[Bf-blender-cvs] [56344fb30fe] master: Cleanup: Silence warning for wrong const char comparison

Charlie Jolly noreply at git.blender.org
Fri Dec 31 14:06:27 CET 2021


Commit: 56344fb30fe41bb18a2fce246a30a9e14a8d4e25
Author: Charlie Jolly
Date:   Fri Dec 31 12:53:21 2021 +0000
Branches: master
https://developer.blender.org/rB56344fb30fe41bb18a2fce246a30a9e14a8d4e25

Cleanup: Silence warning for wrong const char comparison

Incorrectly used comparison for empty string.

Reported in chat by @jacqueslucke.

===================================================================

M	source/blender/nodes/shader/nodes/node_shader_math.cc
M	source/blender/nodes/shader/nodes/node_shader_vector_math.cc

===================================================================

diff --git a/source/blender/nodes/shader/nodes/node_shader_math.cc b/source/blender/nodes/shader/nodes/node_shader_math.cc
index 1b450a6414b..cff3d5f347a 100644
--- a/source/blender/nodes/shader/nodes/node_shader_math.cc
+++ b/source/blender/nodes/shader/nodes/node_shader_math.cc
@@ -76,7 +76,7 @@ static void sh_node_math_gather_link_searches(GatherLinkSearchOpParams &params)
 
     for (const EnumPropertyItem *item = rna_enum_node_math_items; item->identifier != nullptr;
          item++) {
-      if (item->name != nullptr && item->identifier != "") {
+      if (item->name != nullptr && item->identifier[0] != '\0') {
         params.add_item(
             IFACE_(item->name), SocketSearchOp{"Value", (NodeMathOperation)item->value}, weight);
       }
diff --git a/source/blender/nodes/shader/nodes/node_shader_vector_math.cc b/source/blender/nodes/shader/nodes/node_shader_vector_math.cc
index a488e709373..e48a668f9f5 100644
--- a/source/blender/nodes/shader/nodes/node_shader_vector_math.cc
+++ b/source/blender/nodes/shader/nodes/node_shader_vector_math.cc
@@ -68,7 +68,7 @@ static void sh_node_vector_math_gather_link_searches(GatherLinkSearchOpParams &p
 
   for (const EnumPropertyItem *item = rna_enum_node_vec_math_items; item->identifier != nullptr;
        item++) {
-    if (item->name != nullptr && item->identifier != "") {
+    if (item->name != nullptr && item->identifier[0] != '\0') {
       if ((params.in_out() == SOCK_OUT) && ELEM(item->value,
                                                 NODE_VECTOR_MATH_LENGTH,
                                                 NODE_VECTOR_MATH_DISTANCE,



More information about the Bf-blender-cvs mailing list