rwops: Renamed SDL_RWops to SDL_IOStream, and other related symbols.
parent
fe33b2a81b
commit
fc7afa9cbf
|
@ -1804,15 +1804,15 @@ expression e2;
|
|||
@@
|
||||
@@
|
||||
- RW_SEEK_CUR
|
||||
+ SDL_RW_SEEK_CUR
|
||||
+ SDL_IO_SEEK_CUR
|
||||
@@
|
||||
@@
|
||||
- RW_SEEK_END
|
||||
+ SDL_RW_SEEK_END
|
||||
+ SDL_IO_SEEK_END
|
||||
@@
|
||||
@@
|
||||
- RW_SEEK_SET
|
||||
+ SDL_RW_SEEK_SET
|
||||
+ SDL_IO_SEEK_SET
|
||||
@@
|
||||
@@
|
||||
- SDL_SensorClose
|
||||
|
@ -3051,30 +3051,65 @@ typedef SDL_version, SDL_Version;
|
|||
@@
|
||||
@@
|
||||
- SDL_RWclose
|
||||
+ SDL_CloseRW
|
||||
+ SDL_CloseIO
|
||||
(...)
|
||||
@@
|
||||
@@
|
||||
- SDL_RWread
|
||||
+ SDL_ReadRW
|
||||
+ SDL_ReadIO
|
||||
(...)
|
||||
@@
|
||||
@@
|
||||
- SDL_RWwrite
|
||||
+ SDL_WriteRW
|
||||
+ SDL_WriteIO
|
||||
(...)
|
||||
@@
|
||||
@@
|
||||
- SDL_RWtell
|
||||
+ SDL_TellRW
|
||||
+ SDL_TellIO
|
||||
(...)
|
||||
@@
|
||||
@@
|
||||
- SDL_RWsize
|
||||
+ SDL_SizeRW
|
||||
+ SDL_SizeIO
|
||||
(...)
|
||||
@@
|
||||
@@
|
||||
- SDL_RWseek
|
||||
+ SDL_SeekRW
|
||||
+ SDL_SeekIO
|
||||
(...)
|
||||
@@
|
||||
@@
|
||||
- SDL_LoadBMP_RW
|
||||
+ SDL_LoadBMP_IO
|
||||
(...)
|
||||
@@
|
||||
@@
|
||||
- SDL_LoadWAV_RW
|
||||
+ SDL_LoadWAV_IO
|
||||
(...)
|
||||
@@
|
||||
@@
|
||||
- SDL_SaveBMP_RW
|
||||
+ SDL_SaveBMP_IO
|
||||
(...)
|
||||
@@
|
||||
@@
|
||||
- SDL_RWFromFile
|
||||
+ SDL_IOFromFile
|
||||
(...)
|
||||
@@
|
||||
@@
|
||||
- SDL_RWFromMem
|
||||
+ SDL_IOFromMem
|
||||
(...)
|
||||
@@
|
||||
@@
|
||||
- SDL_RWFromConstMem
|
||||
+ SDL_IOFromConstMem
|
||||
(...)
|
||||
@@
|
||||
typedef SDL_RWops, SDL_IOStream;
|
||||
@@
|
||||
- SDL_RWops
|
||||
+ SDL_IOStream
|
||||
|
|
|
@ -301,7 +301,7 @@ Your game probably has data files. Here's how to access them.
|
|||
Filesystem access works like a Unix filesystem; you have a single directory
|
||||
tree, possibly interpolated from several mounted locations, no drive letters,
|
||||
'/' for a path separator. You can access them with standard file APIs like
|
||||
open() or fopen() or SDL_RWops. You can read or write from the filesystem.
|
||||
open() or fopen() or SDL_IOStream. You can read or write from the filesystem.
|
||||
|
||||
By default, you probably have a "MEMFS" filesystem (all files are stored in
|
||||
memory, but access to them is immediate and doesn't need to block). There are
|
||||
|
|
|
@ -191,7 +191,7 @@ SDL_FreeWAV has been removed and calls can be replaced with SDL_free.
|
|||
|
||||
SDL_LoadWAV() is a proper function now and no longer a macro (but offers the same functionality otherwise).
|
||||
|
||||
SDL_LoadWAV_RW() and SDL_LoadWAV() return an int now: zero on success, -1 on error, like most of SDL. They no longer return a pointer to an SDL_AudioSpec.
|
||||
SDL_LoadWAV_IO() and SDL_LoadWAV() return an int now: zero on success, -1 on error, like most of SDL. They no longer return a pointer to an SDL_AudioSpec.
|
||||
|
||||
SDL_AudioCVT interface has been removed, the SDL_AudioStream interface (for audio supplied in pieces) or the new SDL_ConvertAudioSamples() function (for converting a complete audio buffer in one call) can be used instead.
|
||||
|
||||
|
@ -253,6 +253,7 @@ The following functions have been renamed:
|
|||
* SDL_AudioStreamGet() => SDL_GetAudioStreamData()
|
||||
* SDL_AudioStreamPut() => SDL_PutAudioStreamData()
|
||||
* SDL_FreeAudioStream() => SDL_DestroyAudioStream()
|
||||
* SDL_LoadWAV_RW() => SDL_LoadWAV_IO()
|
||||
* SDL_NewAudioStream() => SDL_CreateAudioStream()
|
||||
|
||||
|
||||
|
@ -1152,80 +1153,79 @@ The following symbols have been renamed:
|
|||
## SDL_rwops.h
|
||||
|
||||
The following symbols have been renamed:
|
||||
* RW_SEEK_CUR => SDL_RW_SEEK_CUR
|
||||
* RW_SEEK_END => SDL_RW_SEEK_END
|
||||
* RW_SEEK_SET => SDL_RW_SEEK_SET
|
||||
* RW_SEEK_CUR => SDL_IO_SEEK_CUR
|
||||
* RW_SEEK_END => SDL_IO_SEEK_END
|
||||
* RW_SEEK_SET => SDL_IO_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_OpenRW and provide the function pointers through there. To call into a RWops's functionality, use the standard APIs (SDL_ReadRW, etc) instead of calling into function pointers directly.
|
||||
SDL_RWops is now an opaque structure, and has been renamed to SDL_IOStream. The SDL3 APIs to create an SDL_IOStream (SDL_IOFromFile, etc) are renamed but otherwise still function as they did in SDL2. However, to make a custom SDL_IOStream with app-provided function pointers, call SDL_OpenIO and provide the function pointers through there. To call into an SDL_IOStream's functionality, use the standard APIs (SDL_ReadIO, etc), as the function pointers are concealed.
|
||||
|
||||
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.
|
||||
The RWops function pointers are now in a separate structure called SDL_IOStreamInterface, which is provided to SDL_OpenIO when creating a custom SDL_IOStream implementation. All the functions now take a `void *` userdata argument for their first parameter instead of an SDL_IOStream, since that's now an opaque structure.
|
||||
|
||||
SDL_RWread and SDL_RWwrite (and the read and write function pointers) have a different function signature in SDL3 in addition to being renamed.
|
||||
SDL_RWread and SDL_RWwrite (and the read and write function pointers) have a different function signature in SDL3, in addition to being renamed.
|
||||
|
||||
Previously they looked more like stdio:
|
||||
|
||||
```c
|
||||
size_t SDL_RWread(SDL_RWops *context, void *ptr, size_t size, size_t maxnum);
|
||||
size_t SDL_RWwrite(SDL_RWops *context, const void *ptr, size_t size, size_t maxnum);
|
||||
size_t SDL_RWread(SDL_IOStream *context, void *ptr, size_t size, size_t maxnum);
|
||||
size_t SDL_RWwrite(SDL_IOStream *context, const void *ptr, size_t size, size_t maxnum);
|
||||
```
|
||||
|
||||
But now they look more like POSIX:
|
||||
|
||||
```c
|
||||
size_t SDL_ReadRW(void *userdata, void *ptr, size_t size);
|
||||
size_t SDL_WriteRW(void *userdata, const void *ptr, size_t size);
|
||||
size_t SDL_ReadIO(void *userdata, void *ptr, size_t size);
|
||||
size_t SDL_WriteIO(void *userdata, const void *ptr, size_t size);
|
||||
```
|
||||
|
||||
Code that used to look like this:
|
||||
```c
|
||||
size_t custom_read(void *ptr, size_t size, size_t nitems, SDL_RWops *stream)
|
||||
size_t custom_read(void *ptr, size_t size, size_t nitems, SDL_IOStream *stream)
|
||||
{
|
||||
return SDL_RWread(stream, ptr, size, nitems);
|
||||
}
|
||||
```
|
||||
should be changed to:
|
||||
```c
|
||||
size_t custom_read(void *ptr, size_t size, size_t nitems, SDL_RWops *stream)
|
||||
size_t custom_read(void *ptr, size_t size, size_t nitems, SDL_IOStream *stream, SDL_IOStatus *status)
|
||||
{
|
||||
if (size > 0 && nitems > 0) {
|
||||
return SDL_ReadRW(stream, ptr, size * nitems) / size;
|
||||
return SDL_ReadIO(stream, ptr, size * nitems) / size;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
```
|
||||
|
||||
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_IOStream::type was removed; it wasn't meaningful for app-provided implementations at all, and wasn't much use for SDL's internal implementations, either. If you _have_ to identify the type, you can examine the SDL_IOStream's properties to detect built-in implementations.
|
||||
|
||||
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_IOStreamInterface::close implementations should clean up their own userdata, but not call SDL_CloseIO on themselves; now the contract is always that SDL_CloseIO is called, which calls `->close` before freeing the opaque object.
|
||||
|
||||
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_OpenIO() and SDL_CloseIO().
|
||||
|
||||
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_CloseRW() 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:
|
||||
```c
|
||||
#include <stdio.h>
|
||||
|
||||
typedef struct RWopsStdioFPData
|
||||
typedef struct IOStreamStdioFPData
|
||||
{
|
||||
FILE *fp;
|
||||
SDL_bool autoclose;
|
||||
} RWopsStdioFPData;
|
||||
} IOStreamStdioFPData;
|
||||
|
||||
static Sint64 SDLCALL stdio_seek(void *userdata, Sint64 offset, int whence)
|
||||
{
|
||||
FILE *fp = ((RWopsStdioFPData *) userdata)->fp;
|
||||
FILE *fp = ((IOStreamStdioFPData *) userdata)->fp;
|
||||
int stdiowhence;
|
||||
|
||||
switch (whence) {
|
||||
case SDL_RW_SEEK_SET:
|
||||
case SDL_IO_SEEK_SET:
|
||||
stdiowhence = SEEK_SET;
|
||||
break;
|
||||
case SDL_RW_SEEK_CUR:
|
||||
case SDL_IO_SEEK_CUR:
|
||||
stdiowhence = SEEK_CUR;
|
||||
break;
|
||||
case SDL_RW_SEEK_END:
|
||||
case SDL_IO_SEEK_END:
|
||||
stdiowhence = SEEK_END;
|
||||
break;
|
||||
default:
|
||||
|
@ -1242,9 +1242,9 @@ static Sint64 SDLCALL stdio_seek(void *userdata, Sint64 offset, int whence)
|
|||
return SDL_Error(SDL_EFSEEK);
|
||||
}
|
||||
|
||||
static size_t SDLCALL stdio_read(void *userdata, void *ptr, size_t size)
|
||||
static size_t SDLCALL stdio_read(void *userdata, void *ptr, size_t size, SDL_IOStatus *status)
|
||||
{
|
||||
FILE *fp = ((RWopsStdioFPData *) userdata)->fp;
|
||||
FILE *fp = ((IOStreamStdioFPData *) userdata)->fp;
|
||||
const size_t bytes = fread(ptr, 1, size, fp);
|
||||
if (bytes == 0 && ferror(fp)) {
|
||||
SDL_Error(SDL_EFREAD);
|
||||
|
@ -1252,9 +1252,9 @@ static size_t SDLCALL stdio_read(void *userdata, void *ptr, size_t size)
|
|||
return bytes;
|
||||
}
|
||||
|
||||
static size_t SDLCALL stdio_write(void *userdata, const void *ptr, size_t size)
|
||||
static size_t SDLCALL stdio_write(void *userdata, const void *ptr, size_t size, SDL_IOStatus *status)
|
||||
{
|
||||
FILE *fp = ((RWopsStdioFPData *) userdata)->fp;
|
||||
FILE *fp = ((IOStreamStdioFPData *) userdata)->fp;
|
||||
const size_t bytes = fwrite(ptr, 1, size, fp);
|
||||
if (bytes == 0 && ferror(fp)) {
|
||||
SDL_Error(SDL_EFWRITE);
|
||||
|
@ -1264,7 +1264,7 @@ static size_t SDLCALL stdio_write(void *userdata, const void *ptr, size_t size)
|
|||
|
||||
static int SDLCALL stdio_close(void *userdata)
|
||||
{
|
||||
RWopsStdioData *rwopsdata = (RWopsStdioData *) userdata;
|
||||
IOStreamStdioData *rwopsdata = (IOStreamStdioData *) userdata;
|
||||
int status = 0;
|
||||
if (rwopsdata->autoclose) {
|
||||
if (fclose(rwopsdata->fp) != 0) {
|
||||
|
@ -1274,19 +1274,19 @@ static int SDLCALL stdio_close(void *userdata)
|
|||
return status;
|
||||
}
|
||||
|
||||
SDL_RWops *SDL_RWFromFP(FILE *fp, SDL_bool autoclose)
|
||||
SDL_IOStream *SDL_RWFromFP(FILE *fp, SDL_bool autoclose)
|
||||
{
|
||||
SDL_RWopsInterface iface;
|
||||
RWopsStdioFPData *rwopsdata;
|
||||
SDL_RWops *rwops;
|
||||
SDL_IOStreamInterface iface;
|
||||
IOStreamStdioFPData *rwopsdata;
|
||||
SDL_IOStream *rwops;
|
||||
|
||||
rwopsdata = (RWopsStdioFPData *) SDL_malloc(sizeof (*rwopsdata));
|
||||
rwopsdata = (IOStreamStdioFPData *) SDL_malloc(sizeof (*rwopsdata));
|
||||
if (!rwopsdata) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
SDL_zero(iface);
|
||||
/* There's no stdio_size because SDL_SizeRW emulates it the same way we'd do it for stdio anyhow. */
|
||||
/* There's no stdio_size because SDL_SizeIO emulates it the same way we'd do it for stdio anyhow. */
|
||||
iface.seek = stdio_seek;
|
||||
iface.read = stdio_read;
|
||||
iface.write = stdio_write;
|
||||
|
@ -1295,7 +1295,7 @@ SDL_RWops *SDL_RWFromFP(FILE *fp, SDL_bool autoclose)
|
|||
rwopsdata->fp = fp;
|
||||
rwopsdata->autoclose = autoclose;
|
||||
|
||||
rwops = SDL_OpenRW(&iface, rwopsdata);
|
||||
rwops = SDL_OpenIO(&iface, rwopsdata);
|
||||
if (!rwops) {
|
||||
iface.close(rwopsdata);
|
||||
}
|
||||
|
@ -1303,15 +1303,22 @@ SDL_RWops *SDL_RWFromFP(FILE *fp, SDL_bool autoclose)
|
|||
}
|
||||
```
|
||||
|
||||
The internal `FILE *` is available through a standard SDL_IOStream property, for streams made through SDL_IOFromFile() that use stdio behind the scenes; apps use this pointer at their own risk and should make sure that SDL and the app are using the same C runtime.
|
||||
|
||||
|
||||
The functions SDL_ReadU8(), SDL_ReadU16LE(), SDL_ReadU16BE(), SDL_ReadU32LE(), SDL_ReadU32BE(), SDL_ReadU64LE(), and SDL_ReadU64BE() now return SDL_TRUE if the read succeeded and SDL_FALSE if it didn't, and store the data in a pointer passed in as a parameter.
|
||||
|
||||
The following functions have been renamed:
|
||||
* SDL_RWclose() => SDL_CloseRW()
|
||||
* SDL_RWread() => SDL_ReadRW()
|
||||
* SDL_RWseek() => SDL_SeekRW()
|
||||
* SDL_RWsize() => SDL_SizeRW()
|
||||
* SDL_RWtell() => SDL_TellRW()
|
||||
* SDL_RWwrite() => SDL_WriteRW()
|
||||
* SDL_CloseRW() => SDL_CloseIO()
|
||||
* SDL_RWFromConstMem() => SDL_IOFromConstMem()
|
||||
* SDL_RWFromFile() => SDL_IOFromFile()
|
||||
* SDL_RWFromMem() => SDL_IOFromMem()
|
||||
* SDL_RWclose() => SDL_CloseIO()
|
||||
* SDL_RWread() => SDL_ReadIO()
|
||||
* SDL_RWseek() => SDL_SeekIO()
|
||||
* SDL_RWsize() => SDL_SizeIO()
|
||||
* SDL_RWtell() => SDL_TellIO()
|
||||
* SDL_RWwrite() => SDL_WriteIO()
|
||||
* SDL_ReadBE16() => SDL_ReadU16BE()
|
||||
* SDL_ReadBE32() => SDL_ReadU32BE()
|
||||
* SDL_ReadBE64() => SDL_ReadU64BE()
|
||||
|
@ -1325,6 +1332,10 @@ The following functions have been renamed:
|
|||
* SDL_WriteLE32() => SDL_WriteU32LE()
|
||||
* SDL_WriteLE64() => SDL_WriteU64LE()
|
||||
|
||||
|
||||
The following structures have been renamed:
|
||||
* SDL_RWops => SDL_IOStream
|
||||
|
||||
## SDL_sensor.h
|
||||
|
||||
SDL_SensorID has changed from Sint32 to Uint32, with an invalid ID being 0.
|
||||
|
@ -1448,8 +1459,10 @@ The following functions have been renamed:
|
|||
* SDL_GetColorKey() => SDL_GetSurfaceColorKey()
|
||||
* SDL_HasColorKey() => SDL_SurfaceHasColorKey()
|
||||
* SDL_HasSurfaceRLE() => SDL_SurfaceHasRLE()
|
||||
* SDL_LoadBMP_RW() => SDL_LoadBMP_IO()
|
||||
* SDL_LowerBlit() => SDL_BlitSurfaceUnchecked()
|
||||
* SDL_LowerBlitScaled() => SDL_BlitSurfaceUncheckedScaled()
|
||||
* SDL_SaveBMP_RW() => SDL_SaveBMP_IO()
|
||||
* SDL_SetClipRect() => SDL_SetSurfaceClipRect()
|
||||
* SDL_SetColorKey() => SDL_SetSurfaceColorKey()
|
||||
* SDL_UpperBlit() => SDL_BlitSurface()
|
||||
|
|
|
@ -42,7 +42,7 @@ Here is a rough list of what works, and what doesn't:
|
|||
* threads
|
||||
* timers (via SDL_GetTicks(), SDL_AddTimer(), SDL_GetPerformanceCounter(),
|
||||
SDL_GetPerformanceFrequency(), etc.)
|
||||
* file I/O via SDL_RWops
|
||||
* file I/O via SDL_IOStream
|
||||
* mouse input (unsupported on Windows Phone)
|
||||
* audio, via SDL's WASAPI backend (if you want to record, your app must
|
||||
have "Microphone" capabilities enabled in its manifest, and the user must
|
||||
|
|
|
@ -1306,7 +1306,7 @@ extern DECLSPEC int SDLCALL SDL_SetAudioPostmixCallback(SDL_AudioDeviceID devid,
|
|||
* Example:
|
||||
*
|
||||
* ```c
|
||||
* SDL_LoadWAV_RW(SDL_RWFromFile("sample.wav", "rb"), 1, &spec, &buf, &len);
|
||||
* SDL_LoadWAV_IO(SDL_IOFromFile("sample.wav", "rb"), 1, &spec, &buf, &len);
|
||||
* ```
|
||||
*
|
||||
* Note that the SDL_LoadWAV function does this same thing for you, but in a
|
||||
|
@ -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_CloseRW() on `src` before returning,
|
||||
* \param freesrc If SDL_TRUE, calls SDL_CloseIO() 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
|
||||
|
@ -1344,7 +1344,7 @@ extern DECLSPEC int SDLCALL SDL_SetAudioPostmixCallback(SDL_AudioDeviceID devid,
|
|||
* \sa SDL_free
|
||||
* \sa SDL_LoadWAV
|
||||
*/
|
||||
extern DECLSPEC int SDLCALL SDL_LoadWAV_RW(SDL_RWops * src, SDL_bool freesrc,
|
||||
extern DECLSPEC int SDLCALL SDL_LoadWAV_IO(SDL_IOStream * src, SDL_bool freesrc,
|
||||
SDL_AudioSpec * spec, Uint8 ** audio_buf,
|
||||
Uint32 * audio_len);
|
||||
|
||||
|
@ -1354,7 +1354,7 @@ extern DECLSPEC int SDLCALL SDL_LoadWAV_RW(SDL_RWops * src, SDL_bool freesrc,
|
|||
* This is a convenience function that is effectively the same as:
|
||||
*
|
||||
* ```c
|
||||
* SDL_LoadWAV_RW(SDL_RWFromFile(path, "rb"), 1, spec, audio_buf, audio_len);
|
||||
* SDL_LoadWAV_IO(SDL_IOFromFile(path, "rb"), 1, spec, audio_buf, audio_len);
|
||||
* ```
|
||||
*
|
||||
* Note that in SDL2, this was a preprocessor macro and not a real function.
|
||||
|
@ -1383,7 +1383,7 @@ extern DECLSPEC int SDLCALL SDL_LoadWAV_RW(SDL_RWops * src, SDL_bool freesrc,
|
|||
* \since This function is available since SDL 3.0.0.
|
||||
*
|
||||
* \sa SDL_free
|
||||
* \sa SDL_LoadWAV_RW
|
||||
* \sa SDL_LoadWAV_IO
|
||||
*/
|
||||
extern DECLSPEC int SDLCALL SDL_LoadWAV(const char *path, SDL_AudioSpec * spec,
|
||||
Uint8 ** audio_buf, Uint32 * audio_len);
|
||||
|
|
|
@ -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_CloseRW() on `src` before returning,
|
||||
* \param freesrc if SDL_TRUE, calls SDL_CloseIO() 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.
|
||||
|
@ -279,7 +279,7 @@ extern DECLSPEC int SDLCALL SDL_AddGamepadMapping(const char *mapping);
|
|||
* \sa SDL_AddGamepadMappingsFromFile
|
||||
* \sa SDL_GetGamepadMappingForGUID
|
||||
*/
|
||||
extern DECLSPEC int SDLCALL SDL_AddGamepadMappingsFromRW(SDL_RWops *src, SDL_bool freesrc);
|
||||
extern DECLSPEC int SDLCALL SDL_AddGamepadMappingsFromRW(SDL_IOStream *src, SDL_bool freesrc);
|
||||
|
||||
/**
|
||||
* Load a set of gamepad mappings from a file.
|
||||
|
|
|
@ -2261,7 +2261,7 @@ extern "C" {
|
|||
* "ignorezero" - Like "truncate", but ignore fact chunk if the number of samples is zero.
|
||||
* "ignore" - Ignore fact chunk entirely. (default)
|
||||
*
|
||||
* This hint should be set before calling SDL_LoadWAV() or SDL_LoadWAV_RW()
|
||||
* This hint should be set before calling SDL_LoadWAV() or SDL_LoadWAV_IO()
|
||||
*/
|
||||
#define SDL_HINT_WAVE_FACT_CHUNK "SDL_WAVE_FACT_CHUNK"
|
||||
|
||||
|
@ -2278,7 +2278,7 @@ extern "C" {
|
|||
* "ignore" - Ignore the RIFF chunk size and always search up to 4 GiB.
|
||||
* "maximum" - Search for chunks until the end of file. (not recommended)
|
||||
*
|
||||
* This hint should be set before calling SDL_LoadWAV() or SDL_LoadWAV_RW()
|
||||
* This hint should be set before calling SDL_LoadWAV() or SDL_LoadWAV_IO()
|
||||
*/
|
||||
#define SDL_HINT_WAVE_RIFF_CHUNK_SIZE "SDL_WAVE_RIFF_CHUNK_SIZE"
|
||||
|
||||
|
@ -2293,7 +2293,7 @@ extern "C" {
|
|||
* "dropframe" - Decode until the first incomplete sample frame.
|
||||
* "dropblock" - Decode until the first incomplete block. (default)
|
||||
*
|
||||
* This hint should be set before calling SDL_LoadWAV() or SDL_LoadWAV_RW()
|
||||
* This hint should be set before calling SDL_LoadWAV() or SDL_LoadWAV_IO()
|
||||
*/
|
||||
#define SDL_HINT_WAVE_TRUNCATION "SDL_WAVE_TRUNCATION"
|
||||
|
||||
|
|
|
@ -70,7 +70,7 @@ typedef enum
|
|||
* two may be used interchangeably. Though for readability of your code
|
||||
* SDL_InitSubSystem() might be preferred.
|
||||
*
|
||||
* The file I/O (for example: SDL_RWFromFile) and threading (SDL_CreateThread)
|
||||
* The file I/O (for example: SDL_IOFromFile) and threading (SDL_CreateThread)
|
||||
* subsystems are initialized by default. Message boxes
|
||||
* (SDL_ShowSimpleMessageBox) also attempt to work without initializing the
|
||||
* video subsystem, in hopes of being useful in showing an error dialog when
|
||||
|
|
|
@ -69,6 +69,7 @@
|
|||
#define SDL_AudioStreamPut SDL_PutAudioStreamData
|
||||
#define SDL_FreeAudioStream SDL_DestroyAudioStream
|
||||
#define SDL_FreeWAV SDL_free
|
||||
#define SDL_LoadWAV_RW SDL_LoadWAV_IO
|
||||
#define SDL_NewAudioStream SDL_CreateAudioStream
|
||||
|
||||
/* ##SDL_events.h */
|
||||
|
@ -449,15 +450,19 @@
|
|||
#define SDL_ScaleModeNearest SDL_SCALEMODE_NEAREST
|
||||
|
||||
/* ##SDL_rwops.h */
|
||||
#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_RWclose SDL_CloseRW
|
||||
#define SDL_RWread SDL_ReadRW
|
||||
#define SDL_RWseek SDL_SeekRW
|
||||
#define SDL_RWsize SDL_SizeRW
|
||||
#define SDL_RWtell SDL_TellRW
|
||||
#define SDL_RWwrite SDL_WriteRW
|
||||
#define RW_SEEK_CUR SDL_IO_SEEK_CUR
|
||||
#define RW_SEEK_END SDL_IO_SEEK_END
|
||||
#define RW_SEEK_SET SDL_IO_SEEK_SET
|
||||
#define SDL_RWFromConstMem SDL_IOFromConstMem
|
||||
#define SDL_RWFromFile SDL_IOFromFile
|
||||
#define SDL_RWFromMem SDL_IOFromMem
|
||||
#define SDL_RWclose SDL_CloseIO
|
||||
#define SDL_RWops SDL_IOStream
|
||||
#define SDL_RWread SDL_ReadIO
|
||||
#define SDL_RWseek SDL_SeekIO
|
||||
#define SDL_RWsize SDL_SizeIO
|
||||
#define SDL_RWtell SDL_TellIO
|
||||
#define SDL_RWwrite SDL_WriteIO
|
||||
#define SDL_ReadBE16 SDL_ReadU16BE
|
||||
#define SDL_ReadBE32 SDL_ReadU32BE
|
||||
#define SDL_ReadBE64 SDL_ReadU64BE
|
||||
|
@ -493,8 +498,10 @@
|
|||
#define SDL_GetColorKey SDL_GetSurfaceColorKey
|
||||
#define SDL_HasColorKey SDL_SurfaceHasColorKey
|
||||
#define SDL_HasSurfaceRLE SDL_SurfaceHasRLE
|
||||
#define SDL_LoadBMP_RW SDL_LoadBMP_IO
|
||||
#define SDL_LowerBlit SDL_BlitSurfaceUnchecked
|
||||
#define SDL_LowerBlitScaled SDL_BlitSurfaceUncheckedScaled
|
||||
#define SDL_SaveBMP_RW SDL_SaveBMP_IO
|
||||
#define SDL_SetClipRect SDL_SetSurfaceClipRect
|
||||
#define SDL_SetColorKey SDL_SetSurfaceColorKey
|
||||
#define SDL_UpperBlit SDL_BlitSurface
|
||||
|
@ -558,6 +565,7 @@
|
|||
#define SDL_AudioStreamPut SDL_AudioStreamPut_renamed_SDL_PutAudioStreamData
|
||||
#define SDL_FreeAudioStream SDL_FreeAudioStream_renamed_SDL_DestroyAudioStream
|
||||
#define SDL_FreeWAV SDL_FreeWAV_renamed_SDL_free
|
||||
#define SDL_LoadWAV_RW SDL_LoadWAV_RW_renamed_SDL_LoadWAV_IO
|
||||
#define SDL_NewAudioStream SDL_NewAudioStream_renamed_SDL_CreateAudioStream
|
||||
|
||||
/* ##SDL_events.h */
|
||||
|
@ -939,15 +947,19 @@
|
|||
#define SDL_ScaleModeNearest SDL_ScaleModeNearest_renamed_SDL_SCALEMODE_NEAREST
|
||||
|
||||
/* ##SDL_rwops.h */
|
||||
#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_RWclose SDL_RWclose_renamed_SDL_CloseRW
|
||||
#define SDL_RWread SDL_RWread_renamed_SDL_ReadRW
|
||||
#define SDL_RWseek SDL_RWseek_renamed_SDL_SeekRW
|
||||
#define SDL_RWsize SDL_RWsize_renamed_SDL_SizeRW
|
||||
#define SDL_RWtell SDL_RWtell_renamed_SDL_TellRW
|
||||
#define SDL_RWwrite SDL_RWwrite_renamed_SDL_WriteRW
|
||||
#define RW_SEEK_CUR RW_SEEK_CUR_renamed_SDL_IO_SEEK_CUR
|
||||
#define RW_SEEK_END RW_SEEK_END_renamed_SDL_IO_SEEK_END
|
||||
#define RW_SEEK_SET RW_SEEK_SET_renamed_SDL_IO_SEEK_SET
|
||||
#define SDL_RWFromConstMem SDL_RWFromConstMem_renamed_SDL_IOFromConstMem
|
||||
#define SDL_RWFromFile SDL_RWFromFile_renamed_SDL_IOFromFile
|
||||
#define SDL_RWFromMem SDL_RWFromMem_renamed_SDL_IOFromMem
|
||||
#define SDL_RWclose SDL_RWclose_renamed_SDL_CloseIO
|
||||
#define SDL_RWops SDL_RWops_renamed_SDL_IOStream
|
||||
#define SDL_RWread SDL_RWread_renamed_SDL_ReadIO
|
||||
#define SDL_RWseek SDL_RWseek_renamed_SDL_SeekIO
|
||||
#define SDL_RWsize SDL_RWsize_renamed_SDL_SizeIO
|
||||
#define SDL_RWtell SDL_RWtell_renamed_SDL_TellIO
|
||||
#define SDL_RWwrite SDL_RWwrite_renamed_SDL_WriteIO
|
||||
#define SDL_ReadBE16 SDL_ReadBE16_renamed_SDL_ReadU16BE
|
||||
#define SDL_ReadBE32 SDL_ReadBE32_renamed_SDL_ReadU32BE
|
||||
#define SDL_ReadBE64 SDL_ReadBE64_renamed_SDL_ReadU64BE
|
||||
|
@ -983,8 +995,10 @@
|
|||
#define SDL_GetColorKey SDL_GetColorKey_renamed_SDL_GetSurfaceColorKey
|
||||
#define SDL_HasColorKey SDL_HasColorKey_renamed_SDL_SurfaceHasColorKey
|
||||
#define SDL_HasSurfaceRLE SDL_HasSurfaceRLE_renamed_SDL_SurfaceHasRLE
|
||||
#define SDL_LoadBMP_RW SDL_LoadBMP_RW_renamed_SDL_LoadBMP_IO
|
||||
#define SDL_LowerBlit SDL_LowerBlit_renamed_SDL_BlitSurfaceUnchecked
|
||||
#define SDL_LowerBlitScaled SDL_LowerBlitScaled_renamed_SDL_BlitSurfaceUncheckedScaled
|
||||
#define SDL_SaveBMP_RW SDL_SaveBMP_RW_renamed_SDL_SaveBMP_IO
|
||||
#define SDL_SetClipRect SDL_SetClipRect_renamed_SDL_SetSurfaceClipRect
|
||||
#define SDL_SetColorKey SDL_SetColorKey_renamed_SDL_SetSurfaceColorKey
|
||||
#define SDL_UpperBlit SDL_UpperBlit_renamed_SDL_BlitSurface
|
||||
|
|
|
@ -39,21 +39,21 @@
|
|||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* RWops status, set by a read or write operation */
|
||||
typedef enum SDL_RWopsStatus
|
||||
/* SDL_IOStream status, set by a read or write operation */
|
||||
typedef enum SDL_IOStatus
|
||||
{
|
||||
SDL_RWOPS_STATUS_READY, /**< Everything is ready */
|
||||
SDL_RWOPS_STATUS_ERROR, /**< Read or write I/O error */
|
||||
SDL_RWOPS_STATUS_EOF, /**< End of file */
|
||||
SDL_RWOPS_STATUS_NOT_READY, /**< Non blocking I/O, not ready */
|
||||
SDL_RWOPS_STATUS_READONLY, /**< Tried to write a read-only buffer */
|
||||
SDL_RWOPS_STATUS_WRITEONLY /**< Tried to read a write-only buffer */
|
||||
} SDL_RWopsStatus;
|
||||
SDL_IO_STATUS_READY, /**< Everything is ready */
|
||||
SDL_IO_STATUS_ERROR, /**< Read or write I/O error */
|
||||
SDL_IO_STATUS_EOF, /**< End of file */
|
||||
SDL_IO_STATUS_NOT_READY, /**< Non blocking I/O, not ready */
|
||||
SDL_IO_STATUS_READONLY, /**< Tried to write a read-only buffer */
|
||||
SDL_IO_STATUS_WRITEONLY /**< Tried to read a write-only buffer */
|
||||
} SDL_IOStatus;
|
||||
|
||||
typedef struct SDL_RWopsInterface
|
||||
typedef struct SDL_IOStreamInterface
|
||||
{
|
||||
/**
|
||||
* Return the number of bytes in this rwops
|
||||
* Return the number of bytes in this SDL_IOStream
|
||||
*
|
||||
* \return the total size of the data stream, or -1 on error.
|
||||
*/
|
||||
|
@ -61,7 +61,7 @@ typedef struct SDL_RWopsInterface
|
|||
|
||||
/**
|
||||
* Seek to \c offset relative to \c whence, one of stdio's whence values:
|
||||
* SDL_RW_SEEK_SET, SDL_RW_SEEK_CUR, SDL_RW_SEEK_END
|
||||
* SDL_IO_SEEK_SET, SDL_IO_SEEK_CUR, SDL_IO_SEEK_END
|
||||
*
|
||||
* \return the final offset in the data stream, or -1 on error.
|
||||
*/
|
||||
|
@ -72,52 +72,52 @@ typedef struct SDL_RWopsInterface
|
|||
* at by \c ptr.
|
||||
*
|
||||
* On an incomplete read, you should set `*status` to a value from the
|
||||
* SDL_RWopsStatus enum. You do not have to explicitly set this on
|
||||
* SDL_IOStatus enum. You do not have to explicitly set this on
|
||||
* a complete, successful read.
|
||||
*
|
||||
* \return the number of bytes read
|
||||
*/
|
||||
size_t (SDLCALL *read)(void *userdata, void *ptr, size_t size, SDL_RWopsStatus *status);
|
||||
size_t (SDLCALL *read)(void *userdata, void *ptr, size_t size, SDL_IOStatus *status);
|
||||
|
||||
/**
|
||||
* Write exactly \c size bytes from the area pointed at by \c ptr
|
||||
* to data stream.
|
||||
*
|
||||
* On an incomplete write, you should set `*status` to a value from the
|
||||
* SDL_RWopsStatus enum. You do not have to explicitly set this on
|
||||
* SDL_IOStatus enum. You do not have to explicitly set this on
|
||||
* a complete, successful write.
|
||||
*
|
||||
* \return the number of bytes written
|
||||
*/
|
||||
size_t (SDLCALL *write)(void *userdata, const void *ptr, size_t size, SDL_RWopsStatus *status);
|
||||
size_t (SDLCALL *write)(void *userdata, const void *ptr, size_t size, SDL_IOStatus *status);
|
||||
|
||||
/**
|
||||
* Close and free any allocated resources.
|
||||
*
|
||||
* The RWops is still destroyed even if this fails, so clean up anything
|
||||
* The SDL_IOStream is still destroyed even if this fails, so clean up anything
|
||||
* even if flushing to disk returns an error.
|
||||
*
|
||||
* \return 0 if successful or -1 on write error when flushing data.
|
||||
*/
|
||||
int (SDLCALL *close)(void *userdata);
|
||||
} SDL_RWopsInterface;
|
||||
} SDL_IOStreamInterface;
|
||||
|
||||
|
||||
/**
|
||||
* This is the read/write operation structure -- opaque, as of SDL3!
|
||||
*/
|
||||
typedef struct SDL_RWops SDL_RWops;
|
||||
typedef struct SDL_IOStream SDL_IOStream;
|
||||
|
||||
|
||||
/**
|
||||
* \name RWFrom functions
|
||||
* \name IOFrom functions
|
||||
*
|
||||
* Functions to create SDL_RWops structures from various data streams.
|
||||
* Functions to create SDL_IOStream structures from various data streams.
|
||||
*/
|
||||
/* @{ */
|
||||
|
||||
/**
|
||||
* Use this function to create a new SDL_RWops structure for reading from
|
||||
* Use this function to create a new SDL_IOStream structure for reading from
|
||||
* and/or writing to a named file.
|
||||
*
|
||||
* The `mode` string is treated roughly the same as in a call to the C
|
||||
|
@ -155,168 +155,168 @@ typedef struct SDL_RWops SDL_RWops;
|
|||
* This function supports Unicode filenames, but they must be encoded in UTF-8
|
||||
* format, regardless of the underlying operating system.
|
||||
*
|
||||
* As a fallback, SDL_RWFromFile() will transparently open a matching filename
|
||||
* As a fallback, SDL_IOFromFile() will transparently open a matching filename
|
||||
* in an Android app's `assets`.
|
||||
*
|
||||
* Destroying the SDL_RWops will close the file handle SDL is holding internally.
|
||||
* Destroying the SDL_IOStream will close the file handle SDL is holding internally.
|
||||
*
|
||||
* The following properties may be set at creation time by SDL:
|
||||
*
|
||||
* - `SDL_PROP_RWOPS_WINDOWS_HANDLE_POINTER`: a pointer, that can be cast
|
||||
* to a win32 `HANDLE`, that this RWops is using to access the filesystem.
|
||||
* - `SDL_PROP_IOSTREAM_WINDOWS_HANDLE_POINTER`: a pointer, that can be cast
|
||||
* to a win32 `HANDLE`, that this SDL_IOStream is using to access the filesystem.
|
||||
* If the program isn't running on Windows, or SDL used some other method
|
||||
* to access the filesystem, this property will not be set.
|
||||
* - `SDL_PROP_RWOPS_STDIO_HANDLE_POINTER`: a pointer, that can be cast
|
||||
* to a stdio `FILE *`, that this RWops is using to access the filesystem.
|
||||
* - `SDL_PROP_IOSTREAM_STDIO_HANDLE_POINTER`: a pointer, that can be cast
|
||||
* to a stdio `FILE *`, that this SDL_IOStream is using to access the filesystem.
|
||||
* If SDL used some other method to access the filesystem, this property
|
||||
* will not be set. PLEASE NOTE that if SDL is using a different C runtime
|
||||
* than your app, trying to use this pointer will almost certainly result
|
||||
* in a crash! This is mostly a problem on Windows; make sure you build SDL
|
||||
* and your app with the same compiler and settings to avoid it.
|
||||
* - `SDL_PROP_RWOPS_ANDROID_AASSET_POINTER`: a pointer, that can be cast
|
||||
* to an Android NDK `AAsset *`, that this RWops is using to access the
|
||||
* - `SDL_PROP_IOSTREAM_ANDROID_AASSET_POINTER`: a pointer, that can be cast
|
||||
* to an Android NDK `AAsset *`, that this SDL_IOStream is using to access the
|
||||
* filesystem. If SDL used some other method to access the filesystem, this
|
||||
* property will not be set.
|
||||
*
|
||||
* \param file a UTF-8 string representing the filename to open
|
||||
* \param mode an ASCII string representing the mode to be used for opening
|
||||
* the file.
|
||||
* \returns a pointer to the SDL_RWops structure that is created, or NULL on
|
||||
* \returns a pointer to the SDL_IOStream structure that is created, or NULL on
|
||||
* failure; call SDL_GetError() for more information.
|
||||
*
|
||||
* \since This function is available since SDL 3.0.0.
|
||||
*
|
||||
* \sa SDL_RWFromConstMem
|
||||
* \sa SDL_RWFromMem
|
||||
* \sa SDL_ReadRW
|
||||
* \sa SDL_SeekRW
|
||||
* \sa SDL_TellRW
|
||||
* \sa SDL_WriteRW
|
||||
* \sa SDL_IOFromConstMem
|
||||
* \sa SDL_IOFromMem
|
||||
* \sa SDL_ReadIO
|
||||
* \sa SDL_SeekIO
|
||||
* \sa SDL_TellIO
|
||||
* \sa SDL_WriteIO
|
||||
*/
|
||||
extern DECLSPEC SDL_RWops *SDLCALL SDL_RWFromFile(const char *file, const char *mode);
|
||||
extern DECLSPEC SDL_IOStream *SDLCALL SDL_IOFromFile(const char *file, const char *mode);
|
||||
|
||||
#define SDL_PROP_RWOPS_WINDOWS_HANDLE_POINTER "SDL.rwops.windows.handle"
|
||||
#define SDL_PROP_RWOPS_STDIO_HANDLE_POINTER "SDL.rwops.stdio.handle"
|
||||
#define SDL_PROP_RWOPS_ANDROID_AASSET_POINTER "SDL.rwops.android.aasset"
|
||||
#define SDL_PROP_IOSTREAM_WINDOWS_HANDLE_POINTER "SDL.iostream.windows.handle"
|
||||
#define SDL_PROP_IOSTREAM_STDIO_HANDLE_POINTER "SDL.iostream.stdio.handle"
|
||||
#define SDL_PROP_IOSTREAM_ANDROID_AASSET_POINTER "SDL.opstream.android.aasset"
|
||||
|
||||
/**
|
||||
* Use this function to prepare a read-write memory buffer for use with
|
||||
* SDL_RWops.
|
||||
* SDL_IOStream.
|
||||
*
|
||||
* This function sets up an SDL_RWops struct based on a memory area of a
|
||||
* This function sets up an SDL_IOStream struct based on a memory area of a
|
||||
* certain size, for both read and write access.
|
||||
*
|
||||
* This memory buffer is not copied by the RWops; the pointer you provide must
|
||||
* This memory buffer is not copied by the SDL_IOStream; the pointer you provide must
|
||||
* remain valid until you close the stream. Closing the stream will not free
|
||||
* the original buffer.
|
||||
*
|
||||
* If you need to make sure the RWops never writes to the memory buffer, you
|
||||
* should use SDL_RWFromConstMem() with a read-only buffer of memory instead.
|
||||
* If you need to make sure the SDL_IOStream never writes to the memory buffer, you
|
||||
* should use SDL_IOFromConstMem() with a read-only buffer of memory instead.
|
||||
*
|
||||
* \param mem a pointer to a buffer to feed an SDL_RWops stream
|
||||
* \param mem a pointer to a buffer to feed an SDL_IOStream stream
|
||||
* \param size the buffer size, in bytes
|
||||
* \returns a pointer to a new SDL_RWops structure, or NULL if it fails; call
|
||||
* \returns a pointer to a new SDL_IOStream structure, or NULL if it fails; call
|
||||
* SDL_GetError() for more information.
|
||||
*
|
||||
* \since This function is available since SDL 3.0.0.
|
||||
*
|
||||
* \sa SDL_RWFromConstMem
|
||||
* \sa SDL_RWFromFile
|
||||
* \sa SDL_RWFromMem
|
||||
* \sa SDL_ReadRW
|
||||
* \sa SDL_SeekRW
|
||||
* \sa SDL_TellRW
|
||||
* \sa SDL_WriteRW
|
||||
* \sa SDL_IOFromConstMem
|
||||
* \sa SDL_IOFromFile
|
||||
* \sa SDL_IOFromMem
|
||||
* \sa SDL_ReadIO
|
||||
* \sa SDL_SeekIO
|
||||
* \sa SDL_TellIO
|
||||
* \sa SDL_WriteIO
|
||||
*/
|
||||
extern DECLSPEC SDL_RWops *SDLCALL SDL_RWFromMem(void *mem, size_t size);
|
||||
extern DECLSPEC SDL_IOStream *SDLCALL SDL_IOFromMem(void *mem, size_t size);
|
||||
|
||||
/**
|
||||
* Use this function to prepare a read-only memory buffer for use with RWops.
|
||||
* Use this function to prepare a read-only memory buffer for use with SDL_IOStream.
|
||||
*
|
||||
* This function sets up an SDL_RWops struct based on a memory area of a
|
||||
* This function sets up an SDL_IOStream struct based on a memory area of a
|
||||
* certain size. It assumes the memory area is not writable.
|
||||
*
|
||||
* Attempting to write to this RWops stream will report an error without
|
||||
* Attempting to write to this SDL_IOStream stream will report an error without
|
||||
* writing to the memory buffer.
|
||||
*
|
||||
* This memory buffer is not copied by the RWops; the pointer you provide must
|
||||
* This memory buffer is not copied by the SDL_IOStream; the pointer you provide must
|
||||
* remain valid until you close the stream. Closing the stream will not free
|
||||
* the original buffer.
|
||||
*
|
||||
* If you need to write to a memory buffer, you should use SDL_RWFromMem()
|
||||
* If you need to write to a memory buffer, you should use SDL_IOFromMem()
|
||||
* with a writable buffer of memory instead.
|
||||
*
|
||||
* \param mem a pointer to a read-only buffer to feed an SDL_RWops stream
|
||||
* \param mem a pointer to a read-only buffer to feed an SDL_IOStream stream
|
||||
* \param size the buffer size, in bytes
|
||||
* \returns a pointer to a new SDL_RWops structure, or NULL if it fails; call
|
||||
* \returns a pointer to a new SDL_IOStream structure, or NULL if it fails; call
|
||||
* SDL_GetError() for more information.
|
||||
*
|
||||
* \since This function is available since SDL 3.0.0.
|
||||
*
|
||||
* \sa SDL_RWFromConstMem
|
||||
* \sa SDL_RWFromFile
|
||||
* \sa SDL_RWFromMem
|
||||
* \sa SDL_ReadRW
|
||||
* \sa SDL_SeekRW
|
||||
* \sa SDL_TellRW
|
||||
* \sa SDL_IOFromConstMem
|
||||
* \sa SDL_IOFromFile
|
||||
* \sa SDL_IOFromMem
|
||||
* \sa SDL_ReadIO
|
||||
* \sa SDL_SeekIO
|
||||
* \sa SDL_TellIO
|
||||
*/
|
||||
extern DECLSPEC SDL_RWops *SDLCALL SDL_RWFromConstMem(const void *mem, size_t size);
|
||||
extern DECLSPEC SDL_IOStream *SDLCALL SDL_IOFromConstMem(const void *mem, size_t size);
|
||||
|
||||
/* @} *//* RWFrom functions */
|
||||
/* @} *//* IOFrom functions */
|
||||
|
||||
|
||||
/**
|
||||
* Create a custom SDL_RWops.
|
||||
* Create a custom SDL_IOStream.
|
||||
*
|
||||
* 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_IOStream implementation. If you just need an SDL_IOStream to
|
||||
* 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_IOFromFile() or SDL_IOFromMem(), etc.
|
||||
*
|
||||
* You must free the returned pointer with SDL_CloseRW().
|
||||
* You must free the returned pointer with SDL_CloseIO().
|
||||
*
|
||||
*
|
||||
* \param iface The function pointers that implement this RWops.
|
||||
* \param iface The function pointers that implement this SDL_IOStream.
|
||||
* \param userdata The app-controlled pointer that is passed to iface's functions when called.
|
||||
* \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_CloseRW
|
||||
* \sa SDL_CloseIO
|
||||
*/
|
||||
extern DECLSPEC SDL_RWops *SDLCALL SDL_OpenRW(const SDL_RWopsInterface *iface, void *userdata);
|
||||
extern DECLSPEC SDL_IOStream *SDLCALL SDL_OpenIO(const SDL_IOStreamInterface *iface, void *userdata);
|
||||
|
||||
/**
|
||||
* Close and free an allocated SDL_RWops structure.
|
||||
* Close and free an allocated SDL_IOStream structure.
|
||||
*
|
||||
* 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_CloseRW(). This returns 0 on success, or -1 if the stream failed to
|
||||
* SDL_CloseIO() closes and cleans up the SDL_IOStream stream. It releases any
|
||||
* resources used by the stream and frees the SDL_IOStream itself with
|
||||
* SDL_CloseIO(). 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
|
||||
* an error, but the SDL_RWops is still invalid once this function returns.
|
||||
* an error, but the SDL_IOStream is still invalid once this function returns.
|
||||
*
|
||||
* \param context SDL_RWops structure to close
|
||||
* \param context SDL_IOStream structure to close
|
||||
* \returns 0 on success or a negative error code on failure; call
|
||||
* SDL_GetError() for more information.
|
||||
*
|
||||
* \since This function is available since SDL 3.0.0.
|
||||
*
|
||||
* \sa SDL_RWFromConstMem
|
||||
* \sa SDL_RWFromFile
|
||||
* \sa SDL_RWFromMem
|
||||
* \sa SDL_ReadRW
|
||||
* \sa SDL_SeekRW
|
||||
* \sa SDL_WriteRW
|
||||
* \sa SDL_IOFromConstMem
|
||||
* \sa SDL_IOFromFile
|
||||
* \sa SDL_IOFromMem
|
||||
* \sa SDL_ReadIO
|
||||
* \sa SDL_SeekIO
|
||||
* \sa SDL_WriteIO
|
||||
*/
|
||||
extern DECLSPEC int SDLCALL SDL_CloseRW(SDL_RWops *context);
|
||||
extern DECLSPEC int SDLCALL SDL_CloseIO(SDL_IOStream *context);
|
||||
|
||||
/**
|
||||
* Get the properties associated with an SDL_RWops.
|
||||
* Get the properties associated with an SDL_IOStream.
|
||||
*
|
||||
* \param context a pointer to an SDL_RWops structure
|
||||
* \param context a pointer to an SDL_IOStream structure
|
||||
* \returns a valid property ID on success or 0 on failure; call
|
||||
* SDL_GetError() for more information.
|
||||
*
|
||||
|
@ -325,99 +325,99 @@ extern DECLSPEC int SDLCALL SDL_CloseRW(SDL_RWops *context);
|
|||
* \sa SDL_GetProperty
|
||||
* \sa SDL_SetProperty
|
||||
*/
|
||||
extern DECLSPEC SDL_PropertiesID SDLCALL SDL_GetRWProperties(SDL_RWops *context);
|
||||
extern DECLSPEC SDL_PropertiesID SDLCALL SDL_GetRWProperties(SDL_IOStream *context);
|
||||
|
||||
#define SDL_RW_SEEK_SET 0 /**< Seek from the beginning of data */
|
||||
#define SDL_RW_SEEK_CUR 1 /**< Seek relative to current read point */
|
||||
#define SDL_RW_SEEK_END 2 /**< Seek relative to the end of data */
|
||||
#define SDL_IO_SEEK_SET 0 /**< Seek from the beginning of data */
|
||||
#define SDL_IO_SEEK_CUR 1 /**< Seek relative to current read point */
|
||||
#define SDL_IO_SEEK_END 2 /**< Seek relative to the end of data */
|
||||
|
||||
/**
|
||||
* Query the stream status of a RWops.
|
||||
* Query the stream status of an SDL_IOStream.
|
||||
*
|
||||
* This information can be useful to decide if a short read or write was
|
||||
* due to an error, an EOF, or a non-blocking operation that isn't yet
|
||||
* ready to complete.
|
||||
*
|
||||
* A RWops's status is only expected to change after a SDL_ReadRW or
|
||||
* SDL_WriteRW call; don't expect it to change if you just call this
|
||||
* An SDL_IOStream's status is only expected to change after a SDL_ReadIO or
|
||||
* SDL_WriteIO call; don't expect it to change if you just call this
|
||||
* query function in a tight loop.
|
||||
*
|
||||
* \param context the SDL_RWops to query.
|
||||
* \returns an SDL_RWopsStatus enum with the current state.
|
||||
* \param context the SDL_IOStream to query.
|
||||
* \returns an SDL_IOStatus enum with the current state.
|
||||
*
|
||||
* \threadsafety This function should not be called at the same time that
|
||||
* another thread is operating on the same SDL_RWops.
|
||||
* another thread is operating on the same SDL_IOStream.
|
||||
*
|
||||
* \since This function is available since SDL 3.0.0.
|
||||
*/
|
||||
extern DECLSPEC SDL_RWopsStatus SDLCALL SDL_GetRWStatus(SDL_RWops *context);
|
||||
extern DECLSPEC SDL_IOStatus SDLCALL SDL_GetRWStatus(SDL_IOStream *context);
|
||||
|
||||
/**
|
||||
* Use this function to get the size of the data stream in an SDL_RWops.
|
||||
* Use this function to get the size of the data stream in an SDL_IOStream.
|
||||
*
|
||||
* \param context the SDL_RWops to get the size of the data stream from
|
||||
* \returns the size of the data stream in the SDL_RWops on success or a
|
||||
* \param context the SDL_IOStream to get the size of the data stream from
|
||||
* \returns the size of the data stream in the SDL_IOStream on success or a
|
||||
* negative error code on failure; call SDL_GetError() for more
|
||||
* information.
|
||||
*
|
||||
* \since This function is available since SDL 3.0.0.
|
||||
*/
|
||||
extern DECLSPEC Sint64 SDLCALL SDL_SizeRW(SDL_RWops *context);
|
||||
extern DECLSPEC Sint64 SDLCALL SDL_SizeIO(SDL_IOStream *context);
|
||||
|
||||
/**
|
||||
* Seek within an SDL_RWops data stream.
|
||||
* Seek within an SDL_IOStream data stream.
|
||||
*
|
||||
* This function seeks to byte `offset`, relative to `whence`.
|
||||
*
|
||||
* `whence` may be any of the following values:
|
||||
*
|
||||
* - `SDL_RW_SEEK_SET`: seek from the beginning of data
|
||||
* - `SDL_RW_SEEK_CUR`: seek relative to current read point
|
||||
* - `SDL_RW_SEEK_END`: seek relative to the end of data
|
||||
* - `SDL_IO_SEEK_SET`: seek from the beginning of data
|
||||
* - `SDL_IO_SEEK_CUR`: seek relative to current read point
|
||||
* - `SDL_IO_SEEK_END`: seek relative to the end of data
|
||||
*
|
||||
* If this stream can not seek, it will return -1.
|
||||
*
|
||||
* \param context a pointer to an SDL_RWops structure
|
||||
* \param context a pointer to an SDL_IOStream structure
|
||||
* \param offset an offset in bytes, relative to **whence** location; can be
|
||||
* negative
|
||||
* \param whence any of `SDL_RW_SEEK_SET`, `SDL_RW_SEEK_CUR`,
|
||||
* `SDL_RW_SEEK_END`
|
||||
* \param whence any of `SDL_IO_SEEK_SET`, `SDL_IO_SEEK_CUR`,
|
||||
* `SDL_IO_SEEK_END`
|
||||
* \returns the final offset in the data stream after the seek or a negative
|
||||
* error code on failure; call SDL_GetError() for more information.
|
||||
*
|
||||
* \since This function is available since SDL 3.0.0.
|
||||
*
|
||||
* \sa SDL_RWFromConstMem
|
||||
* \sa SDL_RWFromFile
|
||||
* \sa SDL_RWFromMem
|
||||
* \sa SDL_ReadRW
|
||||
* \sa SDL_TellRW
|
||||
* \sa SDL_WriteRW
|
||||
* \sa SDL_IOFromConstMem
|
||||
* \sa SDL_IOFromFile
|
||||
* \sa SDL_IOFromMem
|
||||
* \sa SDL_ReadIO
|
||||
* \sa SDL_TellIO
|
||||
* \sa SDL_WriteIO
|
||||
*/
|
||||
extern DECLSPEC Sint64 SDLCALL SDL_SeekRW(SDL_RWops *context, Sint64 offset, int whence);
|
||||
extern DECLSPEC Sint64 SDLCALL SDL_SeekIO(SDL_IOStream *context, Sint64 offset, int whence);
|
||||
|
||||
/**
|
||||
* Determine the current read/write offset in an SDL_RWops data stream.
|
||||
* Determine the current read/write offset in an SDL_IOStream data stream.
|
||||
*
|
||||
* SDL_TellRW is actually a wrapper function that calls the SDL_RWops's `seek`
|
||||
* method, with an offset of 0 bytes from `SDL_RW_SEEK_CUR`, to simplify
|
||||
* SDL_TellIO is actually a wrapper function that calls the SDL_IOStream's `seek`
|
||||
* method, with an offset of 0 bytes from `SDL_IO_SEEK_CUR`, to simplify
|
||||
* application development.
|
||||
*
|
||||
* \param context an SDL_RWops data stream object from which to get the
|
||||
* \param context an SDL_IOStream data stream object from which to get the
|
||||
* current offset
|
||||
* \returns the current offset in the stream, or -1 if the information can not
|
||||
* be determined.
|
||||
*
|
||||
* \since This function is available since SDL 3.0.0.
|
||||
*
|
||||
* \sa SDL_RWFromConstMem
|
||||
* \sa SDL_RWFromFile
|
||||
* \sa SDL_RWFromMem
|
||||
* \sa SDL_ReadRW
|
||||
* \sa SDL_SeekRW
|
||||
* \sa SDL_WriteRW
|
||||
* \sa SDL_IOFromConstMem
|
||||
* \sa SDL_IOFromFile
|
||||
* \sa SDL_IOFromMem
|
||||
* \sa SDL_ReadIO
|
||||
* \sa SDL_SeekIO
|
||||
* \sa SDL_WriteIO
|
||||
*/
|
||||
extern DECLSPEC Sint64 SDLCALL SDL_TellRW(SDL_RWops *context);
|
||||
extern DECLSPEC Sint64 SDLCALL SDL_TellIO(SDL_IOStream *context);
|
||||
|
||||
/**
|
||||
* Read from a data source.
|
||||
|
@ -430,26 +430,26 @@ extern DECLSPEC Sint64 SDLCALL SDL_TellRW(SDL_RWops *context);
|
|||
* that this is not an error or end-of-file, and the caller can try again
|
||||
* later.
|
||||
*
|
||||
* SDL_ReadRW() is actually a function wrapper that calls the SDL_RWops's
|
||||
* SDL_ReadIO() is actually a function wrapper that calls the SDL_IOStream's
|
||||
* `read` method appropriately, to simplify application development.
|
||||
*
|
||||
* \param context a pointer to an SDL_RWops structure
|
||||
* \param context a pointer to an SDL_IOStream structure
|
||||
* \param ptr a pointer to a buffer to read data into
|
||||
* \param size the number of bytes to read from the data source.
|
||||
* \returns the number of bytes read, or 0 on end of file or other error.
|
||||
*
|
||||
* \since This function is available since SDL 3.0.0.
|
||||
*
|
||||
* \sa SDL_RWFromConstMem
|
||||
* \sa SDL_RWFromFile
|
||||
* \sa SDL_RWFromMem
|
||||
* \sa SDL_SeekRW
|
||||
* \sa SDL_WriteRW
|
||||
* \sa SDL_IOFromConstMem
|
||||
* \sa SDL_IOFromFile
|
||||
* \sa SDL_IOFromMem
|
||||
* \sa SDL_SeekIO
|
||||
* \sa SDL_WriteIO
|
||||
*/
|
||||
extern DECLSPEC size_t SDLCALL SDL_ReadRW(SDL_RWops *context, void *ptr, size_t size);
|
||||
extern DECLSPEC size_t SDLCALL SDL_ReadIO(SDL_IOStream *context, void *ptr, size_t size);
|
||||
|
||||
/**
|
||||
* Write to an SDL_RWops data stream.
|
||||
* Write to an SDL_IOStream data stream.
|
||||
*
|
||||
* This function writes exactly `size` bytes from the area pointed at by `ptr`
|
||||
* to the stream. If this fails for any reason, it'll return less than `size`
|
||||
|
@ -462,14 +462,14 @@ extern DECLSPEC size_t SDLCALL SDL_ReadRW(SDL_RWops *context, void *ptr, size_t
|
|||
* written because it would require blocking, this function returns -2 to
|
||||
* distinguish that this is not an error and the caller can try again later.
|
||||
*
|
||||
* SDL_WriteRW is actually a function wrapper that calls the SDL_RWops's
|
||||
* SDL_WriteIO is actually a function wrapper that calls the SDL_IOStream's
|
||||
* `write` method appropriately, to simplify application development.
|
||||
*
|
||||
* It is an error to specify a negative `size`, but this parameter is signed
|
||||
* so you definitely cannot overflow the return value on a successful run with
|
||||
* enormous amounts of data.
|
||||
*
|
||||
* \param context a pointer to an SDL_RWops structure
|
||||
* \param context a pointer to an SDL_IOStream structure
|
||||
* \param ptr a pointer to a buffer containing data to write
|
||||
* \param size the number of bytes to write
|
||||
* \returns the number of bytes written, which will be less than `num` on
|
||||
|
@ -477,21 +477,21 @@ extern DECLSPEC size_t SDLCALL SDL_ReadRW(SDL_RWops *context, void *ptr, size_t
|
|||
*
|
||||
* \since This function is available since SDL 3.0.0.
|
||||
*
|
||||
* \sa SDL_RWFromConstMem
|
||||
* \sa SDL_RWFromFile
|
||||
* \sa SDL_RWFromMem
|
||||
* \sa SDL_RWprint
|
||||
* \sa SDL_ReadRW
|
||||
* \sa SDL_SeekRW
|
||||
* \sa SDL_IOFromConstMem
|
||||
* \sa SDL_IOFromFile
|
||||
* \sa SDL_IOFromMem
|
||||
* \sa SDL_IOprintf
|
||||
* \sa SDL_ReadIO
|
||||
* \sa SDL_SeekIO
|
||||
*/
|
||||
extern DECLSPEC size_t SDLCALL SDL_WriteRW(SDL_RWops *context, const void *ptr, size_t size);
|
||||
extern DECLSPEC size_t SDLCALL SDL_WriteIO(SDL_IOStream *context, const void *ptr, size_t size);
|
||||
|
||||
/**
|
||||
* Print to an SDL_RWops data stream.
|
||||
* Print to an SDL_IOStream data stream.
|
||||
*
|
||||
* This function does formatted printing to the stream.
|
||||
*
|
||||
* \param context a pointer to an SDL_RWops structure
|
||||
* \param context a pointer to an SDL_IOStream structure
|
||||
* \param fmt a printf() style format string
|
||||
* \param ... additional parameters matching % tokens in the `fmt` string, if
|
||||
* any
|
||||
|
@ -500,21 +500,21 @@ extern DECLSPEC size_t SDLCALL SDL_WriteRW(SDL_RWops *context, const void *ptr,
|
|||
*
|
||||
* \since This function is available since SDL 3.0.0.
|
||||
*
|
||||
* \sa SDL_RWFromConstMem
|
||||
* \sa SDL_RWFromFile
|
||||
* \sa SDL_RWFromMem
|
||||
* \sa SDL_ReadRW
|
||||
* \sa SDL_SeekRW
|
||||
* \sa SDL_WriteRW
|
||||
* \sa SDL_IOFromConstMem
|
||||
* \sa SDL_IOFromFile
|
||||
* \sa SDL_IOFromMem
|
||||
* \sa SDL_ReadIO
|
||||
* \sa SDL_SeekIO
|
||||
* \sa SDL_WriteIO
|
||||
*/
|
||||
extern DECLSPEC size_t SDLCALL SDL_RWprintf(SDL_RWops *context, SDL_PRINTF_FORMAT_STRING const char *fmt, ...) SDL_PRINTF_VARARG_FUNC(2);
|
||||
extern DECLSPEC size_t SDLCALL SDL_IOprintf(SDL_IOStream *context, SDL_PRINTF_FORMAT_STRING const char *fmt, ...) SDL_PRINTF_VARARG_FUNC(2);
|
||||
|
||||
/**
|
||||
* Print to an SDL_RWops data stream.
|
||||
* Print to an SDL_IOStream data stream.
|
||||
*
|
||||
* This function does formatted printing to the stream.
|
||||
*
|
||||
* \param context a pointer to an SDL_RWops structure
|
||||
* \param context a pointer to an SDL_IOStream structure
|
||||
* \param fmt a printf() style format string
|
||||
* \param ap a variable argument list
|
||||
* \returns the number of bytes written, or 0 on error; call SDL_GetError()
|
||||
|
@ -522,14 +522,14 @@ extern DECLSPEC size_t SDLCALL SDL_RWprintf(SDL_RWops *context, SDL_PRINTF_FORMA
|
|||
*
|
||||
* \since This function is available since SDL 3.0.0.
|
||||
*
|
||||
* \sa SDL_RWFromConstMem
|
||||
* \sa SDL_RWFromFile
|
||||
* \sa SDL_RWFromMem
|
||||
* \sa SDL_ReadRW
|
||||
* \sa SDL_SeekRW
|
||||
* \sa SDL_WriteRW
|
||||
* \sa SDL_IOFromConstMem
|
||||
* \sa SDL_IOFromFile
|
||||
* \sa SDL_IOFromMem
|
||||
* \sa SDL_ReadIO
|
||||
* \sa SDL_SeekIO
|
||||
* \sa SDL_WriteIO
|
||||
*/
|
||||
extern DECLSPEC size_t SDLCALL SDL_RWvprintf(SDL_RWops *context, SDL_PRINTF_FORMAT_STRING const char *fmt, va_list ap) SDL_PRINTF_VARARG_FUNCV(2);
|
||||
extern DECLSPEC size_t SDLCALL SDL_IOvprintf(SDL_IOStream *context, SDL_PRINTF_FORMAT_STRING const char *fmt, va_list ap) SDL_PRINTF_VARARG_FUNCV(2);
|
||||
|
||||
/**
|
||||
* Load all the data from an SDL data stream.
|
||||
|
@ -540,15 +540,15 @@ extern DECLSPEC size_t SDLCALL SDL_RWvprintf(SDL_RWops *context, SDL_PRINTF_FORM
|
|||
*
|
||||
* The data should be freed with SDL_free().
|
||||
*
|
||||
* \param src the SDL_RWops to read all available data from
|
||||
* \param src the SDL_IOStream 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_CloseRW() on `src` before returning,
|
||||
* \param freesrc if SDL_TRUE, calls SDL_CloseIO() 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, SDL_bool freesrc);
|
||||
extern DECLSPEC void *SDLCALL SDL_LoadFile_RW(SDL_IOStream *src, size_t *datasize, SDL_bool freesrc);
|
||||
|
||||
/**
|
||||
* Load all the data from a file path.
|
||||
|
@ -575,19 +575,19 @@ extern DECLSPEC void *SDLCALL SDL_LoadFile(const char *file, size_t *datasize);
|
|||
/* @{ */
|
||||
|
||||
/**
|
||||
* Use this function to read a byte from an SDL_RWops.
|
||||
* Use this function to read a byte from an SDL_IOStream.
|
||||
*
|
||||
* \param src the SDL_RWops to read from
|
||||
* \param src the SDL_IOStream to read from
|
||||
* \param value a pointer filled in with the data read
|
||||
* \returns SDL_TRUE on success or SDL_FALSE on failure; call SDL_GetError()
|
||||
* for more information.
|
||||
*
|
||||
* \since This function is available since SDL 3.0.0.
|
||||
*/
|
||||
extern DECLSPEC SDL_bool SDLCALL SDL_ReadU8(SDL_RWops *src, Uint8 *value);
|
||||
extern DECLSPEC SDL_bool SDLCALL SDL_ReadU8(SDL_IOStream *src, Uint8 *value);
|
||||
|
||||
/**
|
||||
* Use this function to read 16 bits of little-endian data from an SDL_RWops
|
||||
* Use this function to read 16 bits of little-endian data from an SDL_IOStream
|
||||
* and return in native format.
|
||||
*
|
||||
* SDL byteswaps the data only if necessary, so the data returned will be in
|
||||
|
@ -600,10 +600,10 @@ extern DECLSPEC SDL_bool SDLCALL SDL_ReadU8(SDL_RWops *src, Uint8 *value);
|
|||
*
|
||||
* \since This function is available since SDL 3.0.0.
|
||||
*/
|
||||
extern DECLSPEC SDL_bool SDLCALL SDL_ReadU16LE(SDL_RWops *src, Uint16 *value);
|
||||
extern DECLSPEC SDL_bool SDLCALL SDL_ReadU16LE(SDL_IOStream *src, Uint16 *value);
|
||||
|
||||
/**
|
||||
* Use this function to read 16 bits of little-endian data from an SDL_RWops
|
||||
* Use this function to read 16 bits of little-endian data from an SDL_IOStream
|
||||
* and return in native format.
|
||||
*
|
||||
* SDL byteswaps the data only if necessary, so the data returned will be in
|
||||
|
@ -616,10 +616,10 @@ extern DECLSPEC SDL_bool SDLCALL SDL_ReadU16LE(SDL_RWops *src, Uint16 *value);
|
|||
*
|
||||
* \since This function is available since SDL 3.0.0.
|
||||
*/
|
||||
extern DECLSPEC SDL_bool SDLCALL SDL_ReadS16LE(SDL_RWops *src, Sint16 *value);
|
||||
extern DECLSPEC SDL_bool SDLCALL SDL_ReadS16LE(SDL_IOStream *src, Sint16 *value);
|
||||
|
||||
/**
|
||||
* Use this function to read 16 bits of big-endian data from an SDL_RWops and
|
||||
* Use this function to read 16 bits of big-endian data from an SDL_IOStream and
|
||||
* return in native format.
|
||||
*
|
||||
* SDL byteswaps the data only if necessary, so the data returned will be in
|
||||
|
@ -632,10 +632,10 @@ extern DECLSPEC SDL_bool SDLCALL SDL_ReadS16LE(SDL_RWops *src, Sint16 *value);
|
|||
*
|
||||
* \since This function is available since SDL 3.0.0.
|
||||
*/
|
||||
extern DECLSPEC SDL_bool SDLCALL SDL_ReadU16BE(SDL_RWops *src, Uint16 *value);
|
||||
extern DECLSPEC SDL_bool SDLCALL SDL_ReadU16BE(SDL_IOStream *src, Uint16 *value);
|
||||
|
||||
/**
|
||||
* Use this function to read 16 bits of big-endian data from an SDL_RWops and
|
||||
* Use this function to read 16 bits of big-endian data from an SDL_IOStream and
|
||||
* return in native format.
|
||||
*
|
||||
* SDL byteswaps the data only if necessary, so the data returned will be in
|
||||
|
@ -648,10 +648,10 @@ extern DECLSPEC SDL_bool SDLCALL SDL_ReadU16BE(SDL_RWops *src, Uint16 *value);
|
|||
*
|
||||
* \since This function is available since SDL 3.0.0.
|
||||
*/
|
||||
extern DECLSPEC SDL_bool SDLCALL SDL_ReadS16BE(SDL_RWops *src, Sint16 *value);
|
||||
extern DECLSPEC SDL_bool SDLCALL SDL_ReadS16BE(SDL_IOStream *src, Sint16 *value);
|
||||
|
||||
/**
|
||||
* Use this function to read 32 bits of little-endian data from an SDL_RWops
|
||||
* Use this function to read 32 bits of little-endian data from an SDL_IOStream
|
||||
* and return in native format.
|
||||
*
|
||||
* SDL byteswaps the data only if necessary, so the data returned will be in
|
||||
|
@ -664,10 +664,10 @@ extern DECLSPEC SDL_bool SDLCALL SDL_ReadS16BE(SDL_RWops *src, Sint16 *value);
|
|||
*
|
||||
* \since This function is available since SDL 3.0.0.
|
||||
*/
|
||||
extern DECLSPEC SDL_bool SDLCALL SDL_ReadU32LE(SDL_RWops *src, Uint32 *value);
|
||||
extern DECLSPEC SDL_bool SDLCALL SDL_ReadU32LE(SDL_IOStream *src, Uint32 *value);
|
||||
|
||||
/**
|
||||
* Use this function to read 32 bits of little-endian data from an SDL_RWops
|
||||
* Use this function to read 32 bits of little-endian data from an SDL_IOStream
|
||||
* and return in native format.
|
||||
*
|
||||
* SDL byteswaps the data only if necessary, so the data returned will be in
|
||||
|
@ -680,10 +680,10 @@ extern DECLSPEC SDL_bool SDLCALL SDL_ReadU32LE(SDL_RWops *src, Uint32 *value);
|
|||
*
|
||||
* \since This function is available since SDL 3.0.0.
|
||||
*/
|
||||
extern DECLSPEC SDL_bool SDLCALL SDL_ReadS32LE(SDL_RWops *src, Sint32 *value);
|
||||
extern DECLSPEC SDL_bool SDLCALL SDL_ReadS32LE(SDL_IOStream *src, Sint32 *value);
|
||||
|
||||
/**
|
||||
* Use this function to read 32 bits of big-endian data from an SDL_RWops and
|
||||
* Use this function to read 32 bits of big-endian data from an SDL_IOStream and
|
||||
* return in native format.
|
||||
*
|
||||
* SDL byteswaps the data only if necessary, so the data returned will be in
|
||||
|
@ -696,10 +696,10 @@ extern DECLSPEC SDL_bool SDLCALL SDL_ReadS32LE(SDL_RWops *src, Sint32 *value);
|
|||
*
|
||||
* \since This function is available since SDL 3.0.0.
|
||||
*/
|
||||
extern DECLSPEC SDL_bool SDLCALL SDL_ReadU32BE(SDL_RWops *src, Uint32 *value);
|
||||
extern DECLSPEC SDL_bool SDLCALL SDL_ReadU32BE(SDL_IOStream *src, Uint32 *value);
|
||||
|
||||
/**
|
||||
* Use this function to read 32 bits of big-endian data from an SDL_RWops and
|
||||
* Use this function to read 32 bits of big-endian data from an SDL_IOStream and
|
||||
* return in native format.
|
||||
*
|
||||
* SDL byteswaps the data only if necessary, so the data returned will be in
|
||||
|
@ -712,10 +712,10 @@ extern DECLSPEC SDL_bool SDLCALL SDL_ReadU32BE(SDL_RWops *src, Uint32 *value);
|
|||
*
|
||||
* \since This function is available since SDL 3.0.0.
|
||||
*/
|
||||
extern DECLSPEC SDL_bool SDLCALL SDL_ReadS32BE(SDL_RWops *src, Sint32 *value);
|
||||
extern DECLSPEC SDL_bool SDLCALL SDL_ReadS32BE(SDL_IOStream *src, Sint32 *value);
|
||||
|
||||
/**
|
||||
* Use this function to read 64 bits of little-endian data from an SDL_RWops
|
||||
* Use this function to read 64 bits of little-endian data from an SDL_IOStream
|
||||
* and return in native format.
|
||||
*
|
||||
* SDL byteswaps the data only if necessary, so the data returned will be in
|
||||
|
@ -728,10 +728,10 @@ extern DECLSPEC SDL_bool SDLCALL SDL_ReadS32BE(SDL_RWops *src, Sint32 *value);
|
|||
*
|
||||
* \since This function is available since SDL 3.0.0.
|
||||
*/
|
||||
extern DECLSPEC SDL_bool SDLCALL SDL_ReadU64LE(SDL_RWops *src, Uint64 *value);
|
||||
extern DECLSPEC SDL_bool SDLCALL SDL_ReadU64LE(SDL_IOStream *src, Uint64 *value);
|
||||
|
||||
/**
|
||||
* Use this function to read 64 bits of little-endian data from an SDL_RWops
|
||||
* Use this function to read 64 bits of little-endian data from an SDL_IOStream
|
||||
* and return in native format.
|
||||
*
|
||||
* SDL byteswaps the data only if necessary, so the data returned will be in
|
||||
|
@ -744,10 +744,10 @@ extern DECLSPEC SDL_bool SDLCALL SDL_ReadU64LE(SDL_RWops *src, Uint64 *value);
|
|||
*
|
||||
* \since This function is available since SDL 3.0.0.
|
||||
*/
|
||||
extern DECLSPEC SDL_bool SDLCALL SDL_ReadS64LE(SDL_RWops *src, Sint64 *value);
|
||||
extern DECLSPEC SDL_bool SDLCALL SDL_ReadS64LE(SDL_IOStream *src, Sint64 *value);
|
||||
|
||||
/**
|
||||
* Use this function to read 64 bits of big-endian data from an SDL_RWops and
|
||||
* Use this function to read 64 bits of big-endian data from an SDL_IOStream and
|
||||
* return in native format.
|
||||
*
|
||||
* SDL byteswaps the data only if necessary, so the data returned will be in
|
||||
|
@ -760,10 +760,10 @@ extern DECLSPEC SDL_bool SDLCALL SDL_ReadS64LE(SDL_RWops *src, Sint64 *value);
|
|||
*
|
||||
* \since This function is available since SDL 3.0.0.
|
||||
*/
|
||||
extern DECLSPEC SDL_bool SDLCALL SDL_ReadU64BE(SDL_RWops *src, Uint64 *value);
|
||||
extern DECLSPEC SDL_bool SDLCALL SDL_ReadU64BE(SDL_IOStream *src, Uint64 *value);
|
||||
|
||||
/**
|
||||
* Use this function to read 64 bits of big-endian data from an SDL_RWops and
|
||||
* Use this function to read 64 bits of big-endian data from an SDL_IOStream and
|
||||
* return in native format.
|
||||
*
|
||||
* SDL byteswaps the data only if necessary, so the data returned will be in
|
||||
|
@ -776,7 +776,7 @@ extern DECLSPEC SDL_bool SDLCALL SDL_ReadU64BE(SDL_RWops *src, Uint64 *value);
|
|||
*
|
||||
* \since This function is available since SDL 3.0.0.
|
||||
*/
|
||||
extern DECLSPEC SDL_bool SDLCALL SDL_ReadS64BE(SDL_RWops *src, Sint64 *value);
|
||||
extern DECLSPEC SDL_bool SDLCALL SDL_ReadS64BE(SDL_IOStream *src, Sint64 *value);
|
||||
/* @} *//* Read endian functions */
|
||||
|
||||
/**
|
||||
|
@ -787,19 +787,19 @@ extern DECLSPEC SDL_bool SDLCALL SDL_ReadS64BE(SDL_RWops *src, Sint64 *value);
|
|||
/* @{ */
|
||||
|
||||
/**
|
||||
* Use this function to write a byte to an SDL_RWops.
|
||||
* Use this function to write a byte to an SDL_IOStream.
|
||||
*
|
||||
* \param dst the SDL_RWops to write to
|
||||
* \param dst the SDL_IOStream to write to
|
||||
* \param value the byte value to write
|
||||
* \returns SDL_TRUE on successful write, SDL_FALSE on failure; call
|
||||
* SDL_GetError() for more information.
|
||||
*
|
||||
* \since This function is available since SDL 3.0.0.
|
||||
*/
|
||||
extern DECLSPEC SDL_bool SDLCALL SDL_WriteU8(SDL_RWops *dst, Uint8 value);
|
||||
extern DECLSPEC SDL_bool SDLCALL SDL_WriteU8(SDL_IOStream *dst, Uint8 value);
|
||||
|
||||
/**
|
||||
* Use this function to write 16 bits in native format to an SDL_RWops as
|
||||
* Use this function to write 16 bits in native format to an SDL_IOStream as
|
||||
* little-endian data.
|
||||
*
|
||||
* SDL byteswaps the data only if necessary, so the application always
|
||||
|
@ -813,10 +813,10 @@ extern DECLSPEC SDL_bool SDLCALL SDL_WriteU8(SDL_RWops *dst, Uint8 value);
|
|||
*
|
||||
* \since This function is available since SDL 3.0.0.
|
||||
*/
|
||||
extern DECLSPEC SDL_bool SDLCALL SDL_WriteU16LE(SDL_RWops *dst, Uint16 value);
|
||||
extern DECLSPEC SDL_bool SDLCALL SDL_WriteU16LE(SDL_IOStream *dst, Uint16 value);
|
||||
|
||||
/**
|
||||
* Use this function to write 16 bits in native format to an SDL_RWops as
|
||||
* Use this function to write 16 bits in native format to an SDL_IOStream as
|
||||
* little-endian data.
|
||||
*
|
||||
* SDL byteswaps the data only if necessary, so the application always
|
||||
|
@ -830,10 +830,10 @@ extern DECLSPEC SDL_bool SDLCALL SDL_WriteU16LE(SDL_RWops *dst, Uint16 value);
|
|||
*
|
||||
* \since This function is available since SDL 3.0.0.
|
||||
*/
|
||||
extern DECLSPEC SDL_bool SDLCALL SDL_WriteS16LE(SDL_RWops *dst, Sint16 value);
|
||||
extern DECLSPEC SDL_bool SDLCALL SDL_WriteS16LE(SDL_IOStream *dst, Sint16 value);
|
||||
|
||||
/**
|
||||
* Use this function to write 16 bits in native format to an SDL_RWops as
|
||||
* Use this function to write 16 bits in native format to an SDL_IOStream as
|
||||
* big-endian data.
|
||||
*
|
||||
* SDL byteswaps the data only if necessary, so the application always
|
||||
|
@ -846,10 +846,10 @@ extern DECLSPEC SDL_bool SDLCALL SDL_WriteS16LE(SDL_RWops *dst, Sint16 value);
|
|||
*
|
||||
* \since This function is available since SDL 3.0.0.
|
||||
*/
|
||||
extern DECLSPEC SDL_bool SDLCALL SDL_WriteU16BE(SDL_RWops *dst, Uint16 value);
|
||||
extern DECLSPEC SDL_bool SDLCALL SDL_WriteU16BE(SDL_IOStream *dst, Uint16 value);
|
||||
|
||||
/**
|
||||
* Use this function to write 16 bits in native format to an SDL_RWops as
|
||||
* Use this function to write 16 bits in native format to an SDL_IOStream as
|
||||
* big-endian data.
|
||||
*
|
||||
* SDL byteswaps the data only if necessary, so the application always
|
||||
|
@ -862,10 +862,10 @@ extern DECLSPEC SDL_bool SDLCALL SDL_WriteU16BE(SDL_RWops *dst, Uint16 value);
|
|||
*
|
||||
* \since This function is available since SDL 3.0.0.
|
||||
*/
|
||||
extern DECLSPEC SDL_bool SDLCALL SDL_WriteS16BE(SDL_RWops *dst, Sint16 value);
|
||||
extern DECLSPEC SDL_bool SDLCALL SDL_WriteS16BE(SDL_IOStream *dst, Sint16 value);
|
||||
|
||||
/**
|
||||
* Use this function to write 32 bits in native format to an SDL_RWops as
|
||||
* Use this function to write 32 bits in native format to an SDL_IOStream as
|
||||
* little-endian data.
|
||||
*
|
||||
* SDL byteswaps the data only if necessary, so the application always
|
||||
|
@ -879,10 +879,10 @@ extern DECLSPEC SDL_bool SDLCALL SDL_WriteS16BE(SDL_RWops *dst, Sint16 value);
|
|||
*
|
||||
* \since This function is available since SDL 3.0.0.
|
||||
*/
|
||||
extern DECLSPEC SDL_bool SDLCALL SDL_WriteU32LE(SDL_RWops *dst, Uint32 value);
|
||||
extern DECLSPEC SDL_bool SDLCALL SDL_WriteU32LE(SDL_IOStream *dst, Uint32 value);
|
||||
|
||||
/**
|
||||
* Use this function to write 32 bits in native format to an SDL_RWops as
|
||||
* Use this function to write 32 bits in native format to an SDL_IOStream as
|
||||
* little-endian data.
|
||||
*
|
||||
* SDL byteswaps the data only if necessary, so the application always
|
||||
|
@ -896,10 +896,10 @@ extern DECLSPEC SDL_bool SDLCALL SDL_WriteU32LE(SDL_RWops *dst, Uint32 value);
|
|||
*
|
||||
* \since This function is available since SDL 3.0.0.
|
||||
*/
|
||||
extern DECLSPEC SDL_bool SDLCALL SDL_WriteS32LE(SDL_RWops *dst, Sint32 value);
|
||||
extern DECLSPEC SDL_bool SDLCALL SDL_WriteS32LE(SDL_IOStream *dst, Sint32 value);
|
||||
|
||||
/**
|
||||
* Use this function to write 32 bits in native format to an SDL_RWops as
|
||||
* Use this function to write 32 bits in native format to an SDL_IOStream as
|
||||
* big-endian data.
|
||||
*
|
||||
* SDL byteswaps the data only if necessary, so the application always
|
||||
|
@ -912,10 +912,10 @@ extern DECLSPEC SDL_bool SDLCALL SDL_WriteS32LE(SDL_RWops *dst, Sint32 value);
|
|||
*
|
||||
* \since This function is available since SDL 3.0.0.
|
||||
*/
|
||||
extern DECLSPEC SDL_bool SDLCALL SDL_WriteU32BE(SDL_RWops *dst, Uint32 value);
|
||||
extern DECLSPEC SDL_bool SDLCALL SDL_WriteU32BE(SDL_IOStream *dst, Uint32 value);
|
||||
|
||||
/**
|
||||
* Use this function to write 32 bits in native format to an SDL_RWops as
|
||||
* Use this function to write 32 bits in native format to an SDL_IOStream as
|
||||
* big-endian data.
|
||||
*
|
||||
* SDL byteswaps the data only if necessary, so the application always
|
||||
|
@ -928,10 +928,10 @@ extern DECLSPEC SDL_bool SDLCALL SDL_WriteU32BE(SDL_RWops *dst, Uint32 value);
|
|||
*
|
||||
* \since This function is available since SDL 3.0.0.
|
||||
*/
|
||||
extern DECLSPEC SDL_bool SDLCALL SDL_WriteS32BE(SDL_RWops *dst, Sint32 value);
|
||||
extern DECLSPEC SDL_bool SDLCALL SDL_WriteS32BE(SDL_IOStream *dst, Sint32 value);
|
||||
|
||||
/**
|
||||
* Use this function to write 64 bits in native format to an SDL_RWops as
|
||||
* Use this function to write 64 bits in native format to an SDL_IOStream as
|
||||
* little-endian data.
|
||||
*
|
||||
* SDL byteswaps the data only if necessary, so the application always
|
||||
|
@ -945,10 +945,10 @@ extern DECLSPEC SDL_bool SDLCALL SDL_WriteS32BE(SDL_RWops *dst, Sint32 value);
|
|||
*
|
||||
* \since This function is available since SDL 3.0.0.
|
||||
*/
|
||||
extern DECLSPEC SDL_bool SDLCALL SDL_WriteU64LE(SDL_RWops *dst, Uint64 value);
|
||||
extern DECLSPEC SDL_bool SDLCALL SDL_WriteU64LE(SDL_IOStream *dst, Uint64 value);
|
||||
|
||||
/**
|
||||
* Use this function to write 64 bits in native format to an SDL_RWops as
|
||||
* Use this function to write 64 bits in native format to an SDL_IOStream as
|
||||
* little-endian data.
|
||||
*
|
||||
* SDL byteswaps the data only if necessary, so the application always
|
||||
|
@ -962,10 +962,10 @@ extern DECLSPEC SDL_bool SDLCALL SDL_WriteU64LE(SDL_RWops *dst, Uint64 value);
|
|||
*
|
||||
* \since This function is available since SDL 3.0.0.
|
||||
*/
|
||||
extern DECLSPEC SDL_bool SDLCALL SDL_WriteS64LE(SDL_RWops *dst, Sint64 value);
|
||||
extern DECLSPEC SDL_bool SDLCALL SDL_WriteS64LE(SDL_IOStream *dst, Sint64 value);
|
||||
|
||||
/**
|
||||
* Use this function to write 64 bits in native format to an SDL_RWops as
|
||||
* Use this function to write 64 bits in native format to an SDL_IOStream as
|
||||
* big-endian data.
|
||||
*
|
||||
* SDL byteswaps the data only if necessary, so the application always
|
||||
|
@ -978,10 +978,10 @@ extern DECLSPEC SDL_bool SDLCALL SDL_WriteS64LE(SDL_RWops *dst, Sint64 value);
|
|||
*
|
||||
* \since This function is available since SDL 3.0.0.
|
||||
*/
|
||||
extern DECLSPEC SDL_bool SDLCALL SDL_WriteU64BE(SDL_RWops *dst, Uint64 value);
|
||||
extern DECLSPEC SDL_bool SDLCALL SDL_WriteU64BE(SDL_IOStream *dst, Uint64 value);
|
||||
|
||||
/**
|
||||
* Use this function to write 64 bits in native format to an SDL_RWops as
|
||||
* Use this function to write 64 bits in native format to an SDL_IOStream as
|
||||
* big-endian data.
|
||||
*
|
||||
* SDL byteswaps the data only if necessary, so the application always
|
||||
|
@ -994,7 +994,7 @@ extern DECLSPEC SDL_bool SDLCALL SDL_WriteU64BE(SDL_RWops *dst, Uint64 value);
|
|||
*
|
||||
* \since This function is available since SDL 3.0.0.
|
||||
*/
|
||||
extern DECLSPEC SDL_bool SDLCALL SDL_WriteS64BE(SDL_RWops *dst, Sint64 value);
|
||||
extern DECLSPEC SDL_bool SDLCALL SDL_WriteS64BE(SDL_IOStream *dst, Sint64 value);
|
||||
|
||||
/* @} *//* Write endian functions */
|
||||
|
||||
|
|
|
@ -196,7 +196,7 @@ extern DECLSPEC SDL_Surface *SDLCALL SDL_CreateSurfaceFrom
|
|||
* \sa SDL_CreateSurface
|
||||
* \sa SDL_CreateSurfaceFrom
|
||||
* \sa SDL_LoadBMP
|
||||
* \sa SDL_LoadBMP_RW
|
||||
* \sa SDL_LoadBMP_IO
|
||||
*/
|
||||
extern DECLSPEC void SDLCALL SDL_DestroySurface(SDL_Surface *surface);
|
||||
|
||||
|
@ -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_CloseRW() on `src` before returning,
|
||||
* \param freesrc if SDL_TRUE, calls SDL_CloseIO() 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.
|
||||
|
@ -337,9 +337,9 @@ extern DECLSPEC void SDLCALL SDL_UnlockSurface(SDL_Surface *surface);
|
|||
*
|
||||
* \sa SDL_DestroySurface
|
||||
* \sa SDL_LoadBMP
|
||||
* \sa SDL_SaveBMP_RW
|
||||
* \sa SDL_SaveBMP_IO
|
||||
*/
|
||||
extern DECLSPEC SDL_Surface *SDLCALL SDL_LoadBMP_RW(SDL_RWops *src, SDL_bool freesrc);
|
||||
extern DECLSPEC SDL_Surface *SDLCALL SDL_LoadBMP_IO(SDL_IOStream *src, SDL_bool freesrc);
|
||||
|
||||
/**
|
||||
* Load a BMP image from a file.
|
||||
|
@ -354,7 +354,7 @@ extern DECLSPEC SDL_Surface *SDLCALL SDL_LoadBMP_RW(SDL_RWops *src, SDL_bool fre
|
|||
* \since This function is available since SDL 3.0.0.
|
||||
*
|
||||
* \sa SDL_DestroySurface
|
||||
* \sa SDL_LoadBMP_RW
|
||||
* \sa SDL_LoadBMP_IO
|
||||
* \sa SDL_SaveBMP
|
||||
*/
|
||||
extern DECLSPEC SDL_Surface *SDLCALL SDL_LoadBMP(const char *file);
|
||||
|
@ -370,17 +370,17 @@ 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_CloseRW() on `dst` before returning,
|
||||
* \param freedst if SDL_TRUE, calls SDL_CloseIO() 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.
|
||||
*
|
||||
* \since This function is available since SDL 3.0.0.
|
||||
*
|
||||
* \sa SDL_LoadBMP_RW
|
||||
* \sa SDL_LoadBMP_IO
|
||||
* \sa SDL_SaveBMP
|
||||
*/
|
||||
extern DECLSPEC int SDLCALL SDL_SaveBMP_RW(SDL_Surface *surface, SDL_RWops *dst, SDL_bool freedst);
|
||||
extern DECLSPEC int SDLCALL SDL_SaveBMP_IO(SDL_Surface *surface, SDL_IOStream *dst, SDL_bool freedst);
|
||||
|
||||
/**
|
||||
* Save a surface to a file.
|
||||
|
@ -399,7 +399,7 @@ extern DECLSPEC int SDLCALL SDL_SaveBMP_RW(SDL_Surface *surface, SDL_RWops *dst,
|
|||
* \since This function is available since SDL 3.0.0.
|
||||
*
|
||||
* \sa SDL_LoadBMP
|
||||
* \sa SDL_SaveBMP_RW
|
||||
* \sa SDL_SaveBMP_IO
|
||||
*/
|
||||
extern DECLSPEC int SDLCALL SDL_SaveBMP(SDL_Surface *surface, const char *file);
|
||||
|
||||
|
|
|
@ -1502,7 +1502,7 @@ static void WaveFreeChunkData(WaveChunk *chunk)
|
|||
chunk->size = 0;
|
||||
}
|
||||
|
||||
static int WaveNextChunk(SDL_RWops *src, WaveChunk *chunk)
|
||||
static int WaveNextChunk(SDL_IOStream *src, WaveChunk *chunk)
|
||||
{
|
||||
Uint32 chunkheader[2];
|
||||
Sint64 nextposition = chunk->position + chunk->length;
|
||||
|
@ -1520,10 +1520,10 @@ static int WaveNextChunk(SDL_RWops *src, WaveChunk *chunk)
|
|||
nextposition++;
|
||||
}
|
||||
|
||||
if (SDL_SeekRW(src, nextposition, SDL_RW_SEEK_SET) != nextposition) {
|
||||
if (SDL_SeekIO(src, nextposition, SDL_IO_SEEK_SET) != nextposition) {
|
||||
/* Not sure how we ended up here. Just abort. */
|
||||
return -2;
|
||||
} else if (SDL_ReadRW(src, chunkheader, sizeof(Uint32) * 2) != (sizeof(Uint32) * 2)) {
|
||||
} else if (SDL_ReadIO(src, chunkheader, sizeof(Uint32) * 2) != (sizeof(Uint32) * 2)) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -1534,7 +1534,7 @@ static int WaveNextChunk(SDL_RWops *src, WaveChunk *chunk)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int WaveReadPartialChunkData(SDL_RWops *src, WaveChunk *chunk, size_t length)
|
||||
static int WaveReadPartialChunkData(SDL_IOStream *src, WaveChunk *chunk, size_t length)
|
||||
{
|
||||
WaveFreeChunkData(chunk);
|
||||
|
||||
|
@ -1548,12 +1548,12 @@ static int WaveReadPartialChunkData(SDL_RWops *src, WaveChunk *chunk, size_t len
|
|||
return -1;
|
||||
}
|
||||
|
||||
if (SDL_SeekRW(src, chunk->position, SDL_RW_SEEK_SET) != chunk->position) {
|
||||
if (SDL_SeekIO(src, chunk->position, SDL_IO_SEEK_SET) != chunk->position) {
|
||||
/* Not sure how we ended up here. Just abort. */
|
||||
return -2;
|
||||
}
|
||||
|
||||
chunk->size = SDL_ReadRW(src, chunk->data, length);
|
||||
chunk->size = SDL_ReadIO(src, chunk->data, length);
|
||||
if (chunk->size != length) {
|
||||
/* Expected to be handled by the caller. */
|
||||
}
|
||||
|
@ -1562,7 +1562,7 @@ static int WaveReadPartialChunkData(SDL_RWops *src, WaveChunk *chunk, size_t len
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int WaveReadChunkData(SDL_RWops *src, WaveChunk *chunk)
|
||||
static int WaveReadChunkData(SDL_IOStream *src, WaveChunk *chunk)
|
||||
{
|
||||
return WaveReadPartialChunkData(src, chunk, chunk->length);
|
||||
}
|
||||
|
@ -1602,14 +1602,14 @@ static int WaveReadFormat(WaveFile *file)
|
|||
{
|
||||
WaveChunk *chunk = &file->chunk;
|
||||
WaveFormat *format = &file->format;
|
||||
SDL_RWops *fmtsrc;
|
||||
SDL_IOStream *fmtsrc;
|
||||
size_t fmtlen = chunk->size;
|
||||
|
||||
if (fmtlen > SDL_MAX_SINT32) {
|
||||
/* Limit given by SDL_RWFromConstMem. */
|
||||
/* Limit given by SDL_IOFromConstMem. */
|
||||
return SDL_SetError("Data of WAVE fmt chunk too big");
|
||||
}
|
||||
fmtsrc = SDL_RWFromConstMem(chunk->data, (int)chunk->size);
|
||||
fmtsrc = SDL_IOFromConstMem(chunk->data, (int)chunk->size);
|
||||
if (!fmtsrc) {
|
||||
return -1;
|
||||
}
|
||||
|
@ -1629,7 +1629,7 @@ static int WaveReadFormat(WaveFile *file)
|
|||
return -1;
|
||||
}
|
||||
} else if (format->encoding == PCM_CODE) {
|
||||
SDL_CloseRW(fmtsrc);
|
||||
SDL_CloseIO(fmtsrc);
|
||||
return SDL_SetError("Missing wBitsPerSample field in WAVE fmt chunk");
|
||||
}
|
||||
|
||||
|
@ -1649,19 +1649,19 @@ static int WaveReadFormat(WaveFile *file)
|
|||
|
||||
/* Extensible header must be at least 22 bytes. */
|
||||
if (fmtlen < 40 || format->extsize < 22) {
|
||||
SDL_CloseRW(fmtsrc);
|
||||
SDL_CloseIO(fmtsrc);
|
||||
return SDL_SetError("Extensible WAVE header too small");
|
||||
}
|
||||
|
||||
if (!SDL_ReadU16LE(fmtsrc, &format->validsamplebits) ||
|
||||
!SDL_ReadU32LE(fmtsrc, &format->channelmask) ||
|
||||
SDL_ReadRW(fmtsrc, format->subformat, 16) != 16) {
|
||||
SDL_ReadIO(fmtsrc, format->subformat, 16) != 16) {
|
||||
}
|
||||
format->samplesperblock = format->validsamplebits;
|
||||
format->encoding = WaveGetFormatGUIDEncoding(format);
|
||||
}
|
||||
|
||||
SDL_CloseRW(fmtsrc);
|
||||
SDL_CloseIO(fmtsrc);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -1769,7 +1769,7 @@ static int WaveCheckFormat(WaveFile *file, size_t datalength)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int WaveLoad(SDL_RWops *src, WaveFile *file, SDL_AudioSpec *spec, Uint8 **audio_buf, Uint32 *audio_len)
|
||||
static int WaveLoad(SDL_IOStream *src, WaveFile *file, SDL_AudioSpec *spec, Uint8 **audio_buf, Uint32 *audio_len)
|
||||
{
|
||||
int result;
|
||||
Uint32 chunkcount = 0;
|
||||
|
@ -1795,7 +1795,7 @@ static int WaveLoad(SDL_RWops *src, WaveFile *file, SDL_AudioSpec *spec, Uint8 *
|
|||
}
|
||||
}
|
||||
|
||||
RIFFstart = SDL_TellRW(src);
|
||||
RIFFstart = SDL_TellIO(src);
|
||||
if (RIFFstart < 0) {
|
||||
return SDL_SetError("Could not seek in file");
|
||||
}
|
||||
|
@ -1897,7 +1897,7 @@ static int WaveLoad(SDL_RWops *src, WaveFile *file, SDL_AudioSpec *spec, Uint8 *
|
|||
file->fact.status = -1;
|
||||
} else {
|
||||
/* Let's use src directly, it's just too convenient. */
|
||||
Sint64 position = SDL_SeekRW(src, chunk->position, SDL_RW_SEEK_SET);
|
||||
Sint64 position = SDL_SeekIO(src, chunk->position, SDL_IO_SEEK_SET);
|
||||
if (position == chunk->position && SDL_ReadU32LE(src, &file->fact.samplelength)) {
|
||||
file->fact.status = 1;
|
||||
} else {
|
||||
|
@ -1940,7 +1940,7 @@ static int WaveLoad(SDL_RWops *src, WaveFile *file, SDL_AudioSpec *spec, Uint8 *
|
|||
if (chunk->fourcc != DATA && chunk->length > 0) {
|
||||
Uint8 tmp;
|
||||
Uint64 position = (Uint64)chunk->position + chunk->length - 1;
|
||||
if (position > SDL_MAX_SINT64 || SDL_SeekRW(src, (Sint64)position, SDL_RW_SEEK_SET) != (Sint64)position) {
|
||||
if (position > SDL_MAX_SINT64 || SDL_SeekIO(src, (Sint64)position, SDL_IO_SEEK_SET) != (Sint64)position) {
|
||||
return SDL_SetError("Could not seek to WAVE chunk data");
|
||||
} else if (!SDL_ReadU8(src, &tmp)) {
|
||||
return SDL_SetError("RIFF size truncates chunk");
|
||||
|
@ -2075,14 +2075,14 @@ static int WaveLoad(SDL_RWops *src, WaveFile *file, SDL_AudioSpec *spec, Uint8 *
|
|||
return 0;
|
||||
}
|
||||
|
||||
int SDL_LoadWAV_RW(SDL_RWops *src, SDL_bool freesrc, SDL_AudioSpec *spec, Uint8 **audio_buf, Uint32 *audio_len)
|
||||
int SDL_LoadWAV_IO(SDL_IOStream *src, SDL_bool freesrc, SDL_AudioSpec *spec, Uint8 **audio_buf, Uint32 *audio_len)
|
||||
{
|
||||
int result = -1;
|
||||
WaveFile file;
|
||||
|
||||
/* Make sure we are passed a valid data source */
|
||||
if (!src) {
|
||||
goto done; /* Error may come from RWops. */
|
||||
goto done; /* Error may come from SDL_IOStream. */
|
||||
} else if (!spec) {
|
||||
SDL_InvalidParamError("spec");
|
||||
goto done;
|
||||
|
@ -2111,19 +2111,19 @@ int SDL_LoadWAV_RW(SDL_RWops *src, SDL_bool freesrc, SDL_AudioSpec *spec, Uint8
|
|||
|
||||
/* Cleanup */
|
||||
if (!freesrc) {
|
||||
SDL_SeekRW(src, file.chunk.position, SDL_RW_SEEK_SET);
|
||||
SDL_SeekIO(src, file.chunk.position, SDL_IO_SEEK_SET);
|
||||
}
|
||||
WaveFreeChunkData(&file.chunk);
|
||||
SDL_free(file.decoderdata);
|
||||
done:
|
||||
if (freesrc && src) {
|
||||
SDL_CloseRW(src);
|
||||
SDL_CloseIO(src);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
int SDL_LoadWAV(const char *path, SDL_AudioSpec *spec, Uint8 **audio_buf, Uint32 *audio_len)
|
||||
{
|
||||
return SDL_LoadWAV_RW(SDL_RWFromFile(path, "rb"), 1, spec, audio_buf, audio_len);
|
||||
return SDL_LoadWAV_IO(SDL_IOFromFile(path, "rb"), 1, spec, audio_buf, audio_len);
|
||||
}
|
||||
|
||||
|
|
|
@ -43,7 +43,7 @@ static int DISKAUDIO_WaitDevice(SDL_AudioDevice *device)
|
|||
|
||||
static int DISKAUDIO_PlayDevice(SDL_AudioDevice *device, const Uint8 *buffer, int buffer_size)
|
||||
{
|
||||
const int written = (int)SDL_WriteRW(device->hidden->io, buffer, (size_t)buffer_size);
|
||||
const int written = (int)SDL_WriteIO(device->hidden->io, buffer, (size_t)buffer_size);
|
||||
if (written != buffer_size) { // If we couldn't write, assume fatal error for now
|
||||
return -1;
|
||||
}
|
||||
|
@ -64,11 +64,11 @@ static int DISKAUDIO_CaptureFromDevice(SDL_AudioDevice *device, void *buffer, in
|
|||
const int origbuflen = buflen;
|
||||
|
||||
if (h->io) {
|
||||
const int br = (int)SDL_ReadRW(h->io, buffer, (size_t)buflen);
|
||||
const int br = (int)SDL_ReadIO(h->io, buffer, (size_t)buflen);
|
||||
buflen -= br;
|
||||
buffer = ((Uint8 *)buffer) + br;
|
||||
if (buflen > 0) { // EOF (or error, but whatever).
|
||||
SDL_CloseRW(h->io);
|
||||
SDL_CloseIO(h->io);
|
||||
h->io = NULL;
|
||||
}
|
||||
}
|
||||
|
@ -88,7 +88,7 @@ static void DISKAUDIO_CloseDevice(SDL_AudioDevice *device)
|
|||
{
|
||||
if (device->hidden) {
|
||||
if (device->hidden->io) {
|
||||
SDL_CloseRW(device->hidden->io);
|
||||
SDL_CloseIO(device->hidden->io);
|
||||
}
|
||||
SDL_free(device->hidden->mixbuf);
|
||||
SDL_free(device->hidden);
|
||||
|
@ -123,7 +123,7 @@ static int DISKAUDIO_OpenDevice(SDL_AudioDevice *device)
|
|||
}
|
||||
|
||||
// Open the "audio device"
|
||||
device->hidden->io = SDL_RWFromFile(fname, iscapture ? "rb" : "wb");
|
||||
device->hidden->io = SDL_IOFromFile(fname, iscapture ? "rb" : "wb");
|
||||
if (!device->hidden->io) {
|
||||
return -1;
|
||||
}
|
||||
|
|
|
@ -28,7 +28,7 @@
|
|||
struct SDL_PrivateAudioData
|
||||
{
|
||||
// The file descriptor for the audio device
|
||||
SDL_RWops *io;
|
||||
SDL_IOStream *io;
|
||||
Uint32 io_delay;
|
||||
Uint8 *mixbuf;
|
||||
};
|
||||
|
|
|
@ -146,13 +146,13 @@ static void SDL_InitDynamicAPI(void);
|
|||
va_end(ap); \
|
||||
return retval; \
|
||||
} \
|
||||
_static size_t SDLCALL SDL_RWprintf##name(SDL_RWops *context, SDL_PRINTF_FORMAT_STRING const char *fmt, ...) \
|
||||
_static size_t SDLCALL SDL_IOprintf##name(SDL_IOStream *context, SDL_PRINTF_FORMAT_STRING const char *fmt, ...) \
|
||||
{ \
|
||||
size_t retval; \
|
||||
va_list ap; \
|
||||
initcall; \
|
||||
va_start(ap, fmt); \
|
||||
retval = jump_table.SDL_RWvprintf(context, fmt, ap); \
|
||||
retval = jump_table.SDL_IOvprintf(context, fmt, ap); \
|
||||
va_end(ap); \
|
||||
return retval; \
|
||||
} \
|
||||
|
@ -297,13 +297,13 @@ static int SDLCALL SDL_swprintf_LOGSDLCALLS(SDL_OUT_Z_CAP(maxlen) wchar_t *buf,
|
|||
va_end(ap);
|
||||
return retval;
|
||||
}
|
||||
_static size_t SDLCALL SDL_RWprintf_LOGSDLCALLS(SDL_RWops *context, SDL_PRINTF_FORMAT_STRING const char *fmt, ...)
|
||||
_static size_t SDLCALL SDL_IOprintf_LOGSDLCALLS(SDL_IOStream *context, SDL_PRINTF_FORMAT_STRING const char *fmt, ...)
|
||||
{
|
||||
size_t retval;
|
||||
va_list ap;
|
||||
SDL_Log_REAL("SDL3CALL SDL_RWprintf");
|
||||
SDL_Log_REAL("SDL3CALL SDL_IOprintf");
|
||||
va_start(ap, fmt);
|
||||
retval = SDL_RWvprintf_REAL(context, fmt, ap);
|
||||
retval = SDL_IOvprintf_REAL(context, fmt, ap);
|
||||
va_end(ap);
|
||||
return retval;
|
||||
}
|
||||
|
|
|
@ -407,7 +407,7 @@ SDL3_0.0.0 {
|
|||
SDL_LinuxSetThreadPriority;
|
||||
SDL_LinuxSetThreadPriorityAndPolicy;
|
||||
SDL_LoadBMP;
|
||||
SDL_LoadBMP_RW;
|
||||
SDL_LoadBMP_IO;
|
||||
SDL_LoadFile;
|
||||
SDL_LoadFile_RW;
|
||||
SDL_LoadFunction;
|
||||
|
@ -464,14 +464,14 @@ SDL3_0.0.0 {
|
|||
SDL_QueryTexture;
|
||||
SDL_Quit;
|
||||
SDL_QuitSubSystem;
|
||||
SDL_RWFromConstMem;
|
||||
SDL_RWFromFile;
|
||||
SDL_RWFromMem;
|
||||
SDL_ReadRW;
|
||||
SDL_SeekRW;
|
||||
SDL_SizeRW;
|
||||
SDL_TellRW;
|
||||
SDL_WriteRW;
|
||||
SDL_IOFromConstMem;
|
||||
SDL_IOFromFile;
|
||||
SDL_IOFromMem;
|
||||
SDL_ReadIO;
|
||||
SDL_SeekIO;
|
||||
SDL_SizeIO;
|
||||
SDL_TellIO;
|
||||
SDL_WriteIO;
|
||||
SDL_RaiseWindow;
|
||||
SDL_ReadU16BE;
|
||||
SDL_ReadU32BE;
|
||||
|
@ -514,7 +514,7 @@ SDL3_0.0.0 {
|
|||
SDL_RunApp;
|
||||
SDL_SIMDGetAlignment;
|
||||
SDL_SaveBMP;
|
||||
SDL_SaveBMP_RW;
|
||||
SDL_SaveBMP_IO;
|
||||
SDL_ScreenKeyboardShown;
|
||||
SDL_ScreenSaverEnabled;
|
||||
SDL_SendGamepadEffect;
|
||||
|
@ -839,7 +839,7 @@ SDL3_0.0.0 {
|
|||
SDL_SetAudioStreamPutCallback;
|
||||
SDL_DestroyAudioStream;
|
||||
SDL_OpenAudioDeviceStream;
|
||||
SDL_LoadWAV_RW;
|
||||
SDL_LoadWAV_IO;
|
||||
SDL_LoadWAV;
|
||||
SDL_MixAudioFormat;
|
||||
SDL_ConvertAudioSamples;
|
||||
|
@ -884,8 +884,8 @@ SDL3_0.0.0 {
|
|||
SDL_GetWindowProperties;
|
||||
SDL_ClearProperty;
|
||||
SDL_EnterAppMainCallbacks;
|
||||
SDL_RWprintf;
|
||||
SDL_RWvprintf;
|
||||
SDL_IOprintf;
|
||||
SDL_IOvprintf;
|
||||
SDL_AllocateEventMemory;
|
||||
SDL_GetDisplayProperties;
|
||||
SDL_SetPropertyWithCleanup;
|
||||
|
@ -976,8 +976,8 @@ SDL3_0.0.0 {
|
|||
SDL_ShowOpenFileDialog;
|
||||
SDL_ShowSaveFileDialog;
|
||||
SDL_ShowOpenFolderDialog;
|
||||
SDL_OpenRW;
|
||||
SDL_CloseRW;
|
||||
SDL_OpenIO;
|
||||
SDL_CloseIO;
|
||||
SDL_GetRWStatus;
|
||||
# extra symbols go here (don't modify this line)
|
||||
local: *;
|
||||
|
|
|
@ -431,7 +431,7 @@
|
|||
#define SDL_LinuxSetThreadPriority SDL_LinuxSetThreadPriority_REAL
|
||||
#define SDL_LinuxSetThreadPriorityAndPolicy SDL_LinuxSetThreadPriorityAndPolicy_REAL
|
||||
#define SDL_LoadBMP SDL_LoadBMP_REAL
|
||||
#define SDL_LoadBMP_RW SDL_LoadBMP_RW_REAL
|
||||
#define SDL_LoadBMP_IO SDL_LoadBMP_IO_REAL
|
||||
#define SDL_LoadFile SDL_LoadFile_REAL
|
||||
#define SDL_LoadFile_RW SDL_LoadFile_RW_REAL
|
||||
#define SDL_LoadFunction SDL_LoadFunction_REAL
|
||||
|
@ -488,14 +488,14 @@
|
|||
#define SDL_QueryTexture SDL_QueryTexture_REAL
|
||||
#define SDL_Quit SDL_Quit_REAL
|
||||
#define SDL_QuitSubSystem SDL_QuitSubSystem_REAL
|
||||
#define SDL_RWFromConstMem SDL_RWFromConstMem_REAL
|
||||
#define SDL_RWFromFile SDL_RWFromFile_REAL
|
||||
#define SDL_RWFromMem SDL_RWFromMem_REAL
|
||||
#define SDL_ReadRW SDL_ReadRW_REAL
|
||||
#define SDL_SeekRW SDL_SeekRW_REAL
|
||||
#define SDL_SizeRW SDL_SizeRW_REAL
|
||||
#define SDL_TellRW SDL_TellRW_REAL
|
||||
#define SDL_WriteRW SDL_WriteRW_REAL
|
||||
#define SDL_IOFromConstMem SDL_IOFromConstMem_REAL
|
||||
#define SDL_IOFromFile SDL_IOFromFile_REAL
|
||||
#define SDL_IOFromMem SDL_IOFromMem_REAL
|
||||
#define SDL_ReadIO SDL_ReadIO_REAL
|
||||
#define SDL_SeekIO SDL_SeekIO_REAL
|
||||
#define SDL_SizeIO SDL_SizeIO_REAL
|
||||
#define SDL_TellIO SDL_TellIO_REAL
|
||||
#define SDL_WriteIO SDL_WriteIO_REAL
|
||||
#define SDL_RaiseWindow SDL_RaiseWindow_REAL
|
||||
#define SDL_ReadU16BE SDL_ReadU16BE_REAL
|
||||
#define SDL_ReadU32BE SDL_ReadU32BE_REAL
|
||||
|
@ -538,7 +538,7 @@
|
|||
#define SDL_RunApp SDL_RunApp_REAL
|
||||
#define SDL_SIMDGetAlignment SDL_SIMDGetAlignment_REAL
|
||||
#define SDL_SaveBMP SDL_SaveBMP_REAL
|
||||
#define SDL_SaveBMP_RW SDL_SaveBMP_RW_REAL
|
||||
#define SDL_SaveBMP_IO SDL_SaveBMP_IO_REAL
|
||||
#define SDL_ScreenKeyboardShown SDL_ScreenKeyboardShown_REAL
|
||||
#define SDL_ScreenSaverEnabled SDL_ScreenSaverEnabled_REAL
|
||||
#define SDL_SendGamepadEffect SDL_SendGamepadEffect_REAL
|
||||
|
@ -864,7 +864,7 @@
|
|||
#define SDL_SetAudioStreamPutCallback SDL_SetAudioStreamPutCallback_REAL
|
||||
#define SDL_DestroyAudioStream SDL_DestroyAudioStream_REAL
|
||||
#define SDL_OpenAudioDeviceStream SDL_OpenAudioDeviceStream_REAL
|
||||
#define SDL_LoadWAV_RW SDL_LoadWAV_RW_REAL
|
||||
#define SDL_LoadWAV_IO SDL_LoadWAV_IO_REAL
|
||||
#define SDL_LoadWAV SDL_LoadWAV_REAL
|
||||
#define SDL_MixAudioFormat SDL_MixAudioFormat_REAL
|
||||
#define SDL_ConvertAudioSamples SDL_ConvertAudioSamples_REAL
|
||||
|
@ -909,8 +909,8 @@
|
|||
#define SDL_GetWindowProperties SDL_GetWindowProperties_REAL
|
||||
#define SDL_ClearProperty SDL_ClearProperty_REAL
|
||||
#define SDL_EnterAppMainCallbacks SDL_EnterAppMainCallbacks_REAL
|
||||
#define SDL_RWprintf SDL_RWprintf_REAL
|
||||
#define SDL_RWvprintf SDL_RWvprintf_REAL
|
||||
#define SDL_IOprintf SDL_IOprintf_REAL
|
||||
#define SDL_IOvprintf SDL_IOvprintf_REAL
|
||||
#define SDL_AllocateEventMemory SDL_AllocateEventMemory_REAL
|
||||
#define SDL_GetDisplayProperties SDL_GetDisplayProperties_REAL
|
||||
#define SDL_SetPropertyWithCleanup SDL_SetPropertyWithCleanup_REAL
|
||||
|
@ -1001,6 +1001,6 @@
|
|||
#define SDL_ShowOpenFileDialog SDL_ShowOpenFileDialog_REAL
|
||||
#define SDL_ShowSaveFileDialog SDL_ShowSaveFileDialog_REAL
|
||||
#define SDL_ShowOpenFolderDialog SDL_ShowOpenFolderDialog_REAL
|
||||
#define SDL_OpenRW SDL_OpenRW_REAL
|
||||
#define SDL_CloseRW SDL_CloseRW_REAL
|
||||
#define SDL_OpenIO SDL_OpenIO_REAL
|
||||
#define SDL_CloseIO SDL_CloseIO_REAL
|
||||
#define SDL_GetRWStatus SDL_GetRWStatus_REAL
|
||||
|
|
|
@ -43,7 +43,7 @@ SDL_DYNAPI_PROC(int,SDL_asprintf,(char **a, SDL_PRINTF_FORMAT_STRING const char
|
|||
SDL_DYNAPI_PROC(int,SDL_snprintf,(SDL_OUT_Z_CAP(b) char *a, size_t b, SDL_PRINTF_FORMAT_STRING const char *c, ...),(a,b,c),return)
|
||||
SDL_DYNAPI_PROC(int,SDL_swprintf,(SDL_OUT_Z_CAP(b) wchar_t *a, size_t b, SDL_PRINTF_FORMAT_STRING const wchar_t *c, ...),(a,b,c),return)
|
||||
SDL_DYNAPI_PROC(int,SDL_sscanf,(const char *a, SDL_SCANF_FORMAT_STRING const char *b, ...),(a,b),return)
|
||||
SDL_DYNAPI_PROC(size_t,SDL_RWprintf,(SDL_RWops *a, SDL_PRINTF_FORMAT_STRING const char *b, ...),(a,b),return)
|
||||
SDL_DYNAPI_PROC(size_t,SDL_IOprintf,(SDL_IOStream *a, SDL_PRINTF_FORMAT_STRING const char *b, ...),(a,b),return)
|
||||
#endif
|
||||
|
||||
#ifdef SDL_CreateThread
|
||||
|
@ -103,7 +103,7 @@ SDL_DYNAPI_PROC(SDL_bool,SDL_IsDeXMode,(void),(),return)
|
|||
|
||||
SDL_DYNAPI_PROC(int,SDL_AddEventWatch,(SDL_EventFilter a, void *b),(a,b),return)
|
||||
SDL_DYNAPI_PROC(int,SDL_AddGamepadMapping,(const char *a),(a),return)
|
||||
SDL_DYNAPI_PROC(int,SDL_AddGamepadMappingsFromRW,(SDL_RWops *a, SDL_bool b),(a,b),return)
|
||||
SDL_DYNAPI_PROC(int,SDL_AddGamepadMappingsFromRW,(SDL_IOStream *a, SDL_bool b),(a,b),return)
|
||||
SDL_DYNAPI_PROC(int,SDL_AddHintCallback,(const char *a, SDL_HintCallback b, void *c),(a,b,c),return)
|
||||
SDL_DYNAPI_PROC(SDL_TimerID,SDL_AddTimer,(Uint32 a, SDL_TimerCallback b, void *c),(a,b,c),return)
|
||||
SDL_DYNAPI_PROC(int,SDL_AtomicAdd,(SDL_AtomicInt *a, int b),(a,b),return)
|
||||
|
@ -485,9 +485,9 @@ SDL_DYNAPI_PROC(SDL_bool,SDL_JoystickConnected,(SDL_Joystick *a),(a),return)
|
|||
SDL_DYNAPI_PROC(SDL_bool,SDL_JoystickEventsEnabled,(void),(),return)
|
||||
SDL_DYNAPI_PROC(SDL_bool,SDL_IsJoystickHaptic,(SDL_Joystick *a),(a),return)
|
||||
SDL_DYNAPI_PROC(SDL_Surface*,SDL_LoadBMP,(const char *a),(a),return)
|
||||
SDL_DYNAPI_PROC(SDL_Surface*,SDL_LoadBMP_RW,(SDL_RWops *a, SDL_bool b),(a,b),return)
|
||||
SDL_DYNAPI_PROC(SDL_Surface*,SDL_LoadBMP_IO,(SDL_IOStream *a, SDL_bool b),(a,b),return)
|
||||
SDL_DYNAPI_PROC(void*,SDL_LoadFile,(const char *a, size_t *b),(a,b),return)
|
||||
SDL_DYNAPI_PROC(void*,SDL_LoadFile_RW,(SDL_RWops *a, size_t *b, SDL_bool c),(a,b,c),return)
|
||||
SDL_DYNAPI_PROC(void*,SDL_LoadFile_RW,(SDL_IOStream *a, size_t *b, SDL_bool c),(a,b,c),return)
|
||||
SDL_DYNAPI_PROC(SDL_FunctionPointer,SDL_LoadFunction,(void *a, const char *b),(a,b),return)
|
||||
SDL_DYNAPI_PROC(void*,SDL_LoadObject,(const char *a),(a),return)
|
||||
SDL_DYNAPI_PROC(void,SDL_LockJoysticks,(void),(),)
|
||||
|
@ -533,22 +533,22 @@ SDL_DYNAPI_PROC(int,SDL_PushEvent,(SDL_Event *a),(a),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(void,SDL_Quit,(void),(),)
|
||||
SDL_DYNAPI_PROC(void,SDL_QuitSubSystem,(Uint32 a),(a),)
|
||||
SDL_DYNAPI_PROC(SDL_RWops*,SDL_RWFromConstMem,(const void *a, size_t b),(a,b),return)
|
||||
SDL_DYNAPI_PROC(SDL_RWops*,SDL_RWFromFile,(const char *a, const char *b),(a,b),return)
|
||||
SDL_DYNAPI_PROC(SDL_RWops*,SDL_RWFromMem,(void *a, size_t b),(a,b),return)
|
||||
SDL_DYNAPI_PROC(size_t,SDL_ReadRW,(SDL_RWops *a, void *b, size_t c),(a,b,c),return)
|
||||
SDL_DYNAPI_PROC(Sint64,SDL_SeekRW,(SDL_RWops *a, Sint64 b, int c),(a,b,c),return)
|
||||
SDL_DYNAPI_PROC(Sint64,SDL_SizeRW,(SDL_RWops *a),(a),return)
|
||||
SDL_DYNAPI_PROC(Sint64,SDL_TellRW,(SDL_RWops *a),(a),return)
|
||||
SDL_DYNAPI_PROC(size_t,SDL_WriteRW,(SDL_RWops *a, const void *b, size_t c),(a,b,c),return)
|
||||
SDL_DYNAPI_PROC(SDL_IOStream*,SDL_IOFromConstMem,(const void *a, size_t b),(a,b),return)
|
||||
SDL_DYNAPI_PROC(SDL_IOStream*,SDL_IOFromFile,(const char *a, const char *b),(a,b),return)
|
||||
SDL_DYNAPI_PROC(SDL_IOStream*,SDL_IOFromMem,(void *a, size_t b),(a,b),return)
|
||||
SDL_DYNAPI_PROC(size_t,SDL_ReadIO,(SDL_IOStream *a, void *b, size_t c),(a,b,c),return)
|
||||
SDL_DYNAPI_PROC(Sint64,SDL_SeekIO,(SDL_IOStream *a, Sint64 b, int c),(a,b,c),return)
|
||||
SDL_DYNAPI_PROC(Sint64,SDL_SizeIO,(SDL_IOStream *a),(a),return)
|
||||
SDL_DYNAPI_PROC(Sint64,SDL_TellIO,(SDL_IOStream *a),(a),return)
|
||||
SDL_DYNAPI_PROC(size_t,SDL_WriteIO,(SDL_IOStream *a, const void *b, size_t c),(a,b,c),return)
|
||||
SDL_DYNAPI_PROC(int,SDL_RaiseWindow,(SDL_Window *a),(a),return)
|
||||
SDL_DYNAPI_PROC(SDL_bool,SDL_ReadU16BE,(SDL_RWops *a, Uint16 *b),(a,b),return)
|
||||
SDL_DYNAPI_PROC(SDL_bool,SDL_ReadU32BE,(SDL_RWops *a, Uint32 *b),(a,b),return)
|
||||
SDL_DYNAPI_PROC(SDL_bool,SDL_ReadU64BE,(SDL_RWops *a, Uint64 *b),(a,b),return)
|
||||
SDL_DYNAPI_PROC(SDL_bool,SDL_ReadU16LE,(SDL_RWops *a, Uint16 *b),(a,b),return)
|
||||
SDL_DYNAPI_PROC(SDL_bool,SDL_ReadU32LE,(SDL_RWops *a, Uint32 *b),(a,b),return)
|
||||
SDL_DYNAPI_PROC(SDL_bool,SDL_ReadU64LE,(SDL_RWops *a, Uint64 *b),(a,b),return)
|
||||
SDL_DYNAPI_PROC(SDL_bool,SDL_ReadU8,(SDL_RWops *a, Uint8 *b),(a,b),return)
|
||||
SDL_DYNAPI_PROC(SDL_bool,SDL_ReadU16BE,(SDL_IOStream *a, Uint16 *b),(a,b),return)
|
||||
SDL_DYNAPI_PROC(SDL_bool,SDL_ReadU32BE,(SDL_IOStream *a, Uint32 *b),(a,b),return)
|
||||
SDL_DYNAPI_PROC(SDL_bool,SDL_ReadU64BE,(SDL_IOStream *a, Uint64 *b),(a,b),return)
|
||||
SDL_DYNAPI_PROC(SDL_bool,SDL_ReadU16LE,(SDL_IOStream *a, Uint16 *b),(a,b),return)
|
||||
SDL_DYNAPI_PROC(SDL_bool,SDL_ReadU32LE,(SDL_IOStream *a, Uint32 *b),(a,b),return)
|
||||
SDL_DYNAPI_PROC(SDL_bool,SDL_ReadU64LE,(SDL_IOStream *a, Uint64 *b),(a,b),return)
|
||||
SDL_DYNAPI_PROC(SDL_bool,SDL_ReadU8,(SDL_IOStream *a, Uint8 *b),(a,b),return)
|
||||
SDL_DYNAPI_PROC(Uint32,SDL_RegisterEvents,(int a),(a),return)
|
||||
SDL_DYNAPI_PROC(SDL_bool,SDL_RemoveTimer,(SDL_TimerID a),(a),return)
|
||||
SDL_DYNAPI_PROC(int,SDL_RenderClear,(SDL_Renderer *a),(a),return)
|
||||
|
@ -582,7 +582,7 @@ SDL_DYNAPI_PROC(int,SDL_RumbleJoystickTriggers,(SDL_Joystick *a, Uint16 b, Uint1
|
|||
SDL_DYNAPI_PROC(int,SDL_RunApp,(int a, char *b[], SDL_main_func c, void *d),(a,b,c,d),return)
|
||||
SDL_DYNAPI_PROC(size_t,SDL_SIMDGetAlignment,(void),(),return)
|
||||
SDL_DYNAPI_PROC(int,SDL_SaveBMP,(SDL_Surface *a, const char *b),(a,b),return)
|
||||
SDL_DYNAPI_PROC(int,SDL_SaveBMP_RW,(SDL_Surface *a, SDL_RWops *b, SDL_bool c),(a,b,c),return)
|
||||
SDL_DYNAPI_PROC(int,SDL_SaveBMP_IO,(SDL_Surface *a, SDL_IOStream *b, SDL_bool c),(a,b,c),return)
|
||||
SDL_DYNAPI_PROC(SDL_bool,SDL_ScreenKeyboardShown,(SDL_Window *a),(a),return)
|
||||
SDL_DYNAPI_PROC(SDL_bool,SDL_ScreenSaverEnabled,(void),(),return)
|
||||
SDL_DYNAPI_PROC(int,SDL_SendGamepadEffect,(SDL_Gamepad *a, const void *b, int c),(a,b,c),return)
|
||||
|
@ -699,13 +699,13 @@ SDL_DYNAPI_PROC(void,SDL_WaitThread,(SDL_Thread *a, int *b),(a,b),)
|
|||
SDL_DYNAPI_PROC(int,SDL_WarpMouseGlobal,(float a, float b),(a,b),return)
|
||||
SDL_DYNAPI_PROC(void,SDL_WarpMouseInWindow,(SDL_Window *a, float b, float c),(a,b,c),)
|
||||
SDL_DYNAPI_PROC(Uint32,SDL_WasInit,(Uint32 a),(a),return)
|
||||
SDL_DYNAPI_PROC(SDL_bool,SDL_WriteU16BE,(SDL_RWops *a, Uint16 b),(a,b),return)
|
||||
SDL_DYNAPI_PROC(SDL_bool,SDL_WriteU32BE,(SDL_RWops *a, Uint32 b),(a,b),return)
|
||||
SDL_DYNAPI_PROC(SDL_bool,SDL_WriteU64BE,(SDL_RWops *a, Uint64 b),(a,b),return)
|
||||
SDL_DYNAPI_PROC(SDL_bool,SDL_WriteU16LE,(SDL_RWops *a, Uint16 b),(a,b),return)
|
||||
SDL_DYNAPI_PROC(SDL_bool,SDL_WriteU32LE,(SDL_RWops *a, Uint32 b),(a,b),return)
|
||||
SDL_DYNAPI_PROC(SDL_bool,SDL_WriteU64LE,(SDL_RWops *a, Uint64 b),(a,b),return)
|
||||
SDL_DYNAPI_PROC(SDL_bool,SDL_WriteU8,(SDL_RWops *a, Uint8 b),(a,b),return)
|
||||
SDL_DYNAPI_PROC(SDL_bool,SDL_WriteU16BE,(SDL_IOStream *a, Uint16 b),(a,b),return)
|
||||
SDL_DYNAPI_PROC(SDL_bool,SDL_WriteU32BE,(SDL_IOStream *a, Uint32 b),(a,b),return)
|
||||
SDL_DYNAPI_PROC(SDL_bool,SDL_WriteU64BE,(SDL_IOStream *a, Uint64 b),(a,b),return)
|
||||
SDL_DYNAPI_PROC(SDL_bool,SDL_WriteU16LE,(SDL_IOStream *a, Uint16 b),(a,b),return)
|
||||
SDL_DYNAPI_PROC(SDL_bool,SDL_WriteU32LE,(SDL_IOStream *a, Uint32 b),(a,b),return)
|
||||
SDL_DYNAPI_PROC(SDL_bool,SDL_WriteU64LE,(SDL_IOStream *a, Uint64 b),(a,b),return)
|
||||
SDL_DYNAPI_PROC(SDL_bool,SDL_WriteU8,(SDL_IOStream *a, Uint8 b),(a,b),return)
|
||||
SDL_DYNAPI_PROC(int,SDL_abs,(int a),(a),return)
|
||||
SDL_DYNAPI_PROC(double,SDL_acos,(double a),(a),return)
|
||||
SDL_DYNAPI_PROC(float,SDL_acosf,(float a),(a),return)
|
||||
|
@ -896,7 +896,7 @@ SDL_DYNAPI_PROC(int,SDL_SetAudioStreamGetCallback,(SDL_AudioStream *a, SDL_Audio
|
|||
SDL_DYNAPI_PROC(int,SDL_SetAudioStreamPutCallback,(SDL_AudioStream *a, SDL_AudioStreamCallback b, void *c),(a,b,c),return)
|
||||
SDL_DYNAPI_PROC(void,SDL_DestroyAudioStream,(SDL_AudioStream *a),(a),)
|
||||
SDL_DYNAPI_PROC(SDL_AudioStream*,SDL_OpenAudioDeviceStream,(SDL_AudioDeviceID a, const SDL_AudioSpec *b, SDL_AudioStreamCallback c, void *d),(a,b,c,d),return)
|
||||
SDL_DYNAPI_PROC(int,SDL_LoadWAV_RW,(SDL_RWops *a, SDL_bool b, SDL_AudioSpec *c, Uint8 **d, Uint32 *e),(a,b,c,d,e),return)
|
||||
SDL_DYNAPI_PROC(int,SDL_LoadWAV_IO,(SDL_IOStream *a, SDL_bool b, SDL_AudioSpec *c, Uint8 **d, Uint32 *e),(a,b,c,d,e),return)
|
||||
SDL_DYNAPI_PROC(int,SDL_LoadWAV,(const char *a, SDL_AudioSpec *b, Uint8 **c, Uint32 *d),(a,b,c,d),return)
|
||||
SDL_DYNAPI_PROC(int,SDL_MixAudioFormat,(Uint8 *a, const Uint8 *b, SDL_AudioFormat c, Uint32 d, int e),(a,b,c,d,e),return)
|
||||
SDL_DYNAPI_PROC(int,SDL_ConvertAudioSamples,(const SDL_AudioSpec *a, const Uint8 *b, int c, const SDL_AudioSpec *d, Uint8 **e, int *f),(a,b,c,d,e,f),return)
|
||||
|
@ -906,18 +906,18 @@ SDL_DYNAPI_PROC(int,SDL_ResumeAudioDevice,(SDL_AudioDeviceID a),(a),return)
|
|||
SDL_DYNAPI_PROC(SDL_bool,SDL_AudioDevicePaused,(SDL_AudioDeviceID a),(a),return)
|
||||
SDL_DYNAPI_PROC(SDL_AudioDeviceID,SDL_GetAudioStreamDevice,(SDL_AudioStream *a),(a),return)
|
||||
SDL_DYNAPI_PROC(int,SDL_ShowWindowSystemMenu,(SDL_Window *a, int b, int c),(a,b,c),return)
|
||||
SDL_DYNAPI_PROC(SDL_bool,SDL_ReadS16LE,(SDL_RWops *a, Sint16 *b),(a,b),return)
|
||||
SDL_DYNAPI_PROC(SDL_bool,SDL_ReadS16BE,(SDL_RWops *a, Sint16 *b),(a,b),return)
|
||||
SDL_DYNAPI_PROC(SDL_bool,SDL_ReadS32LE,(SDL_RWops *a, Sint32 *b),(a,b),return)
|
||||
SDL_DYNAPI_PROC(SDL_bool,SDL_ReadS32BE,(SDL_RWops *a, Sint32 *b),(a,b),return)
|
||||
SDL_DYNAPI_PROC(SDL_bool,SDL_ReadS64LE,(SDL_RWops *a, Sint64 *b),(a,b),return)
|
||||
SDL_DYNAPI_PROC(SDL_bool,SDL_ReadS64BE,(SDL_RWops *a, Sint64 *b),(a,b),return)
|
||||
SDL_DYNAPI_PROC(SDL_bool,SDL_WriteS16LE,(SDL_RWops *a, Sint16 b),(a,b),return)
|
||||
SDL_DYNAPI_PROC(SDL_bool,SDL_WriteS16BE,(SDL_RWops *a, Sint16 b),(a,b),return)
|
||||
SDL_DYNAPI_PROC(SDL_bool,SDL_WriteS32LE,(SDL_RWops *a, Sint32 b),(a,b),return)
|
||||
SDL_DYNAPI_PROC(SDL_bool,SDL_WriteS32BE,(SDL_RWops *a, Sint32 b),(a,b),return)
|
||||
SDL_DYNAPI_PROC(SDL_bool,SDL_WriteS64LE,(SDL_RWops *a, Sint64 b),(a,b),return)
|
||||
SDL_DYNAPI_PROC(SDL_bool,SDL_WriteS64BE,(SDL_RWops *a, Sint64 b),(a,b),return)
|
||||
SDL_DYNAPI_PROC(SDL_bool,SDL_ReadS16LE,(SDL_IOStream *a, Sint16 *b),(a,b),return)
|
||||
SDL_DYNAPI_PROC(SDL_bool,SDL_ReadS16BE,(SDL_IOStream *a, Sint16 *b),(a,b),return)
|
||||
SDL_DYNAPI_PROC(SDL_bool,SDL_ReadS32LE,(SDL_IOStream *a, Sint32 *b),(a,b),return)
|
||||
SDL_DYNAPI_PROC(SDL_bool,SDL_ReadS32BE,(SDL_IOStream *a, Sint32 *b),(a,b),return)
|
||||
SDL_DYNAPI_PROC(SDL_bool,SDL_ReadS64LE,(SDL_IOStream *a, Sint64 *b),(a,b),return)
|
||||
SDL_DYNAPI_PROC(SDL_bool,SDL_ReadS64BE,(SDL_IOStream *a, Sint64 *b),(a,b),return)
|
||||
SDL_DYNAPI_PROC(SDL_bool,SDL_WriteS16LE,(SDL_IOStream *a, Sint16 b),(a,b),return)
|
||||
SDL_DYNAPI_PROC(SDL_bool,SDL_WriteS16BE,(SDL_IOStream *a, Sint16 b),(a,b),return)
|
||||
SDL_DYNAPI_PROC(SDL_bool,SDL_WriteS32LE,(SDL_IOStream *a, Sint32 b),(a,b),return)
|
||||
SDL_DYNAPI_PROC(SDL_bool,SDL_WriteS32BE,(SDL_IOStream *a, Sint32 b),(a,b),return)
|
||||
SDL_DYNAPI_PROC(SDL_bool,SDL_WriteS64LE,(SDL_IOStream *a, Sint64 b),(a,b),return)
|
||||
SDL_DYNAPI_PROC(SDL_bool,SDL_WriteS64BE,(SDL_IOStream *a, Sint64 b),(a,b),return)
|
||||
|
||||
SDL_DYNAPI_PROC(int,SDL_GDKGetDefaultUser,(XUserHandle *a),(a),return)
|
||||
|
||||
|
@ -937,13 +937,13 @@ SDL_DYNAPI_PROC(SDL_PropertiesID,SDL_GetGamepadProperties,(SDL_Gamepad *a),(a),r
|
|||
SDL_DYNAPI_PROC(SDL_PropertiesID,SDL_GetJoystickProperties,(SDL_Joystick *a),(a),return)
|
||||
SDL_DYNAPI_PROC(SDL_PropertiesID,SDL_GetRendererProperties,(SDL_Renderer *a),(a),return)
|
||||
SDL_DYNAPI_PROC(SDL_PropertiesID,SDL_GetTextureProperties,(SDL_Texture *a),(a),return)
|
||||
SDL_DYNAPI_PROC(SDL_PropertiesID,SDL_GetRWProperties,(SDL_RWops *a),(a),return)
|
||||
SDL_DYNAPI_PROC(SDL_PropertiesID,SDL_GetRWProperties,(SDL_IOStream *a),(a),return)
|
||||
SDL_DYNAPI_PROC(SDL_PropertiesID,SDL_GetSensorProperties,(SDL_Sensor *a),(a),return)
|
||||
SDL_DYNAPI_PROC(SDL_PropertiesID,SDL_GetSurfaceProperties,(SDL_Surface *a),(a),return)
|
||||
SDL_DYNAPI_PROC(SDL_PropertiesID,SDL_GetWindowProperties,(SDL_Window *a),(a),return)
|
||||
SDL_DYNAPI_PROC(int,SDL_ClearProperty,(SDL_PropertiesID a, const char *b),(a,b),return)
|
||||
SDL_DYNAPI_PROC(int,SDL_EnterAppMainCallbacks,(int a, char *b[], SDL_AppInit_func c, SDL_AppIterate_func d, SDL_AppEvent_func e, SDL_AppQuit_func f),(a,b,c,d,e,f),return)
|
||||
SDL_DYNAPI_PROC(size_t,SDL_RWvprintf,(SDL_RWops *a, SDL_PRINTF_FORMAT_STRING const char *b, va_list c),(a,b,c),return)
|
||||
SDL_DYNAPI_PROC(size_t,SDL_IOvprintf,(SDL_IOStream *a, SDL_PRINTF_FORMAT_STRING const char *b, va_list c),(a,b,c),return)
|
||||
SDL_DYNAPI_PROC(void*,SDL_AllocateEventMemory,(size_t a),(a),return)
|
||||
SDL_DYNAPI_PROC(SDL_PropertiesID,SDL_GetDisplayProperties,(SDL_DisplayID a),(a),return)
|
||||
SDL_DYNAPI_PROC(int,SDL_SetPropertyWithCleanup,(SDL_PropertiesID a, const char *b, void *c, void (SDLCALL *d)(void *userdata, void *value), void *e),(a,b,c,d,e),return)
|
||||
|
@ -1026,6 +1026,6 @@ 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_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(SDL_RWops*,SDL_OpenRW,(const SDL_RWopsInterface *a, void *b),(a,b),return)
|
||||
SDL_DYNAPI_PROC(int,SDL_CloseRW,(SDL_RWops *a),(a),return)
|
||||
SDL_DYNAPI_PROC(SDL_RWopsStatus,SDL_GetRWStatus,(SDL_RWops *a),(a),return)
|
||||
SDL_DYNAPI_PROC(SDL_IOStream*,SDL_OpenIO,(const SDL_IOStreamInterface *a, void *b),(a,b),return)
|
||||
SDL_DYNAPI_PROC(int,SDL_CloseIO,(SDL_IOStream *a),(a),return)
|
||||
SDL_DYNAPI_PROC(SDL_IOStatus,SDL_GetRWStatus,(SDL_IOStream *a),(a),return)
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -1789,7 +1789,7 @@ static GamepadMapping_t *SDL_PrivateGetGamepadMapping(SDL_JoystickID instance_id
|
|||
/*
|
||||
* Add or update an entry into the Mappings Database
|
||||
*/
|
||||
int SDL_AddGamepadMappingsFromRW(SDL_RWops *src, SDL_bool freesrc)
|
||||
int SDL_AddGamepadMappingsFromRW(SDL_IOStream *src, SDL_bool freesrc)
|
||||
{
|
||||
const char *platform = SDL_GetPlatform();
|
||||
int gamepads = 0;
|
||||
|
@ -1845,7 +1845,7 @@ int SDL_AddGamepadMappingsFromRW(SDL_RWops *src, SDL_bool freesrc)
|
|||
|
||||
int SDL_AddGamepadMappingsFromFile(const char *file)
|
||||
{
|
||||
return SDL_AddGamepadMappingsFromRW(SDL_RWFromFile(file, "rb"), 1);
|
||||
return SDL_AddGamepadMappingsFromRW(SDL_IOFromFile(file, "rb"), 1);
|
||||
}
|
||||
|
||||
int SDL_ReloadGamepadMappings(void)
|
||||
|
|
|
@ -1900,20 +1900,20 @@ static const void *SDLTest_ScreenShotClipboardProvider(void *context, const char
|
|||
SDL_Log("Providing screenshot image to clipboard!\n");
|
||||
|
||||
if (!data->image) {
|
||||
SDL_RWops *file;
|
||||
SDL_IOStream *file;
|
||||
|
||||
file = SDL_RWFromFile(SCREENSHOT_FILE, "r");
|
||||
file = SDL_IOFromFile(SCREENSHOT_FILE, "r");
|
||||
if (file) {
|
||||
size_t length = (size_t)SDL_SizeRW(file);
|
||||
size_t length = (size_t)SDL_SizeIO(file);
|
||||
void *image = SDL_malloc(length);
|
||||
if (image) {
|
||||
if (SDL_ReadRW(file, image, length) != length) {
|
||||
if (SDL_ReadIO(file, image, length) != length) {
|
||||
SDL_Log("Couldn't read %s: %s\n", SCREENSHOT_FILE, SDL_GetError());
|
||||
SDL_free(image);
|
||||
image = NULL;
|
||||
}
|
||||
}
|
||||
SDL_CloseRW(file);
|
||||
SDL_CloseIO(file);
|
||||
|
||||
if (image) {
|
||||
data->image = image;
|
||||
|
@ -1977,14 +1977,14 @@ static void SDLTest_PasteScreenShot(void)
|
|||
void *data = SDL_GetClipboardData(image_formats[i], &size);
|
||||
if (data) {
|
||||
char filename[16];
|
||||
SDL_RWops *file;
|
||||
SDL_IOStream *file;
|
||||
|
||||
SDL_snprintf(filename, sizeof(filename), "clipboard.%s", image_formats[i] + 6);
|
||||
file = SDL_RWFromFile(filename, "w");
|
||||
file = SDL_IOFromFile(filename, "w");
|
||||
if (file) {
|
||||
SDL_Log("Writing clipboard image to %s", filename);
|
||||
SDL_WriteRW(file, data, size);
|
||||
SDL_CloseRW(file);
|
||||
SDL_WriteIO(file, data, size);
|
||||
SDL_CloseIO(file);
|
||||
}
|
||||
SDL_free(data);
|
||||
return;
|
||||
|
|
|
@ -50,7 +50,7 @@
|
|||
#define LCS_WINDOWS_COLOR_SPACE 0x57696E20
|
||||
#endif
|
||||
|
||||
static SDL_bool readRlePixels(SDL_Surface *surface, SDL_RWops *src, int isRle8)
|
||||
static SDL_bool readRlePixels(SDL_Surface *surface, SDL_IOStream *src, int isRle8)
|
||||
{
|
||||
/*
|
||||
| Sets the surface pixels from src. A bmp image is upside down.
|
||||
|
@ -193,7 +193,7 @@ static void CorrectAlphaChannel(SDL_Surface *surface)
|
|||
}
|
||||
}
|
||||
|
||||
SDL_Surface *SDL_LoadBMP_RW(SDL_RWops *src, SDL_bool freesrc)
|
||||
SDL_Surface *SDL_LoadBMP_IO(SDL_IOStream *src, SDL_bool freesrc)
|
||||
{
|
||||
SDL_bool was_error = SDL_TRUE;
|
||||
Sint64 fp_offset = 0;
|
||||
|
@ -239,12 +239,12 @@ SDL_Surface *SDL_LoadBMP_RW(SDL_RWops *src, SDL_bool freesrc)
|
|||
}
|
||||
|
||||
/* Read in the BMP file header */
|
||||
fp_offset = SDL_TellRW(src);
|
||||
fp_offset = SDL_TellIO(src);
|
||||
if (fp_offset < 0) {
|
||||
goto done;
|
||||
}
|
||||
SDL_ClearError();
|
||||
if (SDL_ReadRW(src, magic, 2) != 2) {
|
||||
if (SDL_ReadIO(src, magic, 2) != 2) {
|
||||
goto done;
|
||||
}
|
||||
if (SDL_strncmp(magic, "BM", 2) != 0) {
|
||||
|
@ -340,9 +340,9 @@ SDL_Surface *SDL_LoadBMP_RW(SDL_RWops *src, SDL_bool freesrc)
|
|||
}
|
||||
|
||||
/* skip any header bytes we didn't handle... */
|
||||
headerSize = (Uint32)(SDL_TellRW(src) - (fp_offset + 14));
|
||||
headerSize = (Uint32)(SDL_TellIO(src) - (fp_offset + 14));
|
||||
if (biSize > headerSize) {
|
||||
if (SDL_SeekRW(src, (biSize - headerSize), SDL_RW_SEEK_CUR) < 0) {
|
||||
if (SDL_SeekIO(src, (biSize - headerSize), SDL_IO_SEEK_CUR) < 0) {
|
||||
goto done;
|
||||
}
|
||||
}
|
||||
|
@ -441,7 +441,7 @@ SDL_Surface *SDL_LoadBMP_RW(SDL_RWops *src, SDL_bool freesrc)
|
|||
/* Load the palette, if any */
|
||||
palette = (surface->format)->palette;
|
||||
if (palette) {
|
||||
if (SDL_SeekRW(src, fp_offset + 14 + biSize, SDL_RW_SEEK_SET) < 0) {
|
||||
if (SDL_SeekIO(src, fp_offset + 14 + biSize, SDL_IO_SEEK_SET) < 0) {
|
||||
SDL_Error(SDL_EFSEEK);
|
||||
goto done;
|
||||
}
|
||||
|
@ -492,7 +492,7 @@ SDL_Surface *SDL_LoadBMP_RW(SDL_RWops *src, SDL_bool freesrc)
|
|||
}
|
||||
|
||||
/* Read the surface pixels. Note that the bmp image is upside down */
|
||||
if (SDL_SeekRW(src, fp_offset + bfOffBits, SDL_RW_SEEK_SET) < 0) {
|
||||
if (SDL_SeekIO(src, fp_offset + bfOffBits, SDL_IO_SEEK_SET) < 0) {
|
||||
SDL_Error(SDL_EFSEEK);
|
||||
goto done;
|
||||
}
|
||||
|
@ -512,7 +512,7 @@ SDL_Surface *SDL_LoadBMP_RW(SDL_RWops *src, SDL_bool freesrc)
|
|||
bits = end - surface->pitch;
|
||||
}
|
||||
while (bits >= top && bits < end) {
|
||||
if (SDL_ReadRW(src, bits, surface->pitch) != (size_t)surface->pitch) {
|
||||
if (SDL_ReadIO(src, bits, surface->pitch) != (size_t)surface->pitch) {
|
||||
goto done;
|
||||
}
|
||||
if (biBitCount == 8 && palette && biClrUsed < (1u << biBitCount)) {
|
||||
|
@ -572,23 +572,23 @@ SDL_Surface *SDL_LoadBMP_RW(SDL_RWops *src, SDL_bool freesrc)
|
|||
done:
|
||||
if (was_error) {
|
||||
if (src) {
|
||||
SDL_SeekRW(src, fp_offset, SDL_RW_SEEK_SET);
|
||||
SDL_SeekIO(src, fp_offset, SDL_IO_SEEK_SET);
|
||||
}
|
||||
SDL_DestroySurface(surface);
|
||||
surface = NULL;
|
||||
}
|
||||
if (freesrc && src) {
|
||||
SDL_CloseRW(src);
|
||||
SDL_CloseIO(src);
|
||||
}
|
||||
return surface;
|
||||
}
|
||||
|
||||
SDL_Surface *SDL_LoadBMP(const char *file)
|
||||
{
|
||||
return SDL_LoadBMP_RW(SDL_RWFromFile(file, "rb"), 1);
|
||||
return SDL_LoadBMP_IO(SDL_IOFromFile(file, "rb"), 1);
|
||||
}
|
||||
|
||||
int SDL_SaveBMP_RW(SDL_Surface *surface, SDL_RWops *dst, SDL_bool freedst)
|
||||
int SDL_SaveBMP_IO(SDL_Surface *surface, SDL_IOStream *dst, SDL_bool freedst)
|
||||
{
|
||||
SDL_bool was_error = SDL_TRUE;
|
||||
Sint64 fp_offset, new_offset;
|
||||
|
@ -685,7 +685,7 @@ int SDL_SaveBMP_RW(SDL_Surface *surface, SDL_RWops *dst, SDL_bool freedst)
|
|||
}
|
||||
} else {
|
||||
/* Set no error here because it may overwrite a more useful message from
|
||||
SDL_RWFromFile() if SDL_SaveBMP_RW() is called from SDL_SaveBMP(). */
|
||||
SDL_IOFromFile() if SDL_SaveBMP_IO() is called from SDL_SaveBMP(). */
|
||||
goto done;
|
||||
}
|
||||
|
||||
|
@ -703,11 +703,11 @@ int SDL_SaveBMP_RW(SDL_Surface *surface, SDL_RWops *dst, SDL_bool freedst)
|
|||
bfOffBits = 0; /* We'll write this when we're done */
|
||||
|
||||
/* Write the BMP file header values */
|
||||
fp_offset = SDL_TellRW(dst);
|
||||
fp_offset = SDL_TellIO(dst);
|
||||
if (fp_offset < 0) {
|
||||
goto done;
|
||||
}
|
||||
if (SDL_WriteRW(dst, magic, 2) != 2 ||
|
||||
if (SDL_WriteIO(dst, magic, 2) != 2 ||
|
||||
!SDL_WriteU32LE(dst, bfSize) ||
|
||||
!SDL_WriteU16LE(dst, bfReserved1) ||
|
||||
!SDL_WriteU16LE(dst, bfReserved2) ||
|
||||
|
@ -801,14 +801,14 @@ int SDL_SaveBMP_RW(SDL_Surface *surface, SDL_RWops *dst, SDL_bool freedst)
|
|||
}
|
||||
|
||||
/* Write the bitmap offset */
|
||||
bfOffBits = (Uint32)(SDL_TellRW(dst) - fp_offset);
|
||||
if (SDL_SeekRW(dst, fp_offset + 10, SDL_RW_SEEK_SET) < 0) {
|
||||
bfOffBits = (Uint32)(SDL_TellIO(dst) - fp_offset);
|
||||
if (SDL_SeekIO(dst, fp_offset + 10, SDL_IO_SEEK_SET) < 0) {
|
||||
goto done;
|
||||
}
|
||||
if (!SDL_WriteU32LE(dst, bfOffBits)) {
|
||||
goto done;
|
||||
}
|
||||
if (SDL_SeekRW(dst, fp_offset + bfOffBits, SDL_RW_SEEK_SET) < 0) {
|
||||
if (SDL_SeekIO(dst, fp_offset + bfOffBits, SDL_IO_SEEK_SET) < 0) {
|
||||
goto done;
|
||||
}
|
||||
|
||||
|
@ -817,7 +817,7 @@ int SDL_SaveBMP_RW(SDL_Surface *surface, SDL_RWops *dst, SDL_bool freedst)
|
|||
pad = ((bw % 4) ? (4 - (bw % 4)) : 0);
|
||||
while (bits > (Uint8 *)intermediate_surface->pixels) {
|
||||
bits -= intermediate_surface->pitch;
|
||||
if (SDL_WriteRW(dst, bits, bw) != bw) {
|
||||
if (SDL_WriteIO(dst, bits, bw) != bw) {
|
||||
goto done;
|
||||
}
|
||||
if (pad) {
|
||||
|
@ -831,18 +831,18 @@ int SDL_SaveBMP_RW(SDL_Surface *surface, SDL_RWops *dst, SDL_bool freedst)
|
|||
}
|
||||
|
||||
/* Write the BMP file size */
|
||||
new_offset = SDL_TellRW(dst);
|
||||
new_offset = SDL_TellIO(dst);
|
||||
if (new_offset < 0) {
|
||||
goto done;
|
||||
}
|
||||
bfSize = (Uint32)(new_offset - fp_offset);
|
||||
if (SDL_SeekRW(dst, fp_offset + 2, SDL_RW_SEEK_SET) < 0) {
|
||||
if (SDL_SeekIO(dst, fp_offset + 2, SDL_IO_SEEK_SET) < 0) {
|
||||
goto done;
|
||||
}
|
||||
if (!SDL_WriteU32LE(dst, bfSize)) {
|
||||
goto done;
|
||||
}
|
||||
if (SDL_SeekRW(dst, fp_offset + bfSize, SDL_RW_SEEK_SET) < 0) {
|
||||
if (SDL_SeekIO(dst, fp_offset + bfSize, SDL_IO_SEEK_SET) < 0) {
|
||||
goto done;
|
||||
}
|
||||
|
||||
|
@ -857,7 +857,7 @@ done:
|
|||
SDL_DestroySurface(intermediate_surface);
|
||||
}
|
||||
if (freedst && dst) {
|
||||
if (SDL_CloseRW(dst) < 0) {
|
||||
if (SDL_CloseIO(dst) < 0) {
|
||||
was_error = SDL_TRUE;
|
||||
}
|
||||
}
|
||||
|
@ -869,5 +869,5 @@ done:
|
|||
|
||||
int SDL_SaveBMP(SDL_Surface *surface, const char *file)
|
||||
{
|
||||
return SDL_SaveBMP_RW(surface, SDL_RWFromFile(file, "wb"), 1);
|
||||
return SDL_SaveBMP_IO(surface, SDL_IOFromFile(file, "wb"), 1);
|
||||
}
|
||||
|
|
|
@ -135,9 +135,9 @@ static SDL_Texture *CreateTexture(SDL_Renderer *renderer, unsigned char *data, u
|
|||
{
|
||||
SDL_Texture *texture = NULL;
|
||||
SDL_Surface *surface;
|
||||
SDL_RWops *src = SDL_RWFromConstMem(data, len);
|
||||
SDL_IOStream *src = SDL_IOFromConstMem(data, len);
|
||||
if (src) {
|
||||
surface = SDL_LoadBMP_RW(src, SDL_TRUE);
|
||||
surface = SDL_LoadBMP_IO(src, SDL_TRUE);
|
||||
if (surface) {
|
||||
texture = SDL_CreateTextureFromSurface(renderer, surface);
|
||||
SDL_DestroySurface(surface);
|
||||
|
|
|
@ -40,7 +40,7 @@ static SDLTest_TestSuiteReference *testSuites[] = {
|
|||
&propertiesTestSuite,
|
||||
&rectTestSuite,
|
||||
&renderTestSuite,
|
||||
&rwopsTestSuite,
|
||||
&iostrmTestSuite,
|
||||
&sdltestTestSuite,
|
||||
&stdlibTestSuite,
|
||||
&surfaceTestSuite,
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
|
||||
/**
|
||||
* Automated SDL_RWops test.
|
||||
* Automated SDL_IOStream test.
|
||||
*
|
||||
* Original code written by Edgar Simo "bobbens"
|
||||
* Ported by Markus Kauppila (markus.kauppila@gmail.com)
|
||||
|
@ -22,17 +22,17 @@
|
|||
|
||||
/* ================= Test Case Implementation ================== */
|
||||
|
||||
static const char *RWopsReadTestFilename = "rwops_read";
|
||||
static const char *RWopsWriteTestFilename = "rwops_write";
|
||||
static const char *RWopsAlphabetFilename = "rwops_alphabet";
|
||||
static const char *IOStreamReadTestFilename = "iostrm_read";
|
||||
static const char *IOStreamWriteTestFilename = "iostrm_write";
|
||||
static const char *IOStreamAlphabetFilename = "iostrm_alphabet";
|
||||
|
||||
static const char RWopsHelloWorldTestString[] = "Hello World!";
|
||||
static const char RWopsHelloWorldCompString[] = "Hello World!";
|
||||
static const char RWopsAlphabetString[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
|
||||
static const char IOStreamHelloWorldTestString[] = "Hello World!";
|
||||
static const char IOStreamHelloWorldCompString[] = "Hello World!";
|
||||
static const char IOStreamAlphabetString[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
|
||||
|
||||
/* Fixture */
|
||||
|
||||
static void RWopsSetUp(void *arg)
|
||||
static void IOStreamSetUp(void *arg)
|
||||
{
|
||||
size_t fileLen;
|
||||
FILE *handle;
|
||||
|
@ -40,34 +40,34 @@ static void RWopsSetUp(void *arg)
|
|||
int result;
|
||||
|
||||
/* Clean up from previous runs (if any); ignore errors */
|
||||
(void)remove(RWopsReadTestFilename);
|
||||
(void)remove(RWopsWriteTestFilename);
|
||||
(void)remove(RWopsAlphabetFilename);
|
||||
(void)remove(IOStreamReadTestFilename);
|
||||
(void)remove(IOStreamWriteTestFilename);
|
||||
(void)remove(IOStreamAlphabetFilename);
|
||||
|
||||
/* Create a test file */
|
||||
handle = fopen(RWopsReadTestFilename, "w");
|
||||
SDLTest_AssertCheck(handle != NULL, "Verify creation of file '%s' returned non NULL handle", RWopsReadTestFilename);
|
||||
handle = fopen(IOStreamReadTestFilename, "w");
|
||||
SDLTest_AssertCheck(handle != NULL, "Verify creation of file '%s' returned non NULL handle", IOStreamReadTestFilename);
|
||||
if (handle == NULL) {
|
||||
return;
|
||||
}
|
||||
|
||||
/* Write some known text into it */
|
||||
fileLen = SDL_strlen(RWopsHelloWorldTestString);
|
||||
writtenLen = fwrite(RWopsHelloWorldTestString, 1, fileLen, handle);
|
||||
fileLen = SDL_strlen(IOStreamHelloWorldTestString);
|
||||
writtenLen = fwrite(IOStreamHelloWorldTestString, 1, fileLen, handle);
|
||||
SDLTest_AssertCheck(fileLen == writtenLen, "Verify number of written bytes, expected %i, got %i", (int)fileLen, (int)writtenLen);
|
||||
result = fclose(handle);
|
||||
SDLTest_AssertCheck(result == 0, "Verify result from fclose, expected 0, got %i", result);
|
||||
|
||||
/* Create a second test file */
|
||||
handle = fopen(RWopsAlphabetFilename, "w");
|
||||
SDLTest_AssertCheck(handle != NULL, "Verify creation of file '%s' returned non NULL handle", RWopsAlphabetFilename);
|
||||
handle = fopen(IOStreamAlphabetFilename, "w");
|
||||
SDLTest_AssertCheck(handle != NULL, "Verify creation of file '%s' returned non NULL handle", IOStreamAlphabetFilename);
|
||||
if (handle == NULL) {
|
||||
return;
|
||||
}
|
||||
|
||||
/* Write alphabet text into it */
|
||||
fileLen = SDL_strlen(RWopsAlphabetString);
|
||||
writtenLen = fwrite(RWopsAlphabetString, 1, fileLen, handle);
|
||||
fileLen = SDL_strlen(IOStreamAlphabetString);
|
||||
writtenLen = fwrite(IOStreamAlphabetString, 1, fileLen, handle);
|
||||
SDLTest_AssertCheck(fileLen == writtenLen, "Verify number of written bytes, expected %i, got %i", (int)fileLen, (int)writtenLen);
|
||||
result = fclose(handle);
|
||||
SDLTest_AssertCheck(result == 0, "Verify result from fclose, expected 0, got %i", result);
|
||||
|
@ -75,16 +75,16 @@ static void RWopsSetUp(void *arg)
|
|||
SDLTest_AssertPass("Creation of test file completed");
|
||||
}
|
||||
|
||||
static void RWopsTearDown(void *arg)
|
||||
static void IOStreamTearDown(void *arg)
|
||||
{
|
||||
int result;
|
||||
|
||||
/* Remove the created files to clean up; ignore errors for write filename */
|
||||
result = remove(RWopsReadTestFilename);
|
||||
SDLTest_AssertCheck(result == 0, "Verify result from remove(%s), expected 0, got %i", RWopsReadTestFilename, result);
|
||||
(void)remove(RWopsWriteTestFilename);
|
||||
result = remove(RWopsAlphabetFilename);
|
||||
SDLTest_AssertCheck(result == 0, "Verify result from remove(%s), expected 0, got %i", RWopsAlphabetFilename, result);
|
||||
result = remove(IOStreamReadTestFilename);
|
||||
SDLTest_AssertCheck(result == 0, "Verify result from remove(%s), expected 0, got %i", IOStreamReadTestFilename, result);
|
||||
(void)remove(IOStreamWriteTestFilename);
|
||||
result = remove(IOStreamAlphabetFilename);
|
||||
SDLTest_AssertCheck(result == 0, "Verify result from remove(%s), expected 0, got %i", IOStreamAlphabetFilename, result);
|
||||
|
||||
SDLTest_AssertPass("Cleanup of test files completed");
|
||||
}
|
||||
|
@ -92,12 +92,12 @@ static void RWopsTearDown(void *arg)
|
|||
/**
|
||||
* Makes sure parameters work properly. Local helper function.
|
||||
*
|
||||
* \sa SDL_SeekRW
|
||||
* \sa SDL_ReadRW
|
||||
* \sa SDL_SeekIO
|
||||
* \sa SDL_ReadIO
|
||||
*/
|
||||
static void testGenericRWopsValidations(SDL_RWops *rw, SDL_bool write)
|
||||
static void testGenericIOStreamValidations(SDL_IOStream *rw, SDL_bool write)
|
||||
{
|
||||
char buf[sizeof(RWopsHelloWorldTestString)];
|
||||
char buf[sizeof(IOStreamHelloWorldTestString)];
|
||||
Sint64 i;
|
||||
size_t s;
|
||||
int seekPos = SDLTest_RandomIntegerInRange(4, 8);
|
||||
|
@ -106,140 +106,140 @@ static void testGenericRWopsValidations(SDL_RWops *rw, SDL_bool write)
|
|||
SDL_zeroa(buf);
|
||||
|
||||
/* Set to start. */
|
||||
i = SDL_SeekRW(rw, 0, SDL_RW_SEEK_SET);
|
||||
SDLTest_AssertPass("Call to SDL_SeekRW succeeded");
|
||||
SDLTest_AssertCheck(i == (Sint64)0, "Verify seek to 0 with SDL_SeekRW (SDL_RW_SEEK_SET), expected 0, got %" SDL_PRIs64, i);
|
||||
i = SDL_SeekIO(rw, 0, SDL_IO_SEEK_SET);
|
||||
SDLTest_AssertPass("Call to SDL_SeekIO succeeded");
|
||||
SDLTest_AssertCheck(i == (Sint64)0, "Verify seek to 0 with SDL_SeekIO (SDL_IO_SEEK_SET), expected 0, got %" SDL_PRIs64, i);
|
||||
|
||||
/* Test write */
|
||||
s = SDL_WriteRW(rw, RWopsHelloWorldTestString, sizeof(RWopsHelloWorldTestString) - 1);
|
||||
SDLTest_AssertPass("Call to SDL_WriteRW succeeded");
|
||||
s = SDL_WriteIO(rw, IOStreamHelloWorldTestString, sizeof(IOStreamHelloWorldTestString) - 1);
|
||||
SDLTest_AssertPass("Call to SDL_WriteIO succeeded");
|
||||
if (write) {
|
||||
SDLTest_AssertCheck(s == sizeof(RWopsHelloWorldTestString) - 1, "Verify result of writing with SDL_WriteRW, expected %i, got %i", (int)sizeof(RWopsHelloWorldTestString) - 1, (int)s);
|
||||
SDLTest_AssertCheck(s == sizeof(IOStreamHelloWorldTestString) - 1, "Verify result of writing with SDL_WriteIO, expected %i, got %i", (int)sizeof(IOStreamHelloWorldTestString) - 1, (int)s);
|
||||
} else {
|
||||
SDLTest_AssertCheck(s == 0, "Verify result of writing with SDL_WriteRW, expected: 0, got %i", (int)s);
|
||||
SDLTest_AssertCheck(s == 0, "Verify result of writing with SDL_WriteIO, expected: 0, got %i", (int)s);
|
||||
}
|
||||
|
||||
/* Test seek to random position */
|
||||
i = SDL_SeekRW(rw, seekPos, SDL_RW_SEEK_SET);
|
||||
SDLTest_AssertPass("Call to SDL_SeekRW succeeded");
|
||||
SDLTest_AssertCheck(i == (Sint64)seekPos, "Verify seek to %i with SDL_SeekRW (SDL_RW_SEEK_SET), expected %i, got %" SDL_PRIs64, seekPos, seekPos, i);
|
||||
i = SDL_SeekIO(rw, seekPos, SDL_IO_SEEK_SET);
|
||||
SDLTest_AssertPass("Call to SDL_SeekIO succeeded");
|
||||
SDLTest_AssertCheck(i == (Sint64)seekPos, "Verify seek to %i with SDL_SeekIO (SDL_IO_SEEK_SET), expected %i, got %" SDL_PRIs64, seekPos, seekPos, i);
|
||||
|
||||
/* Test seek back to start */
|
||||
i = SDL_SeekRW(rw, 0, SDL_RW_SEEK_SET);
|
||||
SDLTest_AssertPass("Call to SDL_SeekRW succeeded");
|
||||
SDLTest_AssertCheck(i == (Sint64)0, "Verify seek to 0 with SDL_SeekRW (SDL_RW_SEEK_SET), expected 0, got %" SDL_PRIs64, i);
|
||||
i = SDL_SeekIO(rw, 0, SDL_IO_SEEK_SET);
|
||||
SDLTest_AssertPass("Call to SDL_SeekIO succeeded");
|
||||
SDLTest_AssertCheck(i == (Sint64)0, "Verify seek to 0 with SDL_SeekIO (SDL_IO_SEEK_SET), expected 0, got %" SDL_PRIs64, i);
|
||||
|
||||
/* Test read */
|
||||
s = SDL_ReadRW(rw, buf, sizeof(RWopsHelloWorldTestString) - 1);
|
||||
SDLTest_AssertPass("Call to SDL_ReadRW succeeded");
|
||||
s = SDL_ReadIO(rw, buf, sizeof(IOStreamHelloWorldTestString) - 1);
|
||||
SDLTest_AssertPass("Call to SDL_ReadIO succeeded");
|
||||
SDLTest_AssertCheck(
|
||||
s == (sizeof(RWopsHelloWorldTestString) - 1),
|
||||
"Verify result from SDL_ReadRW, expected %i, got %i",
|
||||
(int)(sizeof(RWopsHelloWorldTestString) - 1),
|
||||
s == (sizeof(IOStreamHelloWorldTestString) - 1),
|
||||
"Verify result from SDL_ReadIO, expected %i, got %i",
|
||||
(int)(sizeof(IOStreamHelloWorldTestString) - 1),
|
||||
(int)s);
|
||||
SDLTest_AssertCheck(
|
||||
SDL_memcmp(buf, RWopsHelloWorldTestString, sizeof(RWopsHelloWorldTestString) - 1) == 0,
|
||||
"Verify read bytes match expected string, expected '%s', got '%s'", RWopsHelloWorldTestString, buf);
|
||||
SDL_memcmp(buf, IOStreamHelloWorldTestString, sizeof(IOStreamHelloWorldTestString) - 1) == 0,
|
||||
"Verify read bytes match expected string, expected '%s', got '%s'", IOStreamHelloWorldTestString, buf);
|
||||
|
||||
/* Test seek back to start */
|
||||
i = SDL_SeekRW(rw, 0, SDL_RW_SEEK_SET);
|
||||
SDLTest_AssertPass("Call to SDL_SeekRW succeeded");
|
||||
SDLTest_AssertCheck(i == (Sint64)0, "Verify seek to 0 with SDL_SeekRW (SDL_RW_SEEK_SET), expected 0, got %" SDL_PRIs64, i);
|
||||
i = SDL_SeekIO(rw, 0, SDL_IO_SEEK_SET);
|
||||
SDLTest_AssertPass("Call to SDL_SeekIO succeeded");
|
||||
SDLTest_AssertCheck(i == (Sint64)0, "Verify seek to 0 with SDL_SeekIO (SDL_IO_SEEK_SET), expected 0, got %" SDL_PRIs64, i);
|
||||
|
||||
/* Test printf */
|
||||
s = SDL_RWprintf(rw, "%s", RWopsHelloWorldTestString);
|
||||
SDLTest_AssertPass("Call to SDL_RWprintf succeeded");
|
||||
s = SDL_IOprintf(rw, "%s", IOStreamHelloWorldTestString);
|
||||
SDLTest_AssertPass("Call to SDL_IOprintf succeeded");
|
||||
if (write) {
|
||||
SDLTest_AssertCheck(s == sizeof(RWopsHelloWorldTestString) - 1, "Verify result of writing with SDL_RWprintf, expected %i, got %i", (int)sizeof(RWopsHelloWorldTestString) - 1, (int)s);
|
||||
SDLTest_AssertCheck(s == sizeof(IOStreamHelloWorldTestString) - 1, "Verify result of writing with SDL_IOprintf, expected %i, got %i", (int)sizeof(IOStreamHelloWorldTestString) - 1, (int)s);
|
||||
} else {
|
||||
SDLTest_AssertCheck(s == 0, "Verify result of writing with SDL_WriteRW, expected: 0, got %i", (int)s);
|
||||
SDLTest_AssertCheck(s == 0, "Verify result of writing with SDL_WriteIO, expected: 0, got %i", (int)s);
|
||||
}
|
||||
|
||||
/* Test seek back to start */
|
||||
i = SDL_SeekRW(rw, 0, SDL_RW_SEEK_SET);
|
||||
SDLTest_AssertPass("Call to SDL_SeekRW succeeded");
|
||||
SDLTest_AssertCheck(i == (Sint64)0, "Verify seek to 0 with SDL_SeekRW (SDL_RW_SEEK_SET), expected 0, got %" SDL_PRIs64, i);
|
||||
i = SDL_SeekIO(rw, 0, SDL_IO_SEEK_SET);
|
||||
SDLTest_AssertPass("Call to SDL_SeekIO succeeded");
|
||||
SDLTest_AssertCheck(i == (Sint64)0, "Verify seek to 0 with SDL_SeekIO (SDL_IO_SEEK_SET), expected 0, got %" SDL_PRIs64, i);
|
||||
|
||||
/* Test read */
|
||||
s = SDL_ReadRW(rw, buf, sizeof(RWopsHelloWorldTestString) - 1);
|
||||
SDLTest_AssertPass("Call to SDL_ReadRW succeeded");
|
||||
s = SDL_ReadIO(rw, buf, sizeof(IOStreamHelloWorldTestString) - 1);
|
||||
SDLTest_AssertPass("Call to SDL_ReadIO succeeded");
|
||||
SDLTest_AssertCheck(
|
||||
s == (sizeof(RWopsHelloWorldTestString) - 1),
|
||||
"Verify result from SDL_ReadRW, expected %i, got %i",
|
||||
(int)(sizeof(RWopsHelloWorldTestString) - 1),
|
||||
s == (sizeof(IOStreamHelloWorldTestString) - 1),
|
||||
"Verify result from SDL_ReadIO, expected %i, got %i",
|
||||
(int)(sizeof(IOStreamHelloWorldTestString) - 1),
|
||||
(int)s);
|
||||
SDLTest_AssertCheck(
|
||||
SDL_memcmp(buf, RWopsHelloWorldTestString, sizeof(RWopsHelloWorldTestString) - 1) == 0,
|
||||
"Verify read bytes match expected string, expected '%s', got '%s'", RWopsHelloWorldTestString, buf);
|
||||
SDL_memcmp(buf, IOStreamHelloWorldTestString, sizeof(IOStreamHelloWorldTestString) - 1) == 0,
|
||||
"Verify read bytes match expected string, expected '%s', got '%s'", IOStreamHelloWorldTestString, buf);
|
||||
|
||||
/* More seek tests. */
|
||||
i = SDL_SeekRW(rw, -4, SDL_RW_SEEK_CUR);
|
||||
SDLTest_AssertPass("Call to SDL_SeekRW(...,-4,SDL_RW_SEEK_CUR) succeeded");
|
||||
i = SDL_SeekIO(rw, -4, SDL_IO_SEEK_CUR);
|
||||
SDLTest_AssertPass("Call to SDL_SeekIO(...,-4,SDL_IO_SEEK_CUR) succeeded");
|
||||
SDLTest_AssertCheck(
|
||||
i == (Sint64)(sizeof(RWopsHelloWorldTestString) - 5),
|
||||
"Verify seek to -4 with SDL_SeekRW (SDL_RW_SEEK_CUR), expected %i, got %i",
|
||||
(int)(sizeof(RWopsHelloWorldTestString) - 5),
|
||||
i == (Sint64)(sizeof(IOStreamHelloWorldTestString) - 5),
|
||||
"Verify seek to -4 with SDL_SeekIO (SDL_IO_SEEK_CUR), expected %i, got %i",
|
||||
(int)(sizeof(IOStreamHelloWorldTestString) - 5),
|
||||
(int)i);
|
||||
|
||||
i = SDL_SeekRW(rw, -1, SDL_RW_SEEK_END);
|
||||
SDLTest_AssertPass("Call to SDL_SeekRW(...,-1,SDL_RW_SEEK_END) succeeded");
|
||||
i = SDL_SeekIO(rw, -1, SDL_IO_SEEK_END);
|
||||
SDLTest_AssertPass("Call to SDL_SeekIO(...,-1,SDL_IO_SEEK_END) succeeded");
|
||||
SDLTest_AssertCheck(
|
||||
i == (Sint64)(sizeof(RWopsHelloWorldTestString) - 2),
|
||||
"Verify seek to -1 with SDL_SeekRW (SDL_RW_SEEK_END), expected %i, got %i",
|
||||
(int)(sizeof(RWopsHelloWorldTestString) - 2),
|
||||
i == (Sint64)(sizeof(IOStreamHelloWorldTestString) - 2),
|
||||
"Verify seek to -1 with SDL_SeekIO (SDL_IO_SEEK_END), expected %i, got %i",
|
||||
(int)(sizeof(IOStreamHelloWorldTestString) - 2),
|
||||
(int)i);
|
||||
|
||||
/* Invalid whence seek */
|
||||
i = SDL_SeekRW(rw, 0, 999);
|
||||
SDLTest_AssertPass("Call to SDL_SeekRW(...,0,invalid_whence) succeeded");
|
||||
i = SDL_SeekIO(rw, 0, 999);
|
||||
SDLTest_AssertPass("Call to SDL_SeekIO(...,0,invalid_whence) succeeded");
|
||||
SDLTest_AssertCheck(
|
||||
i == (Sint64)(-1),
|
||||
"Verify seek with SDL_SeekRW (invalid_whence); expected: -1, got %i",
|
||||
"Verify seek with SDL_SeekIO (invalid_whence); expected: -1, got %i",
|
||||
(int)i);
|
||||
}
|
||||
|
||||
/**
|
||||
* Negative test for SDL_RWFromFile parameters
|
||||
* Negative test for SDL_IOFromFile parameters
|
||||
*
|
||||
* \sa SDL_RWFromFile
|
||||
* \sa SDL_IOFromFile
|
||||
*
|
||||
*/
|
||||
static int rwops_testParamNegative(void *arg)
|
||||
static int iostrm_testParamNegative(void *arg)
|
||||
{
|
||||
SDL_RWops *rwops;
|
||||
SDL_IOStream *iostrm;
|
||||
|
||||
/* These should all fail. */
|
||||
rwops = SDL_RWFromFile(NULL, NULL);
|
||||
SDLTest_AssertPass("Call to SDL_RWFromFile(NULL, NULL) succeeded");
|
||||
SDLTest_AssertCheck(rwops == NULL, "Verify SDL_RWFromFile(NULL, NULL) returns NULL");
|
||||
iostrm = SDL_IOFromFile(NULL, NULL);
|
||||
SDLTest_AssertPass("Call to SDL_IOFromFile(NULL, NULL) succeeded");
|
||||
SDLTest_AssertCheck(iostrm == NULL, "Verify SDL_IOFromFile(NULL, NULL) returns NULL");
|
||||
|
||||
rwops = SDL_RWFromFile(NULL, "ab+");
|
||||
SDLTest_AssertPass("Call to SDL_RWFromFile(NULL, \"ab+\") succeeded");
|
||||
SDLTest_AssertCheck(rwops == NULL, "Verify SDL_RWFromFile(NULL, \"ab+\") returns NULL");
|
||||
iostrm = SDL_IOFromFile(NULL, "ab+");
|
||||
SDLTest_AssertPass("Call to SDL_IOFromFile(NULL, \"ab+\") succeeded");
|
||||
SDLTest_AssertCheck(iostrm == NULL, "Verify SDL_IOFromFile(NULL, \"ab+\") returns NULL");
|
||||
|
||||
rwops = SDL_RWFromFile(NULL, "sldfkjsldkfj");
|
||||
SDLTest_AssertPass("Call to SDL_RWFromFile(NULL, \"sldfkjsldkfj\") succeeded");
|
||||
SDLTest_AssertCheck(rwops == NULL, "Verify SDL_RWFromFile(NULL, \"sldfkjsldkfj\") returns NULL");
|
||||
iostrm = SDL_IOFromFile(NULL, "sldfkjsldkfj");
|
||||
SDLTest_AssertPass("Call to SDL_IOFromFile(NULL, \"sldfkjsldkfj\") succeeded");
|
||||
SDLTest_AssertCheck(iostrm == NULL, "Verify SDL_IOFromFile(NULL, \"sldfkjsldkfj\") returns NULL");
|
||||
|
||||
rwops = SDL_RWFromFile("something", "");
|
||||
SDLTest_AssertPass("Call to SDL_RWFromFile(\"something\", \"\") succeeded");
|
||||
SDLTest_AssertCheck(rwops == NULL, "Verify SDL_RWFromFile(\"something\", \"\") returns NULL");
|
||||
iostrm = SDL_IOFromFile("something", "");
|
||||
SDLTest_AssertPass("Call to SDL_IOFromFile(\"something\", \"\") succeeded");
|
||||
SDLTest_AssertCheck(iostrm == NULL, "Verify SDL_IOFromFile(\"something\", \"\") returns NULL");
|
||||
|
||||
rwops = SDL_RWFromFile("something", NULL);
|
||||
SDLTest_AssertPass("Call to SDL_RWFromFile(\"something\", NULL) succeeded");
|
||||
SDLTest_AssertCheck(rwops == NULL, "Verify SDL_RWFromFile(\"something\", NULL) returns NULL");
|
||||
iostrm = SDL_IOFromFile("something", NULL);
|
||||
SDLTest_AssertPass("Call to SDL_IOFromFile(\"something\", NULL) succeeded");
|
||||
SDLTest_AssertCheck(iostrm == NULL, "Verify SDL_IOFromFile(\"something\", NULL) returns NULL");
|
||||
|
||||
rwops = SDL_RWFromMem(NULL, 10);
|
||||
SDLTest_AssertPass("Call to SDL_RWFromMem(NULL, 10) succeeded");
|
||||
SDLTest_AssertCheck(rwops == NULL, "Verify SDL_RWFromMem(NULL, 10) returns NULL");
|
||||
iostrm = SDL_IOFromMem(NULL, 10);
|
||||
SDLTest_AssertPass("Call to SDL_IOFromMem(NULL, 10) succeeded");
|
||||
SDLTest_AssertCheck(iostrm == NULL, "Verify SDL_IOFromMem(NULL, 10) returns NULL");
|
||||
|
||||
rwops = SDL_RWFromMem((void *)RWopsAlphabetString, 0);
|
||||
SDLTest_AssertPass("Call to SDL_RWFromMem(data, 0) succeeded");
|
||||
SDLTest_AssertCheck(rwops == NULL, "Verify SDL_RWFromMem(data, 0) returns NULL");
|
||||
iostrm = SDL_IOFromMem((void *)IOStreamAlphabetString, 0);
|
||||
SDLTest_AssertPass("Call to SDL_IOFromMem(data, 0) succeeded");
|
||||
SDLTest_AssertCheck(iostrm == NULL, "Verify SDL_IOFromMem(data, 0) returns NULL");
|
||||
|
||||
rwops = SDL_RWFromConstMem((const void *)RWopsAlphabetString, 0);
|
||||
SDLTest_AssertPass("Call to SDL_RWFromConstMem(data, 0) succeeded");
|
||||
SDLTest_AssertCheck(rwops == NULL, "Verify SDL_RWFromConstMem(data, 0) returns NULL");
|
||||
iostrm = SDL_IOFromConstMem((const void *)IOStreamAlphabetString, 0);
|
||||
SDLTest_AssertPass("Call to SDL_IOFromConstMem(data, 0) succeeded");
|
||||
SDLTest_AssertCheck(iostrm == NULL, "Verify SDL_IOFromConstMem(data, 0) returns NULL");
|
||||
|
||||
return TEST_COMPLETED;
|
||||
}
|
||||
|
@ -247,22 +247,22 @@ static int rwops_testParamNegative(void *arg)
|
|||
/**
|
||||
* Tests opening from memory.
|
||||
*
|
||||
* \sa SDL_RWFromMem
|
||||
* \sa SDL_RWClose
|
||||
* \sa SDL_IOFromMem
|
||||
* \sa SDL_CloseIO
|
||||
*/
|
||||
static int rwops_testMem(void *arg)
|
||||
static int iostrm_testMem(void *arg)
|
||||
{
|
||||
char mem[sizeof(RWopsHelloWorldTestString)];
|
||||
SDL_RWops *rw;
|
||||
char mem[sizeof(IOStreamHelloWorldTestString)];
|
||||
SDL_IOStream *rw;
|
||||
int result;
|
||||
|
||||
/* Clear buffer */
|
||||
SDL_zeroa(mem);
|
||||
|
||||
/* Open */
|
||||
rw = SDL_RWFromMem(mem, sizeof(RWopsHelloWorldTestString) - 1);
|
||||
SDLTest_AssertPass("Call to SDL_RWFromMem() succeeded");
|
||||
SDLTest_AssertCheck(rw != NULL, "Verify opening memory with SDL_RWFromMem does not return NULL");
|
||||
rw = SDL_IOFromMem(mem, sizeof(IOStreamHelloWorldTestString) - 1);
|
||||
SDLTest_AssertPass("Call to SDL_IOFromMem() succeeded");
|
||||
SDLTest_AssertCheck(rw != NULL, "Verify opening memory with SDL_IOFromMem does not return NULL");
|
||||
|
||||
/* Bail out if NULL */
|
||||
if (rw == NULL) {
|
||||
|
@ -270,11 +270,11 @@ static int rwops_testMem(void *arg)
|
|||
}
|
||||
|
||||
/* Run generic tests */
|
||||
testGenericRWopsValidations(rw, SDL_TRUE);
|
||||
testGenericIOStreamValidations(rw, SDL_TRUE);
|
||||
|
||||
/* Close */
|
||||
result = SDL_CloseRW(rw);
|
||||
SDLTest_AssertPass("Call to SDL_CloseRW() succeeded");
|
||||
result = SDL_CloseIO(rw);
|
||||
SDLTest_AssertPass("Call to SDL_CloseIO() succeeded");
|
||||
SDLTest_AssertCheck(result == 0, "Verify result value is 0; got: %d", result);
|
||||
|
||||
return TEST_COMPLETED;
|
||||
|
@ -283,18 +283,18 @@ static int rwops_testMem(void *arg)
|
|||
/**
|
||||
* Tests opening from memory.
|
||||
*
|
||||
* \sa SDL_RWFromConstMem
|
||||
* \sa SDL_RWClose
|
||||
* \sa SDL_IOFromConstMem
|
||||
* \sa SDL_CloseIO
|
||||
*/
|
||||
static int rwops_testConstMem(void *arg)
|
||||
static int iostrm_testConstMem(void *arg)
|
||||
{
|
||||
SDL_RWops *rw;
|
||||
SDL_IOStream *rw;
|
||||
int result;
|
||||
|
||||
/* Open handle */
|
||||
rw = SDL_RWFromConstMem(RWopsHelloWorldCompString, sizeof(RWopsHelloWorldCompString) - 1);
|
||||
SDLTest_AssertPass("Call to SDL_RWFromConstMem() succeeded");
|
||||
SDLTest_AssertCheck(rw != NULL, "Verify opening memory with SDL_RWFromConstMem does not return NULL");
|
||||
rw = SDL_IOFromConstMem(IOStreamHelloWorldCompString, sizeof(IOStreamHelloWorldCompString) - 1);
|
||||
SDLTest_AssertPass("Call to SDL_IOFromConstMem() succeeded");
|
||||
SDLTest_AssertCheck(rw != NULL, "Verify opening memory with SDL_IOFromConstMem does not return NULL");
|
||||
|
||||
/* Bail out if NULL */
|
||||
if (rw == NULL) {
|
||||
|
@ -302,11 +302,11 @@ static int rwops_testConstMem(void *arg)
|
|||
}
|
||||
|
||||
/* Run generic tests */
|
||||
testGenericRWopsValidations(rw, SDL_FALSE);
|
||||
testGenericIOStreamValidations(rw, SDL_FALSE);
|
||||
|
||||
/* Close handle */
|
||||
result = SDL_CloseRW(rw);
|
||||
SDLTest_AssertPass("Call to SDL_CloseRW() succeeded");
|
||||
result = SDL_CloseIO(rw);
|
||||
SDLTest_AssertPass("Call to SDL_CloseIO() succeeded");
|
||||
SDLTest_AssertCheck(result == 0, "Verify result value is 0; got: %d", result);
|
||||
|
||||
return TEST_COMPLETED;
|
||||
|
@ -315,18 +315,18 @@ static int rwops_testConstMem(void *arg)
|
|||
/**
|
||||
* Tests reading from file.
|
||||
*
|
||||
* \sa SDL_RWFromFile
|
||||
* \sa SDL_RWClose
|
||||
* \sa SDL_IOFromFile
|
||||
* \sa SDL_CloseIO
|
||||
*/
|
||||
static int rwops_testFileRead(void *arg)
|
||||
static int iostrm_testFileRead(void *arg)
|
||||
{
|
||||
SDL_RWops *rw;
|
||||
SDL_IOStream *rw;
|
||||
int result;
|
||||
|
||||
/* Read test. */
|
||||
rw = SDL_RWFromFile(RWopsReadTestFilename, "r");
|
||||
SDLTest_AssertPass("Call to SDL_RWFromFile(..,\"r\") succeeded");
|
||||
SDLTest_AssertCheck(rw != NULL, "Verify opening file with SDL_RWFromFile in read mode does not return NULL");
|
||||
rw = SDL_IOFromFile(IOStreamReadTestFilename, "r");
|
||||
SDLTest_AssertPass("Call to SDL_IOFromFile(..,\"r\") succeeded");
|
||||
SDLTest_AssertCheck(rw != NULL, "Verify opening file with SDL_IOFromFile in read mode does not return NULL");
|
||||
|
||||
/* Bail out if NULL */
|
||||
if (rw == NULL) {
|
||||
|
@ -334,11 +334,11 @@ static int rwops_testFileRead(void *arg)
|
|||
}
|
||||
|
||||
/* Run generic tests */
|
||||
testGenericRWopsValidations(rw, SDL_FALSE);
|
||||
testGenericIOStreamValidations(rw, SDL_FALSE);
|
||||
|
||||
/* Close handle */
|
||||
result = SDL_CloseRW(rw);
|
||||
SDLTest_AssertPass("Call to SDL_CloseRW() succeeded");
|
||||
result = SDL_CloseIO(rw);
|
||||
SDLTest_AssertPass("Call to SDL_CloseIO() succeeded");
|
||||
SDLTest_AssertCheck(result == 0, "Verify result value is 0; got: %d", result);
|
||||
|
||||
return TEST_COMPLETED;
|
||||
|
@ -347,18 +347,18 @@ static int rwops_testFileRead(void *arg)
|
|||
/**
|
||||
* Tests writing from file.
|
||||
*
|
||||
* \sa SDL_RWFromFile
|
||||
* \sa SDL_RWClose
|
||||
* \sa SDL_IOFromFile
|
||||
* \sa SDL_CloseIO
|
||||
*/
|
||||
static int rwops_testFileWrite(void *arg)
|
||||
static int iostrm_testFileWrite(void *arg)
|
||||
{
|
||||
SDL_RWops *rw;
|
||||
SDL_IOStream *rw;
|
||||
int result;
|
||||
|
||||
/* Write test. */
|
||||
rw = SDL_RWFromFile(RWopsWriteTestFilename, "w+");
|
||||
SDLTest_AssertPass("Call to SDL_RWFromFile(..,\"w+\") succeeded");
|
||||
SDLTest_AssertCheck(rw != NULL, "Verify opening file with SDL_RWFromFile in write mode does not return NULL");
|
||||
rw = SDL_IOFromFile(IOStreamWriteTestFilename, "w+");
|
||||
SDLTest_AssertPass("Call to SDL_IOFromFile(..,\"w+\") succeeded");
|
||||
SDLTest_AssertCheck(rw != NULL, "Verify opening file with SDL_IOFromFile in write mode does not return NULL");
|
||||
|
||||
/* Bail out if NULL */
|
||||
if (rw == NULL) {
|
||||
|
@ -366,11 +366,11 @@ static int rwops_testFileWrite(void *arg)
|
|||
}
|
||||
|
||||
/* Run generic tests */
|
||||
testGenericRWopsValidations(rw, SDL_TRUE);
|
||||
testGenericIOStreamValidations(rw, SDL_TRUE);
|
||||
|
||||
/* Close handle */
|
||||
result = SDL_CloseRW(rw);
|
||||
SDLTest_AssertPass("Call to SDL_CloseRW() succeeded");
|
||||
result = SDL_CloseIO(rw);
|
||||
SDLTest_AssertPass("Call to SDL_CloseIO() succeeded");
|
||||
SDLTest_AssertCheck(result == 0, "Verify result value is 0; got: %d", result);
|
||||
|
||||
return TEST_COMPLETED;
|
||||
|
@ -379,26 +379,26 @@ static int rwops_testFileWrite(void *arg)
|
|||
/**
|
||||
* Tests alloc and free RW context.
|
||||
*
|
||||
* \sa SDL_OpenRW
|
||||
* \sa SDL_CloseRW
|
||||
* \sa SDL_OpenIO
|
||||
* \sa SDL_CloseIO
|
||||
*/
|
||||
static int rwops_testAllocFree(void *arg)
|
||||
static int iostrm_testAllocFree(void *arg)
|
||||
{
|
||||
/* Allocate context */
|
||||
SDL_RWopsInterface iface;
|
||||
SDL_RWops *rw;
|
||||
SDL_IOStreamInterface iface;
|
||||
SDL_IOStream *rw;
|
||||
|
||||
SDL_zero(iface);
|
||||
rw = SDL_OpenRW(&iface, NULL);
|
||||
SDLTest_AssertPass("Call to SDL_OpenRW() succeeded");
|
||||
SDLTest_AssertCheck(rw != NULL, "Validate result from SDL_OpenRW() is not NULL");
|
||||
rw = SDL_OpenIO(&iface, NULL);
|
||||
SDLTest_AssertPass("Call to SDL_OpenIO() succeeded");
|
||||
SDLTest_AssertCheck(rw != NULL, "Validate result from SDL_OpenIO() is not NULL");
|
||||
if (rw == NULL) {
|
||||
return TEST_ABORTED;
|
||||
}
|
||||
|
||||
/* Free context again */
|
||||
SDL_CloseRW(rw);
|
||||
SDLTest_AssertPass("Call to SDL_CloseRW() succeeded");
|
||||
SDL_CloseIO(rw);
|
||||
SDLTest_AssertPass("Call to SDL_CloseIO() succeeded");
|
||||
|
||||
return TEST_COMPLETED;
|
||||
}
|
||||
|
@ -406,10 +406,10 @@ static int rwops_testAllocFree(void *arg)
|
|||
/**
|
||||
* Compare memory and file reads
|
||||
*
|
||||
* \sa SDL_RWFromMem
|
||||
* \sa SDL_RWFromFile
|
||||
* \sa SDL_IOFromMem
|
||||
* \sa SDL_IOFromFile
|
||||
*/
|
||||
static int rwops_testCompareRWFromMemWithRWFromFile(void *arg)
|
||||
static int iostrm_testCompareRWFromMemWithRWFromFile(void *arg)
|
||||
{
|
||||
int slen = 26;
|
||||
char buffer_file[27];
|
||||
|
@ -418,8 +418,8 @@ static int rwops_testCompareRWFromMemWithRWFromFile(void *arg)
|
|||
size_t rv_mem;
|
||||
Uint64 sv_file;
|
||||
Uint64 sv_mem;
|
||||
SDL_RWops *rwops_file;
|
||||
SDL_RWops *rwops_mem;
|
||||
SDL_IOStream *iostrm_file;
|
||||
SDL_IOStream *iostrm_mem;
|
||||
int size;
|
||||
int result;
|
||||
|
||||
|
@ -429,25 +429,25 @@ static int rwops_testCompareRWFromMemWithRWFromFile(void *arg)
|
|||
buffer_mem[slen] = 0;
|
||||
|
||||
/* Read/seek from memory */
|
||||
rwops_mem = SDL_RWFromMem((void *)RWopsAlphabetString, slen);
|
||||
SDLTest_AssertPass("Call to SDL_RWFromMem()");
|
||||
rv_mem = SDL_ReadRW(rwops_mem, buffer_mem, size * 6);
|
||||
SDLTest_AssertPass("Call to SDL_ReadRW(mem, size=%d)", size * 6);
|
||||
sv_mem = SDL_SeekRW(rwops_mem, 0, SEEK_END);
|
||||
SDLTest_AssertPass("Call to SDL_SeekRW(mem,SEEK_END)");
|
||||
result = SDL_CloseRW(rwops_mem);
|
||||
SDLTest_AssertPass("Call to SDL_CloseRW(mem)");
|
||||
iostrm_mem = SDL_IOFromMem((void *)IOStreamAlphabetString, slen);
|
||||
SDLTest_AssertPass("Call to SDL_IOFromMem()");
|
||||
rv_mem = SDL_ReadIO(iostrm_mem, buffer_mem, size * 6);
|
||||
SDLTest_AssertPass("Call to SDL_ReadIO(mem, size=%d)", size * 6);
|
||||
sv_mem = SDL_SeekIO(iostrm_mem, 0, SEEK_END);
|
||||
SDLTest_AssertPass("Call to SDL_SeekIO(mem,SEEK_END)");
|
||||
result = SDL_CloseIO(iostrm_mem);
|
||||
SDLTest_AssertPass("Call to SDL_CloseIO(mem)");
|
||||
SDLTest_AssertCheck(result == 0, "Verify result value is 0; got: %d", result);
|
||||
|
||||
/* Read/see from file */
|
||||
rwops_file = SDL_RWFromFile(RWopsAlphabetFilename, "r");
|
||||
SDLTest_AssertPass("Call to SDL_RWFromFile()");
|
||||
rv_file = SDL_ReadRW(rwops_file, buffer_file, size * 6);
|
||||
SDLTest_AssertPass("Call to SDL_ReadRW(file, size=%d)", size * 6);
|
||||
sv_file = SDL_SeekRW(rwops_file, 0, SEEK_END);
|
||||
SDLTest_AssertPass("Call to SDL_SeekRW(file,SEEK_END)");
|
||||
result = SDL_CloseRW(rwops_file);
|
||||
SDLTest_AssertPass("Call to SDL_CloseRW(file)");
|
||||
iostrm_file = SDL_IOFromFile(IOStreamAlphabetFilename, "r");
|
||||
SDLTest_AssertPass("Call to SDL_IOFromFile()");
|
||||
rv_file = SDL_ReadIO(iostrm_file, buffer_file, size * 6);
|
||||
SDLTest_AssertPass("Call to SDL_ReadIO(file, size=%d)", size * 6);
|
||||
sv_file = SDL_SeekIO(iostrm_file, 0, SEEK_END);
|
||||
SDLTest_AssertPass("Call to SDL_SeekIO(file,SEEK_END)");
|
||||
result = SDL_CloseIO(iostrm_file);
|
||||
SDLTest_AssertPass("Call to SDL_CloseIO(file)");
|
||||
SDLTest_AssertCheck(result == 0, "Verify result value is 0; got: %d", result);
|
||||
|
||||
/* Compare */
|
||||
|
@ -456,11 +456,11 @@ static int rwops_testCompareRWFromMemWithRWFromFile(void *arg)
|
|||
SDLTest_AssertCheck(buffer_mem[slen] == 0, "Verify mem buffer termination; expected: 0, got: %d", buffer_mem[slen]);
|
||||
SDLTest_AssertCheck(buffer_file[slen] == 0, "Verify file buffer termination; expected: 0, got: %d", buffer_file[slen]);
|
||||
SDLTest_AssertCheck(
|
||||
SDL_strncmp(buffer_mem, RWopsAlphabetString, slen) == 0,
|
||||
"Verify mem buffer contain alphabet string; expected: %s, got: %s", RWopsAlphabetString, buffer_mem);
|
||||
SDL_strncmp(buffer_mem, IOStreamAlphabetString, slen) == 0,
|
||||
"Verify mem buffer contain alphabet string; expected: %s, got: %s", IOStreamAlphabetString, buffer_mem);
|
||||
SDLTest_AssertCheck(
|
||||
SDL_strncmp(buffer_file, RWopsAlphabetString, slen) == 0,
|
||||
"Verify file buffer contain alphabet string; expected: %s, got: %s", RWopsAlphabetString, buffer_file);
|
||||
SDL_strncmp(buffer_file, IOStreamAlphabetString, slen) == 0,
|
||||
"Verify file buffer contain alphabet string; expected: %s, got: %s", IOStreamAlphabetString, buffer_file);
|
||||
}
|
||||
|
||||
return TEST_COMPLETED;
|
||||
|
@ -469,14 +469,14 @@ static int rwops_testCompareRWFromMemWithRWFromFile(void *arg)
|
|||
/**
|
||||
* Tests writing and reading from file using endian aware functions.
|
||||
*
|
||||
* \sa SDL_RWFromFile
|
||||
* \sa SDL_RWClose
|
||||
* \sa SDL_IOFromFile
|
||||
* \sa SDL_CloseIO
|
||||
* \sa SDL_ReadU16BE
|
||||
* \sa SDL_WriteU16BE
|
||||
*/
|
||||
static int rwops_testFileWriteReadEndian(void *arg)
|
||||
static int iostrm_testFileWriteReadEndian(void *arg)
|
||||
{
|
||||
SDL_RWops *rw;
|
||||
SDL_IOStream *rw;
|
||||
Sint64 result;
|
||||
int mode;
|
||||
Uint16 BE16value;
|
||||
|
@ -529,9 +529,9 @@ static int rwops_testFileWriteReadEndian(void *arg)
|
|||
}
|
||||
|
||||
/* Write test. */
|
||||
rw = SDL_RWFromFile(RWopsWriteTestFilename, "w+");
|
||||
SDLTest_AssertPass("Call to SDL_RWFromFile(..,\"w+\")");
|
||||
SDLTest_AssertCheck(rw != NULL, "Verify opening file with SDL_RWFromFile in write mode does not return NULL");
|
||||
rw = SDL_IOFromFile(IOStreamWriteTestFilename, "w+");
|
||||
SDLTest_AssertPass("Call to SDL_IOFromFile(..,\"w+\")");
|
||||
SDLTest_AssertCheck(rw != NULL, "Verify opening file with SDL_IOFromFile in write mode does not return NULL");
|
||||
|
||||
/* Bail out if NULL */
|
||||
if (rw == NULL) {
|
||||
|
@ -559,9 +559,9 @@ static int rwops_testFileWriteReadEndian(void *arg)
|
|||
SDLTest_AssertCheck(bresult == SDL_TRUE, "Validate object written, expected: SDL_TRUE, got: SDL_FALSE");
|
||||
|
||||
/* Test seek to start */
|
||||
result = SDL_SeekRW(rw, 0, SDL_RW_SEEK_SET);
|
||||
SDLTest_AssertPass("Call to SDL_SeekRW succeeded");
|
||||
SDLTest_AssertCheck(result == 0, "Verify result from position 0 with SDL_SeekRW, expected 0, got %i", (int)result);
|
||||
result = SDL_SeekIO(rw, 0, SDL_IO_SEEK_SET);
|
||||
SDLTest_AssertPass("Call to SDL_SeekIO succeeded");
|
||||
SDLTest_AssertCheck(result == 0, "Verify result from position 0 with SDL_SeekIO, expected 0, got %i", (int)result);
|
||||
|
||||
/* Read test data */
|
||||
bresult = SDL_ReadU16BE(rw, &BE16test);
|
||||
|
@ -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);
|
||||
|
||||
/* Close handle */
|
||||
cresult = SDL_CloseRW(rw);
|
||||
SDLTest_AssertPass("Call to SDL_CloseRW() succeeded");
|
||||
cresult = SDL_CloseIO(rw);
|
||||
SDLTest_AssertPass("Call to SDL_CloseIO() succeeded");
|
||||
SDLTest_AssertCheck(cresult == 0, "Verify result value is 0; got: %d", cresult);
|
||||
}
|
||||
|
||||
|
@ -600,49 +600,49 @@ static int rwops_testFileWriteReadEndian(void *arg)
|
|||
|
||||
/* ================= Test References ================== */
|
||||
|
||||
/* RWops test cases */
|
||||
static const SDLTest_TestCaseReference rwopsTest1 = {
|
||||
(SDLTest_TestCaseFp)rwops_testParamNegative, "rwops_testParamNegative", "Negative test for SDL_RWFromFile parameters", TEST_ENABLED
|
||||
/* IOStream test cases */
|
||||
static const SDLTest_TestCaseReference iostrmTest1 = {
|
||||
(SDLTest_TestCaseFp)iostrm_testParamNegative, "iostrm_testParamNegative", "Negative test for SDL_IOFromFile parameters", TEST_ENABLED
|
||||
};
|
||||
|
||||
static const SDLTest_TestCaseReference rwopsTest2 = {
|
||||
(SDLTest_TestCaseFp)rwops_testMem, "rwops_testMem", "Tests opening from memory", TEST_ENABLED
|
||||
static const SDLTest_TestCaseReference iostrmTest2 = {
|
||||
(SDLTest_TestCaseFp)iostrm_testMem, "iostrm_testMem", "Tests opening from memory", TEST_ENABLED
|
||||
};
|
||||
|
||||
static const SDLTest_TestCaseReference rwopsTest3 = {
|
||||
(SDLTest_TestCaseFp)rwops_testConstMem, "rwops_testConstMem", "Tests opening from (const) memory", TEST_ENABLED
|
||||
static const SDLTest_TestCaseReference iostrmTest3 = {
|
||||
(SDLTest_TestCaseFp)iostrm_testConstMem, "iostrm_testConstMem", "Tests opening from (const) memory", TEST_ENABLED
|
||||
};
|
||||
|
||||
static const SDLTest_TestCaseReference rwopsTest4 = {
|
||||
(SDLTest_TestCaseFp)rwops_testFileRead, "rwops_testFileRead", "Tests reading from a file", TEST_ENABLED
|
||||
static const SDLTest_TestCaseReference iostrmTest4 = {
|
||||
(SDLTest_TestCaseFp)iostrm_testFileRead, "iostrm_testFileRead", "Tests reading from a file", TEST_ENABLED
|
||||
};
|
||||
|
||||
static const SDLTest_TestCaseReference rwopsTest5 = {
|
||||
(SDLTest_TestCaseFp)rwops_testFileWrite, "rwops_testFileWrite", "Test writing to a file", TEST_ENABLED
|
||||
static const SDLTest_TestCaseReference iostrmTest5 = {
|
||||
(SDLTest_TestCaseFp)iostrm_testFileWrite, "iostrm_testFileWrite", "Test writing to a file", TEST_ENABLED
|
||||
};
|
||||
|
||||
static const SDLTest_TestCaseReference rwopsTest6 = {
|
||||
(SDLTest_TestCaseFp)rwops_testAllocFree, "rwops_testAllocFree", "Test alloc and free of RW context", TEST_ENABLED
|
||||
static const SDLTest_TestCaseReference iostrmTest6 = {
|
||||
(SDLTest_TestCaseFp)iostrm_testAllocFree, "iostrm_testAllocFree", "Test alloc and free of RW context", TEST_ENABLED
|
||||
};
|
||||
|
||||
static const SDLTest_TestCaseReference rwopsTest7 = {
|
||||
(SDLTest_TestCaseFp)rwops_testFileWriteReadEndian, "rwops_testFileWriteReadEndian", "Test writing and reading via the Endian aware functions", TEST_ENABLED
|
||||
static const SDLTest_TestCaseReference iostrmTest7 = {
|
||||
(SDLTest_TestCaseFp)iostrm_testFileWriteReadEndian, "iostrm_testFileWriteReadEndian", "Test writing and reading via the Endian aware functions", TEST_ENABLED
|
||||
};
|
||||
|
||||
static const SDLTest_TestCaseReference rwopsTest8 = {
|
||||
(SDLTest_TestCaseFp)rwops_testCompareRWFromMemWithRWFromFile, "rwops_testCompareRWFromMemWithRWFromFile", "Compare RWFromMem and RWFromFile RWops for read and seek", TEST_ENABLED
|
||||
static const SDLTest_TestCaseReference iostrmTest8 = {
|
||||
(SDLTest_TestCaseFp)iostrm_testCompareRWFromMemWithRWFromFile, "iostrm_testCompareRWFromMemWithRWFromFile", "Compare RWFromMem and RWFromFile IOStream for read and seek", TEST_ENABLED
|
||||
};
|
||||
|
||||
/* Sequence of RWops test cases */
|
||||
static const SDLTest_TestCaseReference *rwopsTests[] = {
|
||||
&rwopsTest1, &rwopsTest2, &rwopsTest3, &rwopsTest4, &rwopsTest5, &rwopsTest6,
|
||||
&rwopsTest7, &rwopsTest8, NULL
|
||||
/* Sequence of IOStream test cases */
|
||||
static const SDLTest_TestCaseReference *iostrmTests[] = {
|
||||
&iostrmTest1, &iostrmTest2, &iostrmTest3, &iostrmTest4, &iostrmTest5, &iostrmTest6,
|
||||
&iostrmTest7, &iostrmTest8, NULL
|
||||
};
|
||||
|
||||
/* RWops test suite (global) */
|
||||
SDLTest_TestSuiteReference rwopsTestSuite = {
|
||||
"RWops",
|
||||
RWopsSetUp,
|
||||
rwopsTests,
|
||||
RWopsTearDown
|
||||
/* IOStream test suite (global) */
|
||||
SDLTest_TestSuiteReference iostrmTestSuite = {
|
||||
"IOStream",
|
||||
IOStreamSetUp,
|
||||
iostrmTests,
|
||||
IOStreamTearDown
|
||||
};
|
||||
|
|
|
@ -27,7 +27,7 @@ extern SDLTest_TestSuiteReference platformTestSuite;
|
|||
extern SDLTest_TestSuiteReference propertiesTestSuite;
|
||||
extern SDLTest_TestSuiteReference rectTestSuite;
|
||||
extern SDLTest_TestSuiteReference renderTestSuite;
|
||||
extern SDLTest_TestSuiteReference rwopsTestSuite;
|
||||
extern SDLTest_TestSuiteReference iostrmTestSuite;
|
||||
extern SDLTest_TestSuiteReference sdltestTestSuite;
|
||||
extern SDLTest_TestSuiteReference stdlibTestSuite;
|
||||
extern SDLTest_TestSuiteReference subsystemsTestSuite;
|
||||
|
|
|
@ -237,9 +237,9 @@ static SDL_bool CreateWindowAndRenderer(SDL_WindowFlags window_flags, const char
|
|||
static SDL_Texture *CreateTexture(SDL_Renderer *r, unsigned char *data, unsigned int len, int *w, int *h) {
|
||||
SDL_Texture *texture = NULL;
|
||||
SDL_Surface *surface;
|
||||
SDL_RWops *src = SDL_RWFromConstMem(data, len);
|
||||
SDL_IOStream *src = SDL_IOFromConstMem(data, len);
|
||||
if (src) {
|
||||
surface = SDL_LoadBMP_RW(src, SDL_TRUE);
|
||||
surface = SDL_LoadBMP_IO(src, SDL_TRUE);
|
||||
if (surface) {
|
||||
/* Treat white as transparent */
|
||||
SDL_SetSurfaceColorKey(surface, SDL_TRUE, SDL_MapRGB(surface->format, 255, 255, 255));
|
||||
|
|
344
test/testfile.c
344
test/testfile.c
|
@ -51,22 +51,22 @@ cleanup(void)
|
|||
}
|
||||
|
||||
static void
|
||||
rwops_error_quit(unsigned line, SDL_RWops *rwops)
|
||||
iostrm_error_quit(unsigned line, SDL_IOStream *iostrm)
|
||||
{
|
||||
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "testfile.c(%d): failed\n", line);
|
||||
if (rwops) {
|
||||
SDL_CloseRW(rwops);
|
||||
if (iostrm) {
|
||||
SDL_CloseIO(iostrm);
|
||||
}
|
||||
cleanup();
|
||||
SDLTest_CommonDestroyState(state);
|
||||
exit(1); /* quit with rwops error (test failed) */
|
||||
exit(1); /* quit with iostrm error (test failed) */
|
||||
}
|
||||
|
||||
#define RWOP_ERR_QUIT(x) rwops_error_quit(__LINE__, (x))
|
||||
#define RWOP_ERR_QUIT(x) iostrm_error_quit(__LINE__, (x))
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
SDL_RWops *rwops = NULL;
|
||||
SDL_IOStream *iostrm = NULL;
|
||||
char test_buf[30];
|
||||
|
||||
/* Initialize test framework */
|
||||
|
@ -85,27 +85,27 @@ int main(int argc, char *argv[])
|
|||
|
||||
cleanup();
|
||||
|
||||
/* test 1 : basic argument test: all those calls to SDL_RWFromFile should fail */
|
||||
/* test 1 : basic argument test: all those calls to SDL_IOFromFile should fail */
|
||||
|
||||
rwops = SDL_RWFromFile(NULL, NULL);
|
||||
if (rwops) {
|
||||
RWOP_ERR_QUIT(rwops);
|
||||
iostrm = SDL_IOFromFile(NULL, NULL);
|
||||
if (iostrm) {
|
||||
RWOP_ERR_QUIT(iostrm);
|
||||
}
|
||||
rwops = SDL_RWFromFile(NULL, "ab+");
|
||||
if (rwops) {
|
||||
RWOP_ERR_QUIT(rwops);
|
||||
iostrm = SDL_IOFromFile(NULL, "ab+");
|
||||
if (iostrm) {
|
||||
RWOP_ERR_QUIT(iostrm);
|
||||
}
|
||||
rwops = SDL_RWFromFile(NULL, "sldfkjsldkfj");
|
||||
if (rwops) {
|
||||
RWOP_ERR_QUIT(rwops);
|
||||
iostrm = SDL_IOFromFile(NULL, "sldfkjsldkfj");
|
||||
if (iostrm) {
|
||||
RWOP_ERR_QUIT(iostrm);
|
||||
}
|
||||
rwops = SDL_RWFromFile("something", "");
|
||||
if (rwops) {
|
||||
RWOP_ERR_QUIT(rwops);
|
||||
iostrm = SDL_IOFromFile("something", "");
|
||||
if (iostrm) {
|
||||
RWOP_ERR_QUIT(iostrm);
|
||||
}
|
||||
rwops = SDL_RWFromFile("something", NULL);
|
||||
if (rwops) {
|
||||
RWOP_ERR_QUIT(rwops);
|
||||
iostrm = SDL_IOFromFile("something", NULL);
|
||||
if (iostrm) {
|
||||
RWOP_ERR_QUIT(iostrm);
|
||||
}
|
||||
SDL_Log("test1 OK\n");
|
||||
|
||||
|
@ -114,259 +114,259 @@ int main(int argc, char *argv[])
|
|||
modes : a, a+, w, w+ checks that it succeeds (file may not exists)
|
||||
|
||||
*/
|
||||
rwops = SDL_RWFromFile(FBASENAME2, "rb"); /* this file doesn't exist that call must fail */
|
||||
if (rwops) {
|
||||
RWOP_ERR_QUIT(rwops);
|
||||
iostrm = SDL_IOFromFile(FBASENAME2, "rb"); /* this file doesn't exist that call must fail */
|
||||
if (iostrm) {
|
||||
RWOP_ERR_QUIT(iostrm);
|
||||
}
|
||||
rwops = SDL_RWFromFile(FBASENAME2, "rb+"); /* this file doesn't exist that call must fail */
|
||||
if (rwops) {
|
||||
RWOP_ERR_QUIT(rwops);
|
||||
iostrm = SDL_IOFromFile(FBASENAME2, "rb+"); /* this file doesn't exist that call must fail */
|
||||
if (iostrm) {
|
||||
RWOP_ERR_QUIT(iostrm);
|
||||
}
|
||||
rwops = SDL_RWFromFile(FBASENAME2, "wb");
|
||||
if (!rwops) {
|
||||
RWOP_ERR_QUIT(rwops);
|
||||
iostrm = SDL_IOFromFile(FBASENAME2, "wb");
|
||||
if (!iostrm) {
|
||||
RWOP_ERR_QUIT(iostrm);
|
||||
}
|
||||
SDL_CloseRW(rwops);
|
||||
SDL_CloseIO(iostrm);
|
||||
unlink(FBASENAME2);
|
||||
rwops = SDL_RWFromFile(FBASENAME2, "wb+");
|
||||
if (!rwops) {
|
||||
RWOP_ERR_QUIT(rwops);
|
||||
iostrm = SDL_IOFromFile(FBASENAME2, "wb+");
|
||||
if (!iostrm) {
|
||||
RWOP_ERR_QUIT(iostrm);
|
||||
}
|
||||
SDL_CloseRW(rwops);
|
||||
SDL_CloseIO(iostrm);
|
||||
unlink(FBASENAME2);
|
||||
rwops = SDL_RWFromFile(FBASENAME2, "ab");
|
||||
if (!rwops) {
|
||||
RWOP_ERR_QUIT(rwops);
|
||||
iostrm = SDL_IOFromFile(FBASENAME2, "ab");
|
||||
if (!iostrm) {
|
||||
RWOP_ERR_QUIT(iostrm);
|
||||
}
|
||||
SDL_CloseRW(rwops);
|
||||
SDL_CloseIO(iostrm);
|
||||
unlink(FBASENAME2);
|
||||
rwops = SDL_RWFromFile(FBASENAME2, "ab+");
|
||||
if (!rwops) {
|
||||
RWOP_ERR_QUIT(rwops);
|
||||
iostrm = SDL_IOFromFile(FBASENAME2, "ab+");
|
||||
if (!iostrm) {
|
||||
RWOP_ERR_QUIT(iostrm);
|
||||
}
|
||||
SDL_CloseRW(rwops);
|
||||
SDL_CloseIO(iostrm);
|
||||
unlink(FBASENAME2);
|
||||
SDL_Log("test2 OK\n");
|
||||
|
||||
/* test 3 : creation, writing , reading, seeking,
|
||||
test : w mode, r mode, w+ mode
|
||||
*/
|
||||
rwops = SDL_RWFromFile(FBASENAME1, "wb"); /* write only */
|
||||
if (!rwops) {
|
||||
RWOP_ERR_QUIT(rwops);
|
||||
iostrm = SDL_IOFromFile(FBASENAME1, "wb"); /* write only */
|
||||
if (!iostrm) {
|
||||
RWOP_ERR_QUIT(iostrm);
|
||||
}
|
||||
if (10 != SDL_WriteRW(rwops, "1234567890", 10)) {
|
||||
RWOP_ERR_QUIT(rwops);
|
||||
if (10 != SDL_WriteIO(iostrm, "1234567890", 10)) {
|
||||
RWOP_ERR_QUIT(iostrm);
|
||||
}
|
||||
if (10 != SDL_WriteRW(rwops, "1234567890", 10)) {
|
||||
RWOP_ERR_QUIT(rwops);
|
||||
if (10 != SDL_WriteIO(iostrm, "1234567890", 10)) {
|
||||
RWOP_ERR_QUIT(iostrm);
|
||||
}
|
||||
if (7 != SDL_WriteRW(rwops, "1234567", 7)) {
|
||||
RWOP_ERR_QUIT(rwops);
|
||||
if (7 != SDL_WriteIO(iostrm, "1234567", 7)) {
|
||||
RWOP_ERR_QUIT(iostrm);
|
||||
}
|
||||
if (0 != SDL_SeekRW(rwops, 0L, SDL_RW_SEEK_SET)) {
|
||||
RWOP_ERR_QUIT(rwops);
|
||||
if (0 != SDL_SeekIO(iostrm, 0L, SDL_IO_SEEK_SET)) {
|
||||
RWOP_ERR_QUIT(iostrm);
|
||||
}
|
||||
if (0 != SDL_ReadRW(rwops, test_buf, 1)) {
|
||||
RWOP_ERR_QUIT(rwops); /* we are in write only mode */
|
||||
if (0 != SDL_ReadIO(iostrm, test_buf, 1)) {
|
||||
RWOP_ERR_QUIT(iostrm); /* we are in write only mode */
|
||||
}
|
||||
|
||||
SDL_CloseRW(rwops);
|
||||
SDL_CloseIO(iostrm);
|
||||
|
||||
rwops = SDL_RWFromFile(FBASENAME1, "rb"); /* read mode, file must exist */
|
||||
if (!rwops) {
|
||||
RWOP_ERR_QUIT(rwops);
|
||||
iostrm = SDL_IOFromFile(FBASENAME1, "rb"); /* read mode, file must exist */
|
||||
if (!iostrm) {
|
||||
RWOP_ERR_QUIT(iostrm);
|
||||
}
|
||||
if (0 != SDL_SeekRW(rwops, 0L, SDL_RW_SEEK_SET)) {
|
||||
RWOP_ERR_QUIT(rwops);
|
||||
if (0 != SDL_SeekIO(iostrm, 0L, SDL_IO_SEEK_SET)) {
|
||||
RWOP_ERR_QUIT(iostrm);
|
||||
}
|
||||
if (20 != SDL_SeekRW(rwops, -7, SDL_RW_SEEK_END)) {
|
||||
RWOP_ERR_QUIT(rwops);
|
||||
if (20 != SDL_SeekIO(iostrm, -7, SDL_IO_SEEK_END)) {
|
||||
RWOP_ERR_QUIT(iostrm);
|
||||
}
|
||||
if (7 != SDL_ReadRW(rwops, test_buf, 7)) {
|
||||
RWOP_ERR_QUIT(rwops);
|
||||
if (7 != SDL_ReadIO(iostrm, test_buf, 7)) {
|
||||
RWOP_ERR_QUIT(iostrm);
|
||||
}
|
||||
if (SDL_memcmp(test_buf, "1234567", 7) != 0) {
|
||||
RWOP_ERR_QUIT(rwops);
|
||||
RWOP_ERR_QUIT(iostrm);
|
||||
}
|
||||
if (0 != SDL_ReadRW(rwops, test_buf, 1)) {
|
||||
RWOP_ERR_QUIT(rwops);
|
||||
if (0 != SDL_ReadIO(iostrm, test_buf, 1)) {
|
||||
RWOP_ERR_QUIT(iostrm);
|
||||
}
|
||||
if (0 != SDL_ReadRW(rwops, test_buf, 1000)) {
|
||||
RWOP_ERR_QUIT(rwops);
|
||||
if (0 != SDL_ReadIO(iostrm, test_buf, 1000)) {
|
||||
RWOP_ERR_QUIT(iostrm);
|
||||
}
|
||||
if (0 != SDL_SeekRW(rwops, -27, SDL_RW_SEEK_CUR)) {
|
||||
RWOP_ERR_QUIT(rwops);
|
||||
if (0 != SDL_SeekIO(iostrm, -27, SDL_IO_SEEK_CUR)) {
|
||||
RWOP_ERR_QUIT(iostrm);
|
||||
}
|
||||
if (27 != SDL_ReadRW(rwops, test_buf, 30)) {
|
||||
RWOP_ERR_QUIT(rwops);
|
||||
if (27 != SDL_ReadIO(iostrm, test_buf, 30)) {
|
||||
RWOP_ERR_QUIT(iostrm);
|
||||
}
|
||||
if (SDL_memcmp(test_buf, "12345678901234567890", 20) != 0) {
|
||||
RWOP_ERR_QUIT(rwops);
|
||||
RWOP_ERR_QUIT(iostrm);
|
||||
}
|
||||
if (0 != SDL_WriteRW(rwops, test_buf, 1)) {
|
||||
RWOP_ERR_QUIT(rwops); /* readonly mode */
|
||||
if (0 != SDL_WriteIO(iostrm, test_buf, 1)) {
|
||||
RWOP_ERR_QUIT(iostrm); /* readonly mode */
|
||||
}
|
||||
|
||||
SDL_CloseRW(rwops);
|
||||
SDL_CloseIO(iostrm);
|
||||
|
||||
/* test 3: same with w+ mode */
|
||||
rwops = SDL_RWFromFile(FBASENAME1, "wb+"); /* write + read + truncation */
|
||||
if (!rwops) {
|
||||
RWOP_ERR_QUIT(rwops);
|
||||
iostrm = SDL_IOFromFile(FBASENAME1, "wb+"); /* write + read + truncation */
|
||||
if (!iostrm) {
|
||||
RWOP_ERR_QUIT(iostrm);
|
||||
}
|
||||
if (10 != SDL_WriteRW(rwops, "1234567890", 10)) {
|
||||
RWOP_ERR_QUIT(rwops);
|
||||
if (10 != SDL_WriteIO(iostrm, "1234567890", 10)) {
|
||||
RWOP_ERR_QUIT(iostrm);
|
||||
}
|
||||
if (10 != SDL_WriteRW(rwops, "1234567890", 10)) {
|
||||
RWOP_ERR_QUIT(rwops);
|
||||
if (10 != SDL_WriteIO(iostrm, "1234567890", 10)) {
|
||||
RWOP_ERR_QUIT(iostrm);
|
||||
}
|
||||
if (7 != SDL_WriteRW(rwops, "1234567", 7)) {
|
||||
RWOP_ERR_QUIT(rwops);
|
||||
if (7 != SDL_WriteIO(iostrm, "1234567", 7)) {
|
||||
RWOP_ERR_QUIT(iostrm);
|
||||
}
|
||||
if (0 != SDL_SeekRW(rwops, 0L, SDL_RW_SEEK_SET)) {
|
||||
RWOP_ERR_QUIT(rwops);
|
||||
if (0 != SDL_SeekIO(iostrm, 0L, SDL_IO_SEEK_SET)) {
|
||||
RWOP_ERR_QUIT(iostrm);
|
||||
}
|
||||
if (1 != SDL_ReadRW(rwops, test_buf, 1)) {
|
||||
RWOP_ERR_QUIT(rwops); /* we are in read/write mode */
|
||||
if (1 != SDL_ReadIO(iostrm, test_buf, 1)) {
|
||||
RWOP_ERR_QUIT(iostrm); /* we are in read/write mode */
|
||||
}
|
||||
|
||||
if (0 != SDL_SeekRW(rwops, 0L, SDL_RW_SEEK_SET)) {
|
||||
RWOP_ERR_QUIT(rwops);
|
||||
if (0 != SDL_SeekIO(iostrm, 0L, SDL_IO_SEEK_SET)) {
|
||||
RWOP_ERR_QUIT(iostrm);
|
||||
}
|
||||
if (20 != SDL_SeekRW(rwops, -7, SDL_RW_SEEK_END)) {
|
||||
RWOP_ERR_QUIT(rwops);
|
||||
if (20 != SDL_SeekIO(iostrm, -7, SDL_IO_SEEK_END)) {
|
||||
RWOP_ERR_QUIT(iostrm);
|
||||
}
|
||||
if (7 != SDL_ReadRW(rwops, test_buf, 7)) {
|
||||
RWOP_ERR_QUIT(rwops);
|
||||
if (7 != SDL_ReadIO(iostrm, test_buf, 7)) {
|
||||
RWOP_ERR_QUIT(iostrm);
|
||||
}
|
||||
if (SDL_memcmp(test_buf, "1234567", 7) != 0) {
|
||||
RWOP_ERR_QUIT(rwops);
|
||||
RWOP_ERR_QUIT(iostrm);
|
||||
}
|
||||
if (0 != SDL_ReadRW(rwops, test_buf, 1)) {
|
||||
RWOP_ERR_QUIT(rwops);
|
||||
if (0 != SDL_ReadIO(iostrm, test_buf, 1)) {
|
||||
RWOP_ERR_QUIT(iostrm);
|
||||
}
|
||||
if (0 != SDL_ReadRW(rwops, test_buf, 1000)) {
|
||||
RWOP_ERR_QUIT(rwops);
|
||||
if (0 != SDL_ReadIO(iostrm, test_buf, 1000)) {
|
||||
RWOP_ERR_QUIT(iostrm);
|
||||
}
|
||||
if (0 != SDL_SeekRW(rwops, -27, SDL_RW_SEEK_CUR)) {
|
||||
RWOP_ERR_QUIT(rwops);
|
||||
if (0 != SDL_SeekIO(iostrm, -27, SDL_IO_SEEK_CUR)) {
|
||||
RWOP_ERR_QUIT(iostrm);
|
||||
}
|
||||
if (27 != SDL_ReadRW(rwops, test_buf, 30)) {
|
||||
RWOP_ERR_QUIT(rwops);
|
||||
if (27 != SDL_ReadIO(iostrm, test_buf, 30)) {
|
||||
RWOP_ERR_QUIT(iostrm);
|
||||
}
|
||||
if (SDL_memcmp(test_buf, "12345678901234567890", 20) != 0) {
|
||||
RWOP_ERR_QUIT(rwops);
|
||||
RWOP_ERR_QUIT(iostrm);
|
||||
}
|
||||
SDL_CloseRW(rwops);
|
||||
SDL_CloseIO(iostrm);
|
||||
SDL_Log("test3 OK\n");
|
||||
|
||||
/* test 4: same in r+ mode */
|
||||
rwops = SDL_RWFromFile(FBASENAME1, "rb+"); /* write + read + file must exists, no truncation */
|
||||
if (!rwops) {
|
||||
RWOP_ERR_QUIT(rwops);
|
||||
iostrm = SDL_IOFromFile(FBASENAME1, "rb+"); /* write + read + file must exists, no truncation */
|
||||
if (!iostrm) {
|
||||
RWOP_ERR_QUIT(iostrm);
|
||||
}
|
||||
if (10 != SDL_WriteRW(rwops, "1234567890", 10)) {
|
||||
RWOP_ERR_QUIT(rwops);
|
||||
if (10 != SDL_WriteIO(iostrm, "1234567890", 10)) {
|
||||
RWOP_ERR_QUIT(iostrm);
|
||||
}
|
||||
if (10 != SDL_WriteRW(rwops, "1234567890", 10)) {
|
||||
RWOP_ERR_QUIT(rwops);
|
||||
if (10 != SDL_WriteIO(iostrm, "1234567890", 10)) {
|
||||
RWOP_ERR_QUIT(iostrm);
|
||||
}
|
||||
if (7 != SDL_WriteRW(rwops, "1234567", 7)) {
|
||||
RWOP_ERR_QUIT(rwops);
|
||||
if (7 != SDL_WriteIO(iostrm, "1234567", 7)) {
|
||||
RWOP_ERR_QUIT(iostrm);
|
||||
}
|
||||
if (0 != SDL_SeekRW(rwops, 0L, SDL_RW_SEEK_SET)) {
|
||||
RWOP_ERR_QUIT(rwops);
|
||||
if (0 != SDL_SeekIO(iostrm, 0L, SDL_IO_SEEK_SET)) {
|
||||
RWOP_ERR_QUIT(iostrm);
|
||||
}
|
||||
if (1 != SDL_ReadRW(rwops, test_buf, 1)) {
|
||||
RWOP_ERR_QUIT(rwops); /* we are in read/write mode */
|
||||
if (1 != SDL_ReadIO(iostrm, test_buf, 1)) {
|
||||
RWOP_ERR_QUIT(iostrm); /* we are in read/write mode */
|
||||
}
|
||||
|
||||
if (0 != SDL_SeekRW(rwops, 0L, SDL_RW_SEEK_SET)) {
|
||||
RWOP_ERR_QUIT(rwops);
|
||||
if (0 != SDL_SeekIO(iostrm, 0L, SDL_IO_SEEK_SET)) {
|
||||
RWOP_ERR_QUIT(iostrm);
|
||||
}
|
||||
if (20 != SDL_SeekRW(rwops, -7, SDL_RW_SEEK_END)) {
|
||||
RWOP_ERR_QUIT(rwops);
|
||||
if (20 != SDL_SeekIO(iostrm, -7, SDL_IO_SEEK_END)) {
|
||||
RWOP_ERR_QUIT(iostrm);
|
||||
}
|
||||
if (7 != SDL_ReadRW(rwops, test_buf, 7)) {
|
||||
RWOP_ERR_QUIT(rwops);
|
||||
if (7 != SDL_ReadIO(iostrm, test_buf, 7)) {
|
||||
RWOP_ERR_QUIT(iostrm);
|
||||
}
|
||||
if (SDL_memcmp(test_buf, "1234567", 7) != 0) {
|
||||
RWOP_ERR_QUIT(rwops);
|
||||
RWOP_ERR_QUIT(iostrm);
|
||||
}
|
||||
if (0 != SDL_ReadRW(rwops, test_buf, 1)) {
|
||||
RWOP_ERR_QUIT(rwops);
|
||||
if (0 != SDL_ReadIO(iostrm, test_buf, 1)) {
|
||||
RWOP_ERR_QUIT(iostrm);
|
||||
}
|
||||
if (0 != SDL_ReadRW(rwops, test_buf, 1000)) {
|
||||
RWOP_ERR_QUIT(rwops);
|
||||
if (0 != SDL_ReadIO(iostrm, test_buf, 1000)) {
|
||||
RWOP_ERR_QUIT(iostrm);
|
||||
}
|
||||
if (0 != SDL_SeekRW(rwops, -27, SDL_RW_SEEK_CUR)) {
|
||||
RWOP_ERR_QUIT(rwops);
|
||||
if (0 != SDL_SeekIO(iostrm, -27, SDL_IO_SEEK_CUR)) {
|
||||
RWOP_ERR_QUIT(iostrm);
|
||||
}
|
||||
if (27 != SDL_ReadRW(rwops, test_buf, 30)) {
|
||||
RWOP_ERR_QUIT(rwops);
|
||||
if (27 != SDL_ReadIO(iostrm, test_buf, 30)) {
|
||||
RWOP_ERR_QUIT(iostrm);
|
||||
}
|
||||
if (SDL_memcmp(test_buf, "12345678901234567890", 20) != 0) {
|
||||
RWOP_ERR_QUIT(rwops);
|
||||
RWOP_ERR_QUIT(iostrm);
|
||||
}
|
||||
SDL_CloseRW(rwops);
|
||||
SDL_CloseIO(iostrm);
|
||||
SDL_Log("test4 OK\n");
|
||||
|
||||
/* test5 : append mode */
|
||||
rwops = SDL_RWFromFile(FBASENAME1, "ab+"); /* write + read + append */
|
||||
if (!rwops) {
|
||||
RWOP_ERR_QUIT(rwops);
|
||||
iostrm = SDL_IOFromFile(FBASENAME1, "ab+"); /* write + read + append */
|
||||
if (!iostrm) {
|
||||
RWOP_ERR_QUIT(iostrm);
|
||||
}
|
||||
if (10 != SDL_WriteRW(rwops, "1234567890", 10)) {
|
||||
RWOP_ERR_QUIT(rwops);
|
||||
if (10 != SDL_WriteIO(iostrm, "1234567890", 10)) {
|
||||
RWOP_ERR_QUIT(iostrm);
|
||||
}
|
||||
if (10 != SDL_WriteRW(rwops, "1234567890", 10)) {
|
||||
RWOP_ERR_QUIT(rwops);
|
||||
if (10 != SDL_WriteIO(iostrm, "1234567890", 10)) {
|
||||
RWOP_ERR_QUIT(iostrm);
|
||||
}
|
||||
if (7 != SDL_WriteRW(rwops, "1234567", 7)) {
|
||||
RWOP_ERR_QUIT(rwops);
|
||||
if (7 != SDL_WriteIO(iostrm, "1234567", 7)) {
|
||||
RWOP_ERR_QUIT(iostrm);
|
||||
}
|
||||
if (0 != SDL_SeekRW(rwops, 0L, SDL_RW_SEEK_SET)) {
|
||||
RWOP_ERR_QUIT(rwops);
|
||||
if (0 != SDL_SeekIO(iostrm, 0L, SDL_IO_SEEK_SET)) {
|
||||
RWOP_ERR_QUIT(iostrm);
|
||||
}
|
||||
|
||||
if (1 != SDL_ReadRW(rwops, test_buf, 1)) {
|
||||
RWOP_ERR_QUIT(rwops);
|
||||
if (1 != SDL_ReadIO(iostrm, test_buf, 1)) {
|
||||
RWOP_ERR_QUIT(iostrm);
|
||||
}
|
||||
if (0 != SDL_SeekRW(rwops, 0L, SDL_RW_SEEK_SET)) {
|
||||
RWOP_ERR_QUIT(rwops);
|
||||
if (0 != SDL_SeekIO(iostrm, 0L, SDL_IO_SEEK_SET)) {
|
||||
RWOP_ERR_QUIT(iostrm);
|
||||
}
|
||||
|
||||
if (20 + 27 != SDL_SeekRW(rwops, -7, SDL_RW_SEEK_END)) {
|
||||
RWOP_ERR_QUIT(rwops);
|
||||
if (20 + 27 != SDL_SeekIO(iostrm, -7, SDL_IO_SEEK_END)) {
|
||||
RWOP_ERR_QUIT(iostrm);
|
||||
}
|
||||
if (7 != SDL_ReadRW(rwops, test_buf, 7)) {
|
||||
RWOP_ERR_QUIT(rwops);
|
||||
if (7 != SDL_ReadIO(iostrm, test_buf, 7)) {
|
||||
RWOP_ERR_QUIT(iostrm);
|
||||
}
|
||||
if (SDL_memcmp(test_buf, "1234567", 7) != 0) {
|
||||
RWOP_ERR_QUIT(rwops);
|
||||
RWOP_ERR_QUIT(iostrm);
|
||||
}
|
||||
if (0 != SDL_ReadRW(rwops, test_buf, 1)) {
|
||||
RWOP_ERR_QUIT(rwops);
|
||||
if (0 != SDL_ReadIO(iostrm, test_buf, 1)) {
|
||||
RWOP_ERR_QUIT(iostrm);
|
||||
}
|
||||
if (0 != SDL_ReadRW(rwops, test_buf, 1000)) {
|
||||
RWOP_ERR_QUIT(rwops);
|
||||
if (0 != SDL_ReadIO(iostrm, test_buf, 1000)) {
|
||||
RWOP_ERR_QUIT(iostrm);
|
||||
}
|
||||
|
||||
if (27 != SDL_SeekRW(rwops, -27, SDL_RW_SEEK_CUR)) {
|
||||
RWOP_ERR_QUIT(rwops);
|
||||
if (27 != SDL_SeekIO(iostrm, -27, SDL_IO_SEEK_CUR)) {
|
||||
RWOP_ERR_QUIT(iostrm);
|
||||
}
|
||||
|
||||
if (0 != SDL_SeekRW(rwops, 0L, SDL_RW_SEEK_SET)) {
|
||||
RWOP_ERR_QUIT(rwops);
|
||||
if (0 != SDL_SeekIO(iostrm, 0L, SDL_IO_SEEK_SET)) {
|
||||
RWOP_ERR_QUIT(iostrm);
|
||||
}
|
||||
if (30 != SDL_ReadRW(rwops, test_buf, 30)) {
|
||||
RWOP_ERR_QUIT(rwops);
|
||||
if (30 != SDL_ReadIO(iostrm, test_buf, 30)) {
|
||||
RWOP_ERR_QUIT(iostrm);
|
||||
}
|
||||
if (SDL_memcmp(test_buf, "123456789012345678901234567123", 30) != 0) {
|
||||
RWOP_ERR_QUIT(rwops);
|
||||
RWOP_ERR_QUIT(iostrm);
|
||||
}
|
||||
SDL_CloseRW(rwops);
|
||||
SDL_CloseIO(iostrm);
|
||||
SDL_Log("test5 OK\n");
|
||||
cleanup();
|
||||
SDL_Quit();
|
||||
|
|
|
@ -109,7 +109,7 @@ static int unifont_init(const char *fontname)
|
|||
Uint32 numGlyphs = 0;
|
||||
int lineNumber = 1;
|
||||
size_t bytesRead;
|
||||
SDL_RWops *hexFile;
|
||||
SDL_IOStream *hexFile;
|
||||
const size_t unifontGlyphSize = UNIFONT_NUM_GLYPHS * sizeof(struct UnifontGlyph);
|
||||
const size_t unifontTextureSize = UNIFONT_NUM_TEXTURES * state->num_windows * sizeof(void *);
|
||||
char *filename;
|
||||
|
@ -135,7 +135,7 @@ static int unifont_init(const char *fontname)
|
|||
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Out of memory\n");
|
||||
return -1;
|
||||
}
|
||||
hexFile = SDL_RWFromFile(filename, "rb");
|
||||
hexFile = SDL_IOFromFile(filename, "rb");
|
||||
SDL_free(filename);
|
||||
if (!hexFile) {
|
||||
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "unifont: Failed to open font file: %s\n", fontname);
|
||||
|
@ -149,7 +149,7 @@ static int unifont_init(const char *fontname)
|
|||
Uint8 glyphWidth;
|
||||
Uint32 codepoint;
|
||||
|
||||
bytesRead = SDL_ReadRW(hexFile, hexBuffer, 9);
|
||||
bytesRead = SDL_ReadIO(hexFile, hexBuffer, 9);
|
||||
if (numGlyphs > 0 && bytesRead == 0) {
|
||||
break; /* EOF */
|
||||
}
|
||||
|
@ -185,7 +185,7 @@ static int unifont_init(const char *fontname)
|
|||
if (codepointHexSize < 8) {
|
||||
SDL_memmove(hexBuffer, hexBuffer + codepointHexSize + 1, bytesOverread);
|
||||
}
|
||||
bytesRead = SDL_ReadRW(hexFile, hexBuffer + bytesOverread, 33 - bytesOverread);
|
||||
bytesRead = SDL_ReadIO(hexFile, hexBuffer + bytesOverread, 33 - bytesOverread);
|
||||
|
||||
if (bytesRead < (33 - bytesOverread)) {
|
||||
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "unifont: Unexpected end of hex file.\n");
|
||||
|
@ -195,7 +195,7 @@ static int unifont_init(const char *fontname)
|
|||
glyphWidth = 8;
|
||||
} else {
|
||||
glyphWidth = 16;
|
||||
bytesRead = SDL_ReadRW(hexFile, hexBuffer + 33, 32);
|
||||
bytesRead = SDL_ReadIO(hexFile, hexBuffer + 33, 32);
|
||||
if (bytesRead < 32) {
|
||||
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "unifont: Unexpected end of hex file.\n");
|
||||
return -1;
|
||||
|
@ -223,7 +223,7 @@ static int unifont_init(const char *fontname)
|
|||
lineNumber++;
|
||||
} while (bytesRead > 0);
|
||||
|
||||
SDL_CloseRW(hexFile);
|
||||
SDL_CloseIO(hexFile);
|
||||
SDL_Log("unifont: Loaded %" SDL_PRIu32 " glyphs.\n", numGlyphs);
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -318,7 +318,7 @@ static void loop(void)
|
|||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
SDL_RWops *handle;
|
||||
SDL_IOStream *handle;
|
||||
int i;
|
||||
int j;
|
||||
int fps = 12;
|
||||
|
@ -443,16 +443,16 @@ int main(int argc, char **argv)
|
|||
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Out of memory\n");
|
||||
quit(2);
|
||||
}
|
||||
handle = SDL_RWFromFile(filename, "rb");
|
||||
handle = SDL_IOFromFile(filename, "rb");
|
||||
SDL_free(filename);
|
||||
if (!handle) {
|
||||
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Can't find the file moose.dat !\n");
|
||||
quit(2);
|
||||
}
|
||||
|
||||
SDL_ReadRW(handle, RawMooseData, MOOSEFRAME_SIZE * MOOSEFRAMES_COUNT);
|
||||
SDL_ReadIO(handle, RawMooseData, MOOSEFRAME_SIZE * MOOSEFRAMES_COUNT);
|
||||
|
||||
SDL_CloseRW(handle);
|
||||
SDL_CloseIO(handle);
|
||||
|
||||
/* Create the window and renderer */
|
||||
window_w = MOOSEPIC_W * scale;
|
||||
|
|
|
@ -30,7 +30,7 @@ int main(int argc, char **argv)
|
|||
int bitsize = 0;
|
||||
int blockalign = 0;
|
||||
int avgbytes = 0;
|
||||
SDL_RWops *io = NULL;
|
||||
SDL_IOStream *io = NULL;
|
||||
int dst_len;
|
||||
int ret = 0;
|
||||
int argpos = 0;
|
||||
|
@ -115,7 +115,7 @@ int main(int argc, char **argv)
|
|||
}
|
||||
|
||||
/* write out a WAV header... */
|
||||
io = SDL_RWFromFile(file_out, "wb");
|
||||
io = SDL_IOFromFile(file_out, "wb");
|
||||
if (!io) {
|
||||
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "opening '%s' failed: %s\n", file_out, SDL_GetError());
|
||||
ret = 5;
|
||||
|
@ -139,9 +139,9 @@ int main(int argc, char **argv)
|
|||
SDL_WriteU16LE(io, (Uint16)bitsize); /* significant bits per sample */
|
||||
SDL_WriteU32LE(io, 0x61746164); /* data */
|
||||
SDL_WriteU32LE(io, dst_len); /* size */
|
||||
SDL_WriteRW(io, dst_buf, dst_len);
|
||||
SDL_WriteIO(io, dst_buf, dst_len);
|
||||
|
||||
if (SDL_CloseRW(io) == -1) {
|
||||
if (SDL_CloseIO(io) == -1) {
|
||||
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "closing '%s' failed: %s\n", file_out, SDL_GetError());
|
||||
ret = 6;
|
||||
goto end;
|
||||
|
|
|
@ -60,7 +60,7 @@ int main(int argc, char *argv[])
|
|||
goto quit;
|
||||
}
|
||||
} else {
|
||||
shape = SDL_LoadBMP_RW(SDL_RWFromConstMem(glass_bmp, sizeof(glass_bmp)), SDL_TRUE);
|
||||
shape = SDL_LoadBMP_IO(SDL_IOFromConstMem(glass_bmp, sizeof(glass_bmp)), SDL_TRUE);
|
||||
if (!shape) {
|
||||
SDL_Log("Couldn't load glass.bmp: %s\n", SDL_GetError());
|
||||
goto quit;
|
||||
|
|
|
@ -39,9 +39,9 @@ static int done;
|
|||
static SDL_Texture *CreateTexture(SDL_Renderer *r, unsigned char *data, unsigned int len, int *w, int *h) {
|
||||
SDL_Texture *texture = NULL;
|
||||
SDL_Surface *surface;
|
||||
SDL_RWops *src = SDL_RWFromConstMem(data, len);
|
||||
SDL_IOStream *src = SDL_IOFromConstMem(data, len);
|
||||
if (src) {
|
||||
surface = SDL_LoadBMP_RW(src, SDL_TRUE);
|
||||
surface = SDL_LoadBMP_IO(src, SDL_TRUE);
|
||||
if (surface) {
|
||||
/* Treat white as transparent */
|
||||
SDL_SetSurfaceColorKey(surface, SDL_TRUE, SDL_MapRGB(surface->format, 255, 255, 255));
|
||||
|
|
|
@ -136,7 +136,7 @@ static void loop(void)
|
|||
int main(int argc, char **argv)
|
||||
{
|
||||
SDL_Window *window;
|
||||
SDL_RWops *handle;
|
||||
SDL_IOStream *handle;
|
||||
char *filename = NULL;
|
||||
|
||||
/* Initialize test framework */
|
||||
|
@ -164,14 +164,14 @@ int main(int argc, char **argv)
|
|||
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Out of memory\n");
|
||||
return -1;
|
||||
}
|
||||
handle = SDL_RWFromFile(filename, "rb");
|
||||
handle = SDL_IOFromFile(filename, "rb");
|
||||
SDL_free(filename);
|
||||
if (!handle) {
|
||||
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Can't find the file moose.dat !\n");
|
||||
quit(2);
|
||||
}
|
||||
SDL_ReadRW(handle, MooseFrames, MOOSEFRAME_SIZE * MOOSEFRAMES_COUNT);
|
||||
SDL_CloseRW(handle);
|
||||
SDL_ReadIO(handle, MooseFrames, MOOSEFRAME_SIZE * MOOSEFRAMES_COUNT);
|
||||
SDL_CloseIO(handle);
|
||||
|
||||
/* Create the window and renderer */
|
||||
window = SDL_CreateWindow("Happy Moose", MOOSEPIC_W * 4, MOOSEPIC_H * 4, SDL_WINDOW_RESIZABLE);
|
||||
|
|
|
@ -29,7 +29,7 @@ GetNearbyFilename(const char *file)
|
|||
base = SDL_GetBasePath();
|
||||
|
||||
if (base) {
|
||||
SDL_RWops *rw;
|
||||
SDL_IOStream *rw;
|
||||
size_t len = SDL_strlen(base) + SDL_strlen(file) + 1;
|
||||
|
||||
path = SDL_malloc(len);
|
||||
|
@ -42,9 +42,9 @@ GetNearbyFilename(const char *file)
|
|||
(void)SDL_snprintf(path, len, "%s%s", base, file);
|
||||
SDL_free(base);
|
||||
|
||||
rw = SDL_RWFromFile(path, "rb");
|
||||
rw = SDL_IOFromFile(path, "rb");
|
||||
if (rw) {
|
||||
SDL_CloseRW(rw);
|
||||
SDL_CloseIO(rw);
|
||||
return path;
|
||||
}
|
||||
|
||||
|
|
|
@ -36,9 +36,9 @@ static SDL_Texture *CreateTexture(SDL_Renderer *r, unsigned char *data, unsigned
|
|||
{
|
||||
SDL_Texture *texture = NULL;
|
||||
SDL_Surface *surface;
|
||||
SDL_RWops *src = SDL_RWFromConstMem(data, len);
|
||||
SDL_IOStream *src = SDL_IOFromConstMem(data, len);
|
||||
if (src) {
|
||||
surface = SDL_LoadBMP_RW(src, SDL_TRUE);
|
||||
surface = SDL_LoadBMP_IO(src, SDL_TRUE);
|
||||
if (surface) {
|
||||
/* Treat white as transparent */
|
||||
SDL_SetSurfaceColorKey(surface, SDL_TRUE, SDL_MapRGB(surface->format, 255, 255, 255));
|
||||
|
|
Loading…
Reference in New Issue