diff options
author | Jens Arnold <amiconn@rockbox.org> | 2005-11-22 11:31:28 +0000 |
---|---|---|
committer | Jens Arnold <amiconn@rockbox.org> | 2005-11-22 11:31:28 +0000 |
commit | fd02642ee0238ae2b32b7a5ea7005abf0e72489d (patch) | |
tree | 9e1b3eb683698210e439fb3867b0709d6f1bb03a /apps | |
parent | be15957c247acf928ebb07f2bc327fffa6a34baa (diff) |
Fixed truncated option strings for numeric settings.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@8043 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps')
-rw-r--r-- | apps/gui/option_select.c | 7 | ||||
-rw-r--r-- | apps/gui/option_select.h | 4 | ||||
-rw-r--r-- | apps/gui/quickscreen.c | 6 | ||||
-rw-r--r-- | apps/gui/select.c | 3 |
4 files changed, 12 insertions, 8 deletions
diff --git a/apps/gui/option_select.c b/apps/gui/option_select.c index 0e169617c4..68103c77c3 100644 --- a/apps/gui/option_select.c +++ b/apps/gui/option_select.c @@ -90,13 +90,14 @@ void option_select_prev(struct option_select * opt) opt->option-=opt->step; } -const char * option_select_get_text(struct option_select * opt, char * buffer) +const char * option_select_get_text(struct option_select * opt, char * buffer, + int buffersize) { if(opt->items) return(P2STR(opt->items[opt->option].string)); if(!opt->formatter) - snprintf(buffer, sizeof buffer,"%d %s", opt->option, opt->extra_string); + snprintf(buffer, buffersize,"%d %s", opt->option, opt->extra_string); else - opt->formatter(buffer, sizeof buffer, opt->option, opt->extra_string); + opt->formatter(buffer, buffersize, opt->option, opt->extra_string); return(buffer); } diff --git a/apps/gui/option_select.h b/apps/gui/option_select.h index c6a5e196f0..f667993781 100644 --- a/apps/gui/option_select.h +++ b/apps/gui/option_select.h @@ -77,7 +77,9 @@ extern void option_select_init_items(struct option_select * opt, * - buffer : a buffer to eventually format the option * Returns the selected option */ -extern const char * option_select_get_text(struct option_select * opt, char * buffer); +extern const char * option_select_get_text(struct option_select * opt, + char * buffer, + int buffersize); /* * Selects the next value diff --git a/apps/gui/quickscreen.c b/apps/gui/quickscreen.c index 760c1bdb00..a11107cb51 100644 --- a/apps/gui/quickscreen.c +++ b/apps/gui/quickscreen.c @@ -66,14 +66,14 @@ void gui_quickscreen_draw(struct gui_quickscreen * qs, struct screen * display) /* Displays the left's text */ title=option_select_get_title(qs->left_option); - option=option_select_get_text(qs->left_option, buffer); + option=option_select_get_text(qs->left_option, buffer, sizeof buffer); display->putsxy(0, display->height/2 - h*2, title); display->putsxy(0, display->height/2 - h, qs->left_right_title); display->putsxy(0, display->height/2, option); /* Displays the bottom's text */ title=option_select_get_title(qs->bottom_option); - option=option_select_get_text(qs->bottom_option, buffer); + option=option_select_get_text(qs->bottom_option, buffer, sizeof buffer); display->getstringsize(title, &w, &h); display->putsxy((display->width-w)/2, display->height - h*2, title); display->getstringsize(option, &w, &h); @@ -81,7 +81,7 @@ void gui_quickscreen_draw(struct gui_quickscreen * qs, struct screen * display) /* Displays the right's text */ title=option_select_get_title(qs->right_option); - option=option_select_get_text(qs->right_option, buffer); + option=option_select_get_text(qs->right_option, buffer, sizeof buffer); display->getstringsize(title,&w,&h); display->putsxy(display->width - w, display->height/2 - h*2, title); display->getstringsize(qs->left_right_title,&w,&h); diff --git a/apps/gui/select.c b/apps/gui/select.c index b632177fd7..2f3bddec68 100644 --- a/apps/gui/select.c +++ b/apps/gui/select.c @@ -54,7 +54,8 @@ void gui_select_init_items(struct gui_select * select, void gui_select_draw(struct gui_select * select, struct screen * display) { char buffer[30]; - const char * selected=option_select_get_text(&(select->options), buffer); + const char * selected=option_select_get_text(&(select->options), buffer, + sizeof buffer); #ifdef HAVE_LCD_BITMAP screen_set_xmargin(display, 0); #endif |