X-Git-Url: http://git.xonotic.org/?a=blobdiff_plain;f=tools%2Fquake3%2Fq3data%2Fmd3lib.c;h=93b1dfe0028787d2a015149839f62ca7788c54df;hb=02a51890a3d97a0e937fbb11071cf7c41cc00aa9;hp=f2f0eee5501ca6fcb98871d498e24a84cbe8ec84;hpb=dac8329952745dbb494bad1c301e44bab05ec0db;p=xonotic%2Fnetradiant.git diff --git a/tools/quake3/q3data/md3lib.c b/tools/quake3/q3data/md3lib.c index f2f0eee5..93b1dfe0 100644 --- a/tools/quake3/q3data/md3lib.c +++ b/tools/quake3/q3data/md3lib.c @@ -1,5 +1,5 @@ /* - 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. @@ -19,20 +19,23 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ +#include "globaldefs.h" #include -#ifdef WIN32 +#if GDEF_OS_WINDOWS #include #endif #include "md3lib.h" -#if defined ( __linux__ ) || defined ( __APPLE__ ) -#define filelength Q_filelength +#if GDEF_OS_LINUX || GDEF_OS_MACOS +#define filelength(f) Q_filelength(f) +#else +#define filelength(f) filelength(fileno(f)) #endif /* ** MD3_ComputeTagFromTri */ -void MD3_ComputeTagFromTri( md3Tag_t *pTag, const float pTri[3][3] ){ +void MD3_ComputeTagFromTri( md3Tag_t *pTag, float pTri[3][3] ){ float len[3]; vec3_t axes[3], sides[3]; int longestSide, shortestSide, hypotSide; @@ -149,8 +152,8 @@ void MD3_Dump( const char *filename ){ Error( "Unable to open '%s'\n", filename ); } - fileSize = filelength( fileno( fp ) ); - _buffer = malloc( filelength( fileno( fp ) ) ); + fileSize = filelength( fp ); + _buffer = malloc( fileSize ); fread( _buffer, fileSize, 1, fp ); fclose( fp ); @@ -168,7 +171,7 @@ void MD3_Dump( const char *filename ){ printf( " num tags: %d\n", header.numTags ); printf( " num surfaces: %d\n", header.numSurfaces ); printf( " num skins: %d\n", header.numSkins ); - printf( " file size: %d\n", fileSize ); + printf( " file size: %ld\n", fileSize ); printf( "--- TAGS ---\n" ); pTag = ( md3Tag_t * ) ( ( ( char * ) buffer ) + header.ofsTags );