]> git.xonotic.org Git - xonotic/netradiant.git/blobdiff - tools/quake3/q3data/p3dlib.c
q3map2: pad with zero, not with null pointers, ref #160
[xonotic/netradiant.git] / tools / quake3 / q3data / p3dlib.c
index 0b228e2fad9a439039719a03eea366d726598465..ea59bb4d1eeafe2e62ae729aa13a7a3d9c1d1823 100644 (file)
@@ -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.
  */
 
 #include "p3dlib.h"
+#include "globaldefs.h"
 
-#ifdef WIN32
+#if GDEF_OS_WINDOWS
 #include <io.h>
-#endif
+#endif // GDEF_OS_WINDOWS
+
 #include <stdlib.h>
 #include <stdio.h>
 #include <string.h>
 
 #define MAX_POLYSETS 64
 
-#if defined ( __linux__ ) || defined ( __APPLE__ )
+#if GDEF_OS_WINDOWS
+       #define filelength(f) filelength(fileno(f))
+#else // !GDEF_OS_WINDOWS
        #include "cmdlib.h"
        #define _strcmpi Q_stricmp
-       #define filelength Q_filelength
        #define strlwr strlower
-#endif
+       #define filelength(f) Q_filelength(f)
+#endif // !GDEF_OS_WINDOWS
+
 typedef struct
 {
        long len;
@@ -68,7 +73,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 );