[physfs] Seeking to end of file

Christoph Nelles evilazrael at evilazrael.de
Fri May 14 15:18:56 EDT 2010


Hi,

there are 3 patches appended, but i doubt they are useful as there are
only a few changes.

@Ryan, are you still alive? What is the status of the error code thing?


Regards

Christoph



Am 28.04.2010 23:56, schrieb Christoph Nelles:
> Hi,
> 
> according to
> http://www.opengroup.org/onlinepubs/000095399/functions/fseek.html
> seeking beyond EOF is ok. Perhaps PHYSFS should allow to seek at least 1
> byte behind the last byte. I can send in a  patch for the iso9660
> archiver (there are 2 places to patch) by the weekend.
> 
> Regards
> 
> Christoph
> 
> 
> 
> Patrice Mandin schrieb:
>> Hello,
>>
>> In my applications I use the following code to get the length of file
>> (this is with using SDL_RWops, but the concept is the same for most
>> similar API):
>>
>> SDL_RWseek(src, 0, RW_SEEK_END);
>> length = SDL_RWtell(src);
>>
>>
>> Unfortunately, with physfs, the RW_SEEK_END operation fails (but should
>> succeed from my pov), depending on the underlying archiver backend:
>>
>> archiver_grp.c, archiver_hog.c, archiver_iso9660.c, archiver_mvl.c,
>> archiver_qpak.c all fails because of:
>>
>> BAIL_IF_MACRO(offset >= entry->size, ERR_PAST_EOF, 0);
>>
>>
>> Only 2 backends may succeed:
>>
>> archiver_lzma.c:
>> BAIL_IF_MACRO(offset > file->item->Size, ERR_PAST_EOF, 0);
>>
>> archiver_zip.c:
>> BAIL_IF_MACRO(offset > entry->uncompressed_size, ERR_PAST_EOF, 0);
>>
>>   
> 
> _______________________________________________
> physfs mailing list
> physfs at icculus.org
> http://icculus.org/mailman/listinfo/physfs
> 


-- 
Christoph Nelles

E-Mail    : evilazrael at evilazrael.de
Jabber    : eazrael at evilazrael.net      ICQ       : 78819723

PGP-Key   : ID 0x424FB55B on subkeys.pgp.net
            or http://evilazrael.net/pgp.txt

-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: branch-1.0.patch
URL: <http://icculus.org/pipermail/physfs/attachments/20100514/ae013b97/attachment.diff>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: default_branch.patch
URL: <http://icculus.org/pipermail/physfs/attachments/20100514/ae013b97/attachment-0001.diff>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: branch-2.0.patch
URL: <http://icculus.org/pipermail/physfs/attachments/20100514/ae013b97/attachment-0002.diff>


More information about the physfs mailing list