[flac-dev] Bug fix and compatibility patches for 1.3.0pre4
Timothy B. Terriberry
tterribe at xiph.org
Sat May 4 18:03:34 PDT 2013
Robert Kausch wrote:
> The _lseeki64 patch probably is a little more controversial. The problem
> is that fseeki64 and ftelli64 are not available in Windows XP - at least
> not without installing extra MSVC runtime libraries. I changed compat.h
> and replaced them with calls to _lseeki64, which was available at least
> back to Windows 98 and thus doesn't impose such compatibility issues.
_lseeki64 operates on the underlying file handle, and does not interact
well with the buffering in stdio streams. I _think_ you can use this
successfully if you call fflush() beforehand (as this sets FILE::_cnt to
0 and FILE::_ptr to FILE::_base). By which I mean I read the MSVCRT
source from MSVC6.0 and it appears this is how things work.
That source also includes an fseeki64()/ftelli64(), but they are not
defined in stdio.h. I wonder if just declaring it yourself is good
enough? If not, they get called by fsetpos()/fgetpos() (which _do_
interact correctly with the buffering in stdio streams), except when
_MAC is defined (which I presume is not common). I don't actually have
XP to test against.
More information about the flac-dev
mailing list