diff options
author | mrwastl <mrwastl@users.sourceforge.net> | 2011-05-28 17:20:04 +0200 |
---|---|---|
committer | mrwastl <mrwastl@users.sourceforge.net> | 2011-05-28 17:20:04 +0200 |
commit | 13f36d09c49624ffc1f8c9b5cc8a76b7272b4448 (patch) | |
tree | 9ecba85a892a38e2abbb18957a7d3a69048543fd /glcdskin/parser.c | |
parent | 9adb8f879bcad24978b4ac4d96920dc8727c17a0 (diff) | |
download | graphlcd-base-13f36d09c49624ffc1f8c9b5cc8a76b7272b4448.tar.gz graphlcd-base-13f36d09c49624ffc1f8c9b5cc8a76b7272b4448.tar.bz2 |
problem fixed when parsing skin version number (thanks to 'Keine_Ahnung' for detective work)
Diffstat (limited to 'glcdskin/parser.c')
-rw-r--r-- | glcdskin/parser.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/glcdskin/parser.c b/glcdskin/parser.c index 957f44f..b52427b 100644 --- a/glcdskin/parser.c +++ b/glcdskin/parser.c @@ -16,6 +16,8 @@ #include <vector> #include <string> +#include <clocale> + #include "parser.h" #include "xml.h" #include "skin.h" @@ -146,7 +148,12 @@ static bool CheckSkinVersion(const std::string & version) { float currv; char* ecptr = NULL; const char* verscstr = version.c_str(); + // only accept floating point numbers with '.' as separator, no ',' + char* curr_locale = setlocale(LC_NUMERIC, "C"); + currv = strtof(verscstr, &ecptr); + setlocale(LC_NUMERIC, curr_locale); + if ( (*ecptr != '\0') || (ecptr == NULL) /*|| (ecptr != verscstr)*/ || ((int)(GLCDSKIN_SKIN_VERSION * 100.0) < (int)(currv * 100.0)) ) |