diff options
Diffstat (limited to 'Build/source/libs/graphite2/graphite2-src/src/json.cpp')
-rw-r--r-- | Build/source/libs/graphite2/graphite2-src/src/json.cpp | 25 |
1 files changed, 16 insertions, 9 deletions
diff --git a/Build/source/libs/graphite2/graphite2-src/src/json.cpp b/Build/source/libs/graphite2/graphite2-src/src/json.cpp index d6e5518a1c3..25f2190f71a 100644 --- a/Build/source/libs/graphite2/graphite2-src/src/json.cpp +++ b/Build/source/libs/graphite2/graphite2-src/src/json.cpp @@ -33,6 +33,14 @@ of the License or (at your option) any later version. #include <limits> #include "inc/json.h" +#if defined(_MSC_VER) +#define FORMAT_INTMAX "%lli" +#define FORMAT_UINTMAX "%llu" +#else +#define FORMAT_INTMAX "%ji" +#define FORMAT_UINTMAX "%ju" +#endif + using namespace graphite2; namespace @@ -45,7 +53,7 @@ namespace }; } -const json::_null_t json::null = {}; +const std::nullptr_t json::null = nullptr; inline void json::context(const char current) throw() @@ -118,8 +126,8 @@ json & json::operator << (json::string s) throw() } json & json::operator << (json::number f) throw() -{ - context(seq); +{ + context(seq); if (std::numeric_limits<json::number>::infinity() == f) fputs("Infinity", _stream); else if (-std::numeric_limits<json::number>::infinity() == f) @@ -128,13 +136,12 @@ json & json::operator << (json::number f) throw() std::numeric_limits<json::number>::signaling_NaN() == f) fputs("NaN", _stream); else - fprintf(_stream, "%g", f); - return *this; + fprintf(_stream, "%g", f); + return *this; } -json & json::operator << (json::integer d) throw() { context(seq); fprintf(_stream, "%ld", d); return *this; } -json & json::operator << (long unsigned d) throw() { context(seq); fprintf(_stream, "%ld", d); return *this; } +json & json::operator << (json::integer d) throw() { context(seq); fprintf(_stream, FORMAT_INTMAX, intmax_t(d)); return *this; } +json & json::operator << (json::integer_u d) throw() { context(seq); fprintf(_stream, FORMAT_UINTMAX, uintmax_t(d)); return *this; } json & json::operator << (json::boolean b) throw() { context(seq); fputs(b ? "true" : "false", _stream); return *this; } -json & json::operator << (json::_null_t) throw() { context(seq); fputs("null",_stream); return *this; } +json & json::operator << (std::nullptr_t) throw() { context(seq); fputs("null",_stream); return *this; } #endif - |