1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-09 12:50:35 +00:00

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:
marxin
2019-02-21 20:57:39 +01:00
parent ce114e35dd
commit e5f665c718
21 changed files with 40 additions and 41 deletions

View File

@@ -76,7 +76,7 @@ int64_t GDAPI godot_videodecoder_file_seek(void *ptr, int64_t pos, int whence) {
} break;
case SEEK_CUR: {
// Just in case it doesn't exist
if (pos < 0 && -pos > file->get_position()) {
if (pos < 0 && (size_t)-pos > file->get_position()) {
return -1;
}
pos = pos + static_cast<int>(file->get_position());
@@ -86,7 +86,7 @@ int64_t GDAPI godot_videodecoder_file_seek(void *ptr, int64_t pos, int whence) {
} break;
case SEEK_END: {
// Just in case something goes wrong
if (-pos > len) {
if ((size_t)-pos > len) {
return -1;
}
file->seek_end(pos);