resource/unittests: Removing /W4 warnings.
authorPawel Winogrodzki <pawelwi@microsoft.com>
Tue, 13 Jun 2017 00:14:13 +0000 (17:14 -0700)
committerDan Mihai <Daniel.Mihai@microsoft.com>
Thu, 15 Jun 2017 22:31:15 +0000 (22:31 +0000)
Removing variable shadowing warnings: there were a few
variables using the same name in one scope and thus one
overwritten the other.

Bug: https://jira.iotivity.org/browse/IOT-1583

Change-Id: I6405fd2119722b24c3a29c7f8478d1b801d0c1d4
Signed-off-by: Pawel Winogrodzki <pawelwi@microsoft.com>
Reviewed-on: https://gerrit.iotivity.org/gerrit/20741
Reviewed-by: Phil Coval <philippe.coval@osg.samsung.com>
Tested-by: jenkins-iotivity <jenkins@iotivity.org>
Reviewed-by: Dan Mihai <Daniel.Mihai@microsoft.com>
resource/unittests/OCPlatformTest.cpp

index ae74b11..dd0a41a 100644 (file)
@@ -33,7 +33,7 @@ namespace OCPlatformTest
     const std::string gResourceTypeName = "core.res";
     const std::string gResourceInterface = DEFAULT_INTERFACE;
     const uint8_t gResourceProperty = OC_DISCOVERABLE | OC_OBSERVABLE;
-    OCResourceHandle resourceHandle;
+    OCResourceHandle gResourceHandle;
 
     //OCPersistent Storage Handlers
     static FILE* client_open(const char *path, const char *mode)
@@ -175,34 +175,34 @@ namespace OCPlatformTest
     OCResourceHandle RegisterResource(std::string uri, std::string type, std::string iface)
     {
         EXPECT_EQ(OC_STACK_OK, OCPlatform::registerResource(
-                                        resourceHandle, uri, type,
+                                        gResourceHandle, uri, type,
                                         iface, entityHandler, gResourceProperty));
-        return resourceHandle;
+        return gResourceHandle;
     }
 
     OCResourceHandle RegisterResource(std::string uri, std::string type)
     {
         EXPECT_EQ(OC_STACK_OK, OCPlatform::registerResource(
-                                        resourceHandle, uri, type,
+                                        gResourceHandle, uri, type,
                                         gResourceInterface, entityHandler, gResourceProperty));
-        return resourceHandle;
+        return gResourceHandle;
     }
 
     OCResourceHandle RegisterResource(std::string uri)
     {
         EXPECT_EQ(OC_STACK_OK, OCPlatform::registerResource(
-                                        resourceHandle, uri, gResourceTypeName,
+                                        gResourceHandle, uri, gResourceTypeName,
                                         gResourceInterface, entityHandler, gResourceProperty));
-        return resourceHandle;
+        return gResourceHandle;
     }
 
     OCResourceHandle RegisterResource(std::string uri, OCTpsSchemeFlags resourceTpsTypes)
     {
         EXPECT_EQ(OC_STACK_OK, OCPlatform::registerResource(
-                                        resourceHandle, uri, gResourceTypeName,
+                                        gResourceHandle, uri, gResourceTypeName,
                                         gResourceInterface, entityHandler, gResourceProperty,
                                         resourceTpsTypes));
-        return resourceHandle;
+        return gResourceHandle;
     }
 
     TEST(ConfigureTest, ConfigureInvalidModeType)
@@ -238,10 +238,10 @@ namespace OCPlatformTest
 
         std::string uri = "/a/light69";
         std::string type = "core.light";
-        uint8_t gResourceProperty = 0;
+        uint8_t resourceProperty = 0;
         EXPECT_NO_THROW(OCPlatform::registerResource(
-                 resourceHandle, uri, type,
-                 gResourceInterface, entityHandler, gResourceProperty));
+                 gResourceHandle, uri, type,
+                 gResourceInterface, entityHandler, resourceProperty));
     }
 
     TEST(ConfigureTest, ConfigureClient)
@@ -313,7 +313,7 @@ namespace OCPlatformTest
 
         // We should not allow empty URI.
         std::string emptyStr = "";
-        EXPECT_ANY_THROW(OCPlatform::registerResource(resourceHandle, emptyStr, emptyStr,
+        EXPECT_ANY_THROW(OCPlatform::registerResource(gResourceHandle, emptyStr, emptyStr,
                                         emptyStr, entityHandler, gResourceProperty));
     }
 
@@ -324,10 +324,10 @@ namespace OCPlatformTest
 
         std::string uri = "/a/light6";
         std::string type = "core.light";
-        uint8_t gResourceProperty = 0;
+        uint8_t resourceProperty = 0;
         EXPECT_EQ(OC_STACK_OK, OCPlatform::registerResource(
-                resourceHandle, uri, type,
-                gResourceInterface, entityHandler, gResourceProperty));
+                gResourceHandle, uri, type,
+                gResourceInterface, entityHandler, resourceProperty));
     }
 
     TEST(RegisterResourceTest, RegisterWithTpsType)
@@ -337,10 +337,10 @@ namespace OCPlatformTest
 
         std::string uri = "/a/light7";
         std::string type = "core.light";
-        uint8_t gResourceProperty = 0;
+        uint8_t resourceProperty = 0;
         EXPECT_EQ(OC_STACK_OK, OCPlatform::registerResource(
-                resourceHandle, uri, type,
-                gResourceInterface, entityHandler, gResourceProperty , OC_COAP));
+                gResourceHandle, uri, type,
+                gResourceInterface, entityHandler, resourceProperty, OC_COAP));
     }
 
     TEST(RegisterResourceTest, RegisterWithTpsTypeAll)
@@ -350,10 +350,10 @@ namespace OCPlatformTest
 
         std::string uri = "/a/light8";
         std::string type = "core.light";
-        uint8_t gResourceProperty = 0;
+        uint8_t resourceProperty = 0;
         EXPECT_EQ(OC_STACK_OK, OCPlatform::registerResource(
-                resourceHandle, uri, type,
-                gResourceInterface, entityHandler, gResourceProperty, OC_ALL));
+                gResourceHandle, uri, type,
+                gResourceInterface, entityHandler, resourceProperty, OC_ALL));
     }
 #ifdef TCP_ADAPTER
     TEST(RegisterResourceTest, RegisterWithTpsTypeBitComb)
@@ -363,10 +363,10 @@ namespace OCPlatformTest
 
         std::string uri = "/a/light9";
         std::string type = "core.light";
-        uint8_t gResourceProperty = 0;
+        uint8_t resourceProperty = 0;
         EXPECT_EQ(OC_STACK_OK, OCPlatform::registerResource(
-                resourceHandle, uri, type,
-                gResourceInterface, entityHandler, gResourceProperty, (OCTpsSchemeFlags)(OC_COAP || OC_COAP_TCP)));
+                gResourceHandle, uri, type,
+                gResourceInterface, entityHandler, resourceProperty, (OCTpsSchemeFlags)(OC_COAP || OC_COAP_TCP)));
     }
 #endif