Re: [AD] Update for gfx_mode_select/ex/filter behavior for A4.3.11+

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


On Wed, 2009-03-04 at 03:53 -0600, Edgar wrote:
> I wrote up a patch for gfx_mode_select, gfx_mode_select_ex and 
> gfx_mode_select_filter to remove the requirement of the second two 
> functions to 'be sure not to pass in uninitialized values'. The new 
> behaviour for all three functions would be to always check for matching 
> values in the driver, mode, and (color_depth) lists from the initial 
> values at the addresses provided by the pointers passed to the three 
> functions, and defaulting to the first entry in the list if not found.

Well, even if you check if the values make sense, you cannot use the
values of uninitialized variables in a correct program. Just say in the
docs that they should be set to 0 if you don't care about the initial
selection.

> The current behaviour only checks for suggested values in the 
> gfx_mode_select_[ex | filter] functions and also defaults to the first 
> entry. However, the variables what_dialog[GFX_DRIVERLIST].d1 and 
> what_dialog[GFX_MODELIST].d1 are not initialized when called from 
> gfx_mode_select, and so they default to the values currently held by the 
> gfx_mode_dialog DIALOG array.

Sounds reasonable to change this. In the case of gfx_mode_select, we
probably should document in api._tx that previous write-only parameters
are now read-write (but in a way which can't break anything). Not really
necessary at this point though I guess...

> The current behavior of all three functions also always copies the 
> values of the selections into the address parameters, even when the 
> dialog is cancelled, so I made it so that the values are only copied 
> over when the user okays the dialog.

Sounds right.

> So basically, I reworked the list index initialization code, made 
> gfx_mode_select adhere to the same policy as gfx_mode_select[ex | 
> filter], made the functions only store the data when OK'd, and reworked 
> the documentation for the three functions to match.

Nice.

> I've attached three files :
> gfx_mode_select_filter_modifications.c - The whole source for just the 
> three modified functions.
> allegro_tx_gmsf_modifications.txt         - The whole _tx documentation 
> source for just the 3 functions.
> 
> gmsf_mod.diff       - Diff file against the latest SVN for A4.3.11
> 
> I attached the .c and the .txt file so you could see the changes in 
> their entirety outside the context of a diff.
> 
> Let me know what you guys think about my proposed changes.
> 

Can you post a normal patch against svn? Basically, do something like:

svn diff > gfx_mode.patch

And attach that file. Much easier to read than those 3 files and their
descriptions.

-- 
Elias Pschernig <elias@xxxxxxxxxx>





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