[AD] bugfix for files > 2GB under unix

[ Thread Index | Date Index | More lists.liballeg.org/allegro-developers Archives ]


The attached patch allows the unix port to see files > 2GB - currently,
all such files are silently ignored.

The size is not returned correctly simply because 32-bit datatypes are
used - I'd like to update those as well, but keeping in mind binary
compatibility, maybe better to do so only for 4.3. For a video player,
currently there would be no way to play e.g. any DVDs since the files
are usually > 2GB. The patch fixes that.

-- 
Elias Pschernig
Index: configure.in
===================================================================
--- configure.in	(revision 5800)
+++ configure.in	(working copy)
@@ -713,7 +713,7 @@
 AC_STRUCT_TM
 AC_TYPE_SIGNAL
 
-AC_CHECK_FUNCS(mmap mprotect memcmp mkstemp stricmp strlwr strupr vprintf)
+AC_CHECK_FUNCS(mmap mprotect memcmp mkstemp stricmp strlwr strupr vprintf stat64)
 
 dnl Tweak header files for library build
 CFLAGS="$CFLAGS -DALLEGRO_LIB_BUILD"
Index: src/unix/ufile.c
===================================================================
--- src/unix/ufile.c	(revision 5800)
+++ src/unix/ufile.c	(working copy)
@@ -18,11 +18,16 @@
 
 #include <stdio.h>
 #include <string.h>
-#include <sys/stat.h>
 
 #include "allegro.h"
 #include "allegro/internal/aintern.h"
 
+#ifdef HAVE_SYS_STAT_H
+#ifdef HAVE_STAT64
+#define __USE_LARGEFILE64
+#endif
+#include <sys/stat.h>
+#endif
 
 #ifdef HAVE_DIRENT_H
    #include <sys/types.h>
@@ -53,6 +58,9 @@
    #endif
 #endif
 
+#ifdef HAVE_STAT64
+#define stat stat64
+#endif
 
 
 /* _al_file_isok:


Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/