From e029fdbb383d9a4436ef5ee55b8da71a1b88e467 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Wed, 11 Dec 2019 17:46:59 -0800 Subject: [PATCH] Shorten "Performance Designed Products" to "PDP" --- src/joystick/hidapi/SDL_hidapijoystick.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/joystick/hidapi/SDL_hidapijoystick.c b/src/joystick/hidapi/SDL_hidapijoystick.c index 39542bb328cca..3b5685166d881 100644 --- a/src/joystick/hidapi/SDL_hidapijoystick.c +++ b/src/joystick/hidapi/SDL_hidapijoystick.c @@ -616,7 +616,14 @@ HIDAPI_AddDevice(struct hid_device_info *info) } } if (manufacturer_string && product_string) { - size_t name_size = (SDL_strlen(manufacturer_string) + 1 + SDL_strlen(product_string) + 1); + size_t name_size; + + if (SDL_strcmp(manufacturer_string, "Performance Designed Products") == 0) { + /* Shorten this so controller names are more manageable */ + SDL_memcpy(manufacturer_string, "PDP", 4); + } + + name_size = (SDL_strlen(manufacturer_string) + 1 + SDL_strlen(product_string) + 1); device->name = (char *)SDL_malloc(name_size); if (device->name) { if (SDL_strncasecmp(manufacturer_string, product_string, SDL_strlen(manufacturer_string)) == 0) {