[physfs] PHYSFS_seek is too simple
darkuranium at gmail.com
Mon Dec 3 11:27:45 EST 2012
One more thing, which I forgot to mention...
... I don't know whether seeking w/ fseek before the start of file is
implementation-defined or straight out undefined. In either case, the
Vorbis API should not be doing the former because of portability concerns,
and should not be doing the latter because, well, it's undefined.
If it's the former (impl-defined) and you're feeling paranoid, you can
always just do the thing I've specified in the previous email -- what's
important is that it's consistent.
If it's the latter (undefined), you don't need to worry about handling it
at all, since for all the standard cares, it could summon (in the case of
fseek) nasal demons.
That's in theory anyways -- in practice, as stated, I highly doubt the API
would do such a nasty thing due to the aforementioned reasons.
On 3 December 2012 17:23, Tim Čas <darkuranium at gmail.com> wrote:
> I'm pretty sure you can't seek before the beginning of a file w/ fseek
> anyways (and I don't see why the OGG API would want to seek there in the
> first place).
> If you *really* want to, say, make seeking before the beginning possible,
> you could do something like:
> if(type == SEEK_CUR)
> if(pos < -diff) // in other words, if `pos + diff` would be negative
> pos = 0;
> pos += diff;
> ...but, given that Vorbis won't ask for a seek before the start with
> overwhelming probability (since fseek doesn't allow that either, and
> besides -- what would you read from there?), I think such checks would be
> On 3 December 2012 17:15, fy <fy0748 at gmail.com> wrote:
>> 在 Tue, 04 Dec 2012 00:11:44 +0800，Tim Čas <darkuranium at gmail.com> 写道:
>> Well, see the answer in that SO.com question -- use `PHYSFS_tell()` to
>> get the current location, calculate the pos according to `type` (see
>> `AR_seekOgg()` in that answer), and then use `PHYSFS_seek()`.
>> I considered. But PHYSFS_uint64 can not save a negative number.
>> physfs mailing list
>> physfs at icculus.org
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the physfs