SDL: Reverted SDL_Vulkan_GetInstanceExtensions() API change

From 9db68f97f9d66f84c3beee5cb4bdeab48080a3b1 Mon Sep 17 00:00:00 2001
From: Sam Lantinga <[EMAIL REDACTED]>
Date: Tue, 5 Mar 2024 13:39:42 -0800
Subject: [PATCH] Reverted SDL_Vulkan_GetInstanceExtensions() API change

This function is commonly used with Vulkan structures that use uint32_t, so we should keep the Uint32 signature.
---
 include/SDL3/SDL_vulkan.h             | 5 ++---
 src/dynapi/SDL_dynapi_procs.h         | 2 +-
 src/render/vulkan/SDL_render_vulkan.c | 2 +-
 src/video/SDL_video.c                 | 4 ++--
 test/testffmpeg_vulkan.c              | 2 +-
 test/testvulkan.c                     | 2 +-
 6 files changed, 8 insertions(+), 9 deletions(-)

diff --git a/include/SDL3/SDL_vulkan.h b/include/SDL3/SDL_vulkan.h
index 958baf84630bd..64544c8b699cd 100644
--- a/include/SDL3/SDL_vulkan.h
+++ b/include/SDL3/SDL_vulkan.h
@@ -149,15 +149,14 @@ extern DECLSPEC void SDLCALL SDL_Vulkan_UnloadLibrary(void);
  *
  * You should not free the returned array; it is owned by SDL.
  *
- * \param count A pointer to an int that will be filled with the number of
- *              extensions returned.
+ * \param count a pointer filled in with the number of extensions returned.
  * \returns An array of extension name strings on success, NULL on error.
  *
  * \since This function is available since SDL 3.0.0.
  *
  * \sa SDL_Vulkan_CreateSurface
  */
-extern DECLSPEC char const* const* SDLCALL SDL_Vulkan_GetInstanceExtensions(int *count);
+extern DECLSPEC char const* const* SDLCALL SDL_Vulkan_GetInstanceExtensions(Uint32 *count);
 
 /**
  * Create a Vulkan rendering surface for a window.
diff --git a/src/dynapi/SDL_dynapi_procs.h b/src/dynapi/SDL_dynapi_procs.h
index cae0a6394af0a..b19f615cb83f4 100644
--- a/src/dynapi/SDL_dynapi_procs.h
+++ b/src/dynapi/SDL_dynapi_procs.h
@@ -688,7 +688,7 @@ SDL_DYNAPI_PROC(int,SDL_UpdateWindowSurface,(SDL_Window *a),(a),return)
 SDL_DYNAPI_PROC(int,SDL_UpdateWindowSurfaceRects,(SDL_Window *a, const SDL_Rect *b, int c),(a,b,c),return)
 SDL_DYNAPI_PROC(int,SDL_UpdateYUVTexture,(SDL_Texture *a, const SDL_Rect *b, const Uint8 *c, int d, const Uint8 *e, int f, const Uint8 *g, int h),(a,b,c,d,e,f,g,h),return)
 SDL_DYNAPI_PROC(SDL_bool,SDL_Vulkan_CreateSurface,(SDL_Window *a, VkInstance b, const struct VkAllocationCallbacks *c, VkSurfaceKHR *d),(a,b,c,d),return)
-SDL_DYNAPI_PROC(char const* const*,SDL_Vulkan_GetInstanceExtensions,(int *a),(a),return)
+SDL_DYNAPI_PROC(char const* const*,SDL_Vulkan_GetInstanceExtensions,(Uint32 *a),(a),return)
 SDL_DYNAPI_PROC(SDL_FunctionPointer,SDL_Vulkan_GetVkGetInstanceProcAddr,(void),(),return)
 SDL_DYNAPI_PROC(int,SDL_Vulkan_LoadLibrary,(const char *a),(a),return)
 SDL_DYNAPI_PROC(void,SDL_Vulkan_UnloadLibrary,(void),(),)
diff --git a/src/render/vulkan/SDL_render_vulkan.c b/src/render/vulkan/SDL_render_vulkan.c
index 71545a7b21b93..08b5c7dc6f068 100644
--- a/src/render/vulkan/SDL_render_vulkan.c
+++ b/src/render/vulkan/SDL_render_vulkan.c
@@ -1708,7 +1708,7 @@ static VkResult VULKAN_CreateDeviceResources(SDL_Renderer *renderer, SDL_Propert
         appInfo.apiVersion = VK_API_VERSION_1_0;
         instanceCreateInfo.sType = VK_STRUCTURE_TYPE_INSTANCE_CREATE_INFO;
         instanceCreateInfo.pApplicationInfo = &appInfo;
-        char const *const *instanceExtensions = SDL_Vulkan_GetInstanceExtensions((int *)&instanceCreateInfo.enabledExtensionCount);
+        char const *const *instanceExtensions = SDL_Vulkan_GetInstanceExtensions(&instanceCreateInfo.enabledExtensionCount);
 
         const char **instanceExtensionsCopy = SDL_calloc(instanceCreateInfo.enabledExtensionCount + 2, sizeof(const char *));
         for (uint32_t i = 0; i < instanceCreateInfo.enabledExtensionCount; i++) {
diff --git a/src/video/SDL_video.c b/src/video/SDL_video.c
index 2dc709448b1f7..4ac4c5766d9f3 100644
--- a/src/video/SDL_video.c
+++ b/src/video/SDL_video.c
@@ -5217,9 +5217,9 @@ void SDL_Vulkan_UnloadLibrary(void)
     }
 }
 
-char const* const* SDL_Vulkan_GetInstanceExtensions(int *count)
+char const* const* SDL_Vulkan_GetInstanceExtensions(Uint32 *count)
 {
-    return _this->Vulkan_GetInstanceExtensions(_this, (Uint32 *)count);
+    return _this->Vulkan_GetInstanceExtensions(_this, count);
 }
 
 SDL_bool SDL_Vulkan_CreateSurface(SDL_Window *window,
diff --git a/test/testffmpeg_vulkan.c b/test/testffmpeg_vulkan.c
index 3bf92ce3860cf..397b77919cfbb 100644
--- a/test/testffmpeg_vulkan.c
+++ b/test/testffmpeg_vulkan.c
@@ -206,7 +206,7 @@ static int createInstance(VulkanVideoContext *context)
     VkApplicationInfo appInfo = { 0 };
     VkInstanceCreateInfo instanceCreateInfo = { 0 };
     VkResult result;
-    char const *const *instanceExtensions = SDL_Vulkan_GetInstanceExtensions((int *)&instanceCreateInfo.enabledExtensionCount);
+    char const *const *instanceExtensions = SDL_Vulkan_GetInstanceExtensions(&instanceCreateInfo.enabledExtensionCount);
 
     appInfo.sType = VK_STRUCTURE_TYPE_APPLICATION_INFO;
     appInfo.apiVersion = VK_API_VERSION_1_3;
diff --git a/test/testvulkan.c b/test/testvulkan.c
index 732a23fd0cbe5..dcd0ebb1b1886 100644
--- a/test/testvulkan.c
+++ b/test/testvulkan.c
@@ -229,7 +229,7 @@ static void createInstance(void)
     instanceCreateInfo.sType = VK_STRUCTURE_TYPE_INSTANCE_CREATE_INFO;
     instanceCreateInfo.pApplicationInfo = &appInfo;
 
-    instanceCreateInfo.ppEnabledExtensionNames = SDL_Vulkan_GetInstanceExtensions((int *)&instanceCreateInfo.enabledExtensionCount);
+    instanceCreateInfo.ppEnabledExtensionNames = SDL_Vulkan_GetInstanceExtensions(&instanceCreateInfo.enabledExtensionCount);
     result = vkCreateInstance(&instanceCreateInfo, NULL, &vulkanContext->instance);
     if (result != VK_SUCCESS) {
         vulkanContext->instance = VK_NULL_HANDLE;