From 057c9364fc8177c74e7b82cdd2873506fe7e1867 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Tue, 12 Sep 2023 14:48:20 +1000 Subject: [PATCH] Cleanup: use braces around statements --- intern/ghost/intern/GHOST_ContextWGL.cc | 56 +++++++++++++------ .../ghost/intern/GHOST_DisplayManagerWin32.cc | 9 ++- intern/ghost/intern/GHOST_SystemPathsWin32.cc | 3 +- intern/ghost/intern/GHOST_SystemX11.cc | 3 +- intern/ghost/intern/GHOST_WindowWin32.cc | 13 +++-- intern/ghost/intern/GHOST_WindowX11.cc | 3 +- intern/ghost/test/gears/GHOST_C-Test.c | 3 +- intern/ghost/test/gears/GHOST_Test.cpp | 3 +- intern/ghost/test/multitest/MultiTest.c | 24 +++++--- intern/guardedalloc/cpp/mallocn.cpp | 6 +- intern/guardedalloc/test/simpletest/memtest.c | 15 +++-- source/blender/blenlib/intern/system_win32.c | 3 +- source/blender/blenloader/intern/readfile.cc | 5 +- .../space_sequencer/sequencer_modifier.cc | 3 +- .../ply/exporter/ply_export_load_plydata.cc | 3 +- source/blender/io/ply/importer/ply_import.cc | 3 +- .../io/ply/importer/ply_import_buffer.cc | 3 +- .../io/ply/importer/ply_import_data.cc | 9 ++- .../io/ply/tests/io_ply_exporter_test.cc | 3 +- source/blender/sequencer/intern/sound.cc | 18 ++++-- 20 files changed, 125 insertions(+), 63 deletions(-) diff --git a/intern/ghost/intern/GHOST_ContextWGL.cc b/intern/ghost/intern/GHOST_ContextWGL.cc index 72a0ac775d2..42da0b862f6 100644 --- a/intern/ghost/intern/GHOST_ContextWGL.cc +++ b/intern/ghost/intern/GHOST_ContextWGL.cc @@ -65,8 +65,9 @@ GHOST_ContextWGL::~GHOST_ContextWGL() s_sharedCount--; - if (s_sharedCount == 0) + if (s_sharedCount == 0) { s_sharedHGLRC = nullptr; + } WIN32_CHK(::wglDeleteContext(m_hGLRC)); } @@ -88,10 +89,12 @@ GHOST_TSuccess GHOST_ContextWGL::swapBuffers() GHOST_TSuccess GHOST_ContextWGL::setSwapInterval(int interval) { - if (epoxy_has_wgl_extension(m_hDC, "WGL_EXT_swap_control")) + if (epoxy_has_wgl_extension(m_hDC, "WGL_EXT_swap_control")) { return WIN32_CHK(::wglSwapIntervalEXT(interval)) == TRUE ? GHOST_kSuccess : GHOST_kFailure; - else + } + else { return GHOST_kFailure; + } } GHOST_TSuccess GHOST_ContextWGL::getSwapInterval(int &intervalOut) @@ -149,8 +152,9 @@ static int weight_pixel_format(PIXELFORMATDESCRIPTOR &pfd, PIXELFORMATDESCRIPTOR weight += pfd.cColorBits - 8; - if (preferredPFD.cAlphaBits > 0 && pfd.cAlphaBits > 0) + if (preferredPFD.cAlphaBits > 0 && pfd.cAlphaBits > 0) { weight++; + } #ifdef WIN32_COMPOSITING if ((preferredPFD.dwFlags & PFD_SUPPORT_COMPOSITION) && (pfd.dwFlags & PFD_SUPPORT_COMPOSITION)) weight++; @@ -200,8 +204,9 @@ static int choose_pixel_format_legacy(HDC hDC, PIXELFORMATDESCRIPTOR &preferredP } /* choose any available stereo format over a non-stereo format */ - if (iStereoPixelFormat != 0) + if (iStereoPixelFormat != 0) { iPixelFormat = iStereoPixelFormat; + } if (iPixelFormat == 0) { fprintf(stderr, "Warning! Using result of ChoosePixelFormat.\n"); @@ -372,36 +377,44 @@ struct DummyContextWGL { dummyPixelFormat = choose_pixel_format_legacy(hDC, preferredPFD); - if (dummyPixelFormat == 0) + if (dummyPixelFormat == 0) { return; + } PIXELFORMATDESCRIPTOR chosenPFD; if (!WIN32_CHK(::DescribePixelFormat( hDC, dummyPixelFormat, sizeof(PIXELFORMATDESCRIPTOR), &chosenPFD))) + { return; + } if (hWnd) { dummyHWND = clone_window(hWnd, nullptr); - if (dummyHWND == nullptr) + if (dummyHWND == nullptr) { return; + } dummyHDC = GetDC(dummyHWND); } - if (!WIN32_CHK(dummyHDC != nullptr)) + if (!WIN32_CHK(dummyHDC != nullptr)) { return; + } - if (!WIN32_CHK(::SetPixelFormat(dummyHDC, dummyPixelFormat, &chosenPFD))) + if (!WIN32_CHK(::SetPixelFormat(dummyHDC, dummyPixelFormat, &chosenPFD))) { return; + } dummyHGLRC = ::wglCreateContext(dummyHDC); - if (!WIN32_CHK(dummyHGLRC != nullptr)) + if (!WIN32_CHK(dummyHGLRC != nullptr)) { return; + } - if (!WIN32_CHK(::wglMakeCurrent(dummyHDC, dummyHGLRC))) + if (!WIN32_CHK(::wglMakeCurrent(dummyHDC, dummyHGLRC))) { return; + } has_WGL_ARB_pixel_format = epoxy_has_wgl_extension(hDC, "WGL_ARB_pixel_format"); has_WGL_ARB_create_context = epoxy_has_wgl_extension(hDC, "WGL_ARB_create_context"); @@ -523,8 +536,9 @@ GHOST_TSuccess GHOST_ContextWGL::initializeDrawingContext() if (!dummy.has_WGL_ARB_create_context || ::GetPixelFormat(m_hDC) == 0) { int iPixelFormat = 0; - if (dummy.has_WGL_ARB_pixel_format) + if (dummy.has_WGL_ARB_pixel_format) { iPixelFormat = choose_pixel_format_arb(m_stereoVisual, needAlpha); + } if (iPixelFormat == 0) iPixelFormat = choose_pixel_format_legacy(m_hDC, dummy.preferredPFD); @@ -541,8 +555,9 @@ GHOST_TSuccess GHOST_ContextWGL::initializeDrawingContext() goto error; } - if (needAlpha && chosenPFD.cAlphaBits == 0) + if (needAlpha && chosenPFD.cAlphaBits == 0) { fprintf(stderr, "Warning! Unable to find a pixel format with an alpha channel.\n"); + } if (!WIN32_CHK(::SetPixelFormat(m_hDC, iPixelFormat, &chosenPFD))) { goto error; @@ -553,22 +568,27 @@ GHOST_TSuccess GHOST_ContextWGL::initializeDrawingContext() int profileBitCore = m_contextProfileMask & WGL_CONTEXT_CORE_PROFILE_BIT_ARB; int profileBitCompat = m_contextProfileMask & WGL_CONTEXT_COMPATIBILITY_PROFILE_BIT_ARB; - if (!dummy.has_WGL_ARB_create_context_profile && profileBitCore) + if (!dummy.has_WGL_ARB_create_context_profile && profileBitCore) { fprintf(stderr, "Warning! OpenGL core profile not available.\n"); + } - if (!dummy.has_WGL_ARB_create_context_profile && profileBitCompat) + if (!dummy.has_WGL_ARB_create_context_profile && profileBitCompat) { fprintf(stderr, "Warning! OpenGL compatibility profile not available.\n"); + } int profileMask = 0; - if (dummy.has_WGL_ARB_create_context_profile && profileBitCore) + if (dummy.has_WGL_ARB_create_context_profile && profileBitCore) { profileMask |= profileBitCore; + } - if (dummy.has_WGL_ARB_create_context_profile && profileBitCompat) + if (dummy.has_WGL_ARB_create_context_profile && profileBitCompat) { profileMask |= profileBitCompat; + } - if (profileMask != m_contextProfileMask) + if (profileMask != m_contextProfileMask) { fprintf(stderr, "Warning! Ignoring untested OpenGL context profile mask bits."); + } std::vector iAttributes; diff --git a/intern/ghost/intern/GHOST_DisplayManagerWin32.cc b/intern/ghost/intern/GHOST_DisplayManagerWin32.cc index 77b0e2f3af9..5a8eb99ddd6 100644 --- a/intern/ghost/intern/GHOST_DisplayManagerWin32.cc +++ b/intern/ghost/intern/GHOST_DisplayManagerWin32.cc @@ -41,8 +41,9 @@ GHOST_TSuccess GHOST_DisplayManagerWin32::getNumDisplaySettings(uint8_t display, * function was called with #iModeNum set to zero. */ DISPLAY_DEVICE display_device; - if (!get_dd(display, &display_device)) + if (!get_dd(display, &display_device)) { return GHOST_kFailure; + } numSettings = 0; DEVMODE dm; @@ -57,8 +58,9 @@ GHOST_TSuccess GHOST_DisplayManagerWin32::getDisplaySetting(uint8_t display, GHOST_DisplaySetting &setting) const { DISPLAY_DEVICE display_device; - if (!get_dd(display, &display_device)) + if (!get_dd(display, &display_device)) { return GHOST_kFailure; + } GHOST_TSuccess success; DEVMODE dm; @@ -102,8 +104,9 @@ GHOST_TSuccess GHOST_DisplayManagerWin32::setCurrentDisplaySetting( uint8_t display, const GHOST_DisplaySetting &setting) { DISPLAY_DEVICE display_device; - if (!get_dd(display, &display_device)) + if (!get_dd(display, &display_device)) { return GHOST_kFailure; + } GHOST_DisplaySetting match; findMatch(display, setting, match); diff --git a/intern/ghost/intern/GHOST_SystemPathsWin32.cc b/intern/ghost/intern/GHOST_SystemPathsWin32.cc index 12fd73358b0..58fea5ebc19 100644 --- a/intern/ghost/intern/GHOST_SystemPathsWin32.cc +++ b/intern/ghost/intern/GHOST_SystemPathsWin32.cc @@ -130,8 +130,9 @@ void GHOST_SystemPathsWin32::addToSystemRecentFiles(const char *filepath) const IShellItem *shell_item; HRESULT hr = CoInitializeEx(nullptr, COINIT_APARTMENTTHREADED | COINIT_DISABLE_OLE1DDE); - if (!SUCCEEDED(hr)) + if (!SUCCEEDED(hr)) { return; + } hr = SHCreateItemFromParsingName(filepath_16, nullptr, IID_PPV_ARGS(&shell_item)); if (SUCCEEDED(hr)) { diff --git a/intern/ghost/intern/GHOST_SystemX11.cc b/intern/ghost/intern/GHOST_SystemX11.cc index abc5e7eca32..de81a9ddf8f 100644 --- a/intern/ghost/intern/GHOST_SystemX11.cc +++ b/intern/ghost/intern/GHOST_SystemX11.cc @@ -2734,8 +2734,9 @@ void GHOST_SystemX11::refreshXInputDevices() void GHOST_SystemX11::clearXInputDevices() { for (GHOST_TabletX11 &xtablet : m_xtablets) { - if (xtablet.Device) + if (xtablet.Device) { XCloseDevice(m_display, xtablet.Device); + } } m_xtablets.clear(); diff --git a/intern/ghost/intern/GHOST_WindowWin32.cc b/intern/ghost/intern/GHOST_WindowWin32.cc index 3ea3412717b..05418b20599 100644 --- a/intern/ghost/intern/GHOST_WindowWin32.cc +++ b/intern/ghost/intern/GHOST_WindowWin32.cc @@ -671,8 +671,9 @@ void GHOST_WindowWin32::updateMouseCapture(GHOST_MouseCaptureEventWin32 event) m_nPressedButtons++; break; case MouseReleased: - if (m_nPressedButtons) + if (m_nPressedButtons) { m_nPressedButtons--; + } break; case OperatorGrab: m_hasGrabMouse = true; @@ -821,12 +822,14 @@ HCURSOR GHOST_WindowWin32::getStandardCursor(GHOST_TStandardCursor shape) const void GHOST_WindowWin32::loadCursor(bool visible, GHOST_TStandardCursor shape) const { if (!visible) { - while (::ShowCursor(FALSE) >= 0) - ; + while (::ShowCursor(FALSE) >= 0) { + /* Pass. */ + } } else { - while (::ShowCursor(TRUE) < 0) - ; + while (::ShowCursor(TRUE) < 0) { + /* Pass. */ + } } HCURSOR cursor = getStandardCursor(shape); diff --git a/intern/ghost/intern/GHOST_WindowX11.cc b/intern/ghost/intern/GHOST_WindowX11.cc index 55b2b21219e..8e8f17c541c 100644 --- a/intern/ghost/intern/GHOST_WindowX11.cc +++ b/intern/ghost/intern/GHOST_WindowX11.cc @@ -402,8 +402,9 @@ bool GHOST_WindowX11::createX11_XIC() XNDestroyCallback, &destroy, nullptr); - if (!m_xic) + if (!m_xic) { return false; + } ulong fevent; XGetICValues(m_xic, XNFilterEvents, &fevent, nullptr); diff --git a/intern/ghost/test/gears/GHOST_C-Test.c b/intern/ghost/test/gears/GHOST_C-Test.c index e79710c5036..dabc2f40066 100644 --- a/intern/ghost/test/gears/GHOST_C-Test.c +++ b/intern/ghost/test/gears/GHOST_C-Test.c @@ -397,8 +397,9 @@ bool processEvent(GHOST_EventHandle hEvent, GHOST_TUserDataPtr userData) break; case GHOST_kEventWindowUpdate: { GHOST_WindowHandle window2 = GHOST_GetEventWindow(hEvent); - if (!GHOST_ValidWindow(shSystem, window2)) + if (!GHOST_ValidWindow(shSystem, window2)) { break; + } setViewPortGL(window2); drawGL(); GHOST_SwapWindowBuffers(window2); diff --git a/intern/ghost/test/gears/GHOST_Test.cpp b/intern/ghost/test/gears/GHOST_Test.cpp index d6a42298c4c..3e6176774a9 100644 --- a/intern/ghost/test/gears/GHOST_Test.cpp +++ b/intern/ghost/test/gears/GHOST_Test.cpp @@ -602,8 +602,9 @@ bool Application::processEvent(GHOST_IEvent *event) case GHOST_kEventWindowUpdate: { GHOST_IWindow *window2 = event->getWindow(); - if (!m_system->validWindow(window2)) + if (!m_system->validWindow(window2)) { break; + } glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); diff --git a/intern/ghost/test/multitest/MultiTest.c b/intern/ghost/test/multitest/MultiTest.c index fa2d5d14d0a..9dd8dbfe0b6 100644 --- a/intern/ghost/test/multitest/MultiTest.c +++ b/intern/ghost/test/multitest/MultiTest.c @@ -78,10 +78,12 @@ void rect_bevel_side(int rect[2][2], int side, float *lt, float *dk, const float int x = (corner == 0 || corner == 1) ? (rect[0][0] + i) : (rect[1][0] - i - 1); int y = (corner == 0 || corner == 3) ? (rect[0][1] + i) : (rect[1][1] - i - 1); - if (ltidx == corner) + if (ltidx == corner) { glColor3f(col[0] * ltf, col[1] * ltf, col[2] * ltf); - if (dkidx == corner) + } + if (dkidx == corner) { glColor3f(col[0] * dkf, col[1] * dkf, col[2] * dkf); + } glVertex2i(lx, ly); glVertex2i(lx = x, ly = y); @@ -513,8 +515,9 @@ static void loggerwindow_do_key(LoggerWindow *lw, GHOST_TKey key, int press) { switch (key) { case GHOST_kKeyQ: - if (press) + if (press) { multitestapp_exit(lw->app); + } break; } } @@ -685,8 +688,9 @@ static void extrawindow_do_key(ExtraWindow *ew, GHOST_TKey key, int press) { switch (key) { case GHOST_kKeyE: - if (press) + if (press) { multitestapp_toggle_extra_window(ew->app); + } break; } } @@ -862,19 +866,23 @@ MultiTestApp *multitestapp_new(void) GHOST_EventConsumerHandle consumer = GHOST_CreateEventConsumer(multitest_event_handler, app); app->sys = GHOST_CreateSystem(); - if (!app->sys) + if (!app->sys) { fatal("Unable to create ghost system"); + } - if (!GHOST_AddEventConsumer(app->sys, consumer)) + if (!GHOST_AddEventConsumer(app->sys, consumer)) { fatal("Unable to add multitest event consumer "); + } app->main = mainwindow_new(app); - if (!app->main) + if (!app->main) { fatal("Unable to create main window"); + } app->logger = loggerwindow_new(app); - if (!app->logger) + if (!app->logger) { fatal("Unable to create logger window"); + } app->extra = NULL; app->exit = 0; diff --git a/intern/guardedalloc/cpp/mallocn.cpp b/intern/guardedalloc/cpp/mallocn.cpp index 39cd467e297..a86704adf91 100644 --- a/intern/guardedalloc/cpp/mallocn.cpp +++ b/intern/guardedalloc/cpp/mallocn.cpp @@ -34,12 +34,14 @@ void *operator new[](size_t size) void operator delete(void *p) throw() { /* delete NULL is valid in c++ */ - if (p) + if (p) { MEM_freeN(p); + } } void operator delete[](void *p) throw() { /* delete NULL is valid in c++ */ - if (p) + if (p) { MEM_freeN(p); + } } diff --git a/intern/guardedalloc/test/simpletest/memtest.c b/intern/guardedalloc/test/simpletest/memtest.c index db03fe791be..d6f68ed2cab 100644 --- a/intern/guardedalloc/test/simpletest/memtest.c +++ b/intern/guardedalloc/test/simpletest/memtest.c @@ -39,8 +39,9 @@ int main(int argc, char *argv[]) switch (argc) { case 2: verbose = atoi(argv[1]); - if (verbose < 0) + if (verbose < 0) { verbose = 0; + } break; case 1: default: @@ -59,15 +60,17 @@ int main(int argc, char *argv[]) for (i = 0; i < NUM_BLOCKS; i++) { int blocksize = 10000; char tagstring[1000]; - if (verbose > 1) + if (verbose > 1) { printf("|--* Allocating block %d\n", i); + } sprintf(tagstring, "Memblock no. %d : ", i); p[i] = MEM_callocN(blocksize, strdup(tagstring)); } /* report on that */ - if (verbose > 1) + if (verbose > 1) { MEM_printmemlist(); + } /* memory is there: test it */ error_status = MEM_consistency_check(); @@ -94,16 +97,18 @@ int main(int argc, char *argv[]) for (i = 0; i < NUM_BLOCKS; i++) { int blocksize = 10000; char tagstring[1000]; - if (verbose > 1) + if (verbose > 1) { printf("|--* Allocating block %d\n", i); + } sprintf(tagstring, "Memblock no. %d : ", i); p[i] = MEM_callocN(blocksize, strdup(tagstring)); } /* Now corrupt a few blocks. */ ip = (int *)p[5] - 50; - for (i = 0; i < 1000; i++, ip++) + for (i = 0; i < 1000; i++, ip++) { *ip = i + 1; + } ip = (int *)p[6]; *(ip + 10005) = 0; diff --git a/source/blender/blenlib/intern/system_win32.c b/source/blender/blenlib/intern/system_win32.c index 93d4a12c43c..8b384a670d5 100644 --- a/source/blender/blenlib/intern/system_win32.c +++ b/source/blender/blenlib/intern/system_win32.c @@ -227,8 +227,9 @@ static void bli_windows_system_backtrace_modules(FILE *fp) { fprintf(fp, "Loaded Modules :\n"); HANDLE hModuleSnap = CreateToolhelp32Snapshot(TH32CS_SNAPMODULE, 0); - if (hModuleSnap == INVALID_HANDLE_VALUE) + if (hModuleSnap == INVALID_HANDLE_VALUE) { return; + } MODULEENTRY32 me32; me32.dwSize = sizeof(MODULEENTRY32); diff --git a/source/blender/blenloader/intern/readfile.cc b/source/blender/blenloader/intern/readfile.cc index 44a4ba895a4..52ed617748a 100644 --- a/source/blender/blenloader/intern/readfile.cc +++ b/source/blender/blenloader/intern/readfile.cc @@ -573,8 +573,9 @@ void blo_readfile_invalidate(FileData *fd, Main *bmain, const char *message) /* Tag given `bmain`, and 'root 'local' main one (in case given one is a library one) as invalid. */ bmain->is_read_invalid = true; - for (; bmain->prev != nullptr; bmain = bmain->prev) - ; + for (; bmain->prev != nullptr; bmain = bmain->prev) { + /* Pass. */ + } bmain->is_read_invalid = true; BLO_reportf_wrap(fd->reports, diff --git a/source/blender/editors/space_sequencer/sequencer_modifier.cc b/source/blender/editors/space_sequencer/sequencer_modifier.cc index 41ae5ffdd43..caa6d5293f6 100644 --- a/source/blender/editors/space_sequencer/sequencer_modifier.cc +++ b/source/blender/editors/space_sequencer/sequencer_modifier.cc @@ -263,8 +263,9 @@ static int strip_modifier_copy_exec(bContext *C, wmOperator *op) /* If original is sound, only copy to "sound" strips * If original is not sound, only copy to "not sound" strips */ - if (isSound != seq_iter_is_sound) + if (isSound != seq_iter_is_sound) { continue; + } if (type == SEQ_MODIFIER_COPY_REPLACE) { if (seq_iter->modifiers.first) { diff --git a/source/blender/io/ply/exporter/ply_export_load_plydata.cc b/source/blender/io/ply/exporter/ply_export_load_plydata.cc index 88bd818d32c..d52fc7ad992 100644 --- a/source/blender/io/ply/exporter/ply_export_load_plydata.cc +++ b/source/blender/io/ply/exporter/ply_export_load_plydata.cc @@ -137,8 +137,9 @@ static void generate_vertex_map(const Mesh *mesh, /* Add zero UVs for any loose vertices. */ for (int vertex_index = 0; vertex_index < mesh->totvert; vertex_index++) { - if (r_vertex_to_ply[vertex_index] != -1) + if (r_vertex_to_ply[vertex_index] != -1) { continue; + } int ply_index = int(r_uvs.size()); r_vertex_to_ply[vertex_index] = ply_index; r_uvs.append({0, 0}); diff --git a/source/blender/io/ply/importer/ply_import.cc b/source/blender/io/ply/importer/ply_import.cc index 7b200d08adf..65b81c082ea 100644 --- a/source/blender/io/ply/importer/ply_import.cc +++ b/source/blender/io/ply/importer/ply_import.cc @@ -60,8 +60,9 @@ static Span parse_word(Span &str) static void skip_space(Span &str) { - while (!str.is_empty() && str[0] <= ' ') + while (!str.is_empty() && str[0] <= ' ') { str = str.drop_front(1); + } } static PlyDataTypes type_from_string(Span word) diff --git a/source/blender/io/ply/importer/ply_import_buffer.cc b/source/blender/io/ply/importer/ply_import_buffer.cc index 8492c831949..6c95d1bd0b4 100644 --- a/source/blender/io/ply/importer/ply_import_buffer.cc +++ b/source/blender/io/ply/importer/ply_import_buffer.cc @@ -64,8 +64,9 @@ bool PlyReadBuffer::read_bytes(void *dst, size_t size) } } int to_copy = int(size); - if (to_copy > buf_used_) + if (to_copy > buf_used_) { to_copy = buf_used_; + } memcpy(dst, buffer_.data() + pos_, to_copy); pos_ += to_copy; dst = (char *)dst + to_copy; diff --git a/source/blender/io/ply/importer/ply_import_data.cc b/source/blender/io/ply/importer/ply_import_data.cc index 853739d5bbd..f8a7fc12ae9 100644 --- a/source/blender/io/ply/importer/ply_import_data.cc +++ b/source/blender/io/ply/importer/ply_import_data.cc @@ -341,8 +341,9 @@ static uint32_t read_list_count(PlyReadBuffer &file, scratch.resize(8); file.read_bytes(scratch.data(), data_type_size[prop.count_type]); const uint8_t *ptr = scratch.data(); - if (big_endian) + if (big_endian) { endian_switch((uint8_t *)ptr, data_type_size[prop.count_type]); + } uint32_t count = get_binary_value(prop.count_type, ptr); return count; } @@ -446,8 +447,9 @@ static const char *load_face_element(PlyReadBuffer &file, scratch.resize(count * data_type_size[prop.type]); file.read_bytes(scratch.data(), scratch.size()); ptr = scratch.data(); - if (header.type == PlyFormatType::BINARY_BE) + if (header.type == PlyFormatType::BINARY_BE) { endian_switch_array((uint8_t *)ptr, data_type_size[prop.type], count); + } for (int j = 0; j < count; ++j) { uint32_t index = get_binary_value(prop.type, ptr); data->face_vertices.append(index); @@ -508,8 +510,9 @@ static const char *load_tristrips_element(PlyReadBuffer &file, scratch.resize(count * data_type_size[prop.type]); file.read_bytes(scratch.data(), scratch.size()); ptr = scratch.data(); - if (header.type == PlyFormatType::BINARY_BE) + if (header.type == PlyFormatType::BINARY_BE) { endian_switch_array((uint8_t *)ptr, data_type_size[prop.type], count); + } for (int j = 0; j < count; ++j) { int index = get_binary_value(prop.type, ptr); strip[j] = index; diff --git a/source/blender/io/ply/tests/io_ply_exporter_test.cc b/source/blender/io/ply/tests/io_ply_exporter_test.cc index de6bd2f6a02..c275cd5642b 100644 --- a/source/blender/io/ply/tests/io_ply_exporter_test.cc +++ b/source/blender/io/ply/tests/io_ply_exporter_test.cc @@ -76,7 +76,7 @@ static std::unique_ptr load_cube(PLYExportParams ¶ms) plyData->face_vertices = {0, 2, 6, 4, 3, 7, 6, 2, 7, 5, 4, 6, 5, 7, 3, 1, 1, 3, 2, 0, 5, 1, 0, 4}; - if (params.export_normals) + if (params.export_normals) { plyData->vertex_normals = { {-0.5773503, -0.5773503, -0.5773503}, {-0.5773503, -0.5773503, 0.5773503}, @@ -87,6 +87,7 @@ static std::unique_ptr load_cube(PLYExportParams ¶ms) {0.5773503, 0.5773503, -0.5773503}, {0.5773503, 0.5773503, 0.5773503}, }; + } return plyData; } diff --git a/source/blender/sequencer/intern/sound.cc b/source/blender/sequencer/intern/sound.cc index a741ee682a5..8593b5e47b4 100644 --- a/source/blender/sequencer/intern/sound.cc +++ b/source/blender/sequencer/intern/sound.cc @@ -161,10 +161,12 @@ EQCurveMappingData *SEQ_sound_equalizer_add(SoundEqualizerModifierData *semd, { EQCurveMappingData *eqcmd; - if (maxX < 0) + if (maxX < 0) { maxX = SOUND_EQUALIZER_DEFAULT_MAX_FREQ; - if (minX < 0) + } + if (minX < 0) { minX = 0.0; + } /* It's the same as BKE_curvemapping_add , but changing the name */ eqcmd = MEM_cnew("Equalizer"); BKE_curvemapping_set_defaults(&eqcmd->curve_mapping, @@ -212,12 +214,15 @@ EQCurveMappingData *SEQ_sound_equalizermodifier_add_graph(SoundEqualizerModifier float min_freq, float max_freq) { - if (min_freq < 0.0) + if (min_freq < 0.0) { return nullptr; - if (max_freq < 0.0) + } + if (max_freq < 0.0) { return nullptr; - if (max_freq <= min_freq) + } + if (max_freq <= min_freq) { return nullptr; + } return SEQ_sound_equalizer_add(semd, min_freq, max_freq); } @@ -327,8 +332,9 @@ void *SEQ_sound_equalizermodifier_recreator(Sequence *seq, SequenceModifierData const SoundModifierWorkerInfo *SEQ_sound_modifier_worker_info_get(int type) { for (int i = 0; workersSoundModifiers[i].type > 0; i++) { - if (workersSoundModifiers[i].type == type) + if (workersSoundModifiers[i].type == type) { return &workersSoundModifiers[i]; + } } return nullptr; }