* functions to write to the pipe and read from the pipe.
*/
-#include <cinttypes>
#include <string.h>
#include <errno.h>
#include "messageHandler.h"
#include <stdlib.h>
#include <stdio.h>
#define __STDC_FORMAT_MACROS
-#include <inttypes.h>
#include <string.h>
#include <string>
#include <math.h>
//
#define __STDC_FORMAT_MACROS
-#include <inttypes.h>
#include "stringbuffer.h"
#include "writer.h"
#include "curlClient.h"
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:
#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 */
#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 */
#include "logger.h"
#include "oic_malloc.h"
-#include <inttypes.h>
#include <stdio.h>
#include <assert.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
-#include <inttypes.h>
#include "caadapterutils.h"
#include "cainterface.h"
}
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)
{
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(
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
-#ifdef TB_LOG
-#include <inttypes.h>
-#endif
#ifndef SINGLE_THREAD
#ifdef HAVE_UNISTD_H
#ifndef __STDC_FORMAT_MACROS
#define __STDC_FORMAT_MACROS
#endif
-#include <inttypes.h>
#include "cainterface.h"
#include "caipnwmonitor.h"
#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
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)
{
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 &&
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);
// 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)
{
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);
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);
}
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)
}
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)
}
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);
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)
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]);
}
}
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;
}
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;
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);
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;
{
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);
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;
}
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;
}
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;
}
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;
}
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)
{
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)
{
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;
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;
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);
}
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);
#include "pbkdf2.h"
#include <stdlib.h>
#include <stdint.h>
+#include <cinttypes>
/*
* Tests for the PBKDF2 implementation.
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);
}
#ifndef PAYLOAD_LOGGING_H_
#define PAYLOAD_LOGGING_H_
-#include "logger.h"
#ifdef __TIZEN__
#include <dlog.h>
#endif
#define __STDC_LIMIT_MACROS
#endif
-#include <inttypes.h>
+#include "logger.h"
#include "oic_malloc.h"
#include "ocpayload.h"
#include "ocstack.h"
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]);
}
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]);
}
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]);
}
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]);
}
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]);
}
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]);
//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
#include "iotivity_config.h"
-#include <cinttypes>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <pthread.h>
#endif
#include <array>
-#include <cinttypes>
#include "oic_malloc.h"
#include <getopt.h>
#include "ocstack.h"
//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=\r
\r
#include "iotivity_config.h"\r
-#include <cinttypes>\r
#include <stdio.h>\r
#include <stdlib.h>\r
#include <string.h>\r
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;
#include "iotivity_config.h"
#include "iotivity_debug.h"
#include <stdlib.h>
-#include <inttypes.h>
#include <string.h>
#include <ctype.h>
#ifdef HAVE_UNISTD_H
{
OIC_LOG_V(ERROR, TAG,
"OCEncodeAddressForRFC6874 failed: "
- "outputSize (%zu) < inputSize (%zu)",
+ "outputSize (%" PRIuPTR ") < inputSize (%" PRIuPTR ")",
outputSize, inputSize);
return OC_STACK_ERROR;
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;
}
#include <string>
#include <map>
#include <cstdlib>
-#include <cinttypes>
#include <pthread.h>
#include <mutex>
#include <condition_variable>
//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);
LL_APPEND(ace->resources, rsrc);
- printf("[%zu]Resource : ", i + 1);
+ printf("[%" PRIuPTR "]Resource : ", i + 1);
ret = scanf("%64ms", &temp_rsc);
if (1 != ret)
{
//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");
}
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)
{
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);
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)
}
}
- 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);
}
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())
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;