diff options
author | Jonathan Gordon <rockbox@jdgordon.info> | 2010-08-10 14:15:03 +0000 |
---|---|---|
committer | Jonathan Gordon <rockbox@jdgordon.info> | 2010-08-10 14:15:03 +0000 |
commit | 489962dc4e34cc89c2bf9d124feb74954eb92c68 (patch) | |
tree | ef53892652379e43dde6dd013a2ad5081a718d25 /apps/misc.c | |
parent | a547fc1b351f98f620ba61e240ebbf0729727e1c (diff) | |
download | rockbox-489962dc4e34cc89c2bf9d124feb74954eb92c68.tar.gz rockbox-489962dc4e34cc89c2bf9d124feb74954eb92c68.zip |
Fix FS#11526 - %Vf(<hex>) was acceptable on grey remotes with colour main
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@27768 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/misc.c')
-rw-r--r-- | apps/misc.c | 25 |
1 files changed, 18 insertions, 7 deletions
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) | |||
930 | /* '0'-'3' are ASCII 0x30 to 0x33 */ | 930 | /* '0'-'3' are ASCII 0x30 to 0x33 */ |
931 | #define is0123(x) (((x) & 0xfc) == 0x30) | 931 | #define is0123(x) (((x) & 0xfc) == 0x30) |
932 | 932 | ||
933 | bool parse_color(char *text, int *value) | 933 | bool parse_color(enum screen_type screen, char *text, int *value) |
934 | { | 934 | { |
935 | (void)text; (void)value; /* silence warnings on mono bitmap */ | 935 | (void)text; (void)value; /* silence warnings on mono bitmap */ |
936 | int depth = screens[screen].depth; | ||
937 | |||
936 | #ifdef HAVE_LCD_COLOR | 938 | #ifdef HAVE_LCD_COLOR |
937 | if (hex_to_rgb(text, value) < 0) | 939 | if (depth > 2) |
938 | return false; | 940 | { |
941 | if (hex_to_rgb(text, value) < 0) | ||
942 | return false; | ||
943 | else | ||
944 | return true; | ||
945 | } | ||
939 | #endif | 946 | #endif |
940 | 947 | ||
941 | #if LCD_DEPTH == 2 || (defined(HAVE_REMOTE_LCD) && LCD_REMOTE_DEPTH == 2) | 948 | #if LCD_DEPTH == 2 || (defined(HAVE_REMOTE_LCD) && LCD_REMOTE_DEPTH == 2) |
942 | if (text[1] != '\0' || !is0123(*text)) | 949 | if (depth == 2) |
943 | return false; | 950 | { |
944 | *value = *text - '0'; | 951 | if (text[1] != '\0' || !is0123(*text)) |
952 | return false; | ||
953 | *value = *text - '0'; | ||
954 | return true; | ||
955 | } | ||
945 | #endif | 956 | #endif |
946 | return true; | 957 | return false; |
947 | } | 958 | } |
948 | 959 | ||
949 | /* only used in USB HID and set_time screen */ | 960 | /* only used in USB HID and set_time screen */ |