From 3200d04d75c5e7556ed8880b155533e881a4d1e1 Mon Sep 17 00:00:00 2001 From: Nils Wallménius Date: Thu, 20 Aug 2009 16:47:44 +0000 Subject: Make the formatter functions used by the settings return a pointer to avoid usless copying of lang strings, this brought with it a long chain of const correctness and a few random cleanups git-svn-id: svn://svn.rockbox.org/rockbox/trunk@22440 a1c6a512-1295-4272-9138-f99709370657 --- apps/plugins/mpegplayer/mpeg_settings.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'apps/plugins/mpegplayer/mpeg_settings.c') diff --git a/apps/plugins/mpegplayer/mpeg_settings.c b/apps/plugins/mpegplayer/mpeg_settings.c index 62293d101f..3868d759f6 100644 --- a/apps/plugins/mpegplayer/mpeg_settings.c +++ b/apps/plugins/mpegplayer/mpeg_settings.c @@ -317,7 +317,7 @@ static bool mpeg_set_int(const char *string, const char *unit, void (*function)(int), int step, int min, int max, - void (*formatter)(char*, size_t, int, const char*)) + const char* (*formatter)(char*, size_t, int, const char*)) { mpeg_menu_sysevent_clear(); @@ -350,15 +350,16 @@ static void backlight_brightness_function(int value) mpeg_backlight_update_brightness(value); } -static void backlight_brightness_formatter(char *buf, size_t length, - int value, const char *input) +static const char* backlight_brightness_formatter(char *buf, size_t length, + int value, const char *input) { + (void)input; + if (value < 0) - rb->strlcpy(buf, BACKLIGHT_OPTION_DEFAULT, length); + return BACKLIGHT_OPTION_DEFAULT; else rb->snprintf(buf, length, "%d", value + MIN_BRIGHTNESS_SETTING); - - (void)input; + return buf; } #endif /* HAVE_BACKLIGHT_BRIGHTNESS */ -- cgit v1.2.3