Changed 'freesrc' parameter from int to SDL_bool

This commit is contained in:
Sam Lantinga
2023-07-09 13:49:04 -07:00
parent 32d529bf70
commit bea99d48f2
7 changed files with 28 additions and 25 deletions

View File

@@ -594,9 +594,6 @@ extern DECLSPEC int SDLCALL SDL_PauseAudioDevice(SDL_AudioDeviceID dev);
* be valid pointers. The entire data portion of the file is then loaded into
* memory and decoded if necessary.
*
* If `freesrc` is non-zero, the data source gets automatically closed and
* freed before the function returns.
*
* Supported formats are RIFF WAVE files with the formats PCM (8, 16, 24, and
* 32 bits), IEEE Float (32 bits), Microsoft ADPCM and IMA ADPCM (4 bits), and
* A-law and mu-law (8 bits). Other formats are currently unsupported and
@@ -643,11 +640,11 @@ extern DECLSPEC int SDLCALL SDL_PauseAudioDevice(SDL_AudioDeviceID dev);
* ```
*
* \param src The data source for the WAVE data
* \param freesrc If non-zero, SDL will _always_ free the data source
* \param freesrc if SDL_TRUE, calls SDL_RWclose() on `src` before returning, even in the case of an error
* \param spec An SDL_AudioSpec that will be filled in with the wave file's
* format details
* \param audio_buf A pointer filled with the audio data, allocated by the
* function.
* function
* \param audio_len A pointer filled with the length of the audio data buffer
* in bytes
* \returns This function, if successfully called, returns `spec`, which will
@@ -669,7 +666,7 @@ extern DECLSPEC int SDLCALL SDL_PauseAudioDevice(SDL_AudioDeviceID dev);
* \sa SDL_LoadWAV
*/
extern DECLSPEC SDL_AudioSpec *SDLCALL SDL_LoadWAV_RW(SDL_RWops * src,
int freesrc,
SDL_bool freesrc,
SDL_AudioSpec * spec,
Uint8 ** audio_buf,
Uint32 * audio_len);

View File

@@ -530,14 +530,14 @@ extern DECLSPEC int SDLCALL SDL_RWclose(SDL_RWops *context);
*
* \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 non-zero, calls SDL_RWclose() on `src` before returning
* \param freesrc if SDL_TRUE, calls SDL_RWclose() on `src` before returning, even in the case of an error
* \returns the data, or NULL if there was an error.
*
* \since This function is available since SDL 3.0.0.
*/
extern DECLSPEC void *SDLCALL SDL_LoadFile_RW(SDL_RWops *src,
size_t *datasize,
int freesrc);
SDL_bool freesrc);
/**
* Load all the data from a file path.

View File

@@ -228,7 +228,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 non-zero to close the stream after being read
* \param freesrc if SDL_TRUE, calls SDL_RWclose() 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.
*
@@ -238,7 +238,7 @@ extern DECLSPEC void SDLCALL SDL_UnlockSurface(SDL_Surface *surface);
* \sa SDL_LoadBMP
* \sa SDL_SaveBMP_RW
*/
extern DECLSPEC SDL_Surface *SDLCALL SDL_LoadBMP_RW(SDL_RWops *src, int freesrc);
extern DECLSPEC SDL_Surface *SDLCALL SDL_LoadBMP_RW(SDL_RWops *src, SDL_bool freesrc);
/**
* Load a BMP image from a file.