From 681a02c3cacaf4d5aefa9c7396e6a3f392a4becf Mon Sep 17 00:00:00 2001 From: Bogumil Sapinski Date: Fri, 23 Jun 2023 17:38:47 +0200 Subject: [PATCH] fixed warnings caused by comparing signed and unsigned int --- lib/include/CL/SDK/Image.hpp | 2 +- lib/src/SDK/Image.cpp | 2 +- lib/src/Utils/File.cpp | 2 +- samples/core/copybuffer/main.cpp | 2 +- samples/core/copybufferkernel/main.cpp | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/include/CL/SDK/Image.hpp b/lib/include/CL/SDK/Image.hpp index 6e241a4e..3dddbb05 100644 --- a/lib/include/CL/SDK/Image.hpp +++ b/lib/include/CL/SDK/Image.hpp @@ -10,7 +10,7 @@ namespace cl { namespace sdk { struct Image { - int width = 0, height = 0, pixel_size = 1; + size_t width = 0, height = 0, pixel_size = 1; cl::vector pixels; }; diff --git a/lib/src/SDK/Image.cpp b/lib/src/SDK/Image.cpp index c17a3d14..e3d4cfa7 100644 --- a/lib/src/SDK/Image.cpp +++ b/lib/src/SDK/Image.cpp @@ -31,7 +31,7 @@ namespace sdk { Image im; unsigned char* data = - stbi_load(file_name, &im.width, &im.height, &im.pixel_size, 0); + stbi_load(file_name, reinterpret_cast(&im.width), reinterpret_cast(&im.height), reinterpret_cast(&im.pixel_size), 0); if (data == nullptr) { diff --git a/lib/src/Utils/File.cpp b/lib/src/Utils/File.cpp index a62efb62..4ff44f23 100644 --- a/lib/src/Utils/File.cpp +++ b/lib/src/Utils/File.cpp @@ -97,7 +97,7 @@ cl_int cl::util::write_binaries(const cl::Program::Binaries& binaries, { try { - for (auto i = 0; i < binaries.size(); ++i) + for (auto i = 0U; i < binaries.size(); ++i) { string binary_name = string(program_file_name) + "-" + devices.at(i).getInfo() + ".bin"; diff --git a/samples/core/copybuffer/main.cpp b/samples/core/copybuffer/main.cpp index e9b53f45..5429afa6 100644 --- a/samples/core/copybuffer/main.cpp +++ b/samples/core/copybuffer/main.cpp @@ -95,7 +95,7 @@ int main(int argc, char** argv) } else { - for (size_t i = 1; i < argc; i++) + for (int i = 1; i < argc; i++) { if (!strcmp(argv[i], "-d")) { diff --git a/samples/core/copybufferkernel/main.cpp b/samples/core/copybufferkernel/main.cpp index 26d046d6..1b14cfc2 100644 --- a/samples/core/copybufferkernel/main.cpp +++ b/samples/core/copybufferkernel/main.cpp @@ -106,7 +106,7 @@ int main(int argc, char** argv) } else { - for (size_t i = 1; i < argc; i++) + for (int i = 1; i < argc; i++) { if (!strcmp(argv[i], "-d")) {