[physfs] Seeking to end of file

Christoph Nelles evilazrael at evilazrael.de
Wed Apr 28 17:56:52 EDT 2010


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);
>
>   



More information about the physfs mailing list