1
0
Fork 0
mirror of https://github.com/ultrajson/ultrajson.git synced 2024-05-29 19:06:31 +02:00

Fix minGW sprintf_s build error

On windows, We should replace snprintf on msvc only.
This commit is contained in:
smartsgy 2013-09-01 22:54:57 +08:00
parent e65f39efa8
commit 9de9190859

View File

@ -51,6 +51,10 @@ http://www.opensource.apple.com/source/tcl/tcl-14/tcl/license.terms
#define FALSE 0
#endif
#if ( (defined(_WIN32) || defined(WIN32) ) && ( defined(_MSC_VER) ) )
#define snprintf sprintf_s
#endif
/*
Worst cases being:
@ -573,11 +577,7 @@ int Buffer_AppendDoubleUnchecked(JSOBJ obj, JSONObjectEncoder *enc, double value
*/
if (value > thres_max)
{
#ifdef _WIN32
enc->offset += sprintf_s(str, enc->end - enc->offset, "%.15e", neg ? -value : value);
#else
enc->offset += snprintf(str, enc->end - enc->offset, "%.15e", neg ? -value : value);
#endif
enc->offset += snprintf(str, enc->end - enc->offset, "%.15e", neg ? -value : value);
return TRUE;
}