diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2015-02-08 11:48:37 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2015-02-08 11:48:37 +0200 |
commit | edb7ba7437aa577d65da942aaf778c16c9a501ed (patch) | |
tree | 8002ee45759c89c77f01e7748f917a64b4705989 /mssql/types | |
parent | 039beb368bf43572b0400521a7859dd635a8f22f (diff) |
Recode strncpy as memcpy
VC12 deprecated those hard, as in, it is now an error.
Diffstat (limited to 'mssql/types')
-rw-r--r-- | mssql/types/test.hxx | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/mssql/types/test.hxx b/mssql/types/test.hxx index 0b4653e..15070e3 100644 --- a/mssql/types/test.hxx +++ b/mssql/types/test.hxx @@ -23,8 +23,8 @@ typedef struct _GUID #include <string> #include <vector> #include <memory> // std::auto_ptr -#include <cstring> // std::memcmp, std::strncpy, std::str[n]cmp -#include <cwchar> // std::wcsncpy, std::wcs[n]cmp +#include <cstring> // std::memcmp, std::memcpy, std::str[n]cmp, std::strlen +#include <cwchar> // std::wcslen, std::wcs[n]cmp #include <odb/core.hxx> @@ -379,12 +379,12 @@ struct char_array char_array (unsigned long id, const char* s, const wchar_t* ws) : id_ (id) { - std::strncpy (s1, s, sizeof (s1)); - std::strncpy (s2, s, sizeof (s2)); + std::memcpy (s1, s, std::strlen (s) + 1); // VC++ strncpy deprecation. + std::memcpy (s2, s, std::strlen (s) + 1); s3[0] = c1 = *s; - std::wcsncpy (ws1, ws, sizeof (ws1) / sizeof(wchar_t)); - std::wcsncpy (ws2, ws, sizeof (ws2) / sizeof(wchar_t)); + std::memcpy (ws1, ws, (std::wcslen (ws) + 1) * sizeof (wchar_t)); + std::memcpy (ws2, ws, (std::wcslen (ws) + 1) * sizeof (wchar_t)); ws3[0] = wc1 = *ws; if (std::strlen (s) == sizeof (s2)) |