[IOT-1888] Fix /W4 warnings present when building with -noSecurity or -release
authorAlex Kelley <alexke@microsoft.com>
Tue, 7 Mar 2017 01:03:44 +0000 (17:03 -0800)
committerKevin Kane <kkane@microsoft.com>
Wed, 8 Mar 2017 22:03:29 +0000 (22:03 +0000)
Change-Id: I70ff36b675418f7e441b1af594d922c231430918
Signed-off-by: Alex Kelley <alexke@microsoft.com>
Reviewed-on: https://gerrit.iotivity.org/gerrit/17755
Reviewed-by: Kevin Kane <kkane@microsoft.com>
Tested-by: jenkins-iotivity <jenkins@iotivity.org>
Reviewed-by: Dan Mihai <Daniel.Mihai@microsoft.com>
build_common/windows/SConscript
resource/csdk/security/src/credresource.c
resource/csdk/security/src/policyengine.c

index 61fe357..e5dc9c3 100644 (file)
@@ -18,7 +18,9 @@ if env['CC'] == 'cl':
     #    - Disabled due to IoTivity not being ANSI compatible
     #  - warning C4214:  bit field types other than int
     #    - Disabled due to IoTivity not being ANSI compatible
-    env.AppendUnique(CCFLAGS=['/wd4127', '/wd4200', '/wd4201', '/wd4214'])
+    #  - warning C4706: assignment within conditional expression
+    #    - Disabled due to the widespread usage in IoTivity and low impact.
+    env.AppendUnique(CCFLAGS=['/wd4127', '/wd4200', '/wd4201', '/wd4214', '/wd4706'])
 
     env.AppendUnique(CCFLAGS=['/EHsc'])
 
index f6301c9..ff3677a 100755 (executable)
@@ -117,11 +117,12 @@ static bool ValueWithinBounds(uint64_t value, uint64_t maxValue)
 
 static bool CheckSubjectOfCertificate(OicSecCred_t* cred, OicUuid_t deviceID)
 {
-    OicUuid_t emptyUuid = {.id={0}};
     OIC_LOG(DEBUG, TAG, "IN CheckSubjectOfCertificate");
     VERIFY_NOT_NULL(TAG, cred, ERROR);
 
 #if defined(__WITH_DTLS__) || defined(__WITH_TLS__)
+    const OicUuid_t emptyUuid = { .id = { 0 } };
+
     if ( SIGNED_ASYMMETRIC_KEY == cred->credType)
     {
         if((0 == memcmp(cred->subject.id, emptyUuid.id, sizeof(cred->subject.id))) ||
@@ -130,6 +131,8 @@ static bool CheckSubjectOfCertificate(OicSecCred_t* cred, OicUuid_t deviceID)
             memcpy(cred->subject.id, deviceID.id, sizeof(deviceID.id));
         }
     }
+#else
+    OC_UNUSED(deviceID);
 #endif
 
     OIC_LOG(DEBUG, TAG, "OUT CheckSubjectOfCertificate");
index 05cded1..3c7ce13 100644 (file)
@@ -145,6 +145,8 @@ static bool IsRequestFromOwnershipTransferSession(SRMRequestContext_t *context)
         OIC_LOG_V(DEBUG, TAG, "%s: request was %sreceived from Ownership Transfer session",
             __func__, retVal ? "" : "NOT ");
     }
+#else
+    OC_UNUSED(context);
 #endif
 
     return retVal;