diff --git a/resource/csdk/connectivity/src/adapter_util/ca_adapter_net_ssl.c b/resource/csdk/connectivity/src/adapter_util/ca_adapter_net_ssl.c index 361f2e383fd353a8d7e071a47ac8ed90c6b6df0a..c1fd5378272cb0416a03ca9d3589da824972a1d8 100644 --- a/resource/csdk/connectivity/src/adapter_util/ca_adapter_net_ssl.c +++ b/resource/csdk/connectivity/src/adapter_util/ca_adapter_net_ssl.c @@ -28,6 +28,7 @@ #include #include #include +#include #include "ca_adapter_net_ssl.h" #include "cacommon.h" #include "caipinterface.h" @@ -588,7 +589,7 @@ static int SendCallBack(void * tep, const unsigned char * data, size_t dataLen) else if ((size_t)sentLen != dataLen) { OIC_LOG_V(DEBUG, NET_SSL_TAG, - "Packet was partially sent - sent/total/remained bytes : %d/%" PRIuPTR "/%" PRIuPTR, + "Packet was partially sent - sent/total/remained bytes : %" PRIdPTR "/%" PRIuPTR "/%" PRIuPTR, sentLen, dataLen, (dataLen - sentLen)); } } diff --git a/resource/csdk/connectivity/src/adapter_util/caadapterutils.c b/resource/csdk/connectivity/src/adapter_util/caadapterutils.c index a106a67221b83cccc3758cffac9625488a15ac7b..252ccbf049a086a7e9fddad03e60a8e15aa1d4fb 100644 --- a/resource/csdk/connectivity/src/adapter_util/caadapterutils.c +++ b/resource/csdk/connectivity/src/adapter_util/caadapterutils.c @@ -26,6 +26,7 @@ #include "oic_string.h" #include "oic_malloc.h" #include +#include #ifdef HAVE_WS2TCPIP_H #include @@ -387,7 +388,7 @@ void CALogSendStateInfo(CATransportAdapter_t adapter, if (true == isSuccess) { - OIC_LOG_V(DEBUG, ANALYZER_TAG, "Send Success, sent length = [%d]", sentLen); + OIC_LOG_V(DEBUG, ANALYZER_TAG, "Send Success, sent length = [%" PRIdPTR "]", sentLen); } else { diff --git a/resource/csdk/connectivity/src/bt_le_adapter/caleadapter.c b/resource/csdk/connectivity/src/bt_le_adapter/caleadapter.c index b895921bc113edcbf11d9746117608de6c58f6af..d9dd3e4242f915f9c090bb5d29ed840caaa68b6a 100644 --- a/resource/csdk/connectivity/src/bt_le_adapter/caleadapter.c +++ b/resource/csdk/connectivity/src/bt_le_adapter/caleadapter.c @@ -21,6 +21,7 @@ #include #include +#include #include "cafragmentation.h" @@ -1367,7 +1368,7 @@ static void CALEServerSendDataThread(void *threadData) OIC_LOG_V(DEBUG, CALEADAPTER_TAG, - "Server Sent Unicast First Data - data length [%zu]", + "Server Sent Unicast First Data - data length [%u]", length); result = CAGenerateHeader(dataHeader, @@ -1780,7 +1781,7 @@ static void CALEClientSendDataThread(void *threadData) } OIC_LOG_V(DEBUG, CALEADAPTER_TAG, - "Client Sent Unicast First Data - data length [%zu]", + "Client Sent Unicast First Data - data length [%u]", length); result = CAGenerateHeader(dataHeader, @@ -1842,7 +1843,7 @@ static void CALEClientSendDataThread(void *threadData) } OIC_LOG_V(DEBUG, CALEADAPTER_TAG, - "Client Sent Unicast %d Data - data(mtu) length [%zu]", + "Client Sent Unicast %d Data - data(mtu) length [%u]", index + 1, g_mtuSize); } @@ -2827,7 +2828,7 @@ static ssize_t CALESecureSendDataCB(CAEndpoint_t *endpoint, VERIFY_NON_NULL_RET(endpoint, CALEADAPTER_TAG, "endpoint is NULL", -1); VERIFY_NON_NULL_RET(data, CALEADAPTER_TAG, "data is NULL", -1); - OIC_LOG_V(DEBUG, CALEADAPTER_TAG, "Secure Data Send - encrypted datalen = %d", dataLen); + OIC_LOG_V(DEBUG, CALEADAPTER_TAG, "Secure Data Send - encrypted datalen = %" PRIuPTR, dataLen); CAResult_t result; CADataType_t dataType = g_dataType; @@ -2881,7 +2882,7 @@ static void CALESecureReceiveDataCB(const CASecureEndpoint_t *sep, VERIFY_NON_NULL_VOID(sep, CALEADAPTER_TAG, "sep is NULL"); VERIFY_NON_NULL_VOID(data, CALEADAPTER_TAG, "data is NULL"); - OIC_LOG_V(DEBUG, CALEADAPTER_TAG, "Secure Data Receive - decrypted datalen = %d", dataLen); + OIC_LOG_V(DEBUG, CALEADAPTER_TAG, "Secure Data Receive - decrypted datalen = %" PRIuPTR, dataLen); if (dataLen == 0) { @@ -3782,7 +3783,7 @@ static CAResult_t CALEAdapterClientReceivedData(const char *remoteAddress, // Create bleData to add to queue OIC_LOG_V(DEBUG, CALEADAPTER_TAG, - "Data received from LE Client layer [%zu]", + "Data received from LE Client layer [%u]", dataLength); CALEData_t * const bleData = diff --git a/resource/csdk/connectivity/src/cainterfacecontroller.c b/resource/csdk/connectivity/src/cainterfacecontroller.c index 09bb11f01782489817bfc5bf59bf6bebc2789492..ae7dcc141f9403e59c52e3097ad3a3c74d3bfa21 100644 --- a/resource/csdk/connectivity/src/cainterfacecontroller.c +++ b/resource/csdk/connectivity/src/cainterfacecontroller.c @@ -471,7 +471,7 @@ CAResult_t CAGetNetworkInfo(CAEndpoint_t **info, size_t *size) OIC_LOG_V(DEBUG, TAG, - "%" PRIu32 " adapter network info size is %" PRIu32 " res:%d", + "%" PRIuPTR " adapter network info size is %" PRIuPTR " res:%u", index, tempSize[index], res); @@ -864,4 +864,3 @@ CAResult_t CAReadData() return CA_STATUS_OK; } #endif - diff --git a/resource/csdk/connectivity/src/camessagehandler.c b/resource/csdk/connectivity/src/camessagehandler.c index 8829f134b301259a4713fd419e513913e3a400a4..4f83171405eb2e7e589fc396ee6a9458e84971d6 100644 --- a/resource/csdk/connectivity/src/camessagehandler.c +++ b/resource/csdk/connectivity/src/camessagehandler.c @@ -1469,7 +1469,7 @@ static void CALogPDUInfo(const CAData_t *data, const coap_pdu_t *pdu) if (pdu->transport_hdr) { - OIC_LOG_V(DEBUG, ANALYZER_TAG, "Msg ID = [%u]", + OIC_LOG_V(DEBUG, ANALYZER_TAG, "Msg ID = [%u]", (uint32_t)ntohs(pdu->transport_hdr->udp.id)); } @@ -1499,7 +1499,7 @@ static void CALogPDUInfo(const CAData_t *data, const coap_pdu_t *pdu) #ifdef TB_LOG size_t payloadLen = (pdu->data) ? (unsigned char *)pdu->hdr + pdu->length - pdu->data : 0; #endif - OIC_LOG_V(DEBUG, ANALYZER_TAG, "CoAP Message Full Size = [%lu]", pdu->length); + OIC_LOG_V(DEBUG, ANALYZER_TAG, "CoAP Message Full Size = [%u]", pdu->length); OIC_LOG(DEBUG, ANALYZER_TAG, "CoAP Header (+ 0xFF)"); OIC_LOG_BUFFER(DEBUG, ANALYZER_TAG, (const uint8_t *) pdu->transport_hdr, pdu->length - payloadLen); diff --git a/resource/csdk/connectivity/src/ip_adapter/caipserver.c b/resource/csdk/connectivity/src/ip_adapter/caipserver.c index 997775ea0299ca69edc3b9e709f148ea47327d51..8d906a10054d7d227b41efa99d042e32f0560aac 100644 --- a/resource/csdk/connectivity/src/ip_adapter/caipserver.c +++ b/resource/csdk/connectivity/src/ip_adapter/caipserver.c @@ -62,6 +62,7 @@ #endif #include +#include #include "caipinterface.h" #include "caipnwmonitor.h" #include "caadapterutils.h" @@ -1197,7 +1198,7 @@ CAResult_t CAIPStartListenServer() } size_t len = u_arraylist_length(iflist); - OIC_LOG_V(DEBUG, TAG, "IP network interfaces found: %d", len); + OIC_LOG_V(DEBUG, TAG, "IP network interfaces found: %" PRIuPTR, len); for (size_t i = 0; i < len; i++) { @@ -1238,7 +1239,7 @@ CAResult_t CAIPStopListenServer() } size_t len = u_arraylist_length(iflist); - OIC_LOG_V(DEBUG, TAG, "IP network interfaces found: %d", len); + OIC_LOG_V(DEBUG, TAG, "IP network interfaces found: %" PRIuPTR, len); for (size_t i = 0; i < len; i++) { diff --git a/resource/csdk/connectivity/src/tcp_adapter/catcpadapter.c b/resource/csdk/connectivity/src/tcp_adapter/catcpadapter.c index e1a888dbe897c9b1d4d512baeb963156d8aae328..7f70b7d7e838a9c757eef7e4c73f9d9299b3db2f 100644 --- a/resource/csdk/connectivity/src/tcp_adapter/catcpadapter.c +++ b/resource/csdk/connectivity/src/tcp_adapter/catcpadapter.c @@ -23,6 +23,7 @@ #include #include #include +#include #ifndef __STDC_FORMAT_MACROS #define __STDC_FORMAT_MACROS @@ -211,7 +212,7 @@ void CATCPPacketReceivedCB(const CASecureEndpoint_t *sep, const void *data, } else { - OIC_LOG_V(DEBUG, TAG, "%u bytes required for complete CoAP", + OIC_LOG_V(DEBUG, TAG, "%" PRIuPTR " bytes required for complete CoAP", svritem->totalLen - svritem->len); } } @@ -230,7 +231,7 @@ static ssize_t CATCPPacketSendCB(CAEndpoint_t *endpoint, const void *data, size_ ssize_t ret = CATCPSendData(endpoint, data, dataLength); - OIC_LOG_V(DEBUG, TAG, "Out %s : %d bytes sent", __func__, ret); + OIC_LOG_V(DEBUG, TAG, "Out %s : %" PRIdPTR " bytes sent", __func__, ret); return ret; } #endif diff --git a/resource/csdk/connectivity/src/tcp_adapter/catcpserver.c b/resource/csdk/connectivity/src/tcp_adapter/catcpserver.c index 5ee30c55bc605a508a971273f5993ae27db1ddd4..28f42ab69e2c6539e6735eb3d5d4d0a9514cc17d 100644 --- a/resource/csdk/connectivity/src/tcp_adapter/catcpserver.c +++ b/resource/csdk/connectivity/src/tcp_adapter/catcpserver.c @@ -66,6 +66,7 @@ #include #include +#include #ifdef __WITH_TLS__ #include "ca_adapter_net_ssl.h" @@ -647,7 +648,7 @@ CAResult_t CAConstructCoAP(CATCPSessionInfo_t *svritem, unsigned char **data, unsigned char *inBuffer = *data; size_t inLen = *dataLength; - OIC_LOG_V(DEBUG, TAG, "before-datalength : %u", *dataLength); + OIC_LOG_V(DEBUG, TAG, "before-datalength : %" PRIuPTR, *dataLength); if (NULL == svritem->data && inLen > 0) { @@ -737,7 +738,7 @@ CAResult_t CAConstructCoAP(CATCPSessionInfo_t *svritem, unsigned char **data, *data = inBuffer; *dataLength = inLen; - OIC_LOG_V(DEBUG, TAG, "after-datalength : %u", *dataLength); + OIC_LOG_V(DEBUG, TAG, "after-datalength : %" PRIuPTR, *dataLength); OIC_LOG_V(DEBUG, TAG, "Out %s", __func__); return CA_STATUS_OK; } @@ -766,10 +767,10 @@ static CAResult_t CAReceiveMessage(CATCPSessionInfo_t *svritem) //[3][4] bytes in tls header are tls payload length tlsLength = TLS_HEADER_SIZE + (size_t)((svritem->tlsdata[3] << 8) | svritem->tlsdata[4]); - OIC_LOG_V(DEBUG, TAG, "toal tls length = %u", tlsLength); + OIC_LOG_V(DEBUG, TAG, "total tls length = %" PRIuPTR, tlsLength); if (tlsLength > sizeof(svritem->tlsdata)) { - OIC_LOG_V(ERROR, TAG, "toal tls length is too big (buffer size : %u)", + OIC_LOG_V(ERROR, TAG, "total tls length is too big (buffer size : %" PRIuPTR ")", sizeof(svritem->tlsdata)); return CA_RECEIVE_FAILED; } @@ -790,7 +791,7 @@ static CAResult_t CAReceiveMessage(CATCPSessionInfo_t *svritem) else { svritem->tlsLen += len; - OIC_LOG_V(DEBUG, TAG, "nb_read : %u bytes , recv() : %d bytes, svritem->tlsLen : %u bytes", + OIC_LOG_V(DEBUG, TAG, "nb_read : %" PRIuPTR " bytes , recv() : %d bytes, svritem->tlsLen : %" PRIuPTR " bytes", nbRead, len, svritem->tlsLen); if (tlsLength > 0 && tlsLength == svritem->tlsLen) { diff --git a/resource/csdk/security/src/occertutility.c b/resource/csdk/security/src/occertutility.c index 0948fdd92145b03f98e65e0c9bcd9987ee956cf3..d5e3da32b83a43ff6b19447f1d9ff21f949e993a 100644 --- a/resource/csdk/security/src/occertutility.c +++ b/resource/csdk/security/src/occertutility.c @@ -26,6 +26,7 @@ #include #include #include +#include #include "oic_malloc.h" #include "oic_string.h" #include "cacommon.h" @@ -100,7 +101,7 @@ OCStackResult OC_CALL OCGenerateRandomSerialNumber(char **serial, size_t *serial VERIFY_SUCCESS(TAG, OCGetRandomBytes(random, sizeof(random)), ERROR); /* Per RFC 5280, 20 octets is the maximum length of a serial number. In ASN.1, if the highest-order - * bit is set it causes a padding octet to be written, which would be 21 and non-compliant. + * bit is set it causes a padding octet to be written, which would be 21 and non-compliant. * Therefore, always clear the highest-order bit. Integers in ASN.1 are always big-Endian. */ random[0] &= 0x7F; @@ -324,7 +325,7 @@ static OCStackResult GenerateCertificate( { ret = mbedtls_x509write_crt_set_basic_constraints(&outCertCtx, 1, -1); VERIFY_SUCCESS(TAG, 0 == ret, ERROR); - ret = mbedtls_x509write_crt_set_key_usage(&outCertCtx, + ret = mbedtls_x509write_crt_set_key_usage(&outCertCtx, MBEDTLS_X509_KU_DIGITAL_SIGNATURE | MBEDTLS_X509_KU_KEY_CERT_SIGN); VERIFY_SUCCESS(TAG, 0 == ret, ERROR); } @@ -339,7 +340,7 @@ static OCStackResult GenerateCertificate( MBEDTLS_X509_KU_KEY_AGREEMENT); VERIFY_SUCCESS(TAG, 0 == ret, ERROR); } - + switch (certType) { case CERT_TYPE_ROLE: @@ -426,7 +427,7 @@ OCStackResult OC_CALL OCGenerateCACertificate( { OCStackResult res = OC_STACK_OK; OCByteString byteStr = { 0 }; - + res = GenerateCertificate( CERT_TYPE_CA, subject, @@ -677,7 +678,7 @@ OCStackResult OC_CALL OCGetUuidFromCSR(const char* csr, OicUuid_t* uuid) ret = mbedtls_x509_dn_gets(uuidStr, sizeof(uuidStr), &csrObj.subject); if (ret != (sizeof(uuidStr) - 1)) { - OIC_LOG_V(ERROR, TAG, "mbedtls_x509_dn_gets returned length or error: %d, expected %d", ret, sizeof(uuidStr) - 1); + OIC_LOG_V(ERROR, TAG, "mbedtls_x509_dn_gets returned length or error: %d, expected %" PRIuPTR, ret, sizeof(uuidStr) - 1); mbedtls_x509_csr_free(&csrObj); return OC_STACK_ERROR; } diff --git a/resource/csdk/security/src/pstatresource.c b/resource/csdk/security/src/pstatresource.c index e027665fa10acba297a37443317998561fa17de6..ea9b87dbc301e9baa42aec9c763a90d7d25cca02 100644 --- a/resource/csdk/security/src/pstatresource.c +++ b/resource/csdk/security/src/pstatresource.c @@ -22,6 +22,7 @@ #include #include +#include #include "ocstack.h" #include "oic_malloc.h" @@ -208,7 +209,7 @@ OCStackResult PstatToCBORPayloadPartial(const OicSecPstat_t *pstat, pstatMapSize++; } } - OIC_LOG_V(INFO, TAG, "%s: creating pstat CBOR payload with %zu Properties.", + OIC_LOG_V(INFO, TAG, "%s: creating pstat CBOR payload with %" PRIuPTR " Properties.", __func__, pstatMapSize - PSTAT_EMPTY_MAP_SIZE); // Top Level Pstat Map @@ -1263,4 +1264,3 @@ exit: OICFree(cborPayload); return ret; } - diff --git a/resource/csdk/security/src/rolesresource.c b/resource/csdk/security/src/rolesresource.c index dfa197beb6446bd056d623b8e76a05ae6e84c951..586172364ecef235a7c0f7d97cf2b55432f5122f 100644 --- a/resource/csdk/security/src/rolesresource.c +++ b/resource/csdk/security/src/rolesresource.c @@ -716,7 +716,7 @@ OCStackResult CBORPayloadToRoles(const uint8_t *cborPayload, size_t size, RoleCe /* Only SIGNED_ASYMMETRIC_KEY is supported. */ if (SIGNED_ASYMMETRIC_KEY != (OicSecCredType_t)credType) { - OIC_LOG_V(ERROR, TAG, "Unsupported role credential type: %llu", credType); + OIC_LOG_V(ERROR, TAG, "Unsupported role credential type: %lu", credType); goto exit; } } diff --git a/service/coap-http-proxy/src/CoapHttpParser.c b/service/coap-http-proxy/src/CoapHttpParser.c index 63bfe92ced9eedfc0be6cdf8d4fab340b9e6527c..478ba4cafd50a52894006d9c34ecf9349fd20338 100644 --- a/service/coap-http-proxy/src/CoapHttpParser.c +++ b/service/coap-http-proxy/src/CoapHttpParser.c @@ -21,6 +21,7 @@ #include #include #include +#include #include "iotivity_config.h" #include "CoapHttpParser.h" @@ -552,7 +553,7 @@ static size_t CHPEasyHandleWriteCb(char *buffer, size_t size, size_t num, void * void *newPayload = OICRealloc(resp->payload, ctx->writeOffset + dataToWrite); if (!newPayload) { - OIC_LOG_V(ERROR, TAG, "Realloc failed! Current: %u Extra: %u", ctx->writeOffset, + OIC_LOG_V(ERROR, TAG, "Realloc failed! Current: %" PRIuPTR " Extra: %" PRIuPTR, ctx->writeOffset, dataToWrite); resp->payloadLength = 0; ctx->writeOffset = 0; @@ -567,7 +568,7 @@ static size_t CHPEasyHandleWriteCb(char *buffer, size_t size, size_t num, void * ctx->writeOffset += dataToWrite; resp->payloadLength = ctx->writeOffset; - OIC_LOG_V(DEBUG, TAG, "%s OUT %u : %u", __func__, resp->payloadLength, dataToWrite); + OIC_LOG_V(DEBUG, TAG, "%s OUT %" PRIuPTR " : %" PRIuPTR, __func__, resp->payloadLength, dataToWrite); return dataToWrite; } @@ -867,4 +868,3 @@ OCStackResult CHPPostHttpRequest(HttpRequest_t *req, CHPResponseCallback httpcb, OIC_LOG_V(DEBUG, TAG, "%s OUT", __func__); return OC_STACK_OK; } -