From 1382f78b7e82d52d2bd0e282a941131838f5c7d3 Mon Sep 17 00:00:00 2001 From: Jonathan Gordon Date: Mon, 29 Jan 2007 13:32:41 +0000 Subject: fix build git-svn-id: svn://svn.rockbox.org/rockbox/trunk@12143 a1c6a512-1295-4272-9138-f99709370657 --- apps/settings.c | 62 ++++++++++++++++++++++++++++----------------------------- 1 file changed, 31 insertions(+), 31 deletions(-) diff --git a/apps/settings.c b/apps/settings.c index b0f016e418..748d42799e 100644 --- a/apps/settings.c +++ b/apps/settings.c @@ -227,7 +227,38 @@ void settings_load(int which) settings_load_config(FIXEDSETTINGSFILE,false); } } +#ifdef HAVE_LCD_COLOR +/* + * Helper function to convert a string of 6 hex digits to a native colour + */ + +#define hex2dec(c) (((c) >= '0' && ((c) <= '9')) ? (toupper(c)) - '0' : \ + (toupper(c)) - 'A' + 10) + +static int hex_to_rgb(const char* hex) +{ int ok = 1; + int i; + int red, green, blue; + if (strlen(hex) == 6) { + for (i=0; i < 6; i++ ) { + if (!isxdigit(hex[i])) { + ok=0; + break; + } + } + + if (ok) { + red = (hex2dec(hex[0]) << 4) | hex2dec(hex[1]); + green = (hex2dec(hex[2]) << 4) | hex2dec(hex[3]); + blue = (hex2dec(hex[4]) << 4) | hex2dec(hex[5]); + return LCD_RGBPACK(red,green,blue); + } + } + + return 0; +} +#endif /* HAVE_LCD_COLOR */ static bool cfg_string_to_int(int setting_id, int* out, char* str) { @@ -345,38 +376,7 @@ bool settings_load_config(const char* file, bool apply) } /** Writing to a config file and saving settings **/ -#ifdef HAVE_LCD_COLOR -/* - * Helper function to convert a string of 6 hex digits to a native colour - */ - -#define hex2dec(c) (((c) >= '0' && ((c) <= '9')) ? (toupper(c)) - '0' : \ - (toupper(c)) - 'A' + 10) - -static int hex_to_rgb(const char* hex) -{ int ok = 1; - int i; - int red, green, blue; - if (strlen(hex) == 6) { - for (i=0; i < 6; i++ ) { - if (!isxdigit(hex[i])) { - ok=0; - break; - } - } - - if (ok) { - red = (hex2dec(hex[0]) << 4) | hex2dec(hex[1]); - green = (hex2dec(hex[2]) << 4) | hex2dec(hex[3]); - blue = (hex2dec(hex[4]) << 4) | hex2dec(hex[5]); - return LCD_RGBPACK(red,green,blue); - } - } - - return 0; -} -#endif /* HAVE_LCD_COLOR */ static bool cfg_int_to_string(int setting_id, int val, char* buf) { const char* start = settings[setting_id].cfg_vals; -- cgit v1.2.3