Fix OCResourceResponseTest warning 85/27485/5
authorMats Wichmann <mats@linux.com>
Fri, 16 Nov 2018 17:13:51 +0000 (10:13 -0700)
committerMats Wichmann <mats@linux.com>
Wed, 30 Jan 2019 17:36:59 +0000 (17:36 +0000)
commit070c003c6fe6614ee06ec41811a79280dc3777e4
treebbfe604e6f1437ef21c2dafb2bbd3bcc23bd6d66
parent0aeba4ff32c48047846db5dcfee940814df9d0c1
Fix OCResourceResponseTest warning

gcc8.1 is fussier about getting strncpy right, as it gripes on this line:

    strncpy(request.query, query, sizeof(query));

It issues this warning:

resource/unittests/OCResourceResponseTest.cpp:83:39: warning: argument to 'sizeof' in 'char* strncpy(char*, const char*, size_t)' call is the same expression as the source; did you mean to use the size of the destination? [-Wsizeof-pointer-memaccess]

Stack code uses OICStrcpy for safer string copying, but without
fiddling further with dependencies, that function is not available
in this scope, so kept the strncpy but changed the the length
to be based on the destination.

Qualify the two strings with const while we're at it.

Change-Id: I7ed0010a6daeda6f6db4337b9a0babc5e0dce968
Signed-off-by: Mats Wichmann <mats@linux.com>
resource/unittests/OCResourceResponseTest.cpp