From 27cdce8c5b7574e4f9dbf1c367f939553424128a Mon Sep 17 00:00:00 2001 From: "jaesick.shin" Date: Wed, 18 May 2016 18:16:44 +0900 Subject: [PATCH] Clean the warning message in notification service . This patch is clean the warning code in provider side. Change-Id: Id9610ebaad4e374818a35eb4982cb40b5dcd9b68 Signed-off-by: jaesick.shin Reviewed-on: https://gerrit.iotivity.org/gerrit/8213 Tested-by: jenkins-iotivity Reviewed-by: Uze Choi --- service/notification/android/foo.txt | 0 .../examples/linux/notificationprovider.c | 23 ++++------- service/notification/src/common/NSCacheAdapter.h | 4 +- .../src/provider/NSProviderDiscovery.c | 4 +- .../src/provider/NSProviderInterface.c | 15 -------- .../notification/src/provider/NSProviderListener.c | 17 ++++---- .../notification/src/provider/NSProviderListener.h | 2 + .../src/provider/NSProviderNotification.c | 7 +--- .../src/provider/NSProviderNotification.h | 4 +- .../notification/src/provider/NSProviderResource.c | 34 +++++++--------- .../src/provider/NSProviderSubscription.c | 45 ++++++++++------------ .../src/provider/NSProviderSubscription.h | 5 ++- .../notification/src/provider/NSProviderSystem.c | 2 + .../provider/cache/linux/NSProviderMemoryCache.c | 12 ++---- .../provider/cache/linux/NSProviderMemoryCache.h | 5 ++- 15 files changed, 73 insertions(+), 106 deletions(-) delete mode 100644 service/notification/android/foo.txt diff --git a/service/notification/android/foo.txt b/service/notification/android/foo.txt deleted file mode 100644 index e69de29..0000000 diff --git a/service/notification/examples/linux/notificationprovider.c b/service/notification/examples/linux/notificationprovider.c index c614294..95ea737 100644 --- a/service/notification/examples/linux/notificationprovider.c +++ b/service/notification/examples/linux/notificationprovider.c @@ -6,7 +6,8 @@ #include "logger.h" #include "octypes.h" #include "pthread.h" - +#include "oic_string.h" +#include "oic_malloc.h" #define TAG "notiProviderExample" @@ -14,8 +15,6 @@ extern char *strdup(const char *s); bool isExit = false; -pthread_t processThread; - int id; void OCProcessThread(void * ptr) @@ -51,6 +50,7 @@ void syncCallback(NSSync *sync) int main() { int num; + pthread_t processThread; OIC_LOG(INFO, TAG, "NSStartProvider()"); @@ -62,13 +62,6 @@ int main() pthread_create(&processThread, NULL, OCProcessThread, NULL); - NSMessage * message = (NSMessage*) OICMalloc(sizeof(NSMessage)); - if (!message) - { - OIC_LOG(ERROR, TAG, PCF("Fail to allocate memory")); - return NS_ERROR; - } - while (true) { char dummy; @@ -120,13 +113,13 @@ int main() printf("app - mContentText : %s \n", body); - NSMessage * msg = (NSMessage *)malloc(sizeof(NSMessage)); + NSMessage * msg = (NSMessage *)OICMalloc(sizeof(NSMessage)); sprintf(charID, "%d", id); msg->mId = strdup(charID); msg->mTitle = strdup(title); - msg->mContentText = strdup(body); + msg->mContentText = OICStrdup(body); NSSendNotification(msg); @@ -134,13 +127,11 @@ int main() case 4: OIC_LOG(INFO, TAG, "NSRead"); - NSSync * sync = (NSSync*) malloc(sizeof(NSSync)); + NSSync * sync = (NSSync*) OICMalloc(sizeof(NSSync)); - sync->mMessageId = strdup("dev_001"); + sync->mMessageId = OICStrdup("dev_001"); sync->mState = 1; - NSSendSync(sync); - break; /* case 5: diff --git a/service/notification/src/common/NSCacheAdapter.h b/service/notification/src/common/NSCacheAdapter.h index 9f732f5..c87a05c 100755 --- a/service/notification/src/common/NSCacheAdapter.h +++ b/service/notification/src/common/NSCacheAdapter.h @@ -30,9 +30,9 @@ #include "NSConstants.h" NSCacheList * NSCacheCreate(); -NSCacheElement * NSCacheRead(NSCacheList * list, char * findId); +NSCacheElement * NSCacheRead(NSCacheList * list, const char * findId); NSResult NSCacheWrite(NSCacheList * list, NSCacheElement * newObj); -NSResult NSCacheDelete(NSCacheList * list, char * delId); +NSResult NSCacheDelete(NSCacheList * list, const char * delId); NSResult NSCacheDestroy(NSCacheList * list); #endif /* _NS_CACHEADAPTER__H_ */ diff --git a/service/notification/src/provider/NSProviderDiscovery.c b/service/notification/src/provider/NSProviderDiscovery.c index 5f245bc..94652b0 100644 --- a/service/notification/src/provider/NSProviderDiscovery.c +++ b/service/notification/src/provider/NSProviderDiscovery.c @@ -65,7 +65,7 @@ void * NSDiscoverySchedule(void * ptr) NSTask *node = NSHeadMsg[DISCOVERY_SCHEDULER]; NSHeadMsg[DISCOVERY_SCHEDULER] = node->nextTask; - switch ((int)node->taskType) + switch (node->taskType) { case TASK_START_PRESENCE: NSStartPresence(); @@ -76,6 +76,8 @@ void * NSDiscoverySchedule(void * ptr) case TASK_REGISTER_RESOURCE: NSRegisterResource(); break; + default: + break; } OICFree(node); diff --git a/service/notification/src/provider/NSProviderInterface.c b/service/notification/src/provider/NSProviderInterface.c index 16d98b3..558e1e5 100644 --- a/service/notification/src/provider/NSProviderInterface.c +++ b/service/notification/src/provider/NSProviderInterface.c @@ -97,18 +97,14 @@ NSResult NSStopProvider() NSResult NSSendNotification(NSMessage *msg) { OIC_LOG(INFO, INTERFACE_TAG, "Send Notification"); - NSPushQueue(NOTIFICATION_SCHEDULER, TASK_SEND_NOTIFICATION, msg); - return NS_OK; } NSResult NSProviderReadCheck(NSMessage *msg) { OIC_LOG(INFO, INTERFACE_TAG, "Read Sync"); - NSPushQueue(NOTIFICATION_SCHEDULER, TASK_SEND_READ, msg); - return NS_OK; } @@ -128,17 +124,6 @@ NSResult NSAccept(NSConsumer *consumer, bool accepted) return NS_OK; } -/* -NSResult NSGetConsumerList(uint8_t *list, uint32_t size) -{ - OIC_LOG(INFO, INTERFACE_TAG, "Get consumer list"); - - NSGetObsIdList(list); - size = NSGetNumberOfObsList(); - - return NS_OK; -}*/ - void * NSResponseSchedule(void * ptr) { if (ptr == NULL) diff --git a/service/notification/src/provider/NSProviderListener.c b/service/notification/src/provider/NSProviderListener.c index 7c59380..9026451 100644 --- a/service/notification/src/provider/NSProviderListener.c +++ b/service/notification/src/provider/NSProviderListener.c @@ -126,14 +126,6 @@ OCEntityHandlerResult NSEntityHandlerNotificationCb(OCEntityHandlerFlag flag, sendOptions[1].optionLength = 10; response.numSendVendorSpecificHeaderOptions = 2; } - - - // Send the response - /*if (OCDoResponse(&response) != OC_STACK_OK) - { - OIC_LOG(ERROR, LISTENER_TAG, "Error sending response"); - ehResult = OC_EH_ERROR; - }*/ } } @@ -385,7 +377,6 @@ OCEntityHandlerResult NSEntityHandlerSyncCb(OCEntityHandlerFlag flag, } } - OCPayloadDestroy(response.payload); return ehResult; } @@ -393,6 +384,11 @@ OCEntityHandlerResult NSEntityHandlerSyncCb(OCEntityHandlerFlag flag, void NSProviderConnectionStateListener(CATransportAdapter_t adapter, const char *remote_address, bool connected) { + + // should be implementation + (void)adapter; + (void)remote_address; + OIC_LOG (INFO, LISTENER_TAG, "Connection State Changed"); if (connected) @@ -409,6 +405,9 @@ void NSProviderConnectionStateListener(CATransportAdapter_t adapter, const char void NSProviderAdapterStateListener(CATransportAdapter_t adapter, bool enabled) { + // should be implementation + (void)adapter; + OIC_LOG (INFO, LISTENER_TAG, "Adapter State Changed"); if (enabled) diff --git a/service/notification/src/provider/NSProviderListener.h b/service/notification/src/provider/NSProviderListener.h index 152dcca..6b85494 100644 --- a/service/notification/src/provider/NSProviderListener.h +++ b/service/notification/src/provider/NSProviderListener.h @@ -30,6 +30,8 @@ #include "NSProviderSystem.h" #include "NSProviderScheduler.h" #include "cautilinterface.h" +#include "oic_string.h" +#include "oic_malloc.h" OCEntityHandlerResult NSEntityHandlerNotificationCb(OCEntityHandlerFlag flag, OCEntityHandlerRequest *entityHandlerRequest, void* callback); diff --git a/service/notification/src/provider/NSProviderNotification.c b/service/notification/src/provider/NSProviderNotification.c index 3c31b98..fa3b6b1 100644 --- a/service/notification/src/provider/NSProviderNotification.c +++ b/service/notification/src/provider/NSProviderNotification.c @@ -29,7 +29,6 @@ NSResult NSInitMessageList() NSResult NSGetMessagePayload(NSMessage *msg, OCRepPayload** msgPayload) { - *msgPayload = OCRepPayloadCreate(); if (!*msgPayload) @@ -48,7 +47,6 @@ NSResult NSGetMessagePayload(NSMessage *msg, OCRepPayload** msgPayload) NSResult NSGetSyncPayload(NSSync *sync, OCRepPayload** syncPayload) { - *syncPayload = OCRepPayloadCreate(); if (!*syncPayload) @@ -79,8 +77,6 @@ NSResult NSSendMessage(NSMessage *msg) return NS_ERROR; } - // Send Notification to subscribers - if (consumerSubList->head == NULL) { printf("printf - no observers (consumerSubList->head == NULL)\n"); @@ -127,7 +123,6 @@ NSResult NSSendMessage(NSMessage *msg) printf("NS_ -------------------------------------------------------message\n"); } printf("printf - no observers - 10\n"); - // Notify message to subscribers OCStackResult ocstackResult = OCNotifyListOfObservers(rHandle, obArray, obCount, payload, OC_LOW_QOS); @@ -227,7 +222,7 @@ void * NSNotificationSchedule(void *ptr) NSTask *node = NSHeadMsg[NOTIFICATION_SCHEDULER]; NSHeadMsg[NOTIFICATION_SCHEDULER] = node->nextTask; - switch (node->taskType) + switch ((int)node->taskType) { case TASK_SEND_NOTIFICATION: { diff --git a/service/notification/src/provider/NSProviderNotification.h b/service/notification/src/provider/NSProviderNotification.h index e51b493..f03516a 100644 --- a/service/notification/src/provider/NSProviderNotification.h +++ b/service/notification/src/provider/NSProviderNotification.h @@ -22,12 +22,14 @@ #define _NS_PROVIDER_NOTIFICATION_H_ #include -#include "../common/NSCacheAdapter.h" +#include "NSCacheAdapter.h" #include "logger.h" #include "NSProviderScheduler.h" #include "NSProviderListener.h" #include "NSProviderResource.h" #include "NSProviderSubscription.h" +#include "oic_string.h" +#include "oic_malloc.h" NSCacheList * messageList; diff --git a/service/notification/src/provider/NSProviderResource.c b/service/notification/src/provider/NSProviderResource.c index 6f2e64c..7bd651a 100644 --- a/service/notification/src/provider/NSProviderResource.c +++ b/service/notification/src/provider/NSProviderResource.c @@ -20,17 +20,17 @@ #include "NSProviderResource.h" -const char* NSType = "oic.r.notification"; -const char* NSMessageType = "oic.r.notification.message"; -const char* NSSyncType = "oic.r.notification.sync"; +char* NSType = "oic.r.notification"; +char* NSMessageType = "oic.r.notification.message"; +char* NSSyncType = "oic.r.notification.sync"; -const char* NSInterface = "oic.if.baseline"; -const char* NSMessgeInterface = "oic.if.baseline.message"; -const char* NSSyncInterface = "oic.if.baseline.sync"; +char* NSInterface = "oic.if.baseline"; +char* NSMessgeInterface = "oic.if.baseline.message"; +char* NSSyncInterface = "oic.if.baseline.sync"; -const char* NSUri = "/notification"; -const char* NSMessageUri = "/notification/message"; -const char* NSSyncUri = "/notification/sync"; +char* NSUri = "/notification"; +char* NSMessageUri = "/notification/message"; +char* NSSyncUri = "/notification/sync"; /* Structure to represent notification resources */ typedef struct @@ -83,10 +83,6 @@ NSResult NSCreateResource(char *uri) OIC_LOG(ERROR, RESOURCE_TAG, PCF("Fail to Create Notification Resource")); return NS_ERROR; } - - printf("NotificationResource.handle = %u\n", NotificationResource.handle); - - } else if (strcmp(uri, NSMessageUri) == 0) { @@ -102,16 +98,12 @@ NSResult NSCreateResource(char *uri) OIC_LOG(ERROR, RESOURCE_TAG, PCF("Fail to Create Notification Message Resource")); return NS_ERROR; } - - printf("NotificationMessageResource.handle = %u\n", NotificationMessageResource.handle); - - } else if (strcmp(uri, NSSyncUri) == 0) { NotificationSyncResource.id = NULL; NotificationSyncResource.state = NULL; - NotificationSyncResource.device; + memset(&NotificationSyncResource.device, 0, sizeof(NSDevice)); NotificationSyncResource.handle = NULL; if (OCCreateResource(&(NotificationSyncResource.handle), NSSyncType, NSInterface, NSSyncUri, @@ -120,9 +112,6 @@ NSResult NSCreateResource(char *uri) OIC_LOG(ERROR, RESOURCE_TAG, PCF("Fail to Create Notification Sync Resource")); return NS_ERROR; } - - printf("NotificationSyncResource.handle = %u\n", NotificationSyncResource.handle); - } else { @@ -194,6 +183,9 @@ NSResult NSPutSyncResource(NSSync *sync, OCResourceHandle * handle) { OIC_LOG(INFO, RESOURCE_TAG, "Put notification sync to Resource"); + //should be implementation + (void) sync; + *handle = NotificationSyncResource.handle; return NS_OK; diff --git a/service/notification/src/provider/NSProviderSubscription.c b/service/notification/src/provider/NSProviderSubscription.c index a0aae6d..4038c85 100644 --- a/service/notification/src/provider/NSProviderSubscription.c +++ b/service/notification/src/provider/NSProviderSubscription.c @@ -109,11 +109,9 @@ void NSHandleSubscription(OCEntityHandlerRequest *entityHandlerRequest, NSResour if (resourceType == NS_RESOURCE_MESSAGE) { - int obId = entityHandlerRequest->obsInfo.obsId; - - NSCacheElement * element = (NSCacheElement *) malloc(sizeof(NSCacheElement)); + NSCacheElement * element = (NSCacheElement *) OICMalloc(sizeof(NSCacheElement)); + NSCacheSubData * subData = (NSCacheSubData *) OICMalloc(sizeof(NSCacheSubData)); - NSCacheSubData * subData = (NSCacheSubData *) malloc(sizeof(NSCacheSubData)); subData->id = OICStrdup(entityHandlerRequest->devAddr.addr); subData->isWhite = false; subData->messageObId = entityHandlerRequest->obsInfo.obsId; @@ -122,6 +120,8 @@ void NSHandleSubscription(OCEntityHandlerRequest *entityHandlerRequest, NSResour element->data = (void*) subData; element->next = NULL; + printf("NS_ IP = %s in message ob\n", entityHandlerRequest->devAddr.addr); + printf("NS_ IP2 = %s in message ob\n", subData->id); printf("NS_ message ob Id = %d\n", subData->messageObId); if (NSCacheWrite(consumerSubList, element) != NS_OK) @@ -139,16 +139,14 @@ void NSHandleSubscription(OCEntityHandlerRequest *entityHandlerRequest, NSResour else if (NSGetSubscriptionAccepter() == NS_ACCEPTER_CONSUMER) { printf("state = 0 - 3\n"); - NSSendSubscriptionResponse(entityHandlerRequest, NS_ACCEPTER_CONSUMER, true); + NSSendSubscriptionResponse(entityHandlerRequest, true); } } else if (resourceType == NS_RESOURCE_SYNC) { - int obId = entityHandlerRequest->obsInfo.obsId; - - NSCacheElement * element = (NSCacheElement *) malloc(sizeof(NSCacheElement)); + NSCacheElement * element = (NSCacheElement *) OICMalloc(sizeof(NSCacheElement)); - NSCacheSubData * subData = (NSCacheSubData *) malloc(sizeof(NSCacheSubData)); + NSCacheSubData * subData = (NSCacheSubData *) OICMalloc(sizeof(NSCacheSubData)); printf("NS_ entityHandlerRequest->devAddr.addr = %s\n", entityHandlerRequest->devAddr.addr); subData->id = OICStrdup(entityHandlerRequest->devAddr.addr); subData->isWhite = false; @@ -171,11 +169,6 @@ void NSHandleUnsubscription(OCEntityHandlerRequest *entityHandlerRequest) { OIC_LOG(INFO, SUBSCRIPTION_TAG, "Start to unsubscription process"); - // ProcessObserveUnregister (entityHandlerRequest); - - // write consumer info to cache - int obId = entityHandlerRequest->obsInfo.obsId; - NSCacheElement * element = (NSCacheElement *) OICMalloc(sizeof(NSCacheElement)); NSCacheSubData * subData = (NSCacheSubData *) OICMalloc(sizeof(NSCacheSubData)); subData->id = OICStrdup(entityHandlerRequest->devAddr.addr); @@ -221,9 +214,15 @@ NSResult NSSendResponse(const char * id, bool accepted) OCRepPayloadSetPropBool(payload, NS_ATTRIBUTE_ACCPETANCE, accepted); NSCacheElement * element = NSCacheRead(consumerSubList, id); - NSCacheSubData * subData = element->data; - if (OCNotifyListOfObservers(rHandle, &subData->messageObId, 1, payload, OC_HIGH_QOS) + if(element == NULL) + { + printf("NS_ NSSendResponse - element is NULL\n"); + return NS_ERROR; + } + NSCacheSubData * subData = (NSCacheSubData*) element->data; + + if (OCNotifyListOfObservers(rHandle, (OCObservationId*)&subData->messageObId, 1, payload, OC_HIGH_QOS) != OC_STACK_OK) { OIC_LOG(ERROR, SUBSCRIPTION_TAG, "fail to send Acceptance"); @@ -236,8 +235,7 @@ NSResult NSSendResponse(const char * id, bool accepted) return NS_OK; } -NSResult NSSendSubscriptionResponse(OCEntityHandlerRequest *entityHandlerRequest, - NSAccessPolicy accepter, bool accepted) +NSResult NSSendSubscriptionResponse(OCEntityHandlerRequest *entityHandlerRequest, bool accepted) { OIC_LOG(INFO, SUBSCRIPTION_TAG, "Send ACCEPT message to consumer"); @@ -252,8 +250,6 @@ NSResult NSSendSubscriptionResponse(OCEntityHandlerRequest *entityHandlerRequest printf("accepted 1 \n"); if (accepted) { - int obId = entityHandlerRequest->obsInfo.obsId; - NSCacheElement * element = (NSCacheElement *) OICMalloc(sizeof(NSCacheElement)); NSCacheSubData * subData = (NSCacheSubData *) OICMalloc(sizeof(NSCacheSubData)); @@ -270,7 +266,7 @@ NSResult NSSendSubscriptionResponse(OCEntityHandlerRequest *entityHandlerRequest } } - NSSendResponse(&entityHandlerRequest->obsInfo.obsId, accepted); + NSSendResponse(entityHandlerRequest->devAddr.addr, accepted); return NS_OK; @@ -298,7 +294,6 @@ void * NSSubScriptionSchedule(void *ptr) { case TASK_SEND_POLICY: - NSSendAccessPolicyResponse((OCEntityHandlerRequest*) node->taskData); break; @@ -319,7 +314,7 @@ void * NSSubScriptionSchedule(void *ptr) NSConsumer * consumer = (NSConsumer *) node->taskData; int * pObId = (int *) consumer->mUserData; - NSCacheSubData * subData = (NSCacheMsgData *) OICMalloc(sizeof(NSCacheSubData)); + NSCacheSubData * subData = (NSCacheSubData *) OICMalloc(sizeof(NSCacheSubData)); subData->id = OICStrdup(consumer->mId); subData->isWhite = true; subData->messageObId = 0; @@ -338,7 +333,7 @@ void * NSSubScriptionSchedule(void *ptr) NSConsumer * consumer = (NSConsumer *) node->taskData; int * pObId = (int *) consumer->mUserData; - NSCacheSubData * subData = (NSCacheMsgData *) OICMalloc(sizeof(NSCacheSubData)); + NSCacheSubData * subData = (NSCacheSubData *) OICMalloc(sizeof(NSCacheSubData)); subData->id = OICStrdup(consumer->mId); subData->isWhite = false; subData->messageObId = 0; @@ -353,6 +348,8 @@ void * NSSubScriptionSchedule(void *ptr) NSHandleSubscription((OCEntityHandlerRequest*) node->taskData, NS_RESOURCE_SYNC); break; + default: + break; } OICFree(node); diff --git a/service/notification/src/provider/NSProviderSubscription.h b/service/notification/src/provider/NSProviderSubscription.h index 60813fb..7a40256 100644 --- a/service/notification/src/provider/NSProviderSubscription.h +++ b/service/notification/src/provider/NSProviderSubscription.h @@ -29,6 +29,8 @@ #include "NSProviderScheduler.h" #include "NSProviderResource.h" #include "NSCacheAdapter.h" +#include "NSProviderMemoryCache.h" +#include "oic_string.h" NSAccessPolicy NSSubscriptionAccepter; NSCacheList * consumerSubList; @@ -40,7 +42,6 @@ NSResult NSSendAccessPolicyResponse(OCEntityHandlerRequest *entityHandlerRequest void NSHandleSubscription(OCEntityHandlerRequest *entityHandlerRequest, NSResourceType resourceType); void NSHandleUnsubscription(OCEntityHandlerRequest *entityHandlerRequest); void NSAskAcceptanceToUser(OCEntityHandlerRequest *entityHandlerRequest); -NSResult NSSendSubscriptionResponse(OCEntityHandlerRequest *entityHandlerRequest, - NSAccessPolicy accepter, bool accepted); +NSResult NSSendSubscriptionResponse(OCEntityHandlerRequest *entityHandlerRequest, bool accepted); #endif /* _NS_PROVIDER_SUBSCRIPTION_H_ */ diff --git a/service/notification/src/provider/NSProviderSystem.c b/service/notification/src/provider/NSProviderSystem.c index 7e02a70..797caaf 100644 --- a/service/notification/src/provider/NSProviderSystem.c +++ b/service/notification/src/provider/NSProviderSystem.c @@ -30,5 +30,7 @@ void NSSetProviderConnectionState(NSConnectionState state) NSConnectionState NSGetProviderConnectionState() { + OIC_LOG(INFO, SUBSCRIPTION_TAG, "Change Connection State"); + return NSProviderConnectionState; } diff --git a/service/notification/src/provider/cache/linux/NSProviderMemoryCache.c b/service/notification/src/provider/cache/linux/NSProviderMemoryCache.c index 7e41915..260638f 100755 --- a/service/notification/src/provider/cache/linux/NSProviderMemoryCache.c +++ b/service/notification/src/provider/cache/linux/NSProviderMemoryCache.c @@ -36,7 +36,7 @@ NSCacheList * NSCacheCreate() return newList; } -NSCacheElement * NSCacheRead(NSCacheList * list, char * findId) +NSCacheElement * NSCacheRead(NSCacheList * list, const char * findId) { pthread_mutex_lock(&NSCacheMutex); NSCacheElement * iter = list->head; @@ -50,7 +50,6 @@ NSCacheElement * NSCacheRead(NSCacheList * list, char * findId) next = iter->next; printf("NS_ findId2 = %s\n", findId); - pthread_mutex_unlock(&NSCacheMutex); if (NSProviderCompareIdCacheData(type, iter->data, findId)) { @@ -70,9 +69,7 @@ NSResult NSCacheUpdateSubScriptionState(NSCacheList * list, NSCacheSubData * sub { pthread_mutex_lock(&NSCacheMutex); - NSCacheType type = list->cacheType; - - printf("NS_ NSCacheWrite\n"); + printf("NS_ NSCacheUpdateSubScriptionState\n"); if (subData == NULL) { @@ -211,9 +208,8 @@ NSResult NSCacheWrite(NSCacheList * list, NSCacheElement * newObj) return NS_OK; } -NSResult NSCacheDelete(NSCacheList * list, char * delId) +NSResult NSCacheDelete(NSCacheList * list, const char * delId) { - pthread_mutex_lock(&NSCacheMutex); NSCacheElement * prev = list->head; NSCacheElement * del = list->head; @@ -280,7 +276,7 @@ NSResult NSCacheDestroy(NSCacheList * list) return NS_OK; } -bool NSProviderCompareIdCacheData(NSCacheType type, void * data, char * id) +bool NSProviderCompareIdCacheData(NSCacheType type, void * data, const char * id) { if (data == NULL) { diff --git a/service/notification/src/provider/cache/linux/NSProviderMemoryCache.h b/service/notification/src/provider/cache/linux/NSProviderMemoryCache.h index 4e96aff..e4a7b50 100755 --- a/service/notification/src/provider/cache/linux/NSProviderMemoryCache.h +++ b/service/notification/src/provider/cache/linux/NSProviderMemoryCache.h @@ -30,10 +30,13 @@ #include "NSStructs.h" #include "NSConstants.h" #include "NSCacheAdapter.h" +#include "oic_malloc.h" +#include "oic_string.h" +#include "NSUtil.h" NSResult NSProviderDeleteCacheData(NSCacheType, void *); -bool NSProviderCompareIdCacheData(NSCacheType, void *, char *); +bool NSProviderCompareIdCacheData(NSCacheType, void *, const char *); bool NSProviderIsFoundCacheData(NSCacheType, void *, void*); -- 2.7.4