diff options
author | Harry Jeffery <harry@exec64.co.uk> | 2015-11-16 10:23:42 +0000 |
---|---|---|
committer | Harry Jeffery <harry@exec64.co.uk> | 2015-11-16 10:23:42 +0000 |
commit | a5597a9587e8240cccc0a263db69b329fe854d2b (patch) | |
tree | 499e89b5b69a4ef87842ef8217c037a16adf552d | |
parent | 450c3daa4a179e9c74e14614870e5de1c5909e2c (diff) | |
download | imv-a5597a9587e8240cccc0a263db69b329fe854d2b.tar.gz |
Support upper-case hex
Fixes #32
-rw-r--r-- | src/main.c | 5 |
1 files changed, 4 insertions, 1 deletions
@@ -20,6 +20,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. #include <SDL2/SDL.h> #include <FreeImage.h> #include <getopt.h> +#include <ctype.h> #include "image.h" #include "texture.h" @@ -407,6 +408,8 @@ int parse_hex(char c) { return c - '0'; } else if (c >= 'a' && c <= 'f') { return c - 'a' + 10; + } else if (c >= 'A' && c <= 'F') { + return c - 'A' + 10; } return -1; } @@ -423,7 +426,7 @@ int parse_hex_color(const char* str, } for(int i = 0; i < 6; ++i) { - if(parse_hex(str[i]) == -1) { + if(!isxdigit(str[i])) { return 1; } } |