From a4674bda47ddeed7cc929bafdcd89b6bd156ee30 Mon Sep 17 00:00:00 2001 From: Johan Manuel Date: Tue, 26 Jul 2016 15:05:30 +0200 Subject: [PATCH] Fix some comparisons between signed and unsigned integers --- drivers/png/image_loader_png.cpp | 2 +- modules/gdscript/gd_tokenizer.cpp | 4 ++-- platform/android/export/export.cpp | 22 +++++++++++----------- 3 files changed, 14 insertions(+), 14 deletions(-) diff --git a/drivers/png/image_loader_png.cpp b/drivers/png/image_loader_png.cpp index e10ac7493fe..4967b0f9dfb 100644 --- a/drivers/png/image_loader_png.cpp +++ b/drivers/png/image_loader_png.cpp @@ -270,7 +270,7 @@ static void user_read_data(png_structp png_ptr,png_bytep data, png_size_t p_leng PNGReadStatus *rstatus; rstatus=(PNGReadStatus*)png_get_io_ptr(png_ptr); - int to_read=p_length; + png_size_t to_read=p_length; if (rstatus->size>=0) { to_read = MIN( p_length, rstatus->size - rstatus->offset); } diff --git a/modules/gdscript/gd_tokenizer.cpp b/modules/gdscript/gd_tokenizer.cpp index 93863c4eb21..ccdeef19ccf 100644 --- a/modules/gdscript/gd_tokenizer.cpp +++ b/modules/gdscript/gd_tokenizer.cpp @@ -1322,7 +1322,7 @@ StringName GDTokenizerBuffer::get_token_identifier(int p_offset) const{ ERR_FAIL_INDEX_V(offset,tokens.size(),StringName()); uint32_t identifier = tokens[offset]>>TOKEN_BITS; - ERR_FAIL_INDEX_V(identifier,identifiers.size(),StringName()); + ERR_FAIL_INDEX_V(identifier,(uint32_t)identifiers.size(),StringName()); return identifiers[identifier]; } @@ -1381,7 +1381,7 @@ const Variant& GDTokenizerBuffer::get_token_constant(int p_offset) const{ int offset = token+p_offset; ERR_FAIL_INDEX_V(offset,tokens.size(),nil); uint32_t constant = tokens[offset]>>TOKEN_BITS; - ERR_FAIL_INDEX_V(constant,constants.size(),nil); + ERR_FAIL_INDEX_V(constant,(uint32_t)constants.size(),nil); return constants[constant]; } diff --git a/platform/android/export/export.cpp b/platform/android/export/export.cpp index a8456ac4efa..8f3edfcaa75 100644 --- a/platform/android/export/export.cpp +++ b/platform/android/export/export.cpp @@ -495,7 +495,7 @@ static String _parse_string(const uint8_t *p_bytes,bool p_utf8) { Vector str8; str8.resize(len+1); - for(int i=0;i& p_manifest) { printf("stirng count: %i\n",string_count); printf("flags: %x\n",string_flags); - for(int i=0;i& p_manifest) { Vector ret; ret.resize(string_table_begins+string_table.size()*4); - for(int i=0;i& p_manifest,bool uint32_t string_table_ends; Vector stable_extra; - while(ofs < p_manifest.size()) { + while(ofs < (uint32_t)p_manifest.size()) { uint32_t chunk = decode_uint32(&p_manifest[ofs]); uint32_t size = decode_uint32(&p_manifest[ofs+4]); @@ -703,7 +703,7 @@ void EditorExportPlatformAndroid::_fix_manifest(Vector& p_manifest,bool string_table_begins=st_offset; - for(int i=0;i& p_manifest,bool uint32_t len = decode_uint16(&p_manifest[string_at]); Vector ucstring; ucstring.resize(len+1); - for(int j=0;j& p_manifest,bool // print_line("String "+itos(i)+": "+string_table[i]); } - for(int i=string_end;i<(ofs+size);i++) { + for(uint32_t i=string_end;i<(ofs+size);i++) { stable_extra.push_back(p_manifest[i]); } @@ -758,7 +758,7 @@ void EditorExportPlatformAndroid::_fix_manifest(Vector& p_manifest,bool uint32_t attrcount=decode_uint32(&p_manifest[iofs+20]); iofs+=28; //printf("ATTRCOUNT: %x\n",attrcount); - for(int i=0;i& p_manifest,bool Vector ret; ret.resize(string_table_begins+string_table.size()*4); - for(int i=0;i& p_manifest,bool uint32_t extra = (p_manifest.size()-string_table_ends); ret.resize(new_stable_end + extra); - for(int i=0;i