diff options
author | MJPA <git@mjpa.co.uk> | 2010-09-23 01:18:58 +0400 |
---|---|---|
committer | MJPA <git@mjpa.co.uk> | 2010-09-23 01:18:58 +0400 |
commit | 45febdedae6b44ce3fb252bcb730ab0e5eb70179 (patch) | |
tree | 9f58632727e82b78d5f15e56a71cf30a2981949b /src | |
parent | 3e083a308597d0d9f0701385ae86efd60b9ef511 (diff) |
Mac compile fixes
Diffstat (limited to 'src')
-rw-r--r-- | src/JSON.h | 18 |
1 files changed, 18 insertions, 0 deletions
@@ -41,6 +41,24 @@ #include <cstdlib> #endif +// Mac compile fixes - from quaker66 +#if defined(__APPLE__) + #include <wctype.h> + #include <wchar.h> + #include <algorithm> + + static inline int wcsncasecmp (const wchar_t *s1, const wchar_t *s2, size_t n) + { + if (!wcsncmp(s1, s2, n)) + return 0; + + std::wstring ws(s1), wws(s2); + transform(ws.begin(), ws.end(), ws.begin(), towlower); + transform(wws.begin(), wws.end(), wws.begin(), towlower); + return wcsncmp(ws.c_str(), wws.c_str(), n); + } +#endif + // Custom types class JSONValue; typedef std::vector<JSONValue*> JSONArray; |