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>
Fri, 28 Oct 2016 12:08:43 +0000 (12:08 +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>
resource/csdk/connectivity/src/adapter_util/cafragmentation.c
resource/csdk/connectivity/src/bt_le_adapter/caleadapter.c
resource/csdk/stack/src/ocobserve.c
resource/csdk/stack/src/ocresource.c
resource/include/StringConstants.h
resource/src/OCException.cpp
resource/unittests/OCExceptionTest.cpp

index 40ac3a9..859728e 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 6fa4f46..08d5ebb 100644 (file)
@@ -897,7 +897,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,
@@ -964,7 +964,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);
@@ -972,7 +972,7 @@ static void CALEDataReceiverHandler(void *threadData)
                 oc_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,
@@ -1048,12 +1048,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};
@@ -1248,7 +1248,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
@@ -1345,7 +1345,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);
         }
     }
 
@@ -1382,7 +1382,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};
@@ -1572,7 +1572,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
@@ -1671,7 +1671,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);
         }
     }
 
@@ -3383,7 +3383,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,
@@ -3428,7 +3428,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 3f7e17e..b074ffe 100644 (file)
@@ -175,8 +175,6 @@ OCStackResult SendAllObserverNotification (OCMethod method, OCResource *resPtr,
     ResourceObserver * resourceObserver = g_serverObsList;
     uint8_t numObs = 0;
     OCServerRequest * request = NULL;
-    OCEntityHandlerRequest ehRequest = {0};
-    OCEntityHandlerResult ehResult = OC_EH_ERROR;
     bool observeErrorFlag = false;
 
     // Find clients that are observing this resource
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)
             {