mirror of
https://github.com/open-source-parsers/jsoncpp.git
synced 2024-12-28 20:15:24 +08:00
parent
b9afdf190d
commit
094a7d8564
@ -1619,6 +1619,7 @@ bool OurReader::decodeDouble(Token& token, Value& decoded) {
|
|||||||
Char buffer[bufferSize + 1];
|
Char buffer[bufferSize + 1];
|
||||||
memcpy(buffer, token.start_, ulength);
|
memcpy(buffer, token.start_, ulength);
|
||||||
buffer[length] = 0;
|
buffer[length] = 0;
|
||||||
|
fixNumericLocaleInput(buffer, buffer + length);
|
||||||
count = sscanf(buffer, format, &value);
|
count = sscanf(buffer, format, &value);
|
||||||
} else {
|
} else {
|
||||||
JSONCPP_STRING buffer(token.start_, token.end_);
|
JSONCPP_STRING buffer(token.start_, token.end_);
|
||||||
|
@ -5,6 +5,7 @@
|
|||||||
|
|
||||||
#ifndef LIB_JSONCPP_JSON_TOOL_H_INCLUDED
|
#ifndef LIB_JSONCPP_JSON_TOOL_H_INCLUDED
|
||||||
#define LIB_JSONCPP_JSON_TOOL_H_INCLUDED
|
#define LIB_JSONCPP_JSON_TOOL_H_INCLUDED
|
||||||
|
#include <clocale>
|
||||||
|
|
||||||
/* This header provides common string manipulation support, such as UTF-8,
|
/* This header provides common string manipulation support, such as UTF-8,
|
||||||
* portable conversion from/to string...
|
* portable conversion from/to string...
|
||||||
@ -82,6 +83,18 @@ static inline void fixNumericLocale(char* begin, char* end) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static inline void fixNumericLocaleInput(char* begin, char* end) {
|
||||||
|
struct lconv* lc = localeconv();
|
||||||
|
if ((lc != NULL) && (*(lc->decimal_point) != '.')) {
|
||||||
|
while (begin < end) {
|
||||||
|
if (*begin == '.') {
|
||||||
|
*begin = *(lc->decimal_point);
|
||||||
|
}
|
||||||
|
++begin;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace Json {
|
} // namespace Json {
|
||||||
|
|
||||||
#endif // LIB_JSONCPP_JSON_TOOL_H_INCLUDED
|
#endif // LIB_JSONCPP_JSON_TOOL_H_INCLUDED
|
||||||
|
Loading…
x
Reference in New Issue
Block a user