//=============================================================================
// Includes
//=============================================================================
+#define _POSIX_C_SOURCE 200112L
+#include <string.h>
#include "occoap.h"
#include "ocstackconfig.h"
#include "occlientcb.h"
#ifdef WITH_PRESENCE
if(!strcmp((char *)rcvdUri, (char *)OC_PRESENCE_URI)){
+ char* tokSavePtr;
+
isPresenceNotification = 1;
OC_LOG(INFO, TAG, PCF("Received a presence notification"));
- tok = strtok((char *)bufRes, "[:]}");
+ tok = strtok_r((char *)bufRes, "[:]}", &tokSavePtr);
bufRes[strlen((char *)bufRes)] = ':';
- tok = strtok(NULL, "[:]}");
+ tok = strtok_r(NULL, "[:]}", &tokSavePtr);
bufRes[strlen((char *)bufRes)] = ':';
VERIFY_NON_NULL(tok);
sequenceNumber = (uint32_t )atol(tok);
OC_LOG_V(DEBUG, TAG, "The received NONCE is %u", sequenceNumber);
- tok = strtok(NULL, "[:]}");
+ tok = strtok_r(NULL, "[:]}", &tokSavePtr);
VERIFY_NON_NULL(tok);
maxAge = (uint32_t )atol(tok);
OC_LOG_V(DEBUG, TAG, "The received TTL is %u", maxAge);
- tok = strtok(NULL, "[:]}");
+ tok = strtok_r(NULL, "[:]}", &tokSavePtr);
if(tok) {
bufRes[strlen((char *)bufRes)] = ':';
resourceTypeName = (char *)OCMalloc(strlen(tok));
//
//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+#define _POSIX_C_SOURCE 200112L
#include <string.h>
#include "ocstack.h"
#include "ocstackconfig.h"
if (strcmp ((char *)url, GetVirtualResourceUri(OC_WELL_KNOWN_URI)) == 0) {
*filterOn = STACK_RES_DISCOVERY_NOFILTER;
if (query && *query) {
- filterParam = strtok ((char *)query, "=");
- *filterValue = strtok (NULL, " ");
+ char* strTokPtr;
+ filterParam = strtok_r((char *)query, "=", &strTokPtr);
+ *filterValue = strtok_r(NULL, " ", &strTokPtr);
if (!(*filterValue)) {
return OC_STACK_INVALID_QUERY;
} else if (strcmp (filterParam, OC_RSRVD_INTERFACE) == 0) {
//-----------------------------------------------------------------------------
// Includes
//-----------------------------------------------------------------------------
+#define _POSIX_C_SOURCE 200112L
+#include <string.h>
+
#include "ocstack.h"
#include "ocstackinternal.h"
#include "ocresourcehandler.h"
goto exit;
}
strcpy(tempURI, uri);
- leftToken = strtok((char *)tempURI, "?");
+ char* strTokPtr;
+ leftToken = strtok_r((char *)tempURI, "?", &strTokPtr);
while(leftToken != NULL)
{
strcpy((char *)*resourceType, ((const char *)&leftToken[3]));
break;
}
- leftToken = strtok(NULL, "?");
+ leftToken = strtok_r(NULL, "?", &strTokPtr);
}
*newURI = tempURI;