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. --- common/query/array/test.hxx | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'common') 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 // HAVE_CXX11 -#include // std::strncpy +#include // std::memcpy, std::strlen #ifdef HAVE_CXX11 # include @@ -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_)); -- cgit v1.1