aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorPhilip <phil.avdeev@gmail.com>2016-10-21 18:22:24 +0300
committerPhilip <phil.avdeev@gmail.com>2016-10-21 18:22:24 +0300
commit366e7c7e4b09096874d712696e79a913c17dd2c3 (patch)
treee05c2a21e10c7dcc03bd0a3194684bed4bcf7d7f /include
parent4e39b23e455e455f1878b3e68d729a1737f3e431 (diff)
downloadcrow-366e7c7e4b09096874d712696e79a913c17dd2c3.tar.gz
crow-366e7c7e4b09096874d712696e79a913c17dd2c3.zip
MS VS2015 compilation fix. It’s better to use native Win32 (strncpy_s, sprintf_s) to avoid compilation errors when building by MS C++.
Diffstat (limited to 'include')
-rw-r--r--include/crow/json.h5
-rw-r--r--include/crow/query_string.h8
2 files changed, 11 insertions, 2 deletions
diff --git a/include/crow/json.h b/include/crow/json.h
index 891fedf..35f9068 100644
--- a/include/crow/json.h
+++ b/include/crow/json.h
@@ -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;
diff --git a/include/crow/query_string.h b/include/crow/query_string.h
index 3f8bffe..edde0f6 100644
--- a/include/crow/query_string.h
+++ b/include/crow/query_string.h
@@ -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
{