From 331f8500569df9b3b2aa776c5bcaad7b99c57295 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Fri, 7 Oct 2022 22:52:53 +1100 Subject: Cleanup: redundant parenthesis --- source/blender/blenlib/intern/BLI_args.c | 2 +- source/blender/blenlib/intern/BLI_filelist.c | 2 +- source/blender/blenlib/intern/boxpack_2d.c | 8 ++++---- source/blender/blenlib/intern/math_base.c | 4 ++-- source/blender/blenlib/intern/math_color.c | 6 +++--- source/blender/blenlib/intern/math_geom.c | 6 +++--- source/blender/blenlib/intern/math_interp.c | 8 ++++---- source/blender/blenlib/intern/math_rotation.c | 4 ++-- source/blender/blenlib/intern/math_vector.c | 2 +- source/blender/blenlib/intern/noise.c | 18 +++++++++--------- source/blender/blenlib/intern/path_util.c | 2 +- source/blender/blenlib/intern/polyfill_2d.c | 8 ++++---- source/blender/blenlib/intern/string.c | 4 ++-- source/blender/blenlib/intern/timecode.c | 2 +- 14 files changed, 38 insertions(+), 38 deletions(-) (limited to 'source/blender/blenlib/intern') diff --git a/source/blender/blenlib/intern/BLI_args.c b/source/blender/blenlib/intern/BLI_args.c index 3c745716ec8..ceb7f7f0aba 100644 --- a/source/blender/blenlib/intern/BLI_args.c +++ b/source/blender/blenlib/intern/BLI_args.c @@ -80,7 +80,7 @@ static bool keycmp(const void *a, const void *b) if (ka->case_str == 1 || kb->case_str == 1) { return (BLI_strcasecmp(ka->arg, kb->arg) != 0); } - return (!STREQ(ka->arg, kb->arg)); + return !STREQ(ka->arg, kb->arg); } return BLI_ghashutil_intcmp((const void *)ka->pass, (const void *)kb->pass); } diff --git a/source/blender/blenlib/intern/BLI_filelist.c b/source/blender/blenlib/intern/BLI_filelist.c index 4e532f90fb5..1ce6beab933 100644 --- a/source/blender/blenlib/intern/BLI_filelist.c +++ b/source/blender/blenlib/intern/BLI_filelist.c @@ -93,7 +93,7 @@ static int bli_compare(struct direntry *entry1, struct direntry *entry2) return 1; } - return (BLI_strcasecmp_natural(entry1->relname, entry2->relname)); + return BLI_strcasecmp_natural(entry1->relname, entry2->relname); } struct BuildDirCtx { diff --git a/source/blender/blenlib/intern/boxpack_2d.c b/source/blender/blenlib/intern/boxpack_2d.c index d55a4a8c9ff..309ae624305 100644 --- a/source/blender/blenlib/intern/boxpack_2d.c +++ b/source/blender/blenlib/intern/boxpack_2d.c @@ -491,7 +491,7 @@ void BLI_box_pack_2d(BoxPack *boxarray, const uint len, float *r_tot_x, float *r * flag verts on one or both of the boxes * as being used by checking the width or * height of both boxes */ - if (vert->tlb && vert->trb && (ELEM(box, vert->tlb, vert->trb))) { + if (vert->tlb && vert->trb && ELEM(box, vert->tlb, vert->trb)) { if (UNLIKELY(fabsf(vert->tlb->h - vert->trb->h) < EPSILON_MERGE)) { #ifdef USE_MERGE # define A (vert->trb->v[TL]) @@ -522,7 +522,7 @@ void BLI_box_pack_2d(BoxPack *boxarray, const uint len, float *r_tot_x, float *r vert->tlb->v[TR]->free &= ~(TRF | BRF); } } - else if (vert->blb && vert->brb && (ELEM(box, vert->blb, vert->brb))) { + else if (vert->blb && vert->brb && ELEM(box, vert->blb, vert->brb)) { if (UNLIKELY(fabsf(vert->blb->h - vert->brb->h) < EPSILON_MERGE)) { #ifdef USE_MERGE # define A (vert->blb->v[BR]) @@ -554,7 +554,7 @@ void BLI_box_pack_2d(BoxPack *boxarray, const uint len, float *r_tot_x, float *r } } /* Horizontal */ - if (vert->tlb && vert->blb && (ELEM(box, vert->tlb, vert->blb))) { + if (vert->tlb && vert->blb && ELEM(box, vert->tlb, vert->blb)) { if (UNLIKELY(fabsf(vert->tlb->w - vert->blb->w) < EPSILON_MERGE)) { #ifdef USE_MERGE # define A (vert->blb->v[TL]) @@ -585,7 +585,7 @@ void BLI_box_pack_2d(BoxPack *boxarray, const uint len, float *r_tot_x, float *r vert->tlb->v[BL]->free &= ~(BLF | BRF); } } - else if (vert->trb && vert->brb && (ELEM(box, vert->trb, vert->brb))) { + else if (vert->trb && vert->brb && ELEM(box, vert->trb, vert->brb)) { if (UNLIKELY(fabsf(vert->trb->w - vert->brb->w) < EPSILON_MERGE)) { #ifdef USE_MERGE diff --git a/source/blender/blenlib/intern/math_base.c b/source/blender/blenlib/intern/math_base.c index 257153dc6fe..8a791030fce 100644 --- a/source/blender/blenlib/intern/math_base.c +++ b/source/blender/blenlib/intern/math_base.c @@ -65,7 +65,7 @@ float floor_power_of_10(float f) { BLI_assert(!(f < 0.0f)); if (f != 0.0f) { - return 1.0f / (powf(10.0f, ceilf(log10f(1.0f / f)))); + return 1.0f / powf(10.0f, ceilf(log10f(1.0f / f))); } return 0.0f; } @@ -74,7 +74,7 @@ float ceil_power_of_10(float f) { BLI_assert(!(f < 0.0f)); if (f != 0.0f) { - return 1.0f / (powf(10.0f, floorf(log10f(1.0f / f)))); + return 1.0f / powf(10.0f, floorf(log10f(1.0f / f))); } return 0.0f; } diff --git a/source/blender/blenlib/intern/math_color.c b/source/blender/blenlib/intern/math_color.c index e4b352dc22c..51860c1abdb 100644 --- a/source/blender/blenlib/intern/math_color.c +++ b/source/blender/blenlib/intern/math_color.c @@ -368,9 +368,9 @@ uint rgb_to_cpack(float r, float g, float b) void cpack_to_rgb(uint col, float *r_r, float *r_g, float *r_b) { - *r_r = ((float)(col & 0xFF)) * (1.0f / 255.0f); - *r_g = ((float)((col >> 8) & 0xFF)) * (1.0f / 255.0f); - *r_b = ((float)((col >> 16) & 0xFF)) * (1.0f / 255.0f); + *r_r = (float)(col & 0xFF) * (1.0f / 255.0f); + *r_g = (float)((col >> 8) & 0xFF) * (1.0f / 255.0f); + *r_b = (float)((col >> 16) & 0xFF) * (1.0f / 255.0f); } void rgb_uchar_to_float(float r_col[3], const uchar col_ub[3]) diff --git a/source/blender/blenlib/intern/math_geom.c b/source/blender/blenlib/intern/math_geom.c index 2a003100c7a..08152976f7d 100644 --- a/source/blender/blenlib/intern/math_geom.c +++ b/source/blender/blenlib/intern/math_geom.c @@ -2748,7 +2748,7 @@ bool isect_sweeping_sphere_tri_v3(const float p1[3], edotv = dot_v3v3(e1, vel); edotbv = dot_v3v3(e1, bv); - a = elen2 * (-dot_v3v3(vel, vel)) + edotv * edotv; + a = elen2 * -dot_v3v3(vel, vel) + edotv * edotv; b = 2.0f * (elen2 * dot_v3v3(vel, bv) - edotv * edotbv); c = elen2 * (radius2 - dot_v3v3(bv, bv)) + edotbv * edotbv; @@ -2770,7 +2770,7 @@ bool isect_sweeping_sphere_tri_v3(const float p1[3], edotv = dot_v3v3(e2, vel); edotbv = dot_v3v3(e2, bv); - a = elen2 * (-dot_v3v3(vel, vel)) + edotv * edotv; + a = elen2 * -dot_v3v3(vel, vel) + edotv * edotv; b = 2.0f * (elen2 * dot_v3v3(vel, bv) - edotv * edotbv); c = elen2 * (radius2 - dot_v3v3(bv, bv)) + edotbv * edotbv; @@ -2797,7 +2797,7 @@ bool isect_sweeping_sphere_tri_v3(const float p1[3], edotv = dot_v3v3(e3, vel); edotbv = dot_v3v3(e3, bv); - a = elen2 * (-dot_v3v3(vel, vel)) + edotv * edotv; + a = elen2 * -dot_v3v3(vel, vel) + edotv * edotv; b = 2.0f * (elen2 * dot_v3v3(vel, bv) - edotv * edotbv); c = elen2 * (radius2 - dot_v3v3(bv, bv)) + edotbv * edotbv; diff --git a/source/blender/blenlib/intern/math_interp.c b/source/blender/blenlib/intern/math_interp.c index 4feb1d5ee56..29907924bd8 100644 --- a/source/blender/blenlib/intern/math_interp.c +++ b/source/blender/blenlib/intern/math_interp.c @@ -624,10 +624,10 @@ void BLI_ewa_filter(const int width, U0 = uv[0] * (float)width; V0 = uv[1] * (float)height; - u1 = (int)(floorf(U0 - ue)); - u2 = (int)(ceilf(U0 + ue)); - v1 = (int)(floorf(V0 - ve)); - v2 = (int)(ceilf(V0 + ve)); + u1 = (int)floorf(U0 - ue); + u2 = (int)ceilf(U0 + ue); + v1 = (int)floorf(V0 - ve); + v2 = (int)ceilf(V0 + ve); /* sane clamping to avoid unnecessarily huge loops */ /* NOTE: if eccentricity gets clamped (see above), diff --git a/source/blender/blenlib/intern/math_rotation.c b/source/blender/blenlib/intern/math_rotation.c index 91b07639e9b..ff45bbee5c9 100644 --- a/source/blender/blenlib/intern/math_rotation.c +++ b/source/blender/blenlib/intern/math_rotation.c @@ -2360,8 +2360,8 @@ bool mat3_from_axis_conversion( value = ((src_forward << (0 * 3)) | (src_up << (1 * 3)) | (dst_forward << (2 * 3)) | (dst_up << (3 * 3))); - for (uint i = 0; i < (ARRAY_SIZE(_axis_convert_matrix)); i++) { - for (uint j = 0; j < (ARRAY_SIZE(*_axis_convert_lut)); j++) { + for (uint i = 0; i < ARRAY_SIZE(_axis_convert_matrix); i++) { + for (uint j = 0; j < ARRAY_SIZE(*_axis_convert_lut); j++) { if (_axis_convert_lut[i][j] == value) { copy_m3_m3(r_mat, _axis_convert_matrix[i]); return true; diff --git a/source/blender/blenlib/intern/math_vector.c b/source/blender/blenlib/intern/math_vector.c index 5dcdabaf760..f65a5acceae 100644 --- a/source/blender/blenlib/intern/math_vector.c +++ b/source/blender/blenlib/intern/math_vector.c @@ -499,7 +499,7 @@ float angle_signed_on_axis_v3v3_v3(const float v1[3], const float v2[3], const f /* calculate the sign (reuse 'tproj') */ cross_v3_v3v3(tproj, v2_proj, v1_proj); if (dot_v3v3(tproj, axis) < 0.0f) { - angle = ((float)(M_PI * 2.0)) - angle; + angle = (float)(M_PI * 2.0) - angle; } return angle; diff --git a/source/blender/blenlib/intern/noise.c b/source/blender/blenlib/intern/noise.c index b8c17ce20fa..8da35e5ab56 100644 --- a/source/blender/blenlib/intern/noise.c +++ b/source/blender/blenlib/intern/noise.c @@ -939,9 +939,9 @@ void BLI_noise_voronoi(float x, float y, float z, float *da, float *pa, float me break; } - int xi = (int)(floor(x)); - int yi = (int)(floor(y)); - int zi = (int)(floor(z)); + int xi = (int)floor(x); + int yi = (int)floor(y); + int zi = (int)floor(z); da[0] = da[1] = da[2] = da[3] = 1e10f; for (int xx = xi - 1; xx <= xi + 1; xx++) { for (int yy = yi - 1; yy <= yi + 1; yy++) { @@ -1112,9 +1112,9 @@ static float BLI_cellNoiseU(float x, float y, float z) y = (y + 0.000001f) * 1.00001f; z = (z + 0.000001f) * 1.00001f; - int xi = (int)(floor(x)); - int yi = (int)(floor(y)); - int zi = (int)(floor(z)); + int xi = (int)floor(x); + int yi = (int)floor(y); + int zi = (int)floor(z); uint n = xi + yi * 1301 + zi * 314159; n ^= (n << 13); return ((float)(n * (n * n * 15731 + 789221) + 1376312589) / 4294967296.0f); @@ -1132,9 +1132,9 @@ void BLI_noise_cell_v3(float x, float y, float z, float r_ca[3]) y = (y + 0.000001f) * 1.00001f; z = (z + 0.000001f) * 1.00001f; - int xi = (int)(floor(x)); - int yi = (int)(floor(y)); - int zi = (int)(floor(z)); + int xi = (int)floor(x); + int yi = (int)floor(y); + int zi = (int)floor(z); const float *p = HASHPNT(xi, yi, zi); r_ca[0] = p[0]; r_ca[1] = p[1]; diff --git a/source/blender/blenlib/intern/path_util.c b/source/blender/blenlib/intern/path_util.c index a3be9732a68..6ff4d57aecb 100644 --- a/source/blender/blenlib/intern/path_util.c +++ b/source/blender/blenlib/intern/path_util.c @@ -1347,7 +1347,7 @@ bool BLI_path_extension_ensure(char *path, size_t maxlen, const char *ext) ssize_t a; /* first check the extension is already there */ - if ((ext_len <= path_len) && (STREQ(path + (path_len - ext_len), ext))) { + if ((ext_len <= path_len) && STREQ(path + (path_len - ext_len), ext)) { return true; } diff --git a/source/blender/blenlib/intern/polyfill_2d.c b/source/blender/blenlib/intern/polyfill_2d.c index eed87eda436..2b59de5b569 100644 --- a/source/blender/blenlib/intern/polyfill_2d.c +++ b/source/blender/blenlib/intern/polyfill_2d.c @@ -373,12 +373,12 @@ static bool kdtree2d_isect_tri_recursive(const struct KDTree2D *tree, # define KDTREE2D_ISECT_TRI_RECURSE_NEG \ (((node->neg != KDNODE_UNSET) && (co[node->axis] >= bounds[node->axis].min)) && \ - (kdtree2d_isect_tri_recursive( \ - tree, tri_index, tri_coords, tri_center, bounds, &tree->nodes[node->neg]))) + kdtree2d_isect_tri_recursive( \ + tree, tri_index, tri_coords, tri_center, bounds, &tree->nodes[node->neg])) # define KDTREE2D_ISECT_TRI_RECURSE_POS \ (((node->pos != KDNODE_UNSET) && (co[node->axis] <= bounds[node->axis].max)) && \ - (kdtree2d_isect_tri_recursive( \ - tree, tri_index, tri_coords, tri_center, bounds, &tree->nodes[node->pos]))) + kdtree2d_isect_tri_recursive( \ + tree, tri_index, tri_coords, tri_center, bounds, &tree->nodes[node->pos])) if (tri_center[node->axis] > co[node->axis]) { if (KDTREE2D_ISECT_TRI_RECURSE_POS) { diff --git a/source/blender/blenlib/intern/string.c b/source/blender/blenlib/intern/string.c index 38b6f015148..89d31c5e93f 100644 --- a/source/blender/blenlib/intern/string.c +++ b/source/blender/blenlib/intern/string.c @@ -314,7 +314,7 @@ size_t BLI_str_unescape_ex(char *__restrict dst, break; } char c = *src; - if (UNLIKELY(c == '\\') && (str_unescape_pair(*(src + 1), &c))) { + if (UNLIKELY(c == '\\') && str_unescape_pair(*(src + 1), &c)) { src++; } dst[len++] = c; @@ -329,7 +329,7 @@ size_t BLI_str_unescape(char *__restrict dst, const char *__restrict src, const size_t len = 0; for (const char *src_end = src + src_maxncpy; (src < src_end) && *src; src++) { char c = *src; - if (UNLIKELY(c == '\\') && (str_unescape_pair(*(src + 1), &c))) { + if (UNLIKELY(c == '\\') && str_unescape_pair(*(src + 1), &c)) { src++; } dst[len++] = c; diff --git a/source/blender/blenlib/intern/timecode.c b/source/blender/blenlib/intern/timecode.c index fc78b0ad98d..ecaa469984d 100644 --- a/source/blender/blenlib/intern/timecode.c +++ b/source/blender/blenlib/intern/timecode.c @@ -176,7 +176,7 @@ size_t BLI_timecode_string_from_time_simple(char *str, const int hr = ((int)time_seconds) / (60 * 60); const int min = (((int)time_seconds) / 60) % 60; const int sec = ((int)time_seconds) % 60; - const int hun = ((int)(fmod(time_seconds, 1.0) * 100)); + const int hun = (int)(fmod(time_seconds, 1.0) * 100); if (hr) { rlen = BLI_snprintf_rlen(str, maxncpy, "%.2d:%.2d:%.2d.%.2d", hr, min, sec, hun); -- cgit v1.2.3