From 725973485a909c2b732c58bd49d06a75edd52f7e Mon Sep 17 00:00:00 2001 From: Jacques Lucke Date: Mon, 13 Jul 2020 11:27:09 +0200 Subject: Clang Tidy: enable readability-non-const-parameter warning Clang Tidy reported a couple of false positives. I disabled those `NOLINTNEXTLINE`. Differential Revision: https://developer.blender.org/D8199 --- source/blender/blenlib/intern/delaunay_2d.c | 6 +++--- source/blender/blenlib/intern/math_color.c | 8 ++++++-- source/blender/blenlib/intern/math_matrix.c | 2 +- source/blender/blenlib/intern/noise.c | 4 ++-- source/blender/blenlib/intern/rand.cc | 6 +++--- source/blender/blenlib/intern/storage.c | 2 +- source/blender/blenlib/intern/system.c | 6 +++++- source/blender/blenlib/intern/voronoi_2d.c | 2 +- source/blender/blenlib/intern/voxel.c | 13 ++++++++----- 9 files changed, 30 insertions(+), 19 deletions(-) (limited to 'source/blender/blenlib/intern') diff --git a/source/blender/blenlib/intern/delaunay_2d.c b/source/blender/blenlib/intern/delaunay_2d.c index ad6d824be9b..5f663dcb2e1 100644 --- a/source/blender/blenlib/intern/delaunay_2d.c +++ b/source/blender/blenlib/intern/delaunay_2d.c @@ -4320,7 +4320,7 @@ static void exactinit(void) */ static int fast_expansion_sum_zeroelim( - int elen, double *e, int flen, double *f, double *h) /* h cannot be e or f. */ + int elen, const double *e, int flen, const double *f, double *h) /* h cannot be e or f. */ { double Q; INEXACT double Qnew; @@ -4405,7 +4405,7 @@ static int fast_expansion_sum_zeroelim( */ static int scale_expansion_zeroelim(int elen, - double *e, + const double *e, double b, double *h) /* e and h cannot be the same. */ { @@ -4451,7 +4451,7 @@ static int scale_expansion_zeroelim(int elen, * See either version of my paper for details. */ -static double estimate(int elen, double *e) +static double estimate(int elen, const double *e) { double Q; int eindex; diff --git a/source/blender/blenlib/intern/math_color.c b/source/blender/blenlib/intern/math_color.c index 625849c01df..651a062e3d5 100644 --- a/source/blender/blenlib/intern/math_color.c +++ b/source/blender/blenlib/intern/math_color.c @@ -503,8 +503,12 @@ int constrain_rgb(float *r, float *g, float *b) /* ********************** lift/gamma/gain / ASC-CDL conversion ********************************* */ -void lift_gamma_gain_to_asc_cdl( - float *lift, float *gamma, float *gain, float *offset, float *slope, float *power) +void lift_gamma_gain_to_asc_cdl(const float *lift, + const float *gamma, + const float *gain, + float *offset, + float *slope, + float *power) { int c; for (c = 0; c < 3; c++) { diff --git a/source/blender/blenlib/intern/math_matrix.c b/source/blender/blenlib/intern/math_matrix.c index 92cfd09f191..fadd7d83444 100644 --- a/source/blender/blenlib/intern/math_matrix.c +++ b/source/blender/blenlib/intern/math_matrix.c @@ -248,7 +248,7 @@ void swap_m4m4(float m1[4][4], float m2[4][4]) } } -void shuffle_m4(float R[4][4], int index[4]) +void shuffle_m4(float R[4][4], const int index[4]) { zero_m4(R); for (int k = 0; k < 4; k++) { diff --git a/source/blender/blenlib/intern/noise.c b/source/blender/blenlib/intern/noise.c index 42b5ba28f5a..1ae1c91a3bd 100644 --- a/source/blender/blenlib/intern/noise.c +++ b/source/blender/blenlib/intern/noise.c @@ -27,7 +27,7 @@ #include "BLI_noise.h" /* local */ -static float noise3_perlin(float vec[3]); +static float noise3_perlin(const float vec[3]); // static float turbulence_perlin(const float point[3], float lofreq, float hifreq); // static float turbulencep(float noisesize, float x, float y, float z, int nr); @@ -779,7 +779,7 @@ static const float g_perlin_data_v3[512 + 2][3] = { } \ (void)0 -static float noise3_perlin(float vec[3]) +static float noise3_perlin(const float vec[3]) { const char *p = g_perlin_data_ub; const float(*g)[3] = g_perlin_data_v3; diff --git a/source/blender/blenlib/intern/rand.cc b/source/blender/blenlib/intern/rand.cc index 3dbe33764a9..279682ea171 100644 --- a/source/blender/blenlib/intern/rand.cc +++ b/source/blender/blenlib/intern/rand.cc @@ -302,7 +302,7 @@ void BLI_halton_1d(unsigned int prime, double offset, int n, double *r) } } -void BLI_halton_2d(unsigned int prime[2], double offset[2], int n, double *r) +void BLI_halton_2d(const unsigned int prime[2], double offset[2], int n, double *r) { const double invprimes[2] = {1.0 / (double)prime[0], 1.0 / (double)prime[1]}; @@ -315,7 +315,7 @@ void BLI_halton_2d(unsigned int prime[2], double offset[2], int n, double *r) } } -void BLI_halton_3d(unsigned int prime[3], double offset[3], int n, double *r) +void BLI_halton_3d(const unsigned int prime[3], double offset[3], int n, double *r) { const double invprimes[3] = { 1.0 / (double)prime[0], 1.0 / (double)prime[1], 1.0 / (double)prime[2]}; @@ -329,7 +329,7 @@ void BLI_halton_3d(unsigned int prime[3], double offset[3], int n, double *r) } } -void BLI_halton_2d_sequence(unsigned int prime[2], double offset[2], int n, double *r) +void BLI_halton_2d_sequence(const unsigned int prime[2], double offset[2], int n, double *r) { const double invprimes[2] = {1.0 / (double)prime[0], 1.0 / (double)prime[1]}; diff --git a/source/blender/blenlib/intern/storage.c b/source/blender/blenlib/intern/storage.c index 96a7445462d..e3a2b6b4992 100644 --- a/source/blender/blenlib/intern/storage.c +++ b/source/blender/blenlib/intern/storage.c @@ -290,7 +290,7 @@ eFileAttributes BLI_file_attributes(const char *path) /* Return alias/shortcut file target. Apple version is defined in storage_apple.mm */ #ifndef __APPLE__ -bool BLI_file_alias_target(char target[FILE_MAXDIR], const char *filepath) +bool BLI_file_alias_target(const char target[FILE_MAXDIR], const char *filepath) { # ifdef WIN32 if (!BLI_path_extension_check(filepath, ".lnk")) { diff --git a/source/blender/blenlib/intern/system.c b/source/blender/blenlib/intern/system.c index 53db49aa59c..20edbb97561 100644 --- a/source/blender/blenlib/intern/system.c +++ b/source/blender/blenlib/intern/system.c @@ -111,7 +111,11 @@ void BLI_system_backtrace(FILE *fp) /* NOTE: The code for CPU brand string is adopted from Cycles. */ #if !defined(_WIN32) || defined(FREE_WINDOWS) -static void __cpuid(int data[4], int selector) +static void __cpuid( + /* Cannot be const, because it is modified below. + * NOLINTNEXTLINE: readability-non-const-parameter. */ + int data[4], + int selector) { # if defined(__x86_64__) asm("cpuid" : "=a"(data[0]), "=b"(data[1]), "=c"(data[2]), "=d"(data[3]) : "a"(selector)); diff --git a/source/blender/blenlib/intern/voronoi_2d.c b/source/blender/blenlib/intern/voronoi_2d.c index 59270c58341..bc11a2c7a1c 100644 --- a/source/blender/blenlib/intern/voronoi_2d.c +++ b/source/blender/blenlib/intern/voronoi_2d.c @@ -213,7 +213,7 @@ static void voronoiParabola_setRight(VoronoiParabola *parabola, VoronoiParabola right->parent = parabola; } -static float voronoi_getY(VoronoiProcess *process, float p[2], float x) +static float voronoi_getY(VoronoiProcess *process, const float p[2], float x) { float ly = process->current_y; diff --git a/source/blender/blenlib/intern/voxel.c b/source/blender/blenlib/intern/voxel.c index c7c794957c2..2c8eb9f5a13 100644 --- a/source/blender/blenlib/intern/voxel.c +++ b/source/blender/blenlib/intern/voxel.c @@ -26,7 +26,7 @@ #include "BLI_strict_flags.h" -BLI_INLINE float D(float *data, const int res[3], int x, int y, int z) +BLI_INLINE float D(const float *data, const int res[3], int x, int y, int z) { CLAMP(x, 0, res[0] - 1); CLAMP(y, 0, res[1] - 1); @@ -36,7 +36,7 @@ BLI_INLINE float D(float *data, const int res[3], int x, int y, int z) /* *** nearest neighbor *** */ /* input coordinates must be in bounding box 0.0 - 1.0 */ -float BLI_voxel_sample_nearest(float *data, const int res[3], const float co[3]) +float BLI_voxel_sample_nearest(const float *data, const int res[3], const float co[3]) { int xi, yi, zi; @@ -65,7 +65,7 @@ BLI_INLINE int64_t _clamp(int a, int b, int c) return (a < b) ? b : ((a > c) ? c : a); } -float BLI_voxel_sample_trilinear(float *data, const int res[3], const float co[3]) +float BLI_voxel_sample_trilinear(const float *data, const int res[3], const float co[3]) { if (data) { @@ -106,7 +106,7 @@ float BLI_voxel_sample_trilinear(float *data, const int res[3], const float co[3 return 0.f; } -float BLI_voxel_sample_triquadratic(float *data, const int res[3], const float co[3]) +float BLI_voxel_sample_triquadratic(const float *data, const int res[3], const float co[3]) { if (data) { @@ -161,7 +161,10 @@ float BLI_voxel_sample_triquadratic(float *data, const int res[3], const float c return 0.f; } -float BLI_voxel_sample_tricubic(float *data, const int res[3], const float co[3], int bspline) +float BLI_voxel_sample_tricubic(const float *data, + const int res[3], + const float co[3], + int bspline) { if (data) { -- cgit v1.2.3