From 07121d44aebb11c87ce1631da92e55a06eec3d0c Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Wed, 11 Jun 2025 09:05:26 +0000 Subject: [PATCH] Cleanup: use braces (follow own style guide) --- intern/cycles/blender/camera.cpp | 10 ++++--- intern/cycles/integrator/denoiser_optix.cpp | 21 ++++++++------- .../kernel/device/gpu/parallel_active_index.h | 3 ++- intern/cycles/scene/camera.cpp | 15 +++++++---- intern/cycles/scene/osl.cpp | 4 +-- intern/cycles/scene/shader_nodes.cpp | 3 ++- intern/cycles/util/math_base.h | 6 +++-- intern/cycles/util/transform.cpp | 9 ++++--- intern/dualcon/intern/octree.cpp | 3 ++- intern/ghost/intern/GHOST_ContextGLX.cc | 9 ++++--- intern/ghost/intern/GHOST_ContextWGL.cc | 15 +++++++---- intern/ghost/intern/GHOST_ImeWin32.cc | 18 ++++++++----- intern/ghost/intern/GHOST_SystemCocoa.mm | 3 ++- intern/ghost/intern/GHOST_SystemSDL.cc | 16 +++++------ intern/ghost/test/gears/GHOST_Test.cpp | 9 ++++--- .../intern/mallocn_guarded_impl.cc | 27 ++++++++++++------- intern/iksolver/intern/IK_QTask.cpp | 3 ++- intern/iksolver/intern/IK_Solver.cpp | 3 ++- intern/itasc/Scene.cpp | 27 ++++++++++++------- .../internal/evaluator/gpu_patch_table.cc | 3 ++- intern/utfconv/utfconv.cc | 10 ++++--- source/blender/blenlib/intern/winstuff.cc | 3 ++- .../shaders/subdiv_patch_evaluation_comp.glsl | 8 +++--- .../editors/animation/anim_channels_edit.cc | 5 ++-- .../blender/editors/render/render_preview.cc | 3 ++- .../gpu_shader_material_tex_image.glsl | 12 ++++----- .../blender/makesrna/intern/rna_nodetree.cc | 7 ++--- .../blender/makesrna/intern/rna_particle.cc | 3 ++- .../modifiers/intern/lineart/MOD_lineart.hh | 8 +++--- source/blender/render/intern/multires_bake.cc | 9 ++++--- source/creator/blender_launcher_win32.c | 3 ++- 31 files changed, 172 insertions(+), 106 deletions(-) diff --git a/intern/cycles/blender/camera.cpp b/intern/cycles/blender/camera.cpp index d60e2b727a5..9da5b929081 100644 --- a/intern/cycles/blender/camera.cpp +++ b/intern/cycles/blender/camera.cpp @@ -397,8 +397,9 @@ class BlenderCameraParamQuery : public OSLCameraParamQuery { bool get_float(ustring name, vector &data) override { PropertyRNA *prop = get_prop(name); - if (!prop) + if (!prop) { return false; + } if (RNA_property_array_check(prop)) { data.resize(RNA_property_array_length(&custom_props, prop)); RNA_property_float_get_array(&custom_props, prop, data.data()); @@ -413,9 +414,9 @@ class BlenderCameraParamQuery : public OSLCameraParamQuery { bool get_int(ustring name, vector &data) override { PropertyRNA *prop = get_prop(name); - if (!prop) + if (!prop) { return false; - + } int array_len = 0; if (RNA_property_array_check(prop)) { array_len = RNA_property_array_length(&custom_props, prop); @@ -449,8 +450,9 @@ class BlenderCameraParamQuery : public OSLCameraParamQuery { bool get_string(ustring name, string &data) override { PropertyRNA *prop = get_prop(name); - if (!prop) + if (!prop) { return false; + } data = RNA_property_string_get(&custom_props, prop); return true; } diff --git a/intern/cycles/integrator/denoiser_optix.cpp b/intern/cycles/integrator/denoiser_optix.cpp index e4161169f59..b64e209cd28 100644 --- a/intern/cycles/integrator/denoiser_optix.cpp +++ b/intern/cycles/integrator/denoiser_optix.cpp @@ -28,8 +28,9 @@ static OptixResult optixUtilDenoiserSplitImage(const OptixImage2D &input, unsigned int tileHeight, std::vector &tiles) { - if (tileWidth == 0 || tileHeight == 0) + if (tileWidth == 0 || tileHeight == 0) { return OPTIX_ERROR_INVALID_VALUE; + } unsigned int inPixelStride = optixUtilGetPixelStride(input); unsigned int outPixelStride = optixUtilGetPixelStride(output); @@ -99,8 +100,9 @@ static OptixResult optixUtilDenoiserInvokeTiled(OptixDenoiser denoiser, unsigned int tileWidth, unsigned int tileHeight) { - if (!guideLayer || !layers) + if (!guideLayer || !layers) { return OPTIX_ERROR_INVALID_VALUE; + } std::vector> tiles(numLayers); std::vector> prevTiles(numLayers); @@ -166,21 +168,22 @@ static OptixResult optixUtilDenoiserInvokeTiled(OptixDenoiser denoiser, OptixDenoiserLayer layer = {}; layer.input = (tiles[l])[t].input; layer.output = (tiles[l])[t].output; - if (layers[l].previousOutput.data) + if (layers[l].previousOutput.data) { layer.previousOutput = (prevTiles[l])[t].input; + } tlayers.push_back(layer); } OptixDenoiserGuideLayer gl = {}; - if (guideLayer->albedo.data) + if (guideLayer->albedo.data) { gl.albedo = albedoTiles[t].input; - - if (guideLayer->normal.data) + } + if (guideLayer->normal.data) { gl.normal = normalTiles[t].input; - - if (guideLayer->flow.data) + } + if (guideLayer->flow.data) { gl.flow = flowTiles[t].input; - + } if (const OptixResult res = optixDenoiserInvoke(denoiser, stream, params, diff --git a/intern/cycles/kernel/device/gpu/parallel_active_index.h b/intern/cycles/kernel/device/gpu/parallel_active_index.h index 8399219b0f6..e1e74d8988b 100644 --- a/intern/cycles/kernel/device/gpu/parallel_active_index.h +++ b/intern/cycles/kernel/device/gpu/parallel_active_index.h @@ -34,8 +34,9 @@ void gpu_parallel_active_index_array_impl(const uint num_states, # ifdef WITH_ONEAPI_SYCL_HOST_TASK int write_index = 0; for (int state_index = 0; state_index < num_states; state_index++) { - if (is_active_op(state_index)) + if (is_active_op(state_index)) { indices[write_index++] = state_index; + } } *num_indices = write_index; return; diff --git a/intern/cycles/scene/camera.cpp b/intern/cycles/scene/camera.cpp index 50f13901c7a..74bbfe7b266 100644 --- a/intern/cycles/scene/camera.cpp +++ b/intern/cycles/scene/camera.cpp @@ -872,8 +872,9 @@ void Camera::set_osl_camera(Scene *scene, } else { hash = scene->osl_manager->shader_test_loaded(bytecode_hash); - if (!hash) + if (!hash) { hash = scene->osl_manager->shader_load_bytecode(bytecode_hash, bytecode); + } } bool changed = false; @@ -903,22 +904,25 @@ void Camera::set_osl_camera(Scene *scene, int vec_size = (int)param->type.aggregate; if (param->type.basetype == TypeDesc::INT) { vector data; - if (!params.get_int(param->name, data) || data.size() != vec_size) + if (!params.get_int(param->name, data) || data.size() != vec_size) { continue; + } raw_data.resize(sizeof(int) * vec_size); memcpy(raw_data.data(), data.data(), sizeof(int) * vec_size); } else if (param->type.basetype == TypeDesc::FLOAT) { vector data; - if (!params.get_float(param->name, data) || data.size() != vec_size) + if (!params.get_float(param->name, data) || data.size() != vec_size) { continue; + } raw_data.resize(sizeof(float) * vec_size); memcpy(raw_data.data(), data.data(), sizeof(float) * vec_size); } else if (param->type.basetype == TypeDesc::STRING) { string data; - if (!params.get_string(param->name, data)) + if (!params.get_string(param->name, data)) { continue; + } raw_data.resize(data.length() + 1); memcpy(raw_data.data(), data.c_str(), data.length() + 1); } @@ -941,8 +945,9 @@ void Camera::set_osl_camera(Scene *scene, /* Remove unused parameters. */ for (auto it = script_params.begin(); it != script_params.end();) { - if (used_params.count(it->first)) + if (used_params.count(it->first)) { it++; + } else { it = script_params.erase(it); changed = true; diff --git a/intern/cycles/scene/osl.cpp b/intern/cycles/scene/osl.cpp index 05f374c7594..94822bf3868 100644 --- a/intern/cycles/scene/osl.cpp +++ b/intern/cycles/scene/osl.cpp @@ -151,9 +151,9 @@ void OSLManager::device_update_post(Device *device, { /* Create the camera shader. */ if (need_update() && !scene->camera->script_name.empty()) { - if (progress.get_cancel()) + if (progress.get_cancel()) { return; - + } foreach_osl_device(device, [this, scene](Device *sub_device, OSLGlobals *og) { OSL::ShadingSystem *ss = get_shading_system(sub_device); diff --git a/intern/cycles/scene/shader_nodes.cpp b/intern/cycles/scene/shader_nodes.cpp index 5cb87ac1a26..bb38f01953f 100644 --- a/intern/cycles/scene/shader_nodes.cpp +++ b/intern/cycles/scene/shader_nodes.cpp @@ -4688,8 +4688,9 @@ void ParticleInfoNode::attributes(Shader *shader, AttributeRequestSet *attribute attributes->add(ATTR_STD_PARTICLE); } #if 0 /* not yet supported */ - if (!output("Rotation")->links.empty()) + if (!output("Rotation")->links.empty()) { attributes->add(ATTR_STD_PARTICLE); + } #endif if (!output("Size")->links.empty()) { attributes->add(ATTR_STD_PARTICLE); diff --git a/intern/cycles/util/math_base.h b/intern/cycles/util/math_base.h index 4ee9d4eca78..0206cb82126 100644 --- a/intern/cycles/util/math_base.h +++ b/intern/cycles/util/math_base.h @@ -553,10 +553,12 @@ ccl_device float compatible_powf(const float x, const float y) /* GPU pow doesn't accept negative x, do manual checks here */ if (x < 0.0f) { - if (fmodf(-y, 2.0f) == 0.0f) + if (fmodf(-y, 2.0f) == 0.0f) { return powf(-x, y); - else + } + else { return -powf(-x, y); + } } else if (x == 0.0f) return 0.0f; diff --git a/intern/cycles/util/transform.cpp b/intern/cycles/util/transform.cpp index 3e993735aed..541b41e92b5 100644 --- a/intern/cycles/util/transform.cpp +++ b/intern/cycles/util/transform.cpp @@ -89,9 +89,11 @@ static void transform_decompose(DecomposedTransform *decomp, const Transform *tf Transform Rnext; Transform Rit = transform_transposed_inverse(R); - for (int i = 0; i < 3; i++) - for (int j = 0; j < 4; j++) + for (int i = 0; i < 3; i++) { + for (int j = 0; j < 4; j++) { Rnext[i][j] = 0.5f * (R[i][j] + Rit[i][j]); + } + } norm = 0.0f; for (int i = 0; i < 3; i++) { @@ -104,8 +106,9 @@ static void transform_decompose(DecomposedTransform *decomp, const Transform *tf iteration++; } while (iteration < 100 && norm > 1e-4f); - if (transform_negative_scale(R)) + if (transform_negative_scale(R)) { R = R * transform_scale(-1.0f, -1.0f, -1.0f); + } decomp->x = transform_to_quat(R); diff --git a/intern/dualcon/intern/octree.cpp b/intern/dualcon/intern/octree.cpp index 4c22ad82015..f735f6a7cd4 100644 --- a/intern/dualcon/intern/octree.cpp +++ b/intern/dualcon/intern/octree.cpp @@ -349,8 +349,9 @@ void Octree::addTriangle(Triangle *trian, int triind) #if 0 static void print_depth(int height, int maxDepth) { - for (int i = 0; i < maxDepth - height; i++) + for (int i = 0; i < maxDepth - height; i++) { printf(" "); + } } #endif diff --git a/intern/ghost/intern/GHOST_ContextGLX.cc b/intern/ghost/intern/GHOST_ContextGLX.cc index b500c06afb0..0ba7b6067a0 100644 --- a/intern/ghost/intern/GHOST_ContextGLX.cc +++ b/intern/ghost/intern/GHOST_ContextGLX.cc @@ -165,11 +165,13 @@ GHOST_TSuccess GHOST_ContextGLX::initializeDrawingContext() } #ifdef WITH_GLEW_ES - if (!GLXEW_EXT_create_context_es_profile && profileBitES && m_contextMajorVersion == 1) + if (!GLXEW_EXT_create_context_es_profile && profileBitES && m_contextMajorVersion == 1) { fprintf(stderr, "Warning! OpenGL ES profile not available.\n"); + } - if (!GLXEW_EXT_create_context_es2_profile && profileBitES && m_contextMajorVersion == 2) + if (!GLXEW_EXT_create_context_es2_profile && profileBitES && m_contextMajorVersion == 2) { fprintf(stderr, "Warning! OpenGL ES2 profile not available.\n"); + } #endif int profileMask = 0; @@ -182,8 +184,9 @@ GHOST_TSuccess GHOST_ContextGLX::initializeDrawingContext() } #ifdef WITH_GLEW_ES - if (GLXEW_EXT_create_context_es_profile && profileBitES) + if (GLXEW_EXT_create_context_es_profile && profileBitES) { profileMask |= profileBitES; + } #endif if (profileMask != m_contextProfileMask) { diff --git a/intern/ghost/intern/GHOST_ContextWGL.cc b/intern/ghost/intern/GHOST_ContextWGL.cc index 2b832100769..80072861727 100644 --- a/intern/ghost/intern/GHOST_ContextWGL.cc +++ b/intern/ghost/intern/GHOST_ContextWGL.cc @@ -57,8 +57,9 @@ GHOST_ContextWGL::GHOST_ContextWGL(bool stereoVisual, GHOST_ContextWGL::~GHOST_ContextWGL() { if (m_hGLRC != nullptr) { - if (m_hGLRC == ::wglGetCurrentContext()) + if (m_hGLRC == ::wglGetCurrentContext()) { WIN32_CHK(::wglMakeCurrent(nullptr, nullptr)); + } if (m_hGLRC != s_sharedHGLRC || s_sharedCount == 1) { assert(s_sharedCount > 0); @@ -422,12 +423,14 @@ struct DummyContextWGL { { WIN32_CHK(::wglMakeCurrent(prevHDC, prevHGLRC)); - if (dummyHGLRC != nullptr) + if (dummyHGLRC != nullptr) { WIN32_CHK(::wglDeleteContext(dummyHGLRC)); + } if (dummyHWND != nullptr) { - if (dummyHDC != nullptr) + if (dummyHDC != nullptr) { WIN32_CHK(::ReleaseDC(dummyHWND, dummyHDC)); + } WIN32_CHK(::DestroyWindow(dummyHWND)); } @@ -488,8 +491,9 @@ static void reportContextString(const char *name, const char *dummy, const char { fprintf(stderr, "%s: %s\n", name, context); - if (dummy && strcmp(dummy, context) != 0) + if (dummy && strcmp(dummy, context) != 0) { fprintf(stderr, "Warning! Dummy %s: %s\n", name, dummy); + } } #endif @@ -514,8 +518,9 @@ GHOST_TSuccess GHOST_ContextWGL::initializeDrawingContext() iPixelFormat = choose_pixel_format_arb(m_stereoVisual, needAlpha); } - if (iPixelFormat == 0) + if (iPixelFormat == 0) { iPixelFormat = choose_pixel_format_legacy(m_hDC, dummy.preferredPFD); + } if (iPixelFormat == 0) { goto error; diff --git a/intern/ghost/intern/GHOST_ImeWin32.cc b/intern/ghost/intern/GHOST_ImeWin32.cc index 78a90990580..bcf30ac6174 100644 --- a/intern/ghost/intern/GHOST_ImeWin32.cc +++ b/intern/ghost/intern/GHOST_ImeWin32.cc @@ -309,12 +309,14 @@ void GHOST_ImeWin32::GetCaret(HIMC imm_context, LPARAM lparam, ImeComposition *c if (attribute_data) { ::ImmGetCompositionStringW(imm_context, GCS_COMPATTR, attribute_data, attribute_size); for (target_start = 0; target_start < attribute_size; ++target_start) { - if (IsTargetAttribute(attribute_data[target_start])) + if (IsTargetAttribute(attribute_data[target_start])) { break; + } } for (target_end = target_start; target_end < attribute_size; ++target_end) { - if (!IsTargetAttribute(attribute_data[target_end])) + if (!IsTargetAttribute(attribute_data[target_end])) { break; + } } if (target_start == attribute_size) { /** @@ -417,8 +419,9 @@ void GHOST_ImeWin32::EndIME(HWND window_handle) * For this case, we have to complete the ongoing composition and * clean up the resources attached to this object BEFORE DISABLING THE IME. */ - if (!is_enable) + if (!is_enable) { return; + } is_enable = false; CleanupComposition(window_handle); ::ImmAssociateContextEx(window_handle, nullptr, 0); @@ -427,8 +430,9 @@ void GHOST_ImeWin32::EndIME(HWND window_handle) void GHOST_ImeWin32::BeginIME(HWND window_handle, const GHOST_Rect &caret_rect, bool complete) { - if (is_enable && complete) + if (is_enable && complete) { return; + } is_enable = true; /** * Load the default IME context. @@ -466,10 +470,12 @@ void GHOST_ImeWin32::BeginIME(HWND window_handle, const GHOST_Rect &caret_rect, static void convert_utf16_to_utf8_len(std::wstring s, int &len) { - if (len >= 0 && len <= s.size()) + if (len >= 0 && len <= s.size()) { len = count_utf_8_from_16(s.substr(0, len).c_str()) - 1; - else + } + else { len = -1; + } } static size_t updateUtf8Buf(ImeComposition &info) diff --git a/intern/ghost/intern/GHOST_SystemCocoa.mm b/intern/ghost/intern/GHOST_SystemCocoa.mm index fccaeec7b65..96fb3707a34 100644 --- a/intern/ghost/intern/GHOST_SystemCocoa.mm +++ b/intern/ghost/intern/GHOST_SystemCocoa.mm @@ -1012,8 +1012,9 @@ bool GHOST_SystemCocoa::processEvents(bool /*waitForEvent*/) } else { timeOut = (double)(next - getMilliSeconds())/1000.0; - if (timeOut < 0.0) + if (timeOut < 0.0) { timeOut = 0.0; + } } ::ReceiveNextEvent(0, nullptr, timeOut, false, &event); diff --git a/intern/ghost/intern/GHOST_SystemSDL.cc b/intern/ghost/intern/GHOST_SystemSDL.cc index bed3d1e5c6f..ef31c145745 100644 --- a/intern/ghost/intern/GHOST_SystemSDL.cc +++ b/intern/ghost/intern/GHOST_SystemSDL.cc @@ -510,15 +510,17 @@ void GHOST_SystemSDL::processEvent(SDL_Event *sdl_event) #if 0 if (window->getCursorGrabMode() != GHOST_kGrabDisable && - window->getCursorGrabMode() != GHOST_kGrabNormal) { + window->getCursorGrabMode() != GHOST_kGrabNormal) + { int32_t x_new = x_root; int32_t y_new = y_root; int32_t x_accum, y_accum; GHOST_Rect bounds; /* fallback to window bounds */ - if (window->getCursorGrabBounds(bounds) == GHOST_kFailure) + if (window->getCursorGrabBounds(bounds) == GHOST_kFailure) { window->getClientBounds(bounds); + } /* Could also clamp to screen bounds wrap with a window outside the view will * fail at the moment. Use offset of 8 in case the window is at screen bounds. */ @@ -527,7 +529,7 @@ void GHOST_SystemSDL::processEvent(SDL_Event *sdl_event) /* Can't use #setCursorPosition because the mouse may have no focus! */ if (x_new != x_root || y_new != y_root) { - if (1 /* `xme.time > m_last_warp` */ ) { + if (1 /* `xme.time > m_last_warp` */) { /* when wrapping we don't need to add an event because the * #setCursorPosition call will cause a new event after */ SDL_WarpMouseInWindow(sdl_win, x_new - x_win, y_new - y_win); /* wrap */ @@ -539,12 +541,8 @@ void GHOST_SystemSDL::processEvent(SDL_Event *sdl_event) SDL_WarpMouseInWindow(sdl_win, x_new - x_win, y_new - y_win); } - g_event = new GHOST_EventCursor(event_ms, - GHOST_kEventCursorMove, - window, - x_new, - y_new, - GHOST_TABLET_DATA_NONE); + g_event = new GHOST_EventCursor( + event_ms, GHOST_kEventCursorMove, window, x_new, y_new, GHOST_TABLET_DATA_NONE); } else { g_event = new GHOST_EventCursor(event_ms, diff --git a/intern/ghost/test/gears/GHOST_Test.cpp b/intern/ghost/test/gears/GHOST_Test.cpp index a6b5184fe2d..905be6065e2 100644 --- a/intern/ghost/test/gears/GHOST_Test.cpp +++ b/intern/ghost/test/gears/GHOST_Test.cpp @@ -643,17 +643,20 @@ int main(int /*argc*/, char ** /*argv*/) "SOFTWARE\\NVIDIA Corporation\\Global\\Stereo3D\\StereoEnable", KEY_ALL_ACCESS); - if (lresult == ERROR_SUCCESS) + if (lresult == ERROR_SUCCESS) { printf("Successfully opened key\n"); + } # if 0 lresult = regkey.QueryValue(&keyValue, "StereoEnable"); - if (lresult == ERROR_SUCCESS) + if (lresult == ERROR_SUCCESS) { printf("Successfully queried key\n"); + } # endif lresult = regkey.SetValue( HKEY_LOCAL_MACHINE, "SOFTWARE\\NVIDIA Corporation\\Global\\Stereo3D\\StereoEnable", "1"); - if (lresult == ERROR_SUCCESS) + if (lresult == ERROR_SUCCESS) { printf("Successfully set value for key\n"); + } regkey.Close(); if (lresult == ERROR_SUCCESS) { printf("Successfully closed key\n"); diff --git a/intern/guardedalloc/intern/mallocn_guarded_impl.cc b/intern/guardedalloc/intern/mallocn_guarded_impl.cc index e4dc29a9968..1a5fae39ae9 100644 --- a/intern/guardedalloc/intern/mallocn_guarded_impl.cc +++ b/intern/guardedalloc/intern/mallocn_guarded_impl.cc @@ -561,8 +561,9 @@ void *MEM_guarded_mallocN(size_t len, const char *str) } #ifdef DEBUG_MEMCOUNTER - if (_mallocn_count == DEBUG_MEMCOUNTER_ERROR_VAL) + if (_mallocn_count == DEBUG_MEMCOUNTER_ERROR_VAL) { memcount_raise(__func__); + } memh->_count = _mallocn_count++; #endif return (++memh); @@ -651,8 +652,9 @@ void *MEM_guarded_mallocN_aligned(size_t len, } #ifdef DEBUG_MEMCOUNTER - if (_mallocn_count == DEBUG_MEMCOUNTER_ERROR_VAL) + if (_mallocn_count == DEBUG_MEMCOUNTER_ERROR_VAL) { memcount_raise(__func__); + } memh->_count = _mallocn_count++; #endif return (++memh); @@ -675,8 +677,9 @@ void *MEM_guarded_callocN(size_t len, const char *str) if (memh) { make_memhead_header(memh, len, str, AllocationType::ALLOC_FREE); #ifdef DEBUG_MEMCOUNTER - if (_mallocn_count == DEBUG_MEMCOUNTER_ERROR_VAL) + if (_mallocn_count == DEBUG_MEMCOUNTER_ERROR_VAL) { memcount_raise(__func__); + } memh->_count = _mallocn_count++; #endif return (++memh); @@ -1000,8 +1003,9 @@ short MEM_guarded_testN(void *vmemh) mem_lock_thread(); membl = membase->first; - if (membl) + if (membl) { membl = MEMNEXT(membl); + } while (membl) { if (vmemh == membl + 1) { @@ -1126,10 +1130,12 @@ static void addtail(volatile localListBase *listbase, void *vlink) /* for a generic API error checks here is fine but * the limited use here they will never be nullptr */ #if 0 - if (link == nullptr) + if (link == nullptr) { return; - if (listbase == nullptr) + } + if (listbase == nullptr) { return; + } #endif link->next = nullptr; @@ -1151,10 +1157,12 @@ static void remlink(volatile localListBase *listbase, void *vlink) /* for a generic API error checks here is fine but * the limited use here they will never be nullptr */ #if 0 - if (link == nullptr) + if (link == nullptr) { return; - if (listbase == nullptr) + } + if (listbase == nullptr) { return; + } #endif if (link->next) { @@ -1190,8 +1198,9 @@ static void rem_memblock(MemHead *memh) atomic_sub_and_fetch_z(&mem_in_use, memh->len); #ifdef DEBUG_MEMDUPLINAME - if (memh->need_free_name) + if (memh->need_free_name) { free((char *)memh->name); + } #endif if (UNLIKELY(malloc_debug_memset && memh->len)) { diff --git a/intern/iksolver/intern/IK_QTask.cpp b/intern/iksolver/intern/IK_QTask.cpp index d9d040eda45..aab110b5523 100644 --- a/intern/iksolver/intern/IK_QTask.cpp +++ b/intern/iksolver/intern/IK_QTask.cpp @@ -194,8 +194,9 @@ void IK_QCenterOfMassTask::ComputeJacobian(IK_QJacobian &jacobian) m_distance = d_pos.norm(); #if 0 - if (m_distance > m_clamp_length) + if (m_distance > m_clamp_length) { d_pos = (m_clamp_length / m_distance) * d_pos; + } #endif jacobian.SetBetas(m_id, m_size, m_weight * d_pos); diff --git a/intern/iksolver/intern/IK_Solver.cpp b/intern/iksolver/intern/IK_Solver.cpp index dcbee83983d..eeda7ddfd5e 100644 --- a/intern/iksolver/intern/IK_Solver.cpp +++ b/intern/iksolver/intern/IK_Solver.cpp @@ -407,8 +407,9 @@ static void IK_SolverAddCenterOfMass(IK_Solver *solver, float goal[3], float weight) { - if (solver == nullptr || root == nullptr) + if (solver == nullptr || root == nullptr) { return; + } IK_QSolver *qsolver = (IK_QSolver *)solver; IK_QSegment *qroot = (IK_QSegment *)root; diff --git a/intern/itasc/Scene.cpp b/intern/itasc/Scene.cpp index d9ebd9f3464..d0ebc98d5cf 100644 --- a/intern/itasc/Scene.cpp +++ b/intern/itasc/Scene.cpp @@ -115,8 +115,9 @@ bool Scene::addObject(const std::string &name, const std::string &baseFrame) { // finalize the object before adding - if (!object->finalize()) + if (!object->finalize()) { return false; + } // Check if Object is controlled or uncontrolled. if (object->getType() == Object::Controlled) { int baseFrameIndex = base->addEndEffector(baseFrame); @@ -188,12 +189,14 @@ bool Scene::addConstraintSet(const std::string &name, // Check if objects exist: ObjectMap::iterator object1_it = objects.find(object1); ObjectMap::iterator object2_it = objects.find(object2); - if (object1_it == objects.end() || object2_it == objects.end()) + if (object1_it == objects.end() || object2_it == objects.end()) { return false; + } int ee1_index = object1_it->second->object->addEndEffector(ee1); int ee2_index = object2_it->second->object->addEndEffector(ee2); - if (ee1_index < 0 || ee2_index < 0) + if (ee1_index < 0 || ee2_index < 0) { return false; + } std::pair result = constraints.insert(ConstraintMap::value_type( name, new ConstraintSet_struct(task, @@ -203,8 +206,9 @@ bool Scene::addConstraintSet(const std::string &name, ee2_index, Range(m_ncTotal, task->getNrOfConstraints()), Range(6 * m_nsets, 6)))); - if (!result.second) + if (!result.second) { return false; + } m_ncTotal += task->getNrOfConstraints(); m_nsets += 1; return true; @@ -234,8 +238,9 @@ bool Scene::initialize() { // prepare all matrices: - if (m_ncTotal == 0 || m_nqTotal == 0 || m_nsets == 0) + if (m_ncTotal == 0 || m_nqTotal == 0 || m_nsets == 0) { return false; + } m_A = e_zero_matrix(m_ncTotal, m_nqTotal); if (m_nuTotal > 0) { @@ -284,10 +289,12 @@ bool Scene::initialize() project(m_Cf, cs->constraintrange, cs->featurerange) = cs->task->getCf(); } - if (m_solver != NULL) + if (m_solver != NULL) { m_solver->init(m_nqTotal, m_ncTotal, m_ytask); - else + } + else { return false; + } return result; } @@ -315,8 +322,9 @@ bool Scene::update(double timestamp, bool interpolate) { // we must have valid timestep and timestamp - if (timestamp < KDL::epsilon || timestep < 0.0) + if (timestamp < KDL::epsilon || timestep < 0.0) { return false; + } Timestamp ts; ts.realTimestamp = timestamp; // initially we start with the full timestep to allow velocity estimation over the full interval @@ -332,8 +340,9 @@ bool Scene::update(double timestamp, ts.update = 1; ts.numstep = (numsubstep & 0xFF); bool autosubstep = (numsubstep == 0) ? true : false; - if (numsubstep < 1) + if (numsubstep < 1) { numsubstep = 1; + } double timesubstep = timestep / numsubstep; double timeleft = timestep; diff --git a/intern/opensubdiv/internal/evaluator/gpu_patch_table.cc b/intern/opensubdiv/internal/evaluator/gpu_patch_table.cc index 9281cd5f0cb..00e1cbcb8f8 100644 --- a/intern/opensubdiv/internal/evaluator/gpu_patch_table.cc +++ b/intern/opensubdiv/internal/evaluator/gpu_patch_table.cc @@ -14,8 +14,9 @@ namespace blender::opensubdiv { GPUPatchTable *GPUPatchTable::Create(PatchTable const *far_patch_table, void * /*deviceContext*/) { GPUPatchTable *instance = new GPUPatchTable(); - if (instance->allocate(far_patch_table)) + if (instance->allocate(far_patch_table)) { return instance; + } delete instance; return nullptr; } diff --git a/intern/utfconv/utfconv.cc b/intern/utfconv/utfconv.cc index bff9dbb0a98..65ea5a682aa 100644 --- a/intern/utfconv/utfconv.cc +++ b/intern/utfconv/utfconv.cc @@ -259,9 +259,11 @@ int conv_utf_8_to_16(const char *in8, wchar_t *out16, size_t size16) #if 0 static int is_ascii(const char *in8) { - for (; *in8; in8++) - if (0x80 & *in8) + for (; *in8; in8++) { + if (0x80 & *in8) { return 0; + } + } return 1; } @@ -270,9 +272,9 @@ static void utf_8_cut_end(char *inout8, size_t maxcutpoint) { char *cur = inout8 + maxcutpoint; char cc; - if (!inout8) + if (!inout8) { return; - + } cc = *cur; } #endif diff --git a/source/blender/blenlib/intern/winstuff.cc b/source/blender/blenlib/intern/winstuff.cc index ce34d2ab0b1..cdd9ba162e8 100644 --- a/source/blender/blenlib/intern/winstuff.cc +++ b/source/blender/blenlib/intern/winstuff.cc @@ -193,8 +193,9 @@ bool BLI_windows_register_blend_extension(const bool all_users) GetModuleFileName(0, blender_path, sizeof(blender_path)); /* Prevent overflow when we add -launcher to the executable name. */ - if (strlen(blender_path) > (sizeof(blender_path) - 10)) + if (strlen(blender_path) > (sizeof(blender_path) - 10)) { return false; + } /* Replace the actual app name with the wrapper. */ blender_app = strstr(blender_path, "blender.exe"); diff --git a/source/blender/draw/intern/shaders/subdiv_patch_evaluation_comp.glsl b/source/blender/draw/intern/shaders/subdiv_patch_evaluation_comp.glsl index dcaae17f521..5f5ecd01895 100644 --- a/source/blender/draw/intern/shaders/subdiv_patch_evaluation_comp.glsl +++ b/source/blender/draw/intern/shaders/subdiv_patch_evaluation_comp.glsl @@ -61,13 +61,13 @@ PatchHandle bogus_patch_handle() int transformUVToQuadQuadrant(float median, inout float u, inout float v) { int uHalf = (u >= median) ? 1 : 0; - if (uHalf != 0) + if (uHalf != 0) { u -= median; - + } int vHalf = (v >= median) ? 1 : 0; - if (vHalf != 0) + if (vHalf != 0) { v -= median; - + } return (vHalf << 1) | uHalf; } diff --git a/source/blender/editors/animation/anim_channels_edit.cc b/source/blender/editors/animation/anim_channels_edit.cc index a3b3e090efa..d9ec793a3a2 100644 --- a/source/blender/editors/animation/anim_channels_edit.cc +++ b/source/blender/editors/animation/anim_channels_edit.cc @@ -2920,8 +2920,9 @@ static wmOperatorStatus animchannels_delete_exec(bContext *C, wmOperator * /*op* * the same loop. */ if (ac.datatype != ANIMCONT_DRIVERS) { /* Keep deleting container-like channels until there are no more to delete. */ - while (animchannels_delete_containers(C, &ac)) - ; + while (animchannels_delete_containers(C, &ac)) { + /* Pass. */ + } } /* filter data */ diff --git a/source/blender/editors/render/render_preview.cc b/source/blender/editors/render/render_preview.cc index 2e08c5987be..b3718c276af 100644 --- a/source/blender/editors/render/render_preview.cc +++ b/source/blender/editors/render/render_preview.cc @@ -1245,8 +1245,9 @@ static void shader_preview_render(ShaderPreview *sp, ID *id, int split, int firs #if 0 if (idtype == ID_TE) { Tex *tex = (Tex *)id; - if (tex->use_nodes && tex->nodetree) + if (tex->use_nodes && tex->nodetree) { ntreeEndExecTree(tex->nodetree); + } } #endif } diff --git a/source/blender/gpu/shaders/material/gpu_shader_material_tex_image.glsl b/source/blender/gpu/shaders/material/gpu_shader_material_tex_image.glsl index 5a1f1fa4675..72361cfe409 100644 --- a/source/blender/gpu/shaders/material/gpu_shader_material_tex_image.glsl +++ b/source/blender/gpu/shaders/material/gpu_shader_material_tex_image.glsl @@ -182,18 +182,18 @@ bool node_tex_tile_lookup(inout float3 co, sampler2DArray ima, sampler1DArray ma { float2 tile_pos = floor(co.xy); - if (tile_pos.x < 0 || tile_pos.y < 0 || tile_pos.x >= 10) + if (tile_pos.x < 0 || tile_pos.y < 0 || tile_pos.x >= 10) { return false; - + } float tile = 10 * tile_pos.y + tile_pos.x; - if (tile >= textureSize(map, 0).x) + if (tile >= textureSize(map, 0).x) { return false; - + } /* Fetch tile information. */ float tile_layer = texelFetch(map, int2(tile, 0), 0).x; - if (tile_layer < 0) + if (tile_layer < 0) { return false; - + } float4 tile_info = texelFetch(map, int2(tile, 1), 0); co = float3(((co.xy - tile_pos) * tile_info.zw) + tile_info.xy, tile_layer); diff --git a/source/blender/makesrna/intern/rna_nodetree.cc b/source/blender/makesrna/intern/rna_nodetree.cc index 46d2647a57c..70ccd0d3265 100644 --- a/source/blender/makesrna/intern/rna_nodetree.cc +++ b/source/blender/makesrna/intern/rna_nodetree.cc @@ -4484,11 +4484,12 @@ static void rna_NodeCryptomatte_image_set(PointerRNA *ptr, bNode *node = ptr->data_as(); if (node->custom1 == CMP_NODE_CRYPTOMATTE_SOURCE_IMAGE) { - if (node->id) + if (node->id) { id_us_min(node->id); - if (value.data) + } + if (value.data) { id_us_plus(static_cast(value.data)); - + } node->id = static_cast(value.data); } } diff --git a/source/blender/makesrna/intern/rna_particle.cc b/source/blender/makesrna/intern/rna_particle.cc index e66aa26dd6f..b295849fb48 100644 --- a/source/blender/makesrna/intern/rna_particle.cc +++ b/source/blender/makesrna/intern/rna_particle.cc @@ -992,8 +992,9 @@ static void rna_PartSettings_start_set(PointerRNA *ptr, float value) } # if 0 - if (settings->type == PART_REACTOR && value < 1.0) + if (settings->type == PART_REACTOR && value < 1.0) { value = 1.0; + } else # endif if (value < MINAFRAMEF) { diff --git a/source/blender/modifiers/intern/lineart/MOD_lineart.hh b/source/blender/modifiers/intern/lineart/MOD_lineart.hh index 838f283db26..1c1e88bee03 100644 --- a/source/blender/modifiers/intern/lineart/MOD_lineart.hh +++ b/source/blender/modifiers/intern/lineart/MOD_lineart.hh @@ -850,9 +850,9 @@ BLI_INLINE int lineart_line_isec_2d_ignore_line2pos(const double a1[2], k1 = (a2[1] - a1[1]) / x_diff; k2 = (b2[1] - b1[1]) / x_diff2; - if ((k1 == k2)) + if ((k1 == k2)) { return 0; - + } x = (a1[1] - b1[1] - k1 * a1[0] + k2 * b1[0]) / (k2 - k1); ratio = (x - a1[0]) / x_diff; @@ -861,9 +861,9 @@ BLI_INLINE int lineart_line_isec_2d_ignore_line2pos(const double a1[2], } } - if (ratio <= 0 || ratio >= 1) + if (ratio <= 0 || ratio >= 1) { return 0; - + } return 1; #endif } diff --git a/source/blender/render/intern/multires_bake.cc b/source/blender/render/intern/multires_bake.cc index 5e35d3ff2b2..0c06076900f 100644 --- a/source/blender/render/intern/multires_bake.cc +++ b/source/blender/render/intern/multires_bake.cc @@ -1112,12 +1112,15 @@ static void build_permutation_table(ushort permutation[], * every entry must appear exactly once */ # if 0 - for (i = 0; i < number_of_rays; i++) + for (i = 0; i < number_of_rays; i++) { temp_permutation[i] = 0; - for (i = 0; i < number_of_rays; i++) + } + for (i = 0; i < number_of_rays; i++) { ++temp_permutation[permutation[i]]; - for (i = 0; i < number_of_rays; i++) + } + for (i = 0; i < number_of_rays; i++) { BLI_assert(temp_permutation[i] == 1); + } # endif } diff --git a/source/creator/blender_launcher_win32.c b/source/creator/blender_launcher_win32.c index 9486caa554d..2ad4dc61ed3 100644 --- a/source/creator/blender_launcher_win32.c +++ b/source/creator/blender_launcher_win32.c @@ -12,8 +12,9 @@ BOOL LaunchedFromSteam() { HANDLE hSnapShot = CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0); BOOL isSteam = FALSE; - if (!hSnapShot) + if (!hSnapShot) { return (FALSE); + } PROCESSENTRY32 process_entry; process_entry.dwSize = sizeof(PROCESSENTRY32);