[Bf-blender-cvs] [af35ada2f3f] master: Cleanup: Clang-Tidy, modernize-use-bool-literals

Sergey Sharybin noreply at git.blender.org
Fri Nov 6 14:32:54 CET 2020


Commit: af35ada2f3fa8da4d46b3a71de724d353d716820
Author: Sergey Sharybin
Date:   Fri Nov 6 14:25:30 2020 +0100
Branches: master
https://developer.blender.org/rBaf35ada2f3fa8da4d46b3a71de724d353d716820

Cleanup: Clang-Tidy, modernize-use-bool-literals

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

M	.clang-tidy
M	source/blender/blenlib/tests/BLI_path_util_test.cc
M	source/blender/compositor/operations/COM_VectorBlurOperation.cpp
M	source/blender/depsgraph/intern/builder/deg_builder_relations.cc
M	source/blender/freestyle/intern/blender_interface/FRS_freestyle.cpp
M	source/blender/freestyle/intern/python/BPy_Convert.cpp
M	source/blender/freestyle/intern/python/BPy_Freestyle.cpp
M	source/blender/freestyle/intern/python/BPy_FrsMaterial.cpp
M	source/blender/gpu/intern/gpu_select_sample_query.cc
M	source/blender/ikplugin/intern/itasc_plugin.cpp
M	source/blender/imbuf/intern/openexr/openexr_api.cpp
M	source/blender/io/collada/AnimationImporter.cpp
M	source/blender/io/collada/DocumentImporter.cpp
M	source/blender/io/collada/SceneExporter.cpp
M	source/blender/io/collada/SkinInfo.cpp
M	source/blender/io/collada/collada_utils.cpp
M	source/blender/io/common/intern/abstract_hierarchy_iterator_test.cc

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

diff --git a/.clang-tidy b/.clang-tidy
index 0433e298826..af1f779a056 100644
--- a/.clang-tidy
+++ b/.clang-tidy
@@ -42,7 +42,6 @@ Checks:  >
   -modernize-concat-nested-namespaces,
   -modernize-use-nodiscard,
   -modernize-use-using,
-  -modernize-use-bool-literals,
   -modernize-loop-convert,
   -modernize-pass-by-value,
   -modernize-use-default-member-init,
diff --git a/source/blender/blenlib/tests/BLI_path_util_test.cc b/source/blender/blenlib/tests/BLI_path_util_test.cc
index 927d24d2c4c..d8c10f60093 100644
--- a/source/blender/blenlib/tests/BLI_path_util_test.cc
+++ b/source/blender/blenlib/tests/BLI_path_util_test.cc
@@ -41,7 +41,7 @@ TEST(path_util, Clean)
     EXPECT_STREQ("a/", path);
   }
 
-  if (0) /* FIXME */
+  if (false) /* FIXME */
   {
     char path[FILE_MAX] = "./a////";
     BLI_path_normalize(NULL, path);
diff --git a/source/blender/compositor/operations/COM_VectorBlurOperation.cpp b/source/blender/compositor/operations/COM_VectorBlurOperation.cpp
index 4f41a60f3c3..0f3a3172f15 100644
--- a/source/blender/compositor/operations/COM_VectorBlurOperation.cpp
+++ b/source/blender/compositor/operations/COM_VectorBlurOperation.cpp
@@ -747,7 +747,7 @@ void zbuf_accumulate_vecblur(NodeBlurData *nbd,
       float blendfac, ipodata[4];
 
       /* clear zbuf, if we draw future we fill in not moving pixels */
-      if (0) {
+      if (false) {
         for (x = xsize * ysize - 1; x >= 0; x--) {
           rectz[x] = 10e16;
         }
diff --git a/source/blender/depsgraph/intern/builder/deg_builder_relations.cc b/source/blender/depsgraph/intern/builder/deg_builder_relations.cc
index 40b856b1896..8741622ac89 100644
--- a/source/blender/depsgraph/intern/builder/deg_builder_relations.cc
+++ b/source/blender/depsgraph/intern/builder/deg_builder_relations.cc
@@ -1234,7 +1234,7 @@ void DepsgraphRelationBuilder::build_constraints(ID *id,
         }
       }
       if (cti->flush_constraint_targets) {
-        cti->flush_constraint_targets(con, &targets, 1);
+        cti->flush_constraint_targets(con, &targets, true);
       }
     }
   }
diff --git a/source/blender/freestyle/intern/blender_interface/FRS_freestyle.cpp b/source/blender/freestyle/intern/blender_interface/FRS_freestyle.cpp
index 9680e7d25a3..dbc0e94960a 100644
--- a/source/blender/freestyle/intern/blender_interface/FRS_freestyle.cpp
+++ b/source/blender/freestyle/intern/blender_interface/FRS_freestyle.cpp
@@ -116,7 +116,7 @@ void FRS_init()
 
   BKE_callback_add(&load_post_callback_funcstore, BKE_CB_EVT_LOAD_POST);
 
-  freestyle_is_initialized = 1;
+  freestyle_is_initialized = true;
 }
 
 void FRS_set_context(bContext *C)
diff --git a/source/blender/freestyle/intern/python/BPy_Convert.cpp b/source/blender/freestyle/intern/python/BPy_Convert.cpp
index 03f9760344b..29e90ee4ebc 100644
--- a/source/blender/freestyle/intern/python/BPy_Convert.cpp
+++ b/source/blender/freestyle/intern/python/BPy_Convert.cpp
@@ -648,10 +648,10 @@ static bool float_array_from_PyList(PyObject *obj, float *v, int n)
     v[i] = PyFloat_AsDouble(PyList_GET_ITEM(obj, i));
     if (v[i] == -1.0f && PyErr_Occurred()) {
       PyErr_SetString(PyExc_TypeError, "list elements must be a number");
-      return 0;
+      return false;
     }
   }
-  return 1;
+  return true;
 }
 
 bool Vec2f_ptr_from_PyList(PyObject *obj, Vec2f &vec)
@@ -707,10 +707,10 @@ static bool float_array_from_PyTuple(PyObject *obj, float *v, int n)
     v[i] = PyFloat_AsDouble(PyTuple_GET_ITEM(obj, i));
     if (v[i] == -1.0f && PyErr_Occurred()) {
       PyErr_SetString(PyExc_TypeError, "tuple elements must be a number");
-      return 0;
+      return false;
     }
   }
-  return 1;
+  return true;
 }
 
 bool Vec2f_ptr_from_PyTuple(PyObject *obj, Vec2f &vec)
@@ -766,21 +766,21 @@ bool float_array_from_PyObject(PyObject *obj, float *v, int n)
 {
   if (VectorObject_Check(obj) && ((VectorObject *)obj)->size == n) {
     if (BaseMath_ReadCallback((BaseMathObject *)obj) == -1) {
-      return 0;
+      return false;
     }
     for (int i = 0; i < n; i++) {
       v[i] = ((VectorObject *)obj)->vec[i];
     }
-    return 1;
+    return true;
   }
   if (ColorObject_Check(obj) && n == 3) {
     if (BaseMath_ReadCallback((BaseMathObject *)obj) == -1) {
-      return 0;
+      return false;
     }
     for (int i = 0; i < n; i++) {
       v[i] = ((ColorObject *)obj)->col[i];
     }
-    return 1;
+    return true;
   }
   if (PyList_Check(obj) && PyList_GET_SIZE(obj) == n) {
     return float_array_from_PyList(obj, v, n);
@@ -788,7 +788,7 @@ bool float_array_from_PyObject(PyObject *obj, float *v, int n)
   if (PyTuple_Check(obj) && PyTuple_GET_SIZE(obj) == n) {
     return float_array_from_PyTuple(obj, v, n);
   }
-  return 0;
+  return false;
 }
 
 int convert_v4(PyObject *obj, void *v)
diff --git a/source/blender/freestyle/intern/python/BPy_Freestyle.cpp b/source/blender/freestyle/intern/python/BPy_Freestyle.cpp
index 9796dcda964..631bdc8bc28 100644
--- a/source/blender/freestyle/intern/python/BPy_Freestyle.cpp
+++ b/source/blender/freestyle/intern/python/BPy_Freestyle.cpp
@@ -268,7 +268,7 @@ static PyObject *Freestyle_evaluateCurveMappingF(PyObject * /*self*/, PyObject *
   /* disable extrapolation if enabled */
   if ((cumap->flag & CUMA_EXTEND_EXTRAPOLATE)) {
     cumap->flag &= ~CUMA_EXTEND_EXTRAPOLATE;
-    BKE_curvemapping_changed(cumap, 0);
+    BKE_curvemapping_changed(cumap, false);
   }
   return PyFloat_FromDouble(BKE_curvemapping_evaluateF(cumap, cur, value));
 }
diff --git a/source/blender/freestyle/intern/python/BPy_FrsMaterial.cpp b/source/blender/freestyle/intern/python/BPy_FrsMaterial.cpp
index 3efabbfbdf5..bc994e7542c 100644
--- a/source/blender/freestyle/intern/python/BPy_FrsMaterial.cpp
+++ b/source/blender/freestyle/intern/python/BPy_FrsMaterial.cpp
@@ -495,7 +495,7 @@ static PyObject *BPy_FrsMaterial_richcmpr(PyObject *objectA,
                                           int comparison_type)
 {
   const BPy_FrsMaterial *matA = NULL, *matB = NULL;
-  bool result = 0;
+  bool result = false;
 
   if (!BPy_FrsMaterial_Check(objectA) || !BPy_FrsMaterial_Check(objectB)) {
     if (comparison_type == Py_NE) {
diff --git a/source/blender/gpu/intern/gpu_select_sample_query.cc b/source/blender/gpu/intern/gpu_select_sample_query.cc
index 5bbf3bd05d3..6ca811895a5 100644
--- a/source/blender/gpu/intern/gpu_select_sample_query.cc
+++ b/source/blender/gpu/intern/gpu_select_sample_query.cc
@@ -70,7 +70,7 @@ typedef struct GPUSelectQueryState {
   eGPUDepthTest depth_test;
 } GPUSelectQueryState;
 
-static GPUSelectQueryState g_query_state = {0};
+static GPUSelectQueryState g_query_state = {false};
 
 void gpu_select_query_begin(
     uint (*buffer)[4], uint bufsize, const rcti *input, char mode, int oldhits)
diff --git a/source/blender/ikplugin/intern/itasc_plugin.cpp b/source/blender/ikplugin/intern/itasc_plugin.cpp
index 3efb78fe1ca..fd671fabc1b 100644
--- a/source/blender/ikplugin/intern/itasc_plugin.cpp
+++ b/source/blender/ikplugin/intern/itasc_plugin.cpp
@@ -956,7 +956,7 @@ static int convert_channels(struct Depsgraph *depsgraph,
      * this is because some of the pose data (e.g. pose head) don't have corresponding
      * joint angles and can't be applied to the iTaSC armature dynamically */
     if (!(pchan->flag & POSE_DONE)) {
-      BKE_pose_where_is_bone(depsgraph, ikscene->blscene, ikscene->blArmature, pchan, ctime, 1);
+      BKE_pose_where_is_bone(depsgraph, ikscene->blscene, ikscene->blArmature, pchan, ctime, true);
     }
     /* tell blender that this channel was controlled by IK,
      * it's cleared on each BKE_pose_where_is() */
@@ -1720,7 +1720,8 @@ static void execute_scene(struct Depsgraph *depsgraph,
     /* in animation mode, we must get the bone position from action and constraints */
     for (i = 0, ikchan = ikscene->channels; i < ikscene->numchan; i++, ikchan++) {
       if (!(ikchan->pchan->flag & POSE_DONE)) {
-        BKE_pose_where_is_bone(depsgraph, blscene, ikscene->blArmature, ikchan->pchan, ctime, 1);
+        BKE_pose_where_is_bone(
+            depsgraph, blscene, ikscene->blArmature, ikchan->pchan, ctime, true);
       }
       /* tell blender that this channel was controlled by IK,
        * it's cleared on each BKE_pose_where_is() */
diff --git a/source/blender/imbuf/intern/openexr/openexr_api.cpp b/source/blender/imbuf/intern/openexr/openexr_api.cpp
index 08577f767e7..89be0a051c0 100644
--- a/source/blender/imbuf/intern/openexr/openexr_api.cpp
+++ b/source/blender/imbuf/intern/openexr/openexr_api.cpp
@@ -1918,7 +1918,7 @@ struct ImBuf *imb_load_openexr(const unsigned char *mem,
     // printf("OpenEXR-load: image data window %d %d %d %d\n",
     //     dw.min.x, dw.min.y, dw.max.x, dw.max.y);
 
-    if (0) { /* debug */
+    if (false) { /* debug */
       exr_print_filecontents(*file);
     }
 
diff --git a/source/blender/io/collada/AnimationImporter.cpp b/source/blender/io/collada/AnimationImporter.cpp
index 645a821b463..df81e638c68 100644
--- a/source/blender/io/collada/AnimationImporter.cpp
+++ b/source/blender/io/collada/AnimationImporter.cpp
@@ -355,7 +355,7 @@ void AnimationImporter::read_node_transform(COLLADAFW::Node *node, Object *ob)
   TransformReader::get_node_mat(mat, node, &uid_animated_map, ob);
   if (ob) {
     copy_m4_m4(ob->obmat, mat);
-    BKE_object_apply_mat4(ob, ob->obmat, 0, 0);
+    BKE_object_apply_mat4(ob, ob->obmat, false, false);
   }
 }
 
diff --git a/source/blender/io/collada/DocumentImporter.cpp b/source/blender/io/collada/DocumentImporter.cpp
index b9f132d04dd..f7f9bf3f2f9 100644
--- a/source/blender/io/collada/DocumentImporter.cpp
+++ b/source/blender/io/collada/DocumentImporter.cpp
@@ -438,7 +438,7 @@ Object *DocumentImporter::create_instance_node(Object *source_ob,
       }
       /* calc new matrix and apply */
       mul_m4_m4m4(obn->obmat, obn->obmat, mat);
-      BKE_object_apply_mat4(obn, obn->obmat, 0, 0);
+      BKE_object_apply_mat4(obn, obn->obmat, false, false);
     }
   }
   else {
diff --git a/source/blender/io/collada/SceneExporter.cpp b/source/blender/io/collada/SceneExporter.cpp
index 1b3bc1b66ea..b8de5bbd91e 100644
--- a/source/blender/io/collada/SceneExporter.cpp
+++ b/source/blender/io/collada/SceneExporter.cpp
@@ -222,7 +222,7 @@ vo

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list