Clean the warning message in notification service .
authorjaesick.shin <jaesick.shin@samsung.com>
Wed, 18 May 2016 09:16:44 +0000 (18:16 +0900)
committerUze Choi <uzchoi@samsung.com>
Thu, 19 May 2016 01:36:00 +0000 (01:36 +0000)
This patch is clean the warning code in provider side.

Change-Id: Id9610ebaad4e374818a35eb4982cb40b5dcd9b68
Signed-off-by: jaesick.shin <jaesick.shin@samsung.com>
Reviewed-on: https://gerrit.iotivity.org/gerrit/8213
Tested-by: jenkins-iotivity <jenkins-iotivity@opendaylight.org>
Reviewed-by: Uze Choi <uzchoi@samsung.com>
15 files changed:
service/notification/android/foo.txt [deleted file]
service/notification/examples/linux/notificationprovider.c
service/notification/src/common/NSCacheAdapter.h
service/notification/src/provider/NSProviderDiscovery.c
service/notification/src/provider/NSProviderInterface.c
service/notification/src/provider/NSProviderListener.c
service/notification/src/provider/NSProviderListener.h
service/notification/src/provider/NSProviderNotification.c
service/notification/src/provider/NSProviderNotification.h
service/notification/src/provider/NSProviderResource.c
service/notification/src/provider/NSProviderSubscription.c
service/notification/src/provider/NSProviderSubscription.h
service/notification/src/provider/NSProviderSystem.c
service/notification/src/provider/cache/linux/NSProviderMemoryCache.c
service/notification/src/provider/cache/linux/NSProviderMemoryCache.h

diff --git a/service/notification/android/foo.txt b/service/notification/android/foo.txt
deleted file mode 100644 (file)
index e69de29..0000000
index c614294..95ea737 100644 (file)
@@ -6,7 +6,8 @@
 #include "logger.h"\r
 #include "octypes.h"\r
 #include "pthread.h"\r
-\r
+#include "oic_string.h"\r
+#include "oic_malloc.h"\r
 \r
 #define TAG "notiProviderExample"\r
 \r
@@ -14,8 +15,6 @@ extern char *strdup(const char *s);
 \r
 bool isExit = false;\r
 \r
-pthread_t processThread;\r
-\r
 int id;\r
 \r
 void OCProcessThread(void * ptr)\r
@@ -51,6 +50,7 @@ void syncCallback(NSSync *sync)
 int main()\r
 {\r
     int num;\r
+    pthread_t processThread;\r
 \r
     OIC_LOG(INFO, TAG, "NSStartProvider()");\r
 \r
@@ -62,13 +62,6 @@ int main()
 \r
     pthread_create(&processThread, NULL, OCProcessThread, NULL);\r
 \r
-    NSMessage * message = (NSMessage*) OICMalloc(sizeof(NSMessage));\r
-    if (!message)\r
-    {\r
-        OIC_LOG(ERROR, TAG, PCF("Fail to allocate memory"));\r
-        return NS_ERROR;\r
-    }\r
-\r
     while (true)\r
     {\r
         char dummy;\r
@@ -120,13 +113,13 @@ int main()
                 printf("app - mContentText : %s \n", body);\r
 \r
 \r
-                NSMessage * msg = (NSMessage *)malloc(sizeof(NSMessage));\r
+                NSMessage * msg = (NSMessage *)OICMalloc(sizeof(NSMessage));\r
 \r
                 sprintf(charID, "%d", id);\r
 \r
                 msg->mId = strdup(charID);\r
                 msg->mTitle = strdup(title);\r
-                msg->mContentText = strdup(body);\r
+                msg->mContentText = OICStrdup(body);\r
 \r
                 NSSendNotification(msg);\r
 \r
@@ -134,13 +127,11 @@ int main()
 \r
             case 4:\r
                 OIC_LOG(INFO, TAG, "NSRead");\r
-                NSSync * sync = (NSSync*) malloc(sizeof(NSSync));\r
+                NSSync * sync = (NSSync*) OICMalloc(sizeof(NSSync));\r
 \r
-                sync->mMessageId = strdup("dev_001");\r
+                sync->mMessageId = OICStrdup("dev_001");\r
                 sync->mState = 1;\r
 \r
-                NSSendSync(sync);\r
-\r
                 break;\r
 /*\r
             case 5:\r
index 9f732f5..c87a05c 100755 (executable)
@@ -30,9 +30,9 @@
 #include "NSConstants.h"\r
 \r
 NSCacheList * NSCacheCreate();\r
-NSCacheElement * NSCacheRead(NSCacheList * list, char * findId);\r
+NSCacheElement * NSCacheRead(NSCacheList * list, const char * findId);\r
 NSResult NSCacheWrite(NSCacheList * list, NSCacheElement * newObj);\r
-NSResult NSCacheDelete(NSCacheList * list, char * delId);\r
+NSResult NSCacheDelete(NSCacheList * list, const char * delId);\r
 NSResult NSCacheDestroy(NSCacheList * list);\r
 \r
 #endif /* _NS_CACHEADAPTER__H_ */\r
index 5f245bc..94652b0 100644 (file)
@@ -65,7 +65,7 @@ void * NSDiscoverySchedule(void * ptr)
             NSTask *node = NSHeadMsg[DISCOVERY_SCHEDULER];\r
             NSHeadMsg[DISCOVERY_SCHEDULER] = node->nextTask;\r
 \r
-            switch ((int)node->taskType)\r
+            switch (node->taskType)\r
             {\r
                 case TASK_START_PRESENCE:\r
                     NSStartPresence();\r
@@ -76,6 +76,8 @@ void * NSDiscoverySchedule(void * ptr)
                 case TASK_REGISTER_RESOURCE:\r
                     NSRegisterResource();\r
                     break;\r
+                default:\r
+                    break;\r
             }\r
 \r
             OICFree(node);\r
index 16d98b3..558e1e5 100644 (file)
@@ -97,18 +97,14 @@ NSResult NSStopProvider()
 NSResult NSSendNotification(NSMessage *msg)\r
 {\r
     OIC_LOG(INFO, INTERFACE_TAG, "Send Notification");\r
-\r
     NSPushQueue(NOTIFICATION_SCHEDULER, TASK_SEND_NOTIFICATION, msg);\r
-\r
     return NS_OK;\r
 }\r
 \r
 NSResult NSProviderReadCheck(NSMessage *msg)\r
 {\r
     OIC_LOG(INFO, INTERFACE_TAG, "Read Sync");\r
-\r
     NSPushQueue(NOTIFICATION_SCHEDULER, TASK_SEND_READ, msg);\r
-\r
     return NS_OK;\r
 }\r
 \r
@@ -128,17 +124,6 @@ NSResult NSAccept(NSConsumer *consumer, bool accepted)
     return NS_OK;\r
 }\r
 \r
-/*\r
-NSResult NSGetConsumerList(uint8_t *list, uint32_t size)\r
-{\r
-    OIC_LOG(INFO, INTERFACE_TAG, "Get consumer list");\r
-\r
-    NSGetObsIdList(list);\r
-    size = NSGetNumberOfObsList();\r
-\r
-    return NS_OK;\r
-}*/\r
-\r
 void * NSResponseSchedule(void * ptr)\r
 {\r
     if (ptr == NULL)\r
index 7c59380..9026451 100644 (file)
@@ -126,14 +126,6 @@ OCEntityHandlerResult NSEntityHandlerNotificationCb(OCEntityHandlerFlag flag,
                 sendOptions[1].optionLength = 10;\r
                 response.numSendVendorSpecificHeaderOptions = 2;\r
             }\r
-\r
-\r
-            // Send the response\r
-            /*if (OCDoResponse(&response) != OC_STACK_OK)\r
-            {\r
-                OIC_LOG(ERROR, LISTENER_TAG, "Error sending response");\r
-                ehResult = OC_EH_ERROR;\r
-            }*/\r
         }\r
     }\r
 \r
@@ -385,7 +377,6 @@ OCEntityHandlerResult NSEntityHandlerSyncCb(OCEntityHandlerFlag flag,
         }\r
     }\r
 \r
-\r
     OCPayloadDestroy(response.payload);\r
     return ehResult;\r
 }\r
@@ -393,6 +384,11 @@ OCEntityHandlerResult NSEntityHandlerSyncCb(OCEntityHandlerFlag flag,
 void NSProviderConnectionStateListener(CATransportAdapter_t adapter, const char *remote_address,\r
         bool connected)\r
 {\r
+\r
+    // should be implementation\r
+    (void)adapter;\r
+    (void)remote_address;\r
+\r
     OIC_LOG (INFO, LISTENER_TAG, "Connection State Changed");\r
 \r
     if (connected)\r
@@ -409,6 +405,9 @@ void NSProviderConnectionStateListener(CATransportAdapter_t adapter, const char
 \r
 void NSProviderAdapterStateListener(CATransportAdapter_t adapter, bool enabled)\r
 {\r
+    // should be implementation\r
+    (void)adapter;\r
+\r
     OIC_LOG (INFO, LISTENER_TAG, "Adapter State Changed");\r
 \r
     if (enabled)\r
index 152dcca..6b85494 100644 (file)
@@ -30,6 +30,8 @@
 #include "NSProviderSystem.h"\r
 #include "NSProviderScheduler.h"\r
 #include "cautilinterface.h"\r
+#include "oic_string.h"\r
+#include "oic_malloc.h"\r
 \r
 OCEntityHandlerResult NSEntityHandlerNotificationCb(OCEntityHandlerFlag flag,\r
         OCEntityHandlerRequest *entityHandlerRequest, void* callback);\r
index 3c31b98..fa3b6b1 100644 (file)
@@ -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:
                 {
index e51b493..f03516a 100644 (file)
 #define _NS_PROVIDER_NOTIFICATION_H_\r
 \r
 #include <ocstack.h>\r
-#include "../common/NSCacheAdapter.h"\r
+#include "NSCacheAdapter.h"\r
 #include "logger.h"\r
 #include "NSProviderScheduler.h"\r
 #include "NSProviderListener.h"\r
 #include "NSProviderResource.h"\r
 #include "NSProviderSubscription.h"\r
+#include "oic_string.h"\r
+#include "oic_malloc.h"\r
 \r
 NSCacheList * messageList;\r
 \r
index 6f2e64c..7bd651a 100644 (file)
 
 #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;
index a0aae6d..4038c85 100644 (file)
@@ -109,11 +109,9 @@ void NSHandleSubscription(OCEntityHandlerRequest *entityHandlerRequest, NSResour
 \r
     if (resourceType == NS_RESOURCE_MESSAGE)\r
     {\r
-        int obId = entityHandlerRequest->obsInfo.obsId;\r
-\r
-        NSCacheElement * element = (NSCacheElement *) malloc(sizeof(NSCacheElement));\r
+        NSCacheElement * element = (NSCacheElement *) OICMalloc(sizeof(NSCacheElement));\r
+        NSCacheSubData * subData = (NSCacheSubData *) OICMalloc(sizeof(NSCacheSubData));\r
 \r
-        NSCacheSubData * subData = (NSCacheSubData *) malloc(sizeof(NSCacheSubData));\r
         subData->id = OICStrdup(entityHandlerRequest->devAddr.addr);\r
         subData->isWhite = false;\r
         subData->messageObId = entityHandlerRequest->obsInfo.obsId;\r
@@ -122,6 +120,8 @@ void NSHandleSubscription(OCEntityHandlerRequest *entityHandlerRequest, NSResour
         element->data = (void*) subData;\r
         element->next = NULL;\r
 \r
+        printf("NS_ IP = %s in message ob\n", entityHandlerRequest->devAddr.addr);\r
+        printf("NS_ IP2 = %s in message ob\n", subData->id);\r
         printf("NS_ message ob Id = %d\n", subData->messageObId);\r
 \r
         if (NSCacheWrite(consumerSubList, element) != NS_OK)\r
@@ -139,16 +139,14 @@ void NSHandleSubscription(OCEntityHandlerRequest *entityHandlerRequest, NSResour
         else if (NSGetSubscriptionAccepter() == NS_ACCEPTER_CONSUMER)\r
         {\r
             printf("state = 0 - 3\n");\r
-            NSSendSubscriptionResponse(entityHandlerRequest, NS_ACCEPTER_CONSUMER, true);\r
+            NSSendSubscriptionResponse(entityHandlerRequest, true);\r
         }\r
     }\r
     else if (resourceType == NS_RESOURCE_SYNC)\r
     {\r
-        int obId = entityHandlerRequest->obsInfo.obsId;\r
-\r
-        NSCacheElement * element = (NSCacheElement *) malloc(sizeof(NSCacheElement));\r
+        NSCacheElement * element = (NSCacheElement *) OICMalloc(sizeof(NSCacheElement));\r
 \r
-        NSCacheSubData * subData = (NSCacheSubData *) malloc(sizeof(NSCacheSubData));\r
+        NSCacheSubData * subData = (NSCacheSubData *) OICMalloc(sizeof(NSCacheSubData));\r
         printf("NS_ entityHandlerRequest->devAddr.addr = %s\n", entityHandlerRequest->devAddr.addr);\r
         subData->id = OICStrdup(entityHandlerRequest->devAddr.addr);\r
         subData->isWhite = false;\r
@@ -171,11 +169,6 @@ void NSHandleUnsubscription(OCEntityHandlerRequest *entityHandlerRequest)
 {\r
     OIC_LOG(INFO, SUBSCRIPTION_TAG, "Start to unsubscription process");\r
 \r
-    // ProcessObserveUnregister (entityHandlerRequest);\r
-\r
-    // write consumer info to cache\r
-    int obId = entityHandlerRequest->obsInfo.obsId;\r
-\r
     NSCacheElement * element = (NSCacheElement *) OICMalloc(sizeof(NSCacheElement));\r
     NSCacheSubData * subData = (NSCacheSubData *) OICMalloc(sizeof(NSCacheSubData));\r
     subData->id = OICStrdup(entityHandlerRequest->devAddr.addr);\r
@@ -221,9 +214,15 @@ NSResult NSSendResponse(const char * id, bool accepted)
     OCRepPayloadSetPropBool(payload, NS_ATTRIBUTE_ACCPETANCE, accepted);\r
 \r
     NSCacheElement * element = NSCacheRead(consumerSubList, id);\r
-    NSCacheSubData * subData = element->data;\r
 \r
-    if (OCNotifyListOfObservers(rHandle, &subData->messageObId, 1, payload, OC_HIGH_QOS)\r
+    if(element == NULL)\r
+    {\r
+        printf("NS_ NSSendResponse - element is NULL\n");\r
+        return NS_ERROR;\r
+    }\r
+    NSCacheSubData * subData = (NSCacheSubData*) element->data;\r
+\r
+    if (OCNotifyListOfObservers(rHandle, (OCObservationId*)&subData->messageObId, 1, payload, OC_HIGH_QOS)\r
             != OC_STACK_OK)\r
     {\r
         OIC_LOG(ERROR, SUBSCRIPTION_TAG, "fail to send Acceptance");\r
@@ -236,8 +235,7 @@ NSResult NSSendResponse(const char * id, bool accepted)
     return NS_OK;\r
 }\r
 \r
-NSResult NSSendSubscriptionResponse(OCEntityHandlerRequest *entityHandlerRequest,\r
-        NSAccessPolicy accepter, bool accepted)\r
+NSResult NSSendSubscriptionResponse(OCEntityHandlerRequest *entityHandlerRequest, bool accepted)\r
 {\r
     OIC_LOG(INFO, SUBSCRIPTION_TAG, "Send ACCEPT message to consumer");\r
 \r
@@ -252,8 +250,6 @@ NSResult NSSendSubscriptionResponse(OCEntityHandlerRequest *entityHandlerRequest
     printf("accepted 1 \n");\r
     if (accepted)\r
     {\r
-        int obId = entityHandlerRequest->obsInfo.obsId;\r
-\r
         NSCacheElement * element = (NSCacheElement *) OICMalloc(sizeof(NSCacheElement));\r
 \r
         NSCacheSubData * subData = (NSCacheSubData *) OICMalloc(sizeof(NSCacheSubData));\r
@@ -270,7 +266,7 @@ NSResult NSSendSubscriptionResponse(OCEntityHandlerRequest *entityHandlerRequest
         }\r
     }\r
 \r
-    NSSendResponse(&entityHandlerRequest->obsInfo.obsId, accepted);\r
+    NSSendResponse(entityHandlerRequest->devAddr.addr, accepted);\r
 \r
     return NS_OK;\r
 \r
@@ -298,7 +294,6 @@ void * NSSubScriptionSchedule(void *ptr)
             {\r
 \r
                 case TASK_SEND_POLICY:\r
-\r
                     NSSendAccessPolicyResponse((OCEntityHandlerRequest*) node->taskData);\r
                     break;\r
 \r
@@ -319,7 +314,7 @@ void * NSSubScriptionSchedule(void *ptr)
                     NSConsumer * consumer = (NSConsumer *) node->taskData;\r
                     int * pObId = (int *) consumer->mUserData;\r
 \r
-                    NSCacheSubData * subData = (NSCacheMsgData *) OICMalloc(sizeof(NSCacheSubData));\r
+                    NSCacheSubData * subData = (NSCacheSubData *) OICMalloc(sizeof(NSCacheSubData));\r
                     subData->id = OICStrdup(consumer->mId);\r
                     subData->isWhite = true;\r
                     subData->messageObId = 0;\r
@@ -338,7 +333,7 @@ void * NSSubScriptionSchedule(void *ptr)
                     NSConsumer * consumer = (NSConsumer *) node->taskData;\r
                     int * pObId = (int *) consumer->mUserData;\r
 \r
-                    NSCacheSubData * subData = (NSCacheMsgData *) OICMalloc(sizeof(NSCacheSubData));\r
+                    NSCacheSubData * subData = (NSCacheSubData *) OICMalloc(sizeof(NSCacheSubData));\r
                     subData->id = OICStrdup(consumer->mId);\r
                     subData->isWhite = false;\r
                     subData->messageObId = 0;\r
@@ -353,6 +348,8 @@ void * NSSubScriptionSchedule(void *ptr)
                     NSHandleSubscription((OCEntityHandlerRequest*) node->taskData,\r
                             NS_RESOURCE_SYNC);\r
                     break;\r
+                default:\r
+                    break;\r
 \r
             }\r
             OICFree(node);\r
index 60813fb..7a40256 100644 (file)
@@ -29,6 +29,8 @@
 #include "NSProviderScheduler.h"\r
 #include "NSProviderResource.h"\r
 #include "NSCacheAdapter.h"\r
+#include "NSProviderMemoryCache.h"\r
+#include "oic_string.h"\r
 \r
 NSAccessPolicy NSSubscriptionAccepter;\r
 NSCacheList * consumerSubList;\r
@@ -40,7 +42,6 @@ NSResult NSSendAccessPolicyResponse(OCEntityHandlerRequest *entityHandlerRequest
 void NSHandleSubscription(OCEntityHandlerRequest *entityHandlerRequest, NSResourceType resourceType);\r
 void NSHandleUnsubscription(OCEntityHandlerRequest *entityHandlerRequest);\r
 void NSAskAcceptanceToUser(OCEntityHandlerRequest *entityHandlerRequest);\r
-NSResult NSSendSubscriptionResponse(OCEntityHandlerRequest *entityHandlerRequest,\r
-        NSAccessPolicy accepter, bool accepted);\r
+NSResult NSSendSubscriptionResponse(OCEntityHandlerRequest *entityHandlerRequest, bool accepted);\r
 \r
 #endif /* _NS_PROVIDER_SUBSCRIPTION_H_ */\r
index 7e02a70..797caaf 100644 (file)
@@ -30,5 +30,7 @@ void NSSetProviderConnectionState(NSConnectionState state)
 \r
 NSConnectionState NSGetProviderConnectionState()\r
 {\r
+    OIC_LOG(INFO, SUBSCRIPTION_TAG, "Change Connection State");\r
+\r
     return NSProviderConnectionState;\r
 }\r
index 7e41915..260638f 100755 (executable)
@@ -36,7 +36,7 @@ NSCacheList * NSCacheCreate()
     return newList;\r
 }\r
 \r
-NSCacheElement * NSCacheRead(NSCacheList * list, char * findId)\r
+NSCacheElement * NSCacheRead(NSCacheList * list, const char * findId)\r
 {\r
     pthread_mutex_lock(&NSCacheMutex);\r
     NSCacheElement * iter = list->head;\r
@@ -50,7 +50,6 @@ NSCacheElement * NSCacheRead(NSCacheList * list, char * findId)
         next = iter->next;\r
 \r
         printf("NS_ findId2 = %s\n", findId);\r
-        pthread_mutex_unlock(&NSCacheMutex);\r
 \r
         if (NSProviderCompareIdCacheData(type, iter->data, findId))\r
         {\r
@@ -70,9 +69,7 @@ NSResult NSCacheUpdateSubScriptionState(NSCacheList * list, NSCacheSubData * sub
 {\r
     pthread_mutex_lock(&NSCacheMutex);\r
 \r
-    NSCacheType type = list->cacheType;\r
-\r
-    printf("NS_ NSCacheWrite\n");\r
+    printf("NS_ NSCacheUpdateSubScriptionState\n");\r
 \r
     if (subData == NULL)\r
     {\r
@@ -211,9 +208,8 @@ NSResult NSCacheWrite(NSCacheList * list, NSCacheElement * newObj)
     return NS_OK;\r
 }\r
 \r
-NSResult NSCacheDelete(NSCacheList * list, char * delId)\r
+NSResult NSCacheDelete(NSCacheList * list, const char * delId)\r
 {\r
-\r
     pthread_mutex_lock(&NSCacheMutex);\r
     NSCacheElement * prev = list->head;\r
     NSCacheElement * del = list->head;\r
@@ -280,7 +276,7 @@ NSResult NSCacheDestroy(NSCacheList * list)
     return NS_OK;\r
 }\r
 \r
-bool NSProviderCompareIdCacheData(NSCacheType type, void * data, char * id)\r
+bool NSProviderCompareIdCacheData(NSCacheType type, void * data, const char * id)\r
 {\r
     if (data == NULL)\r
     {\r
index 4e96aff..e4a7b50 100755 (executable)
 #include "NSStructs.h"\r
 #include "NSConstants.h"\r
 #include "NSCacheAdapter.h"\r
+#include "oic_malloc.h"\r
+#include "oic_string.h"\r
+#include "NSUtil.h"\r
 \r
 NSResult NSProviderDeleteCacheData(NSCacheType, void *);\r
 \r
-bool NSProviderCompareIdCacheData(NSCacheType, void *, char *);\r
+bool NSProviderCompareIdCacheData(NSCacheType, void *, const char *);\r
 \r
 bool NSProviderIsFoundCacheData(NSCacheType, void *, void*);\r
 \r