fix two bugs cppcheck found
authorRudolf Polzer <divverent@alientrap.org>
Sat, 8 Jan 2011 19:59:46 +0000 (20:59 +0100)
committerRudolf Polzer <divverent@alientrap.org>
Sat, 8 Jan 2011 19:59:46 +0000 (20:59 +0100)
tools/quake3/q3map2/main.c
tools/quake3/q3map2/model.c

index 63e6369..074a4a4 100644 (file)
@@ -989,8 +989,8 @@ int AnalyzeBSP( int argc, char **argv )
                lump = (byte*) header + offset;
                lumpInt = LittleLong( (int) *((int*) lump) );
                lumpFloat = LittleFloat( (float) *((float*) lump) );
-               memcpy( lumpString, (char*) lump, (length < 1024 ? length : 1024) );
-               lumpString[ 1024 ] = '\0';
+               memcpy( lumpString, (char*) lump, (length < sizeof(lumpString) ? length : sizeof(lumpString)-1) );
+               lumpString[ sizeof(lumpString)-1 ] = '\0';
                
                /* print basic lump info */
                Sys_Printf( "Lump:          %d\n", i );
index 05213cf..74e47a8 100644 (file)
@@ -229,7 +229,6 @@ void InsertModel( const char *name, int skin, int frame, m4x4_t transform, remap
        char                            *skinfilecontent;
        int                                     skinfilesize;
        char                            *skinfileptr, *skinfilenextptr;
-       FILE                            *skinfilehandle;
        
        
        /* get model */
@@ -240,7 +239,6 @@ void InsertModel( const char *name, int skin, int frame, m4x4_t transform, remap
        /* load skin file */
        snprintf(skinfilename, sizeof(skinfilename), "%s_%d.skin", name, skin);
        skinfilename[sizeof(skinfilename)-1] = 0;
-       skinfilehandle = fopen(skinfilename, "r");
        skinfilesize = vfsLoadFile(skinfilename, (void**) &skinfilecontent, 0);
        if(skinfilesize < 0 && skin != 0)
        {