Vulkan: Allow SDL_Vulkan_GetInstanceExtensions to be called with a larger array than necessary.
authorJohn Bartholomew <jpa.bartholomew@gmail.com>
Sun, 14 Jan 2018 13:34:50 +0000
changeset 11827922c27f2fa56
parent 11826 13d922b387db
child 11828 da1ca77eb713
Vulkan: Allow SDL_Vulkan_GetInstanceExtensions to be called with a larger array than necessary.
src/video/SDL_vulkan_utils.c
     1.1 --- a/src/video/SDL_vulkan_utils.c	Sat Jan 13 01:58:11 2018 +0100
     1.2 +++ b/src/video/SDL_vulkan_utils.c	Sun Jan 14 13:34:50 2018 +0000
     1.3 @@ -156,10 +156,10 @@
     1.4      {
     1.5  		unsigned int i;
     1.6  
     1.7 -        if(*userCount != nameCount)
     1.8 +        if(*userCount < nameCount)
     1.9          {
    1.10              SDL_SetError(
    1.11 -                "Count doesn't match count from previous call of SDL_Vulkan_GetInstanceExtensions");
    1.12 +                "Ouput array for SDL_Vulkan_GetInstanceExtensions is too small");
    1.13              return SDL_FALSE;
    1.14          }
    1.15          for(i = 0; i < nameCount; i++)
    1.16 @@ -167,10 +167,7 @@
    1.17              userNames[i] = names[i];
    1.18          }
    1.19      }
    1.20 -    else
    1.21 -    {
    1.22 -        *userCount = nameCount;
    1.23 -    }
    1.24 +    *userCount = nameCount;
    1.25      return SDL_TRUE;
    1.26  }
    1.27