On Sun, Apr 10, 2011 at 9:16 PM, Peter Hutterer <[email protected]> wrote: > Buttons higher than sizeof(int) weren't getting sent. The mod_buttons macro > needs to test for the number of bits, not bytes. > > Introduced in 880512f84c26cddbfc1a8ff495890595424466f2 > > Reported-by: Andrzej Giniewicz <[email protected]> > Signed-off-by: Peter Hutterer <[email protected]> > --- > Just to show that having a test doesn't guarantee bug-free code. If the test > replicates the same error, it's still pointless. :)
lol. Ignore the version I just sent since your version has more bytes. Reviewed-by: Chris Bagwell <[email protected]> > > src/wcmUSB.c | 2 +- > test/wacom-tests.c | 4 ++-- > 2 files changed, 3 insertions(+), 3 deletions(-) > > diff --git a/src/wcmUSB.c b/src/wcmUSB.c > index 9ff59ea..1219530 100644 > --- a/src/wcmUSB.c > +++ b/src/wcmUSB.c > @@ -1054,7 +1054,7 @@ static int mod_buttons(int buttons, int btn, int state) > { > int mask; > > - if (btn >= sizeof(int)) > + if (btn >= sizeof(int) * 8) > { > xf86Msg(X_ERROR, "%s: Invalid button number %d. Insufficient " > "storage\n", __func__, btn); > diff --git a/test/wacom-tests.c b/test/wacom-tests.c > index 8e2d352..a22243e 100644 > --- a/test/wacom-tests.c > +++ b/test/wacom-tests.c > @@ -432,7 +432,7 @@ static void > test_mod_buttons(void) > { > int i; > - for (i = 0; i < sizeof(int); i++) > + for (i = 0; i < sizeof(int) * 8; i++) > { > int buttons = mod_buttons(0, i, 1); > assert(buttons == (1 << i)); > @@ -440,7 +440,7 @@ test_mod_buttons(void) > assert(buttons == 0); > } > > - assert(mod_buttons(0, sizeof(int), 1) == 0); > + assert(mod_buttons(0, sizeof(int) * 8, 1) == 0); > } > > static void test_set_type(void) > -- > 1.7.4.2 > > > ------------------------------------------------------------------------------ > Xperia(TM) PLAY > It's a major breakthrough. An authentic gaming > smartphone on the nation's most reliable network. > And it wants your games. > http://p.sf.net/sfu/verizon-sfdev > _______________________________________________ > Linuxwacom-devel mailing list > [email protected] > https://lists.sourceforge.net/lists/listinfo/linuxwacom-devel > ------------------------------------------------------------------------------ Xperia(TM) PLAY It's a major breakthrough. An authentic gaming smartphone on the nation's most reliable network. And it wants your games. http://p.sf.net/sfu/verizon-sfdev _______________________________________________ Linuxwacom-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/linuxwacom-devel
