From ed4c8a50505ab02a8f3a01e41f5f86acca04b81d Mon Sep 17 00:00:00 2001 From: David Robillard Date: Fri, 7 Oct 2022 15:16:55 -0400 Subject: Avoid C-style casts in C++ code --- examples/.clang-tidy | 1 - examples/pugl_vulkan_cpp_demo.cpp | 10 +++++----- examples/sybok.hpp | 2 +- 3 files changed, 6 insertions(+), 7 deletions(-) (limited to 'examples') diff --git a/examples/.clang-tidy b/examples/.clang-tidy index bf9899a..819a16d 100644 --- a/examples/.clang-tidy +++ b/examples/.clang-tidy @@ -21,7 +21,6 @@ Checks: > -fuchsia-default-arguments, -fuchsia-default-arguments-calls, -fuchsia-overloaded-operator, - -google-readability-casting, -google-runtime-references, -hicpp-multiway-paths-covered, -hicpp-no-array-decay, diff --git a/examples/pugl_vulkan_cpp_demo.cpp b/examples/pugl_vulkan_cpp_demo.cpp index c901de5..7e0bd38 100644 --- a/examples/pugl_vulkan_cpp_demo.cpp +++ b/examples/pugl_vulkan_cpp_demo.cpp @@ -272,7 +272,7 @@ selectPresentMode(const sk::VulkanApi& vk, return r; } - const auto& tryModes = priorities[bool(multiBuffer)][bool(sync)]; + const auto& tryModes = priorities[multiBuffer][sync]; for (const auto m : tryModes) { if (std::find(modes.begin(), modes.end(), m) != modes.end()) { presentMode = m; @@ -896,8 +896,8 @@ RectPipeline::init(const sk::VulkanApi& vk, const VkViewport viewport{0.0f, 0.0f, - float(swapchain.extent.width), - float(swapchain.extent.height), + static_cast(swapchain.extent.width), + static_cast(swapchain.extent.height), 0.0f, 1.0f}; @@ -1560,9 +1560,9 @@ update(PuglVulkanDemo& app, const double time) UniformBufferObject ubo = {{}}; mat4Ortho(ubo.projection, 0.0f, - float(app.renderer.swapchain.extent.width), + static_cast(app.renderer.swapchain.extent.width), 0.0f, - float(app.renderer.swapchain.extent.height), + static_cast(app.renderer.swapchain.extent.height), -1.0f, 1.0f); diff --git a/examples/sybok.hpp b/examples/sybok.hpp index 568e581..aad1b41 100644 --- a/examples/sybok.hpp +++ b/examples/sybok.hpp @@ -777,7 +777,7 @@ public: } if (!vkDestroyInstance) { - vkDestroyInstance = PFN_vkDestroyInstance( + vkDestroyInstance = reinterpret_cast( getInstanceProcAddr(instance, "vkDestroyInstance")); } -- cgit v1.2.1