From cf9d49e46157b4c2a0dcf3051679d550c5fb20a1 Mon Sep 17 00:00:00 2001 From: Jeremy Hayes Date: Mon, 30 Aug 2021 18:04:09 -0600 Subject: cubepp: Fix gitlab 828. Expect and deny negative window dimensions. --- cube/cube.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'cube/cube.cpp') diff --git a/cube/cube.cpp b/cube/cube.cpp index f5db1f69..cd983e06 100644 --- a/cube/cube.cpp +++ b/cube/cube.cpp @@ -331,8 +331,8 @@ struct Demo { char const *extension_names[64]; char const *enabled_layers[64]; - uint32_t width; - uint32_t height; + int32_t width; + int32_t height; vk::Format format; vk::ColorSpaceKHR color_space; @@ -824,7 +824,7 @@ void Demo::draw() { vk::SurfaceCapabilitiesKHR surfCapabilities; result = gpu.getSurfaceCapabilitiesKHR(surface, &surfCapabilities); VERIFY(result == vk::Result::eSuccess); - if (surfCapabilities.currentExtent.width != width || surfCapabilities.currentExtent.height != height) { + if (surfCapabilities.currentExtent.width != static_cast(width) || surfCapabilities.currentExtent.height != static_cast(height)) { resize(); } } else if (result == vk::Result::eErrorSurfaceLostKHR) { @@ -983,11 +983,11 @@ void Demo::init(int argc, char **argv) { i++; continue; } - if (strcmp(argv[i], "--width") == 0 && i < argc - 1 && sscanf(argv[i + 1], "%" SCNu32, &width) == 1 && width > 0) { + if (strcmp(argv[i], "--width") == 0 && i < argc - 1 && sscanf(argv[i + 1], "%" SCNi32, &width) == 1 && width > 0) { i++; continue; } - if (strcmp(argv[i], "--height") == 0 && i < argc - 1 && sscanf(argv[i + 1], "%" SCNu32, &height) == 1 && height > 0) { + if (strcmp(argv[i], "--height") == 0 && i < argc - 1 && sscanf(argv[i + 1], "%" SCNi32, &height) == 1 && height > 0) { i++; continue; } -- cgit v1.2.3