rwops: Renamed SDL_CreateRW and SDL_DestroyRW to SDL_OpenRW and SDL_CloseRW.

This commit is contained in:
Ryan C. Gordon
2024-03-12 09:01:37 -04:00
parent 525919b315
commit 655ceb3b31
22 changed files with 81 additions and 95 deletions

View File

@@ -1317,7 +1317,7 @@ extern DECLSPEC int SDLCALL SDL_SetAudioPostmixCallback(SDL_AudioDeviceID devid,
* ```
*
* \param src The data source for the WAVE data
* \param freesrc If SDL_TRUE, calls SDL_DestroyRW() on `src` before returning,
* \param freesrc If SDL_TRUE, calls SDL_CloseRW() on `src` before returning,
* even in the case of an error
* \param spec A pointer to an SDL_AudioSpec that will be set to the WAVE
* data's format details on successful return

View File

@@ -268,7 +268,7 @@ extern DECLSPEC int SDLCALL SDL_AddGamepadMapping(const char *mapping);
* constrained environment.
*
* \param src the data stream for the mappings to be added
* \param freesrc if SDL_TRUE, calls SDL_DestroyRW() on `src` before returning,
* \param freesrc if SDL_TRUE, calls SDL_CloseRW() on `src` before returning,
* even in the case of an error
* \returns the number of mappings added or -1 on error; call SDL_GetError()
* for more information.

View File

@@ -452,8 +452,6 @@
#define RW_SEEK_CUR SDL_RW_SEEK_CUR
#define RW_SEEK_END SDL_RW_SEEK_END
#define RW_SEEK_SET SDL_RW_SEEK_SET
#define SDL_AllocRW SDL_CreateRW
#define SDL_FreeRW SDL_DestroyRW
#define SDL_ReadBE16 SDL_ReadU16BE
#define SDL_ReadBE32 SDL_ReadU32BE
#define SDL_ReadBE64 SDL_ReadU64BE
@@ -938,8 +936,6 @@
#define RW_SEEK_CUR RW_SEEK_CUR_renamed_SDL_RW_SEEK_CUR
#define RW_SEEK_END RW_SEEK_END_renamed_SDL_RW_SEEK_END
#define RW_SEEK_SET RW_SEEK_SET_renamed_SDL_RW_SEEK_SET
#define SDL_AllocRW SDL_AllocRW_renamed_SDL_CreateRW
#define SDL_FreeRW SDL_FreeRW_renamed_SDL_DestroyRW
#define SDL_ReadBE16 SDL_ReadBE16_renamed_SDL_ReadU16BE
#define SDL_ReadBE32 SDL_ReadBE32_renamed_SDL_ReadU32BE
#define SDL_ReadBE64 SDL_ReadBE64_renamed_SDL_ReadU64BE

View File

@@ -234,30 +234,30 @@ extern DECLSPEC SDL_RWops *SDLCALL SDL_RWFromConstMem(const void *mem, size_t si
/**
* Use this function to allocate a SDL_RWops structure.
* Create a custom SDL_RWops.
*
* Applications do not need to use this function unless they are providing
* their own SDL_RWops implementation. If you just need an SDL_RWops to
* read/write a common data source, you should use the built-in
* implementations in SDL, like SDL_RWFromFile() or SDL_RWFromMem(), etc.
*
* You must free the returned pointer with SDL_DestroyRW().
* You must free the returned pointer with SDL_CloseRW().
*
* \returns a pointer to the allocated memory on success, or NULL on failure;
* call SDL_GetError() for more information.
*
* \since This function is available since SDL 3.0.0.
*
* \sa SDL_DestroyRW
* \sa SDL_CloseRW
*/
extern DECLSPEC SDL_RWops *SDLCALL SDL_CreateRW(const SDL_RWopsInterface *iface, void *userdata);
extern DECLSPEC SDL_RWops *SDLCALL SDL_OpenRW(const SDL_RWopsInterface *iface, void *userdata);
/**
* Close and free an allocated SDL_RWops structure.
*
* SDL_DestroyRW() closes and cleans up the SDL_RWops stream. It releases any
* SDL_CloseRW() closes and cleans up the SDL_RWops stream. It releases any
* resources used by the stream and frees the SDL_RWops itself with
* SDL_DestroyRW(). This returns 0 on success, or -1 if the stream failed to
* SDL_CloseRW(). This returns 0 on success, or -1 if the stream failed to
* flush to its output (e.g. to disk).
*
* Note that if this fails to flush the stream to disk, this function reports
@@ -276,7 +276,7 @@ extern DECLSPEC SDL_RWops *SDLCALL SDL_CreateRW(const SDL_RWopsInterface *iface,
* \sa SDL_RWseek
* \sa SDL_RWwrite
*/
extern DECLSPEC int SDLCALL SDL_DestroyRW(SDL_RWops *context);
extern DECLSPEC int SDLCALL SDL_CloseRW(SDL_RWops *context);
/**
* Get the properties associated with an SDL_RWops.
@@ -489,7 +489,7 @@ extern DECLSPEC size_t SDLCALL SDL_RWvprintf(SDL_RWops *context, SDL_PRINTF_FORM
*
* \param src the SDL_RWops to read all available data from
* \param datasize if not NULL, will store the number of bytes read
* \param freesrc if SDL_TRUE, calls SDL_DestroyRW() on `src` before returning,
* \param freesrc if SDL_TRUE, calls SDL_CloseRW() on `src` before returning,
* even in the case of an error
* \returns the data, or NULL if there was an error.
*

View File

@@ -328,7 +328,7 @@ extern DECLSPEC void SDLCALL SDL_UnlockSurface(SDL_Surface *surface);
* will result in a memory leak.
*
* \param src the data stream for the surface
* \param freesrc if SDL_TRUE, calls SDL_DestroyRW() on `src` before returning,
* \param freesrc if SDL_TRUE, calls SDL_CloseRW() on `src` before returning,
* even in the case of an error
* \returns a pointer to a new SDL_Surface structure or NULL if there was an
* error; call SDL_GetError() for more information.
@@ -370,7 +370,7 @@ extern DECLSPEC SDL_Surface *SDLCALL SDL_LoadBMP(const char *file);
*
* \param surface the SDL_Surface structure containing the image to be saved
* \param dst a data stream to save to
* \param freedst if SDL_TRUE, calls SDL_DestroyRW() on `dst` before returning,
* \param freedst if SDL_TRUE, calls SDL_CloseRW() on `dst` before returning,
* even in the case of an error
* \returns 0 on success or a negative error code on failure; call
* SDL_GetError() for more information.