]> de.git.xonotic.org Git - xonotic/netradiant.git/blobdiff - tools/quake3/q3map2/brush.c
ported over the 1.5 branch version of q3map2 which is newer
[xonotic/netradiant.git] / tools / quake3 / q3map2 / brush.c
index 57b5d81a81d610e7831b09c51be4842d3a381824..2517ca63d210e28ed1778863fedf2b102800e8f7 100644 (file)
@@ -1,6 +1,6 @@
 /* -------------------------------------------------------------------------------
 
-Copyright (C) 1999-2006 Id Software, Inc. and contributors.
+Copyright (C) 1999-2007 id Software, Inc. and contributors.
 For a list of contributors, see the accompanying CONTRIBUTORS file.
 
 This file is part of GtkRadiant.
@@ -78,7 +78,7 @@ int   CountBrushList( brush_t *brushes )
        
        
        /* count brushes */
-       for( brushes; brushes != NULL; brushes = brushes->next )
+       for( ; brushes != NULL; brushes = brushes->next )
                c++;
        return c;
 }
@@ -93,13 +93,13 @@ allocates a new brush
 brush_t *AllocBrush( int numSides )
 {
        brush_t         *bb;
-       int                     c;
+       size_t          c;
        
        
        /* allocate and clear */
        if( numSides <= 0 )
                Error( "AllocBrush called with numsides = %d", numSides );
-       c = (int) &(((brush_t*) 0)->sides[ numSides ]);
+       c = (size_t)&(((brush_t*) 0)->sides[ numSides ]);
        bb = safe_malloc( c );
        memset( bb, 0, c );
        if( numthreads == 1 )
@@ -122,7 +122,7 @@ void FreeBrush( brush_t *b )
        
        
        /* error check */
-       if( *((int*) b) == 0xFEFEFEFE )
+       if( *((unsigned int*) b) == 0xFEFEFEFE )
        {
                Sys_FPrintf( SYS_VRB, "WARNING: Attempt to free an already freed brush!\n" );
                return;
@@ -134,8 +134,8 @@ void FreeBrush( brush_t *b )
                        FreeWinding( b->sides[ i ].winding );
        
        /* ydnar: overwrite it */
-       memset( b, 0xFE, (int) &(((brush_t*) 0)->sides[ b->numsides ]) );
-       *((int*) b) = 0xFEFEFEFE;
+       memset( b, 0xFE, (size_t)&(((brush_t*) 0)->sides[ b->numsides ]) );
+       *((unsigned int*) b) = 0xFEFEFEFE;
        
        /* free it */
        free( b );
@@ -156,7 +156,7 @@ void FreeBrushList( brush_t *brushes )
        
        
        /* walk brush list */
-       for( brushes; brushes != NULL; brushes = next )
+       for( ; brushes != NULL; brushes = next )
        {
                next = brushes->next;
                FreeBrush( brushes );
@@ -173,12 +173,12 @@ duplicates the brush, sides, and windings
 brush_t *CopyBrush( brush_t *brush )
 {
        brush_t         *newBrush;
-       int                     size;
+       size_t          size;
        int                     i;
        
        
        /* copy brush */
-       size = (int) &(((brush_t*) 0)->sides[ brush->numsides ]);
+       size = (size_t)&(((brush_t*) 0)->sides[ brush->numsides ]);
        newBrush = AllocBrush( brush->numsides );
        memcpy( newBrush, brush, size );