Re: [AD] About findfirst (2)

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


> I'm ok to do the work minus the MacOS stuff.

The patch is now ready to be commited:
http://www.multimania.com/ebotcazou/dev/findfirst2.zip

I tested it under DOS (DJGPP), Windows (MinGW32) and Linux.

al_findfirst() and al_findnext() now set errno consistently across all
platforms and compilers: true error value if an error occured, ENOENT if no
matching entry is found (this was a little messy before under DOS).

for_each_file() was a little buggy: the docs say "If an error occurs an
error code will be stored in errno" while it ended by "errno =
*allegro_errno = 0" !

Moreover I think the function has got a flaw: it stops the enumeration as
soon as errno is set even if the error is minor, the problem being there are
tons of functions that can set errno behind your back. For example, under
Linux using KDE, the enumeration originally aborted (in the file selector)
on a DCOP lock file because stat() can't read its status (so I coded a
little hack in ufile.c). The function should instead stop the enumeration
only if al_findnext() or the callback function explicitly requested it, but
that would mean modifying the callback prototype hence breaking the API.

--
Eric Botcazou
ebotcazou@xxxxxxxxxx



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