mirror of
https://github.com/SFML/SFML.git
synced 2024-11-24 20:31:05 +08:00
Replace std::strcmp by std::string_view::operator==
clang-format validation pass Remove unecessary cstring include
This commit is contained in:
parent
401615f5e6
commit
642d981acf
@ -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;
|
||||
|
@ -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)
|
||||
{
|
||||
|
@ -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;
|
||||
|
@ -28,7 +28,6 @@
|
||||
#include <SFML/Window/Unix/Display.hpp>
|
||||
#include <SFML/Window/Unix/VulkanImplX11.hpp>
|
||||
|
||||
#include <cstring>
|
||||
#include <dlfcn.h>
|
||||
#include <map>
|
||||
#include <string>
|
||||
@ -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;
|
||||
}
|
||||
|
@ -28,7 +28,6 @@
|
||||
#include <SFML/System/Win32/WindowsHeader.hpp>
|
||||
#include <SFML/Window/Win32/VulkanImplWin32.hpp>
|
||||
|
||||
#include <cstring>
|
||||
#include <map>
|
||||
#include <string>
|
||||
#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;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user