mirror of
https://github.com/open-source-parsers/jsoncpp.git
synced 2025-04-06 02:45:02 +02:00
snprintf does return a signed integer
assert if returned value is neagtive
This commit is contained in:
parent
64d591b720
commit
8eb6f88a87
@ -74,17 +74,19 @@ std::string valueToString(double value) {
|
||||
#if defined(_MSC_VER) && defined(__STDC_SECURE_LIB__) // Use secure version with
|
||||
// visual studio 2005 to
|
||||
// avoid warning.
|
||||
size_t len;
|
||||
int len;
|
||||
#if defined(WINCE)
|
||||
len = _snprintf(buffer, sizeof(buffer), "%.16g", value);
|
||||
#else
|
||||
len = sprintf_s(buffer, sizeof(buffer), "%.16g", value);
|
||||
#endif
|
||||
assert(len>=0);
|
||||
fixNumericLocale(buffer, buffer + len);
|
||||
#else
|
||||
if ( isfinite( value ))
|
||||
{
|
||||
size_t len = snprintf(buffer, sizeof(buffer), "%.16g", value);
|
||||
int len = snprintf(buffer, sizeof(buffer), "%.16g", value);
|
||||
assert(len>=0);
|
||||
fixNumericLocale(buffer, buffer + len);
|
||||
}
|
||||
else
|
||||
|
Loading…
x
Reference in New Issue
Block a user