From: Rudolf Polzer Date: Tue, 5 Oct 2010 13:04:45 +0000 (+0200) Subject: fix some more warnings X-Git-Tag: xonotic-v0.5.0~197 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=d5a9782200fa1447fc8de8705a2183ecd14db2b0;p=xonotic%2Fnetradiant.git fix some more warnings --- diff --git a/libs/ddslib/ddslib.c b/libs/ddslib/ddslib.c index bf1a9f15..424faeea 100644 --- a/libs/ddslib/ddslib.c +++ b/libs/ddslib/ddslib.c @@ -523,7 +523,7 @@ static int DDSDecompressDXT1( ddsBuffer_t *dds, int width, int height, unsigned for( y = 0; y < yBlocks; y++ ) { /* 8 bytes per block */ - block = (ddsColorBlock_t*) ((unsigned int) dds->data + y * xBlocks * 8); + block = (ddsColorBlock_t*) ((char *) dds->data + y * xBlocks * 8); /* walk x */ for( x = 0; x < xBlocks; x++, block++ ) @@ -569,7 +569,7 @@ static int DDSDecompressDXT3( ddsBuffer_t *dds, int width, int height, unsigned for( y = 0; y < yBlocks; y++ ) { /* 8 bytes per block, 1 block for alpha, 1 block for color */ - block = (ddsColorBlock_t*) ((unsigned int) dds->data + y * xBlocks * 16); + block = (ddsColorBlock_t*) ((char *) dds->data + y * xBlocks * 16); /* walk x */ for( x = 0; x < xBlocks; x++, block++ ) @@ -625,7 +625,7 @@ static int DDSDecompressDXT5( ddsBuffer_t *dds, int width, int height, unsigned for( y = 0; y < yBlocks; y++ ) { /* 8 bytes per block, 1 block for alpha, 1 block for color */ - block = (ddsColorBlock_t*) ((unsigned int) dds->data + y * xBlocks * 16); + block = (ddsColorBlock_t*) ((char *) dds->data + y * xBlocks * 16); /* walk x */ for( x = 0; x < xBlocks; x++, block++ ) diff --git a/libs/picomodel/lwo/lwob.c b/libs/picomodel/lwo/lwob.c index 2d0522d5..f12e3a36 100644 --- a/libs/picomodel/lwo/lwob.c +++ b/libs/picomodel/lwo/lwob.c @@ -563,7 +563,7 @@ int lwGetPolygons5( picoMemStream_t *fp, int cksize, lwPolygonList *plist, int p bp += 2; } j -= 1; - pp->surf = ( lwSurface * ) j; + pp->surf = ( lwSurface * ) (size_t) j; pp++; pv += nv; diff --git a/libs/picomodel/lwo/pntspols.c b/libs/picomodel/lwo/pntspols.c index a7f54d25..31475819 100644 --- a/libs/picomodel/lwo/pntspols.c +++ b/libs/picomodel/lwo/pntspols.c @@ -353,7 +353,7 @@ int lwResolvePolySurfaces( lwPolygonList *polygon, lwTagList *tlist, } for ( i = 0; i < polygon->count; i++ ) { - index = ( int ) polygon->pol[ i ].surf; + index = ( size_t ) polygon->pol[ i ].surf; if ( index < 0 || index > tlist->count ) return 0; if ( !s[ index ] ) { s[ index ] = lwDefaultSurface(); @@ -527,7 +527,7 @@ int lwGetPolygonTags( picoMemStream_t *fp, int cksize, lwTagList *tlist, if ( rlen < 0 || rlen > cksize ) return 0; switch ( type ) { - case ID_SURF: plist->pol[ i ].surf = ( lwSurface * ) j; break; + case ID_SURF: plist->pol[ i ].surf = ( lwSurface * ) (size_t) j; break; case ID_PART: plist->pol[ i ].part = j; break; case ID_SMGP: plist->pol[ i ].smoothgrp = j; break; } diff --git a/tools/quake3/common/cmdlib.c b/tools/quake3/common/cmdlib.c index fac9bdbb..5168d233 100644 --- a/tools/quake3/common/cmdlib.c +++ b/tools/quake3/common/cmdlib.c @@ -336,7 +336,7 @@ void Q_getwd (char *out) strcat (out, "\\"); #else // Gef: Changed from getwd() to getcwd() to avoid potential buffer overflow - getcwd (out, 256); + if(!getcwd (out, 256)) *out = 0; strcat (out, "/"); #endif while ( out[i] != 0 ) diff --git a/tools/quake3/common/polylib.c b/tools/quake3/common/polylib.c index 21067ca2..fc8805e7 100644 --- a/tools/quake3/common/polylib.c +++ b/tools/quake3/common/polylib.c @@ -282,11 +282,11 @@ CopyWinding */ winding_t *CopyWinding (winding_t *w) { - int size; + size_t size; winding_t *c; c = AllocWinding (w->numpoints); - size = (int)((winding_t *)0)->p[w->numpoints]; + size = (size_t)((winding_t *)NULL)->p[w->numpoints]; memcpy (c, w, size); return c; } diff --git a/tools/quake3/common/threads.c b/tools/quake3/common/threads.c index a486abaf..7f404a4f 100644 --- a/tools/quake3/common/threads.c +++ b/tools/quake3/common/threads.c @@ -565,7 +565,7 @@ void RunThreadsOn (int workcnt, qboolean showpacifier, void(*func)(int)) for (i=0 ; ipoints[j][k] = v[k]; } - fscanf (f, "\n"); + if(fscanf (f, "\n") != 0) + { + // silence gcc warning + } // calc plane PlaneFromWinding (w, &plane); @@ -1025,7 +1028,10 @@ void LoadPortals (char *name) for (k=0 ; k<3 ; k++) w->points[j][k] = v[k]; } - fscanf (f, "\n"); + if(fscanf (f, "\n") != 0) + { + // silence gcc warning + } // calc plane PlaneFromWinding (w, &plane);