[AD] problem with packfile routines

[ Thread Index | Date Index | More lists.liballeg.org/allegro-developers Archives ]


pack_feof has an annoying behavior of returning true *before* one
attempts to read past the end of the stream, when using allegro's
file system. normally true should be returned only after such a read
is done.
the attached program shows this behavior; changing PACKMODE will show
pack_feof changing behavior, behaving not like libc calls when using
the packfile format, and behaving like libc calls when acting like a
wrapper for open/read/write/close.
in my case, after i read some data, i return an error if pack_feof
returns true, and this breaks my code :)
while this is easily fixable on my side, this is nonetheless something
that ought to be fixed IMHO, to behave consistently with libc (and with
itself, which is even more important).
i had a peek at the code, but i'm not sure where the error lies, and
it could well be spread in a number of places. the suscpicious checks
(in src/file.c) are <= 0 compares against f->todo and f->buf_size.
this code is a bit convoluted, so i'm not sure at all what to change.
i'd be happy if a file.c guru would have a look at it.

cheers

-- 
Lyrian 

Attachment: filetest.cc
Description: Binary data



Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/