Skip to content

Commit

Permalink
Don't include the manufacturer if it's already included in the produc…
Browse files Browse the repository at this point in the history
…t string
  • Loading branch information
slouken committed Dec 10, 2019
1 parent bb37a1e commit 3469481
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/joystick/hidapi/SDL_hidapijoystick.c
Expand Up @@ -806,7 +806,11 @@ HIDAPI_AddDevice(struct hid_device_info *info)
size_t name_size = (SDL_strlen(manufacturer_string) + 1 + SDL_strlen(product_string) + 1);
device->name = (char *)SDL_malloc(name_size);
if (device->name) {
SDL_snprintf(device->name, name_size, "%s %s", manufacturer_string, product_string);
if (SDL_strncasecmp(manufacturer_string, product_string, SDL_strlen(manufacturer_string)) == 0) {
SDL_strlcpy(device->name, product_string, name_size);
} else {
SDL_snprintf(device->name, name_size, "%s %s", manufacturer_string, product_string);
}
}
}
if (manufacturer_string) {
Expand Down

0 comments on commit 3469481

Please sign in to comment.