]> git.rm.cloudns.org Git - xonotic/netradiant.git/commitdiff
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 63e6369764dd7d28af494d7e178126d70062c2a0..074a4a437732d5621022af0037d2b15c074687ca 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 05213cf1ae545ab0efb29ec2d6801f11ee95e291..74e47a8a6db67548258c66fa3ffbd25f99a8e2f0 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)
        {