q3map2: fix some more warnings

imported from netradiant, initial commit message:

> fix some more warnings
This commit is contained in:
Rudolf Polzer 2010-10-05 15:04:45 +02:00 committed by Thomas Debesse
parent 4d558e10c7
commit 5a40208a05
6 changed files with 15 additions and 7 deletions

View file

@ -297,7 +297,7 @@ void Q_getwd( char *out ){
strcat( out, "\\" ); strcat( out, "\\" );
#else #else
// Gef: Changed from getwd() to getcwd() to avoid potential buffer overflow // Gef: Changed from getwd() to getcwd() to avoid potential buffer overflow
getcwd( out, 256 ); if( !getcwd ( out, 256 ) ) *out = 0;
strcat( out, "/" ); strcat( out, "/" );
#endif #endif
while ( out[i] != 0 ) while ( out[i] != 0 )

View file

@ -461,7 +461,7 @@ winding_t *BaseWindingForPlane( vec3_t normal, vec_t dist ){
================== ==================
*/ */
winding_t *CopyWinding( winding_t *w ){ winding_t *CopyWinding( winding_t *w ){
int size; size_t size;
winding_t *c; winding_t *c;
if ( !w ) { if ( !w ) {
@ -469,7 +469,7 @@ winding_t *CopyWinding( winding_t *w ){
} }
c = AllocWinding( w->numpoints ); c = AllocWinding( w->numpoints );
size = sizeof( *w ) + sizeof( *w->p ) * w->numpoints; size = (size_t)sizeof( *w ) + sizeof( *w->p ) * w->numpoints;
memcpy( c, w, size ); memcpy( c, w, size );
return c; return c;
} }

View file

@ -551,7 +551,7 @@ void RunThreadsOn( int workcnt, qboolean showpacifier, void ( *func )( int ) ){
for ( i = 0 ; i < numthreads ; i++ ) for ( i = 0 ; i < numthreads ; i++ )
{ {
/* Default pthread attributes: joinable & non-realtime scheduling */ /* Default pthread attributes: joinable & non-realtime scheduling */
if ( pthread_create( &work_threads[i], NULL, (void*)func, (void*)i ) != 0 ) { if ( pthread_create( &work_threads[i], NULL, (void*)func, (void*)(size_t)i ) != 0 ) {
Error( "pthread_create failed" ); Error( "pthread_create failed" );
} }
} }

View file

@ -289,6 +289,7 @@ int vfsLoadFile( const char *filename, void **bufferptr, int index ){
f = fopen( filename, "rb" ); f = fopen( filename, "rb" );
if ( f == NULL ) { if ( f == NULL ) {
fclose(f);
return -1; return -1;
} }
@ -298,6 +299,7 @@ int vfsLoadFile( const char *filename, void **bufferptr, int index ){
*bufferptr = safe_malloc( len + 1 ); *bufferptr = safe_malloc( len + 1 );
if ( *bufferptr == NULL ) { if ( *bufferptr == NULL ) {
fclose(f);
return -1; return -1;
} }

View file

@ -297,7 +297,7 @@ void ClearSurface( mapDrawSurface_t *ds ){
void TidyEntitySurfaces( entity_t *e ){ void TidyEntitySurfaces( entity_t *e ){
int i, j, deleted; int i, j, deleted;
mapDrawSurface_t *out, *in; mapDrawSurface_t *out, *in = NULL;
/* note it */ /* note it */

View file

@ -954,7 +954,10 @@ void LoadPortals( char *name ){
for ( k = 0 ; k < 3 ; k++ ) for ( k = 0 ; k < 3 ; k++ )
w->points[j][k] = v[k]; w->points[j][k] = v[k];
} }
fscanf( f, "\n" ); if ( fscanf( f, "\n" ) != 0)
{
// silence gcc warning
}
// calc plane // calc plane
PlaneFromWinding( w, &plane ); PlaneFromWinding( w, &plane );
@ -1029,7 +1032,10 @@ void LoadPortals( char *name ){
for ( k = 0 ; k < 3 ; k++ ) for ( k = 0 ; k < 3 ; k++ )
w->points[j][k] = v[k]; w->points[j][k] = v[k];
} }
fscanf( f, "\n" ); if ( fscanf( f, "\n" ) != 0)
{
// silence gcc warning
}
// calc plane // calc plane
PlaneFromWinding( w, &plane ); PlaneFromWinding( w, &plane );