diff options
author | Thomas Martitz <kugel@rockbox.org> | 2010-05-06 21:04:40 +0000 |
---|---|---|
committer | Thomas Martitz <kugel@rockbox.org> | 2010-05-06 21:04:40 +0000 |
commit | 50a6ca39ad4ed01922aa4f755f0ca579788226cf (patch) | |
tree | c7881b015b220558167310345b162324c96be15a | |
parent | adb506df14aded06ed6e9ebf8540e6fd383ffd6a (diff) | |
download | rockbox-50a6ca39ad4ed01922aa4f755f0ca579788226cf.tar.gz rockbox-50a6ca39ad4ed01922aa4f755f0ca579788226cf.zip |
Move c/h files implementing/defining standard library stuff into a new libc directory, also standard'ify some parts of the code base (almost entirely #include fixes).
This is to a) to cleanup firmware/common and firmware/include a bit, but also b) for Rockbox as an application which should use the host system's c library and headers, separating makes it easy to exclude our files from the build.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@25850 a1c6a512-1295-4272-9138-f99709370657
194 files changed, 639 insertions, 455 deletions
diff --git a/apps/alarm_menu.c b/apps/alarm_menu.c index 3a44fa472a..1cd0bc4670 100644 --- a/apps/alarm_menu.c +++ b/apps/alarm_menu.c | |||
@@ -25,7 +25,6 @@ | |||
25 | #include "lcd.h" | 25 | #include "lcd.h" |
26 | #include "action.h" | 26 | #include "action.h" |
27 | #include "kernel.h" | 27 | #include "kernel.h" |
28 | #include "sprintf.h" | ||
29 | #include <string.h> | 28 | #include <string.h> |
30 | #include "settings.h" | 29 | #include "settings.h" |
31 | #include "power.h" | 30 | #include "power.h" |
diff --git a/apps/apps.make b/apps/apps.make index 3717c5bd34..8814147102 100644 --- a/apps/apps.make +++ b/apps/apps.make | |||
@@ -15,9 +15,10 @@ SRC += $(call preprocess, $(APPSDIR)/SOURCES) | |||
15 | # to genlang and thus (translated) phrases can be used based on those names. | 15 | # to genlang and thus (translated) phrases can be used based on those names. |
16 | # button.h is included for the HAS_BUTTON_HOLD define. | 16 | # button.h is included for the HAS_BUTTON_HOLD define. |
17 | # | 17 | # |
18 | # Kludge: depends on ctype.o only to depend on config-*.h ... | 18 | # Kludge: depends on config.o which only depends on config-*.h to have config.h |
19 | # changes trigger a genlang re-run | ||
19 | # | 20 | # |
20 | features $(BUILDDIR)/apps/features $(BUILDDIR)/apps/genlang-features: $(APPSDIR)/features.txt $(BUILDDIR)/firmware/common/ctype.o | 21 | features $(BUILDDIR)/apps/features $(BUILDDIR)/apps/genlang-features: $(APPSDIR)/features.txt $(BUILDDIR)/firmware/common/config.o |
21 | $(SILENT)mkdir -p $(BUILDDIR)/apps | 22 | $(SILENT)mkdir -p $(BUILDDIR)/apps |
22 | $(SILENT)mkdir -p $(BUILDDIR)/lang | 23 | $(SILENT)mkdir -p $(BUILDDIR)/lang |
23 | $(call PRINTS,PP $(<F)) | 24 | $(call PRINTS,PP $(<F)) |
diff --git a/apps/bookmark.c b/apps/bookmark.c index c48810c19c..3d8df3ec0b 100644 --- a/apps/bookmark.c +++ b/apps/bookmark.c | |||
@@ -342,7 +342,7 @@ static char* create_bookmark() | |||
342 | /* new optional bookmark token descriptors should be inserted | 342 | /* new optional bookmark token descriptors should be inserted |
343 | just before the "%s;%s" in this line... */ | 343 | just before the "%s;%s" in this line... */ |
344 | #if CONFIG_CODEC == SWCODEC | 344 | #if CONFIG_CODEC == SWCODEC |
345 | ">%d;%d;%ld;%d;%ld;%d;%d;%d;%d;%s;%s", | 345 | ">%d;%d;%ld;%d;%ld;%d;%d;%ld;%ld;%s;%s", |
346 | #else | 346 | #else |
347 | ">%d;%d;%ld;%d;%ld;%d;%d;%s;%s", | 347 | ">%d;%d;%ld;%d;%ld;%d;%d;%s;%s", |
348 | #endif | 348 | #endif |
@@ -360,8 +360,8 @@ static char* create_bookmark() | |||
360 | global_settings.playlist_shuffle, | 360 | global_settings.playlist_shuffle, |
361 | /* ...and their values should go here */ | 361 | /* ...and their values should go here */ |
362 | #if CONFIG_CODEC == SWCODEC | 362 | #if CONFIG_CODEC == SWCODEC |
363 | sound_get_pitch(), | 363 | (long)sound_get_pitch(), |
364 | dsp_get_timestretch(), | 364 | (long)dsp_get_timestretch(), |
365 | #endif | 365 | #endif |
366 | /* more mandatory tokens */ | 366 | /* more mandatory tokens */ |
367 | playlist_get_name(NULL, global_temp_buffer, | 367 | playlist_get_name(NULL, global_temp_buffer, |
diff --git a/apps/buffering.c b/apps/buffering.c index afc7c7ad6b..2c26c6634d 100644 --- a/apps/buffering.c +++ b/apps/buffering.c | |||
@@ -38,7 +38,6 @@ | |||
38 | #include "kernel.h" | 38 | #include "kernel.h" |
39 | #include "tree.h" | 39 | #include "tree.h" |
40 | #include "debug.h" | 40 | #include "debug.h" |
41 | #include "sprintf.h" | ||
42 | #include "settings.h" | 41 | #include "settings.h" |
43 | #include "codecs.h" | 42 | #include "codecs.h" |
44 | #include "audio.h" | 43 | #include "audio.h" |
diff --git a/apps/codecs.c b/apps/codecs.c index b20aa7f969..4d97baacbe 100644 --- a/apps/codecs.c +++ b/apps/codecs.c | |||
@@ -26,12 +26,13 @@ | |||
26 | #include <stdlib.h> | 26 | #include <stdlib.h> |
27 | #include <timefuncs.h> | 27 | #include <timefuncs.h> |
28 | #include <ctype.h> | 28 | #include <ctype.h> |
29 | #include <stdarg.h> | ||
30 | #include "string-extra.h" | ||
29 | #include "debug.h" | 31 | #include "debug.h" |
30 | #include "button.h" | 32 | #include "button.h" |
31 | #include "dir.h" | 33 | #include "dir.h" |
32 | #include "file.h" | 34 | #include "file.h" |
33 | #include "kernel.h" | 35 | #include "kernel.h" |
34 | #include "sprintf.h" | ||
35 | #include "screens.h" | 36 | #include "screens.h" |
36 | #include "misc.h" | 37 | #include "misc.h" |
37 | #include "mas.h" | 38 | #include "mas.h" |
diff --git a/apps/codecs.h b/apps/codecs.h index 34fd3940ad..27c9caba13 100644 --- a/apps/codecs.h +++ b/apps/codecs.h | |||
@@ -31,8 +31,10 @@ | |||
31 | #define MEM 2 | 31 | #define MEM 2 |
32 | #endif | 32 | #endif |
33 | 33 | ||
34 | #include <_ansi.h> | ||
34 | #include <stdbool.h> | 35 | #include <stdbool.h> |
35 | #include <stdlib.h> | 36 | #include <stdlib.h> |
37 | #include "strlcpy.h" | ||
36 | #include "config.h" | 38 | #include "config.h" |
37 | #include "system.h" | 39 | #include "system.h" |
38 | #include "metadata.h" | 40 | #include "metadata.h" |
diff --git a/apps/codecs/adx.c b/apps/codecs/adx.c index fe32653b18..dd5bba16e7 100644 --- a/apps/codecs/adx.c +++ b/apps/codecs/adx.c | |||
@@ -18,6 +18,8 @@ | |||
18 | * KIND, either express or implied. | 18 | * KIND, either express or implied. |
19 | * | 19 | * |
20 | ****************************************************************************/ | 20 | ****************************************************************************/ |
21 | |||
22 | #include <limits.h> | ||
21 | #include "codeclib.h" | 23 | #include "codeclib.h" |
22 | #include "inttypes.h" | 24 | #include "inttypes.h" |
23 | #include "math.h" | 25 | #include "math.h" |
diff --git a/apps/codecs/demac/demac.c b/apps/codecs/demac/demac.c index 5e9893687d..3e97fff2c9 100644 --- a/apps/codecs/demac/demac.c +++ b/apps/codecs/demac/demac.c | |||
@@ -46,7 +46,6 @@ avoided by writing the decoded data one sample at a time. | |||
46 | #include <stdio.h> | 46 | #include <stdio.h> |
47 | #include <inttypes.h> | 47 | #include <inttypes.h> |
48 | #include <stdlib.h> | 48 | #include <stdlib.h> |
49 | #include <sys/types.h> | ||
50 | #include <sys/stat.h> | 49 | #include <sys/stat.h> |
51 | #include <fcntl.h> | 50 | #include <fcntl.h> |
52 | #include <unistd.h> | 51 | #include <unistd.h> |
diff --git a/apps/codecs/demac/libdemac/parser.c b/apps/codecs/demac/libdemac/parser.c index ebde36deed..2af4a292b8 100644 --- a/apps/codecs/demac/libdemac/parser.c +++ b/apps/codecs/demac/libdemac/parser.c | |||
@@ -27,7 +27,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110, USA | |||
27 | #ifndef ROCKBOX | 27 | #ifndef ROCKBOX |
28 | #include <stdio.h> | 28 | #include <stdio.h> |
29 | #include <stdlib.h> | 29 | #include <stdlib.h> |
30 | #include <sys/types.h> | 30 | #include "inttypes.h" |
31 | #include <sys/stat.h> | 31 | #include <sys/stat.h> |
32 | #include <fcntl.h> | 32 | #include <fcntl.h> |
33 | #include <unistd.h> | 33 | #include <unistd.h> |
diff --git a/apps/codecs/demac/wavwrite.c b/apps/codecs/demac/wavwrite.c index 72c7950dd4..71d2b7bb97 100644 --- a/apps/codecs/demac/wavwrite.c +++ b/apps/codecs/demac/wavwrite.c | |||
@@ -25,7 +25,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110, USA | |||
25 | #include <stdio.h> | 25 | #include <stdio.h> |
26 | #include <inttypes.h> | 26 | #include <inttypes.h> |
27 | #include <stdlib.h> | 27 | #include <stdlib.h> |
28 | #include <sys/types.h> | 28 | #include "inttypes.h" |
29 | #include <sys/stat.h> | 29 | #include <sys/stat.h> |
30 | #include <fcntl.h> | 30 | #include <fcntl.h> |
31 | #include <unistd.h> | 31 | #include <unistd.h> |
diff --git a/apps/codecs/lib/codeclib.h b/apps/codecs/lib/codeclib.h index 817d86a6a3..b7685ebbcb 100644 --- a/apps/codecs/lib/codeclib.h +++ b/apps/codecs/lib/codeclib.h | |||
@@ -22,9 +22,10 @@ | |||
22 | #ifndef __CODECLIB_H__ | 22 | #ifndef __CODECLIB_H__ |
23 | #define __CODECLIB_H__ | 23 | #define __CODECLIB_H__ |
24 | 24 | ||
25 | #include <inttypes.h> | ||
26 | #include <string.h> | ||
25 | #include "config.h" | 27 | #include "config.h" |
26 | #include "codecs.h" | 28 | #include "codecs.h" |
27 | #include <sys/types.h> | ||
28 | #include "mdct.h" | 29 | #include "mdct.h" |
29 | #include "fft.h" | 30 | #include "fft.h" |
30 | 31 | ||
@@ -44,6 +45,7 @@ extern unsigned char* filebuf; /* The rest of the MP3 buffer | |||
44 | #define calloc(x,y) codec_calloc(x,y) | 45 | #define calloc(x,y) codec_calloc(x,y) |
45 | #define realloc(x,y) codec_realloc(x,y) | 46 | #define realloc(x,y) codec_realloc(x,y) |
46 | #define free(x) codec_free(x) | 47 | #define free(x) codec_free(x) |
48 | #undef alloca | ||
47 | #define alloca(x) __builtin_alloca(x) | 49 | #define alloca(x) __builtin_alloca(x) |
48 | 50 | ||
49 | void* codec_malloc(size_t size); | 51 | void* codec_malloc(size_t size); |
@@ -59,7 +61,11 @@ void *memmove(void *s1, const void *s2, size_t n); | |||
59 | size_t strlen(const char *s); | 61 | size_t strlen(const char *s); |
60 | char *strcpy(char *dest, const char *src); | 62 | char *strcpy(char *dest, const char *src); |
61 | char *strcat(char *dest, const char *src); | 63 | char *strcat(char *dest, const char *src); |
62 | int strcmp(const char *, const char *); | 64 | |
65 | /* on some platforms strcmp() seems to be a tricky define which | ||
66 | * breaks if we write down strcmp's prototype */ | ||
67 | #undef strcmp | ||
68 | int strcmp(const char *s1, const char *s2); | ||
63 | 69 | ||
64 | void qsort(void *base, size_t nmemb, size_t size, int(*compar)(const void *, const void *)); | 70 | void qsort(void *base, size_t nmemb, size_t size, int(*compar)(const void *, const void *)); |
65 | 71 | ||
diff --git a/apps/codecs/lib/tlsf/src/tlsf.c b/apps/codecs/lib/tlsf/src/tlsf.c index 6d15c3a3f6..570e472607 100644 --- a/apps/codecs/lib/tlsf/src/tlsf.c +++ b/apps/codecs/lib/tlsf/src/tlsf.c | |||
@@ -165,7 +165,7 @@ | |||
165 | #endif | 165 | #endif |
166 | 166 | ||
167 | #if defined(ROCKBOX) && defined(SIMULATOR) || !defined(ROCKBOX) | 167 | #if defined(ROCKBOX) && defined(SIMULATOR) || !defined(ROCKBOX) |
168 | int printf(char*, ...); | 168 | int printf(const char* fmt, ...); |
169 | #define PRINT_MSG(fmt, args...) printf(fmt, ## args) | 169 | #define PRINT_MSG(fmt, args...) printf(fmt, ## args) |
170 | #define ERROR_MSG(fmt, args...) printf(fmt, ## args) | 170 | #define ERROR_MSG(fmt, args...) printf(fmt, ## args) |
171 | #else | 171 | #else |
diff --git a/apps/codecs/lib/tlsf/src/tlsf.h b/apps/codecs/lib/tlsf/src/tlsf.h index 5d016f4369..4feb5c42cc 100644 --- a/apps/codecs/lib/tlsf/src/tlsf.h +++ b/apps/codecs/lib/tlsf/src/tlsf.h | |||
@@ -19,7 +19,7 @@ | |||
19 | #ifndef _TLSF_H_ | 19 | #ifndef _TLSF_H_ |
20 | #define _TLSF_H_ | 20 | #define _TLSF_H_ |
21 | 21 | ||
22 | #include <sys/types.h> | 22 | #include <string.h> /* defines size_t */ |
23 | 23 | ||
24 | extern size_t init_memory_pool(size_t, void *); | 24 | extern size_t init_memory_pool(size_t, void *); |
25 | extern size_t get_used_size(void *); | 25 | extern size_t get_used_size(void *); |
diff --git a/apps/codecs/libatrac/main.c b/apps/codecs/libatrac/main.c index e0a3f8507d..30307c2946 100644 --- a/apps/codecs/libatrac/main.c +++ b/apps/codecs/libatrac/main.c | |||
@@ -1,6 +1,6 @@ | |||
1 | #include <stdio.h> | 1 | #include <stdio.h> |
2 | #include <stdint.h> | 2 | #include <stdint.h> |
3 | #include <sys/types.h> | 3 | #include <inttypes.h> |
4 | #include <sys/stat.h> | 4 | #include <sys/stat.h> |
5 | #include <fcntl.h> | 5 | #include <fcntl.h> |
6 | #include <unistd.h> | 6 | #include <unistd.h> |
diff --git a/apps/codecs/libcook/main.c b/apps/codecs/libcook/main.c index 25e263dd60..928cad298e 100644 --- a/apps/codecs/libcook/main.c +++ b/apps/codecs/libcook/main.c | |||
@@ -19,7 +19,7 @@ | |||
19 | * | 19 | * |
20 | ****************************************************************************/ | 20 | ****************************************************************************/ |
21 | #include <stdint.h> | 21 | #include <stdint.h> |
22 | #include <sys/types.h> | 22 | #include <inttypes.h> |
23 | #include <sys/stat.h> | 23 | #include <sys/stat.h> |
24 | #include <fcntl.h> | 24 | #include <fcntl.h> |
25 | #include <unistd.h> | 25 | #include <unistd.h> |
diff --git a/apps/codecs/libfaad/common.h b/apps/codecs/libfaad/common.h index 658e92f23f..01164e3746 100644 --- a/apps/codecs/libfaad/common.h +++ b/apps/codecs/libfaad/common.h | |||
@@ -185,7 +185,7 @@ typedef float float32_t; | |||
185 | 185 | ||
186 | #include <stdio.h> | 186 | #include <stdio.h> |
187 | #ifdef HAVE_SYS_TYPES_H | 187 | #ifdef HAVE_SYS_TYPES_H |
188 | # include <sys/types.h> | 188 | # include "inttypes.h" |
189 | #endif | 189 | #endif |
190 | #ifdef HAVE_SYS_STAT_H | 190 | #ifdef HAVE_SYS_STAT_H |
191 | # include <sys/stat.h> | 191 | # include <sys/stat.h> |
diff --git a/apps/codecs/libmad/libmad.make b/apps/codecs/libmad/libmad.make index c5b197ead8..331ee8916f 100644 --- a/apps/codecs/libmad/libmad.make +++ b/apps/codecs/libmad/libmad.make | |||
@@ -11,7 +11,7 @@ | |||
11 | # (one for codec, one for mpegplayer) | 11 | # (one for codec, one for mpegplayer) |
12 | # so a little trickery is necessary | 12 | # so a little trickery is necessary |
13 | 13 | ||
14 | MADFLAGS = $(CODECFLAGS) -UDEBUG -DNDEBUG -O2 -I$(APPSDIR)/codecs/libmad | 14 | MADFLAGS = $(CODECFLAGS) -UDEBUG -DNDEBUG -O2 -I$(APPSDIR)/codecs/libmad -DHAVE_LIMITS_H |
15 | MPEGMADFLAGS = $(MADFLAGS) -DMPEGPLAYER | 15 | MPEGMADFLAGS = $(MADFLAGS) -DMPEGPLAYER |
16 | 16 | ||
17 | # libmad | 17 | # libmad |
diff --git a/apps/codecs/libpcm/adpcm_seek.h b/apps/codecs/libpcm/adpcm_seek.h index 66ec390097..2dd3f000b1 100644 --- a/apps/codecs/libpcm/adpcm_seek.h +++ b/apps/codecs/libpcm/adpcm_seek.h | |||
@@ -21,9 +21,9 @@ | |||
21 | #ifndef CODEC_LIBPCM_ADPCM_SEEK_H | 21 | #ifndef CODEC_LIBPCM_ADPCM_SEEK_H |
22 | #define CODEC_LIBPCM_ADPCM_SEEK_H | 22 | #define CODEC_LIBPCM_ADPCM_SEEK_H |
23 | 23 | ||
24 | #include <sys/types.h> | ||
25 | #include <stdbool.h> | 24 | #include <stdbool.h> |
26 | #include <inttypes.h> | 25 | #include <inttypes.h> |
26 | #include <string.h> | ||
27 | 27 | ||
28 | struct adpcm_data { | 28 | struct adpcm_data { |
29 | int16_t pcmdata[2]; | 29 | int16_t pcmdata[2]; |
diff --git a/apps/codecs/libpcm/ima_adpcm_common.c b/apps/codecs/libpcm/ima_adpcm_common.c index ff5051f166..724cce31b0 100644 --- a/apps/codecs/libpcm/ima_adpcm_common.c +++ b/apps/codecs/libpcm/ima_adpcm_common.c | |||
@@ -63,7 +63,7 @@ static const int index_tables[4][16] ICONST_ATTR = { | |||
63 | }; | 63 | }; |
64 | 64 | ||
65 | static int32_t pcmdata[2]; | 65 | static int32_t pcmdata[2]; |
66 | static int8_t index[2]; | 66 | static int8_t indices[2]; |
67 | 67 | ||
68 | static int adpcm_data_size; | 68 | static int adpcm_data_size; |
69 | static uint8_t step_mask; | 69 | static uint8_t step_mask; |
@@ -107,7 +107,7 @@ void set_decode_parameters(int channels, int32_t *init_pcmdata, int8_t *init_ind | |||
107 | for (ch = 0; ch < channels; ch++) | 107 | for (ch = 0; ch < channels; ch++) |
108 | { | 108 | { |
109 | pcmdata[ch] = init_pcmdata[ch]; | 109 | pcmdata[ch] = init_pcmdata[ch]; |
110 | index[ch] = init_index[ch]; | 110 | indices[ch] = init_index[ch]; |
111 | } | 111 | } |
112 | } | 112 | } |
113 | 113 | ||
@@ -121,7 +121,7 @@ int16_t create_pcmdata(int ch, uint8_t nibble) | |||
121 | { | 121 | { |
122 | int check_bit = 1 << step_shift; | 122 | int check_bit = 1 << step_shift; |
123 | int32_t delta = 0; | 123 | int32_t delta = 0; |
124 | int16_t step = step_table[index[ch]]; | 124 | int16_t step = step_table[indices[ch]]; |
125 | 125 | ||
126 | do { | 126 | do { |
127 | if (nibble & check_bit) | 127 | if (nibble & check_bit) |
@@ -136,8 +136,8 @@ int16_t create_pcmdata(int ch, uint8_t nibble) | |||
136 | else | 136 | else |
137 | pcmdata[ch] += delta; | 137 | pcmdata[ch] += delta; |
138 | 138 | ||
139 | index[ch] += use_index_table[nibble & step_mask]; | 139 | indices[ch] += use_index_table[nibble & step_mask]; |
140 | CLIP(index[ch], 0, 88); | 140 | CLIP(indices[ch], 0, 88); |
141 | 141 | ||
142 | CLIP(pcmdata[ch], -32768, 32767); | 142 | CLIP(pcmdata[ch], -32768, 32767); |
143 | 143 | ||
@@ -150,7 +150,7 @@ int16_t create_pcmdata(int ch, uint8_t nibble) | |||
150 | int16_t create_pcmdata_size4(int ch, uint8_t nibble) | 150 | int16_t create_pcmdata_size4(int ch, uint8_t nibble) |
151 | { | 151 | { |
152 | int32_t delta; | 152 | int32_t delta; |
153 | int16_t step = step_table[index[ch]]; | 153 | int16_t step = step_table[indices[ch]]; |
154 | 154 | ||
155 | delta = (step >> 3); | 155 | delta = (step >> 3); |
156 | if (nibble & 4) delta += step; | 156 | if (nibble & 4) delta += step; |
@@ -162,8 +162,8 @@ int16_t create_pcmdata_size4(int ch, uint8_t nibble) | |||
162 | else | 162 | else |
163 | pcmdata[ch] += delta; | 163 | pcmdata[ch] += delta; |
164 | 164 | ||
165 | index[ch] += use_index_table[nibble & 0x07]; | 165 | indices[ch] += use_index_table[nibble & 0x07]; |
166 | CLIP(index[ch], 0, 88); | 166 | CLIP(indices[ch], 0, 88); |
167 | 167 | ||
168 | CLIP(pcmdata[ch], -32768, 32767); | 168 | CLIP(pcmdata[ch], -32768, 32767); |
169 | 169 | ||
diff --git a/apps/codecs/libpcm/ima_adpcm_common.h b/apps/codecs/libpcm/ima_adpcm_common.h index 0a2129bdf2..46fd6083ec 100644 --- a/apps/codecs/libpcm/ima_adpcm_common.h +++ b/apps/codecs/libpcm/ima_adpcm_common.h | |||
@@ -21,7 +21,6 @@ | |||
21 | #ifndef CODEC_LIBPCM_IMA_ADPCM_COMMON_H | 21 | #ifndef CODEC_LIBPCM_IMA_ADPCM_COMMON_H |
22 | #define CODEC_LIBPCM_IMA_ADPCM_COMMON_H | 22 | #define CODEC_LIBPCM_IMA_ADPCM_COMMON_H |
23 | 23 | ||
24 | #include <sys/types.h> | ||
25 | #include <stdbool.h> | 24 | #include <stdbool.h> |
26 | #include <inttypes.h> | 25 | #include <inttypes.h> |
27 | 26 | ||
diff --git a/apps/codecs/libpcm/pcm_common.h b/apps/codecs/libpcm/pcm_common.h index 91c3ab7f1e..90e29c98ee 100644 --- a/apps/codecs/libpcm/pcm_common.h +++ b/apps/codecs/libpcm/pcm_common.h | |||
@@ -21,9 +21,9 @@ | |||
21 | #ifndef CODEC_LIBPCM_PCM_COMMON_H | 21 | #ifndef CODEC_LIBPCM_PCM_COMMON_H |
22 | #define CODEC_LIBPCM_PCM_COMMON_H | 22 | #define CODEC_LIBPCM_PCM_COMMON_H |
23 | 23 | ||
24 | #include <sys/types.h> | ||
25 | #include <stdbool.h> | 24 | #include <stdbool.h> |
26 | #include <inttypes.h> | 25 | #include <inttypes.h> |
26 | #include <string.h> | ||
27 | 27 | ||
28 | /* decoded pcm sample depth (sample 28bit + sign 1bit) */ | 28 | /* decoded pcm sample depth (sample 28bit + sign 1bit) */ |
29 | #define PCM_OUTPUT_DEPTH 29 | 29 | #define PCM_OUTPUT_DEPTH 29 |
diff --git a/apps/codecs/librm/rm.c b/apps/codecs/librm/rm.c index a179688e7a..b543da50d7 100644 --- a/apps/codecs/librm/rm.c +++ b/apps/codecs/librm/rm.c | |||
@@ -32,7 +32,7 @@ | |||
32 | #ifdef TEST | 32 | #ifdef TEST |
33 | #include <fcntl.h> | 33 | #include <fcntl.h> |
34 | #include <unistd.h> | 34 | #include <unistd.h> |
35 | #include <sys/types.h> | 35 | #include "inttypes.h" |
36 | #include <sys/stat.h> | 36 | #include <sys/stat.h> |
37 | 37 | ||
38 | int filesize(int fd) | 38 | int filesize(int fd) |
diff --git a/apps/codecs/libtremor/config-tremor.h b/apps/codecs/libtremor/config-tremor.h index 8a68ce325f..abed96533b 100644 --- a/apps/codecs/libtremor/config-tremor.h +++ b/apps/codecs/libtremor/config-tremor.h | |||
@@ -7,6 +7,7 @@ | |||
7 | #define _ARM_ASSEM_ | 7 | #define _ARM_ASSEM_ |
8 | #endif | 8 | #endif |
9 | 9 | ||
10 | #ifndef BYTE_ORDER | ||
10 | #ifdef ROCKBOX_BIG_ENDIAN | 11 | #ifdef ROCKBOX_BIG_ENDIAN |
11 | #define BIG_ENDIAN 1 | 12 | #define BIG_ENDIAN 1 |
12 | #define LITTLE_ENDIAN 0 | 13 | #define LITTLE_ENDIAN 0 |
@@ -16,6 +17,7 @@ | |||
16 | #define LITTLE_ENDIAN 1 | 17 | #define LITTLE_ENDIAN 1 |
17 | #define BIG_ENDIAN 0 | 18 | #define BIG_ENDIAN 0 |
18 | #endif | 19 | #endif |
20 | #endif | ||
19 | 21 | ||
20 | #ifndef ICODE_ATTR_TREMOR_MDCT | 22 | #ifndef ICODE_ATTR_TREMOR_MDCT |
21 | #define ICODE_ATTR_TREMOR_MDCT ICODE_ATTR | 23 | #define ICODE_ATTR_TREMOR_MDCT ICODE_ATTR |
diff --git a/apps/codecs/libtremor/ctype.c b/apps/codecs/libtremor/ctype.c index 10468bc27d..359be61e5a 100644 --- a/apps/codecs/libtremor/ctype.c +++ b/apps/codecs/libtremor/ctype.c | |||
@@ -1 +1,3 @@ | |||
1 | #include "common/ctype.c" | 1 | #ifndef SIMULATOR |
2 | #include "libc/ctype.c" | ||
3 | #endif | ||
diff --git a/apps/codecs/libwavpack/words.c b/apps/codecs/libwavpack/words.c index 6da716119c..c3ae50dcf4 100644 --- a/apps/codecs/libwavpack/words.c +++ b/apps/codecs/libwavpack/words.c | |||
@@ -141,7 +141,7 @@ void init_words (WavpackStream *wps) | |||
141 | CLEAR (wps->w); | 141 | CLEAR (wps->w); |
142 | } | 142 | } |
143 | 143 | ||
144 | static int mylog2 (unsigned int32_t avalue); | 144 | static int mylog2 (uint32_t avalue); |
145 | 145 | ||
146 | // Read the median log2 values from the specifed metadata structure, convert | 146 | // Read the median log2 values from the specifed metadata structure, convert |
147 | // them back to 32-bit unsigned values and store them. If length is not | 147 | // them back to 32-bit unsigned values and store them. If length is not |
@@ -553,7 +553,7 @@ void send_words (int32_t *buffer, int nsamples, uint32_t flags, | |||
553 | if (sign) | 553 | if (sign) |
554 | value = ~value; | 554 | value = ~value; |
555 | 555 | ||
556 | if ((unsigned int32_t) value < GET_MED (0)) { | 556 | if ((uint32_t) value < GET_MED (0)) { |
557 | ones_count = low = 0; | 557 | ones_count = low = 0; |
558 | high = GET_MED (0) - 1; | 558 | high = GET_MED (0) - 1; |
559 | DEC_MED0 (); | 559 | DEC_MED0 (); |
@@ -709,7 +709,7 @@ void flush_word (struct words_data *w, Bitstream *bs) | |||
709 | // This function returns the log2 for the specified 32-bit unsigned value. | 709 | // This function returns the log2 for the specified 32-bit unsigned value. |
710 | // The maximum value allowed is about 0xff800000 and returns 8447. | 710 | // The maximum value allowed is about 0xff800000 and returns 8447. |
711 | 711 | ||
712 | static int mylog2 (unsigned int32_t avalue) | 712 | static int mylog2 (uint32_t avalue) |
713 | { | 713 | { |
714 | int dbits; | 714 | int dbits; |
715 | 715 | ||
diff --git a/apps/cuesheet.c b/apps/cuesheet.c index cb3ba6569a..c75ea65334 100644 --- a/apps/cuesheet.c +++ b/apps/cuesheet.c | |||
@@ -28,7 +28,6 @@ | |||
28 | #include "audio.h" | 28 | #include "audio.h" |
29 | #include "kernel.h" | 29 | #include "kernel.h" |
30 | #include "logf.h" | 30 | #include "logf.h" |
31 | #include "sprintf.h" | ||
32 | #include "misc.h" | 31 | #include "misc.h" |
33 | #include "screens.h" | 32 | #include "screens.h" |
34 | #include "list.h" | 33 | #include "list.h" |
diff --git a/apps/debug_menu.c b/apps/debug_menu.c index 054bfd4c99..e8104f74dc 100644 --- a/apps/debug_menu.c +++ b/apps/debug_menu.c | |||
@@ -28,7 +28,6 @@ | |||
28 | #include "menu.h" | 28 | #include "menu.h" |
29 | #include "debug_menu.h" | 29 | #include "debug_menu.h" |
30 | #include "kernel.h" | 30 | #include "kernel.h" |
31 | #include "sprintf.h" | ||
32 | #include "structec.h" | 31 | #include "structec.h" |
33 | #include "action.h" | 32 | #include "action.h" |
34 | #include "debug.h" | 33 | #include "debug.h" |
diff --git a/apps/enc_config.c b/apps/enc_config.c index 48ad18f771..ca8aebb451 100644 --- a/apps/enc_config.c +++ b/apps/enc_config.c | |||
@@ -19,7 +19,6 @@ | |||
19 | * | 19 | * |
20 | ****************************************************************************/ | 20 | ****************************************************************************/ |
21 | #include <stdio.h> | 21 | #include <stdio.h> |
22 | #include <sprintf.h> | ||
23 | #include <string.h> | 22 | #include <string.h> |
24 | #include <stdlib.h> | 23 | #include <stdlib.h> |
25 | #include "config.h" | 24 | #include "config.h" |
diff --git a/apps/filetree.c b/apps/filetree.c index e3977e5a44..9ff48dc451 100644 --- a/apps/filetree.c +++ b/apps/filetree.c | |||
@@ -38,7 +38,6 @@ | |||
38 | #include "screens.h" | 38 | #include "screens.h" |
39 | #include "plugin.h" | 39 | #include "plugin.h" |
40 | #include "rolo.h" | 40 | #include "rolo.h" |
41 | #include "sprintf.h" | ||
42 | #include "splash.h" | 41 | #include "splash.h" |
43 | #include "cuesheet.h" | 42 | #include "cuesheet.h" |
44 | #include "filetree.h" | 43 | #include "filetree.h" |
diff --git a/apps/filetypes.c b/apps/filetypes.c index 4aefef1f0d..3c8f4b9a39 100644 --- a/apps/filetypes.c +++ b/apps/filetypes.c | |||
@@ -26,7 +26,6 @@ | |||
26 | #include "string.h" | 26 | #include "string.h" |
27 | #include <ctype.h> | 27 | #include <ctype.h> |
28 | 28 | ||
29 | #include "sprintf.h" | ||
30 | #include "settings.h" | 29 | #include "settings.h" |
31 | #include "debug.h" | 30 | #include "debug.h" |
32 | #include "lang.h" | 31 | #include "lang.h" |
diff --git a/apps/gui/bitmap/list.c b/apps/gui/bitmap/list.c index 10616c9df4..0da67c7c1e 100644 --- a/apps/gui/bitmap/list.c +++ b/apps/gui/bitmap/list.c | |||
@@ -25,7 +25,6 @@ | |||
25 | #include "lcd.h" | 25 | #include "lcd.h" |
26 | #include "font.h" | 26 | #include "font.h" |
27 | #include "button.h" | 27 | #include "button.h" |
28 | #include "sprintf.h" | ||
29 | #include "string.h" | 28 | #include "string.h" |
30 | #include "settings.h" | 29 | #include "settings.h" |
31 | #include "kernel.h" | 30 | #include "kernel.h" |
diff --git a/apps/gui/charcell/list.c b/apps/gui/charcell/list.c index f36d3c9f7d..8eebfe7fa1 100644 --- a/apps/gui/charcell/list.c +++ b/apps/gui/charcell/list.c | |||
@@ -25,7 +25,6 @@ | |||
25 | #include "lcd.h" | 25 | #include "lcd.h" |
26 | #include "font.h" | 26 | #include "font.h" |
27 | #include "button.h" | 27 | #include "button.h" |
28 | #include "sprintf.h" | ||
29 | #include "string.h" | 28 | #include "string.h" |
30 | #include "settings.h" | 29 | #include "settings.h" |
31 | #include "kernel.h" | 30 | #include "kernel.h" |
diff --git a/apps/gui/list.c b/apps/gui/list.c index 11a4c36015..de76310e0b 100644 --- a/apps/gui/list.c +++ b/apps/gui/list.c | |||
@@ -19,11 +19,11 @@ | |||
19 | * | 19 | * |
20 | ****************************************************************************/ | 20 | ****************************************************************************/ |
21 | 21 | ||
22 | #include <stdarg.h> | ||
22 | #include "config.h" | 23 | #include "config.h" |
23 | #include "lcd.h" | 24 | #include "lcd.h" |
24 | #include "font.h" | 25 | #include "font.h" |
25 | #include "button.h" | 26 | #include "button.h" |
26 | #include "sprintf.h" | ||
27 | #include "string.h" | 27 | #include "string.h" |
28 | #include "settings.h" | 28 | #include "settings.h" |
29 | #include "kernel.h" | 29 | #include "kernel.h" |
diff --git a/apps/gui/option_select.c b/apps/gui/option_select.c index 71a28cb520..feed1dc2db 100644 --- a/apps/gui/option_select.c +++ b/apps/gui/option_select.c | |||
@@ -20,10 +20,9 @@ | |||
20 | * | 20 | * |
21 | ****************************************************************************/ | 21 | ****************************************************************************/ |
22 | #include <stdlib.h> | 22 | #include <stdlib.h> |
23 | #include <string.h> | 23 | #include "string-extra.h" |
24 | #include "config.h" | 24 | #include "config.h" |
25 | #include "option_select.h" | 25 | #include "option_select.h" |
26 | #include "sprintf.h" | ||
27 | #include "kernel.h" | 26 | #include "kernel.h" |
28 | #include "lang.h" | 27 | #include "lang.h" |
29 | #include "talk.h" | 28 | #include "talk.h" |
diff --git a/apps/gui/pitchscreen.c b/apps/gui/pitchscreen.c index 77b5739be1..a0058724ec 100644 --- a/apps/gui/pitchscreen.c +++ b/apps/gui/pitchscreen.c | |||
@@ -23,9 +23,8 @@ | |||
23 | #include <string.h> | 23 | #include <string.h> |
24 | #include <stdio.h> | 24 | #include <stdio.h> |
25 | #include <math.h> | 25 | #include <math.h> |
26 | #include <stdlib.h> /* for ABS() */ | 26 | #include <stdlib.h> /* for abs() */ |
27 | #include "config.h" | 27 | #include "config.h" |
28 | #include "sprintf.h" | ||
29 | #include "action.h" | 28 | #include "action.h" |
30 | #include "dsp.h" | 29 | #include "dsp.h" |
31 | #include "sound.h" | 30 | #include "sound.h" |
@@ -248,10 +247,10 @@ static void pitchscreen_draw(struct screen *display, int max_lines, | |||
248 | /* Pitch:XXX.X% */ | 247 | /* Pitch:XXX.X% */ |
249 | if(global_settings.pitch_mode_semitone) | 248 | if(global_settings.pitch_mode_semitone) |
250 | { | 249 | { |
251 | snprintf(buf, sizeof(buf), "%s: %s%ld.%02ld", str(LANG_PITCH), | 250 | snprintf(buf, sizeof(buf), "%s: %s%d.%02d", str(LANG_PITCH), |
252 | semitone >= 0 ? "+" : "-", | 251 | semitone >= 0 ? "+" : "-", |
253 | ABS(semitone / PITCH_SPEED_PRECISION), | 252 | abs(semitone / PITCH_SPEED_PRECISION), |
254 | ABS((semitone % PITCH_SPEED_PRECISION) / | 253 | abs((semitone % PITCH_SPEED_PRECISION) / |
255 | (PITCH_SPEED_PRECISION / 100)) | 254 | (PITCH_SPEED_PRECISION / 100)) |
256 | ); | 255 | ); |
257 | } | 256 | } |
@@ -290,10 +289,10 @@ static void pitchscreen_draw(struct screen *display, int max_lines, | |||
290 | { | 289 | { |
291 | if(global_settings.pitch_mode_semitone) | 290 | if(global_settings.pitch_mode_semitone) |
292 | { | 291 | { |
293 | snprintf(buf, sizeof(buf), "%s%ld.%02ld", | 292 | snprintf(buf, sizeof(buf), "%s%d.%02d", |
294 | semitone >= 0 ? "+" : "-", | 293 | semitone >= 0 ? "+" : "-", |
295 | ABS(semitone / PITCH_SPEED_PRECISION), | 294 | abs(semitone / PITCH_SPEED_PRECISION), |
296 | ABS((semitone % PITCH_SPEED_PRECISION) / | 295 | abs((semitone % PITCH_SPEED_PRECISION) / |
297 | (PITCH_SPEED_PRECISION / 100)) | 296 | (PITCH_SPEED_PRECISION / 100)) |
298 | ); | 297 | ); |
299 | } | 298 | } |
diff --git a/apps/gui/skin_engine/skin_backdrops.c b/apps/gui/skin_engine/skin_backdrops.c index fd786a7882..77de8bdc1a 100644 --- a/apps/gui/skin_engine/skin_backdrops.c +++ b/apps/gui/skin_engine/skin_backdrops.c | |||
@@ -21,9 +21,8 @@ | |||
21 | 21 | ||
22 | #include "config.h" | 22 | #include "config.h" |
23 | #include <stdio.h> | 23 | #include <stdio.h> |
24 | #include <string.h> | ||
25 | #include <stdlib.h> | 24 | #include <stdlib.h> |
26 | 25 | #include "string-extra.h" | |
27 | #include "settings.h" | 26 | #include "settings.h" |
28 | #include "skin_buffer.h" | 27 | #include "skin_buffer.h" |
29 | #include "wps_internals.h" | 28 | #include "wps_internals.h" |
diff --git a/apps/gui/skin_engine/skin_display.c b/apps/gui/skin_engine/skin_display.c index 0d7824aaf6..d3169be43a 100644 --- a/apps/gui/skin_engine/skin_display.c +++ b/apps/gui/skin_engine/skin_display.c | |||
@@ -21,7 +21,7 @@ | |||
21 | ****************************************************************************/ | 21 | ****************************************************************************/ |
22 | #include "config.h" | 22 | #include "config.h" |
23 | #include <stdio.h> | 23 | #include <stdio.h> |
24 | #include <string.h> | 24 | #include "string-extra.h" |
25 | #include "misc.h" | 25 | #include "misc.h" |
26 | #include "font.h" | 26 | #include "font.h" |
27 | #include "system.h" | 27 | #include "system.h" |
diff --git a/apps/gui/skin_engine/skin_tokens.c b/apps/gui/skin_engine/skin_tokens.c index 4ee8c74cdd..6e5a2eae85 100644 --- a/apps/gui/skin_engine/skin_tokens.c +++ b/apps/gui/skin_engine/skin_tokens.c | |||
@@ -21,7 +21,7 @@ | |||
21 | ****************************************************************************/ | 21 | ****************************************************************************/ |
22 | #include "font.h" | 22 | #include "font.h" |
23 | #include <stdio.h> | 23 | #include <stdio.h> |
24 | #include <string.h> | 24 | #include "string-extra.h" |
25 | #include <stdlib.h> | 25 | #include <stdlib.h> |
26 | #include "action.h" | 26 | #include "action.h" |
27 | #include "system.h" | 27 | #include "system.h" |
@@ -247,7 +247,7 @@ const char *get_id3_token(struct wps_token *token, struct mp3entry *id3, | |||
247 | { | 247 | { |
248 | *intval = limit * elapsed / length + 1; | 248 | *intval = limit * elapsed / length + 1; |
249 | } | 249 | } |
250 | snprintf(buf, buf_size, "%d", 100 * elapsed / length); | 250 | snprintf(buf, buf_size, "%lu", 100 * elapsed / length); |
251 | return buf; | 251 | return buf; |
252 | 252 | ||
253 | 253 | ||
@@ -269,7 +269,7 @@ const char *get_id3_token(struct wps_token *token, struct mp3entry *id3, | |||
269 | if ((id3->frequency % 1000) < 100) | 269 | if ((id3->frequency % 1000) < 100) |
270 | snprintf(buf, buf_size, "%ld", id3->frequency / 1000); | 270 | snprintf(buf, buf_size, "%ld", id3->frequency / 1000); |
271 | else | 271 | else |
272 | snprintf(buf, buf_size, "%ld.%d", | 272 | snprintf(buf, buf_size, "%ld.%lu", |
273 | id3->frequency / 1000, | 273 | id3->frequency / 1000, |
274 | (id3->frequency % 1000) / 100); | 274 | (id3->frequency % 1000) / 100); |
275 | return buf; | 275 | return buf; |
@@ -302,12 +302,12 @@ const char *get_id3_token(struct wps_token *token, struct mp3entry *id3, | |||
302 | case WPS_TOKEN_DATABASE_RATING: | 302 | case WPS_TOKEN_DATABASE_RATING: |
303 | if (intval) | 303 | if (intval) |
304 | *intval = id3->rating + 1; | 304 | *intval = id3->rating + 1; |
305 | snprintf(buf, buf_size, "%ld", id3->rating); | 305 | snprintf(buf, buf_size, "%d", id3->rating); |
306 | return buf; | 306 | return buf; |
307 | case WPS_TOKEN_DATABASE_AUTOSCORE: | 307 | case WPS_TOKEN_DATABASE_AUTOSCORE: |
308 | if (intval) | 308 | if (intval) |
309 | *intval = id3->score + 1; | 309 | *intval = id3->score + 1; |
310 | snprintf(buf, buf_size, "%ld", id3->score); | 310 | snprintf(buf, buf_size, "%d", id3->score); |
311 | return buf; | 311 | return buf; |
312 | #endif | 312 | #endif |
313 | 313 | ||
@@ -1064,7 +1064,7 @@ const char *get_token_value(struct gui_wps *gwps, | |||
1064 | break;) | 1064 | break;) |
1065 | } | 1065 | } |
1066 | } | 1066 | } |
1067 | snprintf(buf, buf_size, "%d.%1d", samprk/1000,samprk%1000); | 1067 | snprintf(buf, buf_size, "%lu.%1lu", samprk/1000,samprk%1000); |
1068 | #else /* HWCODEC */ | 1068 | #else /* HWCODEC */ |
1069 | 1069 | ||
1070 | static const char * const freq_strings[] = | 1070 | static const char * const freq_strings[] = |
@@ -1164,7 +1164,7 @@ const char *get_token_value(struct gui_wps *gwps, | |||
1164 | #endif | 1164 | #endif |
1165 | *intval = global_settings.mp3_enc_config.bitrate+1; | 1165 | *intval = global_settings.mp3_enc_config.bitrate+1; |
1166 | } | 1166 | } |
1167 | snprintf(buf, buf_size, "%d", global_settings.mp3_enc_config.bitrate+1); | 1167 | snprintf(buf, buf_size, "%lu", global_settings.mp3_enc_config.bitrate+1); |
1168 | return buf; | 1168 | return buf; |
1169 | } | 1169 | } |
1170 | else | 1170 | else |
diff --git a/apps/gui/statusbar.c b/apps/gui/statusbar.c index bc5570ee4e..901615d98a 100644 --- a/apps/gui/statusbar.c +++ b/apps/gui/statusbar.c | |||
@@ -19,11 +19,11 @@ | |||
19 | * | 19 | * |
20 | ****************************************************************************/ | 20 | ****************************************************************************/ |
21 | 21 | ||
22 | #include <stdio.h> | ||
22 | #include "config.h" | 23 | #include "config.h" |
23 | #include "font.h" | 24 | #include "font.h" |
24 | #include "kernel.h" | 25 | #include "kernel.h" |
25 | #include "string.h" /* for memcmp oO*/ | 26 | #include "string.h" /* for memcmp oO*/ |
26 | #include "sprintf.h" | ||
27 | #include "sound.h" | 27 | #include "sound.h" |
28 | #include "settings.h" | 28 | #include "settings.h" |
29 | #include "viewport.h" | 29 | #include "viewport.h" |
diff --git a/apps/gui/usb_screen.c b/apps/gui/usb_screen.c index 019aec61ff..9895defc2b 100644 --- a/apps/gui/usb_screen.c +++ b/apps/gui/usb_screen.c | |||
@@ -30,7 +30,6 @@ | |||
30 | #include "usb_core.h" | 30 | #include "usb_core.h" |
31 | #ifdef USB_ENABLE_HID | 31 | #ifdef USB_ENABLE_HID |
32 | #include "usb_keymaps.h" | 32 | #include "usb_keymaps.h" |
33 | #include "sprintf.h" | ||
34 | #endif | 33 | #endif |
35 | #endif | 34 | #endif |
36 | #include "settings.h" | 35 | #include "settings.h" |
diff --git a/apps/gui/viewport.c b/apps/gui/viewport.c index 03f004ba87..7d128188c3 100644 --- a/apps/gui/viewport.c +++ b/apps/gui/viewport.c | |||
@@ -41,7 +41,6 @@ | |||
41 | /* all below isn't needed for pc tools (i.e. checkwps/wps editor) | 41 | /* all below isn't needed for pc tools (i.e. checkwps/wps editor) |
42 | * only viewport_parse_viewport() is */ | 42 | * only viewport_parse_viewport() is */ |
43 | #ifndef __PCTOOL__ | 43 | #ifndef __PCTOOL__ |
44 | #include "sprintf.h" | ||
45 | #include "string.h" | 44 | #include "string.h" |
46 | #include "kernel.h" | 45 | #include "kernel.h" |
47 | #include "system.h" | 46 | #include "system.h" |
diff --git a/apps/gui/wps.c b/apps/gui/wps.c index afd7f3f2d0..916ca2cbcf 100644 --- a/apps/gui/wps.c +++ b/apps/gui/wps.c | |||
@@ -31,7 +31,6 @@ | |||
31 | #include "action.h" | 31 | #include "action.h" |
32 | #include "kernel.h" | 32 | #include "kernel.h" |
33 | #include "filetypes.h" | 33 | #include "filetypes.h" |
34 | #include "sprintf.h" | ||
35 | #include "settings.h" | 34 | #include "settings.h" |
36 | #include "skin_engine/skin_engine.h" | 35 | #include "skin_engine/skin_engine.h" |
37 | #include "mp3_playback.h" | 36 | #include "mp3_playback.h" |
diff --git a/apps/main.c b/apps/main.c index 5b9ecdad79..b043dacede 100644 --- a/apps/main.c +++ b/apps/main.c | |||
@@ -49,7 +49,6 @@ | |||
49 | #include "status.h" | 49 | #include "status.h" |
50 | #include "debug_menu.h" | 50 | #include "debug_menu.h" |
51 | #include "version.h" | 51 | #include "version.h" |
52 | #include "sprintf.h" | ||
53 | #include "font.h" | 52 | #include "font.h" |
54 | #include "language.h" | 53 | #include "language.h" |
55 | #include "wps.h" | 54 | #include "wps.h" |
diff --git a/apps/menus/eq_menu.c b/apps/menus/eq_menu.c index 16d5b82c91..066787a896 100644 --- a/apps/menus/eq_menu.c +++ b/apps/menus/eq_menu.c | |||
@@ -35,7 +35,6 @@ | |||
35 | #include "icons.h" | 35 | #include "icons.h" |
36 | #include "font.h" | 36 | #include "font.h" |
37 | #include "lang.h" | 37 | #include "lang.h" |
38 | #include "sprintf.h" | ||
39 | #include "talk.h" | 38 | #include "talk.h" |
40 | #include "misc.h" | 39 | #include "misc.h" |
41 | #include "sound.h" | 40 | #include "sound.h" |
diff --git a/apps/menus/recording_menu.c b/apps/menus/recording_menu.c index 800918b755..daea1ea8fc 100644 --- a/apps/menus/recording_menu.c +++ b/apps/menus/recording_menu.c | |||
@@ -38,7 +38,6 @@ | |||
38 | #include "scrollbar.h" | 38 | #include "scrollbar.h" |
39 | #endif | 39 | #endif |
40 | #include "lang.h" | 40 | #include "lang.h" |
41 | #include "sprintf.h" | ||
42 | #include "talk.h" | 41 | #include "talk.h" |
43 | #include "misc.h" | 42 | #include "misc.h" |
44 | #include "sound.h" | 43 | #include "sound.h" |
diff --git a/apps/menus/settings_menu.c b/apps/menus/settings_menu.c index db2ad78fdc..1007d2aeb0 100644 --- a/apps/menus/settings_menu.c +++ b/apps/menus/settings_menu.c | |||
@@ -35,7 +35,6 @@ | |||
35 | #include "usb.h" | 35 | #include "usb.h" |
36 | #include "splash.h" | 36 | #include "splash.h" |
37 | #include "talk.h" | 37 | #include "talk.h" |
38 | #include "sprintf.h" | ||
39 | #include "powermgmt.h" | 38 | #include "powermgmt.h" |
40 | #if CONFIG_CODEC == SWCODEC | 39 | #if CONFIG_CODEC == SWCODEC |
41 | #include "playback.h" | 40 | #include "playback.h" |
diff --git a/apps/menus/time_menu.c b/apps/menus/time_menu.c index 597f7e0c3a..a529837b07 100644 --- a/apps/menus/time_menu.c +++ b/apps/menus/time_menu.c | |||
@@ -22,9 +22,9 @@ | |||
22 | #include <stdbool.h> | 22 | #include <stdbool.h> |
23 | #include <stddef.h> | 23 | #include <stddef.h> |
24 | #include <limits.h> | 24 | #include <limits.h> |
25 | #include <stdio.h> | ||
25 | #include "config.h" | 26 | #include "config.h" |
26 | #include "string.h" | 27 | #include "string.h" |
27 | #include "sprintf.h" | ||
28 | #include "lang.h" | 28 | #include "lang.h" |
29 | #include "action.h" | 29 | #include "action.h" |
30 | #include "settings.h" | 30 | #include "settings.h" |
@@ -201,7 +201,7 @@ static void draw_timedate(struct viewport *vp, struct screen *display) | |||
201 | } | 201 | } |
202 | 202 | ||
203 | 203 | ||
204 | static struct viewport clock[NB_SCREENS], menu[NB_SCREENS]; | 204 | static struct viewport clock_vps[NB_SCREENS], menu[NB_SCREENS]; |
205 | static bool menu_was_pressed; | 205 | static bool menu_was_pressed; |
206 | static int time_menu_callback(int action, | 206 | static int time_menu_callback(int action, |
207 | const struct menu_item_ex *this_item) | 207 | const struct menu_item_ex *this_item) |
@@ -233,7 +233,7 @@ static int time_menu_callback(int action, | |||
233 | { | 233 | { |
234 | last_redraw = current_tick; | 234 | last_redraw = current_tick; |
235 | FOR_NB_SCREENS(i) | 235 | FOR_NB_SCREENS(i) |
236 | draw_timedate(&clock[i], &screens[i]); | 236 | draw_timedate(&clock_vps[i], &screens[i]); |
237 | } | 237 | } |
238 | return action; | 238 | return action; |
239 | } | 239 | } |
@@ -257,30 +257,30 @@ int time_screen(void* ignored) | |||
257 | 257 | ||
258 | FOR_NB_SCREENS(i) | 258 | FOR_NB_SCREENS(i) |
259 | { | 259 | { |
260 | viewport_set_defaults(&clock[i], i); | 260 | viewport_set_defaults(&clock_vps[i], i); |
261 | #ifdef HAVE_BUTTONBAR | 261 | #ifdef HAVE_BUTTONBAR |
262 | if (global_settings.buttonbar) | 262 | if (global_settings.buttonbar) |
263 | { | 263 | { |
264 | clock[i].height -= BUTTONBAR_HEIGHT; | 264 | clock_vps[i].height -= BUTTONBAR_HEIGHT; |
265 | } | 265 | } |
266 | #endif | 266 | #endif |
267 | nb_lines = viewport_get_nb_lines(&clock[i]); | 267 | nb_lines = viewport_get_nb_lines(&clock_vps[i]); |
268 | 268 | ||
269 | menu[i] = clock[i]; | 269 | menu[i] = clock_vps[i]; |
270 | /* force time to be drawn centered */ | 270 | /* force time to be drawn centered */ |
271 | clock[i].flags |= VP_FLAG_ALIGN_CENTER; | 271 | clock_vps[i].flags |= VP_FLAG_ALIGN_CENTER; |
272 | 272 | ||
273 | font_h = font_get(clock[i].font)->height; | 273 | font_h = font_get(clock_vps[i].font)->height; |
274 | nb_lines -= 2; /* at least 2 lines for menu */ | 274 | nb_lines -= 2; /* at least 2 lines for menu */ |
275 | if (nb_lines > 4) | 275 | if (nb_lines > 4) |
276 | nb_lines = 4; | 276 | nb_lines = 4; |
277 | if (nb_lines >= 2) | 277 | if (nb_lines >= 2) |
278 | clock[i].height = nb_lines*font_h; | 278 | clock_vps[i].height = nb_lines*font_h; |
279 | else /* disable the clock drawing */ | 279 | else /* disable the clock_vps drawing */ |
280 | clock[i].height = 0; | 280 | clock_vps[i].height = 0; |
281 | menu[i].y += clock[i].height; | 281 | menu[i].y += clock_vps[i].height; |
282 | menu[i].height -= clock[i].height; | 282 | menu[i].height -= clock_vps[i].height; |
283 | draw_timedate(&clock[i], &screens[i]); | 283 | draw_timedate(&clock_vps[i], &screens[i]); |
284 | } | 284 | } |
285 | 285 | ||
286 | ret = do_menu(&time_menu, NULL, menu, false); | 286 | ret = do_menu(&time_menu, NULL, menu, false); |
diff --git a/apps/metadata.c b/apps/metadata.c index 1dfc3763c6..2a49392193 100644 --- a/apps/metadata.c +++ b/apps/metadata.c | |||
@@ -19,10 +19,9 @@ | |||
19 | * | 19 | * |
20 | ****************************************************************************/ | 20 | ****************************************************************************/ |
21 | #include <stdio.h> | 21 | #include <stdio.h> |
22 | #include <string.h> | ||
23 | #include <stdlib.h> | 22 | #include <stdlib.h> |
24 | #include <ctype.h> | 23 | #include <ctype.h> |
25 | #include <inttypes.h> | 24 | #include "string-extra.h" |
26 | 25 | ||
27 | #include "debug.h" | 26 | #include "debug.h" |
28 | #include "logf.h" | 27 | #include "logf.h" |
diff --git a/apps/metadata/metadata_common.c b/apps/metadata/metadata_common.c index fd1cd553e8..e1ef9a0d62 100644 --- a/apps/metadata/metadata_common.c +++ b/apps/metadata/metadata_common.c | |||
@@ -19,7 +19,7 @@ | |||
19 | * | 19 | * |
20 | ****************************************************************************/ | 20 | ****************************************************************************/ |
21 | #include <stdio.h> | 21 | #include <stdio.h> |
22 | #include <string.h> | 22 | #include "string-extra.h" |
23 | #include <stdlib.h> | 23 | #include <stdlib.h> |
24 | #include <ctype.h> | 24 | #include <ctype.h> |
25 | #include <inttypes.h> | 25 | #include <inttypes.h> |
diff --git a/apps/metadata/metadata_common.h b/apps/metadata/metadata_common.h index 3962e2cd17..b2c76afb45 100644 --- a/apps/metadata/metadata_common.h +++ b/apps/metadata/metadata_common.h | |||
@@ -18,6 +18,7 @@ | |||
18 | * KIND, either express or implied. | 18 | * KIND, either express or implied. |
19 | * | 19 | * |
20 | ****************************************************************************/ | 20 | ****************************************************************************/ |
21 | #include <inttypes.h> | ||
21 | #include "metadata.h" | 22 | #include "metadata.h" |
22 | 23 | ||
23 | #ifdef ROCKBOX_BIG_ENDIAN | 24 | #ifdef ROCKBOX_BIG_ENDIAN |
diff --git a/apps/metadata/mp3.c b/apps/metadata/mp3.c index 84c565b8be..49d5c7362e 100644 --- a/apps/metadata/mp3.c +++ b/apps/metadata/mp3.c | |||
@@ -30,11 +30,11 @@ | |||
30 | 30 | ||
31 | #include <stdio.h> | 31 | #include <stdio.h> |
32 | #include <stdlib.h> | 32 | #include <stdlib.h> |
33 | #include <string.h> | ||
34 | #include <errno.h> | 33 | #include <errno.h> |
35 | #include <stdbool.h> | 34 | #include <stdbool.h> |
36 | #include <stddef.h> | 35 | #include <stddef.h> |
37 | #include <ctype.h> | 36 | #include <ctype.h> |
37 | #include "string-extra.h" | ||
38 | #include "config.h" | 38 | #include "config.h" |
39 | #include "file.h" | 39 | #include "file.h" |
40 | #include "logf.h" | 40 | #include "logf.h" |
diff --git a/apps/metadata/smaf.c b/apps/metadata/smaf.c index ca5b690e0b..fa12c99fb9 100644 --- a/apps/metadata/smaf.c +++ b/apps/metadata/smaf.c | |||
@@ -18,9 +18,9 @@ | |||
18 | * KIND, either express or implied. | 18 | * KIND, either express or implied. |
19 | * | 19 | * |
20 | ****************************************************************************/ | 20 | ****************************************************************************/ |
21 | #include <string.h> | ||
22 | #include <inttypes.h> | 21 | #include <inttypes.h> |
23 | 22 | ||
23 | #include "string-extra.h" | ||
24 | #include "system.h" | 24 | #include "system.h" |
25 | #include "metadata.h" | 25 | #include "metadata.h" |
26 | #include "metadata_common.h" | 26 | #include "metadata_common.h" |
diff --git a/apps/misc.c b/apps/misc.c index 22f21d2106..3dfc2892ca 100644 --- a/apps/misc.c +++ b/apps/misc.c | |||
@@ -20,17 +20,15 @@ | |||
20 | ****************************************************************************/ | 20 | ****************************************************************************/ |
21 | #include <stdlib.h> | 21 | #include <stdlib.h> |
22 | #include <ctype.h> | 22 | #include <ctype.h> |
23 | #include <string.h> | 23 | #include <stdio.h> |
24 | #include <stdarg.h> | ||
24 | #include <errno.h> | 25 | #include <errno.h> |
26 | #include "string-extra.h" | ||
25 | #include "config.h" | 27 | #include "config.h" |
26 | #include "misc.h" | 28 | #include "misc.h" |
27 | #include "lcd.h" | 29 | #include "lcd.h" |
28 | #include "file.h" | 30 | #include "file.h" |
29 | #ifdef __PCTOOL__ | 31 | #ifndef __PCTOOL__ |
30 | #include <stdarg.h> | ||
31 | #include <stdio.h> | ||
32 | #else | ||
33 | #include "sprintf.h" | ||
34 | #include "lang.h" | 32 | #include "lang.h" |
35 | #include "dir.h" | 33 | #include "dir.h" |
36 | #include "lcd-remote.h" | 34 | #include "lcd-remote.h" |
diff --git a/apps/onplay.c b/apps/onplay.c index 617f523879..009b375871 100644 --- a/apps/onplay.c +++ b/apps/onplay.c | |||
@@ -25,7 +25,6 @@ | |||
25 | #include <stdbool.h> | 25 | #include <stdbool.h> |
26 | 26 | ||
27 | #include "debug.h" | 27 | #include "debug.h" |
28 | #include "sprintf.h" | ||
29 | #include "lcd.h" | 28 | #include "lcd.h" |
30 | #include "dir.h" | 29 | #include "dir.h" |
31 | #include "file.h" | 30 | #include "file.h" |
diff --git a/apps/player/keyboard.c b/apps/player/keyboard.c index e657f36697..1c6dc9bb0d 100644 --- a/apps/player/keyboard.c +++ b/apps/player/keyboard.c | |||
@@ -23,7 +23,6 @@ | |||
23 | #include "kernel.h" | 23 | #include "kernel.h" |
24 | #include "system.h" | 24 | #include "system.h" |
25 | #include "version.h" | 25 | #include "version.h" |
26 | #include "sprintf.h" | ||
27 | #include <string.h> | 26 | #include <string.h> |
28 | #include "settings.h" | 27 | #include "settings.h" |
29 | #include "statusbar.h" | 28 | #include "statusbar.h" |
diff --git a/apps/playlist.c b/apps/playlist.c index da801968ef..21e1eed083 100644 --- a/apps/playlist.c +++ b/apps/playlist.c | |||
@@ -68,15 +68,14 @@ | |||
68 | */ | 68 | */ |
69 | 69 | ||
70 | #include <stdio.h> | 70 | #include <stdio.h> |
71 | #include <stdlib.h> | 71 | #include <stdlib.h> |
72 | #include <string.h> | 72 | #include <ctype.h> |
73 | #include <ctype.h> | 73 | #include "string-extra.h" |
74 | #include "playlist.h" | 74 | #include "playlist.h" |
75 | #include "ata_idle_notify.h" | 75 | #include "ata_idle_notify.h" |
76 | #include "file.h" | 76 | #include "file.h" |
77 | #include "action.h" | 77 | #include "action.h" |
78 | #include "dir.h" | 78 | #include "dir.h" |
79 | #include "sprintf.h" | ||
80 | #include "debug.h" | 79 | #include "debug.h" |
81 | #include "audio.h" | 80 | #include "audio.h" |
82 | #include "lcd.h" | 81 | #include "lcd.h" |
diff --git a/apps/playlist_catalog.c b/apps/playlist_catalog.c index 4f3c8af231..f9a43da411 100644 --- a/apps/playlist_catalog.c +++ b/apps/playlist_catalog.c | |||
@@ -22,7 +22,7 @@ | |||
22 | #include <stdbool.h> | 22 | #include <stdbool.h> |
23 | #include <stdio.h> | 23 | #include <stdio.h> |
24 | #include <stdlib.h> | 24 | #include <stdlib.h> |
25 | #include <string.h> | 25 | #include "string-extra.h" |
26 | #include "action.h" | 26 | #include "action.h" |
27 | #include "dir.h" | 27 | #include "dir.h" |
28 | #include "file.h" | 28 | #include "file.h" |
@@ -36,7 +36,6 @@ | |||
36 | #include "playlist.h" | 36 | #include "playlist.h" |
37 | #include "settings.h" | 37 | #include "settings.h" |
38 | #include "splash.h" | 38 | #include "splash.h" |
39 | #include "sprintf.h" | ||
40 | #include "tree.h" | 39 | #include "tree.h" |
41 | #include "yesno.h" | 40 | #include "yesno.h" |
42 | #include "filetypes.h" | 41 | #include "filetypes.h" |
diff --git a/apps/playlist_viewer.c b/apps/playlist_viewer.c index e2be36ce5d..e0ab3bb9bd 100644 --- a/apps/playlist_viewer.c +++ b/apps/playlist_viewer.c | |||
@@ -24,7 +24,6 @@ | |||
24 | * multi-screen support, rewrote a lot of code | 24 | * multi-screen support, rewrote a lot of code |
25 | */ | 25 | */ |
26 | #include <string.h> | 26 | #include <string.h> |
27 | #include <sprintf.h> | ||
28 | #include "playlist.h" | 27 | #include "playlist.h" |
29 | #include "audio.h" | 28 | #include "audio.h" |
30 | #include "screens.h" | 29 | #include "screens.h" |
diff --git a/apps/plugin.c b/apps/plugin.c index baf9b60eb8..8a32a159b4 100644 --- a/apps/plugin.c +++ b/apps/plugin.c | |||
@@ -21,7 +21,6 @@ | |||
21 | #include "plugin.h" | 21 | #include "plugin.h" |
22 | #include <ctype.h> | 22 | #include <ctype.h> |
23 | #include <string.h> | 23 | #include <string.h> |
24 | #include <sprintf.h> | ||
25 | #include <stdlib.h> | 24 | #include <stdlib.h> |
26 | #include "debug.h" | 25 | #include "debug.h" |
27 | #include "i2c.h" | 26 | #include "i2c.h" |
diff --git a/apps/plugin.h b/apps/plugin.h index 5f594e6cf5..e6e41e1a3f 100644 --- a/apps/plugin.h +++ b/apps/plugin.h | |||
@@ -32,11 +32,13 @@ | |||
32 | #endif | 32 | #endif |
33 | 33 | ||
34 | #include <stdbool.h> | 34 | #include <stdbool.h> |
35 | #include <inttypes.h> | ||
35 | #include <sys/types.h> | 36 | #include <sys/types.h> |
36 | #include <stdarg.h> | 37 | #include <stdarg.h> |
37 | #include <stdio.h> | 38 | #include <stdio.h> |
38 | #include <stdlib.h> | 39 | #include <stdlib.h> |
39 | #include <string.h> | 40 | #include <string.h> |
41 | #include "string-extra.h" | ||
40 | 42 | ||
41 | char* strncpy(char *, const char *, size_t); | 43 | char* strncpy(char *, const char *, size_t); |
42 | void* plugin_get_buffer(size_t *buffer_size); | 44 | void* plugin_get_buffer(size_t *buffer_size); |
@@ -111,6 +113,11 @@ void* plugin_get_buffer(size_t *buffer_size); | |||
111 | #include "usbstack/usb_hid_usage_tables.h" | 113 | #include "usbstack/usb_hid_usage_tables.h" |
112 | #endif | 114 | #endif |
113 | 115 | ||
116 | |||
117 | /* on some platforms strcmp() seems to be a tricky define which | ||
118 | * breaks if we write down strcmp's prototype */ | ||
119 | #undef strcmp | ||
120 | |||
114 | #ifdef PLUGIN | 121 | #ifdef PLUGIN |
115 | 122 | ||
116 | #if defined(DEBUG) || defined(SIMULATOR) | 123 | #if defined(DEBUG) || defined(SIMULATOR) |
@@ -529,7 +536,7 @@ struct plugin_api { | |||
529 | /* strings and memory */ | 536 | /* strings and memory */ |
530 | int (*snprintf)(char *buf, size_t size, const char *fmt, ...) | 537 | int (*snprintf)(char *buf, size_t size, const char *fmt, ...) |
531 | ATTRIBUTE_PRINTF(3, 4); | 538 | ATTRIBUTE_PRINTF(3, 4); |
532 | int (*vsnprintf)(char *buf, int size, const char *fmt, va_list ap); | 539 | int (*vsnprintf)(char *buf, size_t size, const char *fmt, va_list ap); |
533 | char* (*strcpy)(char *dst, const char *src); | 540 | char* (*strcpy)(char *dst, const char *src); |
534 | size_t (*strlcpy)(char *dst, const char *src, size_t length); | 541 | size_t (*strlcpy)(char *dst, const char *src, size_t length); |
535 | size_t (*strlen)(const char *str); | 542 | size_t (*strlen)(const char *str); |
diff --git a/apps/plugins/calculator.c b/apps/plugins/calculator.c index 942f031890..c19d6bbc5b 100644 --- a/apps/plugins/calculator.c +++ b/apps/plugins/calculator.c | |||
@@ -102,6 +102,9 @@ PLUGIN_HEADER | |||
102 | #define X_5_POS (X_4_POS + REC_WIDTH) /* x5 = 110, column 111 left blank */ | 102 | #define X_5_POS (X_4_POS + REC_WIDTH) /* x5 = 110, column 111 left blank */ |
103 | 103 | ||
104 | #define SIGN(x) ((x)<0?-1:1) | 104 | #define SIGN(x) ((x)<0?-1:1) |
105 | #ifndef ABS | ||
106 | #define ABS(a) (((a) < 0) ? -(a) : (a)) | ||
107 | #endif | ||
105 | 108 | ||
106 | /* variable button definitions */ | 109 | /* variable button definitions */ |
107 | #if CONFIG_KEYPAD == RECORDER_PAD | 110 | #if CONFIG_KEYPAD == RECORDER_PAD |
diff --git a/apps/plugins/doom/d_deh.c b/apps/plugins/doom/d_deh.c index d3f7496885..82426c1bab 100644 --- a/apps/plugins/doom/d_deh.c +++ b/apps/plugins/doom/d_deh.c | |||
@@ -44,7 +44,7 @@ | |||
44 | #include "d_think.h" | 44 | #include "d_think.h" |
45 | #include "w_wad.h" | 45 | #include "w_wad.h" |
46 | 46 | ||
47 | #include "sscanf.h" | 47 | #include <stdio.h> /* sscanf */ |
48 | #include "rockmacros.h" | 48 | #include "rockmacros.h" |
49 | 49 | ||
50 | #define TRUE 1 | 50 | #define TRUE 1 |
diff --git a/apps/plugins/doom/doom.make b/apps/plugins/doom/doom.make index bdc32230eb..54a63eb707 100644 --- a/apps/plugins/doom/doom.make +++ b/apps/plugins/doom/doom.make | |||
@@ -13,7 +13,7 @@ DOOMBUILDDIR := $(BUILDDIR)/apps/plugins/doom | |||
13 | ROCKS += $(DOOMBUILDDIR)/doom.rock | 13 | ROCKS += $(DOOMBUILDDIR)/doom.rock |
14 | 14 | ||
15 | DOOM_SRC := $(call preprocess, $(DOOMSRCDIR)/SOURCES) | 15 | DOOM_SRC := $(call preprocess, $(DOOMSRCDIR)/SOURCES) |
16 | DOOM_SRC += $(ROOTDIR)/firmware/common/sscanf.c | 16 | DOOM_SRC += $(ROOTDIR)/firmware/libc/sscanf.c |
17 | DOOM_OBJ := $(call c2obj, $(DOOM_SRC)) | 17 | DOOM_OBJ := $(call c2obj, $(DOOM_SRC)) |
18 | 18 | ||
19 | # add source files to OTHER_SRC to get automatic dependencies | 19 | # add source files to OTHER_SRC to get automatic dependencies |
diff --git a/apps/plugins/doom/rockmacros.h b/apps/plugins/doom/rockmacros.h index e066fe861c..89c943622a 100644 --- a/apps/plugins/doom/rockmacros.h +++ b/apps/plugins/doom/rockmacros.h | |||
@@ -33,9 +33,13 @@ extern bool doomexit; | |||
33 | int printf(const char *fmt, ...); | 33 | int printf(const char *fmt, ...); |
34 | int fileexists(const char * fname); | 34 | int fileexists(const char * fname); |
35 | char *my_strtok( char * s, const char * delim ); | 35 | char *my_strtok( char * s, const char * delim ); |
36 | #undef alloca | ||
36 | #define alloca __builtin_alloca | 37 | #define alloca __builtin_alloca |
37 | #define fdprintf(...) rb->fdprintf(__VA_ARGS__) | 38 | #undef fdprintf |
39 | #define fdprintf(...) rb->fdprintf(__VA_ARGS__) | ||
40 | #undef vsnprintf | ||
38 | #define vsnprintf(...) rb->vsnprintf(__VA_ARGS__) | 41 | #define vsnprintf(...) rb->vsnprintf(__VA_ARGS__) |
42 | #undef read_line | ||
39 | #define read_line(a,b,c) rb->read_line((a),(b),(c)) | 43 | #define read_line(a,b,c) rb->read_line((a),(b),(c)) |
40 | 44 | ||
41 | #ifdef SIMULATOR | 45 | #ifdef SIMULATOR |
@@ -52,19 +56,33 @@ int my_close(int id); | |||
52 | #define filesize(a) rb->filesize((a)) | 56 | #define filesize(a) rb->filesize((a)) |
53 | #define read(a,b,c) rb->read((a),(b),(c)) | 57 | #define read(a,b,c) rb->read((a),(b),(c)) |
54 | #define write(a,b,c) rb->write((a),(b),(c)) | 58 | #define write(a,b,c) rb->write((a),(b),(c)) |
59 | #undef strtok | ||
55 | #define strtok(a,b) my_strtok((a),(b)) | 60 | #define strtok(a,b) my_strtok((a),(b)) |
61 | #undef strcat | ||
56 | #define strcat(a,b) rb->strcat((a),(b)) | 62 | #define strcat(a,b) rb->strcat((a),(b)) |
63 | #undef memset | ||
57 | #define memset(a,b,c) rb->memset((a),(b),(c)) | 64 | #define memset(a,b,c) rb->memset((a),(b),(c)) |
65 | #undef memmove | ||
58 | #define memmove(a,b,c) rb->memmove((a),(b),(c)) | 66 | #define memmove(a,b,c) rb->memmove((a),(b),(c)) |
67 | #undef memcmp | ||
59 | #define memcmp(a,b,c) rb->memcmp((a),(b),(c)) | 68 | #define memcmp(a,b,c) rb->memcmp((a),(b),(c)) |
69 | #undef memchr | ||
60 | #define memchr(a,b,c) rb->memchr((a),(b),(c)) | 70 | #define memchr(a,b,c) rb->memchr((a),(b),(c)) |
71 | #undef strcpy | ||
61 | #define strcpy(a,b) rb->strcpy((a),(b)) | 72 | #define strcpy(a,b) rb->strcpy((a),(b)) |
73 | #undef strlen | ||
62 | #define strlen(a) rb->strlen((a)) | 74 | #define strlen(a) rb->strlen((a)) |
75 | #undef strcmp | ||
63 | #define strcmp(a,b) rb->strcmp((a),(b)) | 76 | #define strcmp(a,b) rb->strcmp((a),(b)) |
77 | #undef strncmp | ||
64 | #define strncmp(a,b,c) rb->strncmp((a),(b),(c)) | 78 | #define strncmp(a,b,c) rb->strncmp((a),(b),(c)) |
79 | #undef strchr | ||
65 | #define strchr(a,b) rb->strchr((a),(b)) | 80 | #define strchr(a,b) rb->strchr((a),(b)) |
81 | #undef strrchr | ||
66 | #define strrchr(a,b) rb->strrchr((a),(b)) | 82 | #define strrchr(a,b) rb->strrchr((a),(b)) |
83 | #undef strcasecmp | ||
67 | #define strcasecmp(a,b) rb->strcasecmp((a),(b)) | 84 | #define strcasecmp(a,b) rb->strcasecmp((a),(b)) |
85 | #undef strncasecmp | ||
68 | #define strncasecmp(a,b,c) rb->strncasecmp((a),(b),(c)) | 86 | #define strncasecmp(a,b,c) rb->strncasecmp((a),(b),(c)) |
69 | #define srand(a) rb->srand((a)) | 87 | #define srand(a) rb->srand((a)) |
70 | #define rand() rb->rand() | 88 | #define rand() rb->rand() |
diff --git a/apps/plugins/frotz/frotz.c b/apps/plugins/frotz/frotz.c index 96029b85cb..f64431f14e 100644 --- a/apps/plugins/frotz/frotz.c +++ b/apps/plugins/frotz/frotz.c | |||
@@ -285,14 +285,14 @@ void os_beep(int volume) | |||
285 | static unsigned char unget_buf; | 285 | static unsigned char unget_buf; |
286 | static int unget_file; | 286 | static int unget_file; |
287 | 287 | ||
288 | int ungetc(int c, int f) | 288 | int frotz_ungetc(int c, int f) |
289 | { | 289 | { |
290 | unget_file = f; | 290 | unget_file = f; |
291 | unget_buf = c; | 291 | unget_buf = c; |
292 | return c; | 292 | return c; |
293 | } | 293 | } |
294 | 294 | ||
295 | int fgetc(int f) | 295 | int frotz_fgetc(int f) |
296 | { | 296 | { |
297 | unsigned char cb; | 297 | unsigned char cb; |
298 | if (unget_file == f) | 298 | if (unget_file == f) |
@@ -305,7 +305,7 @@ int fgetc(int f) | |||
305 | return cb; | 305 | return cb; |
306 | } | 306 | } |
307 | 307 | ||
308 | int fputc(int c, int f) | 308 | int frotz_fputc(int c, int f) |
309 | { | 309 | { |
310 | unsigned char cb = c; | 310 | unsigned char cb = c; |
311 | if (rb->write(f, &cb, 1) != 1) | 311 | if (rb->write(f, &cb, 1) != 1) |
diff --git a/apps/plugins/frotz/frotzplugin.h b/apps/plugins/frotz/frotzplugin.h index 8caddb470d..1a52bdb913 100644 --- a/apps/plugins/frotz/frotzplugin.h +++ b/apps/plugins/frotz/frotzplugin.h | |||
@@ -37,9 +37,12 @@ | |||
37 | /* | 37 | /* |
38 | * we need functions for character io | 38 | * we need functions for character io |
39 | */ | 39 | */ |
40 | extern int ungetc(int c, int f); | 40 | extern int frotz_ungetc(int c, int f); |
41 | extern int fgetc(int f); | 41 | #define ungetc frotz_ungetc |
42 | extern int fputc(int c, int f); | 42 | extern int frotz_fgetc(int f); |
43 | #define fgetc frotz_fgetc | ||
44 | extern int frotz_fputc(int c, int f); | ||
45 | #define fputc frotz_fputc | ||
43 | 46 | ||
44 | /* | 47 | /* |
45 | * this is used instead of os_read_key for more prompts and the like | 48 | * this is used instead of os_read_key for more prompts and the like |
diff --git a/apps/plugins/imageviewer/png/png.c b/apps/plugins/imageviewer/png/png.c index 310b08d990..c398af70c5 100644 --- a/apps/plugins/imageviewer/png/png.c +++ b/apps/plugins/imageviewer/png/png.c | |||
@@ -1359,7 +1359,7 @@ int load_image(char *filename, struct image_info *info, | |||
1359 | 1359 | ||
1360 | } else { | 1360 | } else { |
1361 | if (!running_slideshow) { | 1361 | if (!running_slideshow) { |
1362 | rb->snprintf(print, sizeof(print), "loading %lu bytes", image_size); | 1362 | rb->snprintf(print, sizeof(print), "loading %zu bytes", image_size); |
1363 | rb->lcd_puts(0, 1, print); | 1363 | rb->lcd_puts(0, 1, print); |
1364 | rb->lcd_update(); | 1364 | rb->lcd_update(); |
1365 | } | 1365 | } |
diff --git a/apps/plugins/invadrox.c b/apps/plugins/invadrox.c index 3e5c98e2a3..851487cf9a 100644 --- a/apps/plugins/invadrox.c +++ b/apps/plugins/invadrox.c | |||
@@ -81,6 +81,10 @@ PLUGIN_HEADER | |||
81 | #define DBG(format, arg...) {} | 81 | #define DBG(format, arg...) {} |
82 | #endif | 82 | #endif |
83 | 83 | ||
84 | #ifndef ABS | ||
85 | #define ABS(a) (((a) < 0) ? -(a) : (a)) | ||
86 | #endif | ||
87 | |||
84 | #if CONFIG_KEYPAD == IRIVER_H100_PAD | 88 | #if CONFIG_KEYPAD == IRIVER_H100_PAD |
85 | 89 | ||
86 | #define QUIT BUTTON_OFF | 90 | #define QUIT BUTTON_OFF |
diff --git a/apps/plugins/lib/buflib.c b/apps/plugins/lib/buflib.c index 5d03ca4bb9..930e49d02e 100644 --- a/apps/plugins/lib/buflib.c +++ b/apps/plugins/lib/buflib.c | |||
@@ -23,8 +23,8 @@ | |||
23 | * | 23 | * |
24 | ****************************************************************************/ | 24 | ****************************************************************************/ |
25 | 25 | ||
26 | #include <stdlib.h> /* for abs() */ | ||
26 | #include "buflib.h" | 27 | #include "buflib.h" |
27 | |||
28 | /* The main goal of this design is fast fetching of the pointer for a handle. | 28 | /* The main goal of this design is fast fetching of the pointer for a handle. |
29 | * For that reason, the handles are stored in a table at the end of the buffer | 29 | * For that reason, the handles are stored in a table at the end of the buffer |
30 | * with a fixed address, so that returning the pointer for a handle is a simple | 30 | * with a fixed address, so that returning the pointer for a handle is a simple |
@@ -311,7 +311,7 @@ buflib_free(struct buflib_context *ctx, int handle_num) | |||
311 | while (next_block < freed_block) | 311 | while (next_block < freed_block) |
312 | { | 312 | { |
313 | block = next_block; | 313 | block = next_block; |
314 | next_block += ABS(block->val); | 314 | next_block += abs(block->val); |
315 | } | 315 | } |
316 | /* If next_block == block, the above loop didn't go anywhere. If it did, | 316 | /* If next_block == block, the above loop didn't go anywhere. If it did, |
317 | * and the block before this one is empty, we can combine them. | 317 | * and the block before this one is empty, we can combine them. |
diff --git a/apps/plugins/lib/jhash.h b/apps/plugins/lib/jhash.h index 97d1ac3d93..7699e24587 100644 --- a/apps/plugins/lib/jhash.h +++ b/apps/plugins/lib/jhash.h | |||
@@ -24,8 +24,8 @@ | |||
24 | #ifndef _LIB_JHASH_H_ | 24 | #ifndef _LIB_JHASH_H_ |
25 | #define _LIB_JHASH_H_ | 25 | #define _LIB_JHASH_H_ |
26 | #include <inttypes.h> /* defines uint32_t etc */ | 26 | #include <inttypes.h> /* defines uint32_t etc */ |
27 | #include <sys/types.h> | 27 | #include <string.h> /* size_t */ |
28 | #include <plugin.h> | 28 | #include "plugin.h" |
29 | 29 | ||
30 | /* | 30 | /* |
31 | hashw() -- hash an array of uint32_t into a 32-bit value | 31 | hashw() -- hash an array of uint32_t into a 32-bit value |
diff --git a/apps/plugins/lib/strncpy.c b/apps/plugins/lib/strncpy.c index 7c1973ba66..f80e759969 100644 --- a/apps/plugins/lib/strncpy.c +++ b/apps/plugins/lib/strncpy.c | |||
@@ -39,6 +39,7 @@ QUICKREF | |||
39 | 39 | ||
40 | #include <string.h> | 40 | #include <string.h> |
41 | #include <limits.h> | 41 | #include <limits.h> |
42 | #include "plugin.h" | ||
42 | 43 | ||
43 | /*SUPPRESS 560*/ | 44 | /*SUPPRESS 560*/ |
44 | /*SUPPRESS 530*/ | 45 | /*SUPPRESS 530*/ |
diff --git a/apps/plugins/lua/gmtime.c b/apps/plugins/lua/gmtime.c index f13c855de8..deb24e08c9 100644 --- a/apps/plugins/lua/gmtime.c +++ b/apps/plugins/lua/gmtime.c | |||
@@ -20,7 +20,7 @@ const short __spm[13] = | |||
20 | (31+28+31+30+31+30+31+31+30+31+30+31), | 20 | (31+28+31+30+31+30+31+31+30+31+30+31), |
21 | }; | 21 | }; |
22 | 22 | ||
23 | int __isleap(int year) { | 23 | static inline int isleap(int year) { |
24 | /* every fourth year is a leap year except for century years that are | 24 | /* every fourth year is a leap year except for century years that are |
25 | * not divisible by 400. */ | 25 | * not divisible by 400. */ |
26 | /* return (year % 4 == 0 && (year % 100 != 0 || year % 400 == 0)); */ | 26 | /* return (year % 4 == 0 && (year % 100 != 0 || year % 400 == 0)); */ |
@@ -36,7 +36,7 @@ struct tm *gmtime(const time_t *timep) { | |||
36 | work=*timep/(SPD); | 36 | work=*timep/(SPD); |
37 | r.tm_wday=(4+work)%7; | 37 | r.tm_wday=(4+work)%7; |
38 | for (i=1970; ; ++i) { | 38 | for (i=1970; ; ++i) { |
39 | register time_t k=__isleap(i)?366:365; | 39 | register time_t k=isleap(i)?366:365; |
40 | if (work>=k) | 40 | if (work>=k) |
41 | work-=k; | 41 | work-=k; |
42 | else | 42 | else |
@@ -46,7 +46,7 @@ struct tm *gmtime(const time_t *timep) { | |||
46 | r.tm_yday=work; | 46 | r.tm_yday=work; |
47 | 47 | ||
48 | r.tm_mday=1; | 48 | r.tm_mday=1; |
49 | if (__isleap(i) && (work>58)) { | 49 | if (isleap(i) && (work>58)) { |
50 | if (work==59) r.tm_mday=2; /* 29.2. */ | 50 | if (work==59) r.tm_mday=2; /* 29.2. */ |
51 | work-=1; | 51 | work-=1; |
52 | } | 52 | } |
diff --git a/apps/plugins/midi/midiplay.c b/apps/plugins/midi/midiplay.c index b225014fce..2c685f2e4b 100644 --- a/apps/plugins/midi/midiplay.c +++ b/apps/plugins/midi/midiplay.c | |||
@@ -450,6 +450,8 @@ static int midimain(const void * filename) | |||
450 | enum plugin_status plugin_start(const void* parameter) | 450 | enum plugin_status plugin_start(const void* parameter) |
451 | { | 451 | { |
452 | int retval; | 452 | int retval; |
453 | PLUGINLIB_EXIT_INIT; | ||
454 | |||
453 | PLUGIN_IRAM_INIT(rb) | 455 | PLUGIN_IRAM_INIT(rb) |
454 | 456 | ||
455 | if (parameter == NULL) | 457 | if (parameter == NULL) |
diff --git a/apps/plugins/midi/midiutil.c b/apps/plugins/midi/midiutil.c index f1b6668be2..87e0f9d9a4 100644 --- a/apps/plugins/midi/midiutil.c +++ b/apps/plugins/midi/midiutil.c | |||
@@ -163,8 +163,3 @@ int printf(const char *fmt, ...) | |||
163 | return 1; | 163 | return 1; |
164 | } | 164 | } |
165 | 165 | ||
166 | void exit(int code) | ||
167 | { | ||
168 | code = code; /* Stub function, kill warning for now */ | ||
169 | } | ||
170 | |||
diff --git a/apps/plugins/midi/midiutil.h b/apps/plugins/midi/midiutil.h index f984e71aff..b1ed6569b7 100644 --- a/apps/plugins/midi/midiutil.h +++ b/apps/plugins/midi/midiutil.h | |||
@@ -21,6 +21,8 @@ | |||
21 | 21 | ||
22 | #define FRACTSIZE 12 | 22 | #define FRACTSIZE 12 |
23 | 23 | ||
24 | #include "lib/pluginlib_exit.h" | ||
25 | |||
24 | #define BUF_SIZE 16384 /* 64 kB output buffers */ | 26 | #define BUF_SIZE 16384 /* 64 kB output buffers */ |
25 | #define NBUF 2 | 27 | #define NBUF 2 |
26 | 28 | ||
@@ -145,7 +147,6 @@ int readFourBytes(int file); | |||
145 | int readVarData(int file); | 147 | int readVarData(int file); |
146 | int eof(int fd); | 148 | int eof(int fd); |
147 | unsigned char * readData(int file, int len); | 149 | unsigned char * readData(int file, int len); |
148 | void exit(int code); | ||
149 | 150 | ||
150 | #define malloc(n) my_malloc(n) | 151 | #define malloc(n) my_malloc(n) |
151 | void * my_malloc(int size); | 152 | void * my_malloc(int size); |
diff --git a/apps/plugins/mpegplayer/disk_buf.c b/apps/plugins/mpegplayer/disk_buf.c index 4f37bfa5bf..59d4816fb4 100644 --- a/apps/plugins/mpegplayer/disk_buf.c +++ b/apps/plugins/mpegplayer/disk_buf.c | |||
@@ -855,7 +855,7 @@ bool disk_buf_init(void) | |||
855 | disk_buf.pos_last = 0; | 855 | disk_buf.pos_last = 0; |
856 | disk_buf.low_wm = DISK_BUF_LOW_WATERMARK; | 856 | disk_buf.low_wm = DISK_BUF_LOW_WATERMARK; |
857 | 857 | ||
858 | disk_buf.start = mpeg_malloc_all(&disk_buf.size, MPEG_ALLOC_DISKBUF); | 858 | disk_buf.start = mpeg_malloc_all((size_t*)&disk_buf.size, MPEG_ALLOC_DISKBUF); |
859 | if (disk_buf.start == NULL) | 859 | if (disk_buf.start == NULL) |
860 | return false; | 860 | return false; |
861 | 861 | ||
diff --git a/apps/plugins/random_folder_advance_config.c b/apps/plugins/random_folder_advance_config.c index d5e7a10cdc..f7bb790dc1 100644 --- a/apps/plugins/random_folder_advance_config.c +++ b/apps/plugins/random_folder_advance_config.c | |||
@@ -23,7 +23,7 @@ | |||
23 | 23 | ||
24 | PLUGIN_HEADER | 24 | PLUGIN_HEADER |
25 | 25 | ||
26 | static bool abort; | 26 | static bool cancel; |
27 | static int fd; | 27 | static int fd; |
28 | static int dirs_count; | 28 | static int dirs_count; |
29 | static int lasttick; | 29 | static int lasttick; |
@@ -70,7 +70,7 @@ void traversedir(char* location, char* name) | |||
70 | if (dir) { | 70 | if (dir) { |
71 | entry = rb->readdir(dir); | 71 | entry = rb->readdir(dir); |
72 | while (entry) { | 72 | while (entry) { |
73 | if (abort) | 73 | if (cancel) |
74 | break; | 74 | break; |
75 | /* Skip .. and . */ | 75 | /* Skip .. and . */ |
76 | if (entry->d_name[0] == '.') | 76 | if (entry->d_name[0] == '.') |
@@ -113,7 +113,7 @@ void traversedir(char* location, char* name) | |||
113 | lasttick = *rb->current_tick; | 113 | lasttick = *rb->current_tick; |
114 | if (rb->action_userabort(TIMEOUT_NOBLOCK)) | 114 | if (rb->action_userabort(TIMEOUT_NOBLOCK)) |
115 | { | 115 | { |
116 | abort = true; | 116 | cancel = true; |
117 | break; | 117 | break; |
118 | } | 118 | } |
119 | } | 119 | } |
@@ -213,7 +213,7 @@ bool custom_dir(void) | |||
213 | void generate(void) | 213 | void generate(void) |
214 | { | 214 | { |
215 | dirs_count = 0; | 215 | dirs_count = 0; |
216 | abort = false; | 216 | cancel = false; |
217 | fd = rb->open(RFA_FILE,O_CREAT|O_WRONLY, 0666); | 217 | fd = rb->open(RFA_FILE,O_CREAT|O_WRONLY, 0666); |
218 | rb->write(fd,&dirs_count,sizeof(int)); | 218 | rb->write(fd,&dirs_count,sizeof(int)); |
219 | if (fd < 0) | 219 | if (fd < 0) |
@@ -621,7 +621,7 @@ enum plugin_status plugin_start(const void* parameter) | |||
621 | { | 621 | { |
622 | (void)parameter; | 622 | (void)parameter; |
623 | 623 | ||
624 | abort = false; | 624 | cancel = false; |
625 | 625 | ||
626 | return main_menu(); | 626 | return main_menu(); |
627 | } | 627 | } |
diff --git a/apps/plugins/rockboy/menu.c b/apps/plugins/rockboy/menu.c index 2f6c3102ff..e081a81d18 100644 --- a/apps/plugins/rockboy/menu.c +++ b/apps/plugins/rockboy/menu.c | |||
@@ -158,7 +158,7 @@ static void build_slot_path(char *buf, size_t bufsiz, size_t slot_id) { | |||
158 | munge_name(name_buf, strlen(name_buf)); | 158 | munge_name(name_buf, strlen(name_buf)); |
159 | 159 | ||
160 | /* glom the whole mess together */ | 160 | /* glom the whole mess together */ |
161 | snprintf(buf, bufsiz, "%s/%s-%ld.rbs", STATE_DIR, name_buf, slot_id + 1); | 161 | snprintf(buf, bufsiz, "%s/%s-%zud.rbs", STATE_DIR, name_buf, slot_id + 1); |
162 | } | 162 | } |
163 | 163 | ||
164 | /* | 164 | /* |
@@ -253,17 +253,17 @@ static void slot_info(char *info_buf, size_t info_bufsiz, size_t slot_id) { | |||
253 | if (read(fd, buf, 20) > 0) | 253 | if (read(fd, buf, 20) > 0) |
254 | { | 254 | { |
255 | buf[20] = '\0'; | 255 | buf[20] = '\0'; |
256 | snprintf(info_buf, info_bufsiz, "%ld. %s", slot_id + 1, buf); | 256 | snprintf(info_buf, info_bufsiz, "%zud. %s", slot_id + 1, buf); |
257 | } | 257 | } |
258 | else | 258 | else |
259 | snprintf(info_buf, info_bufsiz, "%ld. ERROR", slot_id + 1); | 259 | snprintf(info_buf, info_bufsiz, "%zud. ERROR", slot_id + 1); |
260 | 260 | ||
261 | close(fd); | 261 | close(fd); |
262 | } | 262 | } |
263 | else | 263 | else |
264 | { | 264 | { |
265 | /* if we couldn't open the file, then the slot is empty */ | 265 | /* if we couldn't open the file, then the slot is empty */ |
266 | snprintf(info_buf, info_bufsiz, "%ld. %s", slot_id + 1, "<Empty>"); | 266 | snprintf(info_buf, info_bufsiz, "%zu. %s", slot_id + 1, "<Empty>"); |
267 | } | 267 | } |
268 | } | 268 | } |
269 | 269 | ||
diff --git a/apps/plugins/rockboy/rockboy.make b/apps/plugins/rockboy/rockboy.make index ca0ed17a0a..81e9a1f798 100644 --- a/apps/plugins/rockboy/rockboy.make +++ b/apps/plugins/rockboy/rockboy.make | |||
@@ -11,7 +11,7 @@ ROCKBOY_SRCDIR = $(APPSDIR)/plugins/rockboy | |||
11 | ROCKBOY_OBJDIR = $(BUILDDIR)/apps/plugins/rockboy | 11 | ROCKBOY_OBJDIR = $(BUILDDIR)/apps/plugins/rockboy |
12 | 12 | ||
13 | ROCKBOY_SRC := $(call preprocess, $(ROCKBOY_SRCDIR)/SOURCES) | 13 | ROCKBOY_SRC := $(call preprocess, $(ROCKBOY_SRCDIR)/SOURCES) |
14 | ROCKBOY_SRC += $(ROOTDIR)/firmware/common/sscanf.c | 14 | ROCKBOY_SRC += $(ROOTDIR)/firmware/libc/sscanf.c |
15 | ROCKBOY_OBJ := $(call c2obj, $(ROCKBOY_SRC)) | 15 | ROCKBOY_OBJ := $(call c2obj, $(ROCKBOY_SRC)) |
16 | 16 | ||
17 | OTHER_SRC += $(ROCKBOY_SRC) | 17 | OTHER_SRC += $(ROCKBOY_SRC) |
diff --git a/apps/plugins/rockboy/rtc.c b/apps/plugins/rockboy/rtc.c index 6f33bc4f9d..248ebc0714 100644 --- a/apps/plugins/rockboy/rtc.c +++ b/apps/plugins/rockboy/rtc.c | |||
@@ -7,7 +7,6 @@ | |||
7 | #include "defs.h" | 7 | #include "defs.h" |
8 | #include "mem.h" | 8 | #include "mem.h" |
9 | #include "rtc-gb.h" | 9 | #include "rtc-gb.h" |
10 | #include "sscanf.h" | ||
11 | 10 | ||
12 | struct rtc rtc; | 11 | struct rtc rtc; |
13 | 12 | ||
diff --git a/apps/plugins/search.c b/apps/plugins/search.c index ba16b8821b..7edb7e229a 100644 --- a/apps/plugins/search.c +++ b/apps/plugins/search.c | |||
@@ -20,7 +20,7 @@ | |||
20 | * | 20 | * |
21 | ****************************************************************************/ | 21 | ****************************************************************************/ |
22 | #include "plugin.h" | 22 | #include "plugin.h" |
23 | #include "ctype.h" | 23 | #include <ctype.h> |
24 | 24 | ||
25 | PLUGIN_HEADER | 25 | PLUGIN_HEADER |
26 | 26 | ||
diff --git a/apps/plugins/shortcuts/shortcuts.h b/apps/plugins/shortcuts/shortcuts.h index bfe3540c4d..3d6c421c5a 100644 --- a/apps/plugins/shortcuts/shortcuts.h +++ b/apps/plugins/shortcuts/shortcuts.h | |||
@@ -51,7 +51,7 @@ typedef struct sc_file_s | |||
51 | 51 | ||
52 | 52 | ||
53 | extern void *memory_buf; | 53 | extern void *memory_buf; |
54 | extern long memory_bufsize; | 54 | extern size_t memory_bufsize; |
55 | 55 | ||
56 | 56 | ||
57 | extern sc_file_t sc_file; | 57 | extern sc_file_t sc_file; |
diff --git a/apps/plugins/shortcuts/shortcuts_common.c b/apps/plugins/shortcuts/shortcuts_common.c index dee1657afc..da212a55a3 100644 --- a/apps/plugins/shortcuts/shortcuts_common.c +++ b/apps/plugins/shortcuts/shortcuts_common.c | |||
@@ -35,7 +35,7 @@ | |||
35 | 35 | ||
36 | /* Memory (will be used for entries) */ | 36 | /* Memory (will be used for entries) */ |
37 | void *memory_buf; | 37 | void *memory_buf; |
38 | long memory_bufsize; /* Size of memory_buf in bytes */ | 38 | size_t memory_bufsize; /* Size of memory_buf in bytes */ |
39 | 39 | ||
40 | 40 | ||
41 | /* The file we're processing */ | 41 | /* The file we're processing */ |
diff --git a/apps/plugins/stats.c b/apps/plugins/stats.c index eaa1055a73..3420579881 100644 --- a/apps/plugins/stats.c +++ b/apps/plugins/stats.c | |||
@@ -24,7 +24,7 @@ PLUGIN_HEADER | |||
24 | 24 | ||
25 | static int files, dirs, musicfiles, largestdir; | 25 | static int files, dirs, musicfiles, largestdir; |
26 | static int lasttick; | 26 | static int lasttick; |
27 | static bool abort; | 27 | static bool cancel; |
28 | 28 | ||
29 | #if CONFIG_KEYPAD == PLAYER_PAD | 29 | #if CONFIG_KEYPAD == PLAYER_PAD |
30 | #define STATS_STOP BUTTON_STOP | 30 | #define STATS_STOP BUTTON_STOP |
@@ -173,7 +173,7 @@ void traversedir(char* location, char* name) | |||
173 | if (dir) { | 173 | if (dir) { |
174 | entry = rb->readdir(dir); | 174 | entry = rb->readdir(dir); |
175 | while (entry) { | 175 | while (entry) { |
176 | if (abort) | 176 | if (cancel) |
177 | break; | 177 | break; |
178 | /* Skip .. and . */ | 178 | /* Skip .. and . */ |
179 | if (rb->strcmp(entry->d_name, ".") && rb->strcmp(entry->d_name, "..")) | 179 | if (rb->strcmp(entry->d_name, ".") && rb->strcmp(entry->d_name, "..")) |
@@ -206,7 +206,7 @@ void traversedir(char* location, char* name) | |||
206 | || button == STATS_STOP_REMOTE | 206 | || button == STATS_STOP_REMOTE |
207 | #endif | 207 | #endif |
208 | ) { | 208 | ) { |
209 | abort = true; | 209 | cancel = true; |
210 | break; | 210 | break; |
211 | } | 211 | } |
212 | } | 212 | } |
@@ -229,14 +229,14 @@ enum plugin_status plugin_start(const void* parameter) | |||
229 | dirs = 0; | 229 | dirs = 0; |
230 | musicfiles = 0; | 230 | musicfiles = 0; |
231 | largestdir = 0; | 231 | largestdir = 0; |
232 | abort = false; | 232 | cancel = false; |
233 | 233 | ||
234 | rb->splash(HZ, "Counting..."); | 234 | rb->splash(HZ, "Counting..."); |
235 | update_screen(); | 235 | update_screen(); |
236 | lasttick = *rb->current_tick; | 236 | lasttick = *rb->current_tick; |
237 | 237 | ||
238 | traversedir("", ""); | 238 | traversedir("", ""); |
239 | if (abort) { | 239 | if (cancel) { |
240 | rb->splash(HZ, "Aborted"); | 240 | rb->splash(HZ, "Aborted"); |
241 | return PLUGIN_OK; | 241 | return PLUGIN_OK; |
242 | } | 242 | } |
diff --git a/apps/plugins/wav2wv.c b/apps/plugins/wav2wv.c index 03900884f9..3211203db9 100644 --- a/apps/plugins/wav2wv.c +++ b/apps/plugins/wav2wv.c | |||
@@ -97,8 +97,8 @@ static int32_t temp_buffer [TEMP_SAMPLES] IDATA_ATTR; | |||
97 | static int wav2wv(const char *infile) | 97 | static int wav2wv(const char *infile) |
98 | { | 98 | { |
99 | int in_fd, out_fd, num_chans, error = false, last_buttons; | 99 | int in_fd, out_fd, num_chans, error = false, last_buttons; |
100 | unsigned int32_t total_bytes_read = 0, total_bytes_written = 0; | 100 | uint32_t total_bytes_read = 0, total_bytes_written = 0; |
101 | unsigned int32_t total_samples, samples_remaining; | 101 | uint32_t total_samples, samples_remaining; |
102 | int32_t *input_buffer = (int32_t *) audiobuf; | 102 | int32_t *input_buffer = (int32_t *) audiobuf; |
103 | unsigned char *output_buffer = (unsigned char *)(audiobuf + 0x100000); | 103 | unsigned char *output_buffer = (unsigned char *)(audiobuf + 0x100000); |
104 | char outfile[MAX_PATH]; | 104 | char outfile[MAX_PATH]; |
@@ -180,7 +180,7 @@ static int wav2wv(const char *infile) | |||
180 | wvupdate (start_tick, native_header.SampleRate, total_samples, 0, 0, 0); | 180 | wvupdate (start_tick, native_header.SampleRate, total_samples, 0, 0, 0); |
181 | 181 | ||
182 | for (samples_remaining = total_samples; samples_remaining;) { | 182 | for (samples_remaining = total_samples; samples_remaining;) { |
183 | unsigned int32_t samples_count, samples_to_pack, bytes_count; | 183 | uint32_t samples_count, samples_to_pack, bytes_count; |
184 | int cnt, buttons; | 184 | int cnt, buttons; |
185 | int32_t value, *lp; | 185 | int32_t value, *lp; |
186 | signed char *cp; | 186 | signed char *cp; |
@@ -204,7 +204,7 @@ static int wav2wv(const char *infile) | |||
204 | cp = (signed char *) input_buffer; | 204 | cp = (signed char *) input_buffer; |
205 | 205 | ||
206 | while (samples_to_pack) { | 206 | while (samples_to_pack) { |
207 | unsigned int32_t samples_this_pass = TEMP_SAMPLES / num_chans; | 207 | uint32_t samples_this_pass = TEMP_SAMPLES / num_chans; |
208 | 208 | ||
209 | if (samples_this_pass > samples_to_pack) | 209 | if (samples_this_pass > samples_to_pack) |
210 | samples_this_pass = samples_to_pack; | 210 | samples_this_pass = samples_to_pack; |
diff --git a/apps/plugins/zxbox/helpers.h b/apps/plugins/zxbox/helpers.h index ba8607d5cb..c8cb9c1554 100644 --- a/apps/plugins/zxbox/helpers.h +++ b/apps/plugins/zxbox/helpers.h | |||
@@ -7,9 +7,12 @@ extern off_t my_ftell(int); | |||
7 | extern void *my_malloc(size_t size); | 7 | extern void *my_malloc(size_t size); |
8 | 8 | ||
9 | 9 | ||
10 | #undef getc | ||
10 | #define getc my_getc | 11 | #define getc my_getc |
11 | #define malloc my_malloc | 12 | #undef putc |
12 | #define ftell my_ftell | ||
13 | #define putc my_putc | 13 | #define putc my_putc |
14 | #undef ftell | ||
15 | #define ftell my_ftell | ||
16 | #define malloc my_malloc | ||
14 | 17 | ||
15 | #endif /* HELPERS_H */ | 18 | #endif /* HELPERS_H */ |
diff --git a/apps/plugins/zxbox/snapshot.c b/apps/plugins/zxbox/snapshot.c index 0b80b64497..468f46667e 100644 --- a/apps/plugins/zxbox/snapshot.c +++ b/apps/plugins/zxbox/snapshot.c | |||
@@ -18,8 +18,9 @@ | |||
18 | * | 18 | * |
19 | */ | 19 | */ |
20 | 20 | ||
21 | #include <stdlib.h> | ||
22 | #include <string.h> /* size_t */ | ||
21 | #include "zxmisc.h" | 23 | #include "zxmisc.h" |
22 | #include "helpers.h" | ||
23 | #include "spperif.h" | 24 | #include "spperif.h" |
24 | #include "z80.h" | 25 | #include "z80.h" |
25 | 26 | ||
@@ -29,9 +30,8 @@ | |||
29 | 30 | ||
30 | #include "spconf.h" | 31 | #include "spconf.h" |
31 | 32 | ||
32 | #include <stdio.h> | 33 | /* include this at last to avoid clashes with stdio functions */ |
33 | #include <stdlib.h> | 34 | #include "helpers.h" |
34 | #include <sys/types.h> | ||
35 | 35 | ||
36 | #define COMPRESS_SAVE 1 | 36 | #define COMPRESS_SAVE 1 |
37 | 37 | ||
diff --git a/apps/plugins/zxbox/spconf.c b/apps/plugins/zxbox/spconf.c index 728f78638c..0daabc7d77 100644 --- a/apps/plugins/zxbox/spconf.c +++ b/apps/plugins/zxbox/spconf.c | |||
@@ -17,6 +17,10 @@ | |||
17 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | 17 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
18 | * | 18 | * |
19 | */ | 19 | */ |
20 | |||
21 | #include <stdio.h> | ||
22 | #include <string.h> | ||
23 | #include <ctype.h> | ||
20 | #include "zxmisc.h" | 24 | #include "zxmisc.h" |
21 | #include "spconf_p.h" | 25 | #include "spconf_p.h" |
22 | #include "interf.h" | 26 | #include "interf.h" |
@@ -26,11 +30,7 @@ | |||
26 | #include "snapshot.h" /* for SN_Z80 and SN_SNA */ | 30 | #include "snapshot.h" /* for SN_Z80 and SN_SNA */ |
27 | #include "tapefile.h" /* for TAP_TAP and TAP_TZX */ | 31 | #include "tapefile.h" /* for TAP_TAP and TAP_TZX */ |
28 | #include "zxconfig.h" | 32 | #include "zxconfig.h" |
29 | #include "stdio.h" | ||
30 | #include "string.h" | ||
31 | #include "sys/types.h" | ||
32 | #include "helpers.h" | 33 | #include "helpers.h" |
33 | #include "ctype.h" | ||
34 | 34 | ||
35 | 35 | ||
36 | extern const char *spcf_keynames_ascii[]; | 36 | extern const char *spcf_keynames_ascii[]; |
diff --git a/apps/plugins/zxbox/sptape.c b/apps/plugins/zxbox/sptape.c index 21f962ea28..80921a0afd 100644 --- a/apps/plugins/zxbox/sptape.c +++ b/apps/plugins/zxbox/sptape.c | |||
@@ -31,7 +31,6 @@ | |||
31 | #include <stdlib.h> | 31 | #include <stdlib.h> |
32 | #include <string.h> | 32 | #include <string.h> |
33 | #include <errno.h> | 33 | #include <errno.h> |
34 | #include <sys/types.h> | ||
35 | 34 | ||
36 | #define MAXLINELEN 256 | 35 | #define MAXLINELEN 256 |
37 | 36 | ||
diff --git a/apps/plugins/zxbox/tapefile.c b/apps/plugins/zxbox/tapefile.c index 0e262aa0f7..92f4ea69f6 100644 --- a/apps/plugins/zxbox/tapefile.c +++ b/apps/plugins/zxbox/tapefile.c | |||
@@ -29,7 +29,7 @@ | |||
29 | #include <stdlib.h> | 29 | #include <stdlib.h> |
30 | #include <string.h> | 30 | #include <string.h> |
31 | #include <errno.h> | 31 | #include <errno.h> |
32 | #include <sys/types.h> | 32 | #include "inttypes.h" |
33 | #include "zxconfig.h" | 33 | #include "zxconfig.h" |
34 | #include "helpers.h" | 34 | #include "helpers.h" |
35 | #define max(x, y) ((x) > (y) ? (x) : (y)) | 35 | #define max(x, y) ((x) > (y) ? (x) : (y)) |
diff --git a/apps/plugins/zxbox/zxmisc.h b/apps/plugins/zxbox/zxmisc.h index 4ad25a0604..904af24e3d 100644 --- a/apps/plugins/zxbox/zxmisc.h +++ b/apps/plugins/zxbox/zxmisc.h | |||
@@ -21,7 +21,7 @@ | |||
21 | #ifndef ZXMISC_H | 21 | #ifndef ZXMISC_H |
22 | #define ZXMISC_H | 22 | #define ZXMISC_H |
23 | 23 | ||
24 | #include <sys/types.h> | 24 | #include <string.h> /* size_t */ |
25 | 25 | ||
26 | extern char *get_base_name(char *fname); | 26 | extern char *get_base_name(char *fname); |
27 | extern int check_ext(const char *filename, const char *ext); | 27 | extern int check_ext(const char *filename, const char *ext); |
diff --git a/apps/recorder/albumart.c b/apps/recorder/albumart.c index be787538a3..5eca713542 100644 --- a/apps/recorder/albumart.c +++ b/apps/recorder/albumart.c | |||
@@ -19,8 +19,7 @@ | |||
19 | * | 19 | * |
20 | ****************************************************************************/ | 20 | ****************************************************************************/ |
21 | 21 | ||
22 | #include <string.h> | 22 | #include "string-extra.h" |
23 | #include "sprintf.h" | ||
24 | #include "system.h" | 23 | #include "system.h" |
25 | #include "albumart.h" | 24 | #include "albumart.h" |
26 | #include "metadata.h" | 25 | #include "metadata.h" |
diff --git a/apps/recorder/icons.c b/apps/recorder/icons.c index 0b48c125d1..e6c3926759 100644 --- a/apps/recorder/icons.c +++ b/apps/recorder/icons.c | |||
@@ -22,7 +22,6 @@ | |||
22 | #include "lcd.h" | 22 | #include "lcd.h" |
23 | #include "font.h" | 23 | #include "font.h" |
24 | #include "kernel.h" | 24 | #include "kernel.h" |
25 | #include "sprintf.h" | ||
26 | #include "rtc.h" | 25 | #include "rtc.h" |
27 | #include "powermgmt.h" | 26 | #include "powermgmt.h" |
28 | 27 | ||
diff --git a/apps/recorder/jpeg_load.c b/apps/recorder/jpeg_load.c index f75176dae1..1af65fab6c 100644 --- a/apps/recorder/jpeg_load.c +++ b/apps/recorder/jpeg_load.c | |||
@@ -856,7 +856,7 @@ static const struct idct_entry idct_tbl[] = { | |||
856 | /* JPEG decoder implementation */ | 856 | /* JPEG decoder implementation */ |
857 | 857 | ||
858 | #ifdef JPEG_FROM_MEM | 858 | #ifdef JPEG_FROM_MEM |
859 | INLINE unsigned char *getc(struct jpeg* p_jpeg) | 859 | INLINE unsigned char *jpeg_getc(struct jpeg* p_jpeg) |
860 | { | 860 | { |
861 | if (LIKELY(p_jpeg->len)) | 861 | if (LIKELY(p_jpeg->len)) |
862 | { | 862 | { |
@@ -880,7 +880,7 @@ INLINE bool skip_bytes(struct jpeg* p_jpeg, int count) | |||
880 | } | 880 | } |
881 | } | 881 | } |
882 | 882 | ||
883 | INLINE void putc(struct jpeg* p_jpeg) | 883 | INLINE void jpeg_putc(struct jpeg* p_jpeg) |
884 | { | 884 | { |
885 | p_jpeg->len++; | 885 | p_jpeg->len++; |
886 | p_jpeg->data--; | 886 | p_jpeg->data--; |
@@ -892,7 +892,7 @@ INLINE void fill_buf(struct jpeg* p_jpeg) | |||
892 | p_jpeg->buf_index = 0; | 892 | p_jpeg->buf_index = 0; |
893 | } | 893 | } |
894 | 894 | ||
895 | static unsigned char *getc(struct jpeg* p_jpeg) | 895 | static unsigned char *jpeg_getc(struct jpeg* p_jpeg) |
896 | { | 896 | { |
897 | if (UNLIKELY(p_jpeg->buf_left < 1)) | 897 | if (UNLIKELY(p_jpeg->buf_left < 1)) |
898 | fill_buf(p_jpeg); | 898 | fill_buf(p_jpeg); |
@@ -917,7 +917,7 @@ static bool skip_bytes(struct jpeg* p_jpeg, int count) | |||
917 | return p_jpeg->buf_left >= 0 || skip_bytes_seek(p_jpeg); | 917 | return p_jpeg->buf_left >= 0 || skip_bytes_seek(p_jpeg); |
918 | } | 918 | } |
919 | 919 | ||
920 | static void putc(struct jpeg* p_jpeg) | 920 | static void jpeg_putc(struct jpeg* p_jpeg) |
921 | { | 921 | { |
922 | p_jpeg->buf_left++; | 922 | p_jpeg->buf_left++; |
923 | p_jpeg->buf_index--; | 923 | p_jpeg->buf_index--; |
@@ -933,14 +933,14 @@ do {\ | |||
933 | #define e_getc(jpeg, code) \ | 933 | #define e_getc(jpeg, code) \ |
934 | ({ \ | 934 | ({ \ |
935 | unsigned char *c; \ | 935 | unsigned char *c; \ |
936 | if (UNLIKELY(!(c = getc(jpeg)))) \ | 936 | if (UNLIKELY(!(c = jpeg_getc(jpeg)))) \ |
937 | return (code); \ | 937 | return (code); \ |
938 | *c; \ | 938 | *c; \ |
939 | }) | 939 | }) |
940 | 940 | ||
941 | #define d_getc(jpeg, def) \ | 941 | #define d_getc(jpeg, def) \ |
942 | ({ \ | 942 | ({ \ |
943 | unsigned char *cp = getc(jpeg); \ | 943 | unsigned char *cp = jpeg_getc(jpeg); \ |
944 | unsigned char c = LIKELY(cp) ? *cp : (def); \ | 944 | unsigned char c = LIKELY(cp) ? *cp : (def); \ |
945 | c; \ | 945 | c; \ |
946 | }) | 946 | }) |
@@ -958,7 +958,7 @@ static int process_markers(struct jpeg* p_jpeg) | |||
958 | if (c != 0xFF) /* no marker? */ | 958 | if (c != 0xFF) /* no marker? */ |
959 | { | 959 | { |
960 | JDEBUGF("Non-marker data\n"); | 960 | JDEBUGF("Non-marker data\n"); |
961 | putc(p_jpeg); | 961 | jpeg_putc(p_jpeg); |
962 | break; /* exit marker processing */ | 962 | break; /* exit marker processing */ |
963 | } | 963 | } |
964 | 964 | ||
@@ -969,7 +969,7 @@ static int process_markers(struct jpeg* p_jpeg) | |||
969 | case 0xFF: /* Fill byte */ | 969 | case 0xFF: /* Fill byte */ |
970 | ret |= FILL_FF; | 970 | ret |= FILL_FF; |
971 | case 0x00: /* Zero stuffed byte - entropy data */ | 971 | case 0x00: /* Zero stuffed byte - entropy data */ |
972 | putc(p_jpeg); | 972 | jpeg_putc(p_jpeg); |
973 | continue; | 973 | continue; |
974 | 974 | ||
975 | case 0xC0: /* SOF Huff - Baseline DCT */ | 975 | case 0xC0: /* SOF Huff - Baseline DCT */ |
@@ -1669,7 +1669,7 @@ static void search_restart(struct jpeg *p_jpeg) | |||
1669 | return; | 1669 | return; |
1670 | } | 1670 | } |
1671 | else | 1671 | else |
1672 | putc(p_jpeg); | 1672 | jpeg_putc(p_jpeg); |
1673 | } | 1673 | } |
1674 | } | 1674 | } |
1675 | } | 1675 | } |
diff --git a/apps/recorder/keyboard.c b/apps/recorder/keyboard.c index 3df3142897..f8b390d932 100644 --- a/apps/recorder/keyboard.c +++ b/apps/recorder/keyboard.c | |||
@@ -20,7 +20,7 @@ | |||
20 | ****************************************************************************/ | 20 | ****************************************************************************/ |
21 | #include "kernel.h" | 21 | #include "kernel.h" |
22 | #include "system.h" | 22 | #include "system.h" |
23 | #include <string.h> | 23 | #include "string-extra.h" |
24 | #include "font.h" | 24 | #include "font.h" |
25 | #include "screens.h" | 25 | #include "screens.h" |
26 | #include "talk.h" | 26 | #include "talk.h" |
diff --git a/apps/recorder/peakmeter.c b/apps/recorder/peakmeter.c index 8f32a837a7..154f605898 100644 --- a/apps/recorder/peakmeter.c +++ b/apps/recorder/peakmeter.c | |||
@@ -29,7 +29,6 @@ | |||
29 | #include "storage.h" | 29 | #include "storage.h" |
30 | #include "lcd.h" | 30 | #include "lcd.h" |
31 | #include "scrollbar.h" | 31 | #include "scrollbar.h" |
32 | #include "sprintf.h" | ||
33 | #include "button.h" | 32 | #include "button.h" |
34 | #include "system.h" | 33 | #include "system.h" |
35 | #include "font.h" | 34 | #include "font.h" |
diff --git a/apps/recorder/radio.c b/apps/recorder/radio.c index 7cf91d62f7..7761f248ca 100644 --- a/apps/recorder/radio.c +++ b/apps/recorder/radio.c | |||
@@ -23,7 +23,6 @@ | |||
23 | #include <stdio.h> | 23 | #include <stdio.h> |
24 | #include <stdbool.h> | 24 | #include <stdbool.h> |
25 | #include <stdlib.h> | 25 | #include <stdlib.h> |
26 | #include "sprintf.h" | ||
27 | #include "mas.h" | 26 | #include "mas.h" |
28 | #include "settings.h" | 27 | #include "settings.h" |
29 | #include "button.h" | 28 | #include "button.h" |
@@ -35,7 +34,7 @@ | |||
35 | #include "file.h" | 34 | #include "file.h" |
36 | #include "general.h" | 35 | #include "general.h" |
37 | #include "errno.h" | 36 | #include "errno.h" |
38 | #include "string.h" | 37 | #include "string-extra.h" |
39 | #include "system.h" | 38 | #include "system.h" |
40 | #include "radio.h" | 39 | #include "radio.h" |
41 | #include "menu.h" | 40 | #include "menu.h" |
diff --git a/apps/recorder/recording.c b/apps/recorder/recording.c index fc527923db..0f1ff30cf5 100644 --- a/apps/recorder/recording.c +++ b/apps/recorder/recording.c | |||
@@ -1762,7 +1762,7 @@ bool recording_screen(bool no_source) | |||
1762 | draw attention */ | 1762 | draw attention */ |
1763 | /* Don't use language string unless agreed upon to make this | 1763 | /* Don't use language string unless agreed upon to make this |
1764 | method permanent - could do something in the statusbar */ | 1764 | method permanent - could do something in the statusbar */ |
1765 | snprintf(buf, sizeof(buf), "Warning: %08X", | 1765 | snprintf(buf, sizeof(buf), "Warning: %08lX", |
1766 | pcm_rec_get_warnings()); | 1766 | pcm_rec_get_warnings()); |
1767 | } | 1767 | } |
1768 | else | 1768 | else |
@@ -1771,7 +1771,7 @@ bool recording_screen(bool no_source) | |||
1771 | (global_settings.rec_split_method)) | 1771 | (global_settings.rec_split_method)) |
1772 | { | 1772 | { |
1773 | dmb = dsize/1024/1024; | 1773 | dmb = dsize/1024/1024; |
1774 | snprintf(buf, sizeof(buf), "%s %dMB", | 1774 | snprintf(buf, sizeof(buf), "%s %luMB", |
1775 | str(LANG_SPLIT_SIZE), dmb); | 1775 | str(LANG_SPLIT_SIZE), dmb); |
1776 | } | 1776 | } |
1777 | else | 1777 | else |
diff --git a/apps/replaygain.c b/apps/replaygain.c index 6ece1104b4..81f1a45ad7 100644 --- a/apps/replaygain.c +++ b/apps/replaygain.c | |||
@@ -20,13 +20,14 @@ | |||
20 | ****************************************************************************/ | 20 | ****************************************************************************/ |
21 | 21 | ||
22 | #include <ctype.h> | 22 | #include <ctype.h> |
23 | #include <inttypes.h> | ||
24 | #include <math.h> | 23 | #include <math.h> |
25 | #include <stdbool.h> | 24 | #include <stdbool.h> |
26 | #include <stdio.h> | 25 | #include <stdio.h> |
27 | #include <stdlib.h> | 26 | #include <stdlib.h> |
28 | #include <string.h> | 27 | #include <inttypes.h> |
29 | #include <system.h> | 28 | #include "strlcpy.h" |
29 | #include "strcasecmp.h" | ||
30 | #include "system.h" | ||
30 | #include "metadata.h" | 31 | #include "metadata.h" |
31 | #include "debug.h" | 32 | #include "debug.h" |
32 | #include "replaygain.h" | 33 | #include "replaygain.h" |
@@ -244,7 +245,7 @@ long parse_replaygain_int(bool album, long gain, long peak, | |||
244 | 245 | ||
245 | if (buffer != NULL) | 246 | if (buffer != NULL) |
246 | { | 247 | { |
247 | len = snprintf(buffer, length, "%d.%02d dB", gain / 512, | 248 | len = snprintf(buffer, length, "%ld.%02d dB", gain / 512, |
248 | ((abs(gain) & 0x01ff) * 100 + 256) / 512); | 249 | ((abs(gain) & 0x01ff) * 100 + 256) / 512); |
249 | len++; | 250 | len++; |
250 | } | 251 | } |
diff --git a/apps/root_menu.c b/apps/root_menu.c index 5124375490..e533c8ccc7 100644 --- a/apps/root_menu.c +++ b/apps/root_menu.c | |||
@@ -19,9 +19,9 @@ | |||
19 | * | 19 | * |
20 | ****************************************************************************/ | 20 | ****************************************************************************/ |
21 | #include <stdio.h> | 21 | #include <stdio.h> |
22 | #include <string.h> | ||
23 | #include <stdlib.h> | 22 | #include <stdlib.h> |
24 | #include <stdbool.h> | 23 | #include <stdbool.h> |
24 | #include "string-extra.h" | ||
25 | #include "config.h" | 25 | #include "config.h" |
26 | #include "appevents.h" | 26 | #include "appevents.h" |
27 | #include "menu.h" | 27 | #include "menu.h" |
diff --git a/apps/screen_access.c b/apps/screen_access.c index 871b1f8a60..df071020e5 100644 --- a/apps/screen_access.c +++ b/apps/screen_access.c | |||
@@ -19,17 +19,18 @@ | |||
19 | * | 19 | * |
20 | ****************************************************************************/ | 20 | ****************************************************************************/ |
21 | 21 | ||
22 | #include <stdio.h> | ||
23 | #include "config.h" | ||
22 | #include <lcd.h> | 24 | #include <lcd.h> |
23 | #include <lcd-remote.h> | 25 | #include <lcd-remote.h> |
24 | #include <scroll_engine.h> | 26 | #include <scroll_engine.h> |
25 | #include "backlight.h" | ||
26 | #include <font.h> | 27 | #include <font.h> |
27 | #include <button.h> | 28 | #include <button.h> |
28 | #include <sprintf.h> | ||
29 | #include <settings.h> | 29 | #include <settings.h> |
30 | #include <kernel.h> | 30 | #include <kernel.h> |
31 | #include <icons.h> | 31 | #include <icons.h> |
32 | 32 | ||
33 | #include "backlight.h" | ||
33 | #include "screen_access.h" | 34 | #include "screen_access.h" |
34 | #include "backdrop.h" | 35 | #include "backdrop.h" |
35 | 36 | ||
diff --git a/apps/screens.c b/apps/screens.c index 1ac6633ccc..d988a521d0 100644 --- a/apps/screens.c +++ b/apps/screens.c | |||
@@ -34,7 +34,6 @@ | |||
34 | #include "settings.h" | 34 | #include "settings.h" |
35 | #include "status.h" | 35 | #include "status.h" |
36 | #include "playlist.h" | 36 | #include "playlist.h" |
37 | #include "sprintf.h" | ||
38 | #include "kernel.h" | 37 | #include "kernel.h" |
39 | #include "power.h" | 38 | #include "power.h" |
40 | #include "system.h" | 39 | #include "system.h" |
diff --git a/apps/scrobbler.c b/apps/scrobbler.c index 5ab13f3d15..401f5b93b6 100644 --- a/apps/scrobbler.c +++ b/apps/scrobbler.c | |||
@@ -23,8 +23,8 @@ Audioscrobbler spec at: | |||
23 | http://www.audioscrobbler.net/wiki/Portable_Player_Logging | 23 | http://www.audioscrobbler.net/wiki/Portable_Player_Logging |
24 | */ | 24 | */ |
25 | 25 | ||
26 | #include <stdio.h> | ||
26 | #include "file.h" | 27 | #include "file.h" |
27 | #include "sprintf.h" | ||
28 | #include "logf.h" | 28 | #include "logf.h" |
29 | #include "metadata.h" | 29 | #include "metadata.h" |
30 | #include "kernel.h" | 30 | #include "kernel.h" |
diff --git a/apps/settings.c b/apps/settings.c index 690243b537..4901957263 100644 --- a/apps/settings.c +++ b/apps/settings.c | |||
@@ -33,7 +33,8 @@ | |||
33 | #include "backlight.h" | 33 | #include "backlight.h" |
34 | #include "audio.h" | 34 | #include "audio.h" |
35 | #include "talk.h" | 35 | #include "talk.h" |
36 | #include "string.h" | 36 | #include "strlcpy.h" |
37 | #include "strcasestr.h" | ||
37 | #include "rtc.h" | 38 | #include "rtc.h" |
38 | #include "power.h" | 39 | #include "power.h" |
39 | #include "ata_idle_notify.h" | 40 | #include "ata_idle_notify.h" |
@@ -52,7 +53,6 @@ | |||
52 | #include "lang.h" | 53 | #include "lang.h" |
53 | #include "language.h" | 54 | #include "language.h" |
54 | #include "powermgmt.h" | 55 | #include "powermgmt.h" |
55 | #include "sprintf.h" | ||
56 | #include "keyboard.h" | 56 | #include "keyboard.h" |
57 | #include "version.h" | 57 | #include "version.h" |
58 | #include "sound.h" | 58 | #include "sound.h" |
diff --git a/apps/settings_list.c b/apps/settings_list.c index 044f9e8066..34d4fc52e0 100644 --- a/apps/settings_list.c +++ b/apps/settings_list.c | |||
@@ -21,7 +21,7 @@ | |||
21 | 21 | ||
22 | #include "config.h" | 22 | #include "config.h" |
23 | #include <stdbool.h> | 23 | #include <stdbool.h> |
24 | #include <string.h> | 24 | #include "string-extra.h" |
25 | #include "system.h" | 25 | #include "system.h" |
26 | #include "storage.h" | 26 | #include "storage.h" |
27 | #include "lang.h" | 27 | #include "lang.h" |
diff --git a/apps/tagcache.c b/apps/tagcache.c index ab76fbadfe..29c00ae311 100644 --- a/apps/tagcache.c +++ b/apps/tagcache.c | |||
@@ -66,7 +66,7 @@ | |||
66 | #include "kernel.h" | 66 | #include "kernel.h" |
67 | #include "system.h" | 67 | #include "system.h" |
68 | #include "logf.h" | 68 | #include "logf.h" |
69 | #include "string.h" | 69 | #include "string-extra.h" |
70 | #include "usb.h" | 70 | #include "usb.h" |
71 | #include "metadata.h" | 71 | #include "metadata.h" |
72 | #include "tagcache.h" | 72 | #include "tagcache.h" |
@@ -1392,7 +1392,7 @@ static bool get_next(struct tagcache_search *tcs) | |||
1392 | 1392 | ||
1393 | if (TAGCACHE_IS_NUMERIC(tcs->type)) | 1393 | if (TAGCACHE_IS_NUMERIC(tcs->type)) |
1394 | { | 1394 | { |
1395 | snprintf(buf, sizeof(buf), "%d", tcs->position); | 1395 | snprintf(buf, sizeof(buf), "%ld", tcs->position); |
1396 | tcs->result = buf; | 1396 | tcs->result = buf; |
1397 | tcs->result_len = strlen(buf) + 1; | 1397 | tcs->result_len = strlen(buf) + 1; |
1398 | return true; | 1398 | return true; |
@@ -3490,7 +3490,7 @@ bool tagcache_create_changelog(struct tagcache_search *tcs) | |||
3490 | { | 3490 | { |
3491 | if (TAGCACHE_IS_NUMERIC(j)) | 3491 | if (TAGCACHE_IS_NUMERIC(j)) |
3492 | { | 3492 | { |
3493 | snprintf(temp, sizeof temp, "%d", idx.tag_seek[j]); | 3493 | snprintf(temp, sizeof temp, "%d", (int)idx.tag_seek[j]); |
3494 | write_tag(clfd, tagcache_tag_to_str(j), temp); | 3494 | write_tag(clfd, tagcache_tag_to_str(j), temp); |
3495 | continue; | 3495 | continue; |
3496 | } | 3496 | } |
diff --git a/apps/tagtree.c b/apps/tagtree.c index ef9c9d2de7..3b13df06ab 100644 --- a/apps/tagtree.c +++ b/apps/tagtree.c | |||
@@ -27,8 +27,8 @@ | |||
27 | /*#define LOGF_ENABLE*/ | 27 | /*#define LOGF_ENABLE*/ |
28 | 28 | ||
29 | #include <stdio.h> | 29 | #include <stdio.h> |
30 | #include <string.h> | ||
31 | #include <stdlib.h> | 30 | #include <stdlib.h> |
31 | #include "string-extra.h" | ||
32 | #include "config.h" | 32 | #include "config.h" |
33 | #include "system.h" | 33 | #include "system.h" |
34 | #include "kernel.h" | 34 | #include "kernel.h" |
diff --git a/apps/talk.c b/apps/talk.c index 93e76fa69e..9f31645ca5 100644 --- a/apps/talk.c +++ b/apps/talk.c | |||
@@ -25,7 +25,7 @@ | |||
25 | 25 | ||
26 | #include <stdio.h> | 26 | #include <stdio.h> |
27 | #include <stddef.h> | 27 | #include <stddef.h> |
28 | #include <string.h> | 28 | #include "string-extra.h" |
29 | #include "file.h" | 29 | #include "file.h" |
30 | #include "buffer.h" | 30 | #include "buffer.h" |
31 | #include "system.h" | 31 | #include "system.h" |
diff --git a/apps/tree.c b/apps/tree.c index db8f507146..8fbc793bda 100644 --- a/apps/tree.c +++ b/apps/tree.c | |||
@@ -19,9 +19,9 @@ | |||
19 | * | 19 | * |
20 | ****************************************************************************/ | 20 | ****************************************************************************/ |
21 | #include <stdio.h> | 21 | #include <stdio.h> |
22 | #include <string.h> | ||
23 | #include <stdlib.h> | 22 | #include <stdlib.h> |
24 | #include <stdbool.h> | 23 | #include <stdbool.h> |
24 | #include "string-extra.h" | ||
25 | 25 | ||
26 | #include "applimits.h" | 26 | #include "applimits.h" |
27 | #include "dir.h" | 27 | #include "dir.h" |
@@ -32,7 +32,6 @@ | |||
32 | #include "kernel.h" | 32 | #include "kernel.h" |
33 | #include "usb.h" | 33 | #include "usb.h" |
34 | #include "tree.h" | 34 | #include "tree.h" |
35 | #include "sprintf.h" | ||
36 | #include "audio.h" | 35 | #include "audio.h" |
37 | #include "playlist.h" | 36 | #include "playlist.h" |
38 | #include "menu.h" | 37 | #include "menu.h" |
diff --git a/apps/voice_thread.c b/apps/voice_thread.c index 7b5bba20e7..076bd2ea1b 100644 --- a/apps/voice_thread.c +++ b/apps/voice_thread.c | |||
@@ -18,6 +18,7 @@ | |||
18 | * KIND, either express or implied. | 18 | * KIND, either express or implied. |
19 | * | 19 | * |
20 | ****************************************************************************/ | 20 | ****************************************************************************/ |
21 | #include <sys/types.h> | ||
21 | #include "system.h" | 22 | #include "system.h" |
22 | #include "thread.h" | 23 | #include "thread.h" |
23 | #include "voice_thread.h" | 24 | #include "voice_thread.h" |
diff --git a/firmware/SOURCES b/firmware/SOURCES index 4e35850aa8..5253e5fde4 100644 --- a/firmware/SOURCES +++ b/firmware/SOURCES | |||
@@ -22,12 +22,30 @@ panic.c | |||
22 | debug.c | 22 | debug.c |
23 | 23 | ||
24 | /* Common */ | 24 | /* Common */ |
25 | common/atoi.c | 25 | #if !defined(SIMULATOR) || defined(__MINGW32__) || defined(__CYGWIN__) |
26 | libc/errno.c | ||
27 | #endif /* !defined(SIMULATOR) || defined(__MINGW32__) || defined(__CYGWIN__) */ | ||
28 | libc/atoi.c | ||
29 | libc/ctype.c | ||
30 | libc/memcmp.c | ||
31 | libc/memchr.c | ||
32 | libc/qsort.c | ||
33 | libc/random.c | ||
34 | libc/sprintf.c | ||
35 | libc/strcat.c | ||
36 | libc/strchr.c | ||
37 | libc/strcmp.c | ||
38 | libc/strcpy.c | ||
39 | libc/strncmp.c | ||
40 | libc/strrchr.c | ||
41 | libc/strtok.c | ||
42 | libc/strstr.c | ||
43 | libc/mktime.c | ||
44 | common/config.c | ||
26 | common/crc32.c | 45 | common/crc32.c |
27 | #ifdef MI4_FORMAT | 46 | #ifdef MI4_FORMAT |
28 | common/crc32-mi4.c | 47 | common/crc32-mi4.c |
29 | #endif | 48 | #endif |
30 | common/ctype.c | ||
31 | #ifndef SIMULATOR | 49 | #ifndef SIMULATOR |
32 | common/dir_uncached.c | 50 | common/dir_uncached.c |
33 | common/file.c | 51 | common/file.c |
@@ -36,28 +54,13 @@ common/file.c | |||
36 | common/dircache.c | 54 | common/dircache.c |
37 | #endif /* HAVE_DIRCACHE */ | 55 | #endif /* HAVE_DIRCACHE */ |
38 | common/disk.c | 56 | common/disk.c |
39 | #if !defined(SIMULATOR) || defined(__MINGW32__) || defined(__CYGWIN__) | ||
40 | common/errno.c | ||
41 | #endif /* !defined(SIMULATOR) || defined(__MINGW32__) || defined(__CYGWIN__) */ | ||
42 | common/filefuncs.c | 57 | common/filefuncs.c |
43 | common/memcmp.c | 58 | common/format.c |
44 | common/memchr.c | ||
45 | common/qsort.c | ||
46 | common/random.c | ||
47 | common/sprintf.c | ||
48 | common/strcasecmp.c | 59 | common/strcasecmp.c |
49 | common/strcasestr.c | 60 | common/strcasestr.c |
50 | common/strcat.c | ||
51 | common/strchr.c | ||
52 | common/strcmp.c | ||
53 | common/strnatcmp.c | 61 | common/strnatcmp.c |
54 | common/strcpy.c | ||
55 | common/strncmp.c | ||
56 | common/strlcat.c | 62 | common/strlcat.c |
57 | common/strlcpy.c | 63 | common/strlcpy.c |
58 | common/strrchr.c | ||
59 | common/strtok.c | ||
60 | common/strstr.c | ||
61 | common/structec.c | 64 | common/structec.c |
62 | common/timefuncs.c | 65 | common/timefuncs.c |
63 | common/unicode.c | 66 | common/unicode.c |
@@ -377,7 +380,7 @@ target/coldfire/i2c-coldfire.c | |||
377 | target/arm/support-arm.S | 380 | target/arm/support-arm.S |
378 | target/arm/memcpy-arm.S | 381 | target/arm/memcpy-arm.S |
379 | target/arm/memmove-arm.S | 382 | target/arm/memmove-arm.S |
380 | common/strlen.c | 383 | libc/strlen.c |
381 | #ifndef SIMULATOR | 384 | #ifndef SIMULATOR |
382 | target/arm/memset-arm.S | 385 | target/arm/memset-arm.S |
383 | target/arm/memset16-arm.S | 386 | target/arm/memset16-arm.S |
@@ -472,9 +475,9 @@ target/arm/crt0.S | |||
472 | #elif defined(CPU_MIPS) | 475 | #elif defined(CPU_MIPS) |
473 | #undef mips | 476 | #undef mips |
474 | /*target/mips/strlen.S*/ | 477 | /*target/mips/strlen.S*/ |
475 | common/memmove.c | 478 | libc/memmove.c |
476 | common/memset16.c | 479 | common/memset16.c |
477 | common/strlen.c | 480 | libc/strlen.c |
478 | target/mips/ffs-mips.S | 481 | target/mips/ffs-mips.S |
479 | target/mips/memcpy-mips.S | 482 | target/mips/memcpy-mips.S |
480 | target/mips/memset-mips.S | 483 | target/mips/memset-mips.S |
@@ -488,11 +491,11 @@ target/mips/ingenic_jz47xx/crt0.S | |||
488 | #ifdef HAVE_PRIORITY_SCHEDULING | 491 | #ifdef HAVE_PRIORITY_SCHEDULING |
489 | common/ffs.c | 492 | common/ffs.c |
490 | #endif | 493 | #endif |
491 | common/memcpy.c | 494 | libc/memcpy.c |
492 | common/memmove.c | 495 | libc/memmove.c |
493 | common/memset.c | 496 | libc/memset.c |
494 | common/memset16.c | 497 | common/memset16.c |
495 | common/strlen.c | 498 | libc/strlen.c |
496 | #ifndef SIMULATOR | 499 | #ifndef SIMULATOR |
497 | crt0.S | 500 | crt0.S |
498 | drivers/i2c.c | 501 | drivers/i2c.c |
@@ -752,7 +755,7 @@ target/coldfire/iaudio/audio-iaudio.c | |||
752 | #ifdef IRIVER_IFP7XX_SERIES | 755 | #ifdef IRIVER_IFP7XX_SERIES |
753 | #ifdef STUB | 756 | #ifdef STUB |
754 | ifp_usb_serial.c | 757 | ifp_usb_serial.c |
755 | common/sscanf.c | 758 | libc/sscanf.c |
756 | #endif /* STUB */ | 759 | #endif /* STUB */ |
757 | #endif /* IRIVER_IFP7XX_SERIES */ | 760 | #endif /* IRIVER_IFP7XX_SERIES */ |
758 | 761 | ||
diff --git a/uisimulator/sdl/sprintf.h b/firmware/common/config.c index 129a6187c2..5245d34135 100644 --- a/uisimulator/sdl/sprintf.h +++ b/firmware/common/config.c | |||
@@ -7,7 +7,7 @@ | |||
7 | * \/ \/ \/ \/ \/ | 7 | * \/ \/ \/ \/ \/ |
8 | * $Id$ | 8 | * $Id$ |
9 | * | 9 | * |
10 | * Copyright (C) 2002 by Felix Arends | 10 | * Copyright (C) 2010 Thomas Martitz |
11 | * | 11 | * |
12 | * This program is free software; you can redistribute it and/or | 12 | * This program is free software; you can redistribute it and/or |
13 | * modify it under the terms of the GNU General Public License | 13 | * modify it under the terms of the GNU General Public License |
@@ -19,20 +19,10 @@ | |||
19 | * | 19 | * |
20 | ****************************************************************************/ | 20 | ****************************************************************************/ |
21 | 21 | ||
22 | #ifndef __SPRINTF_H__ | ||
23 | #define __SPRINTF_H__ | ||
24 | 22 | ||
25 | #include <stddef.h> | 23 | /** |
26 | #include <stdarg.h> | 24 | * This file is only there to depend on config.h. |
27 | #include <stdio.h> | 25 | * Use this if non-C stuff depends on config.h (e.g. language generation) |
28 | 26 | * See apps/apps.make | |
29 | int snprintf (char *buf, size_t size, const char *fmt, ...); | 27 | **/ |
30 | char *strtok_r (char *, const char *, char **); | 28 | #include "config.h" |
31 | |||
32 | int rockbox_fprintf (int fd, const char *fmt, ...); | ||
33 | #define fprintf rockbox_fprintf | ||
34 | |||
35 | int rockbox_vsnprintf (char *buf, int size, const char *fmt, va_list ap); | ||
36 | #define vsnprintf rockbox_vsnprintf | ||
37 | |||
38 | #endif /* __SPRINTF_H__ */ | ||
diff --git a/firmware/common/dircache.c b/firmware/common/dircache.c index 225ed1aff1..e642296a35 100644 --- a/firmware/common/dircache.c +++ b/firmware/common/dircache.c | |||
@@ -27,7 +27,7 @@ | |||
27 | 27 | ||
28 | #include <stdio.h> | 28 | #include <stdio.h> |
29 | #include <errno.h> | 29 | #include <errno.h> |
30 | #include <string.h> | 30 | #include "string-extra.h" |
31 | #include <stdbool.h> | 31 | #include <stdbool.h> |
32 | #include <stdlib.h> | 32 | #include <stdlib.h> |
33 | #include "debug.h" | 33 | #include "debug.h" |
diff --git a/firmware/common/sprintf.c b/firmware/common/format.c index 35f977a0a3..987af417da 100644 --- a/firmware/common/sprintf.c +++ b/firmware/common/format.c | |||
@@ -19,24 +19,16 @@ | |||
19 | * | 19 | * |
20 | ****************************************************************************/ | 20 | ****************************************************************************/ |
21 | 21 | ||
22 | /* | ||
23 | * Minimal printf and snprintf formatting functions | ||
24 | * | ||
25 | * These support %c %s %d and %x | ||
26 | * Field width and zero-padding flag only | ||
27 | */ | ||
28 | 22 | ||
29 | #include <stdarg.h> | 23 | #include <stdarg.h> |
30 | #include <string.h> | ||
31 | #include <stdbool.h> | 24 | #include <stdbool.h> |
32 | #include <limits.h> | 25 | #include <limits.h> |
33 | 26 | #include <string.h> | |
34 | #include "file.h" /* for write(), used in fprintf() */ | 27 | #include "file.h" |
35 | #include "sprintf.h" /* to allow the simulator magic */ | ||
36 | 28 | ||
37 | static const char hexdigit[] = "0123456789ABCDEF"; | 29 | static const char hexdigit[] = "0123456789ABCDEF"; |
38 | 30 | ||
39 | static int format( | 31 | int format( |
40 | /* call 'push()' for each output letter */ | 32 | /* call 'push()' for each output letter */ |
41 | int (*push)(void *userp, unsigned char data), | 33 | int (*push)(void *userp, unsigned char data), |
42 | void *userp, | 34 | void *userp, |
@@ -194,69 +186,6 @@ static int format( | |||
194 | return ok; /* true means good */ | 186 | return ok; /* true means good */ |
195 | } | 187 | } |
196 | 188 | ||
197 | #if !defined(SIMULATOR) || !defined(linux) | ||
198 | /* ALSA library requires a more advanced snprintf, so let's not | ||
199 | override it in simulator for Linux. Note that Cygwin requires | ||
200 | our snprintf or it produces garbled output after a while. */ | ||
201 | |||
202 | struct for_snprintf { | ||
203 | unsigned char *ptr; /* where to store it */ | ||
204 | int bytes; /* amount already stored */ | ||
205 | int max; /* max amount to store */ | ||
206 | }; | ||
207 | |||
208 | static int sprfunc(void *ptr, unsigned char letter) | ||
209 | { | ||
210 | struct for_snprintf *pr = (struct for_snprintf *)ptr; | ||
211 | if(pr->bytes < pr->max) { | ||
212 | *pr->ptr = letter; | ||
213 | pr->ptr++; | ||
214 | pr->bytes++; | ||
215 | return true; | ||
216 | } | ||
217 | return false; /* filled buffer */ | ||
218 | } | ||
219 | |||
220 | |||
221 | int snprintf(char *buf, size_t size, const char *fmt, ...) | ||
222 | { | ||
223 | bool ok; | ||
224 | va_list ap; | ||
225 | struct for_snprintf pr; | ||
226 | |||
227 | pr.ptr = (unsigned char *)buf; | ||
228 | pr.bytes = 0; | ||
229 | pr.max = size; | ||
230 | |||
231 | va_start(ap, fmt); | ||
232 | ok = format(sprfunc, &pr, fmt, ap); | ||
233 | va_end(ap); | ||
234 | |||
235 | /* make sure it ends with a trailing zero */ | ||
236 | pr.ptr[(pr.bytes < pr.max) ? 0 : -1] = '\0'; | ||
237 | |||
238 | return pr.bytes; | ||
239 | } | ||
240 | |||
241 | int vsnprintf(char *buf, int size, const char *fmt, va_list ap) | ||
242 | { | ||
243 | bool ok; | ||
244 | struct for_snprintf pr; | ||
245 | |||
246 | pr.ptr = (unsigned char *)buf; | ||
247 | pr.bytes = 0; | ||
248 | pr.max = size; | ||
249 | |||
250 | ok = format(sprfunc, &pr, fmt, ap); | ||
251 | |||
252 | /* make sure it ends with a trailing zero */ | ||
253 | pr.ptr[(pr.bytes < pr.max) ? 0 : -1] = '\0'; | ||
254 | |||
255 | return pr.bytes; | ||
256 | } | ||
257 | |||
258 | #endif /* Linux SIMULATOR */ | ||
259 | |||
260 | struct for_fprintf { | 189 | struct for_fprintf { |
261 | int fd; /* where to store it */ | 190 | int fd; /* where to store it */ |
262 | int bytes; /* amount stored */ | 191 | int bytes; /* amount stored */ |
@@ -296,4 +225,3 @@ int vuprintf(int (*push)(void *userp, unsigned char data), void *userp, const ch | |||
296 | { | 225 | { |
297 | return format(push, userp, fmt, ap); | 226 | return format(push, userp, fmt, ap); |
298 | } | 227 | } |
299 | |||
diff --git a/firmware/common/strlcat.c b/firmware/common/strlcat.c index da0d253e79..783ea4daba 100644 --- a/firmware/common/strlcat.c +++ b/firmware/common/strlcat.c | |||
@@ -16,7 +16,6 @@ | |||
16 | * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | 16 | * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
17 | */ | 17 | */ |
18 | 18 | ||
19 | #include <sys/types.h> | ||
20 | #include <string.h> | 19 | #include <string.h> |
21 | 20 | ||
22 | /* | 21 | /* |
diff --git a/firmware/common/strlcpy.c b/firmware/common/strlcpy.c index 6e06eb81d2..e320649140 100644 --- a/firmware/common/strlcpy.c +++ b/firmware/common/strlcpy.c | |||
@@ -16,7 +16,6 @@ | |||
16 | * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | 16 | * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
17 | */ | 17 | */ |
18 | 18 | ||
19 | #include <sys/types.h> | ||
20 | #include <string.h> | 19 | #include <string.h> |
21 | 20 | ||
22 | /* | 21 | /* |
diff --git a/firmware/common/timefuncs.c b/firmware/common/timefuncs.c index e423e016fd..42babbd8e3 100644 --- a/firmware/common/timefuncs.c +++ b/firmware/common/timefuncs.c | |||
@@ -103,43 +103,6 @@ int set_time(const struct tm *tm) | |||
103 | #endif /* RTC */ | 103 | #endif /* RTC */ |
104 | } | 104 | } |
105 | 105 | ||
106 | #if CONFIG_RTC | ||
107 | /* mktime() code taken from lynx-2.8.5 source, written | ||
108 | by Philippe De Muyter <phdm@macqel.be> */ | ||
109 | time_t mktime(struct tm *t) | ||
110 | { | ||
111 | short month, year; | ||
112 | time_t result; | ||
113 | static int m_to_d[12] = | ||
114 | {0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334}; | ||
115 | |||
116 | month = t->tm_mon; | ||
117 | year = t->tm_year + month / 12 + 1900; | ||
118 | month %= 12; | ||
119 | if (month < 0) | ||
120 | { | ||
121 | year -= 1; | ||
122 | month += 12; | ||
123 | } | ||
124 | result = (year - 1970) * 365 + (year - 1969) / 4 + m_to_d[month]; | ||
125 | result = (year - 1970) * 365 + m_to_d[month]; | ||
126 | if (month <= 1) | ||
127 | year -= 1; | ||
128 | result += (year - 1968) / 4; | ||
129 | result -= (year - 1900) / 100; | ||
130 | result += (year - 1600) / 400; | ||
131 | result += t->tm_mday; | ||
132 | result -= 1; | ||
133 | result *= 24; | ||
134 | result += t->tm_hour; | ||
135 | result *= 60; | ||
136 | result += t->tm_min; | ||
137 | result *= 60; | ||
138 | result += t->tm_sec; | ||
139 | return(result); | ||
140 | } | ||
141 | #endif | ||
142 | |||
143 | void set_day_of_week(struct tm *tm) | 106 | void set_day_of_week(struct tm *tm) |
144 | { | 107 | { |
145 | int y=tm->tm_year+1900; | 108 | int y=tm->tm_year+1900; |
diff --git a/firmware/drivers/lcd-bitmap-common.c b/firmware/drivers/lcd-bitmap-common.c index 8f0b61ef6a..1b31ee8a18 100644 --- a/firmware/drivers/lcd-bitmap-common.c +++ b/firmware/drivers/lcd-bitmap-common.c | |||
@@ -27,8 +27,9 @@ | |||
27 | * KIND, either express or implied. | 27 | * KIND, either express or implied. |
28 | * | 28 | * |
29 | ****************************************************************************/ | 29 | ****************************************************************************/ |
30 | #include "stdarg.h" | 30 | #include <stdarg.h> |
31 | #include "sprintf.h" | 31 | #include <stdio.h> |
32 | #include "string-extra.h" | ||
32 | #include "diacritic.h" | 33 | #include "diacritic.h" |
33 | 34 | ||
34 | #ifndef LCDFN /* Not compiling for remote - define macros for main LCD. */ | 35 | #ifndef LCDFN /* Not compiling for remote - define macros for main LCD. */ |
diff --git a/firmware/drivers/lcd-charcell.c b/firmware/drivers/lcd-charcell.c index 8af08e64bb..0186c26106 100644 --- a/firmware/drivers/lcd-charcell.c +++ b/firmware/drivers/lcd-charcell.c | |||
@@ -22,7 +22,6 @@ | |||
22 | #include "config.h" | 22 | #include "config.h" |
23 | #include "hwcompat.h" | 23 | #include "hwcompat.h" |
24 | #include "stdarg.h" | 24 | #include "stdarg.h" |
25 | #include "sprintf.h" | ||
26 | #include "lcd.h" | 25 | #include "lcd.h" |
27 | #include "kernel.h" | 26 | #include "kernel.h" |
28 | #include "thread.h" | 27 | #include "thread.h" |
diff --git a/firmware/drivers/tuner/lv24020lp.c b/firmware/drivers/tuner/lv24020lp.c index 5f23338eee..75796a5d7b 100644 --- a/firmware/drivers/tuner/lv24020lp.c +++ b/firmware/drivers/tuner/lv24020lp.c | |||
@@ -40,7 +40,6 @@ static struct mutex tuner_mtx; | |||
40 | #undef SANYO_TUNER_LOGF | 40 | #undef SANYO_TUNER_LOGF |
41 | 41 | ||
42 | #ifdef SANYO_TUNER_LOG_FILE | 42 | #ifdef SANYO_TUNER_LOG_FILE |
43 | #include "sprintf.h" | ||
44 | #include "file.h" | 43 | #include "file.h" |
45 | 44 | ||
46 | static int fd_log = -1; | 45 | static int fd_log = -1; |
diff --git a/firmware/export/audio.h b/firmware/export/audio.h index 6833761652..1e09081ba5 100644 --- a/firmware/export/audio.h +++ b/firmware/export/audio.h | |||
@@ -22,7 +22,7 @@ | |||
22 | #define AUDIO_H | 22 | #define AUDIO_H |
23 | 23 | ||
24 | #include <stdbool.h> | 24 | #include <stdbool.h> |
25 | #include <sys/types.h> | 25 | #include <string.h> /* size_t */ |
26 | #include "config.h" | 26 | #include "config.h" |
27 | /* These must always be included with audio.h for this to compile under | 27 | /* These must always be included with audio.h for this to compile under |
28 | cetain conditions. Do it here or else spread the complication around to | 28 | cetain conditions. Do it here or else spread the complication around to |
diff --git a/firmware/export/config/sim.h b/firmware/export/config/sim.h index 56c3e18229..5b42394b1f 100644 --- a/firmware/export/config/sim.h +++ b/firmware/export/config/sim.h | |||
@@ -95,3 +95,5 @@ | |||
95 | /* default for 100% in the sim */ | 95 | /* default for 100% in the sim */ |
96 | #define DEFAULT_BRIGHTNESS_SETTING MAX_BRIGHTNESS_SETTING | 96 | #define DEFAULT_BRIGHTNESS_SETTING MAX_BRIGHTNESS_SETTING |
97 | #endif | 97 | #endif |
98 | |||
99 | #define _ISOC99_SOURCE 1 | ||
diff --git a/firmware/export/pcm.h b/firmware/export/pcm.h index e67d459693..0f8222f90d 100644 --- a/firmware/export/pcm.h +++ b/firmware/export/pcm.h | |||
@@ -21,7 +21,7 @@ | |||
21 | #ifndef PCM_PLAYBACK_H | 21 | #ifndef PCM_PLAYBACK_H |
22 | #define PCM_PLAYBACK_H | 22 | #define PCM_PLAYBACK_H |
23 | 23 | ||
24 | #include <sys/types.h> | 24 | #include <string.h> /* size_t */ |
25 | 25 | ||
26 | #define DMA_REC_ERROR_DMA (-1) | 26 | #define DMA_REC_ERROR_DMA (-1) |
27 | #ifdef HAVE_SPDIF_REC | 27 | #ifdef HAVE_SPDIF_REC |
diff --git a/firmware/firmware.make b/firmware/firmware.make index ec24b4ebee..115bfacad0 100644 --- a/firmware/firmware.make +++ b/firmware/firmware.make | |||
@@ -7,7 +7,7 @@ | |||
7 | # $Id$ | 7 | # $Id$ |
8 | # | 8 | # |
9 | 9 | ||
10 | INCLUDES += -I$(FIRMDIR) -I$(FIRMDIR)/include -I$(FIRMDIR)/export -I$(FIRMDIR)/common -I$(FIRMDIR)/drivers | 10 | INCLUDES += -I$(FIRMDIR)/libc/include -I$(FIRMDIR) -I$(FIRMDIR)/export -I$(FIRMDIR)/drivers -I$(FIRMDIR)/include |
11 | 11 | ||
12 | FIRMLIB_SRC += $(call preprocess, $(FIRMDIR)/SOURCES) | 12 | FIRMLIB_SRC += $(call preprocess, $(FIRMDIR)/SOURCES) |
13 | FIRMLIB_OBJ := $(call c2obj, $(FIRMLIB_SRC)) | 13 | FIRMLIB_OBJ := $(call c2obj, $(FIRMLIB_SRC)) |
diff --git a/firmware/general.c b/firmware/general.c index 6f7238ead1..fa1025492b 100644 --- a/firmware/general.c +++ b/firmware/general.c | |||
@@ -20,13 +20,13 @@ | |||
20 | ****************************************************************************/ | 20 | ****************************************************************************/ |
21 | 21 | ||
22 | #include "config.h" | 22 | #include "config.h" |
23 | #include <stdio.h> | ||
23 | #include "general.h" | 24 | #include "general.h" |
24 | 25 | ||
25 | #include "dir.h" | 26 | #include "dir.h" |
26 | #include "limits.h" | 27 | #include "limits.h" |
27 | #include "sprintf.h" | ||
28 | #include "stdlib.h" | 28 | #include "stdlib.h" |
29 | #include "string.h" | 29 | #include "string-extra.h" |
30 | #include "system.h" | 30 | #include "system.h" |
31 | #include "time.h" | 31 | #include "time.h" |
32 | #include "timefuncs.h" | 32 | #include "timefuncs.h" |
diff --git a/firmware/ifp_usb_serial.c b/firmware/ifp_usb_serial.c index 06b286ab85..530f2c122b 100644 --- a/firmware/ifp_usb_serial.c +++ b/firmware/ifp_usb_serial.c | |||
@@ -37,7 +37,6 @@ | |||
37 | 37 | ||
38 | #ifdef LCD_DEBUG | 38 | #ifdef LCD_DEBUG |
39 | #include "lcd.h" | 39 | #include "lcd.h" |
40 | #include "sprintf.h" | ||
41 | #endif | 40 | #endif |
42 | 41 | ||
43 | 42 | ||
diff --git a/firmware/include/file.h b/firmware/include/file.h index ec0ab87759..2d5c9b88ab 100644 --- a/firmware/include/file.h +++ b/firmware/include/file.h | |||
@@ -23,6 +23,7 @@ | |||
23 | #define _FILE_H_ | 23 | #define _FILE_H_ |
24 | 24 | ||
25 | #include <sys/types.h> | 25 | #include <sys/types.h> |
26 | #include "_ansi.h" | ||
26 | 27 | ||
27 | #undef MAX_PATH /* this avoids problems when building simulator */ | 28 | #undef MAX_PATH /* this avoids problems when building simulator */ |
28 | #define MAX_PATH 260 | 29 | #define MAX_PATH 260 |
@@ -94,5 +95,5 @@ extern int rename(const char* path, const char* newname); | |||
94 | extern int ftruncate(int fd, off_t length); | 95 | extern int ftruncate(int fd, off_t length); |
95 | extern off_t filesize(int fd); | 96 | extern off_t filesize(int fd); |
96 | extern int release_files(int volume); | 97 | extern int release_files(int volume); |
97 | 98 | int fdprintf (int fd, const char *fmt, ...) ATTRIBUTE_PRINTF(2, 3); | |
98 | #endif | 99 | #endif |
diff --git a/firmware/include/sprintf.h b/firmware/include/format.h index 869b73eb13..6a00574644 100644 --- a/firmware/include/sprintf.h +++ b/firmware/include/format.h | |||
@@ -19,22 +19,19 @@ | |||
19 | * | 19 | * |
20 | ****************************************************************************/ | 20 | ****************************************************************************/ |
21 | 21 | ||
22 | #ifndef __SPRINTF_H__ | 22 | #ifndef __FORMAT_H__ |
23 | #define __SPRINTF_H__ | 23 | #define __FORMAT_H__ |
24 | 24 | ||
25 | #include <stddef.h> | 25 | int format( |
26 | #include <stdarg.h> | 26 | /* call 'push()' for each output letter */ |
27 | #include <_ansi.h> | 27 | int (*push)(void *userp, unsigned char data), |
28 | 28 | void *userp, | |
29 | int snprintf (char *buf, size_t size, const char *fmt, ...) | 29 | const char *fmt, |
30 | ATTRIBUTE_PRINTF(3, 4); | 30 | va_list ap); |
31 | |||
32 | int vsnprintf (char *buf, int size, const char *fmt, va_list ap); | ||
33 | int fdprintf (int fd, const char *fmt, ...) ATTRIBUTE_PRINTF(2, 3); | ||
34 | 31 | ||
35 | /* callback function is called for every output character (byte) with userp and | 32 | /* callback function is called for every output character (byte) with userp and |
36 | * should return 0 when ch is a char other than '\0' that should stop printing */ | 33 | * should return 0 when ch is a char other than '\0' that should stop printing */ |
37 | int vuprintf(int (*push)(void *userp, unsigned char data), | 34 | int vuprintf(int (*push)(void *userp, unsigned char data), |
38 | void *userp, const char *fmt, va_list ap); | 35 | void *userp, const char *fmt, va_list ap); |
39 | 36 | ||
40 | #endif /* __SPRINTF_H__ */ | 37 | #endif /* __FORMAT_H__ */ |
diff --git a/firmware/include/memory.h b/firmware/include/memory.h index 0b12629049..d025bce610 100644 --- a/firmware/include/memory.h +++ b/firmware/include/memory.h | |||
@@ -22,7 +22,7 @@ | |||
22 | #ifndef _MEMORY_H_ | 22 | #ifndef _MEMORY_H_ |
23 | #define _MEMORY_H_ | 23 | #define _MEMORY_H_ |
24 | 24 | ||
25 | #include <sys/types.h> | 25 | #include "inttypes.h" |
26 | 26 | ||
27 | void memset16(void *dst, int val, size_t len); | 27 | void memset16(void *dst, int val, size_t len); |
28 | 28 | ||
diff --git a/firmware/include/strcasecmp.h b/firmware/include/strcasecmp.h new file mode 100644 index 0000000000..630f3c9fd8 --- /dev/null +++ b/firmware/include/strcasecmp.h | |||
@@ -0,0 +1,28 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * $Id$ | ||
9 | * | ||
10 | * Copyright (C) 2010 Thomas Martitz | ||
11 | * | ||
12 | * This program is free software; you can redistribute it and/or | ||
13 | * modify it under the terms of the GNU General Public License | ||
14 | * as published by the Free Software Foundation; either version 2 | ||
15 | * of the License, or (at your option) any later version. | ||
16 | * | ||
17 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY | ||
18 | * KIND, either express or implied. | ||
19 | * | ||
20 | ****************************************************************************/ | ||
21 | |||
22 | |||
23 | #ifndef __STRCASECMP_H__ | ||
24 | #define __STRCASECMP_H__ | ||
25 | #include <string.h> | ||
26 | int strcasecmp(const char *s1, const char *s2); | ||
27 | int strncasecmp(const char *s1, const char *s2, size_t n); | ||
28 | #endif | ||
diff --git a/firmware/include/strcasestr.h b/firmware/include/strcasestr.h new file mode 100644 index 0000000000..a6d2f2c472 --- /dev/null +++ b/firmware/include/strcasestr.h | |||
@@ -0,0 +1,26 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * $Id$ | ||
9 | * | ||
10 | * Copyright (C) 2010 Thomas Martitz | ||
11 | * | ||
12 | * This program is free software; you can redistribute it and/or | ||
13 | * modify it under the terms of the GNU General Public License | ||
14 | * as published by the Free Software Foundation; either version 2 | ||
15 | * of the License, or (at your option) any later version. | ||
16 | * | ||
17 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY | ||
18 | * KIND, either express or implied. | ||
19 | * | ||
20 | ****************************************************************************/ | ||
21 | |||
22 | |||
23 | #ifndef __STRLCASESTR_H__ | ||
24 | #define __STRLCASESTR_H__ | ||
25 | char *strcasestr(const char *, const char *); | ||
26 | #endif | ||
diff --git a/firmware/include/string-extra.h b/firmware/include/string-extra.h new file mode 100644 index 0000000000..5fe5ab8119 --- /dev/null +++ b/firmware/include/string-extra.h | |||
@@ -0,0 +1,27 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * $Id$ | ||
9 | * | ||
10 | * Copyright (C) 2010 Thomas Martitz | ||
11 | * | ||
12 | * This program is free software; you can redistribute it and/or | ||
13 | * modify it under the terms of the GNU General Public License | ||
14 | * as published by the Free Software Foundation; either version 2 | ||
15 | * of the License, or (at your option) any later version. | ||
16 | * | ||
17 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY | ||
18 | * KIND, either express or implied. | ||
19 | * | ||
20 | ****************************************************************************/ | ||
21 | |||
22 | |||
23 | #include <string.h> | ||
24 | #include "strlcpy.h" | ||
25 | #include "strlcat.h" | ||
26 | #include "strcasecmp.h" | ||
27 | #include "strcasestr.h" | ||
diff --git a/firmware/include/strlcat.h b/firmware/include/strlcat.h new file mode 100644 index 0000000000..dbde60c21b --- /dev/null +++ b/firmware/include/strlcat.h | |||
@@ -0,0 +1,26 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * $Id$ | ||
9 | * | ||
10 | * Copyright (C) 2010 Thomas Martitz | ||
11 | * | ||
12 | * This program is free software; you can redistribute it and/or | ||
13 | * modify it under the terms of the GNU General Public License | ||
14 | * as published by the Free Software Foundation; either version 2 | ||
15 | * of the License, or (at your option) any later version. | ||
16 | * | ||
17 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY | ||
18 | * KIND, either express or implied. | ||
19 | * | ||
20 | ****************************************************************************/ | ||
21 | |||
22 | |||
23 | #ifndef __STRLCAT_H__ | ||
24 | #define __STRLCAT_H__ | ||
25 | size_t strlcat(char *dst, const char *src, size_t siz); | ||
26 | #endif | ||
diff --git a/firmware/include/strlcpy.h b/firmware/include/strlcpy.h new file mode 100644 index 0000000000..f94ed52ba8 --- /dev/null +++ b/firmware/include/strlcpy.h | |||
@@ -0,0 +1,26 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * $Id$ | ||
9 | * | ||
10 | * Copyright (C) 2010 Thomas Martitz | ||
11 | * | ||
12 | * This program is free software; you can redistribute it and/or | ||
13 | * modify it under the terms of the GNU General Public License | ||
14 | * as published by the Free Software Foundation; either version 2 | ||
15 | * of the License, or (at your option) any later version. | ||
16 | * | ||
17 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY | ||
18 | * KIND, either express or implied. | ||
19 | * | ||
20 | ****************************************************************************/ | ||
21 | |||
22 | |||
23 | #ifndef __STRLCPY_H__ | ||
24 | #define __STRLCPY_H__ | ||
25 | size_t strlcpy(char *dst, const char *src, size_t siz); | ||
26 | #endif | ||
diff --git a/firmware/include/sys/types.h b/firmware/include/sys/types.h index 95181dab19..07f9e9c8c7 100644 --- a/firmware/include/sys/types.h +++ b/firmware/include/sys/types.h | |||
@@ -7,7 +7,7 @@ | |||
7 | * \/ \/ \/ \/ \/ | 7 | * \/ \/ \/ \/ \/ |
8 | * $Id$ | 8 | * $Id$ |
9 | * | 9 | * |
10 | * Copyright (C) 2005 by Daniel Stenberg | 10 | * Copyright (C) 2010 Thomas Martitz |
11 | * | 11 | * |
12 | * This program is free software; you can redistribute it and/or | 12 | * This program is free software; you can redistribute it and/or |
13 | * modify it under the terms of the GNU General Public License | 13 | * modify it under the terms of the GNU General Public License |
@@ -19,8 +19,17 @@ | |||
19 | * | 19 | * |
20 | ****************************************************************************/ | 20 | ****************************************************************************/ |
21 | 21 | ||
22 | #ifndef _SYS_TYPES_H_ | 22 | /** |
23 | #define _SYS_TYPES_H_ | 23 | * provide a sys/types.h for compatibility with imported code |
24 | **/ | ||
25 | |||
26 | #ifndef __TYPES_H__ | ||
27 | #define __TYPES_H__ | ||
28 | |||
29 | |||
30 | /* | ||
31 | * include string.h for size_t for convinence */ | ||
32 | #include <string.h> | ||
24 | 33 | ||
25 | #if !defined(__ssize_t_defined) && !defined(_SSIZE_T_) && !defined(ssize_t) && !defined(_SSIZE_T_DECLARED) | 34 | #if !defined(__ssize_t_defined) && !defined(_SSIZE_T_) && !defined(ssize_t) && !defined(_SSIZE_T_DECLARED) |
26 | #define __ssize_t_defined | 35 | #define __ssize_t_defined |
@@ -43,10 +52,4 @@ typedef signed long off_t; | |||
43 | typedef unsigned int mode_t; | 52 | typedef unsigned int mode_t; |
44 | #endif | 53 | #endif |
45 | 54 | ||
46 | #if !defined(_SIZE_T) && !defined(_SIZE_T_DECLARED) | 55 | #endif /* __TYPES_H__ */ |
47 | #define _SIZE_T | ||
48 | #define _SIZE_T_DECLARED | ||
49 | typedef unsigned long size_t; | ||
50 | #endif | ||
51 | |||
52 | #endif /* _SYS_TYPES_H */ | ||
diff --git a/firmware/include/timefuncs.h b/firmware/include/timefuncs.h index f51fa996cc..86a41a516b 100644 --- a/firmware/include/timefuncs.h +++ b/firmware/include/timefuncs.h | |||
@@ -30,9 +30,6 @@ struct tm *get_time(void); | |||
30 | int set_time(const struct tm *tm); | 30 | int set_time(const struct tm *tm); |
31 | bool valid_time(const struct tm *tm); | 31 | bool valid_time(const struct tm *tm); |
32 | void set_day_of_week(struct tm *tm); | 32 | void set_day_of_week(struct tm *tm); |
33 | #if CONFIG_RTC | ||
34 | time_t mktime(struct tm *t); | ||
35 | #endif | ||
36 | 33 | ||
37 | #endif /* _TIMEFUNCS_H_ */ | 34 | #endif /* _TIMEFUNCS_H_ */ |
38 | 35 | ||
diff --git a/firmware/common/atoi.c b/firmware/libc/atoi.c index 3393839b27..3393839b27 100644 --- a/firmware/common/atoi.c +++ b/firmware/libc/atoi.c | |||
diff --git a/firmware/common/ctype.c b/firmware/libc/ctype.c index 6e9b4eb601..6e9b4eb601 100644 --- a/firmware/common/ctype.c +++ b/firmware/libc/ctype.c | |||
diff --git a/firmware/common/errno.c b/firmware/libc/errno.c index 6e7bb62b51..6e7bb62b51 100644 --- a/firmware/common/errno.c +++ b/firmware/libc/errno.c | |||
diff --git a/firmware/include/ctype.h b/firmware/libc/include/ctype.h index 648e06dc5c..648e06dc5c 100644 --- a/firmware/include/ctype.h +++ b/firmware/libc/include/ctype.h | |||
diff --git a/firmware/include/errno.h b/firmware/libc/include/errno.h index 6a24a1938f..6a24a1938f 100644 --- a/firmware/include/errno.h +++ b/firmware/libc/include/errno.h | |||
diff --git a/firmware/include/sscanf.h b/firmware/libc/include/inttypes.h index 26f63dd16d..c03609c6d8 100644 --- a/firmware/include/sscanf.h +++ b/firmware/libc/include/inttypes.h | |||
@@ -7,7 +7,7 @@ | |||
7 | * \/ \/ \/ \/ \/ | 7 | * \/ \/ \/ \/ \/ |
8 | * $Id$ | 8 | * $Id$ |
9 | * | 9 | * |
10 | * Copyright (C) 2006 by Tomasz Malesinski | 10 | * Copyright (C) 2005 by Dave Chapman |
11 | * | 11 | * |
12 | * This program is free software; you can redistribute it and/or | 12 | * This program is free software; you can redistribute it and/or |
13 | * modify it under the terms of the GNU General Public License | 13 | * modify it under the terms of the GNU General Public License |
@@ -18,15 +18,12 @@ | |||
18 | * KIND, either express or implied. | 18 | * KIND, either express or implied. |
19 | * | 19 | * |
20 | ****************************************************************************/ | 20 | ****************************************************************************/ |
21 | |||
22 | #ifndef __INTTYPES_H__ | ||
23 | #define __INTTYPES_H__ | ||
21 | 24 | ||
22 | #ifndef __SSCANF_H__ | 25 | #include <stdint.h> |
23 | #define __SSCANF_H__ | ||
24 | 26 | ||
25 | #include <stddef.h> | 27 | /* could possibly have (f)printf format specifies here */ |
26 | #include <stdarg.h> | ||
27 | #include <_ansi.h> | ||
28 | 28 | ||
29 | int sscanf(const char *s, const char *fmt, ...) | 29 | #endif /* __INTTYPES_H__ */ |
30 | ATTRIBUTE_SCANF(2, 3); | ||
31 | |||
32 | #endif /* __SSCANF_H__ */ | ||
diff --git a/firmware/include/inttypes.h b/firmware/libc/include/stdint.h index f7f5099bd7..93f234c0e8 100644 --- a/firmware/include/inttypes.h +++ b/firmware/libc/include/stdint.h | |||
@@ -19,10 +19,8 @@ | |||
19 | * | 19 | * |
20 | ****************************************************************************/ | 20 | ****************************************************************************/ |
21 | 21 | ||
22 | #ifndef __INTTYPES_H__ | 22 | #ifndef __STDINT_H__ |
23 | #define __INTTYPES_H__ | 23 | #define __STDINT_H__ |
24 | |||
25 | #ifndef WPSEDITOR | ||
26 | 24 | ||
27 | #include <limits.h> | 25 | #include <limits.h> |
28 | 26 | ||
@@ -105,8 +103,5 @@ | |||
105 | #define uint64_t unsigned long long | 103 | #define uint64_t unsigned long long |
106 | 104 | ||
107 | #endif | 105 | #endif |
108 | #else | ||
109 | #include <stdint.h> | ||
110 | #endif /* !WPSEDITOR*/ | ||
111 | 106 | ||
112 | #endif /* __INTTYPES_H__ */ | 107 | #endif /* __STDINT_H__ */ |
diff --git a/firmware/include/stdio.h b/firmware/libc/include/stdio.h index 6ae2ff603a..d9a6dce55f 100644 --- a/firmware/include/stdio.h +++ b/firmware/libc/include/stdio.h | |||
@@ -33,8 +33,20 @@ | |||
33 | #define __VALIST char* | 33 | #define __VALIST char* |
34 | #endif | 34 | #endif |
35 | 35 | ||
36 | int snprintf (char *buf, size_t size, const char *fmt, ...); | 36 | int vsnprintf (char *buf, size_t size, const char *fmt, __VALIST ap); |
37 | int vsnprintf (char *buf, int size, const char *fmt, __VALIST ap); | 37 | |
38 | int sprintf (char *buf, const char *fmt, ...) ATTRIBUTE_PRINTF(2, 3); | ||
39 | |||
40 | int snprintf (char *buf, size_t size, const char *fmt, ...) | ||
41 | ATTRIBUTE_PRINTF(3, 4); | ||
42 | |||
43 | /* callback function is called for every output character (byte) with userp and | ||
44 | * should return 0 when ch is a char other than '\0' that should stop printing */ | ||
45 | int vuprintf(int (*push)(void *userp, unsigned char data), | ||
46 | void *userp, const char *fmt, __VALIST ap); | ||
47 | |||
48 | int sscanf(const char *s, const char *fmt, ...) | ||
49 | ATTRIBUTE_SCANF(2, 3); | ||
38 | 50 | ||
39 | #ifdef SIMULATOR | 51 | #ifdef SIMULATOR |
40 | typedef void FILE; | 52 | typedef void FILE; |
diff --git a/firmware/include/stdlib.h b/firmware/libc/include/stdlib.h index 6de00c816d..5f6db6da8a 100644 --- a/firmware/include/stdlib.h +++ b/firmware/libc/include/stdlib.h | |||
@@ -43,8 +43,8 @@ int rand(void); | |||
43 | #endif /* __GNUC__ */ | 43 | #endif /* __GNUC__ */ |
44 | #endif | 44 | #endif |
45 | 45 | ||
46 | #define abs(x) (ABS(x)) | 46 | #define abs(x) ((int)ABS(x)) |
47 | #define labs(x) abs(x) | 47 | #define labs(x) ((long)abs(x)) |
48 | 48 | ||
49 | #ifdef SIMULATOR | 49 | #ifdef SIMULATOR |
50 | void exit(int status); | 50 | void exit(int status); |
diff --git a/firmware/include/string.h b/firmware/libc/include/string.h index 1a2e056717..8986bd6a0c 100644 --- a/firmware/include/string.h +++ b/firmware/libc/include/string.h | |||
@@ -13,9 +13,17 @@ extern "C" { | |||
13 | 13 | ||
14 | #include "_ansi.h" | 14 | #include "_ansi.h" |
15 | 15 | ||
16 | #define __need_size_t | ||
17 | #include <stddef.h> | 16 | #include <stddef.h> |
18 | 17 | ||
18 | #if !defined(__size_t_defined)&& !defined(_SIZE_T_) && !defined(size_t) && !defined(_SIZE_T_DECLARED) | ||
19 | #define __size_t_defined | ||
20 | #define _SIZE_T | ||
21 | #define _SIZE_T_ | ||
22 | #define _SIZE_T_DECLARED | ||
23 | #define size_t size_t | ||
24 | typedef unsigned long size_t; | ||
25 | #endif | ||
26 | |||
19 | #ifndef NULL | 27 | #ifndef NULL |
20 | #define NULL ((void*)0) | 28 | #define NULL ((void*)0) |
21 | #endif | 29 | #endif |
diff --git a/firmware/include/time.h b/firmware/libc/include/time.h index 28680494f9..912fafe7ca 100644 --- a/firmware/include/time.h +++ b/firmware/libc/include/time.h | |||
@@ -8,7 +8,7 @@ | |||
8 | #define _TIME_H_ | 8 | #define _TIME_H_ |
9 | 9 | ||
10 | #ifdef WPSEDITOR | 10 | #ifdef WPSEDITOR |
11 | #include <sys/types.h> | 11 | #include "inttypes.h" |
12 | #include <time.h> | 12 | #include <time.h> |
13 | #endif | 13 | #endif |
14 | 14 | ||
@@ -34,6 +34,7 @@ typedef long time_t; | |||
34 | #define _TIME_T_DECLARED | 34 | #define _TIME_T_DECLARED |
35 | time_t time(time_t *t); | 35 | time_t time(time_t *t); |
36 | struct tm *localtime(const time_t *timep); | 36 | struct tm *localtime(const time_t *timep); |
37 | time_t mktime(struct tm *t); | ||
37 | 38 | ||
38 | #endif /* SIMULATOR */ | 39 | #endif /* SIMULATOR */ |
39 | 40 | ||
@@ -43,7 +44,6 @@ struct tm *localtime(const time_t *timep); | |||
43 | #undef __USE_MISC | 44 | #undef __USE_MISC |
44 | #endif | 45 | #endif |
45 | 46 | ||
46 | |||
47 | #endif /* _TIME_H_ */ | 47 | #endif /* _TIME_H_ */ |
48 | 48 | ||
49 | 49 | ||
diff --git a/firmware/common/memchr.c b/firmware/libc/memchr.c index 26bdb9eea3..26bdb9eea3 100644 --- a/firmware/common/memchr.c +++ b/firmware/libc/memchr.c | |||
diff --git a/firmware/common/memcmp.c b/firmware/libc/memcmp.c index 1535fcf5b5..1535fcf5b5 100644 --- a/firmware/common/memcmp.c +++ b/firmware/libc/memcmp.c | |||
diff --git a/firmware/common/memcpy.c b/firmware/libc/memcpy.c index a89ac3c557..a89ac3c557 100644 --- a/firmware/common/memcpy.c +++ b/firmware/libc/memcpy.c | |||
diff --git a/firmware/common/memmove.c b/firmware/libc/memmove.c index 5f423964bb..5f423964bb 100644 --- a/firmware/common/memmove.c +++ b/firmware/libc/memmove.c | |||
diff --git a/firmware/common/memset.c b/firmware/libc/memset.c index 6c4a66bf13..7b8d2137e8 100644 --- a/firmware/common/memset.c +++ b/firmware/libc/memset.c | |||
@@ -34,6 +34,7 @@ QUICKREF | |||
34 | */ | 34 | */ |
35 | 35 | ||
36 | #include <string.h> | 36 | #include <string.h> |
37 | #include "_ansi.h" | ||
37 | 38 | ||
38 | #define LBLOCKSIZE (sizeof(long)) | 39 | #define LBLOCKSIZE (sizeof(long)) |
39 | #define UNALIGNED(X) ((long)X & (LBLOCKSIZE - 1)) | 40 | #define UNALIGNED(X) ((long)X & (LBLOCKSIZE - 1)) |
diff --git a/firmware/libc/mktime.c b/firmware/libc/mktime.c new file mode 100644 index 0000000000..a52381ede5 --- /dev/null +++ b/firmware/libc/mktime.c | |||
@@ -0,0 +1,61 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * $Id$ | ||
9 | * | ||
10 | * Copyright (C) 2002 by Linus Nielsen Feltzing | ||
11 | * | ||
12 | * This program is free software; you can redistribute it and/or | ||
13 | * modify it under the terms of the GNU General Public License | ||
14 | * as published by the Free Software Foundation; either version 2 | ||
15 | * of the License, or (at your option) any later version. | ||
16 | * | ||
17 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY | ||
18 | * KIND, either express or implied. | ||
19 | * | ||
20 | ****************************************************************************/ | ||
21 | |||
22 | |||
23 | #include <time.h> | ||
24 | #include "config.h" | ||
25 | |||
26 | #if CONFIG_RTC | ||
27 | /* mktime() code taken from lynx-2.8.5 source, written | ||
28 | by Philippe De Muyter <phdm@macqel.be> */ | ||
29 | time_t mktime(struct tm *t) | ||
30 | { | ||
31 | short month, year; | ||
32 | time_t result; | ||
33 | static int m_to_d[12] = | ||
34 | {0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334}; | ||
35 | |||
36 | month = t->tm_mon; | ||
37 | year = t->tm_year + month / 12 + 1900; | ||
38 | month %= 12; | ||
39 | if (month < 0) | ||
40 | { | ||
41 | year -= 1; | ||
42 | month += 12; | ||
43 | } | ||
44 | result = (year - 1970) * 365 + (year - 1969) / 4 + m_to_d[month]; | ||
45 | result = (year - 1970) * 365 + m_to_d[month]; | ||
46 | if (month <= 1) | ||
47 | year -= 1; | ||
48 | result += (year - 1968) / 4; | ||
49 | result -= (year - 1900) / 100; | ||
50 | result += (year - 1600) / 400; | ||
51 | result += t->tm_mday; | ||
52 | result -= 1; | ||
53 | result *= 24; | ||
54 | result += t->tm_hour; | ||
55 | result *= 60; | ||
56 | result += t->tm_min; | ||
57 | result *= 60; | ||
58 | result += t->tm_sec; | ||
59 | return(result); | ||
60 | } | ||
61 | #endif | ||
diff --git a/firmware/common/qsort.c b/firmware/libc/qsort.c index 8c4d1ad511..8c4d1ad511 100644 --- a/firmware/common/qsort.c +++ b/firmware/libc/qsort.c | |||
diff --git a/firmware/common/random.c b/firmware/libc/random.c index f3efe89351..f3efe89351 100644 --- a/firmware/common/random.c +++ b/firmware/libc/random.c | |||
diff --git a/firmware/libc/sprintf.c b/firmware/libc/sprintf.c new file mode 100644 index 0000000000..b02f5a2fae --- /dev/null +++ b/firmware/libc/sprintf.c | |||
@@ -0,0 +1,93 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * $Id$ | ||
9 | * | ||
10 | * Copyright (C) 2002 by Gary Czvitkovicz | ||
11 | * | ||
12 | * This program is free software; you can redistribute it and/or | ||
13 | * modify it under the terms of the GNU General Public License | ||
14 | * as published by the Free Software Foundation; either version 2 | ||
15 | * of the License, or (at your option) any later version. | ||
16 | * | ||
17 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY | ||
18 | * KIND, either express or implied. | ||
19 | * | ||
20 | ****************************************************************************/ | ||
21 | |||
22 | /* | ||
23 | * Minimal printf and snprintf formatting functions | ||
24 | * | ||
25 | * These support %c %s %d and %x | ||
26 | * Field width and zero-padding flag only | ||
27 | */ | ||
28 | |||
29 | #include <stdio.h> | ||
30 | #include <stdarg.h> | ||
31 | #include <stdbool.h> | ||
32 | #include <limits.h> | ||
33 | #include "format.h" | ||
34 | |||
35 | /* ALSA library requires a more advanced snprintf, so let's not | ||
36 | override it in simulator for Linux. Note that Cygwin requires | ||
37 | our snprintf or it produces garbled output after a while. */ | ||
38 | |||
39 | struct for_snprintf { | ||
40 | unsigned char *ptr; /* where to store it */ | ||
41 | size_t bytes; /* amount already stored */ | ||
42 | size_t max; /* max amount to store */ | ||
43 | }; | ||
44 | |||
45 | static int sprfunc(void *ptr, unsigned char letter) | ||
46 | { | ||
47 | struct for_snprintf *pr = (struct for_snprintf *)ptr; | ||
48 | if(pr->bytes < pr->max) { | ||
49 | *pr->ptr = letter; | ||
50 | pr->ptr++; | ||
51 | pr->bytes++; | ||
52 | return true; | ||
53 | } | ||
54 | return false; /* filled buffer */ | ||
55 | } | ||
56 | |||
57 | |||
58 | int snprintf(char *buf, size_t size, const char *fmt, ...) | ||
59 | { | ||
60 | bool ok; | ||
61 | va_list ap; | ||
62 | struct for_snprintf pr; | ||
63 | |||
64 | pr.ptr = (unsigned char *)buf; | ||
65 | pr.bytes = 0; | ||
66 | pr.max = size; | ||
67 | |||
68 | va_start(ap, fmt); | ||
69 | ok = format(sprfunc, &pr, fmt, ap); | ||
70 | va_end(ap); | ||
71 | |||
72 | /* make sure it ends with a trailing zero */ | ||
73 | pr.ptr[(pr.bytes < pr.max) ? 0 : -1] = '\0'; | ||
74 | |||
75 | return pr.bytes; | ||
76 | } | ||
77 | |||
78 | int vsnprintf(char *buf, size_t size, const char *fmt, va_list ap) | ||
79 | { | ||
80 | bool ok; | ||
81 | struct for_snprintf pr; | ||
82 | |||
83 | pr.ptr = (unsigned char *)buf; | ||
84 | pr.bytes = 0; | ||
85 | pr.max = size; | ||
86 | |||
87 | ok = format(sprfunc, &pr, fmt, ap); | ||
88 | |||
89 | /* make sure it ends with a trailing zero */ | ||
90 | pr.ptr[(pr.bytes < pr.max) ? 0 : -1] = '\0'; | ||
91 | |||
92 | return pr.bytes; | ||
93 | } | ||
diff --git a/firmware/common/sscanf.c b/firmware/libc/sscanf.c index 5fbe81f3e0..5fbe81f3e0 100644 --- a/firmware/common/sscanf.c +++ b/firmware/libc/sscanf.c | |||
diff --git a/firmware/common/strcat.c b/firmware/libc/strcat.c index 221529519c..221529519c 100644 --- a/firmware/common/strcat.c +++ b/firmware/libc/strcat.c | |||
diff --git a/firmware/common/strchr.c b/firmware/libc/strchr.c index 96acf5edf6..96acf5edf6 100644 --- a/firmware/common/strchr.c +++ b/firmware/libc/strchr.c | |||
diff --git a/firmware/common/strcmp.c b/firmware/libc/strcmp.c index bbbf4b174a..bbbf4b174a 100644 --- a/firmware/common/strcmp.c +++ b/firmware/libc/strcmp.c | |||
diff --git a/firmware/common/strcpy.c b/firmware/libc/strcpy.c index 077ae73cc6..077ae73cc6 100644 --- a/firmware/common/strcpy.c +++ b/firmware/libc/strcpy.c | |||
diff --git a/firmware/common/strlen.c b/firmware/libc/strlen.c index 4d33eafce6..4d33eafce6 100644 --- a/firmware/common/strlen.c +++ b/firmware/libc/strlen.c | |||
diff --git a/firmware/common/strncmp.c b/firmware/libc/strncmp.c index b1d8d9d43a..b1d8d9d43a 100644 --- a/firmware/common/strncmp.c +++ b/firmware/libc/strncmp.c | |||
diff --git a/firmware/common/strrchr.c b/firmware/libc/strrchr.c index 31b0d049b3..31b0d049b3 100644 --- a/firmware/common/strrchr.c +++ b/firmware/libc/strrchr.c | |||
diff --git a/firmware/common/strstr.c b/firmware/libc/strstr.c index 73fab1cc63..73fab1cc63 100644 --- a/firmware/common/strstr.c +++ b/firmware/libc/strstr.c | |||
diff --git a/firmware/common/strtok.c b/firmware/libc/strtok.c index 9e2eddf599..9e2eddf599 100644 --- a/firmware/common/strtok.c +++ b/firmware/libc/strtok.c | |||
diff --git a/firmware/profile.c b/firmware/profile.c index 30a1e9fccc..0545acce3c 100644 --- a/firmware/profile.c +++ b/firmware/profile.c | |||
@@ -59,7 +59,7 @@ | |||
59 | #include <system.h> | 59 | #include <system.h> |
60 | #include <string.h> | 60 | #include <string.h> |
61 | #include <timer.h> | 61 | #include <timer.h> |
62 | #include <sys/types.h> | 62 | #include "inttypes.h" |
63 | #include "profile.h" | 63 | #include "profile.h" |
64 | 64 | ||
65 | /* PFD is Profiled Function Data */ | 65 | /* PFD is Profiled Function Data */ |
diff --git a/firmware/rolo.c b/firmware/rolo.c index 0f398770e6..69166785ad 100644 --- a/firmware/rolo.c +++ b/firmware/rolo.c | |||
@@ -24,7 +24,6 @@ | |||
24 | #include "lcd-remote.h" | 24 | #include "lcd-remote.h" |
25 | #include "thread.h" | 25 | #include "thread.h" |
26 | #include "kernel.h" | 26 | #include "kernel.h" |
27 | #include "sprintf.h" | ||
28 | #include "button.h" | 27 | #include "button.h" |
29 | #include "file.h" | 28 | #include "file.h" |
30 | #include "audio.h" | 29 | #include "audio.h" |
diff --git a/firmware/target/arm/as3525/debug-as3525.c b/firmware/target/arm/as3525/debug-as3525.c index cfd7c37b16..75cce72dcd 100644 --- a/firmware/target/arm/as3525/debug-as3525.c +++ b/firmware/target/arm/as3525/debug-as3525.c | |||
@@ -25,7 +25,6 @@ | |||
25 | #include "lcd.h" | 25 | #include "lcd.h" |
26 | #include "font.h" | 26 | #include "font.h" |
27 | #include "system.h" | 27 | #include "system.h" |
28 | #include "sprintf.h" | ||
29 | #include "cpu.h" | 28 | #include "cpu.h" |
30 | #include "pl180.h" | 29 | #include "pl180.h" |
31 | #include "ascodec-target.h" | 30 | #include "ascodec-target.h" |
diff --git a/firmware/target/arm/imx31/debug-imx31.c b/firmware/target/arm/imx31/debug-imx31.c index 783ba728a6..07f9453b29 100644 --- a/firmware/target/arm/imx31/debug-imx31.c +++ b/firmware/target/arm/imx31/debug-imx31.c | |||
@@ -23,7 +23,6 @@ | |||
23 | #include "string.h" | 23 | #include "string.h" |
24 | #include "button.h" | 24 | #include "button.h" |
25 | #include "lcd.h" | 25 | #include "lcd.h" |
26 | #include "sprintf.h" | ||
27 | #include "font.h" | 26 | #include "font.h" |
28 | #include "debug-target.h" | 27 | #include "debug-target.h" |
29 | #include "mc13783.h" | 28 | #include "mc13783.h" |
diff --git a/firmware/target/arm/imx31/gigabeat-s/lcd-gigabeat-s.c b/firmware/target/arm/imx31/gigabeat-s/lcd-gigabeat-s.c index 71d8e4bef4..5a0f81358d 100644 --- a/firmware/target/arm/imx31/gigabeat-s/lcd-gigabeat-s.c +++ b/firmware/target/arm/imx31/gigabeat-s/lcd-gigabeat-s.c | |||
@@ -18,7 +18,7 @@ | |||
18 | * KIND, either express or implied. | 18 | * KIND, either express or implied. |
19 | * | 19 | * |
20 | ****************************************************************************/ | 20 | ****************************************************************************/ |
21 | #include <sys/types.h> | 21 | #include "inttypes.h" |
22 | 22 | ||
23 | #include "config.h" | 23 | #include "config.h" |
24 | #include "cpu.h" | 24 | #include "cpu.h" |
diff --git a/firmware/target/arm/ipod/video/lcd-video.c b/firmware/target/arm/ipod/video/lcd-video.c index ea9738b3a4..74d627730f 100644 --- a/firmware/target/arm/ipod/video/lcd-video.c +++ b/firmware/target/arm/ipod/video/lcd-video.c | |||
@@ -25,8 +25,8 @@ | |||
25 | * KIND, either express or implied. | 25 | * KIND, either express or implied. |
26 | * | 26 | * |
27 | ****************************************************************************/ | 27 | ****************************************************************************/ |
28 | #include <sys/types.h> | ||
29 | 28 | ||
29 | #include <sys/types.h> /* off_t */ | ||
30 | #include "config.h" | 30 | #include "config.h" |
31 | #include "cpu.h" | 31 | #include "cpu.h" |
32 | #include "lcd.h" | 32 | #include "lcd.h" |
diff --git a/firmware/target/arm/lcd-c200_c200v2.c b/firmware/target/arm/lcd-c200_c200v2.c index 45a37d9d7b..14749aa1ff 100644 --- a/firmware/target/arm/lcd-c200_c200v2.c +++ b/firmware/target/arm/lcd-c200_c200v2.c | |||
@@ -18,7 +18,7 @@ | |||
18 | * KIND, either express or implied. | 18 | * KIND, either express or implied. |
19 | * | 19 | * |
20 | ****************************************************************************/ | 20 | ****************************************************************************/ |
21 | #include <sys/types.h> | 21 | #include "inttypes.h" |
22 | 22 | ||
23 | #include "config.h" | 23 | #include "config.h" |
24 | #include "cpu.h" | 24 | #include "cpu.h" |
diff --git a/firmware/target/arm/philips/hdd1630/lcd-hdd1630.c b/firmware/target/arm/philips/hdd1630/lcd-hdd1630.c index 500120a432..93abd300ec 100644 --- a/firmware/target/arm/philips/hdd1630/lcd-hdd1630.c +++ b/firmware/target/arm/philips/hdd1630/lcd-hdd1630.c | |||
@@ -18,7 +18,7 @@ | |||
18 | * KIND, either express or implied. | 18 | * KIND, either express or implied. |
19 | * | 19 | * |
20 | ****************************************************************************/ | 20 | ****************************************************************************/ |
21 | #include <sys/types.h> | 21 | #include "inttypes.h" |
22 | 22 | ||
23 | #include "config.h" | 23 | #include "config.h" |
24 | #include "cpu.h" | 24 | #include "cpu.h" |
diff --git a/firmware/target/arm/pnx0101/iriver-ifp7xx/usb-ifp7xx.c b/firmware/target/arm/pnx0101/iriver-ifp7xx/usb-ifp7xx.c index 7e0594b47d..2f3c4189e5 100644 --- a/firmware/target/arm/pnx0101/iriver-ifp7xx/usb-ifp7xx.c +++ b/firmware/target/arm/pnx0101/iriver-ifp7xx/usb-ifp7xx.c | |||
@@ -31,7 +31,6 @@ | |||
31 | #include "lcd.h" | 31 | #include "lcd.h" |
32 | #include "usb.h" | 32 | #include "usb.h" |
33 | #include "button.h" | 33 | #include "button.h" |
34 | #include "sprintf.h" | ||
35 | #include "string.h" | 34 | #include "string.h" |
36 | 35 | ||
37 | void usb_init_device(void) | 36 | void usb_init_device(void) |
diff --git a/firmware/target/arm/s3c2440/debug-s3c2440.c b/firmware/target/arm/s3c2440/debug-s3c2440.c index 064cca9135..196a0b4177 100644 --- a/firmware/target/arm/s3c2440/debug-s3c2440.c +++ b/firmware/target/arm/s3c2440/debug-s3c2440.c | |||
@@ -26,7 +26,6 @@ | |||
26 | #include <stdbool.h> | 26 | #include <stdbool.h> |
27 | #include "button.h" | 27 | #include "button.h" |
28 | #include "lcd.h" | 28 | #include "lcd.h" |
29 | #include "sprintf.h" | ||
30 | #include "font.h" | 29 | #include "font.h" |
31 | #include "debug-target.h" | 30 | #include "debug-target.h" |
32 | 31 | ||
diff --git a/firmware/target/arm/s3c2440/lcd-s3c2440.c b/firmware/target/arm/s3c2440/lcd-s3c2440.c index 8b24aced5b..b9f7d3ef3d 100644 --- a/firmware/target/arm/s3c2440/lcd-s3c2440.c +++ b/firmware/target/arm/s3c2440/lcd-s3c2440.c | |||
@@ -18,8 +18,8 @@ | |||
18 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY | 18 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY |
19 | * KIND, either express or implied. | 19 | * KIND, either express or implied. |
20 | * | 20 | * |
21 | ****************************************************************************/ | 21 | ****************************************************************************/ |
22 | #include <sys/types.h> | 22 | #include <sys/types.h> /* off_t */ |
23 | 23 | ||
24 | #include "config.h" | 24 | #include "config.h" |
25 | #include "system.h" | 25 | #include "system.h" |
diff --git a/firmware/target/arm/s5l8700/debug-s5l8700.c b/firmware/target/arm/s5l8700/debug-s5l8700.c index 0ad76037f0..96df1546ef 100644 --- a/firmware/target/arm/s5l8700/debug-s5l8700.c +++ b/firmware/target/arm/s5l8700/debug-s5l8700.c | |||
@@ -26,7 +26,6 @@ | |||
26 | #include "button.h" | 26 | #include "button.h" |
27 | #include "lcd.h" | 27 | #include "lcd.h" |
28 | #include "font.h" | 28 | #include "font.h" |
29 | #include "sprintf.h" | ||
30 | #include "storage.h" | 29 | #include "storage.h" |
31 | #ifdef IPOD_NANO2G | 30 | #ifdef IPOD_NANO2G |
32 | #include "power.h" | 31 | #include "power.h" |
diff --git a/firmware/target/arm/samsung/yh820/lcd-yh820.c b/firmware/target/arm/samsung/yh820/lcd-yh820.c index f7d971ab76..4773e27185 100644 --- a/firmware/target/arm/samsung/yh820/lcd-yh820.c +++ b/firmware/target/arm/samsung/yh820/lcd-yh820.c | |||
@@ -18,7 +18,7 @@ | |||
18 | * KIND, either express or implied. | 18 | * KIND, either express or implied. |
19 | * | 19 | * |
20 | ****************************************************************************/ | 20 | ****************************************************************************/ |
21 | #include <sys/types.h> | 21 | #include <sys/types.h> /* off_t */ |
22 | 22 | ||
23 | #include "config.h" | 23 | #include "config.h" |
24 | #include "cpu.h" | 24 | #include "cpu.h" |
diff --git a/firmware/target/arm/sandisk/sansa-e200/lcd-e200.c b/firmware/target/arm/sandisk/sansa-e200/lcd-e200.c index 03f6a1b971..0f9ca9b046 100644 --- a/firmware/target/arm/sandisk/sansa-e200/lcd-e200.c +++ b/firmware/target/arm/sandisk/sansa-e200/lcd-e200.c | |||
@@ -22,7 +22,7 @@ | |||
22 | * KIND, either express or implied. | 22 | * KIND, either express or implied. |
23 | * | 23 | * |
24 | ****************************************************************************/ | 24 | ****************************************************************************/ |
25 | #include <sys/types.h> | 25 | #include <sys/types.h> /* off_t */ |
26 | #include <string.h> | 26 | #include <string.h> |
27 | #include "cpu.h" | 27 | #include "cpu.h" |
28 | #include "system.h" | 28 | #include "system.h" |
diff --git a/firmware/target/arm/tcc77x/debug-tcc77x.c b/firmware/target/arm/tcc77x/debug-tcc77x.c index 203a6010ce..bf322f5675 100644 --- a/firmware/target/arm/tcc77x/debug-tcc77x.c +++ b/firmware/target/arm/tcc77x/debug-tcc77x.c | |||
@@ -26,7 +26,6 @@ | |||
26 | #include <stdbool.h> | 26 | #include <stdbool.h> |
27 | #include "button.h" | 27 | #include "button.h" |
28 | #include "lcd.h" | 28 | #include "lcd.h" |
29 | #include "sprintf.h" | ||
30 | #include "font.h" | 29 | #include "font.h" |
31 | #include "debug-target.h" | 30 | #include "debug-target.h" |
32 | #include "adc.h" | 31 | #include "adc.h" |
diff --git a/firmware/target/arm/tcc77x/iaudio7/ata2501.c b/firmware/target/arm/tcc77x/iaudio7/ata2501.c index 3d78599ff9..f7526b2b9a 100644 --- a/firmware/target/arm/tcc77x/iaudio7/ata2501.c +++ b/firmware/target/arm/tcc77x/iaudio7/ata2501.c | |||
@@ -76,7 +76,6 @@ unsigned short ata2501_read(void) | |||
76 | //#define ATA2501_TEST | 76 | //#define ATA2501_TEST |
77 | #ifdef ATA2501_TEST | 77 | #ifdef ATA2501_TEST |
78 | #include "lcd.h" | 78 | #include "lcd.h" |
79 | #include "sprintf.h" | ||
80 | 79 | ||
81 | static | 80 | static |
82 | void bits(char *str, unsigned short val) | 81 | void bits(char *str, unsigned short val) |
diff --git a/firmware/target/arm/tcc780x/cowond2/lcd-cowond2.c b/firmware/target/arm/tcc780x/cowond2/lcd-cowond2.c index d5a7e2f142..c2800727b9 100644 --- a/firmware/target/arm/tcc780x/cowond2/lcd-cowond2.c +++ b/firmware/target/arm/tcc780x/cowond2/lcd-cowond2.c | |||
@@ -18,7 +18,7 @@ | |||
18 | * KIND, either express or implied. | 18 | * KIND, either express or implied. |
19 | * | 19 | * |
20 | ****************************************************************************/ | 20 | ****************************************************************************/ |
21 | #include <sys/types.h> | 21 | #include <sys/types.h> /* off_t */ |
22 | 22 | ||
23 | #include "config.h" | 23 | #include "config.h" |
24 | #include "hwcompat.h" | 24 | #include "hwcompat.h" |
diff --git a/firmware/target/arm/tcc780x/debug-tcc780x.c b/firmware/target/arm/tcc780x/debug-tcc780x.c index ef6415efc4..11d6d2acab 100644 --- a/firmware/target/arm/tcc780x/debug-tcc780x.c +++ b/firmware/target/arm/tcc780x/debug-tcc780x.c | |||
@@ -26,7 +26,6 @@ | |||
26 | #include <stdbool.h> | 26 | #include <stdbool.h> |
27 | #include "button.h" | 27 | #include "button.h" |
28 | #include "lcd.h" | 28 | #include "lcd.h" |
29 | #include "sprintf.h" | ||
30 | #include "font.h" | 29 | #include "font.h" |
31 | #include "debug-target.h" | 30 | #include "debug-target.h" |
32 | #include "adc.h" | 31 | #include "adc.h" |
diff --git a/firmware/target/arm/tms320dm320/creative-zvm/pic-creativezvm.c b/firmware/target/arm/tms320dm320/creative-zvm/pic-creativezvm.c index 98a4b57bd6..52c500f66d 100644 --- a/firmware/target/arm/tms320dm320/creative-zvm/pic-creativezvm.c +++ b/firmware/target/arm/tms320dm320/creative-zvm/pic-creativezvm.c | |||
@@ -26,7 +26,6 @@ | |||
26 | #include "kernel.h" | 26 | #include "kernel.h" |
27 | #include "button-target.h" | 27 | #include "button-target.h" |
28 | #include "i2c-dm320.h" | 28 | #include "i2c-dm320.h" |
29 | #include "sprintf.h" | ||
30 | #include "logf.h" | 29 | #include "logf.h" |
31 | 30 | ||
32 | #ifdef BUTTON_DEBUG | 31 | #ifdef BUTTON_DEBUG |
diff --git a/firmware/target/arm/tms320dm320/debug-dm320.c b/firmware/target/arm/tms320dm320/debug-dm320.c index 8be21065d6..8bf170048e 100644 --- a/firmware/target/arm/tms320dm320/debug-dm320.c +++ b/firmware/target/arm/tms320dm320/debug-dm320.c | |||
@@ -27,7 +27,6 @@ | |||
27 | #include "button.h" | 27 | #include "button.h" |
28 | #include "lcd.h" | 28 | #include "lcd.h" |
29 | #include "debug.h" | 29 | #include "debug.h" |
30 | #include "sprintf.h" | ||
31 | #include "font.h" | 30 | #include "font.h" |
32 | #include "lcd-target.h" | 31 | #include "lcd-target.h" |
33 | 32 | ||
diff --git a/firmware/target/arm/usb-s3c6400x.c b/firmware/target/arm/usb-s3c6400x.c index 2fbb1a9849..3f28e7f379 100644 --- a/firmware/target/arm/usb-s3c6400x.c +++ b/firmware/target/arm/usb-s3c6400x.c | |||
@@ -35,7 +35,6 @@ | |||
35 | #include "usb_ch9.h" | 35 | #include "usb_ch9.h" |
36 | #include "usb_core.h" | 36 | #include "usb_core.h" |
37 | #include <inttypes.h> | 37 | #include <inttypes.h> |
38 | #include "sprintf.h" | ||
39 | #include "power.h" | 38 | #include "power.h" |
40 | 39 | ||
41 | struct ep_type | 40 | struct ep_type |
diff --git a/firmware/target/arm/usb-tcc.c b/firmware/target/arm/usb-tcc.c index 9d5ae2d50a..1b5f16c223 100644 --- a/firmware/target/arm/usb-tcc.c +++ b/firmware/target/arm/usb-tcc.c | |||
@@ -42,7 +42,6 @@ static int global_ep_irq_mask = 0x1; | |||
42 | #include <inttypes.h> | 42 | #include <inttypes.h> |
43 | 43 | ||
44 | 44 | ||
45 | #include "sprintf.h" | ||
46 | #include "power.h" | 45 | #include "power.h" |
47 | 46 | ||
48 | #ifndef BOOTLOADER | 47 | #ifndef BOOTLOADER |
diff --git a/firmware/target/mips/ingenic_jz47xx/lcd-jz4740.c b/firmware/target/mips/ingenic_jz47xx/lcd-jz4740.c index 29f337b13b..ef45317c3f 100644 --- a/firmware/target/mips/ingenic_jz47xx/lcd-jz4740.c +++ b/firmware/target/mips/ingenic_jz47xx/lcd-jz4740.c | |||
@@ -18,7 +18,7 @@ | |||
18 | * KIND, either express or implied. | 18 | * KIND, either express or implied. |
19 | * | 19 | * |
20 | ****************************************************************************/ | 20 | ****************************************************************************/ |
21 | #include <sys/types.h> | 21 | #include <sys/types.h> /* off_t */ |
22 | 22 | ||
23 | #include "config.h" | 23 | #include "config.h" |
24 | #include "jz4740.h" | 24 | #include "jz4740.h" |
diff --git a/firmware/target/mips/ingenic_jz47xx/system-jz4740.c b/firmware/target/mips/ingenic_jz47xx/system-jz4740.c index c90decc3b6..588cc16aea 100644 --- a/firmware/target/mips/ingenic_jz47xx/system-jz4740.c +++ b/firmware/target/mips/ingenic_jz47xx/system-jz4740.c | |||
@@ -32,7 +32,6 @@ | |||
32 | #include "backlight-target.h" | 32 | #include "backlight-target.h" |
33 | #include "font.h" | 33 | #include "font.h" |
34 | #include "lcd.h" | 34 | #include "lcd.h" |
35 | #include "sprintf.h" | ||
36 | #endif | 35 | #endif |
37 | 36 | ||
38 | #define NUM_DMA 6 | 37 | #define NUM_DMA 6 |
diff --git a/firmware/test/snprintf/test.c b/firmware/test/snprintf/test.c index 8923c9c9f5..049be4d257 100644 --- a/firmware/test/snprintf/test.c +++ b/firmware/test/snprintf/test.c | |||
@@ -1,7 +1,6 @@ | |||
1 | 1 | ||
2 | #include <stdio.h> | 2 | #include <stdio.h> |
3 | 3 | ||
4 | #include "sprintf.h" | ||
5 | 4 | ||
6 | int main(int argc, char **argv) | 5 | int main(int argc, char **argv) |
7 | { | 6 | { |
diff --git a/firmware/thread.c b/firmware/thread.c index 13d568eafb..d3031d55e3 100644 --- a/firmware/thread.c +++ b/firmware/thread.c | |||
@@ -20,9 +20,9 @@ | |||
20 | ****************************************************************************/ | 20 | ****************************************************************************/ |
21 | #include "config.h" | 21 | #include "config.h" |
22 | #include <stdbool.h> | 22 | #include <stdbool.h> |
23 | #include <stdio.h> | ||
23 | #include "thread.h" | 24 | #include "thread.h" |
24 | #include "panic.h" | 25 | #include "panic.h" |
25 | #include "sprintf.h" | ||
26 | #include "system.h" | 26 | #include "system.h" |
27 | #include "kernel.h" | 27 | #include "kernel.h" |
28 | #include "cpu.h" | 28 | #include "cpu.h" |
diff --git a/firmware/usb.c b/firmware/usb.c index ccf12c197d..c615e97d2b 100644 --- a/firmware/usb.c +++ b/firmware/usb.c | |||
@@ -37,7 +37,6 @@ | |||
37 | #include "usb-target.h" | 37 | #include "usb-target.h" |
38 | #include "usb.h" | 38 | #include "usb.h" |
39 | #include "button.h" | 39 | #include "button.h" |
40 | #include "sprintf.h" | ||
41 | #include "string.h" | 40 | #include "string.h" |
42 | #ifdef HAVE_USBSTACK | 41 | #ifdef HAVE_USBSTACK |
43 | #include "usb_core.h" | 42 | #include "usb_core.h" |
diff --git a/tools/configure b/tools/configure index 186e0d5ace..27609ca13a 100755 --- a/tools/configure +++ b/tools/configure | |||
@@ -165,7 +165,8 @@ simcc () { | |||
165 | exit 2 | 165 | exit 2 |
166 | else | 166 | else |
167 | # generic sdl-config checker | 167 | # generic sdl-config checker |
168 | GCCOPTS="$GCCOPTS `$sdl --cflags`" | 168 | #ignore the -D_GNU_SOURCE=1 inserted by sdl |
169 | GCCOPTS="$GCCOPTS `$sdl --cflags` -U_GNU_SOURCE" | ||
169 | LDOPTS="$LDOPTS `$sdl --libs`" | 170 | LDOPTS="$LDOPTS `$sdl --libs`" |
170 | fi | 171 | fi |
171 | fi | 172 | fi |