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 /common/query/array/test.hxx | |
parent | 039beb368bf43572b0400521a7859dd635a8f22f (diff) |
Recode strncpy as memcpy
VC12 deprecated those hard, as in, it is now an error.
Diffstat (limited to 'common/query/array/test.hxx')
-rw-r--r-- | common/query/array/test.hxx | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/common/query/array/test.hxx b/common/query/array/test.hxx index 1bebf19..a881e8c 100644 --- a/common/query/array/test.hxx +++ b/common/query/array/test.hxx @@ -7,7 +7,7 @@ #include <common/config.hxx> // HAVE_CXX11 -#include <cstring> // std::strncpy +#include <cstring> // std::memcpy, std::strlen #ifdef HAVE_CXX11 # include <array> @@ -22,10 +22,11 @@ struct object object (unsigned long id, const char* s, const char* b) : id_ (id) { - std::strncpy (s_, s, sizeof (s_)); - std::strncpy (s1_, s, sizeof (s1_)); + std::memcpy (s_, s, std::strlen (s) + 1); // VC++ strncpy deprecation. + std::memcpy (s1_, s, std::strlen (s) + 1); + #ifdef HAVE_CXX11 - std::strncpy (a_.data (), s, a_.size ()); + std::memcpy (a_.data (), s, std::strlen (s) + 1); #endif c_ = c1_ = *s; std::memcpy (b_, b, sizeof (b_)); |