rwops: Renamed SDL_CreateRW and SDL_DestroyRW to SDL_OpenRW and SDL_CloseRW.
parent
525919b315
commit
655ceb3b31
|
@ -1815,16 +1815,6 @@ expression e2;
|
||||||
+ SDL_RW_SEEK_SET
|
+ SDL_RW_SEEK_SET
|
||||||
@@
|
@@
|
||||||
@@
|
@@
|
||||||
- SDL_AllocRW
|
|
||||||
+ SDL_CreateRW
|
|
||||||
(...)
|
|
||||||
@@
|
|
||||||
@@
|
|
||||||
- SDL_FreeRW
|
|
||||||
+ SDL_DestroyRW
|
|
||||||
(...)
|
|
||||||
@@
|
|
||||||
@@
|
|
||||||
- SDL_SensorClose
|
- SDL_SensorClose
|
||||||
+ SDL_CloseSensor
|
+ SDL_CloseSensor
|
||||||
(...)
|
(...)
|
||||||
|
|
|
@ -1156,9 +1156,9 @@ The following symbols have been renamed:
|
||||||
* RW_SEEK_END => SDL_RW_SEEK_END
|
* RW_SEEK_END => SDL_RW_SEEK_END
|
||||||
* RW_SEEK_SET => SDL_RW_SEEK_SET
|
* RW_SEEK_SET => SDL_RW_SEEK_SET
|
||||||
|
|
||||||
SDL_RWops is now an opaque structure. The existing APIs to create a RWops (SDL_RWFromFile, etc) still function as expected, but to make a custom RWops with app-provided function pointers, call SDL_CreateRW and provide the function pointers through there. To call into a RWops's functionality, use the standard APIs (SDL_RWread, etc) instead of calling into function pointers directly.
|
SDL_RWops is now an opaque structure. The existing APIs to create a RWops (SDL_RWFromFile, etc) still function as expected, but to make a custom RWops with app-provided function pointers, call SDL_OpenRW and provide the function pointers through there. To call into a RWops's functionality, use the standard APIs (SDL_RWread, etc) instead of calling into function pointers directly.
|
||||||
|
|
||||||
The RWops function pointers are now in a separate structure called SDL_RWopsInteface, which is provided to SDL_CreateRW. All the functions now take a `void *` userdata argument for their first parameter instead of an SDL_RWops, since that's now an opaque structure.
|
The RWops function pointers are now in a separate structure called SDL_RWopsInteface, which is provided to SDL_OpenRW. All the functions now take a `void *` userdata argument for their first parameter instead of an SDL_RWops, since that's now an opaque structure.
|
||||||
|
|
||||||
SDL_RWread and SDL_RWwrite (and SDL_RWopsInterface::read, SDL_RWopsInterface::write) have a different function signature in SDL3.
|
SDL_RWread and SDL_RWwrite (and SDL_RWopsInterface::read, SDL_RWopsInterface::write) have a different function signature in SDL3.
|
||||||
|
|
||||||
|
@ -1196,11 +1196,11 @@ size_t custom_read(void *ptr, size_t size, size_t nitems, SDL_RWops *stream)
|
||||||
|
|
||||||
SDL_RWops::type was removed and has no replacement; it wasn't meaningful for app-provided implementations at all, and wasn't much use for SDL's internal implementations, either.
|
SDL_RWops::type was removed and has no replacement; it wasn't meaningful for app-provided implementations at all, and wasn't much use for SDL's internal implementations, either.
|
||||||
|
|
||||||
SDL_RWopsInterface::close implementations should clean up their own userdata, but not call SDL_DestroyRW on themselves; now the contract is always that SDL_DestroyRW is called, which calls `->close` and then frees the opaque object.
|
SDL_RWopsInterface::close implementations should clean up their own userdata, but not call SDL_CloseRW on themselves; now the contract is always that SDL_CloseRW is called, which calls `->close` and then frees the opaque object.
|
||||||
|
|
||||||
SDL_RWFromFP has been removed from the API, due to issues when the SDL library uses a different C runtime from the application.
|
SDL_RWFromFP has been removed from the API, due to issues when the SDL library uses a different C runtime from the application.
|
||||||
|
|
||||||
SDL_AllocRW(), SDL_FreeRW(), SDL_RWclose() and direct access to the `->close` function pointer have been removed from the API, so there's only one path to manage RWops lifetimes now: SDL_CreateRW() and SDL_DestroyRW().
|
SDL_AllocRW(), SDL_FreeRW(), SDL_RWclose() and direct access to the `->close` function pointer have been removed from the API, so there's only one path to manage RWops lifetimes now: SDL_OpenRW() and SDL_CloseRW().
|
||||||
|
|
||||||
|
|
||||||
You can implement this in your own code easily:
|
You can implement this in your own code easily:
|
||||||
|
@ -1295,7 +1295,7 @@ SDL_RWops *SDL_RWFromFP(FILE *fp, SDL_bool autoclose)
|
||||||
rwopsdata->fp = fp;
|
rwopsdata->fp = fp;
|
||||||
rwopsdata->autoclose = autoclose;
|
rwopsdata->autoclose = autoclose;
|
||||||
|
|
||||||
rwops = SDL_CreateRW(&iface, rwopsdata);
|
rwops = SDL_OpenRW(&iface, rwopsdata);
|
||||||
if (!rwops) {
|
if (!rwops) {
|
||||||
iface.close(rwopsdata);
|
iface.close(rwopsdata);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1317,7 +1317,7 @@ extern DECLSPEC int SDLCALL SDL_SetAudioPostmixCallback(SDL_AudioDeviceID devid,
|
||||||
* ```
|
* ```
|
||||||
*
|
*
|
||||||
* \param src The data source for the WAVE data
|
* \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
|
* even in the case of an error
|
||||||
* \param spec A pointer to an SDL_AudioSpec that will be set to the WAVE
|
* \param spec A pointer to an SDL_AudioSpec that will be set to the WAVE
|
||||||
* data's format details on successful return
|
* data's format details on successful return
|
||||||
|
|
|
@ -268,7 +268,7 @@ extern DECLSPEC int SDLCALL SDL_AddGamepadMapping(const char *mapping);
|
||||||
* constrained environment.
|
* constrained environment.
|
||||||
*
|
*
|
||||||
* \param src the data stream for the mappings to be added
|
* \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
|
* even in the case of an error
|
||||||
* \returns the number of mappings added or -1 on error; call SDL_GetError()
|
* \returns the number of mappings added or -1 on error; call SDL_GetError()
|
||||||
* for more information.
|
* for more information.
|
||||||
|
|
|
@ -452,8 +452,6 @@
|
||||||
#define RW_SEEK_CUR SDL_RW_SEEK_CUR
|
#define RW_SEEK_CUR SDL_RW_SEEK_CUR
|
||||||
#define RW_SEEK_END SDL_RW_SEEK_END
|
#define RW_SEEK_END SDL_RW_SEEK_END
|
||||||
#define RW_SEEK_SET SDL_RW_SEEK_SET
|
#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_ReadBE16 SDL_ReadU16BE
|
||||||
#define SDL_ReadBE32 SDL_ReadU32BE
|
#define SDL_ReadBE32 SDL_ReadU32BE
|
||||||
#define SDL_ReadBE64 SDL_ReadU64BE
|
#define SDL_ReadBE64 SDL_ReadU64BE
|
||||||
|
@ -938,8 +936,6 @@
|
||||||
#define RW_SEEK_CUR RW_SEEK_CUR_renamed_SDL_RW_SEEK_CUR
|
#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_END RW_SEEK_END_renamed_SDL_RW_SEEK_END
|
||||||
#define RW_SEEK_SET RW_SEEK_SET_renamed_SDL_RW_SEEK_SET
|
#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_ReadBE16 SDL_ReadBE16_renamed_SDL_ReadU16BE
|
||||||
#define SDL_ReadBE32 SDL_ReadBE32_renamed_SDL_ReadU32BE
|
#define SDL_ReadBE32 SDL_ReadBE32_renamed_SDL_ReadU32BE
|
||||||
#define SDL_ReadBE64 SDL_ReadBE64_renamed_SDL_ReadU64BE
|
#define SDL_ReadBE64 SDL_ReadBE64_renamed_SDL_ReadU64BE
|
||||||
|
|
|
@ -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
|
* 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
|
* 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
|
* read/write a common data source, you should use the built-in
|
||||||
* implementations in SDL, like SDL_RWFromFile() or SDL_RWFromMem(), etc.
|
* 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;
|
* \returns a pointer to the allocated memory on success, or NULL on failure;
|
||||||
* call SDL_GetError() for more information.
|
* call SDL_GetError() for more information.
|
||||||
*
|
*
|
||||||
* \since This function is available since SDL 3.0.0.
|
* \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.
|
* 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
|
* 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).
|
* flush to its output (e.g. to disk).
|
||||||
*
|
*
|
||||||
* Note that if this fails to flush the stream to disk, this function reports
|
* 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_RWseek
|
||||||
* \sa SDL_RWwrite
|
* \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.
|
* 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 src the SDL_RWops to read all available data from
|
||||||
* \param datasize if not NULL, will store the number of bytes read
|
* \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
|
* even in the case of an error
|
||||||
* \returns the data, or NULL if there was an error.
|
* \returns the data, or NULL if there was an error.
|
||||||
*
|
*
|
||||||
|
|
|
@ -328,7 +328,7 @@ extern DECLSPEC void SDLCALL SDL_UnlockSurface(SDL_Surface *surface);
|
||||||
* will result in a memory leak.
|
* will result in a memory leak.
|
||||||
*
|
*
|
||||||
* \param src the data stream for the surface
|
* \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
|
* even in the case of an error
|
||||||
* \returns a pointer to a new SDL_Surface structure or NULL if there was an
|
* \returns a pointer to a new SDL_Surface structure or NULL if there was an
|
||||||
* error; call SDL_GetError() for more information.
|
* 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 surface the SDL_Surface structure containing the image to be saved
|
||||||
* \param dst a data stream to save to
|
* \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
|
* even in the case of an error
|
||||||
* \returns 0 on success or a negative error code on failure; call
|
* \returns 0 on success or a negative error code on failure; call
|
||||||
* SDL_GetError() for more information.
|
* SDL_GetError() for more information.
|
||||||
|
|
|
@ -1629,7 +1629,7 @@ static int WaveReadFormat(WaveFile *file)
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
} else if (format->encoding == PCM_CODE) {
|
} else if (format->encoding == PCM_CODE) {
|
||||||
SDL_DestroyRW(fmtsrc);
|
SDL_CloseRW(fmtsrc);
|
||||||
return SDL_SetError("Missing wBitsPerSample field in WAVE fmt chunk");
|
return SDL_SetError("Missing wBitsPerSample field in WAVE fmt chunk");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1649,7 +1649,7 @@ static int WaveReadFormat(WaveFile *file)
|
||||||
|
|
||||||
/* Extensible header must be at least 22 bytes. */
|
/* Extensible header must be at least 22 bytes. */
|
||||||
if (fmtlen < 40 || format->extsize < 22) {
|
if (fmtlen < 40 || format->extsize < 22) {
|
||||||
SDL_DestroyRW(fmtsrc);
|
SDL_CloseRW(fmtsrc);
|
||||||
return SDL_SetError("Extensible WAVE header too small");
|
return SDL_SetError("Extensible WAVE header too small");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1661,7 +1661,7 @@ static int WaveReadFormat(WaveFile *file)
|
||||||
format->encoding = WaveGetFormatGUIDEncoding(format);
|
format->encoding = WaveGetFormatGUIDEncoding(format);
|
||||||
}
|
}
|
||||||
|
|
||||||
SDL_DestroyRW(fmtsrc);
|
SDL_CloseRW(fmtsrc);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -2117,7 +2117,7 @@ int SDL_LoadWAV_RW(SDL_RWops *src, SDL_bool freesrc, SDL_AudioSpec *spec, Uint8
|
||||||
SDL_free(file.decoderdata);
|
SDL_free(file.decoderdata);
|
||||||
done:
|
done:
|
||||||
if (freesrc && src) {
|
if (freesrc && src) {
|
||||||
SDL_DestroyRW(src);
|
SDL_CloseRW(src);
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
|
@ -68,7 +68,7 @@ static int DISKAUDIO_CaptureFromDevice(SDL_AudioDevice *device, void *buffer, in
|
||||||
buflen -= br;
|
buflen -= br;
|
||||||
buffer = ((Uint8 *)buffer) + br;
|
buffer = ((Uint8 *)buffer) + br;
|
||||||
if (buflen > 0) { // EOF (or error, but whatever).
|
if (buflen > 0) { // EOF (or error, but whatever).
|
||||||
SDL_DestroyRW(h->io);
|
SDL_CloseRW(h->io);
|
||||||
h->io = NULL;
|
h->io = NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -88,7 +88,7 @@ static void DISKAUDIO_CloseDevice(SDL_AudioDevice *device)
|
||||||
{
|
{
|
||||||
if (device->hidden) {
|
if (device->hidden) {
|
||||||
if (device->hidden->io) {
|
if (device->hidden->io) {
|
||||||
SDL_DestroyRW(device->hidden->io);
|
SDL_CloseRW(device->hidden->io);
|
||||||
}
|
}
|
||||||
SDL_free(device->hidden->mixbuf);
|
SDL_free(device->hidden->mixbuf);
|
||||||
SDL_free(device->hidden);
|
SDL_free(device->hidden);
|
||||||
|
|
|
@ -52,7 +52,6 @@ SDL3_0.0.0 {
|
||||||
SDL_CreatePalette;
|
SDL_CreatePalette;
|
||||||
SDL_CreatePixelFormat;
|
SDL_CreatePixelFormat;
|
||||||
SDL_CreatePopupWindow;
|
SDL_CreatePopupWindow;
|
||||||
SDL_CreateRW;
|
|
||||||
SDL_CreateRWLock;
|
SDL_CreateRWLock;
|
||||||
SDL_CreateRenderer;
|
SDL_CreateRenderer;
|
||||||
SDL_CreateSemaphore;
|
SDL_CreateSemaphore;
|
||||||
|
@ -79,7 +78,6 @@ SDL3_0.0.0 {
|
||||||
SDL_DestroyMutex;
|
SDL_DestroyMutex;
|
||||||
SDL_DestroyPalette;
|
SDL_DestroyPalette;
|
||||||
SDL_DestroyPixelFormat;
|
SDL_DestroyPixelFormat;
|
||||||
SDL_DestroyRW;
|
|
||||||
SDL_DestroyRWLock;
|
SDL_DestroyRWLock;
|
||||||
SDL_DestroyRenderer;
|
SDL_DestroyRenderer;
|
||||||
SDL_DestroySemaphore;
|
SDL_DestroySemaphore;
|
||||||
|
@ -978,6 +976,8 @@ SDL3_0.0.0 {
|
||||||
SDL_ShowOpenFileDialog;
|
SDL_ShowOpenFileDialog;
|
||||||
SDL_ShowSaveFileDialog;
|
SDL_ShowSaveFileDialog;
|
||||||
SDL_ShowOpenFolderDialog;
|
SDL_ShowOpenFolderDialog;
|
||||||
|
SDL_OpenRW;
|
||||||
|
SDL_CloseRW;
|
||||||
# extra symbols go here (don't modify this line)
|
# extra symbols go here (don't modify this line)
|
||||||
local: *;
|
local: *;
|
||||||
};
|
};
|
||||||
|
|
|
@ -76,7 +76,6 @@
|
||||||
#define SDL_CreatePalette SDL_CreatePalette_REAL
|
#define SDL_CreatePalette SDL_CreatePalette_REAL
|
||||||
#define SDL_CreatePixelFormat SDL_CreatePixelFormat_REAL
|
#define SDL_CreatePixelFormat SDL_CreatePixelFormat_REAL
|
||||||
#define SDL_CreatePopupWindow SDL_CreatePopupWindow_REAL
|
#define SDL_CreatePopupWindow SDL_CreatePopupWindow_REAL
|
||||||
#define SDL_CreateRW SDL_CreateRW_REAL
|
|
||||||
#define SDL_CreateRWLock SDL_CreateRWLock_REAL
|
#define SDL_CreateRWLock SDL_CreateRWLock_REAL
|
||||||
#define SDL_CreateRenderer SDL_CreateRenderer_REAL
|
#define SDL_CreateRenderer SDL_CreateRenderer_REAL
|
||||||
#define SDL_CreateSemaphore SDL_CreateSemaphore_REAL
|
#define SDL_CreateSemaphore SDL_CreateSemaphore_REAL
|
||||||
|
@ -103,7 +102,6 @@
|
||||||
#define SDL_DestroyMutex SDL_DestroyMutex_REAL
|
#define SDL_DestroyMutex SDL_DestroyMutex_REAL
|
||||||
#define SDL_DestroyPalette SDL_DestroyPalette_REAL
|
#define SDL_DestroyPalette SDL_DestroyPalette_REAL
|
||||||
#define SDL_DestroyPixelFormat SDL_DestroyPixelFormat_REAL
|
#define SDL_DestroyPixelFormat SDL_DestroyPixelFormat_REAL
|
||||||
#define SDL_DestroyRW SDL_DestroyRW_REAL
|
|
||||||
#define SDL_DestroyRWLock SDL_DestroyRWLock_REAL
|
#define SDL_DestroyRWLock SDL_DestroyRWLock_REAL
|
||||||
#define SDL_DestroyRenderer SDL_DestroyRenderer_REAL
|
#define SDL_DestroyRenderer SDL_DestroyRenderer_REAL
|
||||||
#define SDL_DestroySemaphore SDL_DestroySemaphore_REAL
|
#define SDL_DestroySemaphore SDL_DestroySemaphore_REAL
|
||||||
|
@ -1003,3 +1001,5 @@
|
||||||
#define SDL_ShowOpenFileDialog SDL_ShowOpenFileDialog_REAL
|
#define SDL_ShowOpenFileDialog SDL_ShowOpenFileDialog_REAL
|
||||||
#define SDL_ShowSaveFileDialog SDL_ShowSaveFileDialog_REAL
|
#define SDL_ShowSaveFileDialog SDL_ShowSaveFileDialog_REAL
|
||||||
#define SDL_ShowOpenFolderDialog SDL_ShowOpenFolderDialog_REAL
|
#define SDL_ShowOpenFolderDialog SDL_ShowOpenFolderDialog_REAL
|
||||||
|
#define SDL_OpenRW SDL_OpenRW_REAL
|
||||||
|
#define SDL_CloseRW SDL_CloseRW_REAL
|
||||||
|
|
|
@ -142,7 +142,6 @@ SDL_DYNAPI_PROC(SDL_Mutex*,SDL_CreateMutex,(void),(),return)
|
||||||
SDL_DYNAPI_PROC(SDL_Palette*,SDL_CreatePalette,(int a),(a),return)
|
SDL_DYNAPI_PROC(SDL_Palette*,SDL_CreatePalette,(int a),(a),return)
|
||||||
SDL_DYNAPI_PROC(SDL_PixelFormat*,SDL_CreatePixelFormat,(SDL_PixelFormatEnum a),(a),return)
|
SDL_DYNAPI_PROC(SDL_PixelFormat*,SDL_CreatePixelFormat,(SDL_PixelFormatEnum a),(a),return)
|
||||||
SDL_DYNAPI_PROC(SDL_Window*,SDL_CreatePopupWindow,(SDL_Window *a, int b, int c, int d, int e, Uint32 f),(a,b,c,d,e,f),return)
|
SDL_DYNAPI_PROC(SDL_Window*,SDL_CreatePopupWindow,(SDL_Window *a, int b, int c, int d, int e, Uint32 f),(a,b,c,d,e,f),return)
|
||||||
SDL_DYNAPI_PROC(SDL_RWops*,SDL_CreateRW,(const SDL_RWopsInterface *a, void *b),(a,b),return)
|
|
||||||
SDL_DYNAPI_PROC(SDL_RWLock*,SDL_CreateRWLock,(void),(),return)
|
SDL_DYNAPI_PROC(SDL_RWLock*,SDL_CreateRWLock,(void),(),return)
|
||||||
SDL_DYNAPI_PROC(SDL_Renderer*,SDL_CreateRenderer,(SDL_Window *a, const char *b, Uint32 c),(a,b,c),return)
|
SDL_DYNAPI_PROC(SDL_Renderer*,SDL_CreateRenderer,(SDL_Window *a, const char *b, Uint32 c),(a,b,c),return)
|
||||||
SDL_DYNAPI_PROC(SDL_Semaphore*,SDL_CreateSemaphore,(Uint32 a),(a),return)
|
SDL_DYNAPI_PROC(SDL_Semaphore*,SDL_CreateSemaphore,(Uint32 a),(a),return)
|
||||||
|
@ -166,7 +165,6 @@ SDL_DYNAPI_PROC(void,SDL_DestroyCursor,(SDL_Cursor *a),(a),)
|
||||||
SDL_DYNAPI_PROC(void,SDL_DestroyMutex,(SDL_Mutex *a),(a),)
|
SDL_DYNAPI_PROC(void,SDL_DestroyMutex,(SDL_Mutex *a),(a),)
|
||||||
SDL_DYNAPI_PROC(void,SDL_DestroyPalette,(SDL_Palette *a),(a),)
|
SDL_DYNAPI_PROC(void,SDL_DestroyPalette,(SDL_Palette *a),(a),)
|
||||||
SDL_DYNAPI_PROC(void,SDL_DestroyPixelFormat,(SDL_PixelFormat *a),(a),)
|
SDL_DYNAPI_PROC(void,SDL_DestroyPixelFormat,(SDL_PixelFormat *a),(a),)
|
||||||
SDL_DYNAPI_PROC(int,SDL_DestroyRW,(SDL_RWops *a),(a),return)
|
|
||||||
SDL_DYNAPI_PROC(void,SDL_DestroyRWLock,(SDL_RWLock *a),(a),)
|
SDL_DYNAPI_PROC(void,SDL_DestroyRWLock,(SDL_RWLock *a),(a),)
|
||||||
SDL_DYNAPI_PROC(void,SDL_DestroyRenderer,(SDL_Renderer *a),(a),)
|
SDL_DYNAPI_PROC(void,SDL_DestroyRenderer,(SDL_Renderer *a),(a),)
|
||||||
SDL_DYNAPI_PROC(void,SDL_DestroySemaphore,(SDL_Semaphore *a),(a),)
|
SDL_DYNAPI_PROC(void,SDL_DestroySemaphore,(SDL_Semaphore *a),(a),)
|
||||||
|
@ -1028,3 +1026,5 @@ SDL_DYNAPI_PROC(int,SDL_GetJoystickBall,(SDL_Joystick *a, int b, int *c, int *d)
|
||||||
SDL_DYNAPI_PROC(void,SDL_ShowOpenFileDialog,(SDL_DialogFileCallback a, void *b, SDL_Window *c, const SDL_DialogFileFilter *d, const char *e, int f),(a,b,c,d,e,f),)
|
SDL_DYNAPI_PROC(void,SDL_ShowOpenFileDialog,(SDL_DialogFileCallback a, void *b, SDL_Window *c, const SDL_DialogFileFilter *d, const char *e, int f),(a,b,c,d,e,f),)
|
||||||
SDL_DYNAPI_PROC(void,SDL_ShowSaveFileDialog,(SDL_DialogFileCallback a, void *b, SDL_Window *c, const SDL_DialogFileFilter *d, const char *e),(a,b,c,d,e),)
|
SDL_DYNAPI_PROC(void,SDL_ShowSaveFileDialog,(SDL_DialogFileCallback a, void *b, SDL_Window *c, const SDL_DialogFileFilter *d, const char *e),(a,b,c,d,e),)
|
||||||
SDL_DYNAPI_PROC(void,SDL_ShowOpenFolderDialog,(SDL_DialogFileCallback a, void *b, SDL_Window *c, const char *d, int e),(a,b,c,d,e),)
|
SDL_DYNAPI_PROC(void,SDL_ShowOpenFolderDialog,(SDL_DialogFileCallback a, void *b, SDL_Window *c, const char *d, int e),(a,b,c,d,e),)
|
||||||
|
SDL_DYNAPI_PROC(SDL_RWops*,SDL_OpenRW,(const SDL_RWopsInterface *a, void *b),(a,b),return)
|
||||||
|
SDL_DYNAPI_PROC(int,SDL_CloseRW,(SDL_RWops *a),(a),return)
|
||||||
|
|
|
@ -424,7 +424,7 @@ static SDL_RWops *SDL_RWFromFP(FILE *fp, SDL_bool autoclose)
|
||||||
rwopsdata->fp = fp;
|
rwopsdata->fp = fp;
|
||||||
rwopsdata->autoclose = autoclose;
|
rwopsdata->autoclose = autoclose;
|
||||||
|
|
||||||
SDL_RWops *rwops = SDL_CreateRW(&iface, rwopsdata);
|
SDL_RWops *rwops = SDL_OpenRW(&iface, rwopsdata);
|
||||||
if (!rwops) {
|
if (!rwops) {
|
||||||
iface.close(rwopsdata);
|
iface.close(rwopsdata);
|
||||||
}
|
}
|
||||||
|
@ -565,7 +565,7 @@ SDL_RWops *SDL_RWFromFile(const char *file, const char *mode)
|
||||||
|
|
||||||
void *rwopsdata = NULL;
|
void *rwopsdata = NULL;
|
||||||
if (Android_JNI_FileOpen(&rwopsdata, file, mode) < 0) {
|
if (Android_JNI_FileOpen(&rwopsdata, file, mode) < 0) {
|
||||||
SDL_DestroyRW(rwops);
|
SDL_CloseRW(rwops);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -577,7 +577,7 @@ SDL_RWops *SDL_RWFromFile(const char *file, const char *mode)
|
||||||
iface.write = Android_JNI_FileWrite;
|
iface.write = Android_JNI_FileWrite;
|
||||||
iface.close = Android_JNI_FileClose;
|
iface.close = Android_JNI_FileClose;
|
||||||
|
|
||||||
rwops = SDL_CreateRW(&iface, rwopsdata);
|
rwops = SDL_OpenRW(&iface, rwopsdata);
|
||||||
if (!rwops) {
|
if (!rwops) {
|
||||||
iface.close(rwopsdata);
|
iface.close(rwopsdata);
|
||||||
}
|
}
|
||||||
|
@ -591,7 +591,7 @@ SDL_RWops *SDL_RWFromFile(const char *file, const char *mode)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (windows_file_open(rwopsdata, file, mode) < 0) {
|
if (windows_file_open(rwopsdata, file, mode) < 0) {
|
||||||
SDL_DestroyRW(rwops);
|
SDL_CloseRW(rwops);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -603,7 +603,7 @@ SDL_RWops *SDL_RWFromFile(const char *file, const char *mode)
|
||||||
iface.write = windows_file_write;
|
iface.write = windows_file_write;
|
||||||
iface.close = windows_file_close;
|
iface.close = windows_file_close;
|
||||||
|
|
||||||
rwops = SDL_CreateRW(&iface, rwopsdata);
|
rwops = SDL_OpenRW(&iface, rwopsdata);
|
||||||
if (!rwops) {
|
if (!rwops) {
|
||||||
windows_file_close(rwopsdata);
|
windows_file_close(rwopsdata);
|
||||||
}
|
}
|
||||||
|
@ -666,7 +666,7 @@ SDL_RWops *SDL_RWFromMem(void *mem, size_t size)
|
||||||
rwopsdata->here = rwopsdata->base;
|
rwopsdata->here = rwopsdata->base;
|
||||||
rwopsdata->stop = rwopsdata->base + size;
|
rwopsdata->stop = rwopsdata->base + size;
|
||||||
|
|
||||||
SDL_RWops *rwops = SDL_CreateRW(&iface, rwopsdata);
|
SDL_RWops *rwops = SDL_OpenRW(&iface, rwopsdata);
|
||||||
if (!rwops) {
|
if (!rwops) {
|
||||||
SDL_free(rwopsdata);
|
SDL_free(rwopsdata);
|
||||||
}
|
}
|
||||||
|
@ -699,14 +699,14 @@ SDL_RWops *SDL_RWFromConstMem(const void *mem, size_t size)
|
||||||
rwopsdata->here = rwopsdata->base;
|
rwopsdata->here = rwopsdata->base;
|
||||||
rwopsdata->stop = rwopsdata->base + size;
|
rwopsdata->stop = rwopsdata->base + size;
|
||||||
|
|
||||||
SDL_RWops *rwops = SDL_CreateRW(&iface, rwopsdata);
|
SDL_RWops *rwops = SDL_OpenRW(&iface, rwopsdata);
|
||||||
if (!rwops) {
|
if (!rwops) {
|
||||||
SDL_free(rwopsdata);
|
SDL_free(rwopsdata);
|
||||||
}
|
}
|
||||||
return rwops;
|
return rwops;
|
||||||
}
|
}
|
||||||
|
|
||||||
SDL_RWops *SDL_CreateRW(const SDL_RWopsInterface *iface, void *userdata)
|
SDL_RWops *SDL_OpenRW(const SDL_RWopsInterface *iface, void *userdata)
|
||||||
{
|
{
|
||||||
if (!iface) {
|
if (!iface) {
|
||||||
SDL_InvalidParamError("iface");
|
SDL_InvalidParamError("iface");
|
||||||
|
@ -721,7 +721,7 @@ SDL_RWops *SDL_CreateRW(const SDL_RWopsInterface *iface, void *userdata)
|
||||||
return rwops;
|
return rwops;
|
||||||
}
|
}
|
||||||
|
|
||||||
int SDL_DestroyRW(SDL_RWops *rwops)
|
int SDL_CloseRW(SDL_RWops *rwops)
|
||||||
{
|
{
|
||||||
int retval = 0;
|
int retval = 0;
|
||||||
if (rwops) {
|
if (rwops) {
|
||||||
|
@ -797,7 +797,7 @@ done:
|
||||||
*datasize = (size_t)size_total;
|
*datasize = (size_t)size_total;
|
||||||
}
|
}
|
||||||
if (freesrc && src) {
|
if (freesrc && src) {
|
||||||
SDL_DestroyRW(src);
|
SDL_CloseRW(src);
|
||||||
}
|
}
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1913,7 +1913,7 @@ static const void *SDLTest_ScreenShotClipboardProvider(void *context, const char
|
||||||
image = NULL;
|
image = NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
SDL_DestroyRW(file);
|
SDL_CloseRW(file);
|
||||||
|
|
||||||
if (image) {
|
if (image) {
|
||||||
data->image = image;
|
data->image = image;
|
||||||
|
@ -1984,7 +1984,7 @@ static void SDLTest_PasteScreenShot(void)
|
||||||
if (file) {
|
if (file) {
|
||||||
SDL_Log("Writing clipboard image to %s", filename);
|
SDL_Log("Writing clipboard image to %s", filename);
|
||||||
SDL_RWwrite(file, data, size);
|
SDL_RWwrite(file, data, size);
|
||||||
SDL_DestroyRW(file);
|
SDL_CloseRW(file);
|
||||||
}
|
}
|
||||||
SDL_free(data);
|
SDL_free(data);
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -578,7 +578,7 @@ done:
|
||||||
surface = NULL;
|
surface = NULL;
|
||||||
}
|
}
|
||||||
if (freesrc && src) {
|
if (freesrc && src) {
|
||||||
SDL_DestroyRW(src);
|
SDL_CloseRW(src);
|
||||||
}
|
}
|
||||||
return surface;
|
return surface;
|
||||||
}
|
}
|
||||||
|
@ -857,7 +857,7 @@ done:
|
||||||
SDL_DestroySurface(intermediate_surface);
|
SDL_DestroySurface(intermediate_surface);
|
||||||
}
|
}
|
||||||
if (freedst && dst) {
|
if (freedst && dst) {
|
||||||
if (SDL_DestroyRW(dst) < 0) {
|
if (SDL_CloseRW(dst) < 0) {
|
||||||
was_error = SDL_TRUE;
|
was_error = SDL_TRUE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -273,8 +273,8 @@ static int rwops_testMem(void *arg)
|
||||||
testGenericRWopsValidations(rw, SDL_TRUE);
|
testGenericRWopsValidations(rw, SDL_TRUE);
|
||||||
|
|
||||||
/* Close */
|
/* Close */
|
||||||
result = SDL_DestroyRW(rw);
|
result = SDL_CloseRW(rw);
|
||||||
SDLTest_AssertPass("Call to SDL_DestroyRW() succeeded");
|
SDLTest_AssertPass("Call to SDL_CloseRW() succeeded");
|
||||||
SDLTest_AssertCheck(result == 0, "Verify result value is 0; got: %d", result);
|
SDLTest_AssertCheck(result == 0, "Verify result value is 0; got: %d", result);
|
||||||
|
|
||||||
return TEST_COMPLETED;
|
return TEST_COMPLETED;
|
||||||
|
@ -305,8 +305,8 @@ static int rwops_testConstMem(void *arg)
|
||||||
testGenericRWopsValidations(rw, SDL_FALSE);
|
testGenericRWopsValidations(rw, SDL_FALSE);
|
||||||
|
|
||||||
/* Close handle */
|
/* Close handle */
|
||||||
result = SDL_DestroyRW(rw);
|
result = SDL_CloseRW(rw);
|
||||||
SDLTest_AssertPass("Call to SDL_DestroyRW() succeeded");
|
SDLTest_AssertPass("Call to SDL_CloseRW() succeeded");
|
||||||
SDLTest_AssertCheck(result == 0, "Verify result value is 0; got: %d", result);
|
SDLTest_AssertCheck(result == 0, "Verify result value is 0; got: %d", result);
|
||||||
|
|
||||||
return TEST_COMPLETED;
|
return TEST_COMPLETED;
|
||||||
|
@ -337,8 +337,8 @@ static int rwops_testFileRead(void *arg)
|
||||||
testGenericRWopsValidations(rw, SDL_FALSE);
|
testGenericRWopsValidations(rw, SDL_FALSE);
|
||||||
|
|
||||||
/* Close handle */
|
/* Close handle */
|
||||||
result = SDL_DestroyRW(rw);
|
result = SDL_CloseRW(rw);
|
||||||
SDLTest_AssertPass("Call to SDL_DestroyRW() succeeded");
|
SDLTest_AssertPass("Call to SDL_CloseRW() succeeded");
|
||||||
SDLTest_AssertCheck(result == 0, "Verify result value is 0; got: %d", result);
|
SDLTest_AssertCheck(result == 0, "Verify result value is 0; got: %d", result);
|
||||||
|
|
||||||
return TEST_COMPLETED;
|
return TEST_COMPLETED;
|
||||||
|
@ -369,8 +369,8 @@ static int rwops_testFileWrite(void *arg)
|
||||||
testGenericRWopsValidations(rw, SDL_TRUE);
|
testGenericRWopsValidations(rw, SDL_TRUE);
|
||||||
|
|
||||||
/* Close handle */
|
/* Close handle */
|
||||||
result = SDL_DestroyRW(rw);
|
result = SDL_CloseRW(rw);
|
||||||
SDLTest_AssertPass("Call to SDL_DestroyRW() succeeded");
|
SDLTest_AssertPass("Call to SDL_CloseRW() succeeded");
|
||||||
SDLTest_AssertCheck(result == 0, "Verify result value is 0; got: %d", result);
|
SDLTest_AssertCheck(result == 0, "Verify result value is 0; got: %d", result);
|
||||||
|
|
||||||
return TEST_COMPLETED;
|
return TEST_COMPLETED;
|
||||||
|
@ -379,8 +379,8 @@ static int rwops_testFileWrite(void *arg)
|
||||||
/**
|
/**
|
||||||
* Tests alloc and free RW context.
|
* Tests alloc and free RW context.
|
||||||
*
|
*
|
||||||
* \sa SDL_CreateRW
|
* \sa SDL_OpenRW
|
||||||
* \sa SDL_DestroyRW
|
* \sa SDL_CloseRW
|
||||||
*/
|
*/
|
||||||
static int rwops_testAllocFree(void *arg)
|
static int rwops_testAllocFree(void *arg)
|
||||||
{
|
{
|
||||||
|
@ -389,16 +389,16 @@ static int rwops_testAllocFree(void *arg)
|
||||||
SDL_RWops *rw;
|
SDL_RWops *rw;
|
||||||
|
|
||||||
SDL_zero(iface);
|
SDL_zero(iface);
|
||||||
rw = SDL_CreateRW(&iface, NULL);
|
rw = SDL_OpenRW(&iface, NULL);
|
||||||
SDLTest_AssertPass("Call to SDL_CreateRW() succeeded");
|
SDLTest_AssertPass("Call to SDL_OpenRW() succeeded");
|
||||||
SDLTest_AssertCheck(rw != NULL, "Validate result from SDL_CreateRW() is not NULL");
|
SDLTest_AssertCheck(rw != NULL, "Validate result from SDL_OpenRW() is not NULL");
|
||||||
if (rw == NULL) {
|
if (rw == NULL) {
|
||||||
return TEST_ABORTED;
|
return TEST_ABORTED;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Free context again */
|
/* Free context again */
|
||||||
SDL_DestroyRW(rw);
|
SDL_CloseRW(rw);
|
||||||
SDLTest_AssertPass("Call to SDL_DestroyRW() succeeded");
|
SDLTest_AssertPass("Call to SDL_CloseRW() succeeded");
|
||||||
|
|
||||||
return TEST_COMPLETED;
|
return TEST_COMPLETED;
|
||||||
}
|
}
|
||||||
|
@ -435,8 +435,8 @@ static int rwops_testCompareRWFromMemWithRWFromFile(void *arg)
|
||||||
SDLTest_AssertPass("Call to SDL_RWread(mem, size=%d)", size * 6);
|
SDLTest_AssertPass("Call to SDL_RWread(mem, size=%d)", size * 6);
|
||||||
sv_mem = SDL_RWseek(rwops_mem, 0, SEEK_END);
|
sv_mem = SDL_RWseek(rwops_mem, 0, SEEK_END);
|
||||||
SDLTest_AssertPass("Call to SDL_RWseek(mem,SEEK_END)");
|
SDLTest_AssertPass("Call to SDL_RWseek(mem,SEEK_END)");
|
||||||
result = SDL_DestroyRW(rwops_mem);
|
result = SDL_CloseRW(rwops_mem);
|
||||||
SDLTest_AssertPass("Call to SDL_DestroyRW(mem)");
|
SDLTest_AssertPass("Call to SDL_CloseRW(mem)");
|
||||||
SDLTest_AssertCheck(result == 0, "Verify result value is 0; got: %d", result);
|
SDLTest_AssertCheck(result == 0, "Verify result value is 0; got: %d", result);
|
||||||
|
|
||||||
/* Read/see from file */
|
/* Read/see from file */
|
||||||
|
@ -446,8 +446,8 @@ static int rwops_testCompareRWFromMemWithRWFromFile(void *arg)
|
||||||
SDLTest_AssertPass("Call to SDL_RWread(file, size=%d)", size * 6);
|
SDLTest_AssertPass("Call to SDL_RWread(file, size=%d)", size * 6);
|
||||||
sv_file = SDL_RWseek(rwops_file, 0, SEEK_END);
|
sv_file = SDL_RWseek(rwops_file, 0, SEEK_END);
|
||||||
SDLTest_AssertPass("Call to SDL_RWseek(file,SEEK_END)");
|
SDLTest_AssertPass("Call to SDL_RWseek(file,SEEK_END)");
|
||||||
result = SDL_DestroyRW(rwops_file);
|
result = SDL_CloseRW(rwops_file);
|
||||||
SDLTest_AssertPass("Call to SDL_DestroyRW(file)");
|
SDLTest_AssertPass("Call to SDL_CloseRW(file)");
|
||||||
SDLTest_AssertCheck(result == 0, "Verify result value is 0; got: %d", result);
|
SDLTest_AssertCheck(result == 0, "Verify result value is 0; got: %d", result);
|
||||||
|
|
||||||
/* Compare */
|
/* Compare */
|
||||||
|
@ -590,8 +590,8 @@ static int rwops_testFileWriteReadEndian(void *arg)
|
||||||
SDLTest_AssertCheck(LE64test == LE64value, "Validate object read from SDL_ReadU64LE, expected: %" SDL_PRIu64 ", got: %" SDL_PRIu64, LE64value, LE64test);
|
SDLTest_AssertCheck(LE64test == LE64value, "Validate object read from SDL_ReadU64LE, expected: %" SDL_PRIu64 ", got: %" SDL_PRIu64, LE64value, LE64test);
|
||||||
|
|
||||||
/* Close handle */
|
/* Close handle */
|
||||||
cresult = SDL_DestroyRW(rw);
|
cresult = SDL_CloseRW(rw);
|
||||||
SDLTest_AssertPass("Call to SDL_DestroyRW() succeeded");
|
SDLTest_AssertPass("Call to SDL_CloseRW() succeeded");
|
||||||
SDLTest_AssertCheck(cresult == 0, "Verify result value is 0; got: %d", cresult);
|
SDLTest_AssertCheck(cresult == 0, "Verify result value is 0; got: %d", cresult);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -55,7 +55,7 @@ rwops_error_quit(unsigned line, SDL_RWops *rwops)
|
||||||
{
|
{
|
||||||
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "testfile.c(%d): failed\n", line);
|
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "testfile.c(%d): failed\n", line);
|
||||||
if (rwops) {
|
if (rwops) {
|
||||||
SDL_DestroyRW(rwops);
|
SDL_CloseRW(rwops);
|
||||||
}
|
}
|
||||||
cleanup();
|
cleanup();
|
||||||
SDLTest_CommonDestroyState(state);
|
SDLTest_CommonDestroyState(state);
|
||||||
|
@ -126,25 +126,25 @@ int main(int argc, char *argv[])
|
||||||
if (!rwops) {
|
if (!rwops) {
|
||||||
RWOP_ERR_QUIT(rwops);
|
RWOP_ERR_QUIT(rwops);
|
||||||
}
|
}
|
||||||
SDL_DestroyRW(rwops);
|
SDL_CloseRW(rwops);
|
||||||
unlink(FBASENAME2);
|
unlink(FBASENAME2);
|
||||||
rwops = SDL_RWFromFile(FBASENAME2, "wb+");
|
rwops = SDL_RWFromFile(FBASENAME2, "wb+");
|
||||||
if (!rwops) {
|
if (!rwops) {
|
||||||
RWOP_ERR_QUIT(rwops);
|
RWOP_ERR_QUIT(rwops);
|
||||||
}
|
}
|
||||||
SDL_DestroyRW(rwops);
|
SDL_CloseRW(rwops);
|
||||||
unlink(FBASENAME2);
|
unlink(FBASENAME2);
|
||||||
rwops = SDL_RWFromFile(FBASENAME2, "ab");
|
rwops = SDL_RWFromFile(FBASENAME2, "ab");
|
||||||
if (!rwops) {
|
if (!rwops) {
|
||||||
RWOP_ERR_QUIT(rwops);
|
RWOP_ERR_QUIT(rwops);
|
||||||
}
|
}
|
||||||
SDL_DestroyRW(rwops);
|
SDL_CloseRW(rwops);
|
||||||
unlink(FBASENAME2);
|
unlink(FBASENAME2);
|
||||||
rwops = SDL_RWFromFile(FBASENAME2, "ab+");
|
rwops = SDL_RWFromFile(FBASENAME2, "ab+");
|
||||||
if (!rwops) {
|
if (!rwops) {
|
||||||
RWOP_ERR_QUIT(rwops);
|
RWOP_ERR_QUIT(rwops);
|
||||||
}
|
}
|
||||||
SDL_DestroyRW(rwops);
|
SDL_CloseRW(rwops);
|
||||||
unlink(FBASENAME2);
|
unlink(FBASENAME2);
|
||||||
SDL_Log("test2 OK\n");
|
SDL_Log("test2 OK\n");
|
||||||
|
|
||||||
|
@ -171,7 +171,7 @@ int main(int argc, char *argv[])
|
||||||
RWOP_ERR_QUIT(rwops); /* we are in write only mode */
|
RWOP_ERR_QUIT(rwops); /* we are in write only mode */
|
||||||
}
|
}
|
||||||
|
|
||||||
SDL_DestroyRW(rwops);
|
SDL_CloseRW(rwops);
|
||||||
|
|
||||||
rwops = SDL_RWFromFile(FBASENAME1, "rb"); /* read mode, file must exist */
|
rwops = SDL_RWFromFile(FBASENAME1, "rb"); /* read mode, file must exist */
|
||||||
if (!rwops) {
|
if (!rwops) {
|
||||||
|
@ -208,7 +208,7 @@ int main(int argc, char *argv[])
|
||||||
RWOP_ERR_QUIT(rwops); /* readonly mode */
|
RWOP_ERR_QUIT(rwops); /* readonly mode */
|
||||||
}
|
}
|
||||||
|
|
||||||
SDL_DestroyRW(rwops);
|
SDL_CloseRW(rwops);
|
||||||
|
|
||||||
/* test 3: same with w+ mode */
|
/* test 3: same with w+ mode */
|
||||||
rwops = SDL_RWFromFile(FBASENAME1, "wb+"); /* write + read + truncation */
|
rwops = SDL_RWFromFile(FBASENAME1, "wb+"); /* write + read + truncation */
|
||||||
|
@ -258,7 +258,7 @@ int main(int argc, char *argv[])
|
||||||
if (SDL_memcmp(test_buf, "12345678901234567890", 20) != 0) {
|
if (SDL_memcmp(test_buf, "12345678901234567890", 20) != 0) {
|
||||||
RWOP_ERR_QUIT(rwops);
|
RWOP_ERR_QUIT(rwops);
|
||||||
}
|
}
|
||||||
SDL_DestroyRW(rwops);
|
SDL_CloseRW(rwops);
|
||||||
SDL_Log("test3 OK\n");
|
SDL_Log("test3 OK\n");
|
||||||
|
|
||||||
/* test 4: same in r+ mode */
|
/* test 4: same in r+ mode */
|
||||||
|
@ -309,7 +309,7 @@ int main(int argc, char *argv[])
|
||||||
if (SDL_memcmp(test_buf, "12345678901234567890", 20) != 0) {
|
if (SDL_memcmp(test_buf, "12345678901234567890", 20) != 0) {
|
||||||
RWOP_ERR_QUIT(rwops);
|
RWOP_ERR_QUIT(rwops);
|
||||||
}
|
}
|
||||||
SDL_DestroyRW(rwops);
|
SDL_CloseRW(rwops);
|
||||||
SDL_Log("test4 OK\n");
|
SDL_Log("test4 OK\n");
|
||||||
|
|
||||||
/* test5 : append mode */
|
/* test5 : append mode */
|
||||||
|
@ -366,7 +366,7 @@ int main(int argc, char *argv[])
|
||||||
if (SDL_memcmp(test_buf, "123456789012345678901234567123", 30) != 0) {
|
if (SDL_memcmp(test_buf, "123456789012345678901234567123", 30) != 0) {
|
||||||
RWOP_ERR_QUIT(rwops);
|
RWOP_ERR_QUIT(rwops);
|
||||||
}
|
}
|
||||||
SDL_DestroyRW(rwops);
|
SDL_CloseRW(rwops);
|
||||||
SDL_Log("test5 OK\n");
|
SDL_Log("test5 OK\n");
|
||||||
cleanup();
|
cleanup();
|
||||||
SDL_Quit();
|
SDL_Quit();
|
||||||
|
|
|
@ -223,7 +223,7 @@ static int unifont_init(const char *fontname)
|
||||||
lineNumber++;
|
lineNumber++;
|
||||||
} while (bytesRead > 0);
|
} while (bytesRead > 0);
|
||||||
|
|
||||||
SDL_DestroyRW(hexFile);
|
SDL_CloseRW(hexFile);
|
||||||
SDL_Log("unifont: Loaded %" SDL_PRIu32 " glyphs.\n", numGlyphs);
|
SDL_Log("unifont: Loaded %" SDL_PRIu32 " glyphs.\n", numGlyphs);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -452,7 +452,7 @@ int main(int argc, char **argv)
|
||||||
|
|
||||||
SDL_RWread(handle, RawMooseData, MOOSEFRAME_SIZE * MOOSEFRAMES_COUNT);
|
SDL_RWread(handle, RawMooseData, MOOSEFRAME_SIZE * MOOSEFRAMES_COUNT);
|
||||||
|
|
||||||
SDL_DestroyRW(handle);
|
SDL_CloseRW(handle);
|
||||||
|
|
||||||
/* Create the window and renderer */
|
/* Create the window and renderer */
|
||||||
window_w = MOOSEPIC_W * scale;
|
window_w = MOOSEPIC_W * scale;
|
||||||
|
|
|
@ -117,7 +117,7 @@ int main(int argc, char **argv)
|
||||||
/* write out a WAV header... */
|
/* write out a WAV header... */
|
||||||
io = SDL_RWFromFile(file_out, "wb");
|
io = SDL_RWFromFile(file_out, "wb");
|
||||||
if (!io) {
|
if (!io) {
|
||||||
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "fopen('%s') failed: %s\n", file_out, SDL_GetError());
|
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "opening '%s' failed: %s\n", file_out, SDL_GetError());
|
||||||
ret = 5;
|
ret = 5;
|
||||||
goto end;
|
goto end;
|
||||||
}
|
}
|
||||||
|
@ -141,8 +141,8 @@ int main(int argc, char **argv)
|
||||||
SDL_WriteU32LE(io, dst_len); /* size */
|
SDL_WriteU32LE(io, dst_len); /* size */
|
||||||
SDL_RWwrite(io, dst_buf, dst_len);
|
SDL_RWwrite(io, dst_buf, dst_len);
|
||||||
|
|
||||||
if (SDL_DestroyRW(io) == -1) {
|
if (SDL_CloseRW(io) == -1) {
|
||||||
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "fclose('%s') failed: %s\n", file_out, SDL_GetError());
|
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "closing '%s' failed: %s\n", file_out, SDL_GetError());
|
||||||
ret = 6;
|
ret = 6;
|
||||||
goto end;
|
goto end;
|
||||||
}
|
}
|
||||||
|
|
|
@ -171,7 +171,7 @@ int main(int argc, char **argv)
|
||||||
quit(2);
|
quit(2);
|
||||||
}
|
}
|
||||||
SDL_RWread(handle, MooseFrames, MOOSEFRAME_SIZE * MOOSEFRAMES_COUNT);
|
SDL_RWread(handle, MooseFrames, MOOSEFRAME_SIZE * MOOSEFRAMES_COUNT);
|
||||||
SDL_DestroyRW(handle);
|
SDL_CloseRW(handle);
|
||||||
|
|
||||||
/* Create the window and renderer */
|
/* Create the window and renderer */
|
||||||
window = SDL_CreateWindow("Happy Moose", MOOSEPIC_W * 4, MOOSEPIC_H * 4, SDL_WINDOW_RESIZABLE);
|
window = SDL_CreateWindow("Happy Moose", MOOSEPIC_W * 4, MOOSEPIC_H * 4, SDL_WINDOW_RESIZABLE);
|
||||||
|
|
|
@ -44,7 +44,7 @@ GetNearbyFilename(const char *file)
|
||||||
|
|
||||||
rw = SDL_RWFromFile(path, "rb");
|
rw = SDL_RWFromFile(path, "rb");
|
||||||
if (rw) {
|
if (rw) {
|
||||||
SDL_DestroyRW(rw);
|
SDL_CloseRW(rw);
|
||||||
return path;
|
return path;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue