From a07e93938c04d2fe2720bb032006671433719ea6 Mon Sep 17 00:00:00 2001 From: Robert Kukla Date: Tue, 9 Oct 2007 21:28:51 +0000 Subject: fix yellow and some house cleaning git-svn-id: svn://svn.rockbox.org/rockbox/trunk@15056 a1c6a512-1295-4272-9138-f99709370657 --- apps/plugin.c | 2 +- apps/plugin.h | 2 +- apps/plugins/lib/configfile.c | 75 ++++++++++++++++++------------------ apps/plugins/mpegplayer/mpegplayer.c | 8 ++-- firmware/drivers/button.c | 2 +- firmware/export/button.h | 2 +- uisimulator/sdl/button.c | 2 +- 7 files changed, 47 insertions(+), 46 deletions(-) diff --git a/apps/plugin.c b/apps/plugin.c index 7981c36b92..02842572f5 100644 --- a/apps/plugin.c +++ b/apps/plugin.c @@ -518,7 +518,7 @@ static const struct plugin_api rockbox_api = { talk_disable_menus, talk_enable_menus, - button_available, + button_queue_count, }; diff --git a/apps/plugin.h b/apps/plugin.h index 7277d8031c..eeeb11e387 100644 --- a/apps/plugin.h +++ b/apps/plugin.h @@ -636,7 +636,7 @@ struct plugin_api { void (*talk_disable_menus)(void); void (*talk_enable_menus)(void); - int (*button_available)(void); + int (*button_queue_count)(void); }; /* plugin header */ diff --git a/apps/plugins/lib/configfile.c b/apps/plugins/lib/configfile.c index 476f776878..7c7d56e4e5 100644 --- a/apps/plugins/lib/configfile.c +++ b/apps/plugins/lib/configfile.c @@ -154,7 +154,7 @@ int configfile_get_value(const char* filename, const char* name) get_cfg_filename(buf, MAX_PATH, filename); fd = cfg_rb->open(buf, O_RDONLY); if(fd < 0) - return -1; + return -1; while(cfg_rb->read_line(fd, buf, MAX_PATH) > 0) { @@ -172,43 +172,42 @@ int configfile_get_value(const char* filename, const char* name) int configfile_update_entry(const char* filename, const char* name, int val) { - int fd; - char *pname; - char *pval; - char path[MAX_PATH]; - char buf[256]; - int found = 0; - int line_len = 0; - int pos = 0; - - /* open the current config file */ - get_cfg_filename(path, MAX_PATH, filename); - fd = cfg_rb->open(path, O_RDWR); - if(fd < 0) - return -1; - - /* read in the current stored settings */ - while((line_len = cfg_rb->read_line(fd, buf, 256)) > 0) - { - cfg_rb->settings_parseline(buf, &pname, &pval); - - if(!cfg_rb->strcmp(name, pname)) + int fd; + char *pname; + char *pval; + char path[MAX_PATH]; + char buf[256]; + int found = 0; + int line_len = 0; + int pos = 0; + + /* open the current config file */ + get_cfg_filename(path, MAX_PATH, filename); + fd = cfg_rb->open(path, O_RDWR); + if(fd < 0) + return -1; + + /* read in the current stored settings */ + while((line_len = cfg_rb->read_line(fd, buf, 256)) > 0) { - found = 1; - cfg_rb->lseek(fd, pos, SEEK_SET); - /* pre-allocate 10 bytes for INT */ - cfg_rb->fdprintf(fd, "%s: %10d\n", pname, val); - break; + cfg_rb->settings_parseline(buf, &pname, &pval); + if(!cfg_rb->strcmp(name, pname)) + { + found = 1; + cfg_rb->lseek(fd, pos, SEEK_SET); + /* pre-allocate 10 bytes for INT */ + cfg_rb->fdprintf(fd, "%s: %10d\n", pname, val); + break; + } + pos += line_len; } - pos += line_len; - } - - /* if (name/val) is a new entry just append to file */ - if (found == 0) - /* pre-allocate 10 bytes for INT */ - cfg_rb->fdprintf(fd, "%s: %10d\n", name, val); - - cfg_rb->close(fd); - - return found; + + /* if (name/val) is a new entry just append to file */ + if (found == 0) + /* pre-allocate 10 bytes for INT */ + cfg_rb->fdprintf(fd, "%s: %10d\n", name, val); + + cfg_rb->close(fd); + + return found; } diff --git a/apps/plugins/mpegplayer/mpegplayer.c b/apps/plugins/mpegplayer/mpegplayer.c index 128eb268a6..b5e11980db 100644 --- a/apps/plugins/mpegplayer/mpegplayer.c +++ b/apps/plugins/mpegplayer/mpegplayer.c @@ -110,7 +110,6 @@ FPS | 27Mhz | 100Hz | 44.1KHz | 48KHz #include "mpeg_settings.h" #include "video_out.h" #include "../../codecs/libmad/mad.h" -#include "splash.h" PLUGIN_HEADER PLUGIN_IRAM_DECLARE @@ -649,10 +648,12 @@ static int get_next_data( Stream* str, uint8_t type ) rb->splash( HZ*3, "missing packet start code prefix : %X%X at %lX", *p, *(p+2), (long unsigned int)(p-disk_buf_start) ); + /* not 64bit safe DEBUGF("end diff: %X,%X,%X,%X,%X,%X\n",(int)str->curr_packet_end, (int)audio_str.curr_packet_end,(int)video_str.curr_packet_end, (int)disk_buf_start,(int)disk_buf_end,(int)disk_buf_tail); - + */ + str->curr_packet_end = str->curr_packet = NULL; break; } @@ -2035,7 +2036,7 @@ ssize_t seek_PTS( int in_file, int start_time, int accept_button ) if ( accept_button ) { rb->yield(); - if (rb->button_available()) + if (rb->button_queue_count()) return -101; } @@ -2159,6 +2160,7 @@ enum plugin_status plugin_start(struct plugin_api* api, void* parameter) if (parameter == NULL) { api->splash(HZ*2, "No File"); + return PLUGIN_ERROR; } /* Initialize IRAM - stops audio and voice as well */ diff --git a/firmware/drivers/button.c b/firmware/drivers/button.c index d79a9333ff..851b5b9b20 100644 --- a/firmware/drivers/button.c +++ b/firmware/drivers/button.c @@ -293,7 +293,7 @@ static void button_boost(bool state) } #endif /* HAVE_ADJUSTABLE_CPU_FREQ */ -int button_available( void ) +int button_queue_count( void ) { return queue_count(&button_queue); } diff --git a/firmware/export/button.h b/firmware/export/button.h index 881d7c424d..a38385c4cf 100644 --- a/firmware/export/button.h +++ b/firmware/export/button.h @@ -27,7 +27,7 @@ extern struct event_queue button_queue; void button_init (void); -int button_available(void); +int button_queue_count(void); long button_get (bool block); long button_get_w_tmo(int ticks); intptr_t button_get_data(void); diff --git a/uisimulator/sdl/button.c b/uisimulator/sdl/button.c index 2b44a7bace..a15faf72c0 100644 --- a/uisimulator/sdl/button.c +++ b/uisimulator/sdl/button.c @@ -736,7 +736,7 @@ void button_event(int key, bool pressed) /* Again copied from real button.c... */ -int button_available( void ) +int button_queue_count( void ) { return queue_count(&button_queue); } -- cgit v1.2.3