From f9467ec1ea6c0dac2ea513b7dfe58d0349788e02 Mon Sep 17 00:00:00 2001 From: Hein-Pieter van Braam Date: Thu, 31 Aug 2017 23:30:35 +0200 Subject: Fix signed and unsigned comparisons The first in my quest to make Godot 3.x compile with -Werror on GCC7 --- modules/tga/image_loader_tga.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'modules/tga') diff --git a/modules/tga/image_loader_tga.cpp b/modules/tga/image_loader_tga.cpp index 379c894550..8b1d422ce2 100644 --- a/modules/tga/image_loader_tga.cpp +++ b/modules/tga/image_loader_tga.cpp @@ -53,19 +53,19 @@ Error ImageLoaderTGA::decode_tga_rle(const uint8_t *p_compressed_buffer, size_t count = (c & 0x7f) + 1; if (c & 0x80) { - for (int i = 0; i < p_pixel_size; i++) { + for (size_t i = 0; i < p_pixel_size; i++) { pixels_w.ptr()[i] = p_compressed_buffer[compressed_pos]; compressed_pos += 1; } - for (int i = 0; i < count; i++) { - for (int j = 0; j < p_pixel_size; j++) { + for (size_t i = 0; i < count; i++) { + for (size_t j = 0; j < p_pixel_size; j++) { p_uncompressed_buffer[output_pos + j] = pixels_w.ptr()[j]; } output_pos += p_pixel_size; } } else { count *= p_pixel_size; - for (int i = 0; i < count; i++) { + for (size_t i = 0; i < count; i++) { p_uncompressed_buffer[output_pos] = p_compressed_buffer[compressed_pos]; compressed_pos += 1; output_pos += 1; @@ -208,7 +208,7 @@ Error ImageLoaderTGA::load_image(Ref p_image, FileAccess *f, bool p_force PoolVector src_image; int src_image_len = f->get_len(); ERR_FAIL_COND_V(src_image_len == 0, ERR_FILE_CORRUPT); - ERR_FAIL_COND_V(src_image_len < sizeof(tga_header_s), ERR_FILE_CORRUPT); + ERR_FAIL_COND_V(src_image_len < (int)sizeof(tga_header_s), ERR_FILE_CORRUPT); src_image.resize(src_image_len); Error err = OK; -- cgit v1.2.3