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:
authorHans Goudey <h.goudey@me.com>2022-03-24 07:24:54 +0300
committerHans Goudey <h.goudey@me.com>2022-03-24 07:24:54 +0300
commitaeb2c2afaf00d1c1ef6cce73b106d5400e52566e (patch)
treeb270abfc0f710366b98ea01e01a2f372c39caa76 /source/blender
parente253f9f66d6f63592ffd97afe207ef7c72547d03 (diff)
Cleanup: Clang tidy
- Deprecated headers - Else after return - Inconsistent parameter names (I used the most recently modified) - Raw string literals
Diffstat (limited to 'source/blender')
-rw-r--r--source/blender/blenkernel/intern/curve.cc4
-rw-r--r--source/blender/blenkernel/intern/image.cc12
-rw-r--r--source/blender/blenkernel/intern/image_format.cc2
-rw-r--r--source/blender/blenkernel/intern/image_save.cc6
-rw-r--r--source/blender/editors/render/render_preview.cc16
-rw-r--r--source/blender/editors/sculpt_paint/curves_sculpt_3d_brush.cc2
-rw-r--r--source/blender/editors/sculpt_paint/curves_sculpt_add.cc2
-rw-r--r--source/blender/editors/space_outliner/tree/tree_element_rna.cc2
-rw-r--r--source/blender/editors/transform/transform_snap.c4
-rw-r--r--source/blender/imbuf/intern/colormanagement.c25
-rw-r--r--source/blender/io/wavefront_obj/exporter/obj_export_mesh.cc6
-rw-r--r--source/blender/modifiers/intern/MOD_meshsequencecache.cc2
12 files changed, 43 insertions, 40 deletions
diff --git a/source/blender/blenkernel/intern/curve.cc b/source/blender/blenkernel/intern/curve.cc
index 354ddd7d167..02710982564 100644
--- a/source/blender/blenkernel/intern/curve.cc
+++ b/source/blender/blenkernel/intern/curve.cc
@@ -4718,11 +4718,11 @@ static NURBSValidationStatus nurb_check_valid(const int pnts,
if (pnts <= 1) {
return NURBSValidationStatus::AtLeastTwoPointsRequired;
}
- else if (type == CU_NURBS) {
+ if (type == CU_NURBS) {
if (pnts < order) {
return NURBSValidationStatus::MorePointsThanOrderRequired;
}
- else if (flag & CU_NURB_BEZIER) {
+ if (flag & CU_NURB_BEZIER) {
int points_needed = 0;
if (flag & CU_NURB_CYCLIC) {
const int remainder = pnts % (order - 1);
diff --git a/source/blender/blenkernel/intern/image.cc b/source/blender/blenkernel/intern/image.cc
index 0e3c913189c..296364e71ca 100644
--- a/source/blender/blenkernel/intern/image.cc
+++ b/source/blender/blenkernel/intern/image.cc
@@ -239,7 +239,7 @@ static void image_foreach_cache(ID *id,
auto gputexture_offset = [image](int target, int eye, int resolution) {
constexpr size_t base_offset = offsetof(Image, gputexture);
- const auto first = &image->gputexture[0][0][0];
+ struct GPUTexture **first = &image->gputexture[0][0][0];
const size_t array_offset = sizeof(*first) *
(&image->gputexture[target][eye][resolution] - first);
return base_offset + array_offset;
@@ -489,9 +489,9 @@ static void image_add_view(Image *ima, const char *viewname, const char *filepat
/** \name Image Cache
* \{ */
-typedef struct ImageCacheKey {
+struct ImageCacheKey {
int index;
-} ImageCacheKey;
+};
static unsigned int imagecache_hashhash(const void *key_v)
{
@@ -3325,14 +3325,14 @@ void BKE_image_ensure_tile_token(char *filename)
* with other digit sequences, we can leverage the supported range of roughly
* 1000 through 2000 to provide better detection.
*/
- std::regex pattern("(^|.*?\\D)([12]\\d{3})(\\D.*)");
+ std::regex pattern(R"((^|.*?\D)([12]\d{3})(\D.*))");
if (std::regex_search(path, match, pattern)) {
BLI_strncpy(filename, match.format("$1<UDIM>$3").c_str(), FILE_MAX);
return;
}
/* General u##_v### "uvtile" pattern. */
- pattern = std::regex("(.*)(u\\d{1,2}_v\\d{1,3})(\\D.*)");
+ pattern = std::regex(R"((.*)(u\d{1,2}_v\d{1,3})(\D.*))");
if (std::regex_search(path, match, pattern)) {
BLI_strncpy(filename, match.format("$1<UVTILE>$3").c_str(), FILE_MAX);
return;
@@ -5053,7 +5053,7 @@ void BKE_image_user_file_path_ex(ImageUser *iuser, Image *ima, char *filepath, b
bool BKE_image_has_alpha(Image *image)
{
void *lock;
- ImBuf *ibuf = BKE_image_acquire_ibuf(image, NULL, &lock);
+ ImBuf *ibuf = BKE_image_acquire_ibuf(image, nullptr, &lock);
const int planes = (ibuf ? ibuf->planes : 0);
BKE_image_release_ibuf(image, ibuf, lock);
diff --git a/source/blender/blenkernel/intern/image_format.cc b/source/blender/blenkernel/intern/image_format.cc
index 44aa9e21195..2b5712a1597 100644
--- a/source/blender/blenkernel/intern/image_format.cc
+++ b/source/blender/blenkernel/intern/image_format.cc
@@ -5,7 +5,7 @@
* \ingroup bke
*/
-#include <string.h>
+#include <cstring>
#include "DNA_defaults.h"
#include "DNA_scene_types.h"
diff --git a/source/blender/blenkernel/intern/image_save.cc b/source/blender/blenkernel/intern/image_save.cc
index f530183f967..913b5553632 100644
--- a/source/blender/blenkernel/intern/image_save.cc
+++ b/source/blender/blenkernel/intern/image_save.cc
@@ -486,7 +486,7 @@ static float *image_exr_from_scene_linear_to_output(float *rect,
bool BKE_image_render_write_exr(ReportList *reports,
const RenderResult *rr,
- const char *filepath,
+ const char *filename,
const ImageFormatData *imf,
const bool save_as_render,
const char *view,
@@ -630,11 +630,11 @@ bool BKE_image_render_write_exr(ReportList *reports,
errno = 0;
- BLI_make_existing_file(filepath);
+ BLI_make_existing_file(filename);
int compress = (imf ? imf->exr_codec : 0);
bool success = IMB_exr_begin_write(
- exrhandle, filepath, rr->rectx, rr->recty, compress, rr->stamp_data);
+ exrhandle, filename, rr->rectx, rr->recty, compress, rr->stamp_data);
if (success) {
IMB_exr_write_channels(exrhandle);
}
diff --git a/source/blender/editors/render/render_preview.cc b/source/blender/editors/render/render_preview.cc
index 16a3e799779..ef0f0b6225c 100644
--- a/source/blender/editors/render/render_preview.cc
+++ b/source/blender/editors/render/render_preview.cc
@@ -1679,19 +1679,19 @@ class PreviewLoadJob {
PreviewLoadJob();
~PreviewLoadJob();
- static PreviewLoadJob &ensure_job(wmWindowManager *, wmWindow *);
- static void load_jobless(PreviewImage *, eIconSizes);
+ static PreviewLoadJob &ensure_job(wmWindowManager *wm, wmWindow *win);
+ static void load_jobless(PreviewImage *preview, eIconSizes icon_size);
- void push_load_request(PreviewImage *, eIconSizes);
+ void push_load_request(PreviewImage *preview, eIconSizes icon_size);
private:
- static void run_fn(void *, short *, short *, float *);
- static void update_fn(void *);
- static void end_fn(void *);
- static void free_fn(void *);
+ static void run_fn(void *customdata, short *stop, short *do_update, float *progress);
+ static void update_fn(void *customdata);
+ static void end_fn(void *customdata);
+ static void free_fn(void *customdata);
/** Mark a single requested preview as being done, remove the request. */
- static void finish_request(RequestedPreview &);
+ static void finish_request(RequestedPreview &request);
};
PreviewLoadJob::PreviewLoadJob() : todo_queue_(BLI_thread_queue_init())
diff --git a/source/blender/editors/sculpt_paint/curves_sculpt_3d_brush.cc b/source/blender/editors/sculpt_paint/curves_sculpt_3d_brush.cc
index 51997cd9e1e..945bb09c0c6 100644
--- a/source/blender/editors/sculpt_paint/curves_sculpt_3d_brush.cc
+++ b/source/blender/editors/sculpt_paint/curves_sculpt_3d_brush.cc
@@ -65,7 +65,7 @@ static std::optional<float3> find_curves_brush_position(const CurvesGeometry &cu
/* New candidate is in inner radius while old one is not. */
return true;
}
- else if (b.depth_sq_cu < a.depth_sq_cu) {
+ if (b.depth_sq_cu < a.depth_sq_cu) {
/* Both candidates are in inner radius, but new one is closer to the camera. */
return true;
}
diff --git a/source/blender/editors/sculpt_paint/curves_sculpt_add.cc b/source/blender/editors/sculpt_paint/curves_sculpt_add.cc
index 2f39e6eec20..e444b3de2d5 100644
--- a/source/blender/editors/sculpt_paint/curves_sculpt_add.cc
+++ b/source/blender/editors/sculpt_paint/curves_sculpt_add.cc
@@ -55,7 +55,7 @@ class AddOperation : public CurvesSculptStrokeOperation {
friend struct AddOperationExecutor;
public:
- ~AddOperation()
+ ~AddOperation() override
{
if (curve_roots_kdtree_ != nullptr) {
BLI_kdtree_3d_free(curve_roots_kdtree_);
diff --git a/source/blender/editors/space_outliner/tree/tree_element_rna.cc b/source/blender/editors/space_outliner/tree/tree_element_rna.cc
index abc7cd8f8ce..914104f1f06 100644
--- a/source/blender/editors/space_outliner/tree/tree_element_rna.cc
+++ b/source/blender/editors/space_outliner/tree/tree_element_rna.cc
@@ -52,7 +52,7 @@ bool TreeElementRNACommon::isRNAValid() const
return rna_ptr_.data != nullptr;
}
-bool TreeElementRNACommon::expandPoll(const SpaceOutliner &) const
+bool TreeElementRNACommon::expandPoll(const SpaceOutliner &UNUSED(space_outliner)) const
{
return isRNAValid();
}
diff --git a/source/blender/editors/transform/transform_snap.c b/source/blender/editors/transform/transform_snap.c
index 7ace6343985..bf898b9053f 100644
--- a/source/blender/editors/transform/transform_snap.c
+++ b/source/blender/editors/transform/transform_snap.c
@@ -567,10 +567,10 @@ static char snap_flag_from_spacetype(TransInfo *t)
if (t->spacetype == SPACE_NODE) {
return ts->snap_flag_node;
}
- else if (t->spacetype == SPACE_IMAGE) {
+ if (t->spacetype == SPACE_IMAGE) {
return ts->snap_uv_flag;
}
- else if (t->spacetype == SPACE_SEQ) {
+ if (t->spacetype == SPACE_SEQ) {
return ts->snap_flag_seq;
}
return ts->snap_flag;
diff --git a/source/blender/imbuf/intern/colormanagement.c b/source/blender/imbuf/intern/colormanagement.c
index 2e8c5cc4a40..193fda01816 100644
--- a/source/blender/imbuf/intern/colormanagement.c
+++ b/source/blender/imbuf/intern/colormanagement.c
@@ -2449,12 +2449,12 @@ void IMB_colormanagement_imbuf_make_display_space(
ImBuf *IMB_colormanagement_imbuf_for_write(ImBuf *ibuf,
bool save_as_render,
bool allocate_result,
- const ImageFormatData *imf)
+ const ImageFormatData *image_format)
{
ImBuf *colormanaged_ibuf = ibuf;
- const bool is_movie = BKE_imtype_is_movie(imf->imtype);
- const bool requires_linear_float = BKE_imtype_requires_linear_float(imf->imtype);
- const bool do_alpha_under = imf->planes != R_IMF_PLANES_RGBA;
+ const bool is_movie = BKE_imtype_is_movie(image_format->imtype);
+ const bool requires_linear_float = BKE_imtype_requires_linear_float(image_format->imtype);
+ const bool do_alpha_under = image_format->planes != R_IMF_PLANES_RGBA;
if (ibuf->rect_float && ibuf->rect &&
(ibuf->userflags & (IB_DISPLAY_BUFFER_INVALID | IB_RECT_INVALID)) != 0) {
@@ -2464,9 +2464,9 @@ ImBuf *IMB_colormanagement_imbuf_for_write(ImBuf *ibuf,
const bool do_colormanagement_display = save_as_render && (is_movie || !requires_linear_float);
const bool do_colormanagement_linear = save_as_render && requires_linear_float &&
- imf->linear_colorspace_settings.name[0] &&
+ image_format->linear_colorspace_settings.name[0] &&
!IMB_colormanagement_space_name_is_scene_linear(
- imf->linear_colorspace_settings.name);
+ image_format->linear_colorspace_settings.name);
if (do_colormanagement_display || do_colormanagement_linear || do_alpha_under) {
if (allocate_result) {
@@ -2529,7 +2529,8 @@ ImBuf *IMB_colormanagement_imbuf_for_write(ImBuf *ibuf,
* should be pretty safe since this image buffer is supposed to be used for
* saving only and ftype would be overwritten a bit later by BKE_imbuf_write
*/
- colormanaged_ibuf->ftype = BKE_imtype_to_ftype(imf->imtype, &colormanaged_ibuf->foptions);
+ colormanaged_ibuf->ftype = BKE_imtype_to_ftype(image_format->imtype,
+ &colormanaged_ibuf->foptions);
/* if file format isn't able to handle float buffer itself,
* we need to allocate byte buffer and store color managed
@@ -2543,8 +2544,10 @@ ImBuf *IMB_colormanagement_imbuf_for_write(ImBuf *ibuf,
}
/* perform color space conversions */
- colormanagement_imbuf_make_display_space(
- colormanaged_ibuf, &imf->view_settings, &imf->display_settings, make_byte);
+ colormanagement_imbuf_make_display_space(colormanaged_ibuf,
+ &image_format->view_settings,
+ &image_format->display_settings,
+ make_byte);
if (colormanaged_ibuf->rect_float) {
/* float buffer isn't linear anymore,
@@ -2552,7 +2555,7 @@ ImBuf *IMB_colormanagement_imbuf_for_write(ImBuf *ibuf,
* no space conversion should happen if ibuf->float_colorspace != NULL
*/
colormanaged_ibuf->float_colorspace = display_transform_get_colorspace(
- &imf->view_settings, &imf->display_settings);
+ &image_format->view_settings, &image_format->display_settings);
}
}
else if (do_colormanagement_linear) {
@@ -2565,7 +2568,7 @@ ImBuf *IMB_colormanagement_imbuf_for_write(ImBuf *ibuf,
if (colormanaged_ibuf->rect_float) {
const char *from_colorspace = (ibuf->float_colorspace) ? ibuf->float_colorspace->name :
global_role_scene_linear;
- const char *to_colorspace = imf->linear_colorspace_settings.name;
+ const char *to_colorspace = image_format->linear_colorspace_settings.name;
IMB_colormanagement_transform(colormanaged_ibuf->rect_float,
colormanaged_ibuf->x,
diff --git a/source/blender/io/wavefront_obj/exporter/obj_export_mesh.cc b/source/blender/io/wavefront_obj/exporter/obj_export_mesh.cc
index fb9074999f9..a027718a4f3 100644
--- a/source/blender/io/wavefront_obj/exporter/obj_export_mesh.cc
+++ b/source/blender/io/wavefront_obj/exporter/obj_export_mesh.cc
@@ -89,7 +89,7 @@ std::pair<Mesh *, bool> OBJMesh::triangulate_mesh_eval()
if (export_mesh_eval_->totpoly <= 0) {
return {export_mesh_eval_, false};
}
- const BMeshCreateParams bm_create_params = {0u};
+ const BMeshCreateParams bm_create_params = {false};
BMeshFromMeshParams bm_convert_params{};
bm_convert_params.calc_face_normal = true;
bm_convert_params.calc_vert_normal = true;
@@ -382,8 +382,8 @@ void OBJMesh::store_normal_coords_and_indices()
normal_to_index.reserve(export_mesh_eval_->totpoly);
loop_to_normal_index_.resize(export_mesh_eval_->totloop);
loop_to_normal_index_.fill(-1);
- const float(
- *lnors)[3] = (const float(*)[3])(CustomData_get_layer(&export_mesh_eval_->ldata, CD_NORMAL));
+ const float(*lnors)[3] = (const float(*)[3])(
+ CustomData_get_layer(&export_mesh_eval_->ldata, CD_NORMAL));
for (int poly_index = 0; poly_index < export_mesh_eval_->totpoly; ++poly_index) {
const MPoly &mpoly = export_mesh_eval_->mpoly[poly_index];
bool need_per_loop_normals = lnors != nullptr || (mpoly.flag & ME_SMOOTH);
diff --git a/source/blender/modifiers/intern/MOD_meshsequencecache.cc b/source/blender/modifiers/intern/MOD_meshsequencecache.cc
index c30ab622842..cfc5b17f37e 100644
--- a/source/blender/modifiers/intern/MOD_meshsequencecache.cc
+++ b/source/blender/modifiers/intern/MOD_meshsequencecache.cc
@@ -4,7 +4,7 @@
* \ingroup modifiers
*/
-#include <string.h>
+#include <cstring>
#include "BLI_math_vector.h"
#include "BLI_string.h"