bridging: Fix empty string test (on static allocation)
authorPhilippe Coval <philippe.coval@osg.samsung.com>
Thu, 30 Mar 2017 12:20:27 +0000 (14:20 +0200)
committerDan Mihai <Daniel.Mihai@microsoft.com>
Fri, 28 Apr 2017 14:38:59 +0000 (14:38 +0000)
Observed issue using clang on GNU/Linux:

  bridging/common/pluginServer.cpp:211:14:\
  error: comparison of array 'ctx->reconnect_file_name' \
  not equal to a null pointer is always true \
  [-Werror,-Wtautological-pointer-compare]
  if (ctx->reconnect_file_name != NULL)

Change-Id: Ifc5e40ba8d7943ca648e93627ed77cbc25f2731a
Signed-off-by: Philippe Coval <philippe.coval@osg.samsung.com>
Reviewed-on: https://gerrit.iotivity.org/gerrit/18369
Tested-by: jenkins-iotivity <jenkins@iotivity.org>
Reviewed-by: Dave Thaler <dthaler@microsoft.com>
Reviewed-by: Todd Malsbary <todd.malsbary@intel.com>
(cherry picked from commit 995c584afef7af741d32fc024366d245fa2cf1ca)
Reviewed-on: https://gerrit.iotivity.org/gerrit/19129
Reviewed-by: Uze Choi <uzchoi@samsung.com>
Tested-by: Dan Mihai <Daniel.Mihai@microsoft.com>
Reviewed-by: Dan Mihai <Daniel.Mihai@microsoft.com>
bridging/common/pluginServer.cpp
bridging/plugins/hue_plugin/hue_resource.cpp

index eb251dc..c1a67b3 100644 (file)
@@ -208,7 +208,7 @@ MPMResult MPMPluginService(MPMCommonPluginCtx *ctx)
         OIC_LOG_V(ERROR, TAG, "Error (%d) initializing OCF infrastructure", result);
         goto HandleError;
     }
-    if (ctx->reconnect_file_name != NULL)
+    if ('\0' != ctx->reconnect_file_name[0])
     {
         strncpy(g_plugin_context->reconnect_file_name, ctx->reconnect_file_name,
                 strlen(ctx->reconnect_file_name));
index 9a3429a..657d6a9 100644 (file)
@@ -550,7 +550,7 @@ MPMResult pluginReconnect(MPMPluginCtx *, MPMPipeMessage *message)
               plugindetails->clientId,
               plugindetails->lightNo, plugindetails->prefix);
 
-    if ((plugindetails->bridgeMac != NULL) && ( plugindetails->clientId != NULL))
+    if (('\0' != plugindetails->bridgeMac[0]) && ('\0' != plugindetails->clientId[0]))
     {
         if (authorizedBridges.find(plugindetails->bridgeMac) == authorizedBridges.end())
         {