IOT-1583: Removing /W4 warnings - part 5. 31/20731/5
authorPawel Winogrodzki <pawelwi@microsoft.com>
Mon, 12 Jun 2017 22:31:27 +0000 (15:31 -0700)
committerDan Mihai <Daniel.Mihai@microsoft.com>
Fri, 16 Jun 2017 23:55:58 +0000 (23:55 +0000)
Removing variable type and size mismatch warnings.

Change-Id: Ic0c2f4935faf5136c93c79f58f58cb0f3f59d2ab
Signed-off-by: Pawel Winogrodzki <pawelwi@microsoft.com>
Reviewed-on: https://gerrit.iotivity.org/gerrit/20731
Tested-by: jenkins-iotivity <jenkins@iotivity.org>
Reviewed-by: Dan Mihai <Daniel.Mihai@microsoft.com>
resource/csdk/routing/src/routingutility.c
resource/examples/directpairingclient.cpp
resource/provisioning/src/OCProvisioningManager.cpp

index 409c49a..8df03d6 100644 (file)
@@ -294,7 +294,7 @@ void RMGetRouteOptionIndex(const CAHeaderOption_t *options, uint8_t numOptions,
         return;
     }
 
-    for (uint32_t i = 0; i < numOptions; i++)
+    for (uint8_t i = 0; i < numOptions; i++)
     {
         OIC_LOG_V(DEBUG, TAG, "Request- optionID: %u", options[i].optionID);
         if (RM_OPTION_MESSAGE_SWITCHING == options[i].optionID)
@@ -318,7 +318,7 @@ OCStackResult RMCreateRouteOption(const RMRouteOption_t *optValue, CAHeaderOptio
 
     OIC_LOG_V(DEBUG, RM_TAG, "createoption dlen %u slen [%u]", dLen, sLen);
 
-    unsigned int totalLength = 0;
+    uint16_t totalLength = 0;
     uint8_t *tempData = NULL;
 
     if (0 == dLen && 0 == sLen)
index 6185e13..16e84d7 100644 (file)
@@ -290,7 +290,7 @@ int main(void)
                     }
                 case 2:
                     {
-                        unsigned int pMethodIDx = -1;
+                        unsigned int pMethodIDx = 0;
                         std::string pin("");
 
                         std::cout << "- Negotiate DP method & Start Direct-Pairing - ";
@@ -316,7 +316,7 @@ int main(void)
                         printPrompt();
                         std::cin >> pMethodIDx;
                         auto prms = discoveredDeviceList[choice]->getPairingMethods();
-                        if (0 >= pMethodIDx || prms.size() < pMethodIDx)
+                        if (0 == pMethodIDx || prms.size() < pMethodIDx)
                         {
                             std::cout <<"Invalid mode selection" << std::endl;
                             break;
index 5f1153d..b37c118 100644 (file)
@@ -1395,12 +1395,12 @@ namespace OC
     OCStackResult OCSecureResource::getLinkedDevices(UuidList_t &uuidList)
     {
         OCStackResult result;
-        size_t numOfDevices = -1;
         auto devUuid = devPtr->doxm->deviceID;
         auto cLock = m_csdkLock.lock();
 
         if (cLock)
         {
+            size_t numOfDevices;
             std::lock_guard<std::recursive_mutex> lock(*cLock);
 
             OCUuidList_t* linkedDevs = nullptr, *tmp = nullptr;