diff options
author | RĂ©mi Verschelde <rverschelde@gmail.com> | 2017-09-01 21:52:55 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-09-01 21:52:55 +0200 |
commit | dac150108ab3c1f41d5fd86cc6853f883064caaf (patch) | |
tree | 09195c9dd5e0d651e96b7d26f26985ab5ff6f871 /modules/tga | |
parent | 69ac4cbb3764a454194e27a7afe71d98af65c32c (diff) | |
parent | f9467ec1ea6c0dac2ea513b7dfe58d0349788e02 (diff) |
Merge pull request #10846 from hpvb/fix-sign-compare
Fix signed and unsigned comparisons
Diffstat (limited to 'modules/tga')
-rw-r--r-- | modules/tga/image_loader_tga.cpp | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/modules/tga/image_loader_tga.cpp b/modules/tga/image_loader_tga.cpp index 84332ee2ff..7c7cf5bcbe 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<Image> p_image, FileAccess *f, bool p_force PoolVector<uint8_t> 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; |