From edb7ba7437aa577d65da942aaf778c16c9a501ed Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Sun, 8 Feb 2015 11:48:37 +0200 Subject: Recode strncpy as memcpy VC12 deprecated those hard, as in, it is now an error. --- mssql/types/test.hxx | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'mssql/types') 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 #include #include // std::auto_ptr -#include // std::memcmp, std::strncpy, std::str[n]cmp -#include // std::wcsncpy, std::wcs[n]cmp +#include // std::memcmp, std::memcpy, std::str[n]cmp, std::strlen +#include // std::wcslen, std::wcs[n]cmp #include @@ -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)) -- cgit v1.1