]> git.xonotic.org Git - xonotic/netradiant.git/blobdiff - tools/quake3/q3data/p3dlib.c
Centralise compile checks
[xonotic/netradiant.git] / tools / quake3 / q3data / p3dlib.c
index 2da1ae9b6aed31e5b3a64791d518cb2f5709c667..2abcea61c909b9bfdcf949011847d0267c610167 100644 (file)
@@ -20,8 +20,9 @@
  */
 
 #include "p3dlib.h"
+#include "globaldefs.h"
 
-#ifdef WIN32
+#if GDEF_OS_WINDOWS
 #include <io.h>
 #endif
 #include <stdlib.h>
 
 #define MAX_POLYSETS 64
 
-#if defined ( __linux__ ) || defined ( __APPLE__ )
-#define _strcmpi Q_stricmp
-#define filelength Q_filelength
-#define strlwr strlower
+#if GDEF_OS_LINUX || GDEF_OS_MACOS
+       #include "cmdlib.h"
+       #define _strcmpi Q_stricmp
+       #define strlwr strlower
+       #define filelength(f) Q_filelength(f)
+#else
+       #define filelength(f) filelength(fileno(f))
 #endif
 typedef struct
 {
@@ -67,7 +71,7 @@ int P3DLoad( const char *filename ){
 
        memset( &p3d, 0, sizeof( p3d ) );
 
-       p3d.len = filelength( fileno( fp ) );
+       p3d.len = filelength( fp );
 
        p3d.curpos = p3d.buffer = malloc( p3d.len );