[physfs] PHYSFS_seek is too simple

fy fy0748 at gmail.com
Mon Dec 3 13:37:45 EST 2012


在 Tue, 04 Dec 2012 00:27:45 +0800,Tim Č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/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://icculus.org/pipermail/physfs/attachments/20121204/63639dae/attachment.htm>


More information about the physfs mailing list