Re: [AD] file_select_ex patch

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


On 2005-09-12, Chris <chris.kcat@xxxxxxxxxx> wrote:
> On Monday 12 September 2005 10:27 am, Grzegorz Adam Hankiewicz wrote:
> > Instead of playing fire with a buffer whose size Allegro doesn't
> > know, and could overflow
> 
> Actually, file_select_ex takes a size parameter for the buffer,
> so it won't overrun.

True. It's still terribly bad design though, you are trusting yet
another parameter from the user.

> > Can you provide a use case where preserving path's content is
> > necessary with a cancel return value?
> 
> What I tried doing in this case was create a d_box/edit/button_proc
> dialog combo [...] It just feels like this is something the
> function itself should've done, though.

Ah. In that case, maybe it would be safer to make the function
always operate over an internal buffer and copy the contents into
path only when you are sure the function is going to return TRUE.
Safe, as in it's easier to work on an internal buffer than patch
all possible return branches, should arise the need to have more
than one.




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