On Wed, Feb 08, 2006 at 05:22:29PM +0300, George Nephrite Potapov wrote:
> On Wed, Feb 08, 2006 at 05:11:48PM +0300, George Nephrite Potapov wrote:
> 
> I'm very sorry but there was a small error in my previous message with patch.
> Here is the correct one. I'm very very sorry.

Thats a nice patch with an important feature.

I have some minor change requests though:

1) Please supply ChangeLog and NEWS entries for the patch (and
   optionally an AUTHORS entry).

2)

> +static int buttons[] = 
> +{
> +    0, Button1, Button2, Button3, Button4, Button5, NULL
                                                       ^^^^
> +};

I think there shouldn't be a NULL "pointer" at the end of an int
array.

Please do not hard-code the number of mouse buttons.  The macro
NUMBER_OF_MOUSE_BUTTONS in libs/defaults.h defines how many
buttons are handled by fvwm.

> +        rest = GetQuotedString(
> +            rest, &buttonn, "", NULL, NULL, NULL);
> +        if (buttonn) {
> +            mousebutton = atoi(buttonn);
> +
> +            free(buttonn);
> +        }

> +        if (!mousebutton) {
> +            mousebutton = 1;
> +        }
> +        
> +        CurrentButton = b;
> +        act = GetButtonAction(b, buttons[mousebutton]);
                                    ^^^^^^^^^^^^^^^^^^^^

This reads past the end or beginning of the array if the user
requests a button < 0 or > 5.  And because Button1 == 1, ...,
Button5 == 5 you can as well just write

  if (mousebutton <= 0 ||
      mousebutton > NUMBER_OF_EXTENDED_MOUSE_BUTTONS)
  {
    mousebutton = 1;
  }
  /*...*/
  act = GetButtonAction(b, mousebutton);
  
and remove the buttons[] array.

Ciao

Dominik ^_^  ^_^

 --
Dominik Vogt, [EMAIL PROTECTED]

Attachment: signature.asc
Description: Digital signature

Reply via email to