Module zmodel: Change committed

havoc at icculus.org havoc at icculus.org
Sat May 6 22:43:37 EDT 2006


Commiter   : havoc
CVSROOT    : /cvs/cvsroot/twilight
Module     : zmodel
Commit time: 2006-05-07 02:43:37 UTC

Log message:

fix 64bit pointer issues and gcc4 signedness warnings

Modified files:
     zmodel.c

------=MIME.8b11a753b1c58ff5641defe3f9dd1e8d
Content-Type: text/plain; name="zmodel.20060507.024337.havoc.diff"
Content-Disposition: attachment; filename="zmodel.20060507.024337.havoc.diff"
Content-Transfer-Encoding: 8bit

Index: zmodel/zmodel.c
diff -u zmodel/zmodel.c:1.6 zmodel/zmodel.c:1.7
--- zmodel/zmodel.c:1.6	Thu May 26 00:48:57 2005
+++ zmodel/zmodel.c	Sat May  6 22:43:27 2006
@@ -217,11 +217,11 @@
 }
 */
 
-unsigned char *tokenpos;
+char *tokenpos;
 
-int getline(unsigned char *line)
+int getline(char *line)
 {
-	unsigned char *out = line;
+	char *out = line;
 	while (*tokenpos == '\r' || *tokenpos == '\n')
 		tokenpos++;
 	if (*tokenpos)
@@ -412,12 +412,12 @@
 bonepose_t bonematrix[MAX_BONES];
 
 int modelfilesize;
-unsigned char *modelfile;
+char *modelfile;
 
 int parsenodes(void)
 {
 	int num, parent, i;
-	unsigned char line[1024], name[1024];
+	char line[1024], name[1024];
 	memset(scenebone, 0, sizeof(scenebone));
 	memset(sceneboneremap, 0xFF, sizeof(sceneboneremap));
 	while (getline(line))
@@ -497,7 +497,7 @@
 
 int parseskeleton(void)
 {
-	unsigned char line[1024], command[256];
+	char line[1024], command[256];
 	int i, frame, num, highest;
 	float x, y, z, a, b, c;
 	int baseframe;
@@ -550,9 +550,9 @@
 		if (!posedefined[frame+baseframe])
 		{
 			printf("warning: missing pose, compacting pose list\n");
-			memcpy(&pose[frame+baseframe][0], &pose[frame+baseframe+1][0], (int) (&pose[highest+baseframe][0]) - (int) (&pose[frame+baseframe][0]));
-			memcpy(&posedefined[frame+baseframe], &posedefined[frame+baseframe+1], (int) (&posedefined[highest+baseframe]) - (int) (&posedefined[frame+baseframe]));
-			memset(&pose[highest+baseframe][0], 0, (int) &pose[highest+baseframe+1][0] - (int) &pose[highest+baseframe][0]);
+			memcpy(&pose[frame+baseframe][0], &pose[frame+baseframe+1][0], (unsigned char *) (&pose[highest+baseframe][0]) - (unsigned char *) (&pose[frame+baseframe][0]));
+			memcpy(&posedefined[frame+baseframe], &posedefined[frame+baseframe+1], (unsigned char *) (&posedefined[highest+baseframe]) - (unsigned char *) (&posedefined[frame+baseframe]));
+			memset(&pose[highest+baseframe][0], 0, (unsigned char *) &pose[highest+baseframe+1][0] - (unsigned char *) &pose[highest+baseframe][0]);
 			posedefined[highest+baseframe] = 0;
 			highest--;
 			frame--; // recheck this frame
@@ -565,7 +565,7 @@
 
 int parsemeshskeleton(void)
 {
-	unsigned char line[1024], command[256];
+	char line[1024], command[256];
 	int i, num;
 	float x, y, z, a, b, c;
 	while (getline(line))
@@ -612,7 +612,7 @@
 
 int parsemeshtriangles(void)
 {
-	unsigned char line[1024];
+	char line[1024];
 	int current = 0, bonenum, i;
 	float org[3], normal[3];
 	float d;
@@ -753,12 +753,12 @@
 
 int putgetposition(void)
 {
-	return (int) output - (int) outputbuffer;
+	return (int)(output - outputbuffer);
 }
 
 void putsetposition(int n)
 {
-	output = (unsigned char *) (n + (int) outputbuffer);
+	output = outputbuffer + n;
 }
 
 typedef struct lump_s


More information about the twilight-commits mailing list