[prev in list] [next in list] [prev in thread] [next in thread] 

List:       freedesktop-xorg-devel
Subject:    [PATCH libXi 2/3] Change size += to size = in XGetDeviceControl
From:       Peter Hutterer <peter.hutterer () who-t ! net>
Date:       2013-05-28 5:52:33
Message-ID: 1369720354-30706-2-git-send-email-peter.hutterer () who-t ! net
[Download RAW message or body]

size += blah is technically correct but it implies that we're looping or
otherwise incrementing the size. Which we don't, it's only ever set once.

Change this to avoid reviewer confusion.

Reported-by: Dave "color-me-confused" Airlie <airlied@redhat.com>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
---
 src/XGetDCtl.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/src/XGetDCtl.c b/src/XGetDCtl.c
index 51ed0ae..b576aa5 100644
--- a/src/XGetDCtl.c
+++ b/src/XGetDCtl.c
@@ -122,34 +122,34 @@ XGetDeviceControl(
 	    val_size = 3 * sizeof(int) * r->num_valuators;
 	    if ((sizeof(xDeviceResolutionState) + val_size) > nbytes)
 		goto out;
-	    size += sizeof(XDeviceResolutionState) + val_size;
+	    size = sizeof(XDeviceResolutionState) + val_size;
 	    break;
 	}
         case DEVICE_ABS_CALIB:
         {
             if (sizeof(xDeviceAbsCalibState) > nbytes)
                 goto out;
-            size += sizeof(XDeviceAbsCalibState);
+            size = sizeof(XDeviceAbsCalibState);
             break;
         }
         case DEVICE_ABS_AREA:
         {
             if (sizeof(xDeviceAbsAreaState) > nbytes)
                 goto out;
-            size += sizeof(XDeviceAbsAreaState);
+            size = sizeof(XDeviceAbsAreaState);
             break;
         }
         case DEVICE_CORE:
         {
             if (sizeof(xDeviceCoreState) > nbytes)
                 goto out;
-            size += sizeof(XDeviceCoreState);
+            size = sizeof(XDeviceCoreState);
             break;
         }
 	default:
 	    if (d->length > nbytes)
 		goto out;
-	    size += d->length;
+	    size = d->length;
 	    break;
 	}
 
-- 
1.8.1.4

_______________________________________________
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: http://lists.x.org/mailman/listinfo/xorg-devel
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic