Shorten "Performance Designed Products" to "PDP"
authorSam Lantinga <slouken@libsdl.org>
Wed, 11 Dec 2019 17:46:59 -0800
changeset 1333271116618f317
parent 13331 a523954cd529
child 13333 88aec26a0ad0
Shorten "Performance Designed Products" to "PDP"
src/joystick/hidapi/SDL_hidapijoystick.c
     1.1 --- a/src/joystick/hidapi/SDL_hidapijoystick.c	Wed Dec 11 17:46:57 2019 -0800
     1.2 +++ b/src/joystick/hidapi/SDL_hidapijoystick.c	Wed Dec 11 17:46:59 2019 -0800
     1.3 @@ -616,7 +616,14 @@
     1.4              }
     1.5          }
     1.6          if (manufacturer_string && product_string) {
     1.7 -            size_t name_size = (SDL_strlen(manufacturer_string) + 1 + SDL_strlen(product_string) + 1);
     1.8 +            size_t name_size;
     1.9 +
    1.10 +            if (SDL_strcmp(manufacturer_string, "Performance Designed Products") == 0) {
    1.11 +                /* Shorten this so controller names are more manageable */
    1.12 +                SDL_memcpy(manufacturer_string, "PDP", 4);
    1.13 +            }
    1.14 +
    1.15 +            name_size = (SDL_strlen(manufacturer_string) + 1 + SDL_strlen(product_string) + 1);
    1.16              device->name = (char *)SDL_malloc(name_size);
    1.17              if (device->name) {
    1.18                  if (SDL_strncasecmp(manufacturer_string, product_string, SDL_strlen(manufacturer_string)) == 0) {