From b8d0b8ec9e1c6be9aec71628e0655a8e2a476266 Mon Sep 17 00:00:00 2001 From: BearOso Date: Tue, 10 Oct 2023 19:44:06 -0500 Subject: [PATCH] Fix some unsigned/signed comparisons. --- common/audio/s9x_sound_driver_pulse.cpp | 6 +++--- vulkan/vulkan_context.cpp | 2 +- vulkan/vulkan_simple_output.cpp | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/common/audio/s9x_sound_driver_pulse.cpp b/common/audio/s9x_sound_driver_pulse.cpp index ebe2a167..7e9c444c 100644 --- a/common/audio/s9x_sound_driver_pulse.cpp +++ b/common/audio/s9x_sound_driver_pulse.cpp @@ -191,7 +191,7 @@ bool S9xPulseSoundDriver::write_samples(int16_t *data, int samples) if (draining) { - if (bytes > buffer_size / 2) + if (bytes > (size_t)buffer_size / 2) { return false; } @@ -201,13 +201,13 @@ bool S9xPulseSoundDriver::write_samples(int16_t *data, int samples) } } - if (samples * 2 > bytes) + if ((size_t)samples * 2 > bytes) { draining = true; return false; } - if (samples * 2 < bytes) + if ((size_t)samples * 2 < bytes) bytes = samples * 2; if (bytes == 0) diff --git a/vulkan/vulkan_context.cpp b/vulkan/vulkan_context.cpp index babaa79b..4f459c79 100644 --- a/vulkan/vulkan_context.cpp +++ b/vulkan/vulkan_context.cpp @@ -205,7 +205,7 @@ bool Context::init_device(int preferred_device) return device_list[0]; }; - if (preferred_device > -1 && preferred_device < device_list.size()) + if (preferred_device > -1 && (size_t)preferred_device < device_list.size()) physical_device = device_list[preferred_device]; else physical_device = find_device(); diff --git a/vulkan/vulkan_simple_output.cpp b/vulkan/vulkan_simple_output.cpp index 465e8a71..be0183c2 100644 --- a/vulkan/vulkan_simple_output.cpp +++ b/vulkan/vulkan_simple_output.cpp @@ -55,7 +55,7 @@ SimpleOutput::~SimpleOutput() void SimpleOutput::create_objects() { descriptors.clear(); - for (size_t i = 0; i < queue_size; i++) + for (int i = 0; i < queue_size; i++) { vk::DescriptorSetAllocateInfo dsai{}; dsai