From 9b591839531b77948b19191a50f816a6806e20e5 Mon Sep 17 00:00:00 2001 From: Nils Wallménius Date: Sun, 19 Aug 2007 10:22:46 +0000 Subject: Use size_t type for the buffer_size parameter to formatter functions, static two private functions git-svn-id: svn://svn.rockbox.org/rockbox/trunk@14392 a1c6a512-1295-4272-9138-f99709370657 --- apps/gui/option_select.c | 6 +++--- apps/menus/eq_menu.c | 8 ++++---- apps/menus/eq_menu.h | 8 ++++---- apps/menus/main_menu.c | 2 +- apps/plugin.h | 2 +- apps/settings.c | 2 +- apps/settings.h | 4 ++-- apps/settings_list.c | 16 ++++++++-------- apps/settings_list.h | 2 +- 9 files changed, 25 insertions(+), 25 deletions(-) diff --git a/apps/gui/option_select.c b/apps/gui/option_select.c index 7b6322ff91..c57bb6411b 100644 --- a/apps/gui/option_select.c +++ b/apps/gui/option_select.c @@ -45,7 +45,7 @@ static const char *unit_strings[] = [UNIT_PM_TICK] = "units/10ms", }; -char *option_get_valuestring(struct settings_list *setting, +static char *option_get_valuestring(struct settings_list *setting, char *buffer, int buf_len, intptr_t temp_var) { @@ -121,7 +121,7 @@ char *option_get_valuestring(struct settings_list *setting, return buffer; } -void option_talk(struct settings_list *setting, int temp_var) +static void option_talk(struct settings_list *setting, int temp_var) { if (!talk_menus_enabled()) return; @@ -492,7 +492,7 @@ bool set_int_ex(const unsigned char* string, int step, int min, int max, - void (*formatter)(char*, int, int, const char*), + void (*formatter)(char*, size_t, int, const char*), long (*get_talk_id)(int)) { (void)unit; diff --git a/apps/menus/eq_menu.c b/apps/menus/eq_menu.c index d16ef6912d..8058fa10aa 100644 --- a/apps/menus/eq_menu.c +++ b/apps/menus/eq_menu.c @@ -56,7 +56,7 @@ * Utility functions */ -void eq_gain_format(char* buffer, int buffer_size, int value, const char* unit) +void eq_gain_format(char* buffer, size_t buffer_size, int value, const char* unit) { int v = abs(value); @@ -64,12 +64,12 @@ void eq_gain_format(char* buffer, int buffer_size, int value, const char* unit) v / EQ_USER_DIVISOR, v % EQ_USER_DIVISOR, unit); } -void eq_q_format(char* buffer, int buffer_size, int value, const char* unit) +void eq_q_format(char* buffer, size_t buffer_size, int value, const char* unit) { snprintf(buffer, buffer_size, "%d.%d %s", value / EQ_USER_DIVISOR, value % EQ_USER_DIVISOR, unit); } -void eq_precut_format(char* buffer, int buffer_size, int value, const char* unit) +void eq_precut_format(char* buffer, size_t buffer_size, int value, const char* unit) { snprintf(buffer, buffer_size, "%s%d.%d %s", value == 0 ? " " : "-", value / EQ_USER_DIVISOR, value % EQ_USER_DIVISOR, unit); @@ -642,7 +642,7 @@ MAKE_MENU(equalizer_menu, ID2P(LANG_EQUALIZER), NULL, Icon_EQ, #ifdef HAVE_WM8758 -void eq_hw_gain_format(char* buffer, int buffer_size, int value, +void eq_hw_gain_format(char* buffer, size_t buffer_size, int value, const char* unit) { snprintf(buffer, buffer_size, "%d %s", value, unit); diff --git a/apps/menus/eq_menu.h b/apps/menus/eq_menu.h index 8f3cb834d8..b101ff36ed 100644 --- a/apps/menus/eq_menu.h +++ b/apps/menus/eq_menu.h @@ -41,11 +41,11 @@ bool eq_browse_presets(void); bool eq_menu_graphical(void); /* utility functions for settings_list.c */ -void eq_gain_format(char* buffer, int buffer_size, int value, const char* unit); -void eq_q_format(char* buffer, int buffer_size, int value, const char* unit); -void eq_precut_format(char* buffer, int buffer_size, int value, const char* unit); +void eq_gain_format(char* buffer, size_t buffer_size, int value, const char* unit); +void eq_q_format(char* buffer, size_t buffer_size, int value, const char* unit); +void eq_precut_format(char* buffer, size_t buffer_size, int value, const char* unit); #ifdef HAVE_WM8758 -void eq_hw_gain_format(char* buffer, int buffer_size, int value, +void eq_hw_gain_format(char* buffer, size_t buffer_size, int value, const char* unit); /* WM8758 equalizer supports -12 to +12 dB gain in 1 dB increments. */ #define EQ_HW_GAIN_STEP 1 diff --git a/apps/menus/main_menu.c b/apps/menus/main_menu.c index f01e8dc23a..1ae5774d15 100644 --- a/apps/menus/main_menu.c +++ b/apps/menus/main_menu.c @@ -358,7 +358,7 @@ MENUITEM_FUNCTION(show_info_item, 0, ID2P(LANG_ROCKBOX_INFO), /* sleep Menu */ -static void sleep_timer_formatter(char* buffer, int buffer_size, int value, +static void sleep_timer_formatter(char* buffer, size_t buffer_size, int value, const char* unit) { int minutes, hours; diff --git a/apps/plugin.h b/apps/plugin.h index b3db0a9d20..c3e5a5b714 100644 --- a/apps/plugin.h +++ b/apps/plugin.h @@ -516,7 +516,7 @@ struct plugin_api { void (*function)(bool)); bool (*set_int)(const unsigned char* string, const char* unit, int voice_unit, int* variable, void (*function)(int), int step, int min, - int max, void (*formatter)(char*, int, int, const char*) ); + int max, void (*formatter)(char*, size_t, int, const char*) ); bool (*set_bool)(const char* string, bool* variable ); #ifdef HAVE_LCD_COLOR diff --git a/apps/settings.c b/apps/settings.c index f2bb542928..cd1c252426 100644 --- a/apps/settings.c +++ b/apps/settings.c @@ -977,7 +977,7 @@ bool set_int(const unsigned char* string, int step, int min, int max, - void (*formatter)(char*, int, int, const char*) ) + void (*formatter)(char*, size_t, int, const char*) ) { return set_int_ex(string, unit, voice_unit, variable, function, step, min, max, formatter, NULL); diff --git a/apps/settings.h b/apps/settings.h index 8d9646ff6d..0dd21a33eb 100644 --- a/apps/settings.h +++ b/apps/settings.h @@ -275,12 +275,12 @@ bool set_option(const char* string, void* variable, enum optiontype type, bool set_int(const unsigned char* string, const char* unit, int voice_unit, int* variable, void (*function)(int), int step, int min, int max, - void (*formatter)(char*, int, int, const char*) ); + void (*formatter)(char*, size_t, int, const char*) ); /* use this one if you need to create a lang from the value (i.e with TALK_ID()) */ bool set_int_ex(const unsigned char* string, const char* unit, int voice_unit, int* variable, void (*function)(int), int step, int min, int max, - void (*formatter)(char*, int, int, const char*), + void (*formatter)(char*, size_t, int, const char*), long (*get_talk_id)(int)); /* the following are either not in setting.c or shouldnt be */ diff --git a/apps/settings_list.c b/apps/settings_list.c index cfac08835c..6ebeb23658 100644 --- a/apps/settings_list.c +++ b/apps/settings_list.c @@ -192,7 +192,7 @@ static long rectime_getlang(int value) return LANG_OFF; return TALK_ID(value, UNIT_SEC); } -static void rectime_formatter(char *buffer, int buffer_size, +static void rectime_formatter(char *buffer, size_t buffer_size, int val, const char *unit) { (void)unit; @@ -207,7 +207,7 @@ static void rectime_formatter(char *buffer, int buffer_size, #ifdef HAVE_BACKLIGHT static const char backlight_times_conf [] = "off,on,1,2,3,4,5,6,7,8,9,10,15,20,25,30,45,60,90"; -static void backlight_formatter(char *buffer, int buffer_size, +static void backlight_formatter(char *buffer, size_t buffer_size, int val, const char *unit) { (void)unit; @@ -233,7 +233,7 @@ static long ff_rewind_min_step_getlang(int value) { return TALK_ID(ff_rewind_min_stepvals[value], UNIT_SEC); } -static void ff_rewind_min_step_formatter(char *buffer, int buffer_size, +static void ff_rewind_min_step_formatter(char *buffer, size_t buffer_size, int val, const char *unit) { (void)unit; @@ -245,7 +245,7 @@ static long scanaccel_getlang(int value) return LANG_OFF; return TALK_ID(value, UNIT_SEC); } -static void scanaccel_formatter(char *buffer, int buffer_size, +static void scanaccel_formatter(char *buffer, size_t buffer_size, int val, const char *unit) { (void)unit; @@ -262,7 +262,7 @@ static long poweroff_idle_timer_getlang(int value) return LANG_OFF; return TALK_ID(poweroff_idle_timer_times[value], UNIT_MIN); } -static void poweroff_idle_timer_formatter(char *buffer, int buffer_size, +static void poweroff_idle_timer_formatter(char *buffer, size_t buffer_size, int val, const char *unit) { (void)unit; @@ -279,7 +279,7 @@ static long listaccel_getlang(int value) return LANG_OFF; return TALK_ID((HZ/2)*value, UNIT_MS); } -static void listaccel_formatter(char *buffer, int buffer_size, +static void listaccel_formatter(char *buffer, size_t buffer_size, int val, const char *unit) { (void)unit; @@ -291,7 +291,7 @@ static void listaccel_formatter(char *buffer, int buffer_size, #endif /* HAVE_SCROLLWHEEL */ #if CONFIG_CODEC == SWCODEC -static void crossfeed_format(char* buffer, int buffer_size, int value, +static void crossfeed_format(char* buffer, size_t buffer_size, int value, const char* unit) { snprintf(buffer, buffer_size, "%s%d.%d %s", value == 0 ? " " : "-", @@ -305,7 +305,7 @@ static void crossfeed_cross_set(int val) global_settings.crossfeed_hf_cutoff); } -static void replaygain_preamp_format(char* buffer, int buffer_size, int value, +static void replaygain_preamp_format(char* buffer, size_t buffer_size, int value, const char* unit) { int v = abs(value); diff --git a/apps/settings_list.h b/apps/settings_list.h index 829d4f78eb..b7044c8039 100644 --- a/apps/settings_list.h +++ b/apps/settings_list.h @@ -69,7 +69,7 @@ struct int_setting { int min; int max; int step; - void (*formatter)(char*, int, int, const char*); + void (*formatter)(char*, size_t, int, const char*); long (*get_talk_id)(int); }; #define F_INT_SETTING 0x80 -- cgit v1.2.3