[physfs] Seeking to end of file

Tim Čas darkuranium at gmail.com
Wed Apr 28 12:58:00 EDT 2010


That said, I agree that seeking to 0 from end should, well, seek to end.

On 28 April 2010 18:57, Tim Čas <darkuranium at gmail.com> wrote:

> What about the PHYSFS_fileLength function?
>
>
> On 28 April 2010 18:33, Patrice Mandin <mandin.patrice at orange.fr> wrote:
>
>> 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);
>>
>> --
>> Patrice Mandin
>> WWW: http://pmandin.atari.org/
>> Programmeur Linux, Atari
>> Spécialité: Développement, jeux
>>
>>
>> _______________________________________________
>> 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/20100428/380614cc/attachment.htm>


More information about the physfs mailing list