[vorbis-dev] Borland modification

Michael Smith msmith at labyrinth.net.au
Tue Aug 29 20:05:45 PDT 2000



At 04:46 PM 8/29/00 -0700, you wrote:
>Monty wrote:
>
>> Yes.  The basic thinking is that the source module should relinquish
>> all control of the FILE *, as any external interference will confuse
>> (at best) or crash (at worst) vorbisfile.  As the source of the FILE
>> * must be totally hands-off anyway, Vorbisfile assumes
>> responsibility of cleanup as well.
>
>The best reason not to do that is popen.  (On Unix,) fclose is right
>for files opened by fopen or fdopen, but pipes opened by popen
>should be closed by pclose.  So if vorbisfile insists on calling
>fclose, then it can't do I/O to pipes.
>
>In general, it's goodness to keep the destructor at the same level as the
>constructor.

I agree, for the most part - but it works fine as it is, so breaking
backwards compatibility isn't worth it. It's pretty trivial to tell
vorbisfile to use pclose() instead of fclose() in the appropriate case. 

Monty has been saying "FILE *" everywhere, but that's no longer the case -
vorbisfile was originally designed around stdio, but has since been
retrofitted to pass around void pointers and cast them to appropriate
things inside callbacks - so what each of the callbacks does is entirely up
to the programmer. For example, the winamp plugin avoids use of stdio
entirely (mostly not for any good reason, just because we needed an example
of how to do it properly, and it makes no real difference to efficiency). 

Michael

--- >8 ----
List archives:  http://www.xiph.org/archives/
Ogg project homepage: http://www.xiph.org/ogg/



More information about the Vorbis-dev mailing list