From 489962dc4e34cc89c2bf9d124feb74954eb92c68 Mon Sep 17 00:00:00 2001 From: Jonathan Gordon Date: Tue, 10 Aug 2010 14:15:03 +0000 Subject: Fix FS#11526 - %Vf() was acceptable on grey remotes with colour main git-svn-id: svn://svn.rockbox.org/rockbox/trunk@27768 a1c6a512-1295-4272-9138-f99709370657 --- apps/misc.c | 25 ++++++++++++++++++------- 1 file changed, 18 insertions(+), 7 deletions(-) (limited to 'apps/misc.c') diff --git a/apps/misc.c b/apps/misc.c index 9fbdd433ef..31f0ac4193 100644 --- a/apps/misc.c +++ b/apps/misc.c @@ -930,20 +930,31 @@ int hex_to_rgb(const char* hex, int* color) /* '0'-'3' are ASCII 0x30 to 0x33 */ #define is0123(x) (((x) & 0xfc) == 0x30) -bool parse_color(char *text, int *value) +bool parse_color(enum screen_type screen, char *text, int *value) { (void)text; (void)value; /* silence warnings on mono bitmap */ + int depth = screens[screen].depth; + #ifdef HAVE_LCD_COLOR - if (hex_to_rgb(text, value) < 0) - return false; + if (depth > 2) + { + if (hex_to_rgb(text, value) < 0) + return false; + else + return true; + } #endif #if LCD_DEPTH == 2 || (defined(HAVE_REMOTE_LCD) && LCD_REMOTE_DEPTH == 2) - if (text[1] != '\0' || !is0123(*text)) - return false; - *value = *text - '0'; + if (depth == 2) + { + if (text[1] != '\0' || !is0123(*text)) + return false; + *value = *text - '0'; + return true; + } #endif - return true; + return false; } /* only used in USB HID and set_time screen */ -- cgit v1.2.3