From 8f1e976b99a7065d1c950df0d1767aab6c630e58 Mon Sep 17 00:00:00 2001 From: Pawel Winogrodzki Date: Mon, 12 Jun 2017 17:14:13 -0700 Subject: [PATCH] resource/unittests: Removing /W4 warnings. 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 Reviewed-on: https://gerrit.iotivity.org/gerrit/20741 Reviewed-by: Phil Coval Tested-by: jenkins-iotivity Reviewed-by: Dan Mihai --- resource/unittests/OCPlatformTest.cpp | 50 +++++++++++++++++------------------ 1 file changed, 25 insertions(+), 25 deletions(-) diff --git a/resource/unittests/OCPlatformTest.cpp b/resource/unittests/OCPlatformTest.cpp index ae74b11..dd0a41a 100644 --- a/resource/unittests/OCPlatformTest.cpp +++ b/resource/unittests/OCPlatformTest.cpp @@ -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 -- 2.7.4