summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--bootloader/iaudio_coldfire.c1
-rw-r--r--firmware/common/file_internal.c3
-rw-r--r--firmware/common/unicode.c28
-rw-r--r--firmware/export/config.h1
-rw-r--r--firmware/include/string-extra.h3
-rw-r--r--firmware/storage.c2
-rw-r--r--firmware/target/hosted/filesystem-app.c4
-rw-r--r--firmware/target/hosted/filesystem-hosted.h1
8 files changed, 33 insertions, 10 deletions
diff --git a/bootloader/iaudio_coldfire.c b/bootloader/iaudio_coldfire.c
index 2f31958a87..953e649b9a 100644
--- a/bootloader/iaudio_coldfire.c
+++ b/bootloader/iaudio_coldfire.c
@@ -40,6 +40,7 @@
40#include "panic.h" 40#include "panic.h"
41#include "power.h" 41#include "power.h"
42#include "powermgmt.h" 42#include "powermgmt.h"
43#include "file_internal.h"
43#include "file.h" 44#include "file.h"
44#include "version.h" 45#include "version.h"
45#include "loader_strerror.h" 46#include "loader_strerror.h"
diff --git a/firmware/common/file_internal.c b/firmware/common/file_internal.c
index ebe77f0c9f..e5b43cd19d 100644
--- a/firmware/common/file_internal.c
+++ b/firmware/common/file_internal.c
@@ -36,7 +36,8 @@
36 36
37/* for internal functions' scanning use to save quite a bit of stack space - 37/* for internal functions' scanning use to save quite a bit of stack space -
38 access must be serialized by the writer lock */ 38 access must be serialized by the writer lock */
39#if defined(CPU_SH) || defined(IAUDIO_M5) 39#if defined(CPU_SH) || defined(IAUDIO_M5) \
40 || CONFIG_CPU == IMX233
40/* otherwise, out of IRAM */ 41/* otherwise, out of IRAM */
41struct fat_direntry dir_fatent; 42struct fat_direntry dir_fatent;
42#else 43#else
diff --git a/firmware/common/unicode.c b/firmware/common/unicode.c
index 954ad47e1d..8988686b70 100644
--- a/firmware/common/unicode.c
+++ b/firmware/common/unicode.c
@@ -54,6 +54,7 @@
54#else /* APPLICATION */ 54#else /* APPLICATION */
55#ifdef __PCTOOL__ 55#ifdef __PCTOOL__
56#define yield() 56#define yield()
57#define DEFAULT_CP_STATIC_ALLOC
57#endif 58#endif
58#define open_noiso_internal open 59#define open_noiso_internal open
59#endif /* !APPLICATION */ 60#endif /* !APPLICATION */
@@ -182,6 +183,23 @@ const char *get_current_codepage_name_linux(void)
182} 183}
183#endif /* defined(APPLICATION) && defined(__linux__) */ 184#endif /* defined(APPLICATION) && defined(__linux__) */
184 185
186#ifdef DEFAULT_CP_STATIC_ALLOC
187static unsigned short default_cp_table_buf[MAX_CP_TABLE_SIZE+1];
188#define cp_table_get_data(handle) \
189 default_cp_table_buf
190#define cp_table_free(handle) \
191 do {} while (0)
192#define cp_table_alloc(filename, size, opsp) \
193 ({ (void)(opsp); 1; })
194#else
195#define cp_table_alloc(filename, size, opsp) \
196 core_alloc_ex((filename), (size), (opsp))
197#define cp_table_free(handle) \
198 core_free(handle)
199#define cp_table_get_data(handle) \
200 core_get_data(handle)
201#endif
202
185static const unsigned char utf8comp[6] = 203static const unsigned char utf8comp[6] =
186{ 204{
187 0x00, 0xC0, 0xE0, 0xF0, 0xF8, 0xFC 205 0x00, 0xC0, 0xE0, 0xF0, 0xF8, 0xFC
@@ -233,9 +251,9 @@ static int alloc_and_load_cp_table(int cp, void *buf)
233 !(size % (off_t)sizeof (uint16_t))) { 251 !(size % (off_t)sizeof (uint16_t))) {
234 252
235 /* if the buffer is provided, use that but don't alloc */ 253 /* if the buffer is provided, use that but don't alloc */
236 int handle = buf ? 0 : core_alloc_ex(filename, size, &ops); 254 int handle = buf ? 0 : cp_table_alloc(filename, size, &ops);
237 if (handle > 0) 255 if (handle > 0)
238 buf = core_get_data(handle); 256 buf = cp_table_get_data(handle);
239 257
240 if (buf && read(fd, buf, size) == size) { 258 if (buf && read(fd, buf, size) == size) {
241 close(fd); 259 close(fd);
@@ -244,7 +262,7 @@ static int alloc_and_load_cp_table(int cp, void *buf)
244 } 262 }
245 263
246 if (handle > 0) 264 if (handle > 0)
247 core_free(handle); 265 cp_table_free(handle);
248 } 266 }
249 267
250 close(fd); 268 close(fd);
@@ -284,7 +302,7 @@ unsigned char* iso_decode(const unsigned char *iso, unsigned char *utf8,
284 if (tid == default_cp_tid) { 302 if (tid == default_cp_tid) {
285 /* use default table */ 303 /* use default table */
286 if (default_cp_handle > 0) { 304 if (default_cp_handle > 0) {
287 table = core_get_data(default_cp_handle); 305 table = cp_table_get_data(default_cp_handle);
288 default_cp_table_ref++; 306 default_cp_table_ref++;
289 } 307 }
290 308
@@ -564,7 +582,7 @@ void set_codepage(int cp)
564 cp_lock_leave(); 582 cp_lock_leave();
565 583
566 if (handle > 0) 584 if (handle > 0)
567 core_free(handle); 585 cp_table_free(handle);
568} 586}
569 587
570int get_codepage(void) 588int get_codepage(void)
diff --git a/firmware/export/config.h b/firmware/export/config.h
index 2a1cdb3416..b1ee101fe6 100644
--- a/firmware/export/config.h
+++ b/firmware/export/config.h
@@ -584,6 +584,7 @@ Lyre prototype 1 */
584#define CONFIG_CPU 0 584#define CONFIG_CPU 0
585#undef HAVE_MULTIVOLUME 585#undef HAVE_MULTIVOLUME
586#undef HAVE_MULTIDRIVE 586#undef HAVE_MULTIDRIVE
587#undef CONFIG_STORAGE
587#endif 588#endif
588 589
589#ifdef APPLICATION 590#ifdef APPLICATION
diff --git a/firmware/include/string-extra.h b/firmware/include/string-extra.h
index 9ab53d8154..549a018dfc 100644
--- a/firmware/include/string-extra.h
+++ b/firmware/include/string-extra.h
@@ -28,7 +28,8 @@
28#include "strtok_r.h" 28#include "strtok_r.h"
29#include "memset16.h" 29#include "memset16.h"
30 30
31#if defined(WIN32) || defined(APPLICATION) 31#if defined(WIN32) || defined(APPLICATION) \
32 || defined(__PCTOOL__)
32#ifndef mempcpy 33#ifndef mempcpy
33#define mempcpy __builtin_mempcpy 34#define mempcpy __builtin_mempcpy
34#endif 35#endif
diff --git a/firmware/storage.c b/firmware/storage.c
index 7ef7428854..e0b491a5f9 100644
--- a/firmware/storage.c
+++ b/firmware/storage.c
@@ -192,7 +192,7 @@ int storage_num_drives(void)
192 192
193int storage_driver_type(int drive) 193int storage_driver_type(int drive)
194{ 194{
195 if (drive >= num_drives) 195 if ((unsigned int)drive >= num_drives)
196 return -1; 196 return -1;
197 197
198 unsigned int bit = (storage_drivers[drive] & DRIVER_MASK)>>DRIVER_OFFSET; 198 unsigned int bit = (storage_drivers[drive] & DRIVER_MASK)>>DRIVER_OFFSET;
diff --git a/firmware/target/hosted/filesystem-app.c b/firmware/target/hosted/filesystem-app.c
index 7ef8d3109b..a4730a07d9 100644
--- a/firmware/target/hosted/filesystem-app.c
+++ b/firmware/target/hosted/filesystem-app.c
@@ -69,7 +69,7 @@ static const char *handle_special_links(const char* link, unsigned flags,
69{ 69{
70 (void) flags; 70 (void) flags;
71 char vol_string[VOL_MAX_LEN + 1]; 71 char vol_string[VOL_MAX_LEN + 1];
72 get_volume_name(-1, vol_string); 72 int len = get_volume_name(-1, vol_string);
73 73
74 /* link might be passed with or without HOME_DIR expanded. To handle 74 /* link might be passed with or without HOME_DIR expanded. To handle
75 * both perform substring matching (VOL_NAMES is unique enough) */ 75 * both perform substring matching (VOL_NAMES is unique enough) */
@@ -354,7 +354,7 @@ DIR * app_opendir(const char *dirname)
354 354
355#ifdef HAVE_MULTIDRIVE 355#ifdef HAVE_MULTIDRIVE
356 this->volumes_returned = INT_MAX; /* assume NOT $HOME */ 356 this->volumes_returned = INT_MAX; /* assume NOT $HOME */
357 if (rbhome_fildes >= 0 && os_samefile(rbhome_fildes, fd) > 0) 357 if (rbhome_fildes >= 0 && os_fsamefile(rbhome_fildes, this->osfd) > 0)
358 this->volumes_returned = 0; /* there's no place like $HOME */ 358 this->volumes_returned = 0; /* there's no place like $HOME */
359#endif /* HAVE_MULTIDRIVE */ 359#endif /* HAVE_MULTIDRIVE */
360 360
diff --git a/firmware/target/hosted/filesystem-hosted.h b/firmware/target/hosted/filesystem-hosted.h
index 3d979eb19d..5147ef6db6 100644
--- a/firmware/target/hosted/filesystem-hosted.h
+++ b/firmware/target/hosted/filesystem-hosted.h
@@ -63,6 +63,7 @@ bool os_file_exists(const char *ospath);
63#define _FILESYSTEM_HOSTED__DIR_H_ 63#define _FILESYSTEM_HOSTED__DIR_H_
64 64
65#ifndef OSFUNCTIONS_DECLARED 65#ifndef OSFUNCTIONS_DECLARED
66int os_opendirfd(const char *osdirname);
66int os_opendir_and_fd(const char *osdirname, OS_DIR_T **osdirpp, 67int os_opendir_and_fd(const char *osdirname, OS_DIR_T **osdirpp,
67 int *osfdp); 68 int *osfdp);
68 69