aboutsummaryrefslogtreecommitdiff
path: root/sqlite/types
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2015-02-08 11:48:37 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2015-02-08 11:48:37 +0200
commitedb7ba7437aa577d65da942aaf778c16c9a501ed (patch)
tree8002ee45759c89c77f01e7748f917a64b4705989 /sqlite/types
parent039beb368bf43572b0400521a7859dd635a8f22f (diff)
Recode strncpy as memcpy
VC12 deprecated those hard, as in, it is now an error.
Diffstat (limited to 'sqlite/types')
-rw-r--r--sqlite/types/test.hxx8
1 files changed, 4 insertions, 4 deletions
diff --git a/sqlite/types/test.hxx b/sqlite/types/test.hxx
index 5797089..5a0bb41 100644
--- a/sqlite/types/test.hxx
+++ b/sqlite/types/test.hxx
@@ -9,10 +9,10 @@
#include <string>
#include <vector>
#include <memory> // std::auto_ptr
-#include <cstring> // std::strncpy, std::str[n]cmp
+#include <cstring> // std::memcpy, std::str[n]cmp, std::strlen
#ifdef _WIN32
-# include <cwchar> // std::wcsncpy, std::wcs[n]cmp
+# include <cwchar> // std::wcslen, std::wcs[n]cmp
#endif
#include <odb/core.hxx>
@@ -85,11 +85,11 @@ struct char_array
)
: id_ (id)
{
- std::strncpy (s1, s, sizeof (s1));
+ std::memcpy (s1, s, std::strlen (s) + 1); // VC++ strncpy deprecation.
s2[0] = c1 = *s;
#ifdef _WIN32
- std::wcsncpy (ws1, ws, sizeof (ws1) / 2);
+ std::memcpy (ws1, ws, (std::wcslen (ws) + 1) * sizeof (wchar_t));
ws2[0] = wc1 = *ws;
#endif
}