Skip to content

Commit

Permalink
hosted/bmp_libusb: Unwraped the BMP product/version string handling m…
Browse files Browse the repository at this point in the history
…ain branch
  • Loading branch information
dragonmux authored and esden committed Jul 31, 2023
1 parent 394c3e2 commit bff104c
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions src/platforms/hosted/bmp_libusb.c
Original file line number Diff line number Diff line change
Expand Up @@ -143,15 +143,16 @@ void bmp_read_product_version(libusb_device_descriptor_s *device_descriptor, lib
char *start_of_version = strrchr(*product, ' ');
if (start_of_version == NULL) {
*version = NULL;
} else {
while (start_of_version[0] == ' ' && start_of_version != *product)
--start_of_version;
start_of_version[1] = '\0';
start_of_version += 2;
while (start_of_version[0] == ' ')
++start_of_version;
*version = strdup(start_of_version);
return;
}

while (start_of_version[0] == ' ' && start_of_version != *product)
--start_of_version;
start_of_version[1] = '\0';
start_of_version += 2;
while (start_of_version[0] == ' ')
++start_of_version;
*version = strdup(start_of_version);
}

/*
Expand Down

0 comments on commit bff104c

Please sign in to comment.