Skip to content

Commit

Permalink
Fix warning sign compare (#80)
Browse files Browse the repository at this point in the history
* fix unused-parameter warning in samples

* Revert "fix unused-parameter warning in samples"

This reverts commit 5f6319a.

* fixed warnings caused by comparing signed and unsigned int

* fixed formatting

* fixing warning sign-compare other way

* formatting
  • Loading branch information
Bogumil-Sapinski-Mobica authored Sep 12, 2023
1 parent f7f9891 commit 93cf3cd
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 9 deletions.
7 changes: 4 additions & 3 deletions lib/src/SDK/Image.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,12 @@ namespace sdk {
err_msg.c_str());
}

im.pixels.insert(im.pixels.end(), data,
data + im.width * im.height * im.pixel_size);
std::size_t data_size = im.width * im.height * im.pixel_size;

im.pixels.insert(im.pixels.end(), data, data + data_size);

if (im.width && im.height && im.pixel_size
&& im.pixels.size() == im.width * im.height * im.pixel_size)
&& im.pixels.size() == data_size)
err = CL_SUCCESS;
else
cl::util::detail::errHandler(CL_INVALID_ARG_VALUE, &err,
Expand Down
2 changes: 1 addition & 1 deletion lib/src/Utils/File.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<CL_DEVICE_NAME>() + ".bin";
Expand Down
6 changes: 3 additions & 3 deletions samples/core/blur/blur.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -732,9 +732,9 @@ void BlurCppExample::finalize_blur()
// restore image type if needed
if (input_image.pixel_size != output_image.pixel_size)
{
const auto pixels = input_image.width * input_image.height,
pixel_size = output_image.pixel_size;
for (size_t i = 1; i < pixels; ++i)
const std::size_t pixels = input_image.width * input_image.height,
pixel_size = output_image.pixel_size;
for (std::size_t i = 1; i < pixels; ++i)
memcpy(output_image.pixels.data() + pixel_size * i,
output_image.pixels.data() + 4 * i, pixel_size);
}
Expand Down
2 changes: 1 addition & 1 deletion samples/core/copybuffer/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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"))
{
Expand Down
2 changes: 1 addition & 1 deletion samples/core/copybufferkernel/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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"))
{
Expand Down

0 comments on commit 93cf3cd

Please sign in to comment.