Re: [AD] file_select_ex patch

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


On 2005-09-11, Chris <chris.kcat@xxxxxxxxxx> wrote:
> This patch fixes file_select_ex so that passing an empty string for
> the extension doesn't append a '.' to the end of the selected file,
> and so that clicking Cancel restores the original path string.

The extension change sound nice. As for the path thingy, doesn't this
function just smell as a potential problem? Instead of playing fire
with a buffer whose size Allegro doesn't know, and could overflow,
it should return a pointer to a newly allocated string with success,
just like strdup. Yuk.

Other than that, I think it's ok to mess with path. After all, if
the function returns zero, user code is not going to use the path
parameter any more because the user doesn't want to load whatever
garbage Allegro might have spilled over that variable (even if it
is a valid filename). Can you provide a use case where preserving
path's content is necessary with a cancel return value?




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