[flac-dev] Windows file buffering

lvqcl lvqcl.mail at gmail.com
Thu Dec 10 11:24:42 PST 2015

LRN wrote:

>> Maybe you mean some other commit? For example,
>> <http://git.xiph.org/?p=flac.git;a=commitdiff;h=d66f6754bf94bc8ba23d3579d0b5650cd380c9f0> ?
> Yes, that is exactly what i meant.
>> The attached patch *should* resolve the issue. libFLAC will call setvbuf(file, ...)
>> only if GetFileType(...file...) == FILE_TYPE_DISK.
> That patch looks correct. That said, i'm not sure why there's setvbuf() in
> the first place. I mean, the code to de-fragment the output file already
> exists (the aforementioned d66f675), so why buffering? Was it proven
> empirically that buffering is required? Or am i looking at this backwards
> and that code was added later than setvbuf()?

SetFilePointerEx() for _de_coding (e.g. when flac writes .wav file),
setvbuf() for _en_coding (when libFLAC writes .flac file).

More information about the flac-dev mailing list