mirror of
https://github.com/open-source-parsers/jsoncpp.git
synced 2025-01-14 01:47:54 +08:00
Merge pull request #623 from bernhardHartleb/master
Fix #567 in writing real values in different locales
This commit is contained in:
commit
154652ee7a
@ -150,7 +150,8 @@ JSONCPP_STRING valueToString(double value, bool useSpecialFloats, unsigned int p
|
||||
// concepts of reals and integers.
|
||||
if (isfinite(value)) {
|
||||
len = snprintf(buffer, sizeof(buffer), formatString, value);
|
||||
|
||||
fixNumericLocale(buffer, buffer + len);
|
||||
|
||||
// try to ensure we preserve the fact that this was given to us as a double on input
|
||||
if (!strstr(buffer, ".") && !strstr(buffer, "e")) {
|
||||
strcat(buffer, ".0");
|
||||
@ -165,10 +166,8 @@ JSONCPP_STRING valueToString(double value, bool useSpecialFloats, unsigned int p
|
||||
} else {
|
||||
len = snprintf(buffer, sizeof(buffer), useSpecialFloats ? "Infinity" : "1e+9999");
|
||||
}
|
||||
// For those, we do not need to call fixNumLoc, but it is fast.
|
||||
}
|
||||
assert(len >= 0);
|
||||
fixNumericLocale(buffer, buffer + len);
|
||||
return buffer;
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user