Commit 1c4e7a00 authored by Rémi Bernon's avatar Rémi Bernon Committed by Alexandre Julliard

hid: Rewrite HidP_MaxDataListLength using enum_value_caps.

parent 28bbaf67
...@@ -679,24 +679,24 @@ NTSTATUS WINAPI HidP_GetUsagesEx( HIDP_REPORT_TYPE report_type, USHORT collectio ...@@ -679,24 +679,24 @@ NTSTATUS WINAPI HidP_GetUsagesEx( HIDP_REPORT_TYPE report_type, USHORT collectio
return status; return status;
} }
ULONG WINAPI HidP_MaxDataListLength(HIDP_REPORT_TYPE ReportType, PHIDP_PREPARSED_DATA PreparsedData) static NTSTATUS count_data( const struct hid_value_caps *caps, void *user )
{ {
WINE_HIDP_PREPARSED_DATA *data = (WINE_HIDP_PREPARSED_DATA *)PreparsedData; if (caps->is_range || HID_VALUE_CAPS_IS_BUTTON( caps )) *(ULONG *)user += caps->report_count;
TRACE("(%i, %p)\n", ReportType, PreparsedData); else *(ULONG *)user += 1;
if (data->magic != HID_MAGIC) return HIDP_STATUS_SUCCESS;
return 0; }
switch(ReportType) ULONG WINAPI HidP_MaxDataListLength( HIDP_REPORT_TYPE report_type, PHIDP_PREPARSED_DATA preparsed_data )
{ {
case HidP_Input: WINE_HIDP_PREPARSED_DATA *preparsed = (WINE_HIDP_PREPARSED_DATA *)preparsed_data;
return data->caps.NumberInputDataIndices; struct caps_filter filter = {};
case HidP_Output: USHORT limit = -1;
return data->caps.NumberOutputDataIndices; ULONG count = 0;
case HidP_Feature:
return data->caps.NumberFeatureDataIndices; TRACE( "report_type %d, preparsed_data %p.\n", report_type, preparsed_data );
default:
return 0; enum_value_caps( preparsed, report_type, 0, &filter, count_data, &count, &limit );
} return count;
} }
NTSTATUS WINAPI HidP_GetData(HIDP_REPORT_TYPE ReportType, HIDP_DATA *DataList, ULONG *DataLength, NTSTATUS WINAPI HidP_GetData(HIDP_REPORT_TYPE ReportType, HIDP_DATA *DataList, ULONG *DataLength,
......
...@@ -2229,7 +2229,6 @@ static void test_hidp(HANDLE file, int report_id) ...@@ -2229,7 +2229,6 @@ static void test_hidp(HANDLE file, int report_id)
value = HidP_MaxDataListLength(HidP_Feature + 1, preparsed_data); value = HidP_MaxDataListLength(HidP_Feature + 1, preparsed_data);
ok(value == 0, "HidP_MaxDataListLength(HidP_Feature + 1) returned %d, expected %d\n", value, 0); ok(value == 0, "HidP_MaxDataListLength(HidP_Feature + 1) returned %d, expected %d\n", value, 0);
value = HidP_MaxDataListLength(HidP_Input, preparsed_data); value = HidP_MaxDataListLength(HidP_Input, preparsed_data);
todo_wine
ok(value == 50, "HidP_MaxDataListLength(HidP_Input) returned %d, expected %d\n", value, 50); ok(value == 50, "HidP_MaxDataListLength(HidP_Input) returned %d, expected %d\n", value, 50);
value = HidP_MaxDataListLength(HidP_Output, preparsed_data); value = HidP_MaxDataListLength(HidP_Output, preparsed_data);
ok(value == 0, "HidP_MaxDataListLength(HidP_Output) returned %d, expected %d\n", value, 0); ok(value == 0, "HidP_MaxDataListLength(HidP_Output) returned %d, expected %d\n", value, 0);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment