1
0
Fork 0
forked from len0rd/rockbox

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
This commit is contained in:
Franklin Wei 2019-07-24 21:01:44 -04:00
parent 7bef453e03
commit 7e4902bf6b
3 changed files with 23 additions and 19 deletions

View file

@ -1165,7 +1165,11 @@ void Mod_LoadBrushModel (model_t *mod, void *buffer)
mod_base = (byte *)header;
for (i=0 ; i<sizeof(dheader_t)/4 ; i++)
((int *)header)[i] = LittleLongUnaligned ( ((int *)header)[i]);
{
int before = ((int*)header)[i];
((int *)header)[i] = LittleLongUnaligned ( ((int *)header) [i]);
assert(((int*)header)[i] == before); // sanity check of our *Unaligned routines
}
// load into heap