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++ )
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++ )
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++ )
bp += 2;
}
j -= 1;
- pp->surf = ( lwSurface * ) j;
+ pp->surf = ( lwSurface * ) (size_t) j;
pp++;
pv += nv;
}
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();
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;
}
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 )
*/
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;
}
for (i=0 ; i<numthreads ; i++)
{
/* Default pthread attributes: joinable & non-realtime scheduling */
- if(pthread_create(&work_threads[i], &attr, (void*)func, (void*)i) != 0)
+ if(pthread_create(&work_threads[i], &attr, (void*)func, (void*)(size_t)i) != 0)
Error("pthread_create failed");
}
for (i=0 ; i<numthreads ; i++)
{
short v;
- fread( &v, sizeof(v), 1, fin );
+ if(fread( &v, sizeof(v), 1, fin ) != 1)
+ return UNZ_EOF;
*pX = __LittleShort( v);
return UNZ_OK;
{
int v;
- fread( &v, sizeof(v), 1, fin );
+ if(fread( &v, sizeof(v), 1, fin ) != 1)
+ return UNZ_EOF;
*pX = __LittleLong( v);
return UNZ_OK;
*bufferptr = safe_malloc (len+1);
if (*bufferptr == NULL)
- return -1;
+ {
+ fclose(f);
+ return -1;
+ }
- fread (*bufferptr, 1, len, f);
+ if(fread (*bufferptr, 1, len, f) != len)
+ {
+ fclose(f);
+ return -1;
+ }
fclose (f);
// we need to end the buffer with a 0
void TidyEntitySurfaces( entity_t *e )
{
int i, j, deleted;
- mapDrawSurface_t *out, *in;
+ mapDrawSurface_t *out, *in = NULL;
/* note it */
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);
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);