[MPlayer-dev-eng] mingw32 large file support

Rich Felker dalias at aerifal.cx
Fri Jan 27 00:04:19 CET 2006


On Thu, Jan 26, 2006 at 09:42:21AM -0600, Joey Parrish wrote:
> On Thu, Jan 26, 2006 at 10:26:53AM +0100, Dominik 'Rathann' Mierzejewski wrote:
> > On Thursday, 26 January 2006 at 02:12, Felix Buenemann wrote:
> > > Hi,
> > > 
> > > I've discovered that on mingw32 off_t is always 4 bytes,
> > 
> > Even on 64bit Windows?
> > 
> > > wereas only
> > > off64_t delivers 8 bytes, so large file support in MPlayer-mingw32 is
> > > totally broken (this mit also apply to some file handling functions,
> > > I'll till have to check that).
> > 
> > So... there are two versions of each function? One taking off_t and the
> > other off64_t as a parameter?
> > 
> > > Anyone has a good idea how to fix this without
> > > rewriting the entire code in MPlayer?
> > 
> > Hm. typedef off64_t off_t? ;)
> 
> Attached is all64.h, a header to merge the different 64-bit file APIs on
> MinGW, Cygwin, and Linux.  Be sure to include it before any other file.
> 
> Also attached is a test app to allow you to quickly test all64 and make
> sure it works as expected.  I've tested it on all three platforms.
> 
> Is this helpful?

Yes, however I'm strongly against this part:

/*
 * Now use these:
 *  struct stat64
 *  stat64()
 *  fstat64()
 *  lstat64()
 *  off64_t
 *  open64()
 *  lseek64()
 *  fpos64_t
 *  fopen64()
 *  fdopen64()
 *  ftello64()
 *  fseeko64()
 *  fgetpos64()
 *  fsetpos64()
 *  tmpfile64()
 */

Instead your header should use the preprocessor to replace the broken
32bit versions with 64bit ones. If applications directly use these
stupid *64 interfaces, they're not remotely portable and will not work
on non-stupid implementations where file offsets are always 64bit
(like my new replacement libc :).

Rich




More information about the MPlayer-dev-eng mailing list