shithub: qk2

Download patch

ref: c909a88a89b43d5555f3090c0a54de31b067fe7c
parent: 0a3f54086a5d97c57bd6ffb1ca4a6296ed19b441
author: Konstantinn Bonnet <[email protected]>
date: Fri Mar 13 08:24:44 EDT 2015

fix typo and possibly breakable sizeof assumptions

r_poly.c: was dividing by pointer size rather than float size, breaking
e.g. amd64

--- a/ref/r_model.c
+++ b/ref/r_model.c
@@ -890,7 +890,7 @@
 // swap all the lumps
 	mod_base = (byte *)header;
 
-	for (i=0 ; i<sizeof(dheader_t)/4 ; i++)
+	for (i=0 ; i<sizeof(dheader_t)/sizeof(int) ; i++)
 		((int *)header)[i] = LittleLong ( ((int *)header)[i]);
 
 // load into heap
@@ -971,7 +971,7 @@
 	pheader = Hunk_Alloc (LittleLong(pinmodel->ofs_end));
 	
 	// byte swap the header fields and sanity check
-	for (i=0 ; i<sizeof(dmdl_t)/4 ; i++)
+	for (i=0 ; i<sizeof(dmdl_t)/sizeof(int) ; i++)
 		((int *)pheader)[i] = LittleLong (((int *)buffer)[i]);
 
 	if (pheader->skinheight > MAX_LBM_HEIGHT)
--- a/ref/r_poly.c
+++ b/ref/r_poly.c
@@ -988,7 +988,7 @@
 		scale = yscale * pout->zi;
 		pout->v = (ycenter - scale * transformed[1]);
 
-		pv += sizeof (vec5_t) / sizeof (pv);
+		pv += sizeof (vec5_t) / sizeof (*pv);
 	}
 
 // draw it