mirror of
https://github.com/Rockbox/rockbox.git
synced 2025-12-08 12:45:26 -05:00
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
This commit is contained in:
parent
24b85ff1e3
commit
9b59183953
9 changed files with 25 additions and 25 deletions
|
|
@ -45,7 +45,7 @@ static const char *unit_strings[] =
|
||||||
[UNIT_PM_TICK] = "units/10ms",
|
[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,
|
char *buffer, int buf_len,
|
||||||
intptr_t temp_var)
|
intptr_t temp_var)
|
||||||
{
|
{
|
||||||
|
|
@ -121,7 +121,7 @@ char *option_get_valuestring(struct settings_list *setting,
|
||||||
return buffer;
|
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())
|
if (!talk_menus_enabled())
|
||||||
return;
|
return;
|
||||||
|
|
@ -492,7 +492,7 @@ bool set_int_ex(const unsigned char* string,
|
||||||
int step,
|
int step,
|
||||||
int min,
|
int min,
|
||||||
int max,
|
int max,
|
||||||
void (*formatter)(char*, int, int, const char*),
|
void (*formatter)(char*, size_t, int, const char*),
|
||||||
long (*get_talk_id)(int))
|
long (*get_talk_id)(int))
|
||||||
{
|
{
|
||||||
(void)unit;
|
(void)unit;
|
||||||
|
|
|
||||||
|
|
@ -56,7 +56,7 @@
|
||||||
* Utility functions
|
* 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);
|
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);
|
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);
|
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 ? " " : "-",
|
snprintf(buffer, buffer_size, "%s%d.%d %s", value == 0 ? " " : "-",
|
||||||
value / EQ_USER_DIVISOR, value % EQ_USER_DIVISOR, unit);
|
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
|
#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)
|
const char* unit)
|
||||||
{
|
{
|
||||||
snprintf(buffer, buffer_size, "%d %s", value, unit);
|
snprintf(buffer, buffer_size, "%d %s", value, unit);
|
||||||
|
|
|
||||||
|
|
@ -41,11 +41,11 @@ bool eq_browse_presets(void);
|
||||||
bool eq_menu_graphical(void);
|
bool eq_menu_graphical(void);
|
||||||
|
|
||||||
/* utility functions for settings_list.c */
|
/* utility functions for settings_list.c */
|
||||||
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);
|
||||||
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);
|
||||||
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);
|
||||||
#ifdef HAVE_WM8758
|
#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);
|
const char* unit);
|
||||||
/* WM8758 equalizer supports -12 to +12 dB gain in 1 dB increments. */
|
/* WM8758 equalizer supports -12 to +12 dB gain in 1 dB increments. */
|
||||||
#define EQ_HW_GAIN_STEP 1
|
#define EQ_HW_GAIN_STEP 1
|
||||||
|
|
|
||||||
|
|
@ -358,7 +358,7 @@ MENUITEM_FUNCTION(show_info_item, 0, ID2P(LANG_ROCKBOX_INFO),
|
||||||
|
|
||||||
|
|
||||||
/* sleep Menu */
|
/* 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)
|
const char* unit)
|
||||||
{
|
{
|
||||||
int minutes, hours;
|
int minutes, hours;
|
||||||
|
|
|
||||||
|
|
@ -516,7 +516,7 @@ struct plugin_api {
|
||||||
void (*function)(bool));
|
void (*function)(bool));
|
||||||
bool (*set_int)(const unsigned char* string, const char* unit, int voice_unit,
|
bool (*set_int)(const unsigned char* string, const char* unit, int voice_unit,
|
||||||
int* variable, void (*function)(int), int step, int min,
|
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 );
|
bool (*set_bool)(const char* string, bool* variable );
|
||||||
|
|
||||||
#ifdef HAVE_LCD_COLOR
|
#ifdef HAVE_LCD_COLOR
|
||||||
|
|
|
||||||
|
|
@ -977,7 +977,7 @@ bool set_int(const unsigned char* string,
|
||||||
int step,
|
int step,
|
||||||
int min,
|
int min,
|
||||||
int max,
|
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,
|
return set_int_ex(string, unit, voice_unit, variable, function,
|
||||||
step, min, max, formatter, NULL);
|
step, min, max, formatter, NULL);
|
||||||
|
|
|
||||||
|
|
@ -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,
|
bool set_int(const unsigned char* string, const char* unit, int voice_unit,
|
||||||
int* variable,
|
int* variable,
|
||||||
void (*function)(int), int step, int min, int max,
|
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()) */
|
/* 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,
|
bool set_int_ex(const unsigned char* string, const char* unit, int voice_unit,
|
||||||
int* variable,
|
int* variable,
|
||||||
void (*function)(int), int step, int min, int max,
|
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));
|
long (*get_talk_id)(int));
|
||||||
|
|
||||||
/* the following are either not in setting.c or shouldnt be */
|
/* the following are either not in setting.c or shouldnt be */
|
||||||
|
|
|
||||||
|
|
@ -192,7 +192,7 @@ static long rectime_getlang(int value)
|
||||||
return LANG_OFF;
|
return LANG_OFF;
|
||||||
return TALK_ID(value, UNIT_SEC);
|
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)
|
int val, const char *unit)
|
||||||
{
|
{
|
||||||
(void)unit;
|
(void)unit;
|
||||||
|
|
@ -207,7 +207,7 @@ static void rectime_formatter(char *buffer, int buffer_size,
|
||||||
#ifdef HAVE_BACKLIGHT
|
#ifdef HAVE_BACKLIGHT
|
||||||
static const char backlight_times_conf [] =
|
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";
|
"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)
|
int val, const char *unit)
|
||||||
{
|
{
|
||||||
(void)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);
|
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)
|
int val, const char *unit)
|
||||||
{
|
{
|
||||||
(void)unit;
|
(void)unit;
|
||||||
|
|
@ -245,7 +245,7 @@ static long scanaccel_getlang(int value)
|
||||||
return LANG_OFF;
|
return LANG_OFF;
|
||||||
return TALK_ID(value, UNIT_SEC);
|
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)
|
int val, const char *unit)
|
||||||
{
|
{
|
||||||
(void)unit;
|
(void)unit;
|
||||||
|
|
@ -262,7 +262,7 @@ static long poweroff_idle_timer_getlang(int value)
|
||||||
return LANG_OFF;
|
return LANG_OFF;
|
||||||
return TALK_ID(poweroff_idle_timer_times[value], UNIT_MIN);
|
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)
|
int val, const char *unit)
|
||||||
{
|
{
|
||||||
(void)unit;
|
(void)unit;
|
||||||
|
|
@ -279,7 +279,7 @@ static long listaccel_getlang(int value)
|
||||||
return LANG_OFF;
|
return LANG_OFF;
|
||||||
return TALK_ID((HZ/2)*value, UNIT_MS);
|
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)
|
int val, const char *unit)
|
||||||
{
|
{
|
||||||
(void)unit;
|
(void)unit;
|
||||||
|
|
@ -291,7 +291,7 @@ static void listaccel_formatter(char *buffer, int buffer_size,
|
||||||
#endif /* HAVE_SCROLLWHEEL */
|
#endif /* HAVE_SCROLLWHEEL */
|
||||||
|
|
||||||
#if CONFIG_CODEC == SWCODEC
|
#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)
|
const char* unit)
|
||||||
{
|
{
|
||||||
snprintf(buffer, buffer_size, "%s%d.%d %s", value == 0 ? " " : "-",
|
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);
|
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)
|
const char* unit)
|
||||||
{
|
{
|
||||||
int v = abs(value);
|
int v = abs(value);
|
||||||
|
|
|
||||||
|
|
@ -69,7 +69,7 @@ struct int_setting {
|
||||||
int min;
|
int min;
|
||||||
int max;
|
int max;
|
||||||
int step;
|
int step;
|
||||||
void (*formatter)(char*, int, int, const char*);
|
void (*formatter)(char*, size_t, int, const char*);
|
||||||
long (*get_talk_id)(int);
|
long (*get_talk_id)(int);
|
||||||
};
|
};
|
||||||
#define F_INT_SETTING 0x80
|
#define F_INT_SETTING 0x80
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue