On 5/18/22 05:12, Zebediah Figura wrote:
@@ -760,9 +764,9 @@ UINT WINAPI GetRawInputDeviceInfoW(HANDLE handle, UINT command, void *data, UINT break;
case RIDI_PREPARSEDDATA:
if (!(preparsed = (struct hid_preparsed_data *)device->data)) len = 0;
else len = preparsed->caps_size + FIELD_OFFSET(struct hid_preparsed_data, value_caps[0]) +
preparsed->number_link_collection_nodes * sizeof(struct hid_collection_node);
if (!device->data) len = 0;
else len = device->data->caps_size + FIELD_OFFSET(struct hid_preparsed_data, value_caps[0]) +
device->data->number_link_collection_nodes * sizeof(struct hid_collection_node); if (device->data && len <= data_len && data) memcpy(data, device->data, len);
Imho the local variable is still making this easier to read, double indirections are ugly. It could then be used more consistently below.