Addressed format specifier, unused variable, etc, build warnings.
authorOssama Othman <ossama.othman@intel.com>
Wed, 26 Oct 2016 20:44:53 +0000 (13:44 -0700)
committerHabib Virji <habib.virji@samsung.com>
Mon, 31 Oct 2016 14:45:09 +0000 (14:45 +0000)
Change-Id: I8ccfc5e185cfea2555ac5337eb2afa897f1984e4
Signed-off-by: Ossama Othman <ossama.othman@intel.com>
Reviewed-on: https://gerrit.iotivity.org/gerrit/13725
Tested-by: jenkins-iotivity <jenkins-iotivity@opendaylight.org>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: David Antler <david.a.antler@intel.com>
Reviewed-by: Habib Virji <habib.virji@samsung.com>
(cherry picked from commit 329265241170fa97589cc9dd39131886267ad93e)
Reviewed-on: https://gerrit.iotivity.org/gerrit/13819

resource/csdk/connectivity/src/adapter_util/cafragmentation.c
resource/csdk/connectivity/src/bt_le_adapter/caleadapter.c
resource/csdk/stack/src/ocresource.c
resource/include/StringConstants.h
resource/src/OCException.cpp
resource/unittests/OCExceptionTest.cpp

index dc51dd4..67a6aab 100644 (file)
@@ -84,7 +84,7 @@ CAResult_t CAGenerateVariableForFragmentation(size_t dataLength,
                                               size_t *remainingLen,
                                               size_t *totalLength)
 {
-    OIC_LOG_V(DEBUG, TAG, "IN, dataLength = %d", dataLength);
+    OIC_LOG_V(DEBUG, TAG, "IN, dataLength = %zu", dataLength);
 
     size_t remainDataSize = 0;
     size_t dataOnlyLen =
index e96e5a1..04703a9 100644 (file)
@@ -898,7 +898,7 @@ static void CALEDataReceiverHandler(void *threadData)
                 bleData->dataLen - (CA_BLE_HEADER_SIZE + CA_BLE_LENGTH_HEADER_SIZE);
             OIC_LOG_V(DEBUG, CALEADAPTER_TAG, "Total data to be accumulated [%u] bytes",
                       newSender->totalDataLen);
-            OIC_LOG_V(DEBUG, CALEADAPTER_TAG, "data received in the first packet [%u] bytes",
+            OIC_LOG_V(DEBUG, CALEADAPTER_TAG, "data received in the first packet [%zu] bytes",
                       dataOnlyLen);
 
             newSender->defragData = OICCalloc(newSender->totalDataLen + 1,
@@ -965,7 +965,7 @@ static void CALEDataReceiverHandler(void *threadData)
             if (senderInfo->recvDataLen + dataOnlyLen > senderInfo->totalDataLen)
             {
                 OIC_LOG_V(ERROR, CALEADAPTER_TAG,
-                          "Data Length exceeding error!! Receiving [%d] total length [%d]",
+                          "Data Length exceeding error!! Receiving [%zu] total length [%u]",
                           senderInfo->recvDataLen + dataOnlyLen, senderInfo->totalDataLen);
                 u_arraylist_remove(bleData->senderInfo, senderIndex);
                 OICFree(senderInfo->defragData);
@@ -973,7 +973,7 @@ static void CALEDataReceiverHandler(void *threadData)
                 ca_mutex_unlock(g_bleReceiveDataMutex);
                 return;
             }
-            OIC_LOG_V(DEBUG, CALEADAPTER_TAG, "Copying the data of length [%d]",
+            OIC_LOG_V(DEBUG, CALEADAPTER_TAG, "Copying the data of length [%zu]",
                       dataOnlyLen);
             memcpy(senderInfo->defragData + senderInfo->recvDataLen,
                    bleData->data + CA_BLE_HEADER_SIZE,
@@ -1049,12 +1049,12 @@ static void CALEServerSendDataThread(void *threadData)
     }
 
     OIC_LOG_V(DEBUG, CALEADAPTER_TAG,
-              "Packet info: data size[%d] midPacketCount[%d] remainingLen[%d] totalLength[%d]",
+              "Packet info: data size[%d] midPacketCount[%u] remainingLen[%zu] totalLength[%zu]",
               bleData->dataLen, midPacketCount, remainingLen, totalLength);
 
     OIC_LOG_V(DEBUG,
               CALEADAPTER_TAG,
-              "Server total Data length with header is [%u]",
+              "Server total Data length with header is [%zu]",
               totalLength);
 
     uint8_t dataSegment[CA_SUPPORTED_BLE_MTU_SIZE] = {0};
@@ -1247,7 +1247,7 @@ static void CALEServerSendDataThread(void *threadData)
                 return;
             }
             OIC_LOG_V(DEBUG, CALEADAPTER_TAG,
-                      "Server Sent data length [%d]", remainingLen + CA_BLE_HEADER_SIZE);
+                      "Server Sent data length [%zu]", remainingLen + CA_BLE_HEADER_SIZE);
         }
      }
     else
@@ -1342,7 +1342,7 @@ static void CALEServerSendDataThread(void *threadData)
                 return;
             }
             OIC_LOG_V(DEBUG, CALEADAPTER_TAG,
-                      "Server Sent data length [%d]", remainingLen + CA_BLE_HEADER_SIZE);
+                      "Server Sent data length [%zu]", remainingLen + CA_BLE_HEADER_SIZE);
         }
     }
 
@@ -1379,7 +1379,7 @@ static void CALEClientSendDataThread(void *threadData)
     }
 
     OIC_LOG_V(DEBUG, CALEADAPTER_TAG,
-              "Packet info: data size[%d] midPacketCount[%d] remainingLen[%d] totalLength[%d]",
+              "Packet info: data size[%d] midPacketCount[%u] remainingLen[%zu] totalLength[%zu]",
               bleData->dataLen, midPacketCount, remainingLen, totalLength);
 
     uint8_t dataSegment[CA_SUPPORTED_BLE_MTU_SIZE] = {0};
@@ -1567,7 +1567,7 @@ static void CALEClientSendDataThread(void *threadData)
                 return;
             }
             OIC_LOG_V(DEBUG, CALEADAPTER_TAG,
-                      "Client Sent Data length  is [%d]", remainingLen + CA_BLE_HEADER_SIZE);
+                      "Client Sent Data length  is [%zu]", remainingLen + CA_BLE_HEADER_SIZE);
         }
     }
     else
@@ -1664,7 +1664,7 @@ static void CALEClientSendDataThread(void *threadData)
                 return;
             }
             OIC_LOG_V(DEBUG, CALEADAPTER_TAG,
-                      "Client Sent Data length  is [%d]", remainingLen + CA_BLE_HEADER_SIZE);
+                      "Client Sent Data length  is [%zu]", remainingLen + CA_BLE_HEADER_SIZE);
         }
     }
 
@@ -3374,7 +3374,7 @@ static void CALERemoveReceiveQueueData(u_arraylist_t *dataInfoList, const char*
         uint32_t arrayLength = u_arraylist_length(portList);
         for (uint32_t i = 0; i < arrayLength; i++)
         {
-            uint16_t port = u_arraylist_get(portList, i);
+            uint16_t port = (uint16_t)(uintptr_t)u_arraylist_get(portList, i);
             OIC_LOG_V(DEBUG, CALEADAPTER_TAG, "port : %X", port);
 
             if (CA_STATUS_OK == CALEGetSenderInfo(address, port,
@@ -3419,7 +3419,7 @@ static CAResult_t CALEGetPortsFromSenderInfo(const char *leAddress,
 
         if (!strncmp(info->remoteEndpoint->addr, leAddress, addrLength))
         {
-            u_arraylist_add(portList, (void *)info->remoteEndpoint->port);
+            u_arraylist_add(portList, (void *)(uintptr_t)info->remoteEndpoint->port);
         }
     }
 
index 6b8c542..1a6c830 100755 (executable)
@@ -698,10 +698,8 @@ static OCStackResult HandleVirtualResource (OCServerRequest *request, OCResource
 
         discoveryResult = getQueryParamsForFiltering (virtualUriInRequest, request->query,
                 &interfaceQuery, &resourceTypeQuery);
-        bool interfaceQueryAllocated = false;
         if (!interfaceQuery && !resourceTypeQuery)
         {
-            interfaceQueryAllocated = true;
             interfaceQuery = OICStrdup(OC_RSRVD_INTERFACE_LL);
         }
 
@@ -1013,6 +1011,8 @@ HandleResourceWithEntityHandler (OCServerRequest *request,
                                  OCResource *resource,
                                  uint8_t collectionResource)
 {
+    OC_UNUSED(collectionResource);
+
     if(!request || ! resource)
     {
         return OC_STACK_INVALID_PARAM;
index 44e1178..b0a111f 100644 (file)
@@ -125,6 +125,8 @@ namespace OC
         static const char INCONSISTENT_DB[]            = "Data in provisioning DB is inconsistent";
         static const char AUTHENTICATION_FAILURE[]     = "Authentication failure";
         static const char PUBLISH_RESOURCE_FAILED[]    = "Publish Resource failure";
+        static const char FORBIDDEN_REQ[]              = "Forbidden request";
+        static const char INTERNAL_SERVER_ERROR[]      = "Internal server error";
     }
 
     namespace Error
index 419b8f5..a8d2d5d 100644 (file)
@@ -109,6 +109,10 @@ std::string OC::OCException::reason(const OCStackResult sr)
             return OC::Exception::INCONSISTENT_DB;
         case OC_STACK_AUTHENTICATION_FAILURE:
             return OC::Exception::AUTHENTICATION_FAILURE;
+        case OC_STACK_FORBIDDEN_REQ:
+            return OC::Exception::FORBIDDEN_REQ;
+        case OC_STACK_INTERNAL_SERVER_ERROR:
+            return OC::Exception::INTERNAL_SERVER_ERROR;
     }
 
     return OC::Exception::UNKNOWN_ERROR;
index 934073e..f3fe50e 100644 (file)
@@ -73,7 +73,9 @@ namespace OC
                 OC_STACK_PDM_IS_NOT_INITIALIZED,
                 OC_STACK_DUPLICATE_UUID,
                 OC_STACK_INCONSISTENT_DB,
-                OC_STACK_AUTHENTICATION_FAILURE
+                OC_STACK_AUTHENTICATION_FAILURE,
+                OC_STACK_FORBIDDEN_REQ,
+                OC_STACK_INTERNAL_SERVER_ERROR
             };
 
             std::string resultMessages[]=
@@ -118,7 +120,9 @@ namespace OC
                 OC::Exception::PDM_DB_NOT_INITIALIZED,
                 OC::Exception::DUPLICATE_UUID,
                 OC::Exception::INCONSISTENT_DB,
-                OC::Exception::AUTHENTICATION_FAILURE
+                OC::Exception::AUTHENTICATION_FAILURE,
+                OC::Exception::FORBIDDEN_REQ,
+                OC::Exception::INTERNAL_SERVER_ERROR
             };
             TEST(OCExceptionTest, ReasonCodeMatches)
             {