Commit: 2652029f3beee160695194b825a4c0c11dd9f680
Author: Hans Goudey
Date:   Thu Dec 29 12:01:32 2022 -0500
Branches: master
https://developer.blender.org/rB2652029f3beee160695194b825a4c0c11dd9f680

Cleanup: Clang tidy

Addressed almost all warnings except for replacing defines
with enums and variable assignment in if statements.

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

M       source/blender/blendthumb/src/blender_thumbnailer.cc
M       source/blender/blenkernel/intern/data_transfer.cc
M       source/blender/blenkernel/intern/key.cc
M       source/blender/blenkernel/intern/layer.cc
M       source/blender/blenkernel/intern/linestyle.cc
M       source/blender/blenkernel/intern/material.cc
M       source/blender/blenkernel/intern/mesh_legacy_convert.cc
M       source/blender/blenkernel/intern/mesh_mirror.cc
M       source/blender/blenkernel/intern/multires.cc
M       source/blender/blenkernel/intern/object_dupli.cc
M       source/blender/blenkernel/intern/pbvh_uv_islands.cc
M       source/blender/blenkernel/intern/pbvh_uv_islands.hh
M       source/blender/blenkernel/intern/shrinkwrap.cc
M       source/blender/blenkernel/intern/texture.cc
M       source/blender/blenlib/BLI_blenlib.h
M       source/blender/blenlib/intern/listbase.cc
M       source/blender/blenloader/intern/undofile.cc
M       source/blender/draw/engines/overlay/overlay_shader.cc
M       source/blender/draw/intern/draw_cache_impl_gpencil.cc
M       source/blender/editors/gpencil/gpencil_fill.c
M       source/blender/editors/interface/interface_handlers.cc
M       source/blender/editors/interface/interface_icons.cc
M       source/blender/editors/interface/interface_layout.cc
M       source/blender/editors/interface/interface_query.cc
M       source/blender/editors/interface/interface_style.cc
M       source/blender/editors/interface/interface_templates.cc
M       source/blender/editors/interface/interface_undo.cc
M       source/blender/editors/interface/interface_widgets.cc
M       source/blender/editors/sculpt_paint/paint_cursor.cc
M       source/blender/editors/sculpt_paint/paint_image_proj.cc
M       source/blender/editors/space_buttons/buttons_texture.cc
M       source/blender/editors/space_clip/tracking_ops_orient.cc
M       source/blender/editors/space_file/filelist.cc
M       source/blender/editors/space_node/node_draw.cc
M       source/blender/editors/space_outliner/outliner_ops.cc
M       source/blender/editors/transform/transform_snap.cc
M       source/blender/editors/util/ed_util.c
M       source/blender/freestyle/intern/python/BPy_ContextFunctions.cpp
M       source/blender/freestyle/intern/python/BPy_Freestyle.cpp
M       source/blender/freestyle/intern/python/BPy_IntegrationType.cpp
M       source/blender/freestyle/intern/python/BPy_Nature.cpp
M       source/blender/gpencil_modifiers/intern/lineart/MOD_lineart.h
M       source/blender/gpencil_modifiers/intern/lineart/lineart_cpu.cc
M       source/blender/gpu/GPU_texture.h
M       source/blender/gpu/intern/gpu_node_graph.cc
M       source/blender/gpu/intern/gpu_node_graph.h
M       source/blender/gpu/opengl/gl_state.cc
M       source/blender/gpu/opengl/gl_texture.cc
M       source/blender/imbuf/IMB_thumbs.h
M       source/blender/makesrna/intern/rna_ui_api.c
M       source/blender/makesrna/intern/rna_wm_gizmo_api.c
M       source/blender/modifiers/intern/MOD_displace.cc
M       source/blender/modifiers/intern/MOD_screw.cc
M       source/blender/modifiers/intern/MOD_triangulate.cc
M       source/blender/modifiers/intern/MOD_util.cc
M       source/blender/nodes/intern/geometry_nodes_lazy_function.cc
M       source/blender/nodes/intern/node_util.cc
M       source/blender/nodes/texture/node_texture_tree.cc
M       source/blender/nodes/texture/nodes/node_texture_at.cc
M       source/blender/nodes/texture/nodes/node_texture_bricks.cc
M       source/blender/nodes/texture/nodes/node_texture_checker.cc
M       source/blender/nodes/texture/nodes/node_texture_combine_color.cc
M       source/blender/nodes/texture/nodes/node_texture_compose.cc
M       source/blender/nodes/texture/nodes/node_texture_coord.cc
M       source/blender/nodes/texture/nodes/node_texture_curves.cc
M       source/blender/nodes/texture/nodes/node_texture_decompose.cc
M       source/blender/nodes/texture/nodes/node_texture_hueSatVal.cc
M       source/blender/nodes/texture/nodes/node_texture_image.cc
M       source/blender/nodes/texture/nodes/node_texture_invert.cc
M       source/blender/nodes/texture/nodes/node_texture_math.cc
M       source/blender/nodes/texture/nodes/node_texture_rotate.cc
M       source/blender/nodes/texture/nodes/node_texture_scale.cc
M       source/blender/nodes/texture/nodes/node_texture_separate_color.cc
M       source/blender/render/intern/bake.cc
M       source/blender/render/intern/engine.cc
M       source/blender/render/intern/multires_bake.cc
M       source/blender/windowmanager/intern/wm_keymap.c

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

diff --git a/source/blender/blendthumb/src/blender_thumbnailer.cc 
b/source/blender/blendthumb/src/blender_thumbnailer.cc
index 93a3d1530fc..807878c8233 100644
--- a/source/blender/blendthumb/src/blender_thumbnailer.cc
+++ b/source/blender/blendthumb/src/blender_thumbnailer.cc
@@ -73,7 +73,7 @@ static eThumbStatus extract_png_from_blend_file(const char 
*src_blend, const cha
 
   std::optional<blender::Vector<uint8_t>> png_buf_opt = 
blendthumb_create_png_data_from_thumb(
       &thumb);
-  if (png_buf_opt == std::nullopt) {
+  if (!png_buf_opt) {
     err = BT_ERROR;
   }
   else {
diff --git a/source/blender/blenkernel/intern/data_transfer.cc 
b/source/blender/blenkernel/intern/data_transfer.cc
index 2c9ff52e0a4..4220d106095 100644
--- a/source/blender/blenkernel/intern/data_transfer.cc
+++ b/source/blender/blenkernel/intern/data_transfer.cc
@@ -1258,7 +1258,7 @@ bool BKE_object_data_transfer_ex(struct Depsgraph 
*depsgraph,
   float *weights[DATAMAX] = {nullptr};
 
   MeshPairRemap geom_map[DATAMAX] = {{0}};
-  bool geom_map_init[DATAMAX] = {0};
+  bool geom_map_init[DATAMAX] = {false};
   ListBase lay_map = {nullptr};
   bool changed = false;
   bool is_modifier = false;
diff --git a/source/blender/blenkernel/intern/key.cc 
b/source/blender/blenkernel/intern/key.cc
index 388dcff5229..e0af320ac48 100644
--- a/source/blender/blenkernel/intern/key.cc
+++ b/source/blender/blenkernel/intern/key.cc
@@ -5,9 +5,9 @@
  * \ingroup bke
  */
 
-#include <math.h>
-#include <stddef.h>
-#include <string.h>
+#include <cmath>
+#include <cstddef>
+#include <cstring>
 
 #include "MEM_guardedalloc.h"
 
@@ -231,10 +231,10 @@ IDTypeInfo IDType_ID_KE = {
 #define KEY_MODE_BEZTRIPLE 2
 
 /* Internal use only. */
-typedef struct WeightsArrayCache {
+struct WeightsArrayCache {
   int num_defgroup_weights;
   float **defgroup_weights;
-} WeightsArrayCache;
+};
 
 void BKE_key_free_data(Key *key)
 {
diff --git a/source/blender/blenkernel/intern/layer.cc 
b/source/blender/blenkernel/intern/layer.cc
index 971cf85812a..198ad5b196f 100644
--- a/source/blender/blenkernel/intern/layer.cc
+++ b/source/blender/blenkernel/intern/layer.cc
@@ -7,7 +7,7 @@
 /* Allow using deprecated functionality for .blend file I/O. */
 #define DNA_DEPRECATED_ALLOW
 
-#include <string.h>
+#include <cstring>
 
 #include "CLG_log.h"
 
@@ -400,7 +400,7 @@ void BKE_view_layer_base_deselect_all(const Scene *scene, 
ViewLayer *view_layer)
   }
 }
 
-void BKE_view_layer_base_select_and_set_active(struct ViewLayer *view_layer, 
Base *selbase)
+void BKE_view_layer_base_select_and_set_active(ViewLayer *view_layer, Base 
*selbase)
 {
   view_layer->basact = selbase;
   if ((selbase->flag & BASE_SELECTABLE) != 0) {
@@ -780,12 +780,12 @@ void BKE_layer_collection_resync_allow(void)
   no_resync = false;
 }
 
-typedef struct LayerCollectionResync {
-  struct LayerCollectionResync *prev, *next;
+struct LayerCollectionResync {
+  LayerCollectionResync *prev, *next;
 
   /* Temp data used to generate a queue during valid layer search. See
    * #layer_collection_resync_find. */
-  struct LayerCollectionResync *queue_next;
+  LayerCollectionResync *queue_next;
 
   /* LayerCollection and Collection wrapped by this data. */
   LayerCollection *layer;
@@ -793,7 +793,7 @@ typedef struct LayerCollectionResync {
 
   /* Hierarchical relationships in the old, existing ViewLayer state (except 
for newly created
    * layers). */
-  struct LayerCollectionResync *parent_layer_resync;
+  LayerCollectionResync *parent_layer_resync;
   ListBase children_layer_resync;
 
   /* This layer still points to a valid collection. */
@@ -809,7 +809,7 @@ typedef struct LayerCollectionResync {
    * OR
    * This layer has already been re-used to match the new collections 
hierarchy. */
   bool is_used;
-} LayerCollectionResync;
+};
 
 static LayerCollectionResync *layer_collection_resync_create_recurse(
     LayerCollectionResync *parent_layer_resync, LayerCollection *layer, 
BLI_mempool *mempool)
@@ -969,12 +969,12 @@ static void 
layer_collection_resync_unused_layers_free(ViewLayer *view_layer,
   }
 }
 
-void BKE_view_layer_need_resync_tag(struct ViewLayer *view_layer)
+void BKE_view_layer_need_resync_tag(ViewLayer *view_layer)
 {
   view_layer->flag |= VIEW_LAYER_OUT_OF_SYNC;
 }
 
-void BKE_view_layer_synced_ensure(const Scene *scene, struct ViewLayer 
*view_layer)
+void BKE_view_layer_synced_ensure(const Scene *scene, ViewLayer *view_layer)
 {
   if (view_layer->flag & VIEW_LAYER_OUT_OF_SYNC) {
     BKE_layer_collection_sync(scene, view_layer);
@@ -1599,7 +1599,7 @@ bool BKE_base_is_visible(const View3D *v3d, const Base 
*base)
   return base->flag & BASE_ENABLED_AND_VISIBLE_IN_DEFAULT_VIEWPORT;
 }
 
-bool BKE_object_is_visible_in_viewport(const View3D *v3d, const struct Object 
*ob)
+bool BKE_object_is_visible_in_viewport(const View3D *v3d, const Object *ob)
 {
   BLI_assert(v3d != nullptr);
 
@@ -1988,10 +1988,10 @@ bool BKE_scene_has_object(Scene *scene, Object *ob)
 /** \name Private Iterator Helpers
  * \{ */
 
-typedef struct LayerObjectBaseIteratorData {
+struct LayerObjectBaseIteratorData {
   const View3D *v3d;
   Base *base;
-} LayerObjectBaseIteratorData;
+};
 
 static bool object_bases_iterator_is_valid(const View3D *v3d, Base *base, 
const int flag)
 {
@@ -2207,7 +2207,7 @@ void 
BKE_view_layer_visible_bases_iterator_end(BLI_Iterator *iter)
 /** \name BKE_view_layer_bases_in_mode_iterator
  * \{ */
 
-static bool base_is_in_mode(struct ObjectsInModeIteratorData *data, Base *base)
+static bool base_is_in_mode(ObjectsInModeIteratorData *data, Base *base)
 {
   return (base->object->type == data->object_type) &&
          (base->object->mode & data->object_mode) != 0;
@@ -2215,7 +2215,7 @@ static bool base_is_in_mode(struct 
ObjectsInModeIteratorData *data, Base *base)
 
 void BKE_view_layer_bases_in_mode_iterator_begin(BLI_Iterator *iter, void 
*data_in)
 {
-  struct ObjectsInModeIteratorData *data = 
static_cast<ObjectsInModeIteratorData *>(data_in);
+  ObjectsInModeIteratorData *data = static_cast<ObjectsInModeIteratorData 
*>(data_in);
   Base *base = data->base_active;
 
   /* In this case the result will always be empty, the caller must check for 
no mode. */
@@ -2241,7 +2241,7 @@ void 
BKE_view_layer_bases_in_mode_iterator_begin(BLI_Iterator *iter, void *data_
 
 void BKE_view_layer_bases_in_mode_iterator_next(BLI_Iterator *iter)
 {
-  struct ObjectsInModeIteratorData *data = 
static_cast<ObjectsInModeIteratorData *>(iter->data);
+  ObjectsInModeIteratorData *data = static_cast<ObjectsInModeIteratorData 
*>(iter->data);
   Base *base = static_cast<Base *>(iter->current);
 
   if (base == data->base_active) {
@@ -2309,9 +2309,7 @@ void BKE_base_eval_flags(Base *base)
   }
 }
 
-static void layer_eval_view_layer(struct Depsgraph *depsgraph,
-                                  struct Scene *scene,
-                                  ViewLayer *view_layer)
+static void layer_eval_view_layer(Depsgraph *depsgraph, Scene *scene, 
ViewLayer *view_layer)
 {
   DEG_debug_print_eval(depsgraph, __func__, view_layer->name, view_layer);
 
@@ -2327,9 +2325,7 @@ static void layer_eval_view_layer(struct Depsgraph 
*depsgraph,
   }
 }
 
-void BKE_layer_eval_view_layer_indexed(struct Depsgraph *depsgraph,
-                                       struct Scene *scene,
-                                       int view_layer_index)
+void BKE_layer_eval_view_layer_indexed(Depsgraph *depsgraph, Scene *scene, int 
view_layer_index)
 {
   BLI_assert(view_layer_index >= 0);
   ViewLayer *view_layer = static_cast<ViewLayer *>(
@@ -2502,7 +2498,7 @@ static void viewlayer_aov_active_set(ViewLayer 
*view_layer, ViewLayerAOV *aov)
   }
 }
 
-struct ViewLayerAOV *BKE_view_layer_add_aov(struct ViewLayer *view_layer)
+ViewLayerAOV *BKE_view_layer_add_aov(ViewLayer *view_layer)
 {
   ViewLayerAOV *aov;
   aov = MEM_cnew<ViewLayerAOV>(__func__);
@@ -2557,9 +2553,7 @@ static void bke_view_layer_verify_aov_cb(void *userdata,
   }
 }
 
-void BKE_view_layer_verify_aov(struct RenderEngine *engine,
-                               struct Scene *scene,
-                               struct ViewLayer *view_layer)
+void BKE_view_layer_verify_aov(RenderEngine *engine, Scene *scene, ViewLayer 
*view_layer)
 {
   viewlayer_aov_make_name_unique(view_layer);
 
@@ -2584,7 +2578,7 @@ bool BKE_view_layer_has_valid_aov(ViewLayer *view_layer)
   return false;
 }
 
-ViewLayer *BKE_view_layer_find_with_aov(struct Scene *scene, struct 
ViewLayerAOV *aov)
+ViewLayer *BKE_view_layer_find_with_aov(Scene *scene, ViewLayerAOV *aov)
 {
   LISTBASE_FOREACH (ViewLayer *, view_layer, &scene->view_layers) {
     if (BLI_findindex(&view_layer->aovs, aov) != -1) {
@@ -2625,8 +2619,7 @@ static void viewlayer_lightgroup_active_set(ViewLayer 
*view_layer, ViewLayerLigh
   }
 }
 
-struct ViewLayerLightgroup *BKE_view_layer_add_lightgroup(struct ViewLayer 
*view_layer,
-                                                          const char *name)
+ViewLayerLightgroup *BKE_view_layer_add_lightgroup(ViewLayer *view_layer, 
const char *name)
 {
   ViewLayerLightgroup *lightgroup;
   lightgroup = MEM_cnew<ViewLayerLightgroup>(__func__);
@@ -2662,8 +2655,7 @@ void BKE_view_layer_set_active_lightgroup(ViewLayer 
*view_layer, ViewLayerLightg
   viewlayer_lightgroup_active_set(view_layer, lightgroup);
 }
 
-ViewLayer *BKE_view_layer_find_with_lightgroup(struct Scene *scene,
-                                               struct ViewLayerLightgroup 
*lightgroup)
+ViewLayer *BKE_view_layer_find_with_lightgroup(Scene *scene, 
ViewLayerLightgroup *lightgroup)
 {
   LISTBASE_FOREACH (ViewLayer *, view_layer, &scene->view_layers) {
     if (BLI_findindex(&view_layer->lightgroups, lightgroup) != -1) {
@@ -2706,7 +2698,7 @@ void BKE_view_layer_rename_lightgroup(Scene *scene,
   }
 }
 
-void BKE_lightgroup_membership_get(struct LightgroupMembership *lgm, char 
*name)
+void BKE_lightgroup_membership_get(LightgroupMembership *lgm, char *name)
 {
   if (lgm != nullptr) {
     BLI_strncpy(name, lgm->name, sizeof(lgm->name));
@@ -2716,7 +2708,7 @@ void BKE_lightgroup_membership_get(struct 
LightgroupMembership *lgm, char *name)
   }
 }
 
-int BKE_lightgroup_membership_length(struct LightgroupMembership *lgm)
+int BKE_lightgroup_membership_length(LightgroupM

@@ Diff output truncated at 10240 characters. @@

_______________________________________________
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
List details, subscription details or unsubscribe:
https://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to