From: Pawel Winogrodzki Date: Wed, 22 Feb 2017 02:31:11 +0000 (-0800) Subject: IOT-1583: Removing /W3 warnings inside connectivity/ (part 4) X-Git-Tag: 1.3.0~438 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=cdd10bfcd33adbe2c4979250e834600715f1783f;p=platform%2Fupstream%2Fiotivity.git IOT-1583: Removing /W3 warnings inside connectivity/ (part 4) 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 Reviewed-on: https://gerrit.iotivity.org/gerrit/17551 Tested-by: jenkins-iotivity Reviewed-by: Alex Kelley Reviewed-by: Ashok Babu Channa --- diff --git a/bridging/common/pipeHandler.cpp b/bridging/common/pipeHandler.cpp index 20a1879..60a71a1 100644 --- a/bridging/common/pipeHandler.cpp +++ b/bridging/common/pipeHandler.cpp @@ -25,7 +25,6 @@ * functions to write to the pipe and read from the pipe. */ -#include #include #include #include "messageHandler.h" diff --git a/bridging/plugins/hue_plugin/hue_resource.cpp b/bridging/plugins/hue_plugin/hue_resource.cpp index 9346299..b638a03 100644 --- a/bridging/plugins/hue_plugin/hue_resource.cpp +++ b/bridging/plugins/hue_plugin/hue_resource.cpp @@ -36,7 +36,6 @@ #include #include #define __STDC_FORMAT_MACROS -#include #include #include #include diff --git a/bridging/plugins/lifx_plugin/lifx_objects/lifx.cpp b/bridging/plugins/lifx_plugin/lifx_objects/lifx.cpp index 13d89aa..cc10d5d 100644 --- a/bridging/plugins/lifx_plugin/lifx_objects/lifx.cpp +++ b/bridging/plugins/lifx_plugin/lifx_objects/lifx.cpp @@ -20,7 +20,6 @@ // #define __STDC_FORMAT_MACROS -#include #include "stringbuffer.h" #include "writer.h" #include "curlClient.h" diff --git a/resource/csdk/connectivity/SConscript b/resource/csdk/connectivity/SConscript index 58a1822..132f7c4 100644 --- a/resource/csdk/connectivity/SConscript +++ b/resource/csdk/connectivity/SConscript @@ -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: diff --git a/resource/csdk/connectivity/api/cacommon.h b/resource/csdk/connectivity/api/cacommon.h index 340a8a0..1999d1b 100644 --- a/resource/csdk/connectivity/api/cacommon.h +++ b/resource/csdk/connectivity/api/cacommon.h @@ -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 */ diff --git a/resource/csdk/connectivity/src/bt_le_adapter/linux/service.c b/resource/csdk/connectivity/src/bt_le_adapter/linux/service.c index 3cef691..ac96709 100644 --- a/resource/csdk/connectivity/src/bt_le_adapter/linux/service.c +++ b/resource/csdk/connectivity/src/bt_le_adapter/linux/service.c @@ -25,7 +25,6 @@ #include "logger.h" #include "oic_malloc.h" -#include #include #include diff --git a/resource/csdk/connectivity/src/cablockwisetransfer.c b/resource/csdk/connectivity/src/cablockwisetransfer.c index cb795b3..e123284 100644 --- a/resource/csdk/connectivity/src/cablockwisetransfer.c +++ b/resource/csdk/connectivity/src/cablockwisetransfer.c @@ -34,7 +34,6 @@ #include #include #include -#include #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( diff --git a/resource/csdk/connectivity/src/caretransmission.c b/resource/csdk/connectivity/src/caretransmission.c index 7cbcd30..535e48c 100644 --- a/resource/csdk/connectivity/src/caretransmission.c +++ b/resource/csdk/connectivity/src/caretransmission.c @@ -45,9 +45,6 @@ #include #include #include -#ifdef TB_LOG -#include -#endif #ifndef SINGLE_THREAD #ifdef HAVE_UNISTD_H diff --git a/resource/csdk/connectivity/src/tcp_adapter/catcpadapter.c b/resource/csdk/connectivity/src/tcp_adapter/catcpadapter.c index fc78862..d776872 100755 --- a/resource/csdk/connectivity/src/tcp_adapter/catcpadapter.c +++ b/resource/csdk/connectivity/src/tcp_adapter/catcpadapter.c @@ -27,7 +27,6 @@ #ifndef __STDC_FORMAT_MACROS #define __STDC_FORMAT_MACROS #endif -#include #include "cainterface.h" #include "caipnwmonitor.h" diff --git a/resource/csdk/logger/include/logger.h b/resource/csdk/logger/include/logger.h index 7215586..e90deb1 100644 --- a/resource/csdk/logger/include/logger.h +++ b/resource/csdk/logger/include/logger.h @@ -21,7 +21,6 @@ #ifndef LOGGER_H_ #define LOGGER_H_ -#include #include #include #include @@ -33,13 +32,19 @@ #elif defined(__TIZEN__) #include #elif defined(ARDUINO) +#include #include "Arduino.h" #include "avr/pgmspace.h" #endif #ifdef __cplusplus +#ifndef ARDUINO +#include +#endif extern "C" { +#else +#include #endif // Use the PCF macro to wrap strings stored in FLASH on the Arduino diff --git a/resource/csdk/routing/src/routingmanager.c b/resource/csdk/routing/src/routingmanager.c index 2edb143..d7da3c0 100644 --- a/resource/csdk/routing/src/routingmanager.c +++ b/resource/csdk/routing/src/routingmanager.c @@ -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) diff --git a/resource/csdk/routing/src/routingtablemanager.c b/resource/csdk/routing/src/routingtablemanager.c index 4eb8501..f99770d 100644 --- a/resource/csdk/routing/src/routingtablemanager.c +++ b/resource/csdk/routing/src/routingtablemanager.c @@ -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) diff --git a/resource/csdk/security/provisioning/sample/cloud/cloudWrapper.c b/resource/csdk/security/provisioning/sample/cloud/cloudWrapper.c index 1a0b29e..0892862 100644 --- a/resource/csdk/security/provisioning/sample/cloud/cloudWrapper.c +++ b/resource/csdk/security/provisioning/sample/cloud/cloudWrapper.c @@ -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; } diff --git a/resource/csdk/security/provisioning/sample/provisioningclient.c b/resource/csdk/security/provisioning/sample/provisioningclient.c index 58fa2be..2513c8f 100644 --- a/resource/csdk/security/provisioning/sample/provisioningclient.c +++ b/resource/csdk/security/provisioning/sample/provisioningclient.c @@ -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; diff --git a/resource/csdk/security/provisioning/src/secureresourceprovider.c b/resource/csdk/security/provisioning/src/secureresourceprovider.c index 2646f3a..bd4f145 100644 --- a/resource/csdk/security/provisioning/src/secureresourceprovider.c +++ b/resource/csdk/security/provisioning/src/secureresourceprovider.c @@ -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; diff --git a/resource/csdk/security/src/crlresource.c b/resource/csdk/security/src/crlresource.c index 4b3c9cc..4634400 100644 --- a/resource/csdk/security/src/crlresource.c +++ b/resource/csdk/security/src/crlresource.c @@ -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); } diff --git a/resource/csdk/security/src/psinterface.c b/resource/csdk/security/src/psinterface.c index 2c34adc..3499527 100644 --- a/resource/csdk/security/src/psinterface.c +++ b/resource/csdk/security/src/psinterface.c @@ -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); diff --git a/resource/csdk/security/unittest/pbkdf2tests.cpp b/resource/csdk/security/unittest/pbkdf2tests.cpp index b54de2d..2b76431 100644 --- a/resource/csdk/security/unittest/pbkdf2tests.cpp +++ b/resource/csdk/security/unittest/pbkdf2tests.cpp @@ -22,6 +22,7 @@ #include "pbkdf2.h" #include #include +#include /* * 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); } diff --git a/resource/csdk/stack/include/payload_logging.h b/resource/csdk/stack/include/payload_logging.h index 0dd6d09..f416806 100644 --- a/resource/csdk/stack/include/payload_logging.h +++ b/resource/csdk/stack/include/payload_logging.h @@ -21,7 +21,6 @@ #ifndef PAYLOAD_LOGGING_H_ #define PAYLOAD_LOGGING_H_ -#include "logger.h" #ifdef __TIZEN__ #include #endif @@ -33,7 +32,7 @@ #define __STDC_LIMIT_MACROS #endif -#include +#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]); diff --git a/resource/csdk/stack/samples/linux/SimpleClientServer/occlient.cpp b/resource/csdk/stack/samples/linux/SimpleClientServer/occlient.cpp index 591c373..6576405 100755 --- a/resource/csdk/stack/samples/linux/SimpleClientServer/occlient.cpp +++ b/resource/csdk/stack/samples/linux/SimpleClientServer/occlient.cpp @@ -19,7 +19,6 @@ //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= #include "iotivity_config.h" -#include #include #include #include diff --git a/resource/csdk/stack/samples/linux/SimpleClientServer/ocserver.cpp b/resource/csdk/stack/samples/linux/SimpleClientServer/ocserver.cpp index 98ed64e..0c11048 100644 --- a/resource/csdk/stack/samples/linux/SimpleClientServer/ocserver.cpp +++ b/resource/csdk/stack/samples/linux/SimpleClientServer/ocserver.cpp @@ -35,7 +35,6 @@ #include #endif #include -#include #include "oic_malloc.h" #include #include "ocstack.h" diff --git a/resource/csdk/stack/samples/linux/secure/occlientdirectpairing.cpp b/resource/csdk/stack/samples/linux/secure/occlientdirectpairing.cpp index 822e06b..776a695 100644 --- a/resource/csdk/stack/samples/linux/secure/occlientdirectpairing.cpp +++ b/resource/csdk/stack/samples/linux/secure/occlientdirectpairing.cpp @@ -19,7 +19,6 @@ //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= #include "iotivity_config.h" -#include #include #include #include diff --git a/resource/csdk/stack/src/ocpayloadparse.c b/resource/csdk/stack/src/ocpayloadparse.c index 281e576..fdab5fb 100755 --- a/resource/csdk/stack/src/ocpayloadparse.c +++ b/resource/csdk/stack/src/ocpayloadparse.c @@ -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; diff --git a/resource/csdk/stack/src/ocstack.c b/resource/csdk/stack/src/ocstack.c index 85e1c1d..0b52070 100755 --- a/resource/csdk/stack/src/ocstack.c +++ b/resource/csdk/stack/src/ocstack.c @@ -39,7 +39,6 @@ #include "iotivity_config.h" #include "iotivity_debug.h" #include -#include #include #include #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; diff --git a/resource/provisioning/examples/cloudWrapper.cpp b/resource/provisioning/examples/cloudWrapper.cpp index 8a56411..94261b9 100644 --- a/resource/provisioning/examples/cloudWrapper.cpp +++ b/resource/provisioning/examples/cloudWrapper.cpp @@ -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; } diff --git a/resource/provisioning/examples/provisioningclient.cpp b/resource/provisioning/examples/provisioningclient.cpp index d7e8e29..e786e35 100644 --- a/resource/provisioning/examples/provisioningclient.cpp +++ b/resource/provisioning/examples/provisioningclient.cpp @@ -24,7 +24,6 @@ #include #include #include -#include #include #include #include @@ -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) { diff --git a/service/coap-http-proxy/src/CoapHttpHandler.c b/service/coap-http-proxy/src/CoapHttpHandler.c index 8e033e0..12f9ec1 100644 --- a/service/coap-http-proxy/src/CoapHttpHandler.c +++ b/service/coap-http-proxy/src/CoapHttpHandler.c @@ -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); diff --git a/service/coap-http-proxy/src/CoapHttpParser.c b/service/coap-http-proxy/src/CoapHttpParser.c index 23f23c6..ee46a5d 100644 --- a/service/coap-http-proxy/src/CoapHttpParser.c +++ b/service/coap-http-proxy/src/CoapHttpParser.c @@ -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) diff --git a/service/resource-container/src/ResourceContainerImpl.cpp b/service/resource-container/src/ResourceContainerImpl.cpp index e1574a8..8fd9a56 100644 --- a/service/resource-container/src/ResourceContainerImpl.cpp +++ b/service/resource-container/src/ResourceContainerImpl.cpp @@ -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()) diff --git a/service/resource-encapsulation/src/serverBuilder/src/RCSResourceObject.cpp b/service/resource-encapsulation/src/serverBuilder/src/RCSResourceObject.cpp index 4219388e..f29672e 100644 --- a/service/resource-encapsulation/src/serverBuilder/src/RCSResourceObject.cpp +++ b/service/resource-encapsulation/src/serverBuilder/src/RCSResourceObject.cpp @@ -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;