diff options
-rw-r--r-- | apps/plugins/brickmania.c | 2 | ||||
-rw-r--r-- | apps/plugins/chessbox/chessbox_pgn.c | 4 | ||||
-rw-r--r-- | apps/plugins/chip8.c | 4 | ||||
-rw-r--r-- | apps/plugins/jewels.c | 2 | ||||
-rw-r--r-- | apps/plugins/midi/guspat.c | 2 | ||||
-rw-r--r-- | apps/plugins/midi/midifile.c | 2 | ||||
-rw-r--r-- | apps/plugins/random_folder_advance_config.c | 4 | ||||
-rw-r--r-- | apps/plugins/rockboy/menu.c | 2 | ||||
-rw-r--r-- | apps/plugins/search.c | 8 | ||||
-rw-r--r-- | apps/plugins/superdom.c | 2 | ||||
-rw-r--r-- | apps/plugins/viewer.c | 2 |
11 files changed, 20 insertions, 14 deletions
diff --git a/apps/plugins/brickmania.c b/apps/plugins/brickmania.c index 6ae8cb31ed..a372eb0813 100644 --- a/apps/plugins/brickmania.c +++ b/apps/plugins/brickmania.c | |||
@@ -1046,6 +1046,8 @@ static void brickmania_savegame(void) | |||
1046 | 1046 | ||
1047 | /* write out the game state to the save file */ | 1047 | /* write out the game state to the save file */ |
1048 | fd = rb->open(SAVE_FILE, O_WRONLY|O_CREAT); | 1048 | fd = rb->open(SAVE_FILE, O_WRONLY|O_CREAT); |
1049 | if(fd < 0) return; | ||
1050 | |||
1049 | rb->write(fd, &pad_pos_x, sizeof(pad_pos_x)); | 1051 | rb->write(fd, &pad_pos_x, sizeof(pad_pos_x)); |
1050 | rb->write(fd, &life, sizeof(life)); | 1052 | rb->write(fd, &life, sizeof(life)); |
1051 | rb->write(fd, &game_state, sizeof(game_state)); | 1053 | rb->write(fd, &game_state, sizeof(game_state)); |
diff --git a/apps/plugins/chessbox/chessbox_pgn.c b/apps/plugins/chessbox/chessbox_pgn.c index 512fb0ca15..a165e3ee8c 100644 --- a/apps/plugins/chessbox/chessbox_pgn.c +++ b/apps/plugins/chessbox/chessbox_pgn.c | |||
@@ -564,7 +564,7 @@ struct pgn_game_node* pgn_list_games(const char* filename){ | |||
564 | int line_count = 0; | 564 | int line_count = 0; |
565 | bool header_start = true, game_start = false; | 565 | bool header_start = true, game_start = false; |
566 | 566 | ||
567 | if ( (fhandler = rb->open(filename, O_RDONLY)) == 0 ) return NULL; | 567 | if ( (fhandler = rb->open(filename, O_RDONLY)) < 0 ) return NULL; |
568 | 568 | ||
569 | if (bufptr == NULL){ | 569 | if (bufptr == NULL){ |
570 | pl_malloc_init(); | 570 | pl_malloc_init(); |
@@ -572,7 +572,7 @@ struct pgn_game_node* pgn_list_games(const char* filename){ | |||
572 | while (rb->read_line(fhandler, line_buffer, sizeof line_buffer) > 0){ | 572 | while (rb->read_line(fhandler, line_buffer, sizeof line_buffer) > 0){ |
573 | line_count++; | 573 | line_count++; |
574 | /* looking for a game header */ | 574 | /* looking for a game header */ |
575 | if (header_start) { | 575 | if (header_start) { |
576 | /* a new game header is found */ | 576 | /* a new game header is found */ |
577 | if (line_buffer[0] == '['){ | 577 | if (line_buffer[0] == '['){ |
578 | temp_node = (struct pgn_game_node *)pl_malloc(sizeof size_node); | 578 | temp_node = (struct pgn_game_node *)pl_malloc(sizeof size_node); |
diff --git a/apps/plugins/chip8.c b/apps/plugins/chip8.c index 3bdf95093a..7435518855 100644 --- a/apps/plugins/chip8.c +++ b/apps/plugins/chip8.c | |||
@@ -1329,7 +1329,7 @@ static bool chip8_init(const char* file) | |||
1329 | int i; | 1329 | int i; |
1330 | 1330 | ||
1331 | fd = rb->open(file, O_RDONLY); | 1331 | fd = rb->open(file, O_RDONLY); |
1332 | if (fd==-1) { | 1332 | if (fd < 0) { |
1333 | rb->lcd_puts(0, 6, "File Error."); | 1333 | rb->lcd_puts(0, 6, "File Error."); |
1334 | return false; | 1334 | return false; |
1335 | } | 1335 | } |
@@ -1351,7 +1351,7 @@ static bool chip8_init(const char* file) | |||
1351 | c8kname[len-2] = '8'; | 1351 | c8kname[len-2] = '8'; |
1352 | c8kname[len-1] = 'k'; | 1352 | c8kname[len-1] = 'k'; |
1353 | fd = rb->open(c8kname, O_RDONLY); | 1353 | fd = rb->open(c8kname, O_RDONLY); |
1354 | if (fd!=-1) { | 1354 | if (fd >= 0) { |
1355 | rb->lcd_puts(0, 6, "File&Keymap OK."); | 1355 | rb->lcd_puts(0, 6, "File&Keymap OK."); |
1356 | numread = rb->read(fd, chip8_keymap, 16); | 1356 | numread = rb->read(fd, chip8_keymap, 16); |
1357 | rb->close(fd); | 1357 | rb->close(fd); |
diff --git a/apps/plugins/jewels.c b/apps/plugins/jewels.c index 51ad642c48..586caabfa5 100644 --- a/apps/plugins/jewels.c +++ b/apps/plugins/jewels.c | |||
@@ -480,6 +480,8 @@ static void jewels_savegame(struct game_context* bj) | |||
480 | int fd; | 480 | int fd; |
481 | /* write out the game state to the save file */ | 481 | /* write out the game state to the save file */ |
482 | fd = rb->open(SAVE_FILE, O_WRONLY|O_CREAT); | 482 | fd = rb->open(SAVE_FILE, O_WRONLY|O_CREAT); |
483 | if(fd < 0) return; | ||
484 | |||
483 | rb->write(fd, &bj->tmp_type, sizeof(bj->tmp_type)); | 485 | rb->write(fd, &bj->tmp_type, sizeof(bj->tmp_type)); |
484 | rb->write(fd, &bj->type, sizeof(bj->type)); | 486 | rb->write(fd, &bj->type, sizeof(bj->type)); |
485 | rb->write(fd, &bj->score, sizeof(bj->score)); | 487 | rb->write(fd, &bj->score, sizeof(bj->score)); |
diff --git a/apps/plugins/midi/guspat.c b/apps/plugins/midi/guspat.c index 124f779671..5f6ba35110 100644 --- a/apps/plugins/midi/guspat.c +++ b/apps/plugins/midi/guspat.c | |||
@@ -160,7 +160,7 @@ struct GPatch * gusload(char * filename) | |||
160 | 160 | ||
161 | int file = rb->open(filename, O_RDONLY); | 161 | int file = rb->open(filename, O_RDONLY); |
162 | 162 | ||
163 | if(file == -1) | 163 | if(file < 0) |
164 | { | 164 | { |
165 | char message[50]; | 165 | char message[50]; |
166 | rb->snprintf(message, 50, "Error opening %s", filename); | 166 | rb->snprintf(message, 50, "Error opening %s", filename); |
diff --git a/apps/plugins/midi/midifile.c b/apps/plugins/midi/midifile.c index 84e8b567bc..b5d9c5b6d1 100644 --- a/apps/plugins/midi/midifile.c +++ b/apps/plugins/midi/midifile.c | |||
@@ -31,7 +31,7 @@ struct MIDIfile * loadFile(const char * filename) | |||
31 | struct MIDIfile * mfload; | 31 | struct MIDIfile * mfload; |
32 | int file = rb->open (filename, O_RDONLY); | 32 | int file = rb->open (filename, O_RDONLY); |
33 | 33 | ||
34 | if(file==-1) | 34 | if(file < 0) |
35 | { | 35 | { |
36 | printf("Could not open file"); | 36 | printf("Could not open file"); |
37 | return NULL; | 37 | return NULL; |
diff --git a/apps/plugins/random_folder_advance_config.c b/apps/plugins/random_folder_advance_config.c index ba3f0d3f7e..36b9ebfcbf 100644 --- a/apps/plugins/random_folder_advance_config.c +++ b/apps/plugins/random_folder_advance_config.c | |||
@@ -133,7 +133,7 @@ bool custom_dir(void) | |||
133 | int i, errors = 0; | 133 | int i, errors = 0; |
134 | 134 | ||
135 | /* populate removed dirs array */ | 135 | /* populate removed dirs array */ |
136 | if((fd2 = rb->open(RFADIR_FILE,O_RDONLY)) > 0) | 136 | if((fd2 = rb->open(RFADIR_FILE,O_RDONLY)) >= 0) |
137 | { | 137 | { |
138 | while ((rb->read_line(fd2, line, MAX_PATH - 1)) > 0) | 138 | while ((rb->read_line(fd2, line, MAX_PATH - 1)) > 0) |
139 | { | 139 | { |
@@ -148,7 +148,7 @@ bool custom_dir(void) | |||
148 | rb->close(fd2); | 148 | rb->close(fd2); |
149 | } | 149 | } |
150 | 150 | ||
151 | if((fd2 = rb->open(RFADIR_FILE,O_RDONLY)) > 0) | 151 | if((fd2 = rb->open(RFADIR_FILE,O_RDONLY)) >= 0) |
152 | { | 152 | { |
153 | while ((rb->read_line(fd2, line, MAX_PATH - 1)) > 0) | 153 | while ((rb->read_line(fd2, line, MAX_PATH - 1)) > 0) |
154 | { | 154 | { |
diff --git a/apps/plugins/rockboy/menu.c b/apps/plugins/rockboy/menu.c index bd4088300c..710a47646a 100644 --- a/apps/plugins/rockboy/menu.c +++ b/apps/plugins/rockboy/menu.c | |||
@@ -178,7 +178,7 @@ static bool do_file(char *path, char *desc, bool is_load) { | |||
178 | file_mode = is_load ? O_RDONLY : (O_WRONLY | O_CREAT); | 178 | file_mode = is_load ? O_RDONLY : (O_WRONLY | O_CREAT); |
179 | 179 | ||
180 | /* attempt to open file descriptor here */ | 180 | /* attempt to open file descriptor here */ |
181 | if ((fd = open(path, file_mode)) <= 0) | 181 | if ((fd = open(path, file_mode)) < 0) |
182 | return false; | 182 | return false; |
183 | 183 | ||
184 | /* load/save state */ | 184 | /* load/save state */ |
diff --git a/apps/plugins/search.c b/apps/plugins/search.c index e9732d219b..d732c0282b 100644 --- a/apps/plugins/search.c +++ b/apps/plugins/search.c | |||
@@ -121,7 +121,7 @@ static bool search_init(const char* file){ | |||
121 | clear_display(); | 121 | clear_display(); |
122 | rb->splash(0, "Searching..."); | 122 | rb->splash(0, "Searching..."); |
123 | fd = rb->open(file, O_RDONLY); | 123 | fd = rb->open(file, O_RDONLY); |
124 | if (fd==-1) | 124 | if (fd < 0) |
125 | return false; | 125 | return false; |
126 | 126 | ||
127 | fdw = rb->creat(resultfile); | 127 | fdw = rb->creat(resultfile); |
@@ -132,6 +132,7 @@ static bool search_init(const char* file){ | |||
132 | #else | 132 | #else |
133 | rb->splash(HZ, "File creation failed"); | 133 | rb->splash(HZ, "File creation failed"); |
134 | #endif | 134 | #endif |
135 | rb->close(fd); | ||
135 | return false; | 136 | return false; |
136 | } | 137 | } |
137 | 138 | ||
@@ -153,8 +154,9 @@ enum plugin_status plugin_start(const void* parameter) | |||
153 | 154 | ||
154 | DEBUGF("%s - %s\n", (char *)parameter, &filename[rb->strlen(filename)-4]); | 155 | DEBUGF("%s - %s\n", (char *)parameter, &filename[rb->strlen(filename)-4]); |
155 | /* Check the extension. We only allow .m3u files. */ | 156 | /* Check the extension. We only allow .m3u files. */ |
156 | if(rb->strcasecmp(&filename[rb->strlen(filename)-4], ".m3u") && | 157 | if (!(p = rb->strrchr(filename, '.')) || |
157 | rb->strcasecmp(&filename[rb->strlen(filename)-5], ".m3u8")) { | 158 | (rb->strcasecmp(p, ".m3u") && rb->strcasecmp(p, ".m3u8"))) |
159 | { | ||
158 | rb->splash(HZ, "Not a .m3u or .m3u8 file"); | 160 | rb->splash(HZ, "Not a .m3u or .m3u8 file"); |
159 | return PLUGIN_ERROR; | 161 | return PLUGIN_ERROR; |
160 | } | 162 | } |
diff --git a/apps/plugins/superdom.c b/apps/plugins/superdom.c index 3fac0d0434..69dc607090 100644 --- a/apps/plugins/superdom.c +++ b/apps/plugins/superdom.c | |||
@@ -1935,7 +1935,7 @@ static int load_game(const char* file) { | |||
1935 | int fd; | 1935 | int fd; |
1936 | 1936 | ||
1937 | fd = rb->open(file, O_RDONLY); | 1937 | fd = rb->open(file, O_RDONLY); |
1938 | if(fd == 0) { | 1938 | if(fd < 0) { |
1939 | DEBUGF("Couldn't open savegame\n"); | 1939 | DEBUGF("Couldn't open savegame\n"); |
1940 | return -1; | 1940 | return -1; |
1941 | } | 1941 | } |
diff --git a/apps/plugins/viewer.c b/apps/plugins/viewer.c index 5b84c08694..046c76523a 100644 --- a/apps/plugins/viewer.c +++ b/apps/plugins/viewer.c | |||
@@ -1193,7 +1193,7 @@ static bool viewer_init(void) | |||
1193 | #endif | 1193 | #endif |
1194 | 1194 | ||
1195 | fd = rb->open(file_name, O_RDONLY); | 1195 | fd = rb->open(file_name, O_RDONLY); |
1196 | if (fd==-1) | 1196 | if (fd < 0) |
1197 | return false; | 1197 | return false; |
1198 | 1198 | ||
1199 | file_size = rb->filesize(fd); | 1199 | file_size = rb->filesize(fd); |