From 62c376ffa55d7fa1d1c4855a777c3d89670bd4ba Mon Sep 17 00:00:00 2001 From: Chris Thrasher Date: Wed, 12 Jul 2023 01:14:51 -0600 Subject: [PATCH] Remove unnecessary parentheses --- src/SFML/Graphics/Texture.cpp | 2 +- src/SFML/Window/DRM/InputImplUDev.cpp | 8 ++++---- src/SFML/Window/EglContext.cpp | 2 +- src/SFML/Window/Unix/VulkanImplX11.cpp | 2 +- src/SFML/Window/Unix/WindowImplX11.cpp | 2 +- src/SFML/Window/Win32/VulkanImplWin32.cpp | 4 ++-- src/SFML/Window/iOS/SFAppDelegate.mm | 4 ++-- src/SFML/Window/macOS/SFContext.mm | 2 +- src/SFML/Window/macOS/SFOpenGLView+keyboard.mm | 2 +- test/Graphics/Image.test.cpp | 6 +++--- 10 files changed, 17 insertions(+), 17 deletions(-) diff --git a/src/SFML/Graphics/Texture.cpp b/src/SFML/Graphics/Texture.cpp index 4c51bc00..ee92d954 100644 --- a/src/SFML/Graphics/Texture.cpp +++ b/src/SFML/Graphics/Texture.cpp @@ -420,7 +420,7 @@ Image Texture::copyToImage() const // Handle the case where source pixels are flipped vertically if (m_pixelsFlipped) { - src += static_cast(srcPitch * static_cast((m_size.y - 1))); + src += static_cast(srcPitch * static_cast(m_size.y - 1)); srcPitch = -srcPitch; } diff --git a/src/SFML/Window/DRM/InputImplUDev.cpp b/src/SFML/Window/DRM/InputImplUDev.cpp index 799722a0..31fe7230 100644 --- a/src/SFML/Window/DRM/InputImplUDev.cpp +++ b/src/SFML/Window/DRM/InputImplUDev.cpp @@ -73,19 +73,19 @@ termios newTerminalConfig, oldTerminalConfig; // Terminal configurations bool altDown() { - return (keyMap[sf::Keyboard::LAlt] || keyMap[sf::Keyboard::RAlt]); + return keyMap[sf::Keyboard::LAlt] || keyMap[sf::Keyboard::RAlt]; } bool controlDown() { - return (keyMap[sf::Keyboard::LControl] || keyMap[sf::Keyboard::RControl]); + return keyMap[sf::Keyboard::LControl] || keyMap[sf::Keyboard::RControl]; } bool shiftDown() { - return (keyMap[sf::Keyboard::LShift] || keyMap[sf::Keyboard::RShift]); + return keyMap[sf::Keyboard::LShift] || keyMap[sf::Keyboard::RShift]; } bool systemDown() { - return (keyMap[sf::Keyboard::LSystem] || keyMap[sf::Keyboard::RSystem]); + return keyMap[sf::Keyboard::LSystem] || keyMap[sf::Keyboard::RSystem]; } void uninitFileDescriptors() diff --git a/src/SFML/Window/EglContext.cpp b/src/SFML/Window/EglContext.cpp index 7d518b6a..ce8a48c5 100644 --- a/src/SFML/Window/EglContext.cpp +++ b/src/SFML/Window/EglContext.cpp @@ -238,7 +238,7 @@ bool EglContext::makeCurrent(bool current) eglCheck(result = eglMakeCurrent(m_display, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT)); } - return (result != EGL_FALSE); + return result != EGL_FALSE; } diff --git a/src/SFML/Window/Unix/VulkanImplX11.cpp b/src/SFML/Window/Unix/VulkanImplX11.cpp index 703bf8bf..b9f3168c 100644 --- a/src/SFML/Window/Unix/VulkanImplX11.cpp +++ b/src/SFML/Window/Unix/VulkanImplX11.cpp @@ -86,7 +86,7 @@ struct VulkanLibraryWrapper { entryPoint = reinterpret_cast(dlsym(library, name)); - return (entryPoint != nullptr); + return entryPoint != nullptr; } void* library{}; diff --git a/src/SFML/Window/Unix/WindowImplX11.cpp b/src/SFML/Window/Unix/WindowImplX11.cpp index b5429d2b..3e9d7be1 100644 --- a/src/SFML/Window/Unix/WindowImplX11.cpp +++ b/src/SFML/Window/Unix/WindowImplX11.cpp @@ -1229,7 +1229,7 @@ bool WindowImplX11::hasFocus() const int revertToReturn = 0; XGetInputFocus(m_display, &focusedWindow, &revertToReturn); - return (m_window == focusedWindow); + return m_window == focusedWindow; } diff --git a/src/SFML/Window/Win32/VulkanImplWin32.cpp b/src/SFML/Window/Win32/VulkanImplWin32.cpp index 4f9c9ddb..edaa4c60 100644 --- a/src/SFML/Window/Win32/VulkanImplWin32.cpp +++ b/src/SFML/Window/Win32/VulkanImplWin32.cpp @@ -86,7 +86,7 @@ struct VulkanLibraryWrapper { entryPoint = reinterpret_cast(reinterpret_cast(GetProcAddress(library, name))); - return (entryPoint != nullptr); + return entryPoint != nullptr; } HMODULE library{}; @@ -201,7 +201,7 @@ bool VulkanImplWin32::createVulkanSurface(const VkInstance& instance, surfaceCreateInfo.hinstance = GetModuleHandleA(nullptr); surfaceCreateInfo.hwnd = windowHandle; - return (vkCreateWin32SurfaceKHR(instance, &surfaceCreateInfo, allocator, &surface) == VK_SUCCESS); + return vkCreateWin32SurfaceKHR(instance, &surfaceCreateInfo, allocator, &surface) == VK_SUCCESS; } } // namespace sf::priv diff --git a/src/SFML/Window/iOS/SFAppDelegate.mm b/src/SFML/Window/iOS/SFAppDelegate.mm index a32548fe..27bc9231 100644 --- a/src/SFML/Window/iOS/SFAppDelegate.mm +++ b/src/SFML/Window/iOS/SFAppDelegate.mm @@ -207,8 +207,8 @@ std::vector touchPositions; - (bool)needsToFlipFrameForOrientation:(UIDeviceOrientation)orientation { sf::Vector2u size = self.sfWindow->getSize(); - return ((!UIDeviceOrientationIsLandscape(orientation) && size.x > size.y) || - (UIDeviceOrientationIsLandscape(orientation) && size.y > size.x)); + return (!UIDeviceOrientationIsLandscape(orientation) && size.x > size.y) || + (UIDeviceOrientationIsLandscape(orientation) && size.y > size.x); } //////////////////////////////////////////////////////////// diff --git a/src/SFML/Window/macOS/SFContext.mm b/src/SFML/Window/macOS/SFContext.mm index ef891129..dbf78596 100644 --- a/src/SFML/Window/macOS/SFContext.mm +++ b/src/SFML/Window/macOS/SFContext.mm @@ -113,7 +113,7 @@ GlFunctionPointer SFContext::getFunction(const char* name) if (!image) image = dlopen("/System/Library/Frameworks/OpenGL.framework/Versions/Current/OpenGL", RTLD_LAZY); - return (image ? reinterpret_cast(reinterpret_cast(dlsym(image, name))) : nil); + return image ? reinterpret_cast(reinterpret_cast(dlsym(image, name))) : nil; } diff --git a/src/SFML/Window/macOS/SFOpenGLView+keyboard.mm b/src/SFML/Window/macOS/SFOpenGLView+keyboard.mm index 244abc89..526f06cd 100644 --- a/src/SFML/Window/macOS/SFOpenGLView+keyboard.mm +++ b/src/SFML/Window/macOS/SFOpenGLView+keyboard.mm @@ -200,7 +200,7 @@ else if ([[event characters] length] > 0) { unichar code = [[event characters] characterAtIndex:0]; - return ((code < 0xF700) || (code > 0xF8FF)); + return (code < 0xF700) || (code > 0xF8FF); } else { diff --git a/test/Graphics/Image.test.cpp b/test/Graphics/Image.test.cpp index 53b5933e..ce9c5a02 100644 --- a/test/Graphics/Image.test.cpp +++ b/test/Graphics/Image.test.cpp @@ -189,11 +189,11 @@ TEST_CASE("[Graphics] sf::Image") // Create the composited colour for via the alpha composite over operation const auto a = static_cast(source.a + (dest.a * (255 - source.a)) / 255); const auto r = static_cast( - ((source.r * source.a) + (((dest.r * dest.a) * (255 - source.a))) / 255) / a); + ((source.r * source.a) + ((dest.r * dest.a) * (255 - source.a)) / 255) / a); const auto g = static_cast( - ((source.g * source.a) + (((dest.g * dest.a) * (255 - source.a))) / 255) / a); + ((source.g * source.a) + ((dest.g * dest.a) * (255 - source.a)) / 255) / a); const auto b = static_cast( - ((source.b * source.a) + (((dest.b * dest.a) * (255 - source.a))) / 255) / a); + ((source.b * source.a) + ((dest.b * dest.a) * (255 - source.a)) / 255) / a); const sf::Color composite(r, g, b, a); sf::Image image1;