diff --git a/src/lib_json/json_tool.h b/src/lib_json/json_tool.h index c18a768..9f2b534 100644 --- a/src/lib_json/json_tool.h +++ b/src/lib_json/json_tool.h @@ -68,6 +68,20 @@ static inline void uintToString(LargestUInt value, char *¤t) { } while (value != 0); } +/** Change ',' to '.' everywhere in buffer. + * + * We had a sophisticated way, but it did not work in WinCE. + * @see https://github.com/open-source-parsers/jsoncpp/pull/9 + */ +static inline void fixNumericLocale(char* begin, char* end) { + while (begin < end) { + if (*begin == ',') { + *begin = '.'; + } + ++begin; + } +} + } // namespace Json { #endif // LIB_JSONCPP_JSON_TOOL_H_INCLUDED diff --git a/src/lib_json/json_writer.cpp b/src/lib_json/json_writer.cpp index 52ecf3e..1abcc93 100644 --- a/src/lib_json/json_writer.cpp +++ b/src/lib_json/json_writer.cpp @@ -77,7 +77,7 @@ std::string valueToString(double value) { #else snprintf(buffer, sizeof(buffer), "%.16g", value); #endif - + fixNumericLocale(buffer, buffer + strlen(buffer)); return buffer; }