Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSybren A. Stüvel <sybren@blender.org>2020-12-04 14:46:43 +0300
committerSybren A. Stüvel <sybren@blender.org>2020-12-04 14:46:43 +0300
commit7f2d356a672d838c90cf47e9ff4006b15c104148 (patch)
treea87f8056750bc810f1430d03c14e8c93e170f3fd /source/blender
parent10a8286a267d1796983f321dd01668d6072570ed (diff)
Cleanup: Clang-Tidy, modernize-use-using
Replace `typedef` with `using` in C++ code. In the case of `typedef struct SomeName { ... } SomeName;` I removed the `typedef` altogether, as this is unnecessary in C++. Such cases have been rewritten to `struct SomeName { ... };` No functional changes.
Diffstat (limited to 'source/blender')
-rw-r--r--source/blender/blenlib/intern/threads.cc4
-rw-r--r--source/blender/blenlib/tests/BLI_array_store_test.cc8
-rw-r--r--source/blender/compositor/intern/COM_NodeOperationBuilder.cpp2
-rw-r--r--source/blender/compositor/operations/COM_VectorBlurOperation.cpp4
-rw-r--r--source/blender/depsgraph/intern/depsgraph_query_foreach.cc2
-rw-r--r--source/blender/freestyle/intern/view_map/ViewMapBuilder.cpp4
-rw-r--r--source/blender/gpu/intern/gpu_matrix.cc12
-rw-r--r--source/blender/gpu/intern/gpu_select_sample_query.cc4
-rw-r--r--source/blender/gpu/opengl/gl_drawlist.cc8
-rw-r--r--source/blender/ikplugin/intern/itasc_plugin.cpp4
-rw-r--r--source/blender/imbuf/intern/openexr/openexr_api.cpp16
-rw-r--r--source/blender/simulation/intern/hair_volume.cpp4
12 files changed, 36 insertions, 36 deletions
diff --git a/source/blender/blenlib/intern/threads.cc b/source/blender/blenlib/intern/threads.cc
index 0586c361350..0b88cf53442 100644
--- a/source/blender/blenlib/intern/threads.cc
+++ b/source/blender/blenlib/intern/threads.cc
@@ -132,13 +132,13 @@ static int num_threads_override = 0;
/* just a max for security reasons */
#define RE_MAX_THREAD BLENDER_MAX_THREADS
-typedef struct ThreadSlot {
+struct ThreadSlot {
struct ThreadSlot *next, *prev;
void *(*do_thread)(void *);
void *callerdata;
pthread_t pthread;
int avail;
-} ThreadSlot;
+};
void BLI_threadapi_init(void)
{
diff --git a/source/blender/blenlib/tests/BLI_array_store_test.cc b/source/blender/blenlib/tests/BLI_array_store_test.cc
index ff050ce24db..8bbd109fb81 100644
--- a/source/blender/blenlib/tests/BLI_array_store_test.cc
+++ b/source/blender/blenlib/tests/BLI_array_store_test.cc
@@ -32,11 +32,11 @@ static void print_mem_saved(const char *id, const BArrayStore *bs)
/* -------------------------------------------------------------------- */
/* Test Chunks (building data from list of chunks) */
-typedef struct TestChunk {
+struct TestChunk {
struct TestChunk *next, *prev;
const void *data;
size_t data_len;
-} TestChunk;
+};
static TestChunk *testchunk_list_add(ListBase *lb, const void *data, size_t data_len)
{
@@ -111,14 +111,14 @@ static char *testchunk_as_data_array(TestChunk **tc_array, int tc_array_len, siz
/* Test Buffer */
/* API to handle local allocation of data so we can compare it with the data in the array_store */
-typedef struct TestBuffer {
+struct TestBuffer {
struct TestBuffer *next, *prev;
const void *data;
size_t data_len;
/* for reference */
BArrayState *state;
-} TestBuffer;
+};
static TestBuffer *testbuffer_list_add(ListBase *lb, const void *data, size_t data_len)
{
diff --git a/source/blender/compositor/intern/COM_NodeOperationBuilder.cpp b/source/blender/compositor/intern/COM_NodeOperationBuilder.cpp
index 1237e728079..43928f6f915 100644
--- a/source/blender/compositor/intern/COM_NodeOperationBuilder.cpp
+++ b/source/blender/compositor/intern/COM_NodeOperationBuilder.cpp
@@ -597,7 +597,7 @@ void NodeOperationBuilder::add_complex_operation_buffers()
}
}
-typedef std::set<NodeOperation *> Tags;
+using Tags = std::set<NodeOperation *>;
static void find_reachable_operations_recursive(Tags &reachable, NodeOperation *op)
{
diff --git a/source/blender/compositor/operations/COM_VectorBlurOperation.cpp b/source/blender/compositor/operations/COM_VectorBlurOperation.cpp
index d3f59ffcb15..6254f93472e 100644
--- a/source/blender/compositor/operations/COM_VectorBlurOperation.cpp
+++ b/source/blender/compositor/operations/COM_VectorBlurOperation.cpp
@@ -294,10 +294,10 @@ static void zbuf_add_to_span(ZSpan *zspan, const float v1[2], const float v2[2])
/* ******************** VECBLUR ACCUM BUF ************************* */
-typedef struct DrawBufPixel {
+struct DrawBufPixel {
const float *colpoin;
float alpha;
-} DrawBufPixel;
+};
static void zbuf_fill_in_rgba(
ZSpan *zspan, DrawBufPixel *col, float *v1, float *v2, float *v3, float *v4)
diff --git a/source/blender/depsgraph/intern/depsgraph_query_foreach.cc b/source/blender/depsgraph/intern/depsgraph_query_foreach.cc
index ed7011ba306..1c050edc386 100644
--- a/source/blender/depsgraph/intern/depsgraph_query_foreach.cc
+++ b/source/blender/depsgraph/intern/depsgraph_query_foreach.cc
@@ -49,7 +49,7 @@ namespace {
typedef deque<OperationNode *> TraversalQueue;
-typedef void (*DEGForeachOperation)(OperationNode *op_node, void *user_data);
+using DEGForeachOperation = void (*)(OperationNode *, void *);
bool deg_foreach_needs_visit(const OperationNode *op_node, const int flags)
{
diff --git a/source/blender/freestyle/intern/view_map/ViewMapBuilder.cpp b/source/blender/freestyle/intern/view_map/ViewMapBuilder.cpp
index 54f4da7ca40..cbb5c730b2b 100644
--- a/source/blender/freestyle/intern/view_map/ViewMapBuilder.cpp
+++ b/source/blender/freestyle/intern/view_map/ViewMapBuilder.cpp
@@ -2299,8 +2299,8 @@ struct less_SVertex2D {
}
};
-typedef Segment<FEdge *, Vec3r> segment;
-typedef Intersection<segment> intersection;
+using segment = Segment<FEdge *, Vec3r>;
+using intersection = Intersection<segment>;
struct less_Intersection {
segment *edge;
diff --git a/source/blender/gpu/intern/gpu_matrix.cc b/source/blender/gpu/intern/gpu_matrix.cc
index dae56e39db6..4ccb28fedbd 100644
--- a/source/blender/gpu/intern/gpu_matrix.cc
+++ b/source/blender/gpu/intern/gpu_matrix.cc
@@ -39,15 +39,15 @@ using namespace blender::gpu;
#define MATRIX_STACK_DEPTH 32
-typedef float Mat4[4][4];
-typedef float Mat3[3][3];
+using Mat4 = float[4][4];
+using Mat3 = float[3][3];
-typedef struct MatrixStack {
+struct MatrixStack {
Mat4 stack[MATRIX_STACK_DEPTH];
uint top;
-} MatrixStack;
+};
-typedef struct GPUMatrixState {
+struct GPUMatrixState {
MatrixStack model_view_stack;
MatrixStack projection_stack;
@@ -59,7 +59,7 @@ typedef struct GPUMatrixState {
* TODO: separate Model from View transform? Batches/objects have model,
* camera/eye has view & projection
*/
-} GPUMatrixState;
+};
#define ModelViewStack Context::get()->matrix_state->model_view_stack
#define ModelView ModelViewStack.stack[ModelViewStack.top]
diff --git a/source/blender/gpu/intern/gpu_select_sample_query.cc b/source/blender/gpu/intern/gpu_select_sample_query.cc
index 74506232655..5d8689c0d6a 100644
--- a/source/blender/gpu/intern/gpu_select_sample_query.cc
+++ b/source/blender/gpu/intern/gpu_select_sample_query.cc
@@ -47,7 +47,7 @@
using namespace blender;
using namespace blender::gpu;
-typedef struct GPUSelectQueryState {
+struct GPUSelectQueryState {
/* Tracks whether a query has been issued so that gpu_load_id can end the previous one */
bool query_issued;
/* GPU queries abstraction. Contains an array of queries. */
@@ -68,7 +68,7 @@ typedef struct GPUSelectQueryState {
int scissor[4];
eGPUWriteMask write_mask;
eGPUDepthTest depth_test;
-} GPUSelectQueryState;
+};
static GPUSelectQueryState g_query_state = {false};
diff --git a/source/blender/gpu/opengl/gl_drawlist.cc b/source/blender/gpu/opengl/gl_drawlist.cc
index c374a7bdc9d..f0a18deafd3 100644
--- a/source/blender/gpu/opengl/gl_drawlist.cc
+++ b/source/blender/gpu/opengl/gl_drawlist.cc
@@ -43,20 +43,20 @@
using namespace blender::gpu;
-typedef struct GLDrawCommand {
+struct GLDrawCommand {
GLuint v_count;
GLuint i_count;
GLuint v_first;
GLuint i_first;
-} GLDrawCommand;
+};
-typedef struct GLDrawCommandIndexed {
+struct GLDrawCommandIndexed {
GLuint v_count;
GLuint i_count;
GLuint v_first;
GLuint base_index;
GLuint i_first;
-} GLDrawCommandIndexed;
+};
#define MDI_ENABLED (buffer_size_ != 0)
#define MDI_DISABLED (buffer_size_ == 0)
diff --git a/source/blender/ikplugin/intern/itasc_plugin.cpp b/source/blender/ikplugin/intern/itasc_plugin.cpp
index 6846a09f57b..7047b6f3727 100644
--- a/source/blender/ikplugin/intern/itasc_plugin.cpp
+++ b/source/blender/ikplugin/intern/itasc_plugin.cpp
@@ -73,8 +73,8 @@ struct IK_Data {
struct IK_Scene *first;
};
-typedef float Vector3[3];
-typedef float Vector4[4];
+using Vector3 = float[3];
+using Vector4 = float[4];
struct IK_Target;
typedef void (*ErrorCallback)(const iTaSC::ConstraintValues *values,
unsigned int nvalues,
diff --git a/source/blender/imbuf/intern/openexr/openexr_api.cpp b/source/blender/imbuf/intern/openexr/openexr_api.cpp
index cb933062d37..087e001b0b3 100644
--- a/source/blender/imbuf/intern/openexr/openexr_api.cpp
+++ b/source/blender/imbuf/intern/openexr/openexr_api.cpp
@@ -620,7 +620,7 @@ bool imb_save_openexr(struct ImBuf *ibuf, const char *name, int flags)
static ListBase exrhandles = {nullptr, nullptr};
-typedef struct ExrHandle {
+struct ExrHandle {
struct ExrHandle *next, *prev;
char name[FILE_MAX];
@@ -645,10 +645,10 @@ typedef struct ExrHandle {
ListBase layers; /* hierarchical, pointing in end to ExrChannel */
int num_half_channels; /* used during filr save, allows faster temporary buffers allocation */
-} ExrHandle;
+};
/* flattened out channel */
-typedef struct ExrChannel {
+struct ExrChannel {
struct ExrChannel *next, *prev;
char name[EXR_TOT_MAXNAME + 1]; /* full name with everything */
@@ -658,10 +658,10 @@ typedef struct ExrChannel {
char chan_id; /* quick lookup of channel char */
int view_id; /* quick lookup of channel view */
bool use_half_float; /* when saving use half float for file storage */
-} ExrChannel;
+};
/* hierarchical; layers -> passes -> channels[] */
-typedef struct ExrPass {
+struct ExrPass {
struct ExrPass *next, *prev;
char name[EXR_PASS_MAXNAME];
int totchan;
@@ -672,13 +672,13 @@ typedef struct ExrPass {
char internal_name[EXR_PASS_MAXNAME]; /* name with no view */
char view[EXR_VIEW_MAXNAME];
int view_id;
-} ExrPass;
+};
-typedef struct ExrLayer {
+struct ExrLayer {
struct ExrLayer *next, *prev;
char name[EXR_LAY_MAXNAME + 1];
ListBase passes;
-} ExrLayer;
+};
/* ********************** */
diff --git a/source/blender/simulation/intern/hair_volume.cpp b/source/blender/simulation/intern/hair_volume.cpp
index 123b91edaac..1b65dd8f22c 100644
--- a/source/blender/simulation/intern/hair_volume.cpp
+++ b/source/blender/simulation/intern/hair_volume.cpp
@@ -76,12 +76,12 @@ typedef struct HairGridVert {
float velocity_smooth[3];
} HairGridVert;
-typedef struct HairGrid {
+struct HairGrid {
HairGridVert *verts;
int res[3];
float gmin[3], gmax[3];
float cellsize, inv_cellsize;
-} HairGrid;
+};
#define HAIR_GRID_INDEX_AXIS(vec, res, gmin, scale, axis) \
(min_ii(max_ii((int)((vec[axis] - gmin[axis]) * scale), 0), res[axis] - 2))