Aric Stewart : hid: Refine initialization of UsageLength in HidP_GetUsages.

Alexandre Julliard julliard at winehq.org
Thu Dec 8 17:15:47 CST 2016


Module: wine
Branch: master
Commit: e724d67fb4406563538f36f3fb512fba2fd679b3
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=e724d67fb4406563538f36f3fb512fba2fd679b3

Author: Aric Stewart <aric at codeweavers.com>
Date:   Thu Dec  8 08:34:02 2016 -0600

hid: Refine initialization of UsageLength in HidP_GetUsages.

Signed-off-by: Aric Stewart <aric at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/hid/hidp.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/dlls/hid/hidp.c b/dlls/hid/hidp.c
index 56616b4..9dcdeb6 100644
--- a/dlls/hid/hidp.c
+++ b/dlls/hid/hidp.c
@@ -278,10 +278,11 @@ NTSTATUS WINAPI HidP_GetUsages(HIDP_REPORT_TYPE ReportType, USAGE UsagePage, USH
     TRACE("(%i, %x, %i, %p, %p, %p, %p, %i)\n", ReportType, UsagePage, LinkCollection, UsageList,
           UsageLength, PreparsedData, Report, ReportLength);
 
-    *UsageLength = 0;
-
     if (data->magic != HID_MAGIC)
+    {
+        *UsageLength = 0;
         return HIDP_STATUS_INVALID_PREPARSED_DATA;
+    }
 
     switch(ReportType)
     {
@@ -344,11 +345,11 @@ NTSTATUS WINAPI HidP_GetUsages(HIDP_REPORT_TYPE ReportType, USAGE UsagePage, USH
         }
     }
 
+    *UsageLength = uCount;
+
     if (!found)
         return HIDP_STATUS_USAGE_NOT_FOUND;
 
-    *UsageLength = uCount;
-
     return HIDP_STATUS_SUCCESS;
 }
 




More information about the wine-cvs mailing list