[physfs] PHYSFS_seek is too simple

Tim Čas darkuranium at gmail.com
Mon Dec 3 11:23:40 EST 2012


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;
    else
        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
redundant.

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.
>
> --
> 使用Opera的电子邮件客户端:http://www.opera.com/mail/
>
> _______________________________________________
> physfs mailing list
> physfs at icculus.org
> http://icculus.org/mailman/listinfo/physfs
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://icculus.org/pipermail/physfs/attachments/20121203/258a31b6/attachment.htm>


More information about the physfs mailing list