Cleaning up more warnings.
authorJon A. Cruz <jonc@osg.samsung.com>
Tue, 4 Aug 2015 18:50:07 +0000 (11:50 -0700)
committerErich Keane <erich.keane@intel.com>
Wed, 5 Aug 2015 21:43:13 +0000 (21:43 +0000)
These fixes clear a bit over 200 more of the basic warnings
seen. A few signed/unsigned issues that might require thought
were left for later.

Change-Id: Ie04411927cef8a73f17f16e329f6546229c2c3d1
Signed-off-by: Jon A. Cruz <jonc@osg.samsung.com>
Reviewed-on: https://gerrit.iotivity.org/gerrit/2109
Tested-by: jenkins-iotivity <jenkins-iotivity@opendaylight.org>
Reviewed-by: Sachin Agrawal <sachin.agrawal@intel.com>
Reviewed-by: Ossama Othman <ossama.othman@intel.com>
Reviewed-by: Erich Keane <erich.keane@intel.com>
33 files changed:
resource/csdk/connectivity/src/bt_le_adapter/linux/caleinterface.c
resource/csdk/connectivity/src/bt_le_adapter/linux/client.c
resource/csdk/connectivity/src/bt_le_adapter/linux/descriptor.c
resource/csdk/connectivity/src/bt_le_adapter/linux/peripheral.c
resource/csdk/connectivity/test/ca_api_unittest.cpp
resource/csdk/connectivity/test/camutex_tests.cpp
resource/csdk/logger/src/logger.c
resource/csdk/security/src/aclresource.c
resource/csdk/security/src/credresource.c
resource/csdk/security/src/doxmresource.c
resource/csdk/security/src/pstatresource.c
resource/csdk/security/src/resourcemanager.c
resource/csdk/security/src/secureresourcemanager.c
resource/csdk/security/unittest/credentialresource.cpp
resource/csdk/security/unittest/doxmresource.cpp
resource/csdk/security/unittest/securityresourcemanager.cpp
resource/csdk/security/unittest/srmutility.cpp
resource/csdk/stack/samples/linux/SimpleClientServer/occlient.cpp
resource/csdk/stack/samples/linux/SimpleClientServer/occlientbasicops.cpp
resource/csdk/stack/samples/linux/SimpleClientServer/occlientcoll.cpp
resource/csdk/stack/samples/linux/SimpleClientServer/ocserver.cpp
resource/csdk/stack/samples/linux/SimpleClientServer/ocserverbasicops.cpp
resource/csdk/stack/src/occollection.c
resource/csdk/stack/src/ocobserve.c
resource/csdk/stack/src/ocpayloadconvert.c
resource/csdk/stack/src/ocpayloadparse.c
resource/csdk/stack/src/ocresource.c
resource/csdk/stack/src/ocserverrequest.c
resource/csdk/stack/src/ocstack.c
resource/csdk/stack/src/oicgroup.c
resource/oc_logger/c/oc_console_logger.c
resource/oc_logger/cpp/oc_ostream_logger.cpp
resource/src/InProcClientWrapper.cpp

index 5c54171..73703e0 100644 (file)
@@ -75,6 +75,11 @@ static void CALEDumpDBusSignalParameters(char const * sender_name,
                                          char const * signal_name,
                                          GVariant   * parameters)
 {
+    (void)sender_name;
+    (void)object_path;
+    (void)interface_name;
+    (void)signal_name;
+    (void)parameters;
 #ifdef TB_LOG
     gchar * const param_dump =
         g_variant_print(parameters, TRUE);
@@ -106,6 +111,9 @@ static void CALEOnInterfaceProxyPropertiesChanged(
     gchar const * const      * invalidated_properties,
     gpointer                   user_data)
 {
+    (void)manager;
+    (void)object_proxy;
+    (void)invalidated_properties;
     OIC_LOG_V(DEBUG,
               TAG,
               "Properties Changed on %s:\n",
@@ -242,6 +250,8 @@ static void CALEOnInterfacesAdded(GDBusConnection * connection,
                                   GVariant   * parameters,
                                   gpointer     user_data)
 {
+    (void)connection;
+    (void)user_data;
     CALEDumpDBusSignalParameters(sender_name,
                                  object_path,
                                  interface_name,
@@ -270,6 +280,8 @@ static void CALEOnInterfacesRemoved(GDBusConnection * connection,
                                     GVariant   * parameters,
                                     gpointer     user_data)
 {
+    (void)connection;
+    (void)user_data;
     CALEDumpDBusSignalParameters(sender_name,
                                  object_path,
                                  interface_name,
@@ -360,6 +372,8 @@ static void CALEOnPropertiesChanged(GDBusConnection * connection,
                                     GVariant   * parameters,
                                     gpointer     user_data)
 {
+    (void)connection;
+    (void)user_data;
     CALEDumpDBusSignalParameters(sender_name,
                                  object_path,
                                  interface_name,
@@ -375,6 +389,8 @@ static void CALEOnPropertyChanged(GDBusConnection * connection,
                                   GVariant   * parameters,
                                   gpointer     user_data)
 {
+    (void)connection;
+    (void)user_data;
     CALEDumpDBusSignalParameters(sender_name,
                                  object_path,
                                  interface_name,
@@ -1125,6 +1141,9 @@ CAResult_t CAUpdateCharacteristicsToGattClient(char const * address,
                                                char const * charValue,
                                                uint32_t charValueLen)
 {
+    (void)address;
+    (void)charValue;
+    (void)charValueLen;
     /**
      * @todo To be implemented shortly as part of the effort to
      *       address a critical code review that stated this BLE
@@ -1137,6 +1156,8 @@ CAResult_t CAUpdateCharacteristicsToGattClient(char const * address,
 CAResult_t CAUpdateCharacteristicsToAllGattClients(char const * charValue,
                                                    uint32_t charValueLen)
 {
+    (void)charValue;
+    (void)charValueLen;
     /**
      * @todo To be implemented shortly as part of the effort to
      *       address a critical code review that stated this BLE
@@ -1178,6 +1199,11 @@ CAResult_t CAUpdateCharacteristicsToGattServer(
     CALETransferType_t type,
     int32_t position)
 {
+    (void)remoteAddress;
+    (void)data;
+    (void)dataLen;
+    (void)type;
+    (void)position;
     /**
      * @todo To be implemented shortly as part of the effort to
      *       address a critical code review that stated this BLE
index 6d5adba..4ca2224 100644 (file)
@@ -123,6 +123,7 @@ bool CAGattClientsInitialize(CALEContext * context)
 
 bool CAGattClientsDestroy(CALEContext * context)
 {
+    (void)context;
     /* g_hash_table_destroy(...); */   // FIXME
     return false;
 }
@@ -252,6 +253,11 @@ void CAGattReceiveResponse(GDBusConnection * connection,
                            GVariant   * parameters,
                            gpointer     user_data)
 {
+    (void)connection;
+    (void)sender_name;
+    (void)object_path;
+    (void)interface_name;
+    (void)signal_name;
     /*
       This handler is only trigged in a GATT client when receiving
       data sent by a GATT server through a notification, e.g. such as
index 190d192..7066c33 100644 (file)
@@ -54,6 +54,7 @@ static gboolean CAGattDescriptorReadValue(
     GDBusMethodInvocation * invocation,
     gpointer user_data)
 {
+    (void)user_data;
     /**
      * @todo The @c GattDescriptor1 object still owns the returned
      *       variant when using the below call.  Should be we use
@@ -97,6 +98,7 @@ static bool CAGattDescriptorInitialize(CAGattCharacteristic * c,
                                        char const * descriptor_path,
                                        char const * value)
 {
+    (void)s;
     CAGattDescriptor * const d = &c->descriptor;
 
     // Path of the form /org/iotivity/gatt/hci0/service0/char0/desc0.
index 0054767..da07b5e 100644 (file)
@@ -1,4 +1,4 @@
-/******************************************************************
+/* ****************************************************************
  *
  * Copyright 2015 Intel Corporation All Rights Reserved.
  *
@@ -403,6 +403,9 @@ static void CAPeripheralOnNameAcquired(GDBusConnection * connection,
                                        gchar const * name,
                                        gpointer user_data)
 {
+    (void)connection;
+    (void)name; // needed when logging is a noop
+    (void)user_data;
     OIC_LOG_V(DEBUG,
               TAG,
               "Name \"%s\" acquired on D-Bus.", name);
@@ -421,6 +424,9 @@ static void CAPeripheralOnNameLost(GDBusConnection * connection,
                                    gchar const * name,
                                    gpointer user_data)
 {
+    (void)connection;
+    (void)name; // needed when logging is a noop
+    (void)user_data;
     /*
       This can happen if the appropriate D-Bus policy is not
       installed, for example.
index 5d763df..543c68f 100644 (file)
@@ -41,12 +41,14 @@ void error_handler(const CAEndpoint_t *object, const CAErrorInfo_t* errorInfo);
 CAResult_t checkGetNetworkInfo();
 CAResult_t checkSelectNetwork();
 
-void request_handler(const CAEndpoint_t *object, const CARequestInfo_t *requestInfo)
+void request_handler(const CAEndpoint_t * /*object*/,
+                     const CARequestInfo_t * /*requestInfo*/)
 {
 
 }
 
-void response_handler(const CAEndpoint_t *object, const CAResponseInfo_t *responseInfo)
+void response_handler(const CAEndpoint_t * /*object*/,
+                      const CAResponseInfo_t * /*responseInfo*/)
 {
 
 }
index 98def7e..24fcf06 100644 (file)
@@ -144,7 +144,7 @@ TEST(MutexTests, TC_03_THREAD_LOCKING)
 
     EXPECT_EQ(CA_STATUS_OK, ca_thread_pool_init(3, &mythreadpool));
 
-    _func1_struct pData = {};
+    _func1_struct pData = {0, false, false};
 
     pData.mutex = ca_mutex_new();
 
index f627ef6..f131517 100644 (file)
@@ -152,7 +152,7 @@ static void osalGetTime(int *min,int *sec, int *ms)
     if (min && sec && ms)
     {
 #if defined(_POSIX_TIMERS) && _POSIX_TIMERS > 0
-        struct timespec when = {};
+        struct timespec when = {0};
         clockid_t clk = CLOCK_REALTIME;
 #ifdef CLOCK_REALTIME_COARSE
         clk = CLOCK_REALTIME_COARSE;
index a1afef8..bc18c20 100644 (file)
@@ -44,15 +44,14 @@ void DeleteACLList(OicSecAcl_t* acl)
 {
     if (acl)
     {
-        OicSecAcl_t *aclTmp1 = NULL, *aclTmp2 = NULL;
+        OicSecAcl_t *aclTmp1 = NULL;
+        OicSecAcl_t *aclTmp2 = NULL;
         LL_FOREACH_SAFE(acl, aclTmp1, aclTmp2)
         {
-            int i = 0;
-
             LL_DELETE(acl, aclTmp1);
 
             // Clean Resources
-            for (i = 0; i < aclTmp1->resourcesLen; i++)
+            for (size_t i = 0; i < aclTmp1->resourcesLen; i++)
             {
                 OICFree(aclTmp1->resources[i]);
             }
@@ -115,7 +114,7 @@ char * BinToAclJSON(const OicSecAcl_t * acl)
             cJSON *jsonRsrcArray = NULL;
             cJSON_AddItemToObject (jsonAcl, OIC_JSON_RESOURCES_NAME, jsonRsrcArray = cJSON_CreateArray());
             VERIFY_NON_NULL(TAG, jsonRsrcArray, ERROR);
-            for (int i = 0; i < acl->resourcesLen; i++)
+            for (size_t i = 0; i < acl->resourcesLen; i++)
             {
                 cJSON_AddItemToArray (jsonRsrcArray, cJSON_CreateString(acl->resources[i]));
             }
@@ -127,7 +126,7 @@ char * BinToAclJSON(const OicSecAcl_t * acl)
             cJSON *jsonOwnrArray = NULL;
             cJSON_AddItemToObject (jsonAcl, OIC_JSON_OWNERS_NAME, jsonOwnrArray = cJSON_CreateArray());
             VERIFY_NON_NULL(TAG, jsonOwnrArray, ERROR);
-            for (int i = 0; i < acl->ownersLen; i++)
+            for (size_t i = 0; i < acl->ownersLen; i++)
             {
                 outLen = 0;
 
@@ -220,7 +219,7 @@ OicSecAcl_t * JSONToAclBin(const char * jsonStr)
             acl->resources = (char**)OICCalloc(acl->resourcesLen, sizeof(char*));
             VERIFY_NON_NULL(TAG, (acl->resources), ERROR);
 
-            int idxx = 0;
+            size_t idxx = 0;
             do
             {
                 cJSON *jsonRsrc = cJSON_GetArrayItem(jsonObj, idxx);
@@ -343,6 +342,7 @@ OCEntityHandlerResult ACLEntityHandler (OCEntityHandlerFlag flag,
                                         OCEntityHandlerRequest * ehRequest,
                                         void* callbackParameter)
 {
+    (void)callbackParameter;
     OCEntityHandlerResult ehRet = OC_EH_ERROR;
 
     if (!ehRequest)
@@ -406,7 +406,7 @@ OCStackResult  GetDefaultACL(OicSecAcl_t** defaultAcl)
 {
     OCStackResult ret = OC_STACK_ERROR;
 
-    OicUuid_t ownerId = {};
+    OicUuid_t ownerId = {.id = {0}};
 
     /*
      * TODO In future, when new virtual resources will be added in OIC
@@ -445,7 +445,7 @@ OCStackResult  GetDefaultACL(OicSecAcl_t** defaultAcl)
     acl->resources = (char**)OICCalloc(acl->resourcesLen, sizeof(char*));
     VERIFY_NON_NULL(TAG, (acl->resources), ERROR);
 
-    for (int i = 0; i <  acl->resourcesLen; i++)
+    for (size_t i = 0; i <  acl->resourcesLen; i++)
     {
         size_t len = strlen(rsrcs[i]) + 1;
         acl->resources[i] = (char*)OICMalloc(len * sizeof(char));
index af21b26..30f1b08 100644 (file)
@@ -343,6 +343,7 @@ OicSecCred_t * GenerateCredential(const OicUuid_t * subject, OicSecCredType_t cr
                                  const char * publicData, const char * privateData,
                                  size_t ownersLen, const OicUuid_t * owners)
 {
+    (void)publicData;
     OCStackResult ret = OC_STACK_ERROR;
 
     OicSecCred_t *cred = (OicSecCred_t*)OICCalloc(1, sizeof(OicSecCred_t));
@@ -528,6 +529,7 @@ OCEntityHandlerResult CredEntityHandler (OCEntityHandlerFlag flag,
                                         OCEntityHandlerRequest * ehRequest,
                                         void* callbackParameter)
 {
+    (void)callbackParameter;
     OCEntityHandlerResult ret = OC_EH_ERROR;
 
     if(!ehRequest)
index 5389595..8251214 100644 (file)
@@ -55,8 +55,8 @@ static OicSecDoxm_t gDefaultDoxm =
     1,                      /* size_t oxmLen */
     OIC_JUST_WORKS,         /* uint16_t oxmSel */
     false,                  /* bool owned */
-    {},                     /* OicUuid_t deviceID */
-    {},                     /* OicUuid_t owner */
+    {.id = {0}},            /* OicUuid_t deviceID */
+    {.id = {0}},            /* OicUuid_t owner */
 };
 
 void DeleteDoxmBinData(OicSecDoxm_t* doxm)
@@ -64,7 +64,7 @@ void DeleteDoxmBinData(OicSecDoxm_t* doxm)
     if (doxm)
     {
         //Clean oxmType
-        for(int i = 0; i < doxm->oxmTypeLen; i++)
+        for (size_t i = 0; i < doxm->oxmTypeLen; i++)
         {
             OICFree(doxm->oxmType[i]);
         }
@@ -195,7 +195,7 @@ OicSecDoxm_t * JSONToDoxmBin(const char * jsonStr)
         doxm->oxmType = (OicUrn_t *)OICCalloc(doxm->oxmTypeLen, sizeof(char *));
         VERIFY_NON_NULL(TAG, (doxm->oxmType), ERROR);
 
-        for(int i  = 0; i < doxm->oxmTypeLen ; i++)
+        for (size_t i  = 0; i < doxm->oxmTypeLen ; i++)
         {
             cJSON *jsonOxmTy = cJSON_GetArrayItem(jsonObj, i);
             VERIFY_NON_NULL(TAG, jsonOxmTy, ERROR);
@@ -217,7 +217,7 @@ OicSecDoxm_t * JSONToDoxmBin(const char * jsonStr)
         doxm->oxm = (OicSecOxm_t*)OICCalloc(doxm->oxmLen, sizeof(OicSecOxm_t));
         VERIFY_NON_NULL(TAG, doxm->oxm, ERROR);
 
-        for(int i  = 0; i < doxm->oxmLen ; i++)
+        for (size_t i  = 0; i < doxm->oxmLen ; i++)
         {
             cJSON *jsonOxm = cJSON_GetArrayItem(jsonObj, i);
             VERIFY_NON_NULL(TAG, jsonOxm, ERROR);
@@ -348,7 +348,7 @@ static bool ValidateQuery(unsigned char * query)
         return false;
     }
 
-    OicParseQueryIter_t parseIter = {};
+    OicParseQueryIter_t parseIter = {0};
 
     ParseQueryIterInit(query, &parseIter);
 
@@ -413,7 +413,7 @@ static OCEntityHandlerResult HandleDoxmPutRequest (const OCEntityHandlerRequest
 {
     OC_LOG (INFO, TAG, PCF("Doxm EntityHandle  processing PUT request"));
     OCEntityHandlerResult ehRet = OC_EH_ERROR;
-    OicUuid_t emptyOwner = {};
+    OicUuid_t emptyOwner = {.id = {0}};
 
     /*
      * Convert JSON Doxm data into binary. This will also validate
@@ -536,6 +536,7 @@ OCEntityHandlerResult DoxmEntityHandler (OCEntityHandlerFlag flag,
                                         OCEntityHandlerRequest * ehRequest,
                                         void* callbackParam)
 {
+    (void)callbackParam;
     OCEntityHandlerResult ehRet = OC_EH_ERROR;
 
     if(NULL == ehRequest)
index aa798e0..63df79c 100644 (file)
@@ -42,7 +42,7 @@ static OicSecPstat_t gDefaultPstat =
     PROVISION_CREDENTIALS | PROVISION_ACLS),   // OicSecDpm_t cm
     (OicSecDpm_t)(TAKE_OWNER | BOOTSTRAP_SERVICE | SECURITY_MANAGEMENT_SERVICES |
     PROVISION_CREDENTIALS | PROVISION_ACLS),   // OicSecDpm_t tm
-    {},                                       // OicUuid_t deviceID
+    {.id = {0}},                              // OicUuid_t deviceID
     SINGLE_SERVICE_CLIENT_DRIVEN,             // OicSecDpom_t om */
     1,                                        // the number of elts in Sms
     &gSm,                                     // OicSecDpom_t *sm
@@ -95,7 +95,7 @@ char * BinToPstatJSON(const OicSecPstat_t * pstat)
 
     cJSON_AddItemToObject(jsonPstat, OIC_JSON_SM_NAME, jsonSmArray = cJSON_CreateArray());
     VERIFY_NON_NULL(TAG, jsonSmArray, INFO);
-    for (int i = 0; i < pstat->smLen; i++)
+    for (size_t i = 0; i < pstat->smLen; i++)
     {
         cJSON_AddItemToArray(jsonSmArray, cJSON_CreateNumber((int )pstat->sm[i]));
     }
@@ -166,7 +166,7 @@ OicSecPstat_t * JSONToPstatBin(const char * jsonStr)
     if (cJSON_Array == jsonObj->type)
     {
         pstat->smLen = cJSON_GetArraySize(jsonObj);
-        int idxx = 0;
+        size_t idxx = 0;
         VERIFY_SUCCESS(TAG, pstat->smLen != 0, ERROR);
         pstat->sm = (OicSecDpom_t*)OICCalloc(pstat->smLen, sizeof(OicSecDpom_t));
         VERIFY_NON_NULL(TAG, pstat->sm, ERROR);
@@ -290,6 +290,7 @@ OCEntityHandlerResult PstatEntityHandler(OCEntityHandlerFlag flag,
         OCEntityHandlerRequest * ehRequest,
         void *callbackParam)
 {
+    (void)callbackParam;
     OCEntityHandlerResult ehRet = OC_EH_ERROR;
     // This method will handle REST request (GET/POST) for /oic/sec/pstat
     if (flag & OC_REQUEST_FLAG)
index 615dae4..7e61926 100644 (file)
@@ -45,10 +45,10 @@ OCStackResult SendSRMResponse(const OCEntityHandlerRequest *ehRequest,
         OCEntityHandlerResult ehRet, const char *rspPayload)
 {
     OC_LOG (INFO, TAG, PCF("SRM sending SRM response"));
-    OCEntityHandlerResponse response = {};
+    OCEntityHandlerResponse response = {0};
     if (ehRequest)
     {
-        OCSecurityPayload ocPayload = {};
+        OCSecurityPayload ocPayload = {.base = {.type = PAYLOAD_TYPE_INVALID}};
 
         response.requestHandle = ehRequest->requestHandle;
         response.resourceHandle = ehRequest->resource;
index fea76f8..ddccc55 100644 (file)
@@ -72,7 +72,7 @@ void SRMRequestHandler(const CAEndpoint_t *endPoint, const CARequestInfo_t *requ
     }
 
     // Copy the subjectID
-    OicUuid_t subjectId = {};
+    OicUuid_t subjectId = {.id = {0}};
     memcpy(subjectId.id, endPoint->identity.id, sizeof(subjectId.id));
 
     //Check the URI has the query and skip it before checking the permission
@@ -110,7 +110,7 @@ void SRMRequestHandler(const CAEndpoint_t *endPoint, const CARequestInfo_t *requ
     }
 
     // Form a 'access deny' or 'Error' response and send to peer
-    CAResponseInfo_t responseInfo = {};
+    CAResponseInfo_t responseInfo = {.result = CA_EMPTY};
     memcpy(&responseInfo.info, &(requestInfo->info), sizeof(responseInfo.info));
     responseInfo.info.payload = NULL;
     if (!gRequestHandler)
index 02ce7d4..962b9cc 100644 (file)
@@ -225,7 +225,7 @@ TEST(CredGenerateCredentialTest, GenerateCredentialValidInput)
     OicUuid_t owners[1];
     OICStrcpy((char *)owners[0].id, sizeof(owners[0].id), "ownersId21");
 
-    OicUuid_t subject = {};
+    OicUuid_t subject = {0};
     OICStrcpy((char *)subject.id, sizeof(subject.id), "subject11");
 
     char privateKey[] = "My private Key11";
@@ -244,7 +244,7 @@ TEST(GenerateAndAddCredentialTest, GenerateAndAddCredentialValidInput)
     OicUuid_t owners[1];
     OICStrcpy((char *)owners[0].id, sizeof(owners[0].id), "ownersId11");
 
-    OicUuid_t subject = {};
+    OicUuid_t subject = {0};
     OICStrcpy((char *)subject.id, sizeof(subject.id), "subject11");
 
     char privateKey[] = "My private Key11";
index 1395e87..5d68e03 100644 (file)
@@ -127,7 +127,7 @@ TEST(DoxmEntityHandlerTest, DoxmEntityHandlerValidRequest)
 {
     EXPECT_EQ(OC_STACK_INVALID_PARAM, InitDoxmResource());
     char query[] = "oxm=0&owned=false&owner=owner1";
-    OCEntityHandlerRequest req = {};
+    OCEntityHandlerRequest req = {0};
     req.method = OC_REST_GET;
     req.query = OICStrdup(query);
     EXPECT_EQ(OC_EH_ERROR, DoxmEntityHandler(OCEntityHandlerFlag::OC_REQUEST_FLAG, &req));
index 1a3f0d2..95cf63c 100644 (file)
 using namespace std;
 
 // Helper Methods
-void UTRequestHandler(const CAEndpoint_t *endPoint, const CARequestInfo_t *requestInfo)
+void UTRequestHandler(const CAEndpoint_t * /*endPoint*/,
+                      const CARequestInfo_t * /*requestInfo*/)
 {
     EXPECT_TRUE(true) << "UTRequestHandler\n";
 }
 
-void UTResponseHandler(const CAEndpoint_t *endPoint, const CAResponseInfo_t *responseInfo)
+void UTResponseHandler(const CAEndpoint_t * /*endPoint*/,
+                       const CAResponseInfo_t * /*responseInfo*/)
 {
      EXPECT_TRUE(true) << "UTResponseHandler\n";
 }
 
-void UTErrorHandler(const CAEndpoint_t *endPoint, const CAErrorInfo_t *errorInfo)
+void UTErrorHandler(const CAEndpoint_t * /*endPoint*/,
+                    const CAErrorInfo_t * /*errorInfo*/)
 {
      EXPECT_TRUE(true) << "UTErrorHandler\n";
 }
index 7dd2217..225e3e3 100644 (file)
@@ -26,7 +26,7 @@
 TEST(ParseRestQueryTest, ParseRestQueryEmpty)
 {
     unsigned char query[] = "";
-    OicParseQueryIter_t parseIter = {};
+    OicParseQueryIter_t parseIter = {0};
     ParseQueryIterInit(query, &parseIter);
     EXPECT_EQ(NULL,  GetNextQuery(&parseIter));
 }
@@ -36,7 +36,7 @@ TEST(ParseRestQueryTest, ParseSingleRestQuery)
     char attr[10], val[10];
     unsigned char query[] = "owned=false";
 
-    OicParseQueryIter_t parseIter = {};
+    OicParseQueryIter_t parseIter = {0};
     ParseQueryIterInit(query, &parseIter);
     EXPECT_NE((OicParseQueryIter_t *)NULL,  GetNextQuery(&parseIter));
 
@@ -51,7 +51,7 @@ TEST(ParseRestQueryTest, ParseRestMultipleQuery)
     char attr[10], val[10];
     unsigned char query[] = "oxm=0&owned=true&owner=owner1";
 
-    OicParseQueryIter_t parseIter = {};
+    OicParseQueryIter_t parseIter = {0};
     ParseQueryIterInit(query, &parseIter);
     printf("\n");
     while(GetNextQuery(&parseIter))
@@ -65,4 +65,3 @@ TEST(ParseRestQueryTest, ParseRestMultipleQuery)
     }
     printf("\n");
 }
-
index 8aa54a2..d828286 100644 (file)
@@ -169,7 +169,8 @@ OCStackResult InvokeOCDoResource(std::ostringstream &query,
     return ret;
 }
 
-OCStackApplicationResult putReqCB(void* ctx, OCDoHandle handle, OCClientResponse * clientResponse)
+OCStackApplicationResult putReqCB(void* ctx, OCDoHandle /*handle*/,
+                                  OCClientResponse * clientResponse)
 {
     if(ctx == (void*)DEFAULT_CONTEXT_VALUE)
     {
@@ -189,7 +190,8 @@ OCStackApplicationResult putReqCB(void* ctx, OCDoHandle handle, OCClientResponse
     return OC_STACK_DELETE_TRANSACTION;
 }
 
-OCStackApplicationResult postReqCB(void *ctx, OCDoHandle handle, OCClientResponse *clientResponse)
+OCStackApplicationResult postReqCB(void *ctx, OCDoHandle /*handle*/,
+                                   OCClientResponse *clientResponse)
 {
     if(ctx == (void*)DEFAULT_CONTEXT_VALUE)
     {
@@ -210,7 +212,8 @@ OCStackApplicationResult postReqCB(void *ctx, OCDoHandle handle, OCClientRespons
 }
 
 OCStackApplicationResult deleteReqCB(void *ctx,
-        OCDoHandle handle, OCClientResponse *clientResponse)
+                                     OCDoHandle /*handle*/,
+                                     OCClientResponse *clientResponse)
 {
     if(ctx == (void*)DEFAULT_CONTEXT_VALUE)
     {
@@ -230,7 +233,8 @@ OCStackApplicationResult deleteReqCB(void *ctx,
     return OC_STACK_DELETE_TRANSACTION;
 }
 
-OCStackApplicationResult getReqCB(void* ctx, OCDoHandle handle, OCClientResponse * clientResponse)
+OCStackApplicationResult getReqCB(void* ctx, OCDoHandle /*handle*/,
+                                  OCClientResponse * clientResponse)
 {
     if(clientResponse == NULL)
     {
@@ -268,7 +272,8 @@ OCStackApplicationResult getReqCB(void* ctx, OCDoHandle handle, OCClientResponse
     return OC_STACK_DELETE_TRANSACTION;
 }
 
-OCStackApplicationResult obsReqCB(void* ctx, OCDoHandle handle, OCClientResponse * clientResponse)
+OCStackApplicationResult obsReqCB(void* ctx, OCDoHandle /*handle*/,
+                                  OCClientResponse * clientResponse)
 {
     if(ctx == (void*)DEFAULT_CONTEXT_VALUE)
     {
@@ -324,7 +329,8 @@ OCStackApplicationResult obsReqCB(void* ctx, OCDoHandle handle, OCClientResponse
     return OC_STACK_KEEP_TRANSACTION;
 }
 #ifdef WITH_PRESENCE
-OCStackApplicationResult presenceCB(void* ctx, OCDoHandle handle, OCClientResponse * clientResponse)
+OCStackApplicationResult presenceCB(void* ctx, OCDoHandle /*handle*/,
+                                    OCClientResponse * clientResponse)
 {
     if (ctx == (void*) DEFAULT_CONTEXT_VALUE)
     {
@@ -358,7 +364,7 @@ OCStackApplicationResult presenceCB(void* ctx, OCDoHandle handle, OCClientRespon
 #endif
 
 // This is a function called back when a device is discovered
-OCStackApplicationResult discoveryReqCB(void* ctx, OCDoHandle handle,
+OCStackApplicationResult discoveryReqCB(void* ctx, OCDoHandle /*handle*/,
         OCClientResponse * clientResponse)
 {
     if (ctx == (void*) DEFAULT_CONTEXT_VALUE)
@@ -446,7 +452,8 @@ OCStackApplicationResult discoveryReqCB(void* ctx, OCDoHandle handle,
     return OC_STACK_KEEP_TRANSACTION;
 }
 
-OCStackApplicationResult PlatformDiscoveryReqCB (void* ctx, OCDoHandle handle,
+OCStackApplicationResult PlatformDiscoveryReqCB (void* ctx,
+                                                 OCDoHandle /*handle*/,
         OCClientResponse * clientResponse)
 {
     if (ctx == (void*) DEFAULT_CONTEXT_VALUE)
@@ -467,7 +474,7 @@ OCStackApplicationResult PlatformDiscoveryReqCB (void* ctx, OCDoHandle handle,
     return (UNICAST_DISCOVERY) ? OC_STACK_DELETE_TRANSACTION : OC_STACK_KEEP_TRANSACTION;
 }
 
-OCStackApplicationResult DeviceDiscoveryReqCB (void* ctx, OCDoHandle handle,
+OCStackApplicationResult DeviceDiscoveryReqCB (void* ctx, OCDoHandle /*handle*/,
         OCClientResponse * clientResponse)
 {
     if (ctx == (void*) DEFAULT_CONTEXT_VALUE)
@@ -967,7 +974,7 @@ std::string getConnectivityType (OCConnectivityType connType)
     }
 }
 
-std::string getQueryStrForGetPut(OCClientResponse * clientResponse)
+std::string getQueryStrForGetPut(OCClientResponse * /*clientResponse*/)
 {
 
     return "/a/light";
@@ -979,4 +986,3 @@ void parseClientResponse(OCClientResponse * clientResponse)
     coapServerPort = getPortTBServer(clientResponse);
     coapServerResource = getQueryStrForGetPut(clientResponse);
 }
-
index 3cfa30b..17e4ba8 100644 (file)
@@ -123,7 +123,7 @@ OCStackResult InvokeOCDoResource(std::ostringstream &query, OCMethod method,
     return ret;
 }
 
-OCStackApplicationResult putReqCB(void* ctx, OCDoHandle handle,
+OCStackApplicationResult putReqCB(void* ctx, OCDoHandle /*handle*/,
                                 OCClientResponse * clientResponse)
 {
     if(ctx == (void*)DEFAULT_CONTEXT_VALUE)
@@ -147,7 +147,7 @@ OCStackApplicationResult putReqCB(void* ctx, OCDoHandle handle,
     return OC_STACK_DELETE_TRANSACTION;
 }
 
-OCStackApplicationResult postReqCB(void *ctx, OCDoHandle handle,
+OCStackApplicationResult postReqCB(void *ctx, OCDoHandle /*handle*/,
                           OCClientResponse *clientResponse)
 {
     if(ctx == (void*)DEFAULT_CONTEXT_VALUE)
@@ -172,7 +172,7 @@ OCStackApplicationResult postReqCB(void *ctx, OCDoHandle handle,
     return OC_STACK_DELETE_TRANSACTION;
 }
 
-OCStackApplicationResult getReqCB(void* ctx, OCDoHandle handle,
+OCStackApplicationResult getReqCB(void* ctx, OCDoHandle /*handle*/,
                            OCClientResponse * clientResponse)
 {
     if (ctx == (void*) DEFAULT_CONTEXT_VALUE)
@@ -219,7 +219,7 @@ OCStackApplicationResult getReqCB(void* ctx, OCDoHandle handle,
 /*
  * This is a function called back when a device is discovered
  */
-OCStackApplicationResult discoveryReqCB(void* ctx, OCDoHandle handle,
+OCStackApplicationResult discoveryReqCB(void* ctx, OCDoHandle /*handle*/,
         OCClientResponse * clientResponse)
 {
     if (ctx == (void*)DEFAULT_CONTEXT_VALUE)
index 9e39ab7..a544ada 100644 (file)
@@ -156,7 +156,8 @@ void PrintUsage()
                  "unavailable resource using link list interface.");
 }
 
-OCStackApplicationResult putReqCB(void* ctx, OCDoHandle handle, OCClientResponse * clientResponse)
+OCStackApplicationResult putReqCB(void* ctx, OCDoHandle /*handle*/,
+                                  OCClientResponse * clientResponse)
 {
     if(clientResponse == NULL)
     {
@@ -172,7 +173,8 @@ OCStackApplicationResult putReqCB(void* ctx, OCDoHandle handle, OCClientResponse
     return OC_STACK_KEEP_TRANSACTION;
 }
 
-OCStackApplicationResult getReqCB(void* ctx, OCDoHandle handle, OCClientResponse * clientResponse)
+OCStackApplicationResult getReqCB(void* ctx, OCDoHandle /*handle*/,
+                                  OCClientResponse * clientResponse)
 {
     OC_LOG_V(INFO, TAG, "StackResult: %s",
             getResult(clientResponse->result));
@@ -208,7 +210,7 @@ OCStackApplicationResult getReqCB(void* ctx, OCDoHandle handle, OCClientResponse
 
 
 // This is a function called back when a device is discovered
-OCStackApplicationResult discoveryReqCB(void* ctx, OCDoHandle handle,
+OCStackApplicationResult discoveryReqCB(void* ctx, OCDoHandle /*handle*/,
         OCClientResponse * clientResponse)
 {
     OC_LOG(INFO, TAG,
index e40f06a..d576b57 100644 (file)
@@ -367,7 +367,7 @@ OCEntityHandlerResult ProcessDeleteRequest (OCEntityHandlerRequest *ehRequest)
     return ehResult;
 }
 
-OCEntityHandlerResult ProcessNonExistingResourceRequest(OCEntityHandlerRequest *ehRequest)
+OCEntityHandlerResult ProcessNonExistingResourceRequest(OCEntityHandlerRequest * /*ehRequest*/)
 {
     OC_LOG_V(INFO, TAG, "\n\nExecuting %s ", __func__);
 
@@ -414,7 +414,9 @@ void ProcessObserveDeregister (OCEntityHandlerRequest *ehRequest)
 
 OCEntityHandlerResult
 OCDeviceEntityHandlerCb (OCEntityHandlerFlag flag,
-        OCEntityHandlerRequest *entityHandlerRequest, char* uri, void* callbackParam)
+                         OCEntityHandlerRequest *entityHandlerRequest,
+                         char* uri,
+                         void* /*callbackParam*/)
 {
     OC_LOG_V (INFO, TAG, "Inside device default entity handler - flags: 0x%x, uri: %s", flag, uri);
 
@@ -501,8 +503,9 @@ OCDeviceEntityHandlerCb (OCEntityHandlerFlag flag,
 }
 
 OCEntityHandlerResult
-OCNOPEntityHandlerCb (OCEntityHandlerFlag flag,
-        OCEntityHandlerRequest *entityHandlerRequest, void* callbackParam)
+OCNOPEntityHandlerCb (OCEntityHandlerFlag /*flag*/,
+                      OCEntityHandlerRequest * /*entityHandlerRequest*/,
+                      void* /*callbackParam*/)
 {
     // This is callback is associated with the 2 presence notification
     // resources. They are non-operational.
index 0e93500..694a364 100644 (file)
@@ -220,12 +220,13 @@ OCEntityHandlerResult ProcessPostRequest (OCEntityHandlerRequest *ehRequest,
 
 OCEntityHandlerResult
 OCEntityHandlerCb (OCEntityHandlerFlag flag,
-        OCEntityHandlerRequest *entityHandlerRequest,void* callbackParam)
+                   OCEntityHandlerRequest *entityHandlerRequest,
+                   void* /*callbackParam*/)
 {
     OC_LOG_V (INFO, TAG, "Inside entity handler - flags: 0x%x", flag);
 
     OCEntityHandlerResult ehResult = OC_EH_ERROR;
-    OCEntityHandlerResponse response = {};
+    OCEntityHandlerResponse response = {0};
 
     // Validate pointer
     if (!entityHandlerRequest)
@@ -298,7 +299,7 @@ void handleSigInt(int signum)
     }
 }
 
-int main(int argc, char* argv[])
+int main(int /*argc*/, char* /*argv*/[])
 {
     OC_LOG(DEBUG, TAG, "OCServer is starting...");
     if (OCInit(NULL, 0, OC_SERVER) != OC_STACK_OK)
index b1822de..625f5fd 100644 (file)
@@ -221,8 +221,12 @@ ValidateQuery (const char *query, OCResourceHandle resource,
 }
 
 static OCStackResult
-HandleLinkedListInterface(OCEntityHandlerRequest *ehRequest, uint8_t filterOn, char *filterValue)
+HandleLinkedListInterface(OCEntityHandlerRequest *ehRequest,
+                          uint8_t filterOn,
+                          char *filterValue)
 {
+    (void)filterOn;
+    (void)filterValue;
     if(!ehRequest)
     {
         return OC_STACK_INVALID_PARAM;
@@ -254,7 +258,7 @@ HandleLinkedListInterface(OCEntityHandlerRequest *ehRequest, uint8_t filterOn, c
 
     if(ret == OC_STACK_OK)
     {
-        OCEntityHandlerResponse response = {};
+        OCEntityHandlerResponse response = {0};
         response.ehResult = OC_EH_OK;
         response.payload = (OCPayload*)payload;
         response.persistentBufferFlag = 0;
@@ -286,7 +290,7 @@ HandleBatchInterface(OCEntityHandlerRequest *ehRequest)
 
     if(stackRet == OC_STACK_OK)
     {
-        OCEntityHandlerResponse response = {};
+        OCEntityHandlerResponse response = {0};
         response.ehResult = OC_EH_OK;
         response.payload = (OCPayload*)payload;
         response.persistentBufferFlag = 0;
index f587d74..0297707 100644 (file)
@@ -113,7 +113,7 @@ OCStackResult SendAllObserverNotification (OCMethod method, OCResource *resPtr,
     ResourceObserver * resourceObserver = serverObsList;
     uint8_t numObs = 0;
     OCServerRequest * request = NULL;
-    OCEntityHandlerRequest ehRequest = {};
+    OCEntityHandlerRequest ehRequest = {0};
     OCEntityHandlerResult ehResult = OC_EH_ERROR;
     bool observeErrorFlag = false;
 
@@ -170,7 +170,7 @@ OCStackResult SendAllObserverNotification (OCMethod method, OCResource *resPtr,
             }
             else
             {
-                OCEntityHandlerResponse ehResponse = {};
+                OCEntityHandlerResponse ehResponse = {0};
 
                 //This is effectively the implementation for the presence entity handler.
                 OC_LOG(DEBUG, TAG, PCF("This notification is for Presence"));
@@ -237,6 +237,7 @@ OCStackResult SendListObserverNotification (OCResource * resource,
         uint32_t maxAge,
         OCQualityOfService qos)
 {
+    (void)maxAge;
     if(!resource || !obsIdList || !payload)
     {
         return OC_STACK_INVALID_PARAM;
@@ -272,7 +273,7 @@ OCStackResult SendListObserverNotification (OCResource * resource,
                     request->observeResult = OC_STACK_OK;
                     if(result == OC_STACK_OK)
                     {
-                        OCEntityHandlerResponse ehResponse = {};
+                        OCEntityHandlerResponse ehResponse = {0};
                         ehResponse.ehResult = OC_EH_OK;
                         ehResponse.payload = (OCPayload*)OCRepPayloadCreate();
                         if(!ehResponse.payload)
index 40c8399..d72c136 100644 (file)
@@ -138,7 +138,7 @@ static OCStackResult OCConvertDiscoveryPayload(OCDiscoveryPayload* payload, uint
         return OC_STACK_NO_MEMORY;
     }
 
-    CborEncoder encoder = {};
+    CborEncoder encoder = {0};
     bool err = false;
     size_t resourceCount =  OCDiscoveryPayloadGetResourceCount(payload);
 
@@ -279,7 +279,7 @@ static OCStackResult OCConvertDevicePayload(OCDevicePayload* payload, uint8_t**
         return OC_STACK_NO_MEMORY;
     }
 
-    CborEncoder encoder = {};
+    CborEncoder encoder = {0};
     bool err = false;
 
     cbor_encoder_init(&encoder, *outPayload, *size, 0);
@@ -363,7 +363,7 @@ static OCStackResult OCConvertPlatformPayload(OCPlatformPayload* payload, uint8_
         return OC_STACK_NO_MEMORY;
     }
 
-    CborEncoder encoder = {};
+    CborEncoder encoder = {0};
     bool err = false;
 
     cbor_encoder_init(&encoder, *outPayload, *size, 0);
@@ -642,7 +642,7 @@ static OCStackResult OCConvertRepPayload(OCRepPayload* payload, uint8_t** outPay
         return OC_STACK_NO_MEMORY;
     }
 
-    CborEncoder encoder = {};
+    CborEncoder encoder = {0};
     bool err = false;
 
     cbor_encoder_init(&encoder, *outPayload, *size, 0);
@@ -691,7 +691,7 @@ static OCStackResult OCConvertPresencePayload(OCPresencePayload* payload,
         return OC_STACK_NO_MEMORY;
     }
 
-    CborEncoder encoder = {};
+    CborEncoder encoder = {0};
     bool err = false;
 
     cbor_encoder_init(&encoder, *outPayload, *size, 0);
index 7b60c97..05c6b59 100644 (file)
@@ -435,7 +435,7 @@ static OCStackResult OCParsePlatformPayload(OCPayload** outPayload, CborValue* a
     if(cbor_value_is_map(arrayVal))
     {
         char* uri = NULL;
-        OCPlatformInfo info = {};
+        OCPlatformInfo info = {0};
         CborValue curVal;
          err = err || cbor_value_map_find_value(arrayVal, OC_RSRVD_HREF, &curVal);
         size_t len;
@@ -722,7 +722,7 @@ static bool OCParseSingleRepPayload(OCRepPayload** outPayload, CborValue* repPar
     err = err || cbor_value_map_find_value(repParent, OC_RSRVD_PROPERTY, &curVal);
     if(cbor_value_is_valid(&curVal))
     {
-        CborValue insidePropArray = {};
+        CborValue insidePropArray = {0};
         err = err || cbor_value_map_find_value(&curVal, OC_RSRVD_RESOURCE_TYPE,
                 &insidePropArray);
 
index 3945196..9f4f675 100644 (file)
@@ -49,8 +49,8 @@
              TAG, PCF(#arg " is NULL")); return (retVal); } }
 
 extern OCResource *headResource;
-static OCPlatformInfo savedPlatformInfo = {};
-static OCDeviceInfo savedDeviceInfo = {};
+static OCPlatformInfo savedPlatformInfo = {0};
+static OCDeviceInfo savedDeviceInfo = {0};
 
 //-----------------------------------------------------------------------------
 // Default resource entity handler function
@@ -522,7 +522,7 @@ static bool includeThisResourceInResponse(OCResource *resource,
 OCStackResult SendNonPersistantDiscoveryResponse(OCServerRequest *request, OCResource *resource,
                                 OCPayload *discoveryPayload, OCEntityHandlerResult ehResult)
 {
-    OCEntityHandlerResponse response = {};
+    OCEntityHandlerResponse response = {0};
 
     response.ehResult = ehResult;
     response.payload = discoveryPayload;
@@ -676,7 +676,7 @@ HandleDefaultDeviceEntityHandler (OCServerRequest *request)
 
     OCStackResult result = OC_STACK_OK;
     OCEntityHandlerResult ehResult = OC_EH_ERROR;
-    OCEntityHandlerRequest ehRequest = {};
+    OCEntityHandlerRequest ehRequest = {0};
 
     OC_LOG(INFO, TAG, PCF("Entering HandleResourceWithDefaultDeviceEntityHandler"));
     result = FormOCEntityHandlerRequest(&ehRequest,
@@ -725,7 +725,7 @@ HandleResourceWithEntityHandler (OCServerRequest *request,
     OCEntityHandlerFlag ehFlag = OC_REQUEST_FLAG;
     ResourceObserver *resObs = NULL;
 
-    OCEntityHandlerRequest ehRequest = {};
+    OCEntityHandlerRequest ehRequest = {0};
 
     OC_LOG(INFO, TAG, PCF("Entering HandleResourceWithEntityHandler"));
 
@@ -842,7 +842,7 @@ HandleCollectionResourceDefaultEntityHandler (OCServerRequest *request,
     }
 
     OCStackResult result = OC_STACK_ERROR;
-    OCEntityHandlerRequest ehRequest = {};
+    OCEntityHandlerRequest ehRequest = {0};
 
     result = FormOCEntityHandlerRequest(&ehRequest,
                                         (OCRequestHandle)request,
index 215222a..43efdc5 100644 (file)
@@ -411,8 +411,8 @@ CAResponseResult_t ConvertEHResultToCAResult (OCEntityHandlerResult result)
 OCStackResult HandleSingleResponse(OCEntityHandlerResponse * ehResponse)
 {
     OCStackResult result = OC_STACK_ERROR;
-    CAEndpoint_t responseEndpoint = {};
-    CAResponseInfo_t responseInfo = {};
+    CAEndpoint_t responseEndpoint = {.adapter = CA_DEFAULT_ADAPTER};
+    CAResponseInfo_t responseInfo = {.result = CA_EMPTY};
     CAHeaderOption_t* optionsPointer = NULL;
 
     if(!ehResponse || !ehResponse->requestHandle)
index 12adb2f..4808272 100644 (file)
@@ -461,7 +461,7 @@ OCStackResult OCStackFeedBack(CAToken_t token, uint8_t tokenLength, uint8_t stat
 {
     OCStackResult result = OC_STACK_ERROR;
     ResourceObserver * observer = NULL;
-    OCEntityHandlerRequest ehRequest = {};
+    OCEntityHandlerRequest ehRequest = {0};
 
     switch(status)
     {
@@ -800,7 +800,7 @@ OCStackResult HandlePresenceResponse(const CAEndpoint_t *endpoint,
     OCStackApplicationResult cbResult = OC_STACK_DELETE_TRANSACTION;
     ClientCB * cbNode = NULL;
     char *resourceTypeName = NULL;
-    OCClientResponse response = {};
+    OCClientResponse response = {.devAddr = {.adapter = OC_DEFAULT_ADAPTER}};
     OCStackResult result = OC_STACK_ERROR;
     uint32_t maxAge = 0;
     int uriLen;
@@ -830,7 +830,8 @@ OCStackResult HandlePresenceResponse(const CAEndpoint_t *endpoint,
     else
     {
         // check for multiicast presence
-        CAEndpoint_t ep = { endpoint->adapter, endpoint->flags };
+        CAEndpoint_t ep = { .adapter = endpoint->adapter,
+                            .flags = endpoint->flags };
         OICStrcpy(ep.addr, sizeof(ep.addr), OC_MULTICAST_IP);
         ep.port = OC_MULTICAST_PORT;
 
@@ -1040,7 +1041,8 @@ void HandleCAResponses(const CAEndpoint_t* endPoint, const CAResponseInfo_t* res
             OC_LOG(INFO, TAG, PCF("Receiving A Timeout for this token"));
             OC_LOG(INFO, TAG, PCF("Calling into application address space"));
 
-            OCClientResponse response = {};
+            OCClientResponse response =
+                {.devAddr = {.adapter = OC_DEFAULT_ADAPTER}};
             CopyEndpointToDevAddr(endPoint, &response.devAddr);
             FixUpClientResponse(&response);
             response.resourceUri = responseInfo->info.resourceUri;
@@ -1055,7 +1057,8 @@ void HandleCAResponses(const CAEndpoint_t* endPoint, const CAResponseInfo_t* res
             OC_LOG(INFO, TAG, PCF("This is a regular response, A client call back is found"));
             OC_LOG(INFO, TAG, PCF("Calling into application address space"));
 
-            OCClientResponse response = {};
+            OCClientResponse response =
+                {.devAddr = {.adapter = OC_DEFAULT_ADAPTER}};
             response.sequenceNumber = OC_OBSERVE_NO_OPTION;
             CopyEndpointToDevAddr(endPoint, &response.devAddr);
             FixUpClientResponse(&response);
@@ -1239,8 +1242,9 @@ OCStackResult SendDirectStackResponse(const CAEndpoint_t* endPoint, const uint16
         const uint8_t numOptions, const CAHeaderOption_t *options,
         CAToken_t token, uint8_t tokenLength)
 {
-    CAResponseInfo_t respInfo = {};
-    respInfo.result = responseResult;
+    CAResponseInfo_t respInfo = {
+        .result = responseResult
+    };
     respInfo.info.messageId = coapID;
     respInfo.info.numOptions = numOptions;
     respInfo.info.options = (CAHeaderOption_t*)options;
@@ -1282,7 +1286,7 @@ void HandleCARequests(const CAEndpoint_t* endPoint, const CARequestInfo_t* reque
         return;
     }
 
-    OCServerProtocolRequest serverRequest = {};
+    OCServerProtocolRequest serverRequest = {0};
 
     OC_LOG_V(INFO, TAG, PCF("Endpoint URI : %s"), requestInfo->info.resourceUri);
 
@@ -1999,7 +2003,7 @@ OCStackResult OCDoResource(OCDoHandle *handle,
     OCTransportAdapter adapter;
     OCTransportFlags flags;
     // the request contents are put here
-    CARequestInfo_t requestInfo = { CA_GET };
+    CARequestInfo_t requestInfo = {.method = CA_GET};
     // requestUri  will be parsed into the following three variables
     OCDevAddr *devAddr = NULL;
     char *resourceUri = NULL;
@@ -2249,8 +2253,8 @@ OCStackResult OCCancel(OCDoHandle handle, OCQualityOfService qos, OCHeaderOption
     OCStackResult ret = OC_STACK_OK;
     CAEndpoint_t* endpoint = NULL;
     CAResult_t caResult;
-    CAInfo_t requestData = {};
-    CARequestInfo_t requestInfo = {};
+    CAInfo_t requestData = {.type = CA_MSG_CONFIRM};
+    CARequestInfo_t requestInfo = {.method = CA_GET};
 
     if(!handle)
     {
@@ -2432,8 +2436,8 @@ OCStackResult OCProcessPresence()
 
         CAResult_t caResult = CA_STATUS_OK;
         CAEndpoint_t* endpoint = NULL;
-        CAInfo_t requestData ={};
-        CARequestInfo_t requestInfo = {};
+        CAInfo_t requestData = {.type = CA_MSG_CONFIRM};
+        CARequestInfo_t requestInfo = {.method = CA_GET};
 
         OC_LOG(DEBUG, TAG, PCF("time to test server presence"));
 
index d5f9f83..1ff11a8 100644 (file)
@@ -799,6 +799,8 @@ exit:
 OCStackApplicationResult ActionSetCB(void* context, OCDoHandle handle,
         OCClientResponse* clientResponse)
 {
+    (void)context;
+    (void)clientResponse;
     OC_LOG(INFO, TAG, PCF("Entering BuildActionJSON"));
 
     ClientRequestInfo *info = GetClientRequestInfo(clientRequstList, handle);
@@ -846,6 +848,7 @@ OCStackApplicationResult ActionSetCB(void* context, OCDoHandle handle,
 
 void ActionSetCD(void *context)
 {
+    (void)context;
 }
 
 OCStackResult BuildActionJSON(OCAction* action, unsigned char* bufferPtr,
@@ -909,6 +912,9 @@ unsigned int GetNumOfTargetResource(OCAction *actionset)
 OCStackResult SendAction(OCDoHandle *handle, const char *targetUri,
         const unsigned char *action)
 {
+    (void)handle;
+    (void)targetUri;
+    (void)action;
     // TODO: disabled since this is no longer compatible
     return OC_STACK_NOTIMPL;
 }
index a84de53..5e2015b 100644 (file)
@@ -45,6 +45,7 @@ oc_log_ctx_t *oc_make_console_logger()
 
 int oc_console_logger_init(oc_log_ctx_t *ctx, void *world)
 {
+ (void)world;
  oc_console_logger_ctx *my_ctx;
 
  my_ctx = (oc_console_logger_ctx *)malloc(sizeof(oc_console_logger_ctx));
@@ -77,6 +78,8 @@ void oc_console_logger_flush(oc_log_ctx_t *ctx)
 
 void oc_console_logger_set_level(oc_log_ctx_t *ctx, const int level)
 {
+ (void)ctx;
+ (void)level;
  /* We don't have any special thing we need to do when a log level changes. */
  return;
 }
@@ -95,6 +98,8 @@ size_t oc_console_logger_write(oc_log_ctx_t *ctx, const int level, const char *m
 
 int oc_console_logger_set_module(oc_log_ctx_t *ctx, const char *module_name)
 {
+ (void)ctx;
+ (void)module_name;
  /* We don't do anything special when the module name changes: */
  return 1;
 }
index cadf871..8134940 100644 (file)
@@ -112,7 +112,7 @@ catch(...)
 {
 }
 
-void oc_ostream_log_set_level(oc_log_ctx_t *ctx, const int level)
+void oc_ostream_log_set_level(oc_log_ctx_t * /*ctx*/, const int /*level*/)
 try
 {
  /* We don't have any special thing we need to do when a log level changes. */
@@ -147,7 +147,8 @@ catch(...)
  return 0;
 }
 
-int oc_ostream_log_set_module(oc_log_ctx_t *ctx, const char *module_name)
+int oc_ostream_log_set_module(oc_log_ctx_t * /*ctx*/,
+                              const char * /*module_name*/)
 try
 {
  // Nothing special needs to happen for a module name change:
index 987c0f5..4f1dd62 100644 (file)
@@ -132,7 +132,7 @@ namespace OC
 
     }
 
-    OCStackApplicationResult listenCallback(void* ctx, OCDoHandle handle,
+    OCStackApplicationResult listenCallback(void* ctx, OCDoHandle /*handle*/,
         OCClientResponse* clientResponse)
     {
         ClientCallbackContext::ListenContext* context =
@@ -218,7 +218,8 @@ namespace OC
         return result;
     }
 
-    OCStackApplicationResult listenDeviceCallback(void* ctx, OCDoHandle handle,
+    OCStackApplicationResult listenDeviceCallback(void* ctx,
+                                                  OCDoHandle /*handle*/,
             OCClientResponse* clientResponse)
     {
         ClientCallbackContext::DeviceListenContext* context =
@@ -307,7 +308,8 @@ namespace OC
         }
     }
 
-    OCStackApplicationResult getResourceCallback(void* ctx, OCDoHandle handle,
+    OCStackApplicationResult getResourceCallback(void* ctx,
+                                                 OCDoHandle /*handle*/,
         OCClientResponse* clientResponse)
     {
         ClientCallbackContext::GetContext* context =
@@ -381,7 +383,8 @@ namespace OC
     }
 
 
-    OCStackApplicationResult setResourceCallback(void* ctx, OCDoHandle handle,
+    OCStackApplicationResult setResourceCallback(void* ctx,
+                                                 OCDoHandle /*handle*/,
         OCClientResponse* clientResponse)
     {
         ClientCallbackContext::SetContext* context =
@@ -539,7 +542,8 @@ namespace OC
         return result;
     }
 
-    OCStackApplicationResult deleteResourceCallback(void* ctx, OCDoHandle handle,
+    OCStackApplicationResult deleteResourceCallback(void* ctx,
+                                                    OCDoHandle /*handle*/,
         OCClientResponse* clientResponse)
     {
         ClientCallbackContext::DeleteContext* context =
@@ -558,7 +562,9 @@ namespace OC
     OCStackResult InProcClientWrapper::DeleteResource(
         const OCDevAddr& devAddr,
         const std::string& uri,
-        const HeaderOptions& headerOptions, DeleteCallback& callback, QualityOfService QoS)
+        const HeaderOptions& headerOptions,
+        DeleteCallback& callback,
+        QualityOfService /*QoS*/)
     {
         if(!callback)
         {
@@ -599,7 +605,8 @@ namespace OC
         return result;
     }
 
-    OCStackApplicationResult observeResourceCallback(void* ctx, OCDoHandle handle,
+    OCStackApplicationResult observeResourceCallback(void* ctx,
+                                                     OCDoHandle /*handle*/,
         OCClientResponse* clientResponse)
     {
         ClientCallbackContext::ObserveContext* context =
@@ -693,8 +700,8 @@ namespace OC
 
     OCStackResult InProcClientWrapper::CancelObserveResource(
             OCDoHandle handle,
-            const std::string& host, // unused
-            const std::string& uri,  // unused
+            const std::string& /*host*/,
+            const std::string& /*uri*/,
             const HeaderOptions& headerOptions,
             QualityOfService QoS)
     {
@@ -719,7 +726,8 @@ namespace OC
         return result;
     }
 
-    OCStackApplicationResult subscribePresenceCallback(void* ctx, OCDoHandle handle,
+    OCStackApplicationResult subscribePresenceCallback(void* ctx,
+                                                       OCDoHandle /*handle*/,
             OCClientResponse* clientResponse)
     {
         ClientCallbackContext::SubscribePresenceContext* context =