[flac-dev] Bug fix and compatibility patches for 1.3.0pre4

Robert Kausch robert.kausch at freac.org
Mon May 6 16:28:37 PDT 2013


Timothy B. Terriberry wrote:
>> "The pos value is stored in an internal format and is intended
>> for use only by *fgetpos* and *fsetpos*."
> FWIW, I verified that this is the approach used by mingw32 to implement
> fseeko/ftello.
>
Yes, they do - I also had a look at the libmingwex source. But still, 
with that sentence Microsoft basically reserves the right to change the 
behaviour of fgetpos/fsetpos at any time without notice...

I wrote a small test program in the meantime and verified that 
fgetpos/fsetpos indeed work, even back to Windows 98. _lseeki64 on the 
other hand totally messes up with buffered streams and cannot be used 
here. Calling fflush beforehand doesn't help and even fflush alone 
breaks the stream (i.e. with 4kB buffers, 
fopen()->fread()->fflush()->fread() will start at byte #4096 with the 
second read, so don't use fflush for reading).

However, as Janne already pointed out, libFLAC is statically linked by 
default, so there's no real problem with _fseeki64/_ftelli64 indeed.

I'll still have to decide whether to link statically or use your 
fgetpos/fsetpos patch for my build, but no need to change anything in 
the official FLAC code. In any case, please disregard my _lseeki64 patch.


More information about the flac-dev mailing list