summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJens Arnold <amiconn@rockbox.org>2006-12-12 22:22:21 +0000
committerJens Arnold <amiconn@rockbox.org>2006-12-12 22:22:21 +0000
commit314f3b58f18ccbc8f5a39897681bc8579cd330d1 (patch)
treeb56b1ca14e372738b171d81c8f0ae4ac9429cc13
parent819712f118a3e036da7042199c6d7197416ddbee (diff)
downloadrockbox-314f3b58f18ccbc8f5a39897681bc8579cd330d1.tar.gz
rockbox-314f3b58f18ccbc8f5a39897681bc8579cd330d1.zip
More static'ing, and a few fixes resulting from that.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@11737 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r--apps/abrepeat.c2
-rw-r--r--apps/abrepeat.h4
-rw-r--r--apps/debug_menu.c77
-rw-r--r--apps/debug_menu.h3
-rw-r--r--apps/dsp.c4
-rw-r--r--apps/eq.c4
-rw-r--r--apps/filetypes.c2
-rw-r--r--apps/main.c14
-rw-r--r--apps/main_menu.c8
-rw-r--r--apps/menu.c4
-rw-r--r--apps/metadata.c51
-rw-r--r--apps/misc.c2
12 files changed, 67 insertions, 108 deletions
diff --git a/apps/abrepeat.c b/apps/abrepeat.c
index fc1913d37b..caf76ff122 100644
--- a/apps/abrepeat.c
+++ b/apps/abrepeat.c
@@ -78,6 +78,7 @@ void ab_repeat_init(void)
78 } 78 }
79} 79}
80 80
81#if 0 /* Currently unused */
81unsigned int ab_get_A_marker(void) 82unsigned int ab_get_A_marker(void)
82{ 83{
83 return ab_A_marker; 84 return ab_A_marker;
@@ -87,6 +88,7 @@ unsigned int ab_get_B_marker(void)
87{ 88{
88 return ab_B_marker; 89 return ab_B_marker;
89} 90}
91#endif /* if 0 */
90 92
91/* determines if the given song position is earlier than the A mark; 93/* determines if the given song position is earlier than the A mark;
92intended for use in handling the jump NEXT and PREV commands */ 94intended for use in handling the jump NEXT and PREV commands */
diff --git a/apps/abrepeat.h b/apps/abrepeat.h
index 143e57b371..d7bed0a990 100644
--- a/apps/abrepeat.h
+++ b/apps/abrepeat.h
@@ -32,9 +32,11 @@
32#include "settings.h" 32#include "settings.h"
33#endif 33#endif
34 34
35void ab_repeat_init(void); 35void ab_repeat_init(void);
36#if 0 /* Currently unused */
36unsigned int ab_get_A_marker(void); 37unsigned int ab_get_A_marker(void);
37unsigned int ab_get_B_marker(void); 38unsigned int ab_get_B_marker(void);
39#endif /* if 0 */
38bool ab_before_A_marker(unsigned int song_position); 40bool ab_before_A_marker(unsigned int song_position);
39bool ab_after_A_marker(unsigned int song_position); 41bool ab_after_A_marker(unsigned int song_position);
40void ab_jump_to_A_marker(void); 42void ab_jump_to_A_marker(void);
diff --git a/apps/debug_menu.c b/apps/debug_menu.c
index 6caae2d7e0..7d1e1c18cf 100644
--- a/apps/debug_menu.c
+++ b/apps/debug_menu.c
@@ -90,7 +90,9 @@ extern int ata_device;
90extern int ata_io_address; 90extern int ata_io_address;
91extern struct core_entry cores[NUM_CORES]; 91extern struct core_entry cores[NUM_CORES];
92 92
93char thread_status_char(int status) 93#ifndef SIMULATOR
94#ifdef HAVE_LCD_BITMAP
95static char thread_status_char(int status)
94{ 96{
95 switch (status) 97 switch (status)
96 { 98 {
@@ -102,10 +104,9 @@ char thread_status_char(int status)
102 104
103 return '?'; 105 return '?';
104} 106}
105#ifndef SIMULATOR 107
106#ifdef HAVE_LCD_BITMAP
107/* Test code!!! */ 108/* Test code!!! */
108bool dbg_os(void) 109static bool dbg_os(void)
109{ 110{
110 struct thread_entry *thread; 111 struct thread_entry *thread;
111 char buf[32]; 112 char buf[32];
@@ -168,7 +169,7 @@ bool dbg_os(void)
168# else 169# else
169 snprintf(buf, 32, "%c%c %s: %d%%", 170 snprintf(buf, 32, "%c%c %s: %d%%",
170 (status == STATE_RUNNING) ? '*' : ' ', 171 (status == STATE_RUNNING) ? '*' : ' ',
171 (status == STATE_BLOCKED) ? 'B' : ' ', 172 thread_status_char(status),
172 cores[CURRENT_CORE].threads[i].name, usage); 173 cores[CURRENT_CORE].threads[i].name, usage);
173# endif 174# endif
174 lcd_puts(0, 1+i, buf); 175 lcd_puts(0, 1+i, buf);
@@ -183,7 +184,7 @@ bool dbg_os(void)
183 return false; 184 return false;
184} 185}
185#else /* !HAVE_LCD_BITMAP */ 186#else /* !HAVE_LCD_BITMAP */
186bool dbg_os(void) 187static bool dbg_os(void)
187{ 188{
188 char buf[32]; 189 char buf[32];
189 int button; 190 int button;
@@ -229,7 +230,7 @@ bool dbg_os(void)
229#ifdef HAVE_LCD_BITMAP 230#ifdef HAVE_LCD_BITMAP
230#if CONFIG_CODEC != SWCODEC 231#if CONFIG_CODEC != SWCODEC
231#ifndef SIMULATOR 232#ifndef SIMULATOR
232bool dbg_audio_thread(void) 233static bool dbg_audio_thread(void)
233{ 234{
234 char buf[32]; 235 char buf[32];
235 struct audio_debug d; 236 struct audio_debug d;
@@ -282,7 +283,7 @@ extern size_t filebuflen;
282 283
283static unsigned int ticks, boost_ticks; 284static unsigned int ticks, boost_ticks;
284 285
285void dbg_audio_task(void) 286static void dbg_audio_task(void)
286{ 287{
287#ifndef SIMULATOR 288#ifndef SIMULATOR
288 if(FREQ > CPUFREQ_NORMAL) 289 if(FREQ > CPUFREQ_NORMAL)
@@ -292,7 +293,7 @@ void dbg_audio_task(void)
292 ticks++; 293 ticks++;
293} 294}
294 295
295bool dbg_audio_thread(void) 296static bool dbg_audio_thread(void)
296{ 297{
297 char buf[32]; 298 char buf[32];
298 int button; 299 int button;
@@ -373,37 +374,18 @@ bool dbg_audio_thread(void)
373#endif /* HAVE_LCD_BITMAP */ 374#endif /* HAVE_LCD_BITMAP */
374 375
375 376
376#ifndef SIMULATOR 377#if (CONFIG_CPU == SH7034 || defined(CPU_COLDFIRE)) && !defined(SIMULATOR)
377/* Tool function to read the flash manufacturer and type, if available. 378/* Tool function to read the flash manufacturer and type, if available.
378 Only chips which could be reprogrammed in system will return values. 379 Only chips which could be reprogrammed in system will return values.
379 (The mode switch addresses vary between flash manufacturers, hence addr1/2) */ 380 (The mode switch addresses vary between flash manufacturers, hence addr1/2) */
380 /* In IRAM to avoid problems when running directly from Flash */ 381 /* In IRAM to avoid problems when running directly from Flash */
381bool dbg_flash_id(unsigned* p_manufacturer, unsigned* p_device, 382static bool dbg_flash_id(unsigned* p_manufacturer, unsigned* p_device,
382 unsigned addr1, unsigned addr2) 383 unsigned addr1, unsigned addr2)
383 ICODE_ATTR; 384 ICODE_ATTR __attribute__((noinline));
384bool dbg_flash_id(unsigned* p_manufacturer, unsigned* p_device, 385static bool dbg_flash_id(unsigned* p_manufacturer, unsigned* p_device,
385 unsigned addr1, unsigned addr2) 386 unsigned addr1, unsigned addr2)
386 387
387{ 388{
388#ifdef CPU_PP
389 /* TODO: Implement for PortalPlayer */
390 (void)p_manufacturer;
391 (void)p_device;
392 (void)addr1;
393 (void)addr2;
394#elif CONFIG_CPU == PNX0101
395 /* TODO: Implement for iFP7xx */
396 (void)p_manufacturer;
397 (void)p_device;
398 (void)addr1;
399 (void)addr2;
400#elif CONFIG_CPU == S3C2440
401 /* TODO: Implement for Gigabeat */
402 (void)p_manufacturer;
403 (void)p_device;
404 (void)addr1;
405 (void)addr2;
406#else
407 unsigned not_manu, not_id; /* read values before switching to ID mode */ 389 unsigned not_manu, not_id; /* read values before switching to ID mode */
408 unsigned manu, id; /* read values when in ID mode */ 390 unsigned manu, id; /* read values when in ID mode */
409 391
@@ -444,14 +426,13 @@ bool dbg_flash_id(unsigned* p_manufacturer, unsigned* p_device,
444 *p_device = id; 426 *p_device = id;
445 return true; /* success */ 427 return true; /* success */
446 } 428 }
447#endif
448 return false; /* fail */ 429 return false; /* fail */
449} 430}
450#endif /* !SIMULATOR */ 431#endif /* (CONFIG_CPU == SH7034 || CPU_COLDFIRE) && !SIMULATOR */
451 432
452#ifndef SIMULATOR 433#ifndef SIMULATOR
453#ifdef HAVE_LCD_BITMAP 434#ifdef HAVE_LCD_BITMAP
454bool dbg_hw_info(void) 435static bool dbg_hw_info(void)
455{ 436{
456#if CONFIG_CPU == SH7034 437#if CONFIG_CPU == SH7034
457 char buf[32]; 438 char buf[32];
@@ -602,7 +583,7 @@ bool dbg_hw_info(void)
602 return false; 583 return false;
603} 584}
604#else /* !HAVE_LCD_BITMAP */ 585#else /* !HAVE_LCD_BITMAP */
605bool dbg_hw_info(void) 586static bool dbg_hw_info(void)
606{ 587{
607 char buf[32]; 588 char buf[32];
608 int button; 589 int button;
@@ -765,7 +746,7 @@ bool dbg_partitions(void)
765#endif 746#endif
766 747
767#if defined(CPU_COLDFIRE) && defined(HAVE_SPDIF_OUT) 748#if defined(CPU_COLDFIRE) && defined(HAVE_SPDIF_OUT)
768bool dbg_spdif(void) 749static bool dbg_spdif(void)
769{ 750{
770 char buf[128]; 751 char buf[128];
771 int line; 752 int line;
@@ -1261,7 +1242,7 @@ bool dbg_ports(void)
1261#endif /* !SIMULATOR */ 1242#endif /* !SIMULATOR */
1262 1243
1263#ifdef HAVE_ADJUSTABLE_CPU_FREQ 1244#ifdef HAVE_ADJUSTABLE_CPU_FREQ
1264bool dbg_cpufreq(void) 1245static bool dbg_cpufreq(void)
1265{ 1246{
1266 char buf[128]; 1247 char buf[128];
1267 int line; 1248 int line;
@@ -1323,7 +1304,7 @@ bool dbg_cpufreq(void)
1323#define BAT_LAST_VAL MIN(LCD_WIDTH, POWER_HISTORY_LEN) 1304#define BAT_LAST_VAL MIN(LCD_WIDTH, POWER_HISTORY_LEN)
1324#define BAT_YSPACE (LCD_HEIGHT - 20) 1305#define BAT_YSPACE (LCD_HEIGHT - 20)
1325 1306
1326bool view_battery(void) 1307static bool view_battery(void)
1327{ 1308{
1328 int view = 0; 1309 int view = 0;
1329 int i, x, y; 1310 int i, x, y;
@@ -1590,7 +1571,7 @@ static bool view_runtime(void)
1590 1571
1591#ifndef SIMULATOR 1572#ifndef SIMULATOR
1592#ifdef HAVE_MMC 1573#ifdef HAVE_MMC
1593bool dbg_mmc_info(void) 1574static bool dbg_mmc_info(void)
1594{ 1575{
1595 bool done = false; 1576 bool done = false;
1596 int currval = 0; 1577 int currval = 0;
@@ -1970,7 +1951,7 @@ static bool dbg_tagcache_info(void)
1970#endif 1951#endif
1971 1952
1972#if CONFIG_CPU == SH7034 1953#if CONFIG_CPU == SH7034
1973bool dbg_save_roms(void) 1954static bool dbg_save_roms(void)
1974{ 1955{
1975 int fd; 1956 int fd;
1976 int oldmode = system_memory_guard(MEMGUARD_NONE); 1957 int oldmode = system_memory_guard(MEMGUARD_NONE);
@@ -1993,7 +1974,7 @@ bool dbg_save_roms(void)
1993 return false; 1974 return false;
1994} 1975}
1995#elif defined CPU_COLDFIRE 1976#elif defined CPU_COLDFIRE
1996bool dbg_save_roms(void) 1977static bool dbg_save_roms(void)
1997{ 1978{
1998 int fd; 1979 int fd;
1999 int oldmode = system_memory_guard(MEMGUARD_NONE); 1980 int oldmode = system_memory_guard(MEMGUARD_NONE);
@@ -2042,7 +2023,7 @@ bool dbg_save_roms(void)
2042 2023
2043#ifndef SIMULATOR 2024#ifndef SIMULATOR
2044#ifdef CONFIG_TUNER 2025#ifdef CONFIG_TUNER
2045bool dbg_fm_radio(void) 2026static bool dbg_fm_radio(void)
2046{ 2027{
2047 char buf[32]; 2028 char buf[32];
2048 bool fm_detected; 2029 bool fm_detected;
@@ -2086,7 +2067,7 @@ bool dbg_fm_radio(void)
2086#ifdef HAVE_LCD_BITMAP 2067#ifdef HAVE_LCD_BITMAP
2087extern bool do_screendump_instead_of_usb; 2068extern bool do_screendump_instead_of_usb;
2088 2069
2089bool dbg_screendump(void) 2070static bool dbg_screendump(void)
2090{ 2071{
2091 do_screendump_instead_of_usb = !do_screendump_instead_of_usb; 2072 do_screendump_instead_of_usb = !do_screendump_instead_of_usb;
2092 gui_syncsplash(HZ, true, "Screendump %s", 2073 gui_syncsplash(HZ, true, "Screendump %s",
@@ -2096,7 +2077,7 @@ bool dbg_screendump(void)
2096#endif /* HAVE_LCD_BITMAP */ 2077#endif /* HAVE_LCD_BITMAP */
2097 2078
2098#if CONFIG_CPU == SH7034 || defined(CPU_COLDFIRE) 2079#if CONFIG_CPU == SH7034 || defined(CPU_COLDFIRE)
2099bool dbg_set_memory_guard(void) 2080static bool dbg_set_memory_guard(void)
2100{ 2081{
2101 static const struct opt_items names[MAXMEMGUARD] = { 2082 static const struct opt_items names[MAXMEMGUARD] = {
2102 { "None", -1 }, 2083 { "None", -1 },
@@ -2113,7 +2094,7 @@ bool dbg_set_memory_guard(void)
2113#endif /* CONFIG_CPU == SH7034 || defined(CPU_COLDFIRE) */ 2094#endif /* CONFIG_CPU == SH7034 || defined(CPU_COLDFIRE) */
2114 2095
2115#if defined(HAVE_EEPROM) && !defined(HAVE_EEPROM_SETTINGS) 2096#if defined(HAVE_EEPROM) && !defined(HAVE_EEPROM_SETTINGS)
2116bool dbg_write_eeprom(void) 2097static bool dbg_write_eeprom(void)
2117{ 2098{
2118 int fd; 2099 int fd;
2119 int rc; 2100 int rc;
diff --git a/apps/debug_menu.h b/apps/debug_menu.h
index 629d0712c6..d1a49294da 100644
--- a/apps/debug_menu.h
+++ b/apps/debug_menu.h
@@ -24,9 +24,6 @@ bool debug_menu(void);
24#ifndef SIMULATOR 24#ifndef SIMULATOR
25extern bool dbg_ports(void); 25extern bool dbg_ports(void);
26extern bool dbg_partitions(void); 26extern bool dbg_partitions(void);
27#ifdef CONFIG_RTC
28extern bool dbg_rtc(void);
29#endif
30#endif 27#endif
31 28
32#endif 29#endif
diff --git a/apps/dsp.c b/apps/dsp.c
index 21bd00eb52..81a1d29e11 100644
--- a/apps/dsp.c
+++ b/apps/dsp.c
@@ -226,7 +226,7 @@ static int channels_mode = 0;
226static int32_t sw_gain, sw_cross; 226static int32_t sw_gain, sw_cross;
227 227
228extern int current_codec; 228extern int current_codec;
229struct dsp_config *dsp; 229static struct dsp_config *dsp;
230 230
231/* The internal format is 32-bit samples, non-interleaved, stereo. This 231/* The internal format is 32-bit samples, non-interleaved, stereo. This
232 * format is similar to the raw output from several codecs, so the amount 232 * format is similar to the raw output from several codecs, so the amount
@@ -563,7 +563,7 @@ void dsp_set_crossfeed_cross_params(long lf_gain, long hf_gain, long cutoff)
563 * to listen to on headphones with no crossfeed. 563 * to listen to on headphones with no crossfeed.
564 */ 564 */
565#ifndef DSP_HAVE_ASM_CROSSFEED 565#ifndef DSP_HAVE_ASM_CROSSFEED
566void apply_crossfeed(int32_t* src[], int count) 566static void apply_crossfeed(int32_t* src[], int count)
567{ 567{
568 int32_t *hist_l = &crossfeed_data.history[0]; 568 int32_t *hist_l = &crossfeed_data.history[0];
569 int32_t *hist_r = &crossfeed_data.history[2]; 569 int32_t *hist_r = &crossfeed_data.history[2];
diff --git a/apps/eq.c b/apps/eq.c
index ac2e51daee..bf562c73f2 100644
--- a/apps/eq.c
+++ b/apps/eq.c
@@ -101,7 +101,7 @@ static const unsigned long atan_table[] = {
101 * @return sin of phase, value is a signed value from LONG_MIN to LONG_MAX, 101 * @return sin of phase, value is a signed value from LONG_MIN to LONG_MAX,
102 * representing -1 and 1 respectively. 102 * representing -1 and 1 respectively.
103 */ 103 */
104long fsincos(unsigned long phase, long *cos) { 104static long fsincos(unsigned long phase, long *cos) {
105 int32_t x, x1, y, y1; 105 int32_t x, x1, y, y1;
106 unsigned long z, z1; 106 unsigned long z, z1;
107 int i; 107 int i;
@@ -164,7 +164,7 @@ static long fsqrt(long a, unsigned int fracbits)
164 return b; 164 return b;
165} 165}
166 166
167short dbtoatab[49] = { 167static const short dbtoatab[49] = {
168 2058, 2180, 2309, 2446, 2591, 2744, 2907, 3079, 3261, 3455, 3659, 3876, 168 2058, 2180, 2309, 2446, 2591, 2744, 2907, 3079, 3261, 3455, 3659, 3876,
169 4106, 4349, 4607, 4880, 5169, 5475, 5799, 6143, 6507, 6893, 7301, 7734, 169 4106, 4349, 4607, 4880, 5169, 5475, 5799, 6143, 6507, 6893, 7301, 7734,
170 8192, 8677, 9192, 9736, 10313, 10924, 11572, 12257, 12983, 13753, 14568, 170 8192, 8677, 9192, 9736, 10313, 10924, 11572, 12257, 12983, 13753, 14568,
diff --git a/apps/filetypes.c b/apps/filetypes.c
index 573e640da1..c26b50bb0f 100644
--- a/apps/filetypes.c
+++ b/apps/filetypes.c
@@ -537,7 +537,7 @@ static int add_plugin(char *plugin)
537} 537}
538 538
539/* read config file (or cahe file) */ 539/* read config file (or cahe file) */
540bool read_config(const char* file) 540static bool read_config(const char* file)
541{ 541{
542 enum {extension, 542 enum {extension,
543 plugin, 543 plugin,
diff --git a/apps/main.c b/apps/main.c
index a107d1cdd0..abc7740919 100644
--- a/apps/main.c
+++ b/apps/main.c
@@ -104,15 +104,19 @@
104 104
105const char appsversion[]=APPSVERSION; 105const char appsversion[]=APPSVERSION;
106 106
107void init(void); 107static void init(void);
108 108
109#ifdef SIMULATOR
109void app_main(void) 110void app_main(void)
111#else
112static void app_main(void)
113#endif
110{ 114{
111 init(); 115 init();
112 browse_root(); 116 browse_root();
113} 117}
114 118
115int init_dircache(bool preinit) 119static int init_dircache(bool preinit)
116{ 120{
117#ifdef HAVE_DIRCACHE 121#ifdef HAVE_DIRCACHE
118 int result = 0; 122 int result = 0;
@@ -174,7 +178,7 @@ int init_dircache(bool preinit)
174} 178}
175 179
176#ifdef HAVE_TAGCACHE 180#ifdef HAVE_TAGCACHE
177void init_tagcache(void) 181static void init_tagcache(void)
178{ 182{
179 bool clear = false; 183 bool clear = false;
180 184
@@ -213,7 +217,7 @@ void init_tagcache(void)
213 217
214#ifdef SIMULATOR 218#ifdef SIMULATOR
215 219
216void init(void) 220static void init(void)
217{ 221{
218 init_threads(); 222 init_threads();
219 buffer_init(); 223 buffer_init();
@@ -273,7 +277,7 @@ void init(void)
273 277
274#else 278#else
275 279
276void init(void) 280static void init(void)
277{ 281{
278 int rc; 282 int rc;
279 bool mounted = false; 283 bool mounted = false;
diff --git a/apps/main_menu.c b/apps/main_menu.c
index 4af2f1a4f3..952586465f 100644
--- a/apps/main_menu.c
+++ b/apps/main_menu.c
@@ -56,7 +56,7 @@
56#include "recording.h" 56#include "recording.h"
57#endif 57#endif
58 58
59bool show_credits(void) 59static bool show_credits(void)
60{ 60{
61 plugin_load("/.rockbox/rocks/credits.rock",NULL); 61 plugin_load("/.rockbox/rocks/credits.rock",NULL);
62 return false; 62 return false;
@@ -72,7 +72,7 @@ extern bool simulate_usb(void);
72#define SIZE_FMT "%s %s" 72#define SIZE_FMT "%s %s"
73#endif 73#endif
74 74
75bool show_info(void) 75static bool show_info(void)
76{ 76{
77 char s[64], s1[32]; 77 char s[64], s1[32];
78 unsigned long size, free; 78 unsigned long size, free;
@@ -340,7 +340,7 @@ bool rec_menu(void)
340} 340}
341#endif 341#endif
342 342
343bool info_menu(void) 343static bool info_menu(void)
344{ 344{
345 int m; 345 int m;
346 bool result; 346 bool result;
@@ -374,7 +374,7 @@ static bool do_shutdown(void)
374 return false; 374 return false;
375} 375}
376#endif 376#endif
377 377
378bool main_menu(void) 378bool main_menu(void)
379{ 379{
380 int m; 380 int m;
diff --git a/apps/menu.c b/apps/menu.c
index faed2cc88a..261286b8fa 100644
--- a/apps/menu.c
+++ b/apps/menu.c
@@ -65,14 +65,14 @@ struct menu {
65static struct menu menus[MAX_MENUS]; 65static struct menu menus[MAX_MENUS];
66static bool inuse[MAX_MENUS] = { false }; 66static bool inuse[MAX_MENUS] = { false };
67 67
68char * menu_get_itemname(int selected_item, void * data, char *buffer) 68static char * menu_get_itemname(int selected_item, void * data, char *buffer)
69{ 69{
70 struct menu *local_menus=(struct menu *)data; 70 struct menu *local_menus=(struct menu *)data;
71 (void)buffer; 71 (void)buffer;
72 return(P2STR(local_menus->items[selected_item].desc)); 72 return(P2STR(local_menus->items[selected_item].desc));
73} 73}
74 74
75int menu_find_free(void) 75static int menu_find_free(void)
76{ 76{
77 int i; 77 int i;
78 /* Tries to find an unused slot to put the new menu */ 78 /* Tries to find an unused slot to put the new menu */
diff --git a/apps/metadata.c b/apps/metadata.c
index dcbc29e73c..83c29649a1 100644
--- a/apps/metadata.c
+++ b/apps/metadata.c
@@ -194,11 +194,12 @@ static void convert_endian(void *data, const char *format)
194 } 194 }
195} 195}
196 196
197#if 0 /* not needed atm */
197/* Read an unsigned 16-bit integer from a big-endian file. */ 198/* Read an unsigned 16-bit integer from a big-endian file. */
198#ifdef ROCKBOX_BIG_ENDIAN 199#ifdef ROCKBOX_BIG_ENDIAN
199#define read_uint16be(fd, buf) read((fd), (buf), 2) 200#define read_uint16be(fd, buf) read((fd), (buf), 2)
200#else 201#else
201int read_uint16be(int fd, unsigned short* buf) 202static int read_uint16be(int fd, unsigned short* buf)
202{ 203{
203 size_t n; 204 size_t n;
204 205
@@ -207,12 +208,13 @@ int read_uint16be(int fd, unsigned short* buf)
207 return n; 208 return n;
208} 209}
209#endif 210#endif
211#endif /* if 0 */
210 212
211/* Read an unsigned 32-bit integer from a big-endian file. */ 213/* Read an unsigned 32-bit integer from a big-endian file. */
212#ifdef ROCKBOX_BIG_ENDIAN 214#ifdef ROCKBOX_BIG_ENDIAN
213#define read_uint32be(fd,buf) read((fd), (buf), 4) 215#define read_uint32be(fd,buf) read((fd), (buf), 4)
214#else 216#else
215int read_uint32be(int fd, unsigned int* buf) 217static int read_uint32be(int fd, unsigned int* buf)
216{ 218{
217 size_t n; 219 size_t n;
218 220
@@ -238,35 +240,6 @@ static unsigned long get_long_be(void* buf)
238 return (p[0] << 24) | (p[1] << 16) | (p[2] << 8) | p[3]; 240 return (p[0] << 24) | (p[1] << 16) | (p[2] << 8) | p[3];
239} 241}
240 242
241/* Read a string tag from an M4A file */
242void read_m4a_tag_string(int fd, int len,char** bufptr,size_t* bytes_remaining, char** dest)
243{
244 int data_length;
245
246 if (bytes_remaining==0) {
247 lseek(fd,len,SEEK_CUR); /* Skip everything */
248 } else {
249 /* Skip the data tag header - maybe we should parse it properly? */
250 lseek(fd,16,SEEK_CUR);
251 len-=16;
252
253 *dest=*bufptr;
254 if ((size_t)len+1 > *bytes_remaining) {
255 read(fd,*bufptr,*bytes_remaining-1);
256 lseek(fd,len-(*bytes_remaining-1),SEEK_CUR);
257 *bufptr+=(*bytes_remaining-1);
258 } else {
259 read(fd,*bufptr,len);
260 *bufptr+=len;
261 }
262 **bufptr=(char)0;
263
264 data_length = strlen(*dest)+1;
265 *bufptr=(*dest)+data_length;
266 *bytes_remaining-=data_length;
267 }
268}
269
270/* Parse the tag (the name-value pair) and fill id3 and buffer accordingly. 243/* Parse the tag (the name-value pair) and fill id3 and buffer accordingly.
271 * String values to keep are written to buf. Returns number of bytes written 244 * String values to keep are written to buf. Returns number of bytes written
272 * to buf (including end nil). 245 * to buf (including end nil).
@@ -953,8 +926,8 @@ static bool get_wave_metadata(int fd, struct mp3entry* id3)
953/* Read the tag data from an MP4 file, storing up to buffer_size bytes in 926/* Read the tag data from an MP4 file, storing up to buffer_size bytes in
954 * buffer. 927 * buffer.
955 */ 928 */
956unsigned long read_mp4_tag(int fd, unsigned int size_left, char* buffer, 929static unsigned long read_mp4_tag(int fd, unsigned int size_left, char* buffer,
957 unsigned int buffer_left) 930 unsigned int buffer_left)
958{ 931{
959 unsigned int bytes_read = 0; 932 unsigned int bytes_read = 0;
960 933
@@ -985,8 +958,8 @@ unsigned long read_mp4_tag(int fd, unsigned int size_left, char* buffer,
985} 958}
986 959
987/* Read a string tag from an MP4 file */ 960/* Read a string tag from an MP4 file */
988unsigned int read_mp4_tag_string(int fd, int size_left, char** buffer, 961static unsigned int read_mp4_tag_string(int fd, int size_left, char** buffer,
989 unsigned int* buffer_left, char** dest) 962 unsigned int* buffer_left, char** dest)
990{ 963{
991 unsigned int bytes_read = read_mp4_tag(fd, size_left, *buffer, 964 unsigned int bytes_read = read_mp4_tag(fd, size_left, *buffer,
992 *buffer_left - 1); 965 *buffer_left - 1);
@@ -1009,7 +982,7 @@ unsigned int read_mp4_tag_string(int fd, int size_left, char** buffer,
1009} 982}
1010 983
1011static unsigned int read_mp4_atom(int fd, unsigned int* size, 984static unsigned int read_mp4_atom(int fd, unsigned int* size,
1012 unsigned int* type, unsigned int size_left) 985 unsigned int* type, unsigned int size_left)
1013{ 986{
1014 read_uint32be(fd, size); 987 read_uint32be(fd, size);
1015 read_uint32be(fd, type); 988 read_uint32be(fd, type);
@@ -1177,7 +1150,7 @@ static bool read_mp4_esds(int fd, struct mp3entry* id3,
1177} 1150}
1178 1151
1179static bool read_mp4_tags(int fd, struct mp3entry* id3, 1152static bool read_mp4_tags(int fd, struct mp3entry* id3,
1180 unsigned int size_left) 1153 unsigned int size_left)
1181{ 1154{
1182 unsigned int size; 1155 unsigned int size;
1183 unsigned int type; 1156 unsigned int type;
@@ -1300,7 +1273,7 @@ static bool read_mp4_tags(int fd, struct mp3entry* id3,
1300} 1273}
1301 1274
1302static bool read_mp4_container(int fd, struct mp3entry* id3, 1275static bool read_mp4_container(int fd, struct mp3entry* id3,
1303 unsigned int size_left) 1276 unsigned int size_left)
1304{ 1277{
1305 unsigned int size; 1278 unsigned int size;
1306 unsigned int type; 1279 unsigned int type;
@@ -1858,7 +1831,7 @@ unsigned int probe_file_format(const char *filename)
1858 * file that would prevent playback. 1831 * file that would prevent playback.
1859 */ 1832 */
1860bool get_metadata(struct track_info* track, int fd, const char* trackname, 1833bool get_metadata(struct track_info* track, int fd, const char* trackname,
1861 bool v1first) 1834 bool v1first)
1862{ 1835{
1863#if CONFIG_CODEC == SWCODEC 1836#if CONFIG_CODEC == SWCODEC
1864 unsigned char* buf; 1837 unsigned char* buf;
diff --git a/apps/misc.c b/apps/misc.c
index 75c4910d40..155027b1bf 100644
--- a/apps/misc.c
+++ b/apps/misc.c
@@ -703,7 +703,7 @@ void car_adapter_mode_init(void)
703#endif 703#endif
704 704
705#ifdef HAVE_HEADPHONE_DETECTION 705#ifdef HAVE_HEADPHONE_DETECTION
706void unplug_change(bool inserted) 706static void unplug_change(bool inserted)
707{ 707{
708 if (global_settings.unplug_mode) 708 if (global_settings.unplug_mode)
709 { 709 {