diff --git a/examples/vulkan/Vulkan.cpp b/examples/vulkan/Vulkan.cpp index 761671851..a1b7f4862 100644 --- a/examples/vulkan/Vulkan.cpp +++ b/examples/vulkan/Vulkan.cpp @@ -470,11 +470,11 @@ public: // -- VK_LAYER_GOOGLE_unique_objects // These layers perform error checking and warn about bad or sub-optimal Vulkan API usage // VK_LAYER_LUNARG_monitor appends an FPS counter to the window title - if (!std::strcmp(layer.layerName, "VK_LAYER_LUNARG_standard_validation")) + if (std::string_view(layer.layerName) == "VK_LAYER_LUNARG_standard_validation") { validationLayers.push_back("VK_LAYER_LUNARG_standard_validation"); } - else if (!std::strcmp(layer.layerName, "VK_LAYER_LUNARG_monitor")) + else if (std::string_view(layer.layerName) == "VK_LAYER_LUNARG_monitor") { validationLayers.push_back("VK_LAYER_LUNARG_monitor"); } @@ -611,7 +611,7 @@ public: for (VkExtensionProperties& extension : extensions) { - if (!std::strcmp(extension.extensionName, VK_KHR_SWAPCHAIN_EXTENSION_NAME)) + if (std::string_view(extension.extensionName) == VK_KHR_SWAPCHAIN_EXTENSION_NAME) { supportsSwapchain = true; break; diff --git a/src/SFML/Window/DRM/DRMContext.cpp b/src/SFML/Window/DRM/DRMContext.cpp index 6a014f0ad..99468e7da 100644 --- a/src/SFML/Window/DRM/DRMContext.cpp +++ b/src/SFML/Window/DRM/DRMContext.cpp @@ -365,7 +365,7 @@ int initDrm(sf::priv::Drm& drm, const char* device, const char* modeStr, unsigne { drmModeModeInfoPtr currentMode = &connector->modes[i]; - if (std::strcmp(currentMode->name, modeStr) == 0) + if (std::string_view(currentMode->name) == modeStr) { if (vrefresh == 0 || currentMode->vrefresh == vrefresh) { diff --git a/src/SFML/Window/GlContext.cpp b/src/SFML/Window/GlContext.cpp index 7ce9c0827..5fec86769 100644 --- a/src/SFML/Window/GlContext.cpp +++ b/src/SFML/Window/GlContext.cpp @@ -932,7 +932,7 @@ void GlContext::checkSettings(const ContextSettings& requestedSettings) const if (vendorName && rendererName) { - if ((std::strcmp(vendorName, "Microsoft Corporation") == 0) && (std::strcmp(rendererName, "GDI Generic") == 0)) + if (std::string_view(vendorName) == "Microsoft Corporation" && std::string_view(rendererName) == "GDI Generic") { err() << "Warning: Detected \"Microsoft Corporation GDI Generic\" OpenGL implementation" << '\n' << "The current OpenGL implementation is not hardware-accelerated" << std::endl; diff --git a/src/SFML/Window/Unix/VulkanImplX11.cpp b/src/SFML/Window/Unix/VulkanImplX11.cpp index 945909751..a9b479af4 100644 --- a/src/SFML/Window/Unix/VulkanImplX11.cpp +++ b/src/SFML/Window/Unix/VulkanImplX11.cpp @@ -28,7 +28,6 @@ #include #include -#include #include #include #include @@ -139,11 +138,11 @@ bool VulkanImplX11::isAvailable(bool requireGraphics) for (const VkExtensionProperties& properties : extensionProperties) { - if (!std::strcmp(properties.extensionName, VK_KHR_SURFACE_EXTENSION_NAME)) + if (std::string_view(properties.extensionName) == VK_KHR_SURFACE_EXTENSION_NAME) { hasVkKhrSurface = true; } - else if (!std::strcmp(properties.extensionName, VK_KHR_XLIB_SURFACE_EXTENSION_NAME)) + else if (std::string_view(properties.extensionName) == VK_KHR_XLIB_SURFACE_EXTENSION_NAME) { hasVkKhrPlatformSurface = true; } diff --git a/src/SFML/Window/Win32/VulkanImplWin32.cpp b/src/SFML/Window/Win32/VulkanImplWin32.cpp index a026face5..f68287852 100644 --- a/src/SFML/Window/Win32/VulkanImplWin32.cpp +++ b/src/SFML/Window/Win32/VulkanImplWin32.cpp @@ -28,7 +28,6 @@ #include #include -#include #include #include #define VK_USE_PLATFORM_WIN32_KHR @@ -138,11 +137,11 @@ bool VulkanImplWin32::isAvailable(bool requireGraphics) for (const VkExtensionProperties& properties : extensionProperties) { - if (!std::strcmp(properties.extensionName, VK_KHR_SURFACE_EXTENSION_NAME)) + if (std::string_view(properties.extensionName) == VK_KHR_SURFACE_EXTENSION_NAME) { hasVkKhrSurface = true; } - else if (!std::strcmp(properties.extensionName, VK_KHR_WIN32_SURFACE_EXTENSION_NAME)) + else if (std::string_view(properties.extensionName) == VK_KHR_WIN32_SURFACE_EXTENSION_NAME) { hasVkKhrPlatformSurface = true; }