Skip to content

Commit

Permalink
Small clarifications with no behaviour change
Browse files Browse the repository at this point in the history
All the right hand side is `dev_cap`, changed one outlier to match.

Also clarified the relationshipts between some magic numbers.

No change in behaviour here.
  • Loading branch information
seanm committed Feb 5, 2024
1 parent f430381 commit 7ae012b
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions libusb/descriptor.c
Original file line number Diff line number Diff line change
Expand Up @@ -1124,11 +1124,11 @@ int API_EXPORTED libusb_get_platform_descriptor(libusb_context *ctx,
_platform_descriptor->bReserved = dev_cap->dev_capability_data[0];
memcpy(_platform_descriptor->PlatformCapabilityUUID, &(dev_cap->dev_capability_data[1]), 16);

/* Capability data is located after reserved byte and 128-bit UUID */
/* Capability data is located after reserved byte and 16 byte UUID */
uint8_t* capability_data = dev_cap->dev_capability_data + 1 + 16;

/* Capability data length is total descriptor length minus initial fields */
size_t capability_data_length = _platform_descriptor->bLength - (16 + 4);
size_t capability_data_length = dev_cap->bLength - (3 + 1 + 16);

memcpy(_platform_descriptor->CapabilityData, capability_data, capability_data_length);

Expand Down

0 comments on commit 7ae012b

Please sign in to comment.