IOT-2539 Fix write-strings warning 93/22193/3
authorGeorge Nash <george.nash@intel.com>
Fri, 4 Aug 2017 18:57:02 +0000 (11:57 -0700)
committerRick Bell <richard.s.bell@intel.com>
Mon, 18 Sep 2017 17:42:31 +0000 (17:42 +0000)
The write-strings warning comes from assigning
the a const string to a char* that is not const.
From everything I see in this example the string
is not changed so simply using const_cast will
remove the warning.

If these values are always expected to be constant
we may want to consider changing the strutures
to hold const char * not char *. Without further
investigation I did not feel safe making that
change.

Bug: https://jira.iotivity.org/browse/IOT-2539
Change-Id: Ib9053a1041b72b1fd05329999efc7a7ff28aab94
Signed-off-by: George Nash <george.nash@intel.com>
Reviewed-on: https://gerrit.iotivity.org/gerrit/21753
Tested-by: jenkins-iotivity <jenkins@iotivity.org>
Reviewed-by: Mats Wichmann <mats@linux.com>
Reviewed-by: Phil Coval <philippe.coval@osg.samsung.com>
Reviewed-by: Rick Bell <richard.s.bell@intel.com>
(cherry picked from commit ff88390c2889d3e20bdbdcf73e10ada7584ab8e8)

cloud/samples/client/group_invite/group_invite.cpp

index 02c3e30..fc7d53a 100644 (file)
@@ -968,9 +968,9 @@ int main(int argc, char *argv[])
                         OCDeviceInfo devInfoBinarySwitch;
                         OCStringLL deviceType;
 
-                        deviceType.value = "oic.d.binaryswitch";
+                        deviceType.value = const_cast<char *>("oic.d.binaryswitch");
                         deviceType.next = NULL;
-                        devInfoBinarySwitch.deviceName = "FAC_2016";
+                        devInfoBinarySwitch.deviceName = const_cast<char *>("FAC_2016");
                         devInfoBinarySwitch.types = &deviceType;
                         devInfoBinarySwitch.specVersion = NULL;
                         devInfoBinarySwitch.dataModelVersions = NULL;