mirror of
https://github.com/Relintai/sdl2_frt.git
synced 2024-12-20 22:16:49 +01:00
Don't include the manufacturer if it's already included in the product string
This commit is contained in:
parent
bb37a1ebf5
commit
3469481ef6
@ -806,9 +806,13 @@ HIDAPI_AddDevice(struct hid_device_info *info)
|
|||||||
size_t name_size = (SDL_strlen(manufacturer_string) + 1 + SDL_strlen(product_string) + 1);
|
size_t name_size = (SDL_strlen(manufacturer_string) + 1 + SDL_strlen(product_string) + 1);
|
||||||
device->name = (char *)SDL_malloc(name_size);
|
device->name = (char *)SDL_malloc(name_size);
|
||||||
if (device->name) {
|
if (device->name) {
|
||||||
|
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);
|
SDL_snprintf(device->name, name_size, "%s %s", manufacturer_string, product_string);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
if (manufacturer_string) {
|
if (manufacturer_string) {
|
||||||
SDL_free(manufacturer_string);
|
SDL_free(manufacturer_string);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user