Fix signed and unsigned comparisons
The first in my quest to make Godot 3.x compile with -Werror on GCC7
This commit is contained in:
parent
51ae90d789
commit
f9467ec1ea
34 changed files with 105 additions and 105 deletions
|
|
@ -1705,7 +1705,7 @@ Variant _File::get_var() const {
|
|||
ERR_FAIL_COND_V(!f, Variant());
|
||||
uint32_t len = get_32();
|
||||
PoolVector<uint8_t> buff = get_buffer(len);
|
||||
ERR_FAIL_COND_V(buff.size() != len, Variant());
|
||||
ERR_FAIL_COND_V((uint32_t)buff.size() != len, Variant());
|
||||
|
||||
PoolVector<uint8_t>::Read r = buff.read();
|
||||
|
||||
|
|
|
|||
|
|
@ -37,11 +37,11 @@ class FileAccessCompressed : public FileAccess {
|
|||
|
||||
Compression::Mode cmode;
|
||||
bool writing;
|
||||
int write_pos;
|
||||
uint32_t write_pos;
|
||||
uint8_t *write_ptr;
|
||||
int write_buffer_size;
|
||||
int write_max;
|
||||
int block_size;
|
||||
uint32_t write_buffer_size;
|
||||
uint32_t write_max;
|
||||
uint32_t block_size;
|
||||
mutable bool read_eof;
|
||||
mutable bool at_end;
|
||||
|
||||
|
|
@ -57,7 +57,7 @@ class FileAccessCompressed : public FileAccess {
|
|||
mutable int read_block_size;
|
||||
mutable int read_pos;
|
||||
Vector<ReadBlock> read_blocks;
|
||||
int read_total;
|
||||
uint32_t read_total;
|
||||
|
||||
String magic;
|
||||
mutable Vector<uint8_t> buffer;
|
||||
|
|
|
|||
|
|
@ -73,14 +73,14 @@ Error FileAccessEncrypted::open_and_parse(FileAccess *p_base, const Vector<uint8
|
|||
length = p_base->get_64();
|
||||
base = p_base->get_pos();
|
||||
ERR_FAIL_COND_V(p_base->get_len() < base + length, ERR_FILE_CORRUPT);
|
||||
int ds = length;
|
||||
uint32_t ds = length;
|
||||
if (ds % 16) {
|
||||
ds += 16 - (ds % 16);
|
||||
}
|
||||
|
||||
data.resize(ds);
|
||||
|
||||
int blen = p_base->get_buffer(data.ptr(), ds);
|
||||
uint32_t blen = p_base->get_buffer(data.ptr(), ds);
|
||||
ERR_FAIL_COND_V(blen != ds, ERR_FILE_CORRUPT);
|
||||
|
||||
aes256_context ctx;
|
||||
|
|
|
|||
|
|
@ -48,7 +48,7 @@ private:
|
|||
size_t base;
|
||||
size_t length;
|
||||
Vector<uint8_t> data;
|
||||
mutable size_t pos;
|
||||
mutable int pos;
|
||||
mutable bool eofed;
|
||||
|
||||
public:
|
||||
|
|
|
|||
|
|
@ -244,14 +244,14 @@ FileAccessNetworkClient::~FileAccessNetworkClient() {
|
|||
memdelete(sem);
|
||||
}
|
||||
|
||||
void FileAccessNetwork::_set_block(size_t p_offset, const Vector<uint8_t> &p_block) {
|
||||
void FileAccessNetwork::_set_block(int p_offset, const Vector<uint8_t> &p_block) {
|
||||
|
||||
int page = p_offset / page_size;
|
||||
ERR_FAIL_INDEX(page, pages.size());
|
||||
if (page < pages.size() - 1) {
|
||||
ERR_FAIL_COND(p_block.size() != page_size);
|
||||
} else {
|
||||
ERR_FAIL_COND((p_block.size() != (total_size % page_size)));
|
||||
ERR_FAIL_COND((p_block.size() != (int)(total_size % page_size)));
|
||||
}
|
||||
|
||||
buffer_mutex->lock();
|
||||
|
|
|
|||
|
|
@ -97,7 +97,7 @@ class FileAccessNetwork : public FileAccess {
|
|||
mutable int last_page;
|
||||
mutable uint8_t *last_page_buff;
|
||||
|
||||
uint32_t page_size;
|
||||
int page_size;
|
||||
int read_ahead;
|
||||
int max_pages;
|
||||
|
||||
|
|
@ -121,7 +121,7 @@ class FileAccessNetwork : public FileAccess {
|
|||
friend class FileAccessNetworkClient;
|
||||
void _queue_page(int p_page) const;
|
||||
void _respond(size_t p_len, Error p_status);
|
||||
void _set_block(size_t p_offset, const Vector<uint8_t> &p_block);
|
||||
void _set_block(int p_offset, const Vector<uint8_t> &p_block);
|
||||
|
||||
public:
|
||||
enum Command {
|
||||
|
|
|
|||
|
|
@ -333,14 +333,14 @@ Error decode_variant(Variant &r_variant, const uint8_t *p_buffer, int p_len, int
|
|||
len -= 12;
|
||||
buf += 12;
|
||||
|
||||
int total = namecount + subnamecount;
|
||||
uint32_t total = namecount + subnamecount;
|
||||
if (flags & 2)
|
||||
total++;
|
||||
|
||||
if (r_len)
|
||||
(*r_len) += 12;
|
||||
|
||||
for (int i = 0; i < total; i++) {
|
||||
for (uint32_t i = 0; i < total; i++) {
|
||||
|
||||
ERR_FAIL_COND_V((int)len < 4, ERR_INVALID_DATA);
|
||||
strlen = decode_uint32(buf);
|
||||
|
|
@ -566,7 +566,7 @@ Error decode_variant(Variant &r_variant, const uint8_t *p_buffer, int p_len, int
|
|||
if (count) {
|
||||
data.resize(count);
|
||||
PoolVector<uint8_t>::Write w = data.write();
|
||||
for (int i = 0; i < count; i++) {
|
||||
for (uint32_t i = 0; i < count; i++) {
|
||||
|
||||
w[i] = buf[i];
|
||||
}
|
||||
|
|
@ -597,7 +597,7 @@ Error decode_variant(Variant &r_variant, const uint8_t *p_buffer, int p_len, int
|
|||
//const int*rbuf=(const int*)buf;
|
||||
data.resize(count);
|
||||
PoolVector<int>::Write w = data.write();
|
||||
for (int i = 0; i < count; i++) {
|
||||
for (uint32_t i = 0; i < count; i++) {
|
||||
|
||||
w[i] = decode_uint32(&buf[i * 4]);
|
||||
}
|
||||
|
|
@ -624,7 +624,7 @@ Error decode_variant(Variant &r_variant, const uint8_t *p_buffer, int p_len, int
|
|||
//const float*rbuf=(const float*)buf;
|
||||
data.resize(count);
|
||||
PoolVector<float>::Write w = data.write();
|
||||
for (int i = 0; i < count; i++) {
|
||||
for (uint32_t i = 0; i < count; i++) {
|
||||
|
||||
w[i] = decode_float(&buf[i * 4]);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -102,7 +102,7 @@ StringName ResourceInteractiveLoaderBinary::_get_string() {
|
|||
|
||||
uint32_t id = f->get_32();
|
||||
if (id & 0x80000000) {
|
||||
uint32_t len = id & 0x7FFFFFFF;
|
||||
int len = id & 0x7FFFFFFF;
|
||||
if (len > str_buf.size()) {
|
||||
str_buf.resize(len);
|
||||
}
|
||||
|
|
@ -336,9 +336,9 @@ Error ResourceInteractiveLoaderBinary::parse_variant(Variant &r_v) {
|
|||
} break;
|
||||
case OBJECT_EXTERNAL_RESOURCE_INDEX: {
|
||||
//new file format, just refers to an index in the external list
|
||||
uint32_t erindex = f->get_32();
|
||||
int erindex = f->get_32();
|
||||
|
||||
if (erindex >= external_resources.size()) {
|
||||
if (erindex < 0 || erindex >= external_resources.size()) {
|
||||
WARN_PRINT("Broken external resource! (index out of size");
|
||||
r_v = Variant();
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -385,7 +385,7 @@ void XMLParser::_bind_methods() {
|
|||
Error XMLParser::read() {
|
||||
|
||||
// if not end reached, parse the node
|
||||
if (P && (P - data) < length - 1 && *P != 0) {
|
||||
if (P && (P - data) < (int64_t)length - 1 && *P != 0) {
|
||||
_parse_current_node();
|
||||
return OK;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -67,7 +67,7 @@ public:
|
|||
private:
|
||||
char *data;
|
||||
char *P;
|
||||
int length;
|
||||
uint64_t length;
|
||||
void unescape(String &p_str);
|
||||
Vector<String> special_characters;
|
||||
String node_name;
|
||||
|
|
|
|||
|
|
@ -389,8 +389,8 @@ Error QuickHull::build(const Vector<Vector3> &p_points, Geometry::MeshData &r_me
|
|||
|
||||
for (int i = 0; i < f.indices.size(); i++) {
|
||||
|
||||
uint32_t a = E->get().indices[i];
|
||||
uint32_t b = E->get().indices[(i + 1) % f.indices.size()];
|
||||
int a = E->get().indices[i];
|
||||
int b = E->get().indices[(i + 1) % f.indices.size()];
|
||||
Edge e(a, b);
|
||||
|
||||
Map<Edge, RetFaceConnect>::Element *F = ret_edges.find(e);
|
||||
|
|
|
|||
|
|
@ -61,7 +61,7 @@ Variant PackedDataContainer::_iter_init_ofs(const Array &p_iter, uint32_t p_offs
|
|||
Variant PackedDataContainer::_iter_next_ofs(const Array &p_iter, uint32_t p_offset) {
|
||||
|
||||
Array ref = p_iter;
|
||||
uint32_t size = _size(p_offset);
|
||||
int size = _size(p_offset);
|
||||
if (ref.size() != 1)
|
||||
return false;
|
||||
int pos = ref[0];
|
||||
|
|
@ -74,7 +74,7 @@ Variant PackedDataContainer::_iter_next_ofs(const Array &p_iter, uint32_t p_offs
|
|||
|
||||
Variant PackedDataContainer::_iter_get_ofs(const Variant &p_iter, uint32_t p_offset) {
|
||||
|
||||
uint32_t size = _size(p_offset);
|
||||
int size = _size(p_offset);
|
||||
int pos = p_iter;
|
||||
if (pos < 0 || pos >= size)
|
||||
return Variant();
|
||||
|
|
@ -164,7 +164,7 @@ Variant PackedDataContainer::_key_at_ofs(uint32_t p_ofs, const Variant &p_key, b
|
|||
if (p_key.is_num()) {
|
||||
|
||||
int idx = p_key;
|
||||
uint32_t len = decode_uint32(r + 4);
|
||||
int len = decode_uint32(r + 4);
|
||||
if (idx < 0 || idx >= len) {
|
||||
err = true;
|
||||
return Variant();
|
||||
|
|
@ -183,7 +183,7 @@ Variant PackedDataContainer::_key_at_ofs(uint32_t p_ofs, const Variant &p_key, b
|
|||
uint32_t len = decode_uint32(r + 4);
|
||||
|
||||
bool found = false;
|
||||
for (int i = 0; i < len; i++) {
|
||||
for (uint32_t i = 0; i < len; i++) {
|
||||
uint32_t khash = decode_uint32(r + 8 + i * 12 + 0);
|
||||
if (khash == hash) {
|
||||
Variant key = _get_at_ofs(decode_uint32(r + 8 + i * 12 + 4), rd.ptr(), err);
|
||||
|
|
|
|||
|
|
@ -339,9 +339,9 @@ Error PoolAllocator::resize(ID p_mem, int p_new_size) {
|
|||
ERR_FAIL_COND_V(e->lock, ERR_ALREADY_IN_USE);
|
||||
}
|
||||
|
||||
int alloc_size = aligned(p_new_size);
|
||||
uint32_t alloc_size = aligned(p_new_size);
|
||||
|
||||
if (aligned(e->len) == alloc_size) {
|
||||
if ((uint32_t)aligned(e->len) == alloc_size) {
|
||||
|
||||
e->len = p_new_size;
|
||||
mt_unlock();
|
||||
|
|
@ -374,7 +374,7 @@ Error PoolAllocator::resize(ID p_mem, int p_new_size) {
|
|||
}
|
||||
|
||||
//no need to move stuff around, it fits before the next block
|
||||
int next_pos;
|
||||
uint32_t next_pos;
|
||||
if (entry_indices_pos + 1 == entry_count) {
|
||||
next_pos = pool_size; // - static_area_size;
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -588,7 +588,7 @@ String String::camelcase_to_underscore(bool lowercase) const {
|
|||
const char a = 'a', z = 'z';
|
||||
int start_index = 0;
|
||||
|
||||
for (size_t i = 1; i < this->size(); i++) {
|
||||
for (int i = 1; i < this->size(); i++) {
|
||||
bool is_upper = cstr[i] >= A && cstr[i] <= Z;
|
||||
bool is_number = cstr[i] >= '0' && cstr[i] <= '9';
|
||||
bool are_next_2_lower = false;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue