aboutsummaryrefslogtreecommitdiff
path: root/cube/cube.cpp
diff options
context:
space:
mode:
authorYilong Li <liyl@google.com>2025-02-16 01:25:04 -0800
committerCharles Giessen <46324611+charles-lunarg@users.noreply.github.com>2025-02-18 04:02:30 -0600
commit8a7c2760f69a13ca333eea3066f5e29423557be0 (patch)
treeaee93ce009b356ce9219ea5fbeee88f8a3184a57 /cube/cube.cpp
parentb4061dbbe5392947ad4cc176f823972080197ce4 (diff)
downloadusermoji-8a7c2760f69a13ca333eea3066f5e29423557be0.tar.xz
vkcubepp: Remove implicit casts
1. std::tolower() returns an `int` value. Implicit converting an `int` to a `char` may trigger compiler warnings (-Wconversion on gcc and clang). This change adds an explicit cast to suppress the implicit conversion warnings. 2. Previously we used `assert(!"....")` to show error messages. This does an implicit conversion from `const char*` to `bool` which triggers compiler warnings (-Wconversion). This change replaces it with `assert(false && "...")` which doesn't trigger the warning. Bug: https://fxbug.dev/378964821 Change-Id: I51be6858db558568619d0d2e6bc01a544d3459e4
Diffstat (limited to 'cube/cube.cpp')
-rw-r--r--cube/cube.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/cube/cube.cpp b/cube/cube.cpp
index 7d959756..45c3afd0 100644
--- a/cube/cube.cpp
+++ b/cube/cube.cpp
@@ -1064,7 +1064,7 @@ void Demo::init(int argc, char **argv) {
if ((strcmp(argv[i], "--wsi") == 0) && (i < argc - 1)) {
std::string selection_input = argv[i + 1];
for (char &c : selection_input) {
- c = std::tolower(c);
+ c = static_cast<char>(std::tolower(c));
}
WsiPlatform selection = wsi_from_string(selection_input);
if (selection == WsiPlatform::invalid) {
@@ -2689,7 +2689,7 @@ void Demo::prepare_textures() {
textures[i].imageLayout, vk::AccessFlagBits::eTransferWrite, vk::PipelineStageFlagBits::eTransfer,
vk::PipelineStageFlagBits::eFragmentShader);
} else {
- assert(!"No support for R8G8B8A8_SRGB as texture image format");
+ assert(false && "No support for R8G8B8A8_SRGB as texture image format");
}
auto const samplerInfo = vk::SamplerCreateInfo()