Fix -Wsign-compare warnings.
I decided to modify code in a defensive way. Ideally functions like size() or length() should return an unsigned type.
This commit is contained in:
@@ -224,7 +224,7 @@ Error PacketPeerStream::get_packet(const uint8_t **r_buffer, int &r_buffer_size)
|
||||
uint32_t len = decode_uint32(lbuf);
|
||||
ERR_FAIL_COND_V(remaining < (int)len, ERR_UNAVAILABLE);
|
||||
|
||||
ERR_FAIL_COND_V(input_buffer.size() < len, ERR_UNAVAILABLE);
|
||||
ERR_FAIL_COND_V(input_buffer.size() < (int)len, ERR_UNAVAILABLE);
|
||||
ring_buffer.read(lbuf, 4); //get rid of first 4 bytes
|
||||
ring_buffer.read(input_buffer.ptrw(), len); // read packet
|
||||
|
||||
|
||||
@@ -106,7 +106,7 @@ StringName ResourceInteractiveLoaderBinary::_get_string() {
|
||||
uint32_t id = f->get_32();
|
||||
if (id & 0x80000000) {
|
||||
uint32_t len = id & 0x7FFFFFFF;
|
||||
if (len > str_buf.size()) {
|
||||
if ((int)len > str_buf.size()) {
|
||||
str_buf.resize(len);
|
||||
}
|
||||
if (len == 0)
|
||||
|
||||
Reference in New Issue
Block a user