coap-http-proxy: cast size_t type in test 81/22081/5
authorPhilippe Coval <philippe.coval@osg.samsung.com>
Thu, 20 Jul 2017 11:17:59 +0000 (13:17 +0200)
committerMats Wichmann <mats@linux.com>
Wed, 11 Oct 2017 22:28:50 +0000 (22:28 +0000)
Suppress a warning using clang-3.5

  CoAPHttpUnitTest.cpp:277:60: error: \
  non-constant-expression cannot be narrowed from \
  type 'unsigned long' to 'uint16_t' (aka 'unsigned short') \
  in initializer list [-Wc++11-narrowing]

Change-Id: I8c740970a536a3bbc0d3d6d16cd4fe1dc81df6be
Signed-off-by: Philippe Coval <philippe.coval@osg.samsung.com>
Reviewed-on: https://gerrit.iotivity.org/gerrit/21563
Tested-by: jenkins-iotivity <jenkins@iotivity.org>
Reviewed-by: Dan Mihai <Daniel.Mihai@microsoft.com>
(cherry picked from commit a7468c261b3f59090ad49d09c690be45b94c8f9c)

service/coap-http-proxy/unittests/CoAPHttpUnitTest.cpp

index 51e3872..6b1628a 100644 (file)
@@ -274,8 +274,9 @@ TEST_F(CoApHttpTest, CHPGetHttpMethod)
 
 TEST_F(CoApHttpTest, CHPGetHttpOption)
 {
-    OCHeaderOption ocOp = {OC_COAP_ID, COAP_OPTION_ACCEPT, strlen(CBOR_CONTENT_TYPE) + 1,
-                            (uint8_t *)CBOR_CONTENT_TYPE};
+    OCHeaderOption ocOp = {OC_COAP_ID, COAP_OPTION_ACCEPT,
+                           (uint16_t)(strlen(CBOR_CONTENT_TYPE) + 1),
+                           (uint8_t *)CBOR_CONTENT_TYPE};
 
     HttpHeaderOption_t *httpOp;
     EXPECT_NE(OC_STACK_OK, (CHPGetHttpOption(NULL, NULL)));