diff options
author | Hans Goudey <h.goudey@me.com> | 2022-03-24 07:24:54 +0300 |
---|---|---|
committer | Hans Goudey <h.goudey@me.com> | 2022-03-24 07:24:54 +0300 |
commit | aeb2c2afaf00d1c1ef6cce73b106d5400e52566e (patch) | |
tree | b270abfc0f710366b98ea01e01a2f372c39caa76 /source/blender/blenkernel | |
parent | e253f9f66d6f63592ffd97afe207ef7c72547d03 (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/blenkernel')
-rw-r--r-- | source/blender/blenkernel/intern/curve.cc | 4 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/image.cc | 12 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/image_format.cc | 2 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/image_save.cc | 6 |
4 files changed, 12 insertions, 12 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); } |