SDL_image: Updated for the SDL3 RW -> IO changes

From 6fb75c1ea764e6838d88bfcf3693ac68a7c2dac0 Mon Sep 17 00:00:00 2001
From: Sam Lantinga <[EMAIL REDACTED]>
Date: Mon, 18 Mar 2024 11:49:12 -0700
Subject: [PATCH] Updated for the SDL3 RW -> IO changes

Fixes https://github.com/libsdl-org/SDL_image/issues/436
---
 CHANGES.txt                    |    2 +-
 README.txt                     |    6 +-
 external/SDL                   |    2 +-
 include/SDL3_image/SDL_image.h | 1191 ++++++++++++++++----------------
 src/IMG.c                      |  122 ++--
 src/IMG_ImageIO.m              |   98 +--
 src/IMG_WIC.c                  |   44 +-
 src/IMG_avif.c                 |   50 +-
 src/IMG_bmp.c                  |   74 +-
 src/IMG_gif.c                  |   56 +-
 src/IMG_jpg.c                  |  106 +--
 src/IMG_jxl.c                  |   24 +-
 src/IMG_lbm.c                  |   46 +-
 src/IMG_pcx.c                  |   34 +-
 src/IMG_png.c                  |   72 +-
 src/IMG_pnm.c                  |   34 +-
 src/IMG_qoi.c                  |   16 +-
 src/IMG_stb.c                  |   34 +-
 src/IMG_svg.c                  |   20 +-
 src/IMG_tga.c                  |   26 +-
 src/IMG_tif.c                  |   38 +-
 src/IMG_webp.c                 |   38 +-
 src/IMG_xcf.c                  |   80 +--
 src/IMG_xpm.c                  |   34 +-
 src/IMG_xv.c                   |   26 +-
 src/IMG_xxx.c                  |   18 +-
 src/SDL_image.sym              |   62 +-
 test/main.c                    |   96 +--
 28 files changed, 1225 insertions(+), 1224 deletions(-)

diff --git a/CHANGES.txt b/CHANGES.txt
index c485d4ce..5084189b 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -1,4 +1,4 @@
 3.0.0:
  * Added support for loading HDR AVIF images
  * Added AVIF save support:
-    IMG_SaveAVIF() and IMG_SaveAVIF_RW()
+    IMG_SaveAVIF() and IMG_SaveAVIF_IO()
diff --git a/README.txt b/README.txt
index 4a5ebc6a..9fe97809 100644
--- a/README.txt
+++ b/README.txt
@@ -12,12 +12,12 @@ API:
 
 	SDL_Surface *IMG_Load(const char *file);
 or
-	SDL_Surface *IMG_Load_RW(SDL_RWops *src, SDL_bool freesrc);
+	SDL_Surface *IMG_Load_IO(SDL_IOStream *src, SDL_bool closeio);
 or
-	SDL_Surface *IMG_LoadTyped_RW(SDL_RWops *src, SDL_bool freesrc, char *type);
+	SDL_Surface *IMG_LoadTyped_IO(SDL_IOStream *src, SDL_bool closeio, char *type);
 
 where type is a string specifying the format (i.e. "PNG" or "pcx").
-Note that IMG_Load_RW cannot load TGA images.
+Note that IMG_Load_IO cannot load TGA images.
 
 To create a surface from an XPM image included in C source, use:
 
diff --git a/external/SDL b/external/SDL
index 2132ba89..086a7a46 160000
--- a/external/SDL
+++ b/external/SDL
@@ -1 +1 @@
-Subproject commit 2132ba8985c55f9893d4b10db01fb600743bed32
+Subproject commit 086a7a468738c915f48dab940482cfe0dec1b57a
diff --git a/include/SDL3_image/SDL_image.h b/include/SDL3_image/SDL_image.h
index de27db4f..6ceaed69 100644
--- a/include/SDL3_image/SDL_image.h
+++ b/include/SDL3_image/SDL_image.h
@@ -210,9 +210,9 @@ extern DECLSPEC void SDLCALL IMG_Quit(void);
  * by calling: SDL_SetSurfaceColorKey(image, SDL_RLEACCEL,
  * image->format->colorkey);
  *
- * If `freesrc` is SDL_TRUE, the RWops will be closed before returning,
+ * If `closeio` is SDL_TRUE, `src` will be closed before returning,
  * whether this function succeeds or not. SDL_image reads everything it needs
- * from the RWops during this call in any case.
+ * from `src` during this call in any case.
  *
  * Even though this function accepts a file type, SDL_image may still try
  * other decoders that are capable of detecting file type from the contents of
@@ -221,23 +221,23 @@ extern DECLSPEC void SDLCALL IMG_Quit(void);
  * its ability to guess the format.
  *
  * There is a separate function to read files from disk without having to deal
- * with SDL_RWops: `IMG_Load("filename.jpg")` will call this function and
+ * with SDL_IOStream: `IMG_Load("filename.jpg")` will call this function and
  * manage those details for you, determining the file type from the filename's
  * extension.
  *
- * There is also IMG_Load_RW(), which is equivalent to this function except
+ * There is also IMG_Load_IO(), which is equivalent to this function except
  * that it will rely on SDL_image to determine what type of data it is
  * loading, much like passing a NULL for type.
  *
  * If you are using SDL's 2D rendering API, there is an equivalent call to
  * load images directly into an SDL_Texture for use by the GPU without using a
- * software surface: call IMG_LoadTextureTyped_RW() instead.
+ * software surface: call IMG_LoadTextureTyped_IO() instead.
  *
  * When done with the returned surface, the app should dispose of it with a
  * call to SDL_DestroySurface().
  *
- * \param src an SDL_RWops that data will be read from.
- * \param freesrc SDL_TRUE to close/free the SDL_RWops before returning,
+ * \param src an SDL_IOStream that data will be read from.
+ * \param closeio SDL_TRUE to close/free the SDL_IOStream before returning,
  *                SDL_FALSE to leave it open.
  * \param type a filename extension that represent this data ("BMP", "GIF",
  *             "PNG", etc).
@@ -246,10 +246,10 @@ extern DECLSPEC void SDLCALL IMG_Quit(void);
  * \since This function is available since SDL_image 3.0.0.
  *
  * \sa IMG_Load
- * \sa IMG_Load_RW
+ * \sa IMG_Load_IO
  * \sa SDL_DestroySurface
  */
-extern DECLSPEC SDL_Surface * SDLCALL IMG_LoadTyped_RW(SDL_RWops *src, SDL_bool freesrc, const char *type);
+extern DECLSPEC SDL_Surface * SDLCALL IMG_LoadTyped_IO(SDL_IOStream *src, SDL_bool closeio, const char *type);
 
 /**
  * Load an image from a filesystem path into a software surface.
@@ -272,9 +272,9 @@ extern DECLSPEC SDL_Surface * SDLCALL IMG_LoadTyped_RW(SDL_RWops *src, SDL_bool
  * by calling: SDL_SetSurfaceColorKey(image, SDL_RLEACCEL,
  * image->format->colorkey);
  *
- * There is a separate function to read files from an SDL_RWops, if you need
+ * There is a separate function to read files from an SDL_IOStream, if you need
  * an i/o abstraction to provide data from anywhere instead of a simple
- * filesystem read; that function is IMG_Load_RW().
+ * filesystem read; that function is IMG_Load_IO().
  *
  * If you are using SDL's 2D rendering API, there is an equivalent call to
  * load images directly into an SDL_Texture for use by the GPU without using a
@@ -288,8 +288,8 @@ extern DECLSPEC SDL_Surface * SDLCALL IMG_LoadTyped_RW(SDL_RWops *src, SDL_bool
  *
  * \since This function is available since SDL_image 3.0.0.
  *
- * \sa IMG_LoadTyped_RW
- * \sa IMG_Load_RW
+ * \sa IMG_LoadTyped_IO
+ * \sa IMG_Load_IO
  * \sa SDL_DestroySurface
  */
 extern DECLSPEC SDL_Surface * SDLCALL IMG_Load(const char *file);
@@ -315,38 +315,38 @@ extern DECLSPEC SDL_Surface * SDLCALL IMG_Load(const char *file);
  * by calling: SDL_SetSurfaceColorKey(image, SDL_RLEACCEL,
  * image->format->colorkey);
  *
- * If `freesrc` is SDL_TRUE, the RWops will be closed before returning,
+ * If `closeio` is SDL_TRUE, `src` will be closed before returning,
  * whether this function succeeds or not. SDL_image reads everything it needs
- * from the RWops during this call in any case.
+ * from `src` during this call in any case.
  *
  * There is a separate function to read files from disk without having to deal
- * with SDL_RWops: `IMG_Load("filename.jpg")` will call this function and
+ * with SDL_IOStream: `IMG_Load("filename.jpg")` will call this function and
  * manage those details for you, determining the file type from the filename's
  * extension.
  *
- * There is also IMG_LoadTyped_RW(), which is equivalent to this function
+ * There is also IMG_LoadTyped_IO(), which is equivalent to this function
  * except a file extension (like "BMP", "JPG", etc) can be specified, in case
  * SDL_image cannot autodetect the file format.
  *
  * If you are using SDL's 2D rendering API, there is an equivalent call to
  * load images directly into an SDL_Texture for use by the GPU without using a
- * software surface: call IMG_LoadTexture_RW() instead.
+ * software surface: call IMG_LoadTexture_IO() instead.
  *
  * When done with the returned surface, the app should dispose of it with a
  * call to SDL_DestroySurface().
  *
- * \param src an SDL_RWops that data will be read from.
- * \param freesrc SDL_TRUE to close/free the SDL_RWops before returning,
+ * \param src an SDL_IOStream that data will be read from.
+ * \param closeio SDL_TRUE to close/free the SDL_IOStream before returning,
  *                SDL_FALSE to leave it open.
  * \returns a new SDL surface, or NULL on error.
  *
  * \since This function is available since SDL_image 3.0.0.
  *
  * \sa IMG_Load
- * \sa IMG_LoadTyped_RW
+ * \sa IMG_LoadTyped_IO
  * \sa SDL_DestroySurface
  */
-extern DECLSPEC SDL_Surface * SDLCALL IMG_Load_RW(SDL_RWops *src, SDL_bool freesrc);
+extern DECLSPEC SDL_Surface * SDLCALL IMG_Load_IO(SDL_IOStream *src, SDL_bool closeio);
 
 #if SDL_VERSION_ATLEAST(2,0,0)
 
@@ -364,9 +364,9 @@ extern DECLSPEC SDL_Surface * SDLCALL IMG_Load_RW(SDL_RWops *src, SDL_bool frees
  * data (but in many cases, this will just end up being 32-bit RGB or 32-bit
  * RGBA).
  *
- * There is a separate function to read files from an SDL_RWops, if you need
+ * There is a separate function to read files from an SDL_IOStream, if you need
  * an i/o abstraction to provide data from anywhere instead of a simple
- * filesystem read; that function is IMG_LoadTexture_RW().
+ * filesystem read; that function is IMG_LoadTexture_IO().
  *
  * If you would rather decode an image to an SDL_Surface (a buffer of pixels
  * in CPU memory), call IMG_Load() instead.
@@ -380,8 +380,8 @@ extern DECLSPEC SDL_Surface * SDLCALL IMG_Load_RW(SDL_RWops *src, SDL_bool frees
  *
  * \since This function is available since SDL_image 3.0.0.
  *
- * \sa IMG_LoadTextureTyped_RW
- * \sa IMG_LoadTexture_RW
+ * \sa IMG_LoadTextureTyped_IO
+ * \sa IMG_LoadTexture_IO
  */
 extern DECLSPEC SDL_Texture * SDLCALL IMG_LoadTexture(SDL_Renderer *renderer, const char *file);
 
@@ -399,16 +399,16 @@ extern DECLSPEC SDL_Texture * SDLCALL IMG_LoadTexture(SDL_Renderer *renderer, co
  * data (but in many cases, this will just end up being 32-bit RGB or 32-bit
  * RGBA).
  *
- * If `freesrc` is SDL_TRUE, the RWops will be closed before returning,
+ * If `closeio` is SDL_TRUE, `src` will be closed before returning,
  * whether this function succeeds or not. SDL_image reads everything it needs
- * from the RWops during this call in any case.
+ * from `src` during this call in any case.
  *
  * There is a separate function to read files from disk without having to deal
- * with SDL_RWops: `IMG_LoadTexture(renderer, "filename.jpg")` will call this
+ * with SDL_IOStream: `IMG_LoadTexture(renderer, "filename.jpg")` will call this
  * function and manage those details for you, determining the file type from
  * the filename's extension.
  *
- * There is also IMG_LoadTextureTyped_RW(), which is equivalent to this
+ * There is also IMG_LoadTextureTyped_IO(), which is equivalent to this
  * function except a file extension (like "BMP", "JPG", etc) can be specified,
  * in case SDL_image cannot autodetect the file format.
  *
@@ -419,18 +419,18 @@ extern DECLSPEC SDL_Texture * SDLCALL IMG_LoadTexture(SDL_Renderer *renderer, co
  * call to SDL_DestroyTexture().
  *
  * \param renderer the SDL_Renderer to use to create the GPU texture.
- * \param src an SDL_RWops that data will be read from.
- * \param freesrc SDL_TRUE to close/free the SDL_RWops before returning,
+ * \param src an SDL_IOStream that data will be read from.
+ * \param closeio SDL_TRUE to close/free the SDL_IOStream before returning,
  *                SDL_FALSE to leave it open.
  * \returns a new texture, or NULL on error.
  *
  * \since This function is available since SDL_image 3.0.0.
  *
  * \sa IMG_LoadTexture
- * \sa IMG_LoadTextureTyped_RW
+ * \sa IMG_LoadTextureTyped_IO
  * \sa SDL_DestroyTexture
  */
-extern DECLSPEC SDL_Texture * SDLCALL IMG_LoadTexture_RW(SDL_Renderer *renderer, SDL_RWops *src, SDL_bool freesrc);
+extern DECLSPEC SDL_Texture * SDLCALL IMG_LoadTexture_IO(SDL_Renderer *renderer, SDL_IOStream *src, SDL_bool closeio);
 
 /**
  * Load an image from an SDL data source into a GPU texture.
@@ -446,9 +446,9 @@ extern DECLSPEC SDL_Texture * SDLCALL IMG_LoadTexture_RW(SDL_Renderer *renderer,
  * data (but in many cases, this will just end up being 32-bit RGB or 32-bit
  * RGBA).
  *
- * If `freesrc` is SDL_TRUE, the RWops will be closed before returning,
+ * If `closeio` is SDL_TRUE, `src` will be closed before returning,
  * whether this function succeeds or not. SDL_image reads everything it needs
- * from the RWops during this call in any case.
+ * from `src` during this call in any case.
  *
  * Even though this function accepts a file type, SDL_image may still try
  * other decoders that are capable of detecting file type from the contents of
@@ -457,23 +457,23 @@ extern DECLSPEC SDL_Texture * SDLCALL IMG_LoadTexture_RW(SDL_Renderer *renderer,
  * its ability to guess the format.
  *
  * There is a separate function to read files from disk without having to deal
- * with SDL_RWops: `IMG_LoadTexture("filename.jpg")` will call this function
+ * with SDL_IOStream: `IMG_LoadTexture("filename.jpg")` will call this function
  * and manage those details for you, determining the file type from the
  * filename's extension.
  *
- * There is also IMG_LoadTexture_RW(), which is equivalent to this function
+ * There is also IMG_LoadTexture_IO(), which is equivalent to this function
  * except that it will rely on SDL_image to determine what type of data it is
  * loading, much like passing a NULL for type.
  *
  * If you would rather decode an image to an SDL_Surface (a buffer of pixels
- * in CPU memory), call IMG_LoadTyped_RW() instead.
+ * in CPU memory), call IMG_LoadTyped_IO() instead.
  *
  * When done with the returned texture, the app should dispose of it with a
  * call to SDL_DestroyTexture().
  *
  * \param renderer the SDL_Renderer to use to create the GPU texture.
- * \param src an SDL_RWops that data will be read from.
- * \param freesrc SDL_TRUE to close/free the SDL_RWops before returning,
+ * \param src an SDL_IOStream that data will be read from.
+ * \param closeio SDL_TRUE to close/free the SDL_IOStream before returning,
  *                SDL_FALSE to leave it open.
  * \param type a filename extension that represent this data ("BMP", "GIF",
  *             "PNG", etc).
@@ -482,22 +482,22 @@ extern DECLSPEC SDL_Texture * SDLCALL IMG_LoadTexture_RW(SDL_Renderer *renderer,
  * \since This function is available since SDL_image 3.0.0.
  *
  * \sa IMG_LoadTexture
- * \sa IMG_LoadTexture_RW
+ * \sa IMG_LoadTexture_IO
  * \sa SDL_DestroyTexture
  */
-extern DECLSPEC SDL_Texture * SDLCALL IMG_LoadTextureTyped_RW(SDL_Renderer *renderer, SDL_RWops *src, SDL_bool freesrc, const char *type);
+extern DECLSPEC SDL_Texture * SDLCALL IMG_LoadTextureTyped_IO(SDL_Renderer *renderer, SDL_IOStream *src, SDL_bool closeio, const char *type);
 #endif /* SDL 2.0 */
 
 /**
- * Detect AVIF image data on a readable/seekable SDL_RWops.
+ * Detect AVIF image data on a readable/seekable SDL_IOStream.
  *
  * This function attempts to determine if a file is a given filetype, reading
- * the least amount possible from the SDL_RWops (usually a few bytes).
+ * the least amount possible from the SDL_IOStream (usually a few bytes).
  *
  * There is no distinction made between "not the filetype in question" and
  * basic i/o errors.
  *
- * This function will always attempt to seek the RWops back to where it
+ * This function will always attempt to seek `src` back to where it
  * started when this function was called, but it will not report any errors in
  * doing so, but assuming seeking works, this means you can immediately use
  * this with a different IMG_isTYPE function, or load the image without
@@ -506,7 +506,7 @@ extern DECLSPEC SDL_Texture * SDLCALL IMG_LoadTextureTyped_RW(SDL_Renderer *rend
  * You do not need to call this function to load data; SDL_image can work to
  * determine file type in many cases in its standard load functions.
  *
- * \param src a seekable/readable SDL_RWops to provide image data.
+ * \param src a seekable/readable SDL_IOStream to provide image data.
  * \returns non-zero if this is AVIF data, zero otherwise.
  *
  * \since This function is available since SDL_image 3.0.0.
@@ -530,18 +530,18 @@ extern DECLSPEC SDL_Texture * SDLCALL IMG_LoadTextureTyped_RW(SDL_Renderer *rend
  * \sa IMG_isXV
  * \sa IMG_isWEBP
  */
-extern DECLSPEC int SDLCALL IMG_isAVIF(SDL_RWops *src);
+extern DECLSPEC int SDLCALL IMG_isAVIF(SDL_IOStream *src);
 
 /**
- * Detect ICO image data on a readable/seekable SDL_RWops.
+ * Detect ICO image data on a readable/seekable SDL_IOStream.
  *
  * This function attempts to determine if a file is a given filetype, reading
- * the least amount possible from the SDL_RWops (usually a few bytes).
+ * the least amount possible from the SDL_IOStream (usually a few bytes).
  *
  * There is no distinction made between "not the filetype in question" and
  * basic i/o errors.
  *
- * This function will always attempt to seek the RWops back to where it
+ * This function will always attempt to seek `src` back to where it
  * started when this function was called, but it will not report any errors in
  * doing so, but assuming seeking works, this means you can immediately use
  * this with a different IMG_isTYPE function, or load the image without
@@ -550,7 +550,7 @@ extern DECLSPEC int SDLCALL IMG_isAVIF(SDL_RWops *src);
  * You do not need to call this function to load data; SDL_image can work to
  * determine file type in many cases in its standard load functions.
  *
- * \param src a seekable/readable SDL_RWops to provide image data.
+ * \param src a seekable/readable SDL_IOStream to provide image data.
  * \returns non-zero if this is ICO data, zero otherwise.
  *
  * \since This function is available since SDL_image 3.0.0.
@@ -573,18 +573,18 @@ extern DECLSPEC int SDLCALL IMG_isAVIF(SDL_RWops *src);
  * \sa IMG_isXV
  * \sa IMG_isWEBP
  */
-extern DECLSPEC int SDLCALL IMG_isICO(SDL_RWops *src);
+extern DECLSPEC int SDLCALL IMG_isICO(SDL_IOStream *src);
 
 /**
- * Detect CUR image data on a readable/seekable SDL_RWops.
+ * Detect CUR image data on a readable/seekable SDL_IOStream.
  *
  * This function attempts to determine if a file is a given filetype, reading
- * the least amount possible from the SDL_RWops (usually a few bytes).
+ * the least amount possible from the SDL_IOStream (usually a few bytes).
  *
  * There is no distinction made between "not the filetype in question" and
  * basic i/o errors.
  *
- * This function will always attempt to seek the RWops back to where it
+ * This function will always attempt to seek `src` back to where it
  * started when this function was called, but it will not report any errors in
  * doing so, but assuming seeking works, this means you can immediately use
  * this with a different IMG_isTYPE function, or load the image without
@@ -593,7 +593,7 @@ extern DECLSPEC int SDLCALL IMG_isICO(SDL_RWops *src);
  * You do not need to call this function to load data; SDL_image can work to
  * determine file type in many cases in its standard load functions.
  *
- * \param src a seekable/readable SDL_RWops to provide image data.
+ * \param src a seekable/readable SDL_IOStream to provide image data.
  * \returns non-zero if this is CUR data, zero otherwise.
  *
  * \since This function is available since SDL_image 3.0.0.
@@ -616,18 +616,18 @@ extern DECLSPEC int SDLCALL IMG_isICO(SDL_RWops *src);
  * \sa IMG_isXV
  * \sa IMG_isWEBP
  */
-extern DECLSPEC int SDLCALL IMG_isCUR(SDL_RWops *src);
+extern DECLSPEC int SDLCALL IMG_isCUR(SDL_IOStream *src);
 
 /**
- * Detect BMP image data on a readable/seekable SDL_RWops.
+ * Detect BMP image data on a readable/seekable SDL_IOStream.
  *
  * This function attempts to determine if a file is a given filetype, reading
- * the least amount possible from the SDL_RWops (usually a few bytes).
+ * the least amount possible from the SDL_IOStream (usually a few bytes).
  *
  * There is no distinction made between "not the filetype in question" and
  * basic i/o errors.
  *
- * This function will always attempt to seek the RWops back to where it
+ * This function will always attempt to seek `src` back to where it
  * started when this function was called, but it will not report any errors in
  * doing so, but assuming seeking works, this means you can immediately use
  * this with a different IMG_isTYPE function, or load the image without
@@ -636,7 +636,7 @@ extern DECLSPEC int SDLCALL IMG_isCUR(SDL_RWops *src);
  * You do not need to call this function to load data; SDL_image can work to
  * determine file type in many cases in its standard load functions.
  *
- * \param src a seekable/readable SDL_RWops to provide image data.
+ * \param src a seekable/readable SDL_IOStream to provide image data.
  * \returns non-zero if this is BMP data, zero otherwise.
  *
  * \since This function is available since SDL_image 3.0.0.
@@ -659,18 +659,18 @@ extern DECLSPEC int SDLCALL IMG_isCUR(SDL_RWops *src);
  * \sa IMG_isXV
  * \sa IMG_isWEBP
  */
-extern DECLSPEC int SDLCALL IMG_isBMP(SDL_RWops *src);
+extern DECLSPEC int SDLCALL IMG_isBMP(SDL_IOStream *src);
 
 /**
- * Detect GIF image data on a readable/seekable SDL_RWops.
+ * Detect GIF image data on a readable/seekable SDL_IOStream.
  *
  * This function attempts to determine if a file is a given filetype, reading
- * the least amount possible from the SDL_RWops (usually a few bytes).
+ * the least amount possible from the SDL_IOStream (usually a few bytes).
  *
  * There is no distinction made between "not the filetype in question" and
  * basic i/o errors.
  *
- * This function will always attempt to seek the RWops back to where it
+ * This function will always attempt to seek `src` back to where it
  * started when this function was called, but it will not report any errors in
  * doing so, but assuming seeking works, this means you can immediately use
  * this with a different IMG_isTYPE function, or load the image without
@@ -679,7 +679,7 @@ extern DECLSPEC int SDLCALL IMG_isBMP(SDL_RWops *src);
  * You do not need to call this function to load data; SDL_image can work to
  * determine file type in many cases in its standard load functions.
  *
- * \param src a seekable/readable SDL_RWops to provide image data.
+ * \param src a seekable/readable SDL_IOStream to provide image data.
  * \returns non-zero if this is GIF data, zero otherwise.
  *
  * \since This function is available since SDL_image 3.0.0.
@@ -702,18 +702,18 @@ extern DECLSPEC int SDLCALL IMG_isBMP(SDL_RWops *src);
  * \sa IMG_isXV
  * \sa IMG_isWEBP
  */
-extern DECLSPEC int SDLCALL IMG_isGIF(SDL_RWops *src);
+extern DECLSPEC int SDLCALL IMG_isGIF(SDL_IOStream *src);
 
 /**
- * Detect JPG image data on a readable/seekable SDL_RWops.
+ * Detect JPG image data on a readable/seekable SDL_IOStream.
  *
  * This function attempts to determine if a file is a given filetype, reading
- * the least amount possible from the SDL_RWops (usually a few bytes).
+ * the least amount possible from the SDL_IOStream (usually a few bytes).
  *
  * There is no distinction made between "not the filetype in question" and
  * basic i/o errors.
  *
- * This function will always attempt to seek the RWops back to where it
+ * This function will always attempt to seek `src` back to where it
  * started when this function was called, but it will not report any errors in
  * doing so, but assuming seeking works, this means you can immediately use
  * this with a different IMG_isTYPE function, or load the image without
@@ -722,7 +722,7 @@ extern DECLSPEC int SDLCALL IMG_isGIF(SDL_RWops *src);
  * You do not need to call this function to load data; SDL_image can work to
  * determine file type in many cases in its standard load functions.
  *
- * \param src a seekable/readable SDL_RWops to provide image data.
+ * \param src a seekable/readable SDL_IOStream to provide image data.
  * \returns non-zero if this is JPG data, zero otherwise.
  *
  * \since This function is available since SDL_image 3.0.0.
@@ -745,18 +745,18 @@ extern DECLSPEC int SDLCALL IMG_isGIF(SDL_RWops *src);
  * \sa IMG_isXV
  * \sa IMG_isWEBP
  */
-extern DECLSPEC int SDLCALL IMG_isJPG(SDL_RWops *src);
+extern DECLSPEC int SDLCALL IMG_isJPG(SDL_IOStream *src);
 
 /**
- * Detect JXL image data on a readable/seekable SDL_RWops.
+ * Detect JXL image data on a readable/seekable SDL_IOStream.
  *
  * This function attempts to determine if a file is a given filetype, reading
- * the least amount possible from the SDL_RWops (usually a few bytes).
+ * the least amount possible from the SDL_IOStream (usually a few bytes).
  *
  * There is no distinction made between "not the filetype in question" and
  * basic i/o errors.
  *
- * This function will always attempt to seek the RWops back to where it
+ * This function will always attempt to seek `src` back to where it
  * started when this function was called, but it will not report any errors in
  * doing so, but assuming seeking works, this means you can immediately use
  * this with a different IMG_isTYPE function, or load the image without
@@ -765,7 +765,7 @@ extern DECLSPEC int SDLCALL IMG_isJPG(SDL_RWops *src);
  * You do not need to call this function to load data; SDL_image can work to
  * determine file type in many cases in its standard load functions.
  *
- * \param src a seekable/readable SDL_RWops to provide image data.
+ * \param src a seekable/readable SDL_IOStream to provide image data.
  * \returns non-zero if this is JXL data, zero otherwise.
  *
  * \since This function is available since SDL_image 3.0.0.
@@ -788,18 +788,18 @@ extern DECLSPEC int SDLCALL IMG_isJPG(SDL_RWops *src);
  * \sa IMG_isXV
  * \sa IMG_isWEBP
  */
-extern DECLSPEC int SDLCALL IMG_isJXL(SDL_RWops *src);
+extern DECLSPEC int SDLCALL IMG_isJXL(SDL_IOStream *src);
 
 /**
- * Detect LBM image data on a readable/seekable SDL_RWops.
+ * Detect LBM image data on a readable/seekable SDL_IOStream.
  *
  * This function attempts to determine if a file is a given filetype, reading
- * the least amount possible from the SDL_RWops (usually a few bytes).
+ * the least amount possible from the SDL_IOStream (usually a few bytes).
  *
  * There is no distinction made between "not the filetype in question" and
  * basic i/o errors.
  *
- * This function will always attempt to seek the RWops back to where it
+ * This function will always attempt to seek `src` back to where it
  * started when this function was called, but it will not report any errors in
  * doing so, but assuming seeking works, this means you can immediately use
  * this with a different IMG_isTYPE function, or load the image without
@@ -808,7 +808,7 @@ extern DECLSPEC int SDLCALL IMG_isJXL(SDL_RWops *src);
  * You do not need to call this function to load data; SDL_image can work to
  * determine file type in many cases in its standard load functions.
  *
- * \param src a seekable/readable SDL_RWops to provide image data.
+ * \param src a seekable/readable SDL_IOStream to provide image data.
  * \returns non-zero if this is LBM data, zero otherwise.
  *
  * \since This function is available since SDL_image 3.0.0.
@@ -831,18 +831,18 @@ extern DECLSPEC int SDLCALL IMG_isJXL(SDL_RWops *src);
  * \sa IMG_isXV
  * \sa IMG_isWEBP
  */
-extern DECLSPEC int SDLCALL IMG_isLBM(SDL_RWops *src);
+extern DECLSPEC int SDLCALL IMG_isLBM(SDL_IOStream *src);
 
 /**
- * Detect PCX image data on a readable/seekable SDL_RWops.
+ * Detect PCX image data on a readable/seekable SDL_IOStream.
  *
  * This function attempts to determine if a file is a given filetype, reading
- * the least amount possible from the SDL_RWops (usually a few bytes).
+ * the least amount possible from the SDL_IOStream (usually a few bytes).
  *
  * There is no distinction made between "not the filetype in question" and
  * basic i/o errors.
  *
- * This function will always attempt to seek the RWops back to where it
+ * This function will always attempt to seek `src` back to where it
  * started when this function was called, but it will not report any errors in
  * doing so, but assuming seeking works, this means you can immediately use
  * this with a different IMG_isTYPE function, or load the image without
@@ -851,7 +851,7 @@ extern DECLSPEC int SDLCALL IMG_isLBM(SDL_RWops *src);
  * You do not need to call this function to load data; SDL_image can work to
  * determine file type in many cases in its standard load functions.
  *
- * \param src a seekable/readable SDL_RWops to provide image data.
+ * \param src a seekable/readable SDL_IOStream to provide image data.
  * \returns non-zero if this is PCX data, zero otherwise.
  *
  * \since This function is available since SDL_image 3.0.0.
@@ -874,18 +874,18 @@ extern DECLSPEC int SDLCALL IMG_isLBM(SDL_RWops *src);
  * \sa IMG_isXV
  * \sa IMG_isWEBP
  */
-extern DECLSPEC int SDLCALL IMG_isPCX(SDL_RWops *src);
+extern DECLSPEC int SDLCALL IMG_isPCX(SDL_IOStream *src);
 
 /**
- * Detect PNG image data on a readable/seekable SDL_RWops.
+ * Detect PNG image data on a readable/seekable SDL_IOStream.
  *
  * This function attempts to determine if a file is a given filetype, reading
- * the least amount possible from the SDL_RWops (usually a few bytes).
+ * the least amount possible from the SDL_IOStream (usually a few bytes).
  *
  * There is no distinction made between "not the filetype in question" and
  * basic i/o errors.
  *
- * This function will always attempt to seek the RWops back to where it
+ * This function will always attempt to seek `src` back to where it
  * started when this function was called, but it will not report any errors in
  * doing so, but assuming seeking works, this means you can immediately use
  * this with a different IMG_isTYPE function, or load the image without
@@ -894,7 +894,7 @@ extern DECLSPEC int SDLCALL IMG_isPCX(SDL_RWops *src);
  * You do not need to call this function to load data; SDL_image can work to
  * determine file type in many cases in its standard load functions.
  *
- * \param src a seekable/readable SDL_RWops to provide image data.
+ * \param src a seekable/readable SDL_IOStream to provide image data.
  * \returns non-zero if this is PNG data, zero otherwise.
  *
  * \since This function is available since SDL_image 3.0.0.
@@ -917,18 +917,18 @@ extern DECLSPEC int SDLCALL IMG_isPCX(SDL_RWops *src);
  * \sa IMG_isXV
  * \sa IMG_isWEBP
  */
-extern DECLSPEC int SDLCALL IMG_isPNG(SDL_RWops *src);
+extern DECLSPEC int SDLCALL IMG_isPNG(SDL_IOStream *src);
 
 /**
- * Detect PNM image data on a readable/seekable SDL_RWops.
+ * Detect PNM image data on a readable/seekable SDL_IOStream.
  *
  * This function attempts to determine if a file is a given filetype, reading
- * the least amount possible from the SDL_RWops (usually a few bytes).
+ * the least amount possible from the SDL_IOStream (usually a few bytes).
  *
  * There is no distinction made between "not the filetype in question" and
  * basic i/o errors.
  *
- * This function will always attempt to seek the RWops back to where it
+ * This function will always attempt to seek `src` back to where it
  * started when this function was called, but it will not report any errors in
  * doing so, but assuming seeking works, this means you can immediately use
  * this with a different IMG_isTYPE function, or load the image without
@@ -937,7 +937,7 @@ extern DECLSPEC int SDLCALL IMG_isPNG(SDL_RWops *src);
  * You do not need to call this function to load data; SDL_image can work to
  * determine file

(Patch may be truncated, please check the link at the top of this post.)