Cleanup: various clang tidy fixes

This commit is contained in:
Jacques Lucke 2020-12-09 16:29:11 +01:00
parent 4a5f36638b
commit c93f826661
24 changed files with 34 additions and 35 deletions

View File

@ -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<OrderedEdge, OrigEdgeOrIndex>;
static void reserve_hash_maps(const Mesh *mesh,

View File

@ -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;

View File

@ -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<NodeOperationInput *> Inputs;
using Inputs = std::vector<NodeOperationInput *>;
Inputs pending_inputs;
for (Operations::const_iterator it = m_operations.begin(); it != m_operations.end(); ++it) {
NodeOperation *op = *it;

View File

@ -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,

View File

@ -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)
{

View File

@ -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)

View File

@ -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)

View File

@ -47,7 +47,7 @@ namespace deg = blender::deg;
namespace blender::deg {
namespace {
typedef deque<OperationNode *> TraversalQueue;
using TraversalQueue = deque<OperationNode *>;
using DEGForeachOperation = void (*)(OperationNode *, void *);

View File

@ -82,7 +82,7 @@ enum {
COMPONENT_STATE_DONE = 2,
};
typedef deque<OperationNode *> FlushQueue;
using FlushQueue = deque<OperationNode *>;
namespace {

View File

@ -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 ||

View File

@ -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));
}

View File

@ -46,7 +46,7 @@ ListBase TreeDisplayScenes::buildTree(const TreeSourceData &source_data)
for (ID *id : List<ID>(source_data.bmain->scenes)) {
Scene *scene = reinterpret_cast<Scene *>(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
} // namespace blender::ed::outliner

View File

@ -18,7 +18,7 @@
* \ingroup spoutliner
*/
#include <string.h>
#include <cstring>
#include "BLI_listbase.h"
#include "BLI_listbase_wrapper.hh"
@ -51,11 +51,11 @@ ListBase TreeDisplaySequencer::buildTree(const TreeSourceData &source_data)
for (Sequence *seq : List<Sequence>(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);
}
}

View File

@ -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);

View File

@ -1067,7 +1067,7 @@ void Controller::displayDensityCurves(int x, int y)
}
unsigned int i, j;
typedef vector<Vec3r> densityCurve;
using densityCurve = vector<Vec3r>;
vector<densityCurve> curves(svm->getNumberOfOrientations() + 1);
vector<densityCurve> curvesDirection(svm->getNumberOfPyramidLevels());

View File

@ -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);

View File

@ -202,7 +202,7 @@ void GeomCleaner::CleanIndexedVertexArray(const float *iVertices,
unsigned *oVSize,
unsigned **oIndices)
{
typedef map<Vec3f, unsigned> cleanHashTable;
using cleanHashTable = map<Vec3f, unsigned>;
vector<Vec3f> vertices;
unsigned i;
for (i = 0; i < iVSize; i += 3) {

View File

@ -30,7 +30,7 @@
#include "gl_debug.hh"
typedef void *GPUvoidptr;
using GPUvoidptr = void *;
#define GPUvoidptr_set void *ret =
#define GPUvoidptr_ret return ret

View File

@ -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 {

View File

@ -45,7 +45,7 @@
#include <Stream.h>
/* 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)

View File

@ -48,7 +48,7 @@ OIIO_NAMESPACE_USING
using std::string;
using std::unique_ptr;
typedef unsigned char uchar;
using uchar = unsigned char;
template<class T, class Q>
static void fill_all_channels(T *pixels, int width, int height, int components, Q alpha)

View File

@ -322,7 +322,7 @@ struct _RGBAZ {
half z;
};
typedef struct _RGBAZ RGBAZ;
using RGBAZ = _RGBAZ;
extern "C" {

View File

@ -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<std::string, std::vector<std::string>> map_string_list;
using map_string_list = std::map<std::string, std::vector<std::string>>;
map_string_list global_id_map;
void clear_global_id_map()

View File

@ -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;