IOT-1583: Removing /W3 warnings inside connectivity/ (part 4)
authorPawel Winogrodzki <pawelwi@microsoft.com>
Wed, 22 Feb 2017 02:31:11 +0000 (18:31 -0800)
committerAshok Babu Channa <ashok.channa@samsung.com>
Thu, 23 Mar 2017 11:34:02 +0000 (11:34 +0000)
Removing the /W3 warnings in order to add the /WX option to prevent new
ones from being added inside the resource/csdk/connectivity/ directory.

Change-Id: I0a6eb91c6c2cd940e9939f54a454aab2a01ec954
Signed-off-by: Pawel Winogrodzki <pawelwi@microsoft.com>
Reviewed-on: https://gerrit.iotivity.org/gerrit/17551
Tested-by: jenkins-iotivity <jenkins@iotivity.org>
Reviewed-by: Alex Kelley <alexke@microsoft.com>
Reviewed-by: Ashok Babu Channa <ashok.channa@samsung.com>
30 files changed:
bridging/common/pipeHandler.cpp
bridging/plugins/hue_plugin/hue_resource.cpp
bridging/plugins/lifx_plugin/lifx_objects/lifx.cpp
resource/csdk/connectivity/SConscript
resource/csdk/connectivity/api/cacommon.h
resource/csdk/connectivity/src/bt_le_adapter/linux/service.c
resource/csdk/connectivity/src/cablockwisetransfer.c
resource/csdk/connectivity/src/caretransmission.c
resource/csdk/connectivity/src/tcp_adapter/catcpadapter.c
resource/csdk/logger/include/logger.h
resource/csdk/routing/src/routingmanager.c
resource/csdk/routing/src/routingtablemanager.c
resource/csdk/security/provisioning/sample/cloud/cloudWrapper.c
resource/csdk/security/provisioning/sample/provisioningclient.c
resource/csdk/security/provisioning/src/secureresourceprovider.c
resource/csdk/security/src/crlresource.c
resource/csdk/security/src/psinterface.c
resource/csdk/security/unittest/pbkdf2tests.cpp
resource/csdk/stack/include/payload_logging.h
resource/csdk/stack/samples/linux/SimpleClientServer/occlient.cpp
resource/csdk/stack/samples/linux/SimpleClientServer/ocserver.cpp
resource/csdk/stack/samples/linux/secure/occlientdirectpairing.cpp
resource/csdk/stack/src/ocpayloadparse.c
resource/csdk/stack/src/ocstack.c
resource/provisioning/examples/cloudWrapper.cpp
resource/provisioning/examples/provisioningclient.cpp
service/coap-http-proxy/src/CoapHttpHandler.c
service/coap-http-proxy/src/CoapHttpParser.c
service/resource-container/src/ResourceContainerImpl.cpp
service/resource-encapsulation/src/serverBuilder/src/RCSResourceObject.cpp

index 20a1879..60a71a1 100644 (file)
@@ -25,7 +25,6 @@
  * functions to write to the pipe and read from the pipe.
  */
 
-#include <cinttypes>
 #include <string.h>
 #include <errno.h>
 #include "messageHandler.h"
index 9346299..b638a03 100644 (file)
@@ -36,7 +36,6 @@
 #include <stdlib.h>
 #include <stdio.h>
 #define __STDC_FORMAT_MACROS
-#include <inttypes.h>
 #include <string.h>
 #include <string>
 #include <math.h>
index 13d89aa..cc10d5d 100644 (file)
@@ -20,7 +20,6 @@
 //
 
 #define __STDC_FORMAT_MACROS
-#include <inttypes.h>
 #include "stringbuffer.h"
 #include "writer.h"
 #include "curlClient.h"
index 58a1822..132f7c4 100644 (file)
@@ -17,6 +17,9 @@ print "Given OS is %s" % target_os
 print "BUILD_SAMPLE is %s" % build_sample
 print "MQ flag is %s" % with_mq
 
+if target_os in ['msys_nt', 'windows']:
+    connectivity_env.AppendUnique(CCFLAGS=['/W3', '/WX'])
+
 targets_disallow_multitransport = ['arduino']
 
 if target_os in targets_disallow_multitransport:
index 340a8a0..1999d1b 100644 (file)
@@ -603,7 +603,7 @@ typedef struct
 #else
         int netlinkFd;              /**< netlink */
         int shutdownFds[2];         /**< fds used to signal threads to stop */
-        int maxfd;                  /**< highest fd (for select) */
+        CASocketFd_t maxfd;         /**< highest fd (for select) */
 #endif
         int selectTimeout;          /**< in seconds */
         bool started;               /**< the IP adapter has started */
@@ -646,7 +646,7 @@ typedef struct
 #else
         int shutdownFds[2];     /**< shutdown pipe */
         int connectionFds[2];   /**< connection pipe */
-        int maxfd;              /**< highest fd (for select) */
+        CASocketFd_t maxfd;     /**< highest fd (for select) */
 #endif
         bool started;           /**< the TCP adapter has started */
         volatile bool terminate;/**< the TCP adapter needs to stop */
index 3cef691..ac96709 100644 (file)
@@ -25,7 +25,6 @@
 #include "logger.h"
 #include "oic_malloc.h"
 
-#include <inttypes.h>
 #include <stdio.h>
 #include <assert.h>
 
index cb795b3..e123284 100644 (file)
@@ -34,7 +34,6 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
-#include <inttypes.h>
 
 #include "caadapterutils.h"
 #include "cainterface.h"
@@ -730,7 +729,7 @@ CAResult_t CASendErrorMessage(const coap_pdu_t *pdu, uint8_t status,
     }
     else
     {
-        CAInfo_t responseData = { .tokenLength = pdu->transport_hdr->udp.token_length };
+        CAInfo_t responseData = { .tokenLength = (uint8_t)pdu->transport_hdr->udp.token_length };
         responseData.token = (CAToken_t) OICMalloc(responseData.tokenLength);
         if (!responseData.token)
         {
@@ -1413,7 +1412,7 @@ CAResult_t CAAddBlockOption(coap_pdu_t **pdu, const CAInfo_t *info,
     if (info->payload)
     {
         dataLength = (unsigned int)info->payloadSize;
-        OIC_LOG_V(DEBUG, TAG, "dataLength - %" PRIuPTR, dataLength);
+        OIC_LOG_V(DEBUG, TAG, "dataLength - %u", dataLength);
     }
 
     CABlockDataID_t* blockDataID = CACreateBlockDatablockId(
index 7cbcd30..535e48c 100644 (file)
@@ -45,9 +45,6 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
-#ifdef TB_LOG
-#include <inttypes.h>
-#endif
 
 #ifndef SINGLE_THREAD
 #ifdef HAVE_UNISTD_H
index fc78862..d776872 100755 (executable)
@@ -27,7 +27,6 @@
 #ifndef __STDC_FORMAT_MACROS
 #define __STDC_FORMAT_MACROS
 #endif
-#include <inttypes.h>
 
 #include "cainterface.h"
 #include "caipnwmonitor.h"
index 7215586..e90deb1 100644 (file)
@@ -21,7 +21,6 @@
 #ifndef LOGGER_H_
 #define LOGGER_H_
 
-#include <inttypes.h>
 #include <stdint.h>
 #include <stdio.h>
 #include <stdarg.h>
 #elif defined(__TIZEN__)
 #include <dlog.h>
 #elif defined(ARDUINO)
+#include <inttypes.h>
 #include "Arduino.h"
 #include "avr/pgmspace.h"
 #endif
 
 #ifdef __cplusplus
+#ifndef ARDUINO
+#include <cinttypes>
+#endif
 extern "C"
 {
+#else
+#include <inttypes.h>
 #endif
 
 // Use the PCF macro to wrap strings stored in FLASH on the Arduino
index 2edb143..d7da3c0 100644 (file)
@@ -858,7 +858,7 @@ void RMSendDeleteToNeighbourNodes()
         RTMGatewayEntry_t *entry = (RTMGatewayEntry_t *) u_linklist_get_data(iterTable);
         if (entry)
         {
-            for (uint32_t i = 0; i < u_arraylist_length(entry->destination->destIntfAddr); i++)
+            for (size_t i = 0; i < u_arraylist_length(entry->destination->destIntfAddr); i++)
             {
                 RTMDestIntfInfo_t *dest = u_arraylist_get(entry->destination->destIntfAddr, i);
                 if (!dest)
index 4eb8501..f99770d 100644 (file)
@@ -570,7 +570,7 @@ OCStackResult RTMAddObserver(uint32_t obsID, CAEndpoint_t devAddr, u_linklist_t
     {
         RTMGatewayEntry_t *entry = u_linklist_get_data(iterTable);
 
-        for (uint32_t i = 0; i < u_arraylist_length(entry->destination->destIntfAddr); i++)
+        for (size_t i = 0; i < u_arraylist_length(entry->destination->destIntfAddr); i++)
         {
             RTMDestIntfInfo_t *destCheck = u_arraylist_get(entry->destination->destIntfAddr, i);
             if (NULL != destCheck &&
@@ -614,7 +614,7 @@ bool RTMIsObserverPresent(CAEndpoint_t devAddr, OCObservationId *obsID,
             OIC_LOG(ERROR, TAG, "entry is NULL");
             return false;
         }
-        for (uint32_t i = 0; i < u_arraylist_length(entry->destination->destIntfAddr); i++)
+        for (size_t i = 0; i < u_arraylist_length(entry->destination->destIntfAddr); i++)
         {
             RTMDestIntfInfo_t *destCheck =
                 u_arraylist_get(entry->destination->destIntfAddr, i);
@@ -712,7 +712,7 @@ OCStackResult RTMRemoveGatewayDestEntry(uint32_t gatewayId, uint32_t nextHop,
         // Update the time for NextHop entry.
         if (NULL != entry->destination && nextHop == entry->destination->gatewayId)
         {
-            for (uint32_t i = 0; i < u_arraylist_length(entry->destination->destIntfAddr); i++)
+            for (size_t i = 0; i < u_arraylist_length(entry->destination->destIntfAddr); i++)
             {
                 RTMDestIntfInfo_t *destCheck = u_arraylist_get(entry->destination->destIntfAddr, i);
                 if(!destCheck)
@@ -999,7 +999,7 @@ OCStackResult RTMUpdateDestinationIntfAdr(uint32_t gatewayId, RTMDestIntfInfo_t
         {
             if (addAdr)
             {
-                for (uint32_t i = 0; i < u_arraylist_length(entry->destination->destIntfAddr); i++)
+                for (size_t i = 0; i < u_arraylist_length(entry->destination->destIntfAddr); i++)
                 {
                     RTMDestIntfInfo_t *destCheck =
                         u_arraylist_get(entry->destination->destIntfAddr, i);
@@ -1042,7 +1042,7 @@ OCStackResult RTMUpdateDestinationIntfAdr(uint32_t gatewayId, RTMDestIntfInfo_t
                 return OC_STACK_DUPLICATE_REQUEST;
             }
 
-            for (uint32_t i = 0; i < u_arraylist_length(entry->destination->destIntfAddr); i++)
+            for (size_t i = 0; i < u_arraylist_length(entry->destination->destIntfAddr); i++)
             {
                 RTMDestIntfInfo_t *removeAdr =
                     u_arraylist_get(entry->destination->destIntfAddr, i);
@@ -1156,7 +1156,7 @@ OCStackResult RTMUpdateDestAddrValidity(u_linklist_t **invalidTable, u_linklist_
         }
         else if (1 == entry->routeCost)
         {
-            for (uint32_t i = 0; i < u_arraylist_length(entry->destination->destIntfAddr); i++)
+            for (size_t i = 0; i < u_arraylist_length(entry->destination->destIntfAddr); i++)
             {
                 RTMDestIntfInfo_t *destCheck = u_arraylist_get(entry->destination->destIntfAddr, i);
                 if (!destCheck)
@@ -1207,7 +1207,7 @@ OCStackResult RTMRemoveInvalidGateways(u_linklist_t **invalidTable, u_linklist_t
         }
         else if (NULL != entry->destination && (1 == entry->routeCost))
         {
-            for (uint32_t i = 0; i < u_arraylist_length(entry->destination->destIntfAddr); i++)
+            for (size_t i = 0; i < u_arraylist_length(entry->destination->destIntfAddr); i++)
             {
                 RTMDestIntfInfo_t *destCheck = u_arraylist_get(entry->destination->destIntfAddr, i);
                 if (!destCheck && !destCheck->isValid)
@@ -1270,7 +1270,7 @@ OCStackResult RTMUpdateEntryParameters(uint32_t gatewayId, uint32_t seqNum,
         }
         if (NULL != entry->destination && gatewayId == entry->destination->gatewayId)
         {
-            for (uint32_t i = 0; i < u_arraylist_length(entry->destination->destIntfAddr); i++)
+            for (size_t i = 0; i < u_arraylist_length(entry->destination->destIntfAddr); i++)
             {
                 RTMDestIntfInfo_t *destCheck =
                     u_arraylist_get(entry->destination->destIntfAddr, i);
@@ -1335,7 +1335,7 @@ void RTMPrintTable(const u_linklist_t *gatewayTable, const u_linklist_t *endpoin
         if (1 == hop->routeCost && NULL != hop->destination &&
             hop->destination->destIntfAddr != NULL)
         {
-            for (uint32_t i = 0; i < u_arraylist_length(hop->destination->destIntfAddr); i++)
+            for (size_t i = 0; i < u_arraylist_length(hop->destination->destIntfAddr); i++)
             {
                 RTMDestIntfInfo_t *dest = u_arraylist_get(hop->destination->destIntfAddr, i);
                 if (NULL != dest)
index 1a0b29e..0892862 100644 (file)
@@ -204,11 +204,11 @@ void printStringArray(stringArray_t *list)
         return;
     }
 
-    OIC_LOG_V(INFO, TAG, "List contains %zu items", list->length);
+    OIC_LOG_V(INFO, TAG, "List contains %" PRIuPTR " items", list->length);
 
     for (size_t i = 0; i < list->length; i++)
     {
-        OIC_LOG_V(INFO, TAG, "item[%zu] = %s", i, list->array[i]);
+        OIC_LOG_V(INFO, TAG, "item[%" PRIuPTR "] = %s", i, list->array[i]);
     }
 }
 
@@ -295,7 +295,7 @@ bool readFile(const char *name, OCByteString *out)
     size_t realCount = fread(buffer, length, count, file);
     if (realCount != count)
     {
-        OIC_LOG_V(ERROR, TAG, "Read %d bytes %zu times instead of %zu", length, realCount, count);
+        OIC_LOG_V(ERROR, TAG, "Read %d bytes %" PRIuPTR " times instead of %" PRIuPTR, length, realCount, count);
         goto exit;
     }
 
index 58fa2be..2513c8f 100644 (file)
@@ -1977,7 +1977,7 @@ static size_t printUuidList(const OCUuidList_t* uid_lst)
     size_t lst_cnt = 0;
     for( ; lst; )
     {
-        printf("     [%zu] ", ++lst_cnt);
+        printf("     [%" PRIuPTR "] ", ++lst_cnt);
         printUuid((const OicUuid_t*) &lst->dev);
         printf("\n");
         lst = lst->next;
index 2646f3a..bd4f145 100644 (file)
@@ -782,7 +782,7 @@ OCStackResult SRPProvisionCredentials(void *ctx, OicSecCredType_t type, size_t k
 static void registerResultForACLProvisioning(ACLData_t *aclData,
                                              OCStackResult stackresult)
 {
-   OIC_LOG_V(INFO, TAG, "Inside registerResultForACLProvisioning aclData->numOfResults is %d\n",
+   OIC_LOG_V(INFO, TAG, "Inside registerResultForACLProvisioning aclData->numOfResults is %d",
                        aclData->numOfResults);
    memcpy(aclData->resArr[(aclData->numOfResults)].deviceId.id,
           aclData->deviceInfo->doxm->deviceID.id, UUID_LENGTH);
@@ -943,7 +943,7 @@ static void registerResultForDirectPairingProvisioning(PconfData_t *pconfData,
                                              OCStackResult stackresult)
 {
    OIC_LOG_V(INFO, TAG, "Inside registerResultForDirectPairingProvisioning "
-           "pconfData->numOfResults is %d\n", pconfData->numOfResults);
+           "pconfData->numOfResults is %d", pconfData->numOfResults);
    memcpy(pconfData->resArr[(pconfData->numOfResults)].deviceId.id,
           pconfData->deviceInfo->doxm->deviceID.id, UUID_LENGTH);
    pconfData->resArr[(pconfData->numOfResults)].res = stackresult;
@@ -1098,7 +1098,7 @@ static void registerResultForUnlinkDevices(UnlinkData_t *unlinkData, OCStackResu
 {
     if (NULL != unlinkData)
     {
-        OIC_LOG_V(INFO, TAG, "Inside registerResultForUnlinkDevices unlinkData->numOfResults is %d\n",
+        OIC_LOG_V(INFO, TAG, "Inside registerResultForUnlinkDevices unlinkData->numOfResults is %d",
                             unlinkData->numOfResults);
         OIC_LOG_V(INFO, TAG, "Stack result :: %d", stackresult);
 
@@ -1145,7 +1145,7 @@ static OCStackResult SendDeleteCredentialRequest(void* ctx,
                                                      destDev->endpoint.addr);
     if (OC_STACK_OK != result)
     {
-        OIC_LOG_V(ERROR, TAG, "SendDeleteCredentialRequest : encoding error %d\n", result);
+        OIC_LOG_V(ERROR, TAG, "SendDeleteCredentialRequest : encoding error %d", result);
         return OC_STACK_ERROR;
     }
 
@@ -1165,12 +1165,12 @@ static OCStackResult SendDeleteCredentialRequest(void* ctx,
     OICFree(subID);
     if (snRet < 0)
     {
-        OIC_LOG_V(ERROR, TAG, "SendDeleteCredentialRequest : Error (snprintf) %d\n", snRet);
+        OIC_LOG_V(ERROR, TAG, "SendDeleteCredentialRequest : Error (snprintf) %d", snRet);
         return OC_STACK_ERROR;
     }
     else if ((size_t)snRet >= sizeof(reqBuf))
     {
-        OIC_LOG_V(ERROR, TAG, "SendDeleteCredentialRequest : Truncated (snprintf) %d\n", snRet);
+        OIC_LOG_V(ERROR, TAG, "SendDeleteCredentialRequest : Truncated (snprintf) %d", snRet);
         return OC_STACK_ERROR;
     }
 
@@ -1221,7 +1221,7 @@ static OCStackResult SendDeleteACLRequest(void* ctx,
                                                      destDev->endpoint.addr);
     if (OC_STACK_OK != result)
     {
-        OIC_LOG_V(ERROR, TAG, "SendDeleteCredentialRequest : encoding error %d\n", result);
+        OIC_LOG_V(ERROR, TAG, "SendDeleteCredentialRequest : encoding error %d", result);
         return OC_STACK_ERROR;
     }
 
@@ -1233,12 +1233,12 @@ static OCStackResult SendDeleteACLRequest(void* ctx,
     OICFree(subID);
     if (snRet < 0)
     {
-        OIC_LOG_V(ERROR, TAG, "SendDeleteACLRequest : Error (snprintf) %d\n", snRet);
+        OIC_LOG_V(ERROR, TAG, "SendDeleteACLRequest : Error (snprintf) %d", snRet);
         return OC_STACK_ERROR;
     }
     else if ((size_t)snRet >= sizeof(reqBuf))
     {
-        OIC_LOG_V(ERROR, TAG, "SendDeleteACLRequest : Truncated (snprintf) %d\n", snRet);
+        OIC_LOG_V(ERROR, TAG, "SendDeleteACLRequest : Truncated (snprintf) %d", snRet);
         return OC_STACK_ERROR;
     }
 
@@ -1502,7 +1502,7 @@ static void DeleteRemoveData_t(RemoveData_t* pRemoveData)
 static void registerResultForRemoveDevice(RemoveData_t *removeData, OicUuid_t *pLinkedDevId,
                                           OCStackResult stackresult, bool hasError)
 {
-    OIC_LOG_V(INFO, TAG, "Inside registerResultForRemoveDevice removeData->numOfResults is %zu\n",
+    OIC_LOG_V(INFO, TAG, "Inside registerResultForRemoveDevice removeData->numOfResults is %" PRIuPTR,
                          removeData->numOfResults + 1);
     if (pLinkedDevId)
     {
@@ -1539,7 +1539,7 @@ static void registerResultForRemoveDevice(RemoveData_t *removeData, OicUuid_t *p
 static void registerResultForResetDevice(RemoveData_t *removeData, OicUuid_t *pLinkedDevId,
                                           OCStackResult stackresult, bool hasError)
 {
-    OIC_LOG_V(INFO, TAG, "Inside registerResultForResetDevice removeData->numOfResults is %zu\n",
+    OIC_LOG_V(INFO, TAG, "Inside registerResultForResetDevice removeData->numOfResults is %" PRIuPTR,
                          removeData->numOfResults + 1);
     if (pLinkedDevId)
     {
@@ -2427,7 +2427,7 @@ static void registerResultForGetCredResourceCB(GetSecData_t *GetSecData,
                                              OCStackResult stackresult)
 {
    OIC_LOG_V(INFO, TAG, "Inside registerResultForGetCredResourceCB "
-           "GetSecData->numOfResults is %d\n", GetSecData->numOfResults);
+           "GetSecData->numOfResults is %d", GetSecData->numOfResults);
    memcpy(GetSecData->resArr[(GetSecData->numOfResults)].deviceId.id,
           GetSecData->deviceInfo->doxm->deviceID.id, UUID_LENGTH);
    GetSecData->resArr[(GetSecData->numOfResults)].res = stackresult;
@@ -2549,7 +2549,7 @@ static void registerResultForGetACLResourceCB(GetSecData_t *GetSecData,
                                              OCStackResult stackresult)
 {
    OIC_LOG_V(INFO, TAG, "Inside registerResultForGetACLResourceCB "
-           "GetSecData->numOfResults is %d\n", GetSecData->numOfResults);
+           "GetSecData->numOfResults is %d", GetSecData->numOfResults);
    memcpy(GetSecData->resArr[(GetSecData->numOfResults)].deviceId.id,
           GetSecData->deviceInfo->doxm->deviceID.id, UUID_LENGTH);
    GetSecData->resArr[(GetSecData->numOfResults)].res = stackresult;
index 4b3c9cc..4634400 100644 (file)
@@ -89,7 +89,7 @@ void printCrl(const OicSecCrl_t *crl)
 
     OIC_LOG(INFO, TAG, "crl:");
     OIC_LOG_V(INFO, TAG, "encoding = %d", crl->CrlData.encoding);
-    OIC_LOG_V(INFO, TAG, "data (length = %zu):", crl->CrlData.len);
+    OIC_LOG_V(INFO, TAG, "data (length = %" PRIuPTR "):", crl->CrlData.len);
     OIC_LOG_BUFFER(INFO, TAG, crl->CrlData.data, crl->CrlData.len);
 }
 
index 2c34adc..3499527 100644 (file)
@@ -174,7 +174,7 @@ OCStackResult ReadDatabaseFromPS(const char *databaseName, const char *resourceN
     VERIFY_NOT_NULL(TAG, ps, ERROR);
 
     fileSize = GetDatabaseSize(ps, databaseName);
-    OIC_LOG_V(DEBUG, TAG, "File Read Size: %zu", fileSize);
+    OIC_LOG_V(DEBUG, TAG, "File Read Size: %" PRIuPTR, fileSize);
     if (fileSize)
     {
         fsData = (uint8_t *) OICCalloc(1, fileSize);
index b54de2d..2b76431 100644 (file)
@@ -22,6 +22,7 @@
 #include "pbkdf2.h"
 #include <stdlib.h>
 #include <stdint.h>
+#include <cinttypes>
 
 /*
  * Tests for the PBKDF2 implementation. 
@@ -59,7 +60,7 @@ static void print_vector(const char* label,
     printf("%s\n", label);
     print_buffer("Password", passwd, pLen);
     print_buffer("Salt", salt, saltLen);
-    printf("Iterations: %zu\n", iterations);
+    printf("Iterations: %" PRIuPTR "\n", iterations);
     print_buffer("Derived Key", derivedKey, keyLen);
 }
 
index 0dd6d09..f416806 100644 (file)
@@ -21,7 +21,6 @@
 #ifndef PAYLOAD_LOGGING_H_
 #define PAYLOAD_LOGGING_H_
 
-#include "logger.h"
 #ifdef __TIZEN__
 #include <dlog.h>
 #endif
@@ -33,7 +32,7 @@
 #define __STDC_LIMIT_MACROS
 #endif
 
-#include <inttypes.h>
+#include "logger.h"
 #include "oic_malloc.h"
 #include "ocpayload.h"
 #include "ocstack.h"
@@ -90,7 +89,7 @@ INLINE_API void OCPayloadLogRepValues(LogLevel level, OCRepPayloadValue* val)
                 switch(val->arr.type)
                 {
                     case OCREP_PROP_INT:
-                        OIC_LOG_V(level, PL_TAG, "\t\t%s(int array):%zu x %zu x %zu: ",
+                        OIC_LOG_V(level, PL_TAG, "\t\t%s(int array):%" PRIuPTR " x %" PRIuPTR " x %" PRIuPTR ": ",
                                 val->name,
                                 val->arr.dimensions[0], val->arr.dimensions[1],
                                 val->arr.dimensions[2]);
@@ -101,7 +100,7 @@ INLINE_API void OCPayloadLogRepValues(LogLevel level, OCRepPayloadValue* val)
                         }
                         break;
                     case OCREP_PROP_DOUBLE:
-                        OIC_LOG_V(level, PL_TAG, "\t\t%s(double array):%zu x %zu x %zu: ",
+                        OIC_LOG_V(level, PL_TAG, "\t\t%s(double array):%" PRIuPTR " x %" PRIuPTR " x %" PRIuPTR ": ",
                                 val->name,
                                 val->arr.dimensions[0], val->arr.dimensions[1],
                                 val->arr.dimensions[2]);
@@ -112,7 +111,7 @@ INLINE_API void OCPayloadLogRepValues(LogLevel level, OCRepPayloadValue* val)
                         }
                         break;
                     case OCREP_PROP_BOOL:
-                        OIC_LOG_V(level, PL_TAG, "\t\t%s(bool array):%zu x %zu x %zu: ",
+                        OIC_LOG_V(level, PL_TAG, "\t\t%s(bool array):%" PRIuPTR " x %" PRIuPTR " x %" PRIuPTR ": ",
                                 val->name,
                                 val->arr.dimensions[0], val->arr.dimensions[1],
                                 val->arr.dimensions[2]);
@@ -123,7 +122,7 @@ INLINE_API void OCPayloadLogRepValues(LogLevel level, OCRepPayloadValue* val)
                         }
                         break;
                     case OCREP_PROP_STRING:
-                        OIC_LOG_V(level, PL_TAG, "\t\t%s(string array):%zu x %zu x %zu: ",
+                        OIC_LOG_V(level, PL_TAG, "\t\t%s(string array):%" PRIuPTR " x %" PRIuPTR " x %" PRIuPTR ": ",
                                 val->name,
                                 val->arr.dimensions[0], val->arr.dimensions[1],
                                 val->arr.dimensions[2]);
@@ -134,7 +133,7 @@ INLINE_API void OCPayloadLogRepValues(LogLevel level, OCRepPayloadValue* val)
                         }
                         break;
                     case OCREP_PROP_BYTE_STRING:
-                        OIC_LOG_V(level, PL_TAG, "\t\t%s(byte array):%zu x %zu x %zu: ",
+                        OIC_LOG_V(level, PL_TAG, "\t\t%s(byte array):%" PRIuPTR " x %" PRIuPTR " x %" PRIuPTR ": ",
                                 val->name,
                                 val->arr.dimensions[0], val->arr.dimensions[1],
                                 val->arr.dimensions[2]);
@@ -145,7 +144,7 @@ INLINE_API void OCPayloadLogRepValues(LogLevel level, OCRepPayloadValue* val)
                         }
                         break;
                     case OCREP_PROP_OBJECT:
-                        OIC_LOG_V(level, PL_TAG, "\t\t%s(object array):%zu x %zu x %zu: ",
+                        OIC_LOG_V(level, PL_TAG, "\t\t%s(object array):%" PRIuPTR " x %" PRIuPTR " x %" PRIuPTR ": ",
                                 val->name,
                                 val->arr.dimensions[0], val->arr.dimensions[1],
                                 val->arr.dimensions[2]);
index 591c373..6576405 100755 (executable)
@@ -19,7 +19,6 @@
 //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
 
 #include "iotivity_config.h"
-#include <cinttypes>
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
index 98ed64e..0c11048 100644 (file)
@@ -35,7 +35,6 @@
 #include <pthread.h>
 #endif
 #include <array>
-#include <cinttypes>
 #include "oic_malloc.h"
 #include <getopt.h>
 #include "ocstack.h"
index 822e06b..776a695 100644 (file)
@@ -19,7 +19,6 @@
 //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=\r
 \r
 #include "iotivity_config.h"\r
-#include <cinttypes>\r
 #include <stdio.h>\r
 #include <stdlib.h>\r
 #include <string.h>\r
index 281e576..fdab5fb 100755 (executable)
@@ -60,7 +60,7 @@ OCStackResult OCParsePayload(OCPayload **outPayload, OCPayloadType payloadType,
     VERIFY_PARAM_NON_NULL(TAG, outPayload, "Conversion of outPayload failed");
     VERIFY_PARAM_NON_NULL(TAG, payload, "Invalid cbor payload value");
 
-    OIC_LOG_V(INFO, TAG, "CBOR Parsing size: %zu of Payload Type: %d, Payload:",
+    OIC_LOG_V(INFO, TAG, "CBOR Parsing size: %" PRIuPTR " of Payload Type: %d, Payload:",
             payloadSize, payloadType);
 
     CborParser parser;
index 85e1c1d..0b52070 100755 (executable)
@@ -39,7 +39,6 @@
 #include "iotivity_config.h"
 #include "iotivity_debug.h"
 #include <stdlib.h>
-#include <inttypes.h>
 #include <string.h>
 #include <ctype.h>
 #ifdef HAVE_UNISTD_H
@@ -1013,7 +1012,7 @@ OCStackResult OCEncodeAddressForRFC6874(char *outputAddress,
     {
         OIC_LOG_V(ERROR, TAG,
                   "OCEncodeAddressForRFC6874 failed: "
-                  "outputSize (%zu) < inputSize (%zu)",
+                  "outputSize (%" PRIuPTR ") < inputSize (%" PRIuPTR ")",
                   outputSize, inputSize);
 
         return OC_STACK_ERROR;
index 8a56411..94261b9 100644 (file)
@@ -254,7 +254,7 @@ static int ReadFile(const char *name, OCByteString *crl)
     realLen = fread(buffer, length, 1, file);
     if (realLen != (size_t)length)
     {
-        OIC_LOG_V(ERROR, TAG, "Length mismatch: read %zu instead of %d bytes", realLen, length);
+        OIC_LOG_V(ERROR, TAG, "Length mismatch: read %" PRIuPTR " instead of %d bytes", realLen, length);
         goto exit;
     }
 
index d7e8e29..e786e35 100644 (file)
@@ -24,7 +24,6 @@
 #include <string>
 #include <map>
 #include <cstdlib>
-#include <cinttypes>
 #include <pthread.h>
 #include <mutex>
 #include <condition_variable>
@@ -410,7 +409,7 @@ static int InputACL(OicSecAcl_t *acl)
     //Set Resource.
     size_t resourcesLen = 0;
     printf("Num. of Resource : ");
-    ret = scanf("%zu", &resourcesLen);
+    ret = scanf("%" PRIuPTR, &resourcesLen);
     if ((1 != ret) || (resourcesLen <= 0 || resourcesLen > 50))
     {
         deleteACL(acl);
@@ -431,7 +430,7 @@ static int InputACL(OicSecAcl_t *acl)
 
         LL_APPEND(ace->resources, rsrc);
 
-        printf("[%zu]Resource : ", i + 1);
+        printf("[%" PRIuPTR "]Resource : ", i + 1);
         ret = scanf("%64ms", &temp_rsc);
         if (1 != ret)
         {
@@ -666,7 +665,7 @@ static OicSecPdAcl_t* InputPdACL()
 
     //Set Resource.
     printf("Num. of Resource : ");
-    ret = scanf("%zu", &acl->resourcesLen);
+    ret = scanf("%" PRIuPTR, &acl->resourcesLen);
     if ((1 != ret) || (acl->resourcesLen <= 0 || acl->resourcesLen > 50))
     {
         printf("Error while input\n");
@@ -684,7 +683,7 @@ static OicSecPdAcl_t* InputPdACL()
     }
     for (size_t i = 0; i < acl->resourcesLen; i++)
     {
-        printf("[%zu]Resource : ", i + 1);
+        printf("[%" PRIuPTR "]Resource : ", i + 1);
         ret = scanf("%64ms", &temp_rsc);
         if (1 != ret)
         {
index 8e033e0..12f9ec1 100644 (file)
@@ -371,9 +371,9 @@ void CHPHandleHttpResponse(const HttpResponse_t *httpResponse, void *context)
     response.numSendVendorSpecificHeaderOptions = 0;
     OCHeaderOption *optionsPointer = response.sendVendorSpecificHeaderOptions;
 
-    uint8_t tempOptionNumber = u_arraylist_length(httpResponse->headerOptions);
-    for (int numOptions = 0; numOptions < tempOptionNumber &&
-                             response.numSendVendorSpecificHeaderOptions < MAX_HEADER_OPTIONS;
+    size_t tempOptionNumber = u_arraylist_length(httpResponse->headerOptions);
+    for (size_t numOptions = 0; (numOptions < tempOptionNumber) &&
+                             (response.numSendVendorSpecificHeaderOptions < MAX_HEADER_OPTIONS);
                              numOptions++)
     {
         HttpHeaderOption_t *httpOption = u_arraylist_get(httpResponse->headerOptions, numOptions);
index 23f23c6..ee46a5d 100644 (file)
@@ -798,8 +798,8 @@ static OCStackResult CHPInitializeEasyHandle(CURL** easyHandle, HttpRequest_t *r
     if (req->headerOptions)
     {
         HttpHeaderOption_t *option = NULL;
-        int headerCount = u_arraylist_length(req->headerOptions);
-        for(int i = 0; i < headerCount; i++)
+        size_t headerCount = u_arraylist_length(req->headerOptions);
+        for(size_t i = 0; i < headerCount; i++)
         {
             option = u_arraylist_get(req->headerOptions, i);
             if(option)
index e1574a8..8fd9a56 100644 (file)
@@ -436,7 +436,7 @@ namespace OIC
 
                 }
             }
-            OIC_LOG_V(INFO, CONTAINER_TAG, "Container get request for %s finished, %zu attributes",strResourceUri.c_str(), attr.size());
+            OIC_LOG_V(INFO, CONTAINER_TAG, "Container get request for %s finished, %" PRIuPTR " attributes",strResourceUri.c_str(), attr.size());
 
             return RCSGetResponse::create(std::move(attr), 200);
         }
@@ -449,7 +449,7 @@ namespace OIC
             std::string strResourceUri = request.getResourceUri();
             const std::map< std::string, std::string > &queryParams  = request.getQueryParams();
 
-            OIC_LOG_V(INFO, CONTAINER_TAG, "Container set request for %s, %zu attributes",strResourceUri.c_str(), attributes.size());
+            OIC_LOG_V(INFO, CONTAINER_TAG, "Container set request for %s, %" PRIuPTR " attributes",strResourceUri.c_str(), attributes.size());
 
             if (m_mapServers.find(strResourceUri) != m_mapServers.end()
                 && m_mapResources.find(strResourceUri) != m_mapResources.end())
index 4219388..f29672e 100644 (file)
@@ -668,7 +668,7 @@ namespace OIC
             auto replaced = requestHandler->applyAcceptanceMethod(response.getAcceptanceMethod(),
                     *this, requestAttrs);
 
-            OIC_LOG_V(WARNING, LOG_TAG, "replaced num %zu", replaced.size());
+            OIC_LOG_V(WARNING, LOG_TAG, "replaced num %" PRIuPTR, replaced.size());
             for (const auto& attrKeyValPair : replaced)
             {
                 std::shared_ptr< AttributeUpdatedListener > foundListener;