Fix resource sample and unit test warnings
authorSakthivel Samidurai <sakthivel.samidurai@intel.com>
Wed, 26 Aug 2015 21:17:10 +0000 (14:17 -0700)
committerJon A. Cruz <jonc@osg.samsung.com>
Thu, 27 Aug 2015 04:29:55 +0000 (04:29 +0000)
Change-Id: Ieced950f54f7ce9997852a455fd5f9b5e89afbc1
Signed-off-by: Sakthivel Samidurai <sakthivel.samidurai@intel.com>
Reviewed-on: https://gerrit.iotivity.org/gerrit/2291
Tested-by: jenkins-iotivity <jenkins-iotivity@opendaylight.org>
Reviewed-by: Jon A. Cruz <jonc@osg.samsung.com>
resource/csdk/stack/samples/linux/SimpleClientServer/occlientslow.cpp
resource/csdk/stack/samples/linux/SimpleClientServer/ocservercoll.cpp
resource/csdk/stack/test/stacktests.cpp

index 8b98b52..03792de 100644 (file)
@@ -109,7 +109,8 @@ OCStackResult InvokeOCDoResource(std::ostringstream &query,
     return ret;
 }
 
-OCStackApplicationResult getReqCB(void* ctx, OCDoHandle handle, OCClientResponse * clientResponse)
+OCStackApplicationResult getReqCB(void* ctx,
+        OCDoHandle /*handle*/, OCClientResponse * clientResponse)
 {
     if(clientResponse == NULL)
     {
@@ -148,7 +149,7 @@ OCStackApplicationResult getReqCB(void* ctx, OCDoHandle handle, OCClientResponse
 }
 
 // This is a function called back when a device is discovered
-OCStackApplicationResult discoveryReqCB(void* ctx, OCDoHandle handle,
+OCStackApplicationResult discoveryReqCB(void* ctx, OCDoHandle /*handle*/,
         OCClientResponse * clientResponse)
 {
     if (ctx == (void*) DEFAULT_CONTEXT_VALUE)
@@ -324,7 +325,7 @@ int main(int argc, char* argv[])
     return 0;
 }
 
-std::string getQueryStrForGetPut(OCClientResponse * clientResponse)
+std::string getQueryStrForGetPut(OCClientResponse * /*clientResponse*/)
 {
     return "/a/led";
 }
index 45f67c4..eca2ad1 100644 (file)
@@ -106,7 +106,7 @@ PrintReceivedMsgInfo(OCEntityHandlerFlag flag, OCEntityHandlerRequest * ehReques
 //The only case when this entity handler is for a non-existing resource.
 OCEntityHandlerResult
 OCDeviceEntityHandlerCb (OCEntityHandlerFlag flag,
-        OCEntityHandlerRequest *entityHandlerRequest, char* uri, void* callbackParam)
+        OCEntityHandlerRequest *entityHandlerRequest, char* uri, void* /*callbackParam*/)
 {
     OC_LOG_V(INFO, TAG, "Inside device default entity handler - flags: 0x%x, uri: %s", flag, uri);
 
@@ -156,7 +156,7 @@ OCDeviceEntityHandlerCb (OCEntityHandlerFlag flag,
 
 OCEntityHandlerResult OCEntityHandlerRoomCb(OCEntityHandlerFlag flag,
                                             OCEntityHandlerRequest * ehRequest,
-                                            void* callback)
+                                            void* /*callback*/)
 {
     OCEntityHandlerResult ret = OC_EH_OK;
     OCEntityHandlerResponse response;
@@ -323,7 +323,7 @@ OCEntityHandlerResult OCEntityHandlerRoomCb(OCEntityHandlerFlag flag,
 }
 
 OCEntityHandlerResult OCEntityHandlerLightCb(OCEntityHandlerFlag flag,
-        OCEntityHandlerRequest * ehRequest,void* callbackParam)
+        OCEntityHandlerRequest * ehRequest,void* /*callbackParam*/)
 {
     OCEntityHandlerResult ret = OC_EH_OK;
     OCEntityHandlerResponse response;
@@ -388,7 +388,7 @@ OCEntityHandlerResult OCEntityHandlerLightCb(OCEntityHandlerFlag flag,
 }
 
 OCEntityHandlerResult OCEntityHandlerFanCb(OCEntityHandlerFlag flag,
-        OCEntityHandlerRequest * ehRequest, void* callback)
+        OCEntityHandlerRequest * ehRequest, void* /*callback*/)
 {
     OCEntityHandlerResult ret = OC_EH_OK;
     OCEntityHandlerResponse response;
index 8ee757d..c928982 100644 (file)
@@ -57,12 +57,18 @@ namespace itst = iotivity::test;
 //-----------------------------------------------------------------------------
 static const char TAG[] = "TestHarness";
 
+char gDeviceUUID[] = "myDeviceUUID";
+char gManufacturerName[] = "myName";
+char gTooLongManufacturerName[] = "extremelylongmanufacturername";
+char gManufacturerUrl[] = "www.foooooooooooooooo.baaaaaaaaaaaaar";
+
 std::chrono::seconds const SHORT_TEST_TIMEOUT = std::chrono::seconds(5);
 
 //-----------------------------------------------------------------------------
 // Callback functions
 //-----------------------------------------------------------------------------
-extern "C"  OCStackApplicationResult asyncDoResourcesCallback(void* ctx, OCDoHandle handle, OCClientResponse * clientResponse)
+extern "C"  OCStackApplicationResult asyncDoResourcesCallback(void* ctx,
+        OCDoHandle /*handle*/, OCClientResponse * clientResponse)
 {
     OC_LOG(INFO, TAG, "Entering asyncDoResourcesCallback");
 
@@ -79,8 +85,9 @@ extern "C"  OCStackApplicationResult asyncDoResourcesCallback(void* ctx, OCDoHan
 //-----------------------------------------------------------------------------
 // Entity handler
 //-----------------------------------------------------------------------------
-OCEntityHandlerResult entityHandler(OCEntityHandlerFlag flag, OCEntityHandlerRequest * entityHandlerRequest,
-                                    void* callbackParam)
+OCEntityHandlerResult entityHandler(OCEntityHandlerFlag /*flag*/,
+        OCEntityHandlerRequest * /*entityHandlerRequest*/,
+        void* /*callbackParam*/)
 {
     OC_LOG(INFO, TAG, "Entering entityHandler");
 
@@ -187,10 +194,12 @@ TEST(StackStart, SetPlatformInfoValid)
     itst::DeadmanTimer killSwitch(SHORT_TEST_TIMEOUT);
     EXPECT_EQ(OC_STACK_OK, OCInit("127.0.0.1", 5683, OC_SERVER));
 
-    OCPlatformInfo info = {};
-    info.platformID = (char *) "platform_id";
-    info.manufacturerName = (char *) "manufac_name";
-
+    OCPlatformInfo info =
+    {
+        gDeviceUUID,
+        gManufacturerName,
+        0, 0, 0, 0, 0, 0, 0, 0, 0
+    };
     EXPECT_EQ(OC_STACK_OK, OCSetPlatformInfo(info));
     EXPECT_EQ(OC_STACK_OK, OCStop());
 }
@@ -200,8 +209,12 @@ TEST(StackStart, SetPlatformInfoWithNoPlatformID)
     itst::DeadmanTimer killSwitch(SHORT_TEST_TIMEOUT);
     EXPECT_EQ(OC_STACK_OK, OCInit("127.0.0.1", 5683, OC_SERVER));
 
-    OCPlatformInfo info = {};
-    info.manufacturerName = (char *) "manufac_name";
+    OCPlatformInfo info =
+     {
+         0,
+         gDeviceUUID,
+         0, 0, 0, 0, 0, 0, 0, 0, 0
+     };
 
     EXPECT_EQ(OC_STACK_INVALID_PARAM, OCSetPlatformInfo(info));
     EXPECT_EQ(OC_STACK_OK, OCStop());
@@ -212,8 +225,11 @@ TEST(StackStart, SetPlatformInfoWithNoManufacturerName)
     itst::DeadmanTimer killSwitch(SHORT_TEST_TIMEOUT);
     EXPECT_EQ(OC_STACK_OK, OCInit("127.0.0.1", 5683, OC_SERVER));
 
-    OCPlatformInfo info = {};
-    info.platformID = (char *) "platform_id";
+    OCPlatformInfo info =
+    {
+        gDeviceUUID,
+        0, 0, 0, 0, 0, 0, 0, 0, 0, 0
+    };
 
     EXPECT_EQ(OC_STACK_INVALID_PARAM, OCSetPlatformInfo(info));
     EXPECT_EQ(OC_STACK_OK, OCStop());
@@ -224,8 +240,11 @@ TEST(StackStart, SetPlatformInfoWithZeroLengthManufacturerName)
     itst::DeadmanTimer killSwitch(SHORT_TEST_TIMEOUT);
     EXPECT_EQ(OC_STACK_OK, OCInit("127.0.0.1", 5683, OC_SERVER));
 
-    OCPlatformInfo info = {};
-    info.platformID = (char *) "platform_id";
+    OCPlatformInfo info =
+    {
+        gDeviceUUID,
+        0, 0, 0, 0, 0, 0, 0, 0, 0, 0
+    };
     info.manufacturerName = (char *) "";
 
     EXPECT_EQ(OC_STACK_INVALID_PARAM, OCSetPlatformInfo(info));
@@ -237,9 +256,12 @@ TEST(StackStart, SetPlatformInfoWithTooLongManufacName)
     itst::DeadmanTimer killSwitch(SHORT_TEST_TIMEOUT);
     EXPECT_EQ(OC_STACK_OK, OCInit("127.0.0.1", 5683, OC_SERVER));
 
-    OCPlatformInfo info = {};
-    info.platformID = (char *) "platform_id";
-    info.manufacturerName = (char *) "extremelylongmanufacturername";
+    OCPlatformInfo info =
+    {
+        gDeviceUUID,
+        gTooLongManufacturerName,
+        0, 0, 0, 0, 0, 0, 0, 0, 0
+    };
 
     EXPECT_EQ(OC_STACK_INVALID_PARAM, OCSetPlatformInfo(info));
     EXPECT_EQ(OC_STACK_OK, OCStop());
@@ -249,17 +271,18 @@ TEST(StackStart, SetPlatformInfoWithTooLongManufacURL)
 {
     itst::DeadmanTimer killSwitch(SHORT_TEST_TIMEOUT);
     EXPECT_EQ(OC_STACK_OK, OCInit("127.0.0.1", 5683, OC_SERVER));
-
-    OCPlatformInfo info = {};
-    info.platformID = (char *) "platform_id";
-    info.manufacturerName = (char *) "extremelylongmanufacturername";
-    info.manufacturerUrl = (char *)"www.foooooooooooooooo.baaaaaaaaaaaaar";
+    OCPlatformInfo info =
+    {
+        gDeviceUUID,
+        gManufacturerName,
+        gManufacturerUrl,
+        0, 0, 0, 0, 0, 0, 0, 0
+    };
 
     EXPECT_EQ(OC_STACK_INVALID_PARAM, OCSetPlatformInfo(info));
     EXPECT_EQ(OC_STACK_OK, OCStop());
 }
 
-
 TEST(StackDiscovery, DISABLED_DoResourceDeviceDiscovery)
 {
     itst::DeadmanTimer killSwitch(SHORT_TEST_TIMEOUT);