diff --git a/source/blender/animrig/intern/bone_collections.cc b/source/blender/animrig/intern/bone_collections.cc index 9fb95fb8ed4..0ecb2d01bb4 100644 --- a/source/blender/animrig/intern/bone_collections.cc +++ b/source/blender/animrig/intern/bone_collections.cc @@ -1207,12 +1207,11 @@ bool armature_bonecoll_is_child_of(const bArmature *armature, const int potential_child_index) { /* Check for roots, before we try and access collection_array[-1]. */ - const bool is_root = armature_bonecoll_is_root(armature, potential_child_index); - if (is_root) { + if (armature_bonecoll_is_root(armature, potential_child_index)) { return potential_parent_index == -1; } if (potential_parent_index < 0) { - return is_root; + return false; } const BoneCollection *potential_parent = armature->collection_array[potential_parent_index]; diff --git a/source/blender/blenkernel/intern/ocean.cc b/source/blender/blenkernel/intern/ocean.cc index 4bc6e052664..166aa7dea94 100644 --- a/source/blender/blenkernel/intern/ocean.cc +++ b/source/blender/blenkernel/intern/ocean.cc @@ -1348,12 +1348,11 @@ OceanCache *BKE_ocean_init_cache(const char *bakepath, void BKE_ocean_simulate_cache(OceanCache *och, int frame) { char filepath[FILE_MAX]; - int f = frame; /* ibufs array is zero based, but filenames are based on frame numbers */ /* still need to clamp frame numbers to valid range of images on disk though */ CLAMP(frame, och->start, och->end); - f = frame - och->start; /* shift to 0 based */ + const int f = frame - och->start; /* shift to 0 based */ /* if image is already loaded in mem, return */ if (och->ibufs_disp[f] != nullptr) { diff --git a/source/blender/blenlib/BLI_math_matrix.hh b/source/blender/blenlib/BLI_math_matrix.hh index ed4c4be123b..62cf19ecc98 100644 --- a/source/blender/blenlib/BLI_math_matrix.hh +++ b/source/blender/blenlib/BLI_math_matrix.hh @@ -1669,7 +1669,7 @@ template MatBase result = mat; const bool is_perspective = mat[2][3] == -1.0f; const bool is_perspective_infinite = mat[2][2] == -1.0f; - if (is_perspective | is_perspective_infinite) { + if (is_perspective || is_perspective_infinite) { result[2][0] -= mat[0][0] * offset.x / math::length(float3(mat[0][0], mat[1][0], mat[2][0])); result[2][1] -= mat[1][1] * offset.y / math::length(float3(mat[0][1], mat[1][1], mat[2][1])); } diff --git a/source/blender/blenlib/intern/fileops_c.cc b/source/blender/blenlib/intern/fileops_c.cc index cf7263222fb..2f9abec363a 100644 --- a/source/blender/blenlib/intern/fileops_c.cc +++ b/source/blender/blenlib/intern/fileops_c.cc @@ -1204,8 +1204,8 @@ static int delete_soft(const char *file, const char **error_message) const char *args[5]; const char *process_failed; - char *xdg_current_desktop = getenv("XDG_CURRENT_DESKTOP"); - char *xdg_session_desktop = getenv("XDG_SESSION_DESKTOP"); + const char *xdg_current_desktop = getenv("XDG_CURRENT_DESKTOP"); + const char *xdg_session_desktop = getenv("XDG_SESSION_DESKTOP"); if ((xdg_current_desktop != nullptr && STREQ(xdg_current_desktop, "KDE")) || (xdg_session_desktop != nullptr && STREQ(xdg_session_desktop, "KDE"))) diff --git a/source/blender/blenlib/intern/math_solvers.c b/source/blender/blenlib/intern/math_solvers.c index fbae5f6d980..2e967f033c0 100644 --- a/source/blender/blenlib/intern/math_solvers.c +++ b/source/blender/blenlib/intern/math_solvers.c @@ -53,11 +53,10 @@ bool BLI_tridiagonal_solve( size_t bytes = sizeof(double) * (uint)count; double *c1 = (double *)MEM_mallocN(bytes * 2, "tridiagonal_c1d1"); - double *d1 = c1 + count; - if (!c1) { return false; } + double *d1 = c1 + count; int i; double c_prev, d_prev, x_prev; @@ -120,11 +119,10 @@ bool BLI_tridiagonal_solve_cyclic( size_t bytes = sizeof(float) * (uint)count; float *tmp = (float *)MEM_mallocN(bytes * 2, "tridiagonal_ex"); - float *b2 = tmp + count; - if (!tmp) { return false; } + float *b2 = tmp + count; /* Prepare the non-cyclic system; relies on tridiagonal_solve ignoring values. */ memcpy(b2, b, bytes); diff --git a/source/blender/editors/space_view3d/view3d_gizmo_ruler.cc b/source/blender/editors/space_view3d/view3d_gizmo_ruler.cc index 95b16a1cf26..31721071d29 100644 --- a/source/blender/editors/space_view3d/view3d_gizmo_ruler.cc +++ b/source/blender/editors/space_view3d/view3d_gizmo_ruler.cc @@ -291,6 +291,7 @@ static bool view3d_ruler_pick(wmGizmoGroup *gzgroup, } } } + UNUSED_VARS(dist_best); *r_co_index = co_index_best; return found; diff --git a/source/blender/makesrna/intern/rna_access_compare_override.cc b/source/blender/makesrna/intern/rna_access_compare_override.cc index 796e9aaa9c8..61c884e584b 100644 --- a/source/blender/makesrna/intern/rna_access_compare_override.cc +++ b/source/blender/makesrna/intern/rna_access_compare_override.cc @@ -498,7 +498,7 @@ static bool rna_property_override_operation_store(Main *bmain, } } - if (ptr_storage != nullptr && prop_storage->magic == RNA_MAGIC && + if ((prop_storage->magic == RNA_MAGIC) && !ELEM(prop_storage->override_store, nullptr, override_store)) { override_store = nullptr;