Removed some warnings from security code. 53/2253/2 security-basecamp
authorSachin Agrawal <sachin.agrawal@intel.com>
Thu, 20 Aug 2015 18:21:57 +0000 (11:21 -0700)
committerSachin Agrawal <sachin.agrawal@intel.com>
Fri, 21 Aug 2015 16:53:24 +0000 (16:53 +0000)
Removed warnings related to missing-field-initializers.

Change-Id: If4af332ba8f7995c5657dc052763e1bd4089682c
Signed-off-by: Sachin Agrawal <sachin.agrawal@intel.com>
Reviewed-on: https://gerrit.iotivity.org/gerrit/2253
Tested-by: jenkins-iotivity <jenkins-iotivity@opendaylight.org>
Reviewed-by: Shilpa Sodani <shilpa.a.sodani@intel.com>
Reviewed-by: Randeep Singh <randeep.s@samsung.com>
resource/csdk/security/provisioning/sample/sampleserver_justworks.cpp
resource/csdk/security/provisioning/sample/sampleserver_randompin.cpp
resource/csdk/security/src/doxmresource.c
resource/csdk/security/src/pbkdf2.c
resource/csdk/security/src/resourcemanager.c
resource/csdk/security/unittest/credentialresource.cpp

index 10971e8..1bbaf41 100644 (file)
@@ -312,7 +312,9 @@ OCEntityHandlerCb (OCEntityHandlerFlag flag,
     OC_LOG_V (INFO, TAG, "Inside entity handler - flags: 0x%x", flag);
     (void)callbackParam;
     OCEntityHandlerResult ehResult = OC_EH_ERROR;
-    OCEntityHandlerResponse response = {};
+
+    OCEntityHandlerResponse response;
+    memset(&response, 0, sizeof(response));
 
     // Validate pointer
     if (!entityHandlerRequest)
@@ -400,12 +402,8 @@ int main()
     OC_LOG(DEBUG, TAG, "OCServer is starting...");
 
     // Initialize Persistent Storage for SVR database
-    OCPersistentStorage ps = {};
-    ps.open = server_fopen;
-    ps.read = fread;
-    ps.write = fwrite;
-    ps.close = fclose;
-    ps.unlink = unlink;
+    OCPersistentStorage ps = {server_fopen, fread, fwrite, fclose, unlink};
+
     OCRegisterPersistentStorageHandler(&ps);
 
     if (OCInit(NULL, 0, OC_SERVER) != OC_STACK_OK)
index 7051a52..bd9560f 100644 (file)
@@ -313,7 +313,9 @@ OCEntityHandlerCb (OCEntityHandlerFlag flag,
     OC_LOG_V (INFO, TAG, "Inside entity handler - flags: 0x%x", flag);
     (void)callbackParam;
     OCEntityHandlerResult ehResult = OC_EH_ERROR;
-    OCEntityHandlerResponse response = {};
+
+    OCEntityHandlerResponse response;
+    memset(&response, 0, sizeof(response));
 
     // Validate pointer
     if (!entityHandlerRequest)
@@ -414,12 +416,7 @@ int main()
     OC_LOG(DEBUG, TAG, "OCServer is starting...");
 
     // Initialize Persistent Storage for SVR database
-    OCPersistentStorage ps = {};
-    ps.open = server_fopen;
-    ps.read = fread;
-    ps.write = fwrite;
-    ps.close = fclose;
-    ps.unlink = unlink;
+    OCPersistentStorage ps = {server_fopen, fread, fwrite, fclose, unlink};
     OCRegisterPersistentStorageHandler(&ps);
 
     if (OCInit(NULL, 0, OC_SERVER) != OC_STACK_OK)
index 502dc7c..0423a21 100644 (file)
@@ -357,7 +357,7 @@ static bool ValidateQuery(unsigned char * query)
         return false;
     }
 
-    OicParseQueryIter_t parseIter = {0};
+    OicParseQueryIter_t parseIter = {.attrPos = NULL};
 
     ParseQueryIterInit(query, &parseIter);
 
index 71b6d02..1ddabed 100644 (file)
@@ -54,7 +54,7 @@ static void GetBigEndianBuf(uint8_t *buf, int num)
     uint8_t *nBuf = (uint8_t *)&num;
     if ( isLittle() == 1 )
     {
-        int i = 0;
+        size_t i = 0;
         for (i = 0; i < sizeof(int); i++)
         {
             buf[i] = nBuf[ sizeof(int) - i - 1];
index 2297f00..5eefbd4 100644 (file)
@@ -47,7 +47,7 @@ OCStackResult SendSRMResponse(const OCEntityHandlerRequest *ehRequest,
         OCEntityHandlerResult ehRet, const char *rspPayload)
 {
     OC_LOG (INFO, TAG, PCF("SRM sending SRM response"));
-    OCEntityHandlerResponse response = {0};
+    OCEntityHandlerResponse response = {.requestHandle = NULL};
     if (ehRequest)
     {
         OCSecurityPayload ocPayload = {.base = {.type = PAYLOAD_TYPE_INVALID}};
@@ -98,7 +98,7 @@ OCStackResult InitSecureResources( )
         ret = InitSVCResource();
        }
        if(OC_STACK_OK == ret)
-    {     
+    {
         ret = InitAmaclResource();
     }
     if(OC_STACK_OK != ret)
index 62597f1..1ee9238 100644 (file)
@@ -283,7 +283,7 @@ TEST(CredGenerateCredentialTest, GenerateCredentialValidInput)
     OicUuid_t owners[1];
     OICStrcpy((char *)owners[0].id, sizeof(owners[0].id), "ownersId21");
 
-    OicUuid_t subject = {0};
+    OicUuid_t subject = {{0}};
     OICStrcpy((char *)subject.id, sizeof(subject.id), "subject11");
 
     char privateKey[] = "My private Key11";
@@ -303,7 +303,7 @@ TEST(GenerateAndAddCredentialTest, GenerateAndAddCredentialValidInput)
     OicUuid_t owners[1];
     OICStrcpy((char *)owners[0].id, sizeof(owners[0].id), "ownersId11");
 
-    OicUuid_t subject = {0};
+    OicUuid_t subject = {{0}};
     OICStrcpy((char *)subject.id, sizeof(subject.id), "subject11");
 
     char privateKey[] = "My private Key11";