[physfs] PHYSFS_seek is too simple
Christoph Nelles
evilazrael at evilazrael.de
Mon Dec 3 13:44:21 EST 2012
Hi,
write your own small wrapper function with the third parameter which
translates relative positions to absolute positions. It is not so
difficult, just a little bit of math (and physfs_tell). The worst is
probably SEEK_END. If Physfs_uint64 is a problem for you, try a weak &
dynamic typed language.
On 03.12.2012 19:37, fy wrote:
> ? Tue, 04 Dec 2012 00:27:45 +0800,Tim C(as <darkuranium at gmail.com> ??:
>
> 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.
>
>
> OK. Now I tired, but failed.
>
> Then I load whole file into memory.I got a record of func calls by
> codes of stackoverflow :
>
> SEEK_END
> SEEK_END
> SEEK_SET
> SEEK_SET
>
> The "fromwhere" parameter is REALLY needed.
>
>
> As to this code snippet,
>
> > if(type == SEEK_CUR)
> > {
> > if(pos < -diff) // in other words, if `pos + diff` would be negative
> > pos = 0;
> > else
> > pos += diff;
> > }
>
> It can't be so easy.
>
>
> Anyway the problem is solved, not in the best way.
>
> So I think it should be patched.
>
>
> --
> ??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/12a3c9df/attachment.htm>
More information about the physfs
mailing list