diff options
-rw-r--r-- | common/json.cpp | 8 | ||||
-rw-r--r-- | common/json.h | 43 |
2 files changed, 4 insertions, 47 deletions
diff --git a/common/json.cpp b/common/json.cpp index 878c67e1ae..83ce0db29d 100644 --- a/common/json.cpp +++ b/common/json.cpp @@ -281,15 +281,15 @@ JSONValue *JSONValue::parse(const char **data) { return new JSONValue(str); } - // Is it a boolean? - else if ((simplejson_wcsnlen(*data, 4) && wcsncasecmp(*data, "true", 4) == 0) || (simplejson_wcsnlen(*data, 5) && wcsncasecmp(*data, "false", 5) == 0)) { - bool value = wcsncasecmp(*data, "true", 4) == 0; + // Is it a boolean? + else if ((simplejson_wcsnlen(*data, 4) && scumm_strnicmp(*data, "true", 4) == 0) || (simplejson_wcsnlen(*data, 5) && scumm_strnicmp(*data, "false", 5) == 0)) { + bool value = scumm_strnicmp(*data, "true", 4) == 0; (*data) += value ? 4 : 5; return new JSONValue(value); } // Is it a null? - else if (simplejson_wcsnlen(*data, 4) && wcsncasecmp(*data, "null", 4) == 0) { + else if (simplejson_wcsnlen(*data, 4) && scumm_strnicmp(*data, "null", 4) == 0) { (*data) += 4; return new JSONValue(); } diff --git a/common/json.h b/common/json.h index 5114947966..c9debf05af 100644 --- a/common/json.h +++ b/common/json.h @@ -54,8 +54,6 @@ // Win32 incompatibilities #if defined(WIN32) && !defined(__GNUC__) -#define wcsncasecmp _strnicmp - static inline bool isnan(double x) { return x != x; } @@ -65,44 +63,7 @@ static inline bool isinf(double x) { } #endif -// Linux compile fix - from quaker66 -#ifdef __GNUC__ - #include <cstring> - #include <cstdlib> -#endif - -// Mac compile fixes - from quaker66, Lion fix by dabrahams -// Tkachov: I probably broke those -#if defined(__APPLE__) && __DARWIN_C_LEVEL < 200809L || (defined(WIN32) && defined(__GNUC__)) || defined(ANDROID) - #include <wctype.h> - #include <wchar.h> - - static inline int wcsncasecmp(const char *s1, const char *s2, size_t n) - { - int lc1 = 0; - int lc2 = 0; - - while (n--) - { - lc1 = towlower (*s1); - lc2 = towlower (*s2); - - if (lc1 != lc2) - return (lc1 - lc2); - - if (!lc1) - return 0; - - ++s1; - ++s2; - } - - return 0; - } -#endif - // Simple function to check a string 's' has at least 'n' characters -// Tkachov: that's not wchar_t anymore, though it should work for C-strings too static inline bool simplejson_wcsnlen(const char *s, size_t n) { if (s == 0) return false; @@ -122,8 +83,6 @@ class JSONValue; typedef Array<JSONValue*> JSONArray; typedef HashMap<String, JSONValue*> JSONObject; -//JSONValue.h: - class JSON; enum JSONType { JSONType_Null, JSONType_String, JSONType_Bool, JSONType_Number, JSONType_Array, JSONType_Object }; @@ -183,8 +142,6 @@ private: }; -//EOF JSONValue.h - class JSON { friend class JSONValue; |