summaryrefslogtreecommitdiffstats
path: root/src/resources
diff options
context:
space:
mode:
authorP. J. McDermott <pj@pehjota.net>2023-02-25 13:15:36 (EST)
committer P. J. McDermott <pj@pehjota.net>2023-02-25 14:01:16 (EST)
commit625da6f5603f33168572597cda8b72b5bd1b96d1 (patch)
treeaf84540be2764357236446fb89f07bf09156fd9b /src/resources
parent4a07d2676fd06b20180b7bbac2aff06d7a0fbcde (diff)
downloadoverworld-rpg-625da6f5603f33168572597cda8b72b5bd1b96d1.zip
overworld-rpg-625da6f5603f33168572597cda8b72b5bd1b96d1.tar.gz
overworld-rpg-625da6f5603f33168572597cda8b72b5bd1b96d1.tar.bz2
map: Fix shift overflow warningHEADmaster
src/resources/map.c: In function ‘tmx_data_end’: src/resources/map.c:541:35: warning: result of ‘255 << 24’ requires 33 bits to represent, but ‘int’ only has 32 bits [-Wshift-overflow=] 541 | (decomp_buf[i * 4 + 3] & 0xFF << 030); | ^~
Diffstat (limited to 'src/resources')
-rw-r--r--src/resources/map.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/resources/map.c b/src/resources/map.c
index e190282..38928d3 100644
--- a/src/resources/map.c
+++ b/src/resources/map.c
@@ -535,10 +535,10 @@ tmx_data_end(void *pv, const char *name)
for (i = 0; i < decomp_len / 4; ++i) {
/* Convert each tile GID to the system's byte order. */
ly->tiles[i] =
- (decomp_buf[i * 4 + 0] & 0xFF << 000) |
- (decomp_buf[i * 4 + 1] & 0xFF << 010) |
- (decomp_buf[i * 4 + 2] & 0xFF << 020) |
- (decomp_buf[i * 4 + 3] & 0xFF << 030);
+ (decomp_buf[i * 4 + 0] & (Uint32) 0xFF << 000) |
+ (decomp_buf[i * 4 + 1] & (Uint32) 0xFF << 010) |
+ (decomp_buf[i * 4 + 2] & (Uint32) 0xFF << 020) |
+ (decomp_buf[i * 4 + 3] & (Uint32) 0xFF << 030);
}
free(decomp_buf);
xml_node_pop(p);