SDL: SDL_QueryTexture() fills in a pointer to SDL_PixelFormatEnum

From a82ed82bc7679d8a9fefe93c4057c532d927dd11 Mon Sep 17 00:00:00 2001
From: Sam Lantinga <[EMAIL REDACTED]>
Date: Mon, 1 Apr 2024 15:35:46 -0700
Subject: [PATCH] SDL_QueryTexture() fills in a pointer to SDL_PixelFormatEnum

---
 include/SDL3/SDL_render.h     |  2 +-
 src/dynapi/SDL_dynapi_procs.h |  2 +-
 src/render/SDL_render.c       |  2 +-
 test/testautomation_render.c  | 10 +++++-----
 test/testffmpeg.c             |  8 ++++----
 5 files changed, 12 insertions(+), 12 deletions(-)

diff --git a/include/SDL3/SDL_render.h b/include/SDL3/SDL_render.h
index edd80a1c8e0c4..46cf94a6253f9 100644
--- a/include/SDL3/SDL_render.h
+++ b/include/SDL3/SDL_render.h
@@ -814,7 +814,7 @@ extern DECLSPEC SDL_Renderer *SDLCALL SDL_GetRendererFromTexture(SDL_Texture *te
  *
  * \since This function is available since SDL 3.0.0.
  */
-extern DECLSPEC int SDLCALL SDL_QueryTexture(SDL_Texture *texture, Uint32 *format, int *access, int *w, int *h);
+extern DECLSPEC int SDLCALL SDL_QueryTexture(SDL_Texture *texture, SDL_PixelFormatEnum *format, int *access, int *w, int *h);
 
 /**
  * Set an additional color value multiplied into render copy operations.
diff --git a/src/dynapi/SDL_dynapi_procs.h b/src/dynapi/SDL_dynapi_procs.h
index 40ebf9bb2228d..6d7e8825d2c89 100644
--- a/src/dynapi/SDL_dynapi_procs.h
+++ b/src/dynapi/SDL_dynapi_procs.h
@@ -654,7 +654,7 @@ SDL_DYNAPI_PROC(int,SDL_PremultiplyAlpha,(int a, int b, SDL_PixelFormatEnum c, c
 SDL_DYNAPI_PROC(void,SDL_PumpEvents,(void),(),)
 SDL_DYNAPI_PROC(int,SDL_PushEvent,(SDL_Event *a),(a),return)
 SDL_DYNAPI_PROC(int,SDL_PutAudioStreamData,(SDL_AudioStream *a, const void *b, int c),(a,b,c),return)
-SDL_DYNAPI_PROC(int,SDL_QueryTexture,(SDL_Texture *a, Uint32 *b, int *c, int *d, int *e),(a,b,c,d,e),return)
+SDL_DYNAPI_PROC(int,SDL_QueryTexture,(SDL_Texture *a, SDL_PixelFormatEnum *b, int *c, int *d, int *e),(a,b,c,d,e),return)
 SDL_DYNAPI_PROC(void,SDL_Quit,(void),(),)
 SDL_DYNAPI_PROC(void,SDL_QuitSubSystem,(Uint32 a),(a),)
 SDL_DYNAPI_PROC(int,SDL_RaiseWindow,(SDL_Window *a),(a),return)
diff --git a/src/render/SDL_render.c b/src/render/SDL_render.c
index 923d361d8da57..6c48639b459ac 100644
--- a/src/render/SDL_render.c
+++ b/src/render/SDL_render.c
@@ -1603,7 +1603,7 @@ SDL_PropertiesID SDL_GetTextureProperties(SDL_Texture *texture)
     return texture->props;
 }
 
-int SDL_QueryTexture(SDL_Texture *texture, Uint32 *format, int *access, int *w, int *h)
+int SDL_QueryTexture(SDL_Texture *texture, SDL_PixelFormatEnum *format, int *access, int *w, int *h)
 {
     CHECK_TEXTURE_MAGIC(texture, -1);
 
diff --git a/test/testautomation_render.c b/test/testautomation_render.c
index 82ac1e3b2892c..59e1aa1feae41 100644
--- a/test/testautomation_render.c
+++ b/test/testautomation_render.c
@@ -388,7 +388,7 @@ static int render_testBlit(void *arg)
     SDL_FRect rect;
     SDL_Texture *tface;
     SDL_Surface *referenceSurface = NULL;
-    Uint32 tformat;
+    SDL_PixelFormatEnum tformat;
     int taccess, tw, th;
     int i, j, ni, nj;
     int checkFailCount1;
@@ -456,7 +456,7 @@ static int render_testBlitColor(void *arg)
     SDL_FRect rect;
     SDL_Texture *tface;
     SDL_Surface *referenceSurface = NULL;
-    Uint32 tformat;
+    SDL_PixelFormatEnum tformat;
     int taccess, tw, th;
     int i, j, ni, nj;
     int checkFailCount1;
@@ -530,7 +530,7 @@ static int render_testBlitAlpha(void *arg)
     SDL_FRect rect;
     SDL_Texture *tface;
     SDL_Surface *referenceSurface = NULL;
-    Uint32 tformat;
+    SDL_PixelFormatEnum tformat;
     int taccess, tw, th;
     int i, j, ni, nj;
     int checkFailCount1;
@@ -604,7 +604,7 @@ static void
 testBlitBlendMode(SDL_Texture *tface, int mode)
 {
     int ret;
-    Uint32 tformat;
+    SDL_PixelFormatEnum tformat;
     int taccess, tw, th;
     int i, j, ni, nj;
     SDL_FRect rect;
@@ -659,7 +659,7 @@ static int render_testBlitBlend(void *arg)
     SDL_FRect rect;
     SDL_Texture *tface;
     SDL_Surface *referenceSurface = NULL;
-    Uint32 tformat;
+    SDL_PixelFormatEnum tformat;
     int taccess, tw, th;
     int i, j, ni, nj;
     int mode;
diff --git a/test/testffmpeg.c b/test/testffmpeg.c
index 069f8e52bd2b0..7988a1e933b00 100644
--- a/test/testffmpeg.c
+++ b/test/testffmpeg.c
@@ -285,7 +285,7 @@ static void MoveSprite(void)
     }
 }
 
-static Uint32 GetTextureFormat(enum AVPixelFormat format)
+static SDL_PixelFormatEnum GetTextureFormat(enum AVPixelFormat format)
 {
     switch (format) {
     case AV_PIX_FMT_RGB8:
@@ -509,7 +509,7 @@ static SDL_Colorspace GetFrameColorspace(AVFrame *frame)
     return colorspace;
 }
 
-static SDL_PropertiesID CreateVideoTextureProperties(AVFrame *frame, Uint32 format, int access)
+static SDL_PropertiesID CreateVideoTextureProperties(AVFrame *frame, SDL_PixelFormatEnum format, int access)
 {
     AVFrameSideData *pSideData;
     SDL_PropertiesID props;
@@ -569,8 +569,8 @@ static void SDLCALL FreeSwsContextContainer(void *userdata, void *value)
 static SDL_bool GetTextureForMemoryFrame(AVFrame *frame, SDL_Texture **texture)
 {
     int texture_width = 0, texture_height = 0;
-    Uint32 texture_format = SDL_PIXELFORMAT_UNKNOWN;
-    Uint32 frame_format = GetTextureFormat(frame->format);
+    SDL_PixelFormatEnum texture_format = SDL_PIXELFORMAT_UNKNOWN;
+    SDL_PixelFormatEnum frame_format = GetTextureFormat(frame->format);
 
     if (*texture) {
         SDL_QueryTexture(*texture, &texture_format, NULL, &texture_width, &texture_height);