diff options
author | Franklin Wei <git@fwei.tk> | 2019-07-24 21:01:44 -0400 |
---|---|---|
committer | Franklin Wei <git@fwei.tk> | 2019-07-24 21:02:11 -0400 |
commit | 7e4902bf6bfcf0acef0889bf4e3fae04a8839079 (patch) | |
tree | 27af47d9ca18184c0f52c76282284c6fa016148e /apps/plugins/sdl/progs/quake/model.c | |
parent | 7bef453e0318acee10adbc2b561ba7d2f4b81fe3 (diff) | |
download | rockbox-7e4902bf6bfcf0acef0889bf4e3fae04a8839079.tar.gz rockbox-7e4902bf6bfcf0acef0889bf4e3fae04a8839079.zip |
quake: fix errorneous endian-correcting reads
ef9ee89 introduced Read{Big,Little}{Short,Long,Float} functions to safely
read a value in memory. These incorrectly take char*, which causes them to
output erroneous 0xff bytes when given bytes with bit 7 set.
Change-Id: I9531172301aecfdacae405d2f782f662608ce6df
Diffstat (limited to 'apps/plugins/sdl/progs/quake/model.c')
-rw-r--r-- | apps/plugins/sdl/progs/quake/model.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/apps/plugins/sdl/progs/quake/model.c b/apps/plugins/sdl/progs/quake/model.c index 4c16c7f0f5..5ac6dc6cb2 100644 --- a/apps/plugins/sdl/progs/quake/model.c +++ b/apps/plugins/sdl/progs/quake/model.c | |||
@@ -1165,7 +1165,11 @@ void Mod_LoadBrushModel (model_t *mod, void *buffer) | |||
1165 | mod_base = (byte *)header; | 1165 | mod_base = (byte *)header; |
1166 | 1166 | ||
1167 | for (i=0 ; i<sizeof(dheader_t)/4 ; i++) | 1167 | for (i=0 ; i<sizeof(dheader_t)/4 ; i++) |
1168 | ((int *)header)[i] = LittleLongUnaligned ( ((int *)header)[i]); | 1168 | { |
1169 | int before = ((int*)header)[i]; | ||
1170 | ((int *)header)[i] = LittleLongUnaligned ( ((int *)header) [i]); | ||
1171 | assert(((int*)header)[i] == before); // sanity check of our *Unaligned routines | ||
1172 | } | ||
1169 | 1173 | ||
1170 | // load into heap | 1174 | // load into heap |
1171 | 1175 | ||