forked from len0rd/rockbox
fix build
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@12143 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
41bd24e7dc
commit
1382f78b7e
1 changed files with 31 additions and 31 deletions
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue