mirror of
https://github.com/CrowCpp/Crow.git
synced 2024-06-07 21:10:44 +00:00
MS VS2015 compilation fix. It’s better to use native Win32 (strncpy_s, sprintf_s) to avoid compilation errors when building by MS C++.
This commit is contained in:
parent
4e39b23e45
commit
366e7c7e4b
@ -1377,7 +1377,12 @@ namespace crow
|
||||
case type::Number:
|
||||
{
|
||||
char outbuf[128];
|
||||
#ifdef _MSC_VER
|
||||
sprintf_s(outbuf, 128, "%g", v.d);
|
||||
#else
|
||||
sprintf(outbuf, "%g", v.d);
|
||||
#endif
|
||||
|
||||
out += outbuf;
|
||||
}
|
||||
break;
|
||||
|
@ -222,8 +222,12 @@ inline char * qs_scanvalue(const char * key, const char * qs, char * val, size_t
|
||||
{
|
||||
qs++;
|
||||
i = strcspn(qs, "&=#");
|
||||
strncpy(val, qs, (val_len-1)<(i+1) ? (val_len-1) : (i+1));
|
||||
qs_decode(val);
|
||||
#ifdef _MSC_VER
|
||||
strncpy_s(val, val_len, qs, (val_len - 1)<(i + 1) ? (val_len - 1) : (i + 1));
|
||||
#else
|
||||
strncpy(val, qs, (val_len - 1)<(i + 1) ? (val_len - 1) : (i + 1));
|
||||
#endif
|
||||
qs_decode(val);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user