diff options
Diffstat (limited to 'apps/plugins')
31 files changed, 88 insertions, 60 deletions
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); |