Apparently there is some subtle difference here between returning
a pointer and using a double-pointer as an output parameter.
Tracing through the function shows the former *should* be working,
but for an unknown reason fails "assert(action == &action_dn)"...

This patch shouldn't change any functionality -- it just shuts up
`make distcheck`.

Signed-off-by: Jason Gerecke <killert...@gmail.com>
---
 src/wcmCommon.c    | 21 +++++++++++----------
 test/wacom-tests.c |  3 ++-
 2 files changed, 13 insertions(+), 11 deletions(-)

diff --git a/src/wcmCommon.c b/src/wcmCommon.c
index 144dd20..7464a0a 100644
--- a/src/wcmCommon.c
+++ b/src/wcmCommon.c
@@ -354,15 +354,16 @@ static int getScrollDelta(int current, int old, int wrap, 
int flags)
  * @param action_dn    Action to send on scroll down
  * @return             Action that should be performed
  */
-static unsigned int* getWheelButton(int delta, unsigned int *action_up,
-                                    unsigned int *action_dn)
+static void getWheelButton(int delta, unsigned int *action_up,
+                                    unsigned int *action_dn,
+                                    unsigned int** action)
 {
        if (delta > 0)
-               return action_up;
+               *action = action_up;
        else if (delta < 0)
-               return action_dn;
+               *action = action_dn;
        else
-               return NULL;
+               *action = NULL;
 }
 
 /**
@@ -401,7 +402,7 @@ static void sendWheelStripEvents(InputInfoPtr pInfo, const 
WacomDeviceState* ds,
        if (delta && IsPad(priv) && priv->oldProximity == ds->proximity)
        {
                DBG(10, priv, "Left touch strip scroll delta = %d\n", delta);
-               fakeKey = getWheelButton(delta, 
priv->strip_keys[STRIP_LEFT_UP], priv->strip_keys[STRIP_LEFT_DN]);
+               getWheelButton(delta, priv->strip_keys[STRIP_LEFT_UP], 
priv->strip_keys[STRIP_LEFT_DN], &fakeKey);
                sendWheelStripEvent(fakeKey, pInfo, first_val, num_vals, 
valuators);
        }
 
@@ -410,7 +411,7 @@ static void sendWheelStripEvents(InputInfoPtr pInfo, const 
WacomDeviceState* ds,
        if (delta && IsPad(priv) && priv->oldProximity == ds->proximity)
        {
                DBG(10, priv, "Right touch strip scroll delta = %d\n", delta);
-               fakeKey = getWheelButton(delta, 
priv->strip_keys[STRIP_RIGHT_UP], priv->strip_keys[STRIP_RIGHT_DN]);
+               getWheelButton(delta, priv->strip_keys[STRIP_RIGHT_UP], 
priv->strip_keys[STRIP_RIGHT_DN], &fakeKey);
                sendWheelStripEvent(fakeKey, pInfo, first_val, num_vals, 
valuators);
        }
 
@@ -419,7 +420,7 @@ static void sendWheelStripEvents(InputInfoPtr pInfo, const 
WacomDeviceState* ds,
        if (delta && (IsCursor(priv) || IsPad(priv)) && priv->oldProximity == 
ds->proximity)
        {
                DBG(10, priv, "Relative wheel scroll delta = %d\n", delta);
-               fakeKey = getWheelButton(delta, priv->wheel_keys[WHEEL_REL_UP], 
priv->wheel_keys[WHEEL_REL_DN]);
+               getWheelButton(delta, priv->wheel_keys[WHEEL_REL_UP], 
priv->wheel_keys[WHEEL_REL_DN], &fakeKey);
                sendWheelStripEvent(fakeKey, pInfo, first_val, num_vals, 
valuators);
        }
 
@@ -428,7 +429,7 @@ static void sendWheelStripEvents(InputInfoPtr pInfo, const 
WacomDeviceState* ds,
        if (delta && IsPad(priv) && priv->oldProximity == ds->proximity)
        {
                DBG(10, priv, "Left touch wheel scroll delta = %d\n", delta);
-               fakeKey = getWheelButton(delta, priv->wheel_keys[WHEEL_ABS_UP], 
priv->wheel_keys[WHEEL_ABS_DN]);
+               getWheelButton(delta, priv->wheel_keys[WHEEL_ABS_UP], 
priv->wheel_keys[WHEEL_ABS_DN], &fakeKey);
                sendWheelStripEvent(fakeKey, pInfo, first_val, num_vals, 
valuators);
        }
 
@@ -437,7 +438,7 @@ static void sendWheelStripEvents(InputInfoPtr pInfo, const 
WacomDeviceState* ds,
        if (delta && IsPad(priv) && priv->oldProximity == ds->proximity)
        {
                DBG(10, priv, "Right touch wheel scroll delta = %d\n", delta);
-               fakeKey = getWheelButton(delta, 
priv->wheel_keys[WHEEL2_ABS_UP], priv->wheel_keys[WHEEL2_ABS_DN]);
+               getWheelButton(delta, priv->wheel_keys[WHEEL2_ABS_UP], 
priv->wheel_keys[WHEEL2_ABS_DN], &fakeKey);
                sendWheelStripEvent(fakeKey, pInfo, first_val, num_vals, 
valuators);
        }
 }
diff --git a/test/wacom-tests.c b/test/wacom-tests.c
index 3f47b2d..652977d 100644
--- a/test/wacom-tests.c
+++ b/test/wacom-tests.c
@@ -89,7 +89,8 @@ test_get_wheel_button(void)
 
        for (delta = -32; delta <= 32; delta++)
        {
-               unsigned int *action = getWheelButton(delta, &action_up, 
&action_dn);
+               unsigned int *action;
+               getWheelButton(delta, &action_up, &action_dn, &action);
                if (delta < 0)
                {
                        assert(action == &action_dn);
-- 
1.7.12


------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Linuxwacom-devel mailing list
Linuxwacom-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linuxwacom-devel

Reply via email to