From c93f826661334926fc15504243f61c85242bec42 Mon Sep 17 00:00:00 2001 From: Jacques Lucke Date: Wed, 9 Dec 2020 16:29:11 +0100 Subject: Cleanup: various clang tidy fixes --- source/blender/blenkernel/intern/mesh_validate.cc | 4 ++-- source/blender/blenlib/intern/task_pool.cc | 4 ++-- source/blender/compositor/intern/COM_NodeOperationBuilder.cpp | 2 +- source/blender/compositor/intern/COM_OpenCLDevice.cpp | 2 +- source/blender/compositor/operations/COM_DilateErodeOperation.cpp | 4 ++-- source/blender/compositor/operations/COM_GlareFogGlowOperation.cpp | 2 +- source/blender/compositor/operations/COM_VectorBlurOperation.cpp | 5 ++--- source/blender/depsgraph/intern/depsgraph_query_foreach.cc | 2 +- source/blender/depsgraph/intern/eval/deg_eval_flush.cc | 2 +- source/blender/editors/space_outliner/tree/tree_display_data.cc | 2 +- source/blender/editors/space_outliner/tree/tree_display_orphaned.cc | 2 +- source/blender/editors/space_outliner/tree/tree_display_scenes.cc | 4 ++-- .../blender/editors/space_outliner/tree/tree_display_sequencer.cc | 6 +++--- source/blender/editors/space_outliner/tree/tree_element.h | 2 +- source/blender/freestyle/intern/application/Controller.cpp | 2 +- source/blender/freestyle/intern/geometry/FitCurve.cpp | 2 +- source/blender/freestyle/intern/geometry/GeomCleaner.cpp | 2 +- source/blender/gpu/opengl/gl_debug_layer.cc | 2 +- source/blender/ikplugin/intern/itasc_plugin.cpp | 6 +++--- source/blender/imbuf/intern/dds/FlipDXT.cpp | 2 +- source/blender/imbuf/intern/oiio/openimageio_api.cpp | 2 +- source/blender/imbuf/intern/openexr/openexr_api.cpp | 2 +- source/blender/io/collada/collada_internal.cpp | 2 +- source/blender/simulation/intern/hair_volume.cpp | 4 ++-- 24 files changed, 34 insertions(+), 35 deletions(-) (limited to 'source/blender') diff --git a/source/blender/blenkernel/intern/mesh_validate.cc b/source/blender/blenkernel/intern/mesh_validate.cc index 16733729be0..0aaca33124a 100644 --- a/source/blender/blenkernel/intern/mesh_validate.cc +++ b/source/blender/blenkernel/intern/mesh_validate.cc @@ -76,10 +76,10 @@ struct OrderedEdge { }; /* The map first contains an edge pointer and later an index. */ -typedef union OrigEdgeOrIndex { +union OrigEdgeOrIndex { const MEdge *original_edge; int index; -} OrigEdgeOrIndex; +}; using EdgeMap = Map; static void reserve_hash_maps(const Mesh *mesh, diff --git a/source/blender/blenlib/intern/task_pool.cc b/source/blender/blenlib/intern/task_pool.cc index 142496dce20..dfed24da2d9 100644 --- a/source/blender/blenlib/intern/task_pool.cc +++ b/source/blender/blenlib/intern/task_pool.cc @@ -149,13 +149,13 @@ class TBBTaskGroup : public tbb::task_group { /* Task Pool */ -typedef enum TaskPoolType { +enum TaskPoolType { TASK_POOL_TBB, TASK_POOL_TBB_SUSPENDED, TASK_POOL_NO_THREADS, TASK_POOL_BACKGROUND, TASK_POOL_BACKGROUND_SERIAL, -} TaskPoolType; +}; struct TaskPool { TaskPoolType type; diff --git a/source/blender/compositor/intern/COM_NodeOperationBuilder.cpp b/source/blender/compositor/intern/COM_NodeOperationBuilder.cpp index 43928f6f915..35a3314db3b 100644 --- a/source/blender/compositor/intern/COM_NodeOperationBuilder.cpp +++ b/source/blender/compositor/intern/COM_NodeOperationBuilder.cpp @@ -304,7 +304,7 @@ void NodeOperationBuilder::add_operation_input_constants() /* Note: unconnected inputs cached first to avoid modifying * m_operations while iterating over it */ - typedef std::vector Inputs; + using Inputs = std::vector; Inputs pending_inputs; for (Operations::const_iterator it = m_operations.begin(); it != m_operations.end(); ++it) { NodeOperation *op = *it; diff --git a/source/blender/compositor/intern/COM_OpenCLDevice.cpp b/source/blender/compositor/intern/COM_OpenCLDevice.cpp index 51ae9d6652e..acfe800e433 100644 --- a/source/blender/compositor/intern/COM_OpenCLDevice.cpp +++ b/source/blender/compositor/intern/COM_OpenCLDevice.cpp @@ -19,7 +19,7 @@ #include "COM_OpenCLDevice.h" #include "COM_WorkScheduler.h" -typedef enum COM_VendorID { NVIDIA = 0x10DE, AMD = 0x1002 } COM_VendorID; +enum COM_VendorID { NVIDIA = 0x10DE, AMD = 0x1002 }; const cl_image_format IMAGE_FORMAT_COLOR = { CL_RGBA, CL_FLOAT, diff --git a/source/blender/compositor/operations/COM_DilateErodeOperation.cpp b/source/blender/compositor/operations/COM_DilateErodeOperation.cpp index 74f5fceacfb..b2dfb558028 100644 --- a/source/blender/compositor/operations/COM_DilateErodeOperation.cpp +++ b/source/blender/compositor/operations/COM_DilateErodeOperation.cpp @@ -330,11 +330,11 @@ void DilateStepOperation::initExecution() } // small helper to pass data from initializeTileData to executePixel -typedef struct tile_info { +struct tile_info { rcti rect; int width; float *buffer; -} tile_info; +}; static tile_info *create_cache(int xmin, int xmax, int ymin, int ymax) { diff --git a/source/blender/compositor/operations/COM_GlareFogGlowOperation.cpp b/source/blender/compositor/operations/COM_GlareFogGlowOperation.cpp index acc1dddacdd..362905761bb 100644 --- a/source/blender/compositor/operations/COM_GlareFogGlowOperation.cpp +++ b/source/blender/compositor/operations/COM_GlareFogGlowOperation.cpp @@ -23,7 +23,7 @@ * 2D Fast Hartley Transform, used for convolution */ -typedef float fREAL; +using fREAL = float; // returns next highest power of 2 of x, as well its log2 in L2 static unsigned int nextPow2(unsigned int x, unsigned int *L2) diff --git a/source/blender/compositor/operations/COM_VectorBlurOperation.cpp b/source/blender/compositor/operations/COM_VectorBlurOperation.cpp index 6254f93472e..f7b908deaf4 100644 --- a/source/blender/compositor/operations/COM_VectorBlurOperation.cpp +++ b/source/blender/compositor/operations/COM_VectorBlurOperation.cpp @@ -141,7 +141,7 @@ void VectorBlurOperation::generateVectorBlur(float *data, /* ****************** Spans ******************************* */ /* span fill in method, is also used to localize data for zbuffering */ -typedef struct ZSpan { +struct ZSpan { /* range for clipping */ int rectx, recty; @@ -157,8 +157,7 @@ typedef struct ZSpan { int *rectz; DrawBufPixel *rectdraw; float clipcrop; - -} ZSpan; +}; /* each zbuffer has coordinates transformed to local rect coordinates, so we can simply clip */ void zbuf_alloc_span(ZSpan *zspan, int rectx, int recty, float clipcrop) diff --git a/source/blender/depsgraph/intern/depsgraph_query_foreach.cc b/source/blender/depsgraph/intern/depsgraph_query_foreach.cc index 1c050edc386..6ce7cc0837b 100644 --- a/source/blender/depsgraph/intern/depsgraph_query_foreach.cc +++ b/source/blender/depsgraph/intern/depsgraph_query_foreach.cc @@ -47,7 +47,7 @@ namespace deg = blender::deg; namespace blender::deg { namespace { -typedef deque TraversalQueue; +using TraversalQueue = deque; using DEGForeachOperation = void (*)(OperationNode *, void *); diff --git a/source/blender/depsgraph/intern/eval/deg_eval_flush.cc b/source/blender/depsgraph/intern/eval/deg_eval_flush.cc index fa7cfb305ee..1b24e2b7ad2 100644 --- a/source/blender/depsgraph/intern/eval/deg_eval_flush.cc +++ b/source/blender/depsgraph/intern/eval/deg_eval_flush.cc @@ -82,7 +82,7 @@ enum { COMPONENT_STATE_DONE = 2, }; -typedef deque FlushQueue; +using FlushQueue = deque; namespace { diff --git a/source/blender/editors/space_outliner/tree/tree_display_data.cc b/source/blender/editors/space_outliner/tree/tree_display_data.cc index 41ca4f72903..8a5c2e7d9f3 100644 --- a/source/blender/editors/space_outliner/tree/tree_display_data.cc +++ b/source/blender/editors/space_outliner/tree/tree_display_data.cc @@ -41,7 +41,7 @@ ListBase TreeDisplayDataAPI::buildTree(const TreeSourceData &source_data) RNA_main_pointer_create(source_data.bmain, &mainptr); TreeElement *te = outliner_add_element( - &space_outliner_, &tree, (void *)&mainptr, NULL, TSE_RNA_STRUCT, -1); + &space_outliner_, &tree, (void *)&mainptr, nullptr, TSE_RNA_STRUCT, -1); /* On first view open parent data elements */ const int show_opened = !space_outliner_.treestore || diff --git a/source/blender/editors/space_outliner/tree/tree_display_orphaned.cc b/source/blender/editors/space_outliner/tree/tree_display_orphaned.cc index 71c1d344057..0b17ea98831 100644 --- a/source/blender/editors/space_outliner/tree/tree_display_orphaned.cc +++ b/source/blender/editors/space_outliner/tree/tree_display_orphaned.cc @@ -68,7 +68,7 @@ ListBase TreeDisplayIDOrphans::buildTree(const TreeSourceData &source_data) TreeElement *te = nullptr; if (!filter_id_type) { ID *id = (ID *)lbarray[a]->first; - te = outliner_add_element(&space_outliner_, &tree, lbarray[a], NULL, TSE_ID_BASE, 0); + te = outliner_add_element(&space_outliner_, &tree, lbarray[a], nullptr, TSE_ID_BASE, 0); te->directdata = lbarray[a]; te->name = outliner_idcode_to_plural(GS(id->name)); } diff --git a/source/blender/editors/space_outliner/tree/tree_display_scenes.cc b/source/blender/editors/space_outliner/tree/tree_display_scenes.cc index c4a5688504d..f377512d81e 100644 --- a/source/blender/editors/space_outliner/tree/tree_display_scenes.cc +++ b/source/blender/editors/space_outliner/tree/tree_display_scenes.cc @@ -46,7 +46,7 @@ ListBase TreeDisplayScenes::buildTree(const TreeSourceData &source_data) for (ID *id : List(source_data.bmain->scenes)) { Scene *scene = reinterpret_cast(id); - TreeElement *te = outliner_add_element(&space_outliner_, &tree, scene, NULL, 0, 0); + TreeElement *te = outliner_add_element(&space_outliner_, &tree, scene, nullptr, 0, 0); TreeStoreElem *tselem = TREESTORE(te); /* New scene elements open by default */ @@ -60,4 +60,4 @@ ListBase TreeDisplayScenes::buildTree(const TreeSourceData &source_data) return tree; } -} // namespace blender::ed::outliner \ No newline at end of file +} // namespace blender::ed::outliner diff --git a/source/blender/editors/space_outliner/tree/tree_display_sequencer.cc b/source/blender/editors/space_outliner/tree/tree_display_sequencer.cc index 486f735be9f..48f0322ccb9 100644 --- a/source/blender/editors/space_outliner/tree/tree_display_sequencer.cc +++ b/source/blender/editors/space_outliner/tree/tree_display_sequencer.cc @@ -18,7 +18,7 @@ * \ingroup spoutliner */ -#include +#include #include "BLI_listbase.h" #include "BLI_listbase_wrapper.hh" @@ -51,11 +51,11 @@ ListBase TreeDisplaySequencer::buildTree(const TreeSourceData &source_data) for (Sequence *seq : List(ed->seqbasep)) { SequenceAddOp op = need_add_seq_dup(seq); if (op == SEQUENCE_DUPLICATE_NONE) { - outliner_add_element(&space_outliner_, &tree, seq, NULL, TSE_SEQUENCE, 0); + outliner_add_element(&space_outliner_, &tree, seq, nullptr, TSE_SEQUENCE, 0); } else if (op == SEQUENCE_DUPLICATE_ADD) { TreeElement *te = outliner_add_element( - &space_outliner_, &tree, seq, NULL, TSE_SEQUENCE_DUP, 0); + &space_outliner_, &tree, seq, nullptr, TSE_SEQUENCE_DUP, 0); add_seq_dup(seq, te, 0); } } diff --git a/source/blender/editors/space_outliner/tree/tree_element.h b/source/blender/editors/space_outliner/tree/tree_element.h index 9012321a323..d88c37180b3 100644 --- a/source/blender/editors/space_outliner/tree/tree_element.h +++ b/source/blender/editors/space_outliner/tree/tree_element.h @@ -36,7 +36,7 @@ extern "C" { typedef struct TreeElementType TreeElementType; TreeElementType *outliner_tree_element_type_create(int type, TreeElement *legacy_te, void *idv); -void outliner_tree_element_type_free(TreeElementType **element); +void outliner_tree_element_type_free(TreeElementType **type); void outliner_tree_element_type_expand(TreeElementType *type, SpaceOutliner *space_outliner); diff --git a/source/blender/freestyle/intern/application/Controller.cpp b/source/blender/freestyle/intern/application/Controller.cpp index e24700a57d8..ddd11729e67 100644 --- a/source/blender/freestyle/intern/application/Controller.cpp +++ b/source/blender/freestyle/intern/application/Controller.cpp @@ -1067,7 +1067,7 @@ void Controller::displayDensityCurves(int x, int y) } unsigned int i, j; - typedef vector densityCurve; + using densityCurve = vector; vector curves(svm->getNumberOfOrientations() + 1); vector curvesDirection(svm->getNumberOfPyramidLevels()); diff --git a/source/blender/freestyle/intern/geometry/FitCurve.cpp b/source/blender/freestyle/intern/geometry/FitCurve.cpp index 66914929960..5768f88e95f 100644 --- a/source/blender/freestyle/intern/geometry/FitCurve.cpp +++ b/source/blender/freestyle/intern/geometry/FitCurve.cpp @@ -30,7 +30,7 @@ using namespace std; namespace Freestyle { -typedef Vector2 *BezierCurve; +using BezierCurve = Vector2 *; /* Forward declarations */ static double *Reparameterize(Vector2 *d, int first, int last, double *u, BezierCurve bezCurve); diff --git a/source/blender/freestyle/intern/geometry/GeomCleaner.cpp b/source/blender/freestyle/intern/geometry/GeomCleaner.cpp index 6a499c07061..7ec18fb2801 100644 --- a/source/blender/freestyle/intern/geometry/GeomCleaner.cpp +++ b/source/blender/freestyle/intern/geometry/GeomCleaner.cpp @@ -202,7 +202,7 @@ void GeomCleaner::CleanIndexedVertexArray(const float *iVertices, unsigned *oVSize, unsigned **oIndices) { - typedef map cleanHashTable; + using cleanHashTable = map; vector vertices; unsigned i; for (i = 0; i < iVSize; i += 3) { diff --git a/source/blender/gpu/opengl/gl_debug_layer.cc b/source/blender/gpu/opengl/gl_debug_layer.cc index 9c2b6c0e547..7d2abfb2cff 100644 --- a/source/blender/gpu/opengl/gl_debug_layer.cc +++ b/source/blender/gpu/opengl/gl_debug_layer.cc @@ -30,7 +30,7 @@ #include "gl_debug.hh" -typedef void *GPUvoidptr; +using GPUvoidptr = void *; #define GPUvoidptr_set void *ret = #define GPUvoidptr_ret return ret diff --git a/source/blender/ikplugin/intern/itasc_plugin.cpp b/source/blender/ikplugin/intern/itasc_plugin.cpp index c91da839d25..9512bce1914 100644 --- a/source/blender/ikplugin/intern/itasc_plugin.cpp +++ b/source/blender/ikplugin/intern/itasc_plugin.cpp @@ -76,9 +76,9 @@ struct IK_Data { using Vector3 = float[3]; using Vector4 = float[4]; struct IK_Target; -typedef void (*ErrorCallback)(const iTaSC::ConstraintValues *values, - unsigned int nvalues, - IK_Target *iktarget); +using ErrorCallback = void (*)(const iTaSC::ConstraintValues *values, + unsigned int nvalues, + IK_Target *iktarget); /* one structure for each target in the scene */ struct IK_Target { diff --git a/source/blender/imbuf/intern/dds/FlipDXT.cpp b/source/blender/imbuf/intern/dds/FlipDXT.cpp index e96b7891f1e..2acf072556a 100644 --- a/source/blender/imbuf/intern/dds/FlipDXT.cpp +++ b/source/blender/imbuf/intern/dds/FlipDXT.cpp @@ -45,7 +45,7 @@ #include /* A function that flips a DXTC block. */ -typedef void (*FlipBlockFunction)(uint8_t *block); +using FlipBlockFunction = void (*)(uint8_t *block); /* Flips a full DXT1 block in the y direction. */ static void FlipDXT1BlockFull(uint8_t *block) diff --git a/source/blender/imbuf/intern/oiio/openimageio_api.cpp b/source/blender/imbuf/intern/oiio/openimageio_api.cpp index 1e8c3c25778..65c25194477 100644 --- a/source/blender/imbuf/intern/oiio/openimageio_api.cpp +++ b/source/blender/imbuf/intern/oiio/openimageio_api.cpp @@ -48,7 +48,7 @@ OIIO_NAMESPACE_USING using std::string; using std::unique_ptr; -typedef unsigned char uchar; +using uchar = unsigned char; template static void fill_all_channels(T *pixels, int width, int height, int components, Q alpha) diff --git a/source/blender/imbuf/intern/openexr/openexr_api.cpp b/source/blender/imbuf/intern/openexr/openexr_api.cpp index 12faa48c81c..9726eaeed2c 100644 --- a/source/blender/imbuf/intern/openexr/openexr_api.cpp +++ b/source/blender/imbuf/intern/openexr/openexr_api.cpp @@ -322,7 +322,7 @@ struct _RGBAZ { half z; }; -typedef struct _RGBAZ RGBAZ; +using RGBAZ = _RGBAZ; extern "C" { diff --git a/source/blender/io/collada/collada_internal.cpp b/source/blender/io/collada/collada_internal.cpp index ed5cc62d05f..787af933e8f 100644 --- a/source/blender/io/collada/collada_internal.cpp +++ b/source/blender/io/collada/collada_internal.cpp @@ -205,7 +205,7 @@ const unsigned char translate_name_map[256] = { 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255, }; -typedef std::map> map_string_list; +using map_string_list = std::map>; map_string_list global_id_map; void clear_global_id_map() diff --git a/source/blender/simulation/intern/hair_volume.cpp b/source/blender/simulation/intern/hair_volume.cpp index 1b65dd8f22c..08af2344bc4 100644 --- a/source/blender/simulation/intern/hair_volume.cpp +++ b/source/blender/simulation/intern/hair_volume.cpp @@ -68,13 +68,13 @@ BLI_INLINE int hair_grid_size(const int res[3]) return res[0] * res[1] * res[2]; } -typedef struct HairGridVert { +struct HairGridVert { int samples; float velocity[3]; float density; float velocity_smooth[3]; -} HairGridVert; +}; struct HairGrid { HairGridVert *verts; -- cgit v1.2.3