Add "SDL_" prefix to RW_SEEK macros

This commit is contained in:
meyraud705 2022-12-23 10:16:11 +01:00 committed by Sam Lantinga
parent 1a80fbaae4
commit 126c60cb45
7 changed files with 75 additions and 72 deletions

View file

@ -140,6 +140,9 @@ to decide for you.
## SDL_rwops.h ## SDL_rwops.h
The RW_SEEK_CUR, RW_SEEK_END and RW_SEEK_SET macros have been renamed SDL_RW_SEEK_CUR, SDL_RW_SEEK_END and SDL_RW_SEEK_SET.
SDL_RWread and SDL_RWwrite (and SDL_RWops::read, SDL_RWops::write) have a different function signature in SDL3. SDL_RWread and SDL_RWwrite (and SDL_RWops::read, SDL_RWops::write) have a different function signature in SDL3.
Previously they looked more like stdio: Previously they looked more like stdio:
@ -190,13 +193,13 @@ stdio_size(SDL_RWops * context)
{ {
Sint64 pos, size; Sint64 pos, size;
pos = SDL_RWseek(context, 0, RW_SEEK_CUR); pos = SDL_RWseek(context, 0, SDL_RW_SEEK_CUR);
if (pos < 0) { if (pos < 0) {
return -1; return -1;
} }
size = SDL_RWseek(context, 0, RW_SEEK_END); size = SDL_RWseek(context, 0, SDL_RW_SEEK_END);
SDL_RWseek(context, pos, RW_SEEK_SET); SDL_RWseek(context, pos, SDL_RW_SEEK_SET);
return size; return size;
} }
@ -206,13 +209,13 @@ stdio_seek(SDL_RWops * context, Sint64 offset, int whence)
int stdiowhence; int stdiowhence;
switch (whence) { switch (whence) {
case RW_SEEK_SET: case SDL_RW_SEEK_SET:
stdiowhence = SEEK_SET; stdiowhence = SEEK_SET;
break; break;
case RW_SEEK_CUR: case SDL_RW_SEEK_CUR:
stdiowhence = SEEK_CUR; stdiowhence = SEEK_CUR;
break; break;
case RW_SEEK_END: case SDL_RW_SEEK_END:
stdiowhence = SEEK_END; stdiowhence = SEEK_END;
break; break;
default: default:

View file

@ -58,7 +58,7 @@ typedef struct SDL_RWops
/** /**
* Seek to \c offset relative to \c whence, one of stdio's whence values: * Seek to \c offset relative to \c whence, one of stdio's whence values:
* RW_SEEK_SET, RW_SEEK_CUR, RW_SEEK_END * SDL_RW_SEEK_SET, SDL_RW_SEEK_CUR, SDL_RW_SEEK_END
* *
* \return the final offset in the data stream, or -1 on error. * \return the final offset in the data stream, or -1 on error.
*/ */
@ -332,9 +332,9 @@ extern DECLSPEC SDL_RWops *SDLCALL SDL_AllocRW(void);
*/ */
extern DECLSPEC void SDLCALL SDL_FreeRW(SDL_RWops * area); extern DECLSPEC void SDLCALL SDL_FreeRW(SDL_RWops * area);
#define RW_SEEK_SET 0 /**< Seek from the beginning of data */ #define SDL_RW_SEEK_SET 0 /**< Seek from the beginning of data */
#define RW_SEEK_CUR 1 /**< Seek relative to current read point */ #define SDL_RW_SEEK_CUR 1 /**< Seek relative to current read point */
#define RW_SEEK_END 2 /**< Seek relative to the end of data */ #define SDL_RW_SEEK_END 2 /**< Seek relative to the end of data */
/** /**
* 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_RWops.
@ -357,9 +357,9 @@ extern DECLSPEC Sint64 SDLCALL SDL_RWsize(SDL_RWops *context);
* *
* `whence` may be any of the following values: * `whence` may be any of the following values:
* *
* - `RW_SEEK_SET`: seek from the beginning of data * - `SDL_RW_SEEK_SET`: seek from the beginning of data
* - `RW_SEEK_CUR`: seek relative to current read point * - `SDL_RW_SEEK_CUR`: seek relative to current read point
* - `RW_SEEK_END`: seek relative to the end of data * - `SDL_RW_SEEK_END`: seek relative to the end of data
* *
* If this stream can not seek, it will return -1. * If this stream can not seek, it will return -1.
* *
@ -371,7 +371,7 @@ extern DECLSPEC Sint64 SDLCALL SDL_RWsize(SDL_RWops *context);
* \param context a pointer to an SDL_RWops structure * \param context a pointer to an SDL_RWops structure
* \param offset an offset in bytes, relative to **whence** location; can be * \param offset an offset in bytes, relative to **whence** location; can be
* negative * negative
* \param whence any of `RW_SEEK_SET`, `RW_SEEK_CUR`, `RW_SEEK_END` * \param whence any of `SDL_RW_SEEK_SET`, `SDL_RW_SEEK_CUR`, `SDL_RW_SEEK_END`
* \returns the final offset in the data stream after the seek or -1 on error. * \returns the final offset in the data stream after the seek or -1 on error.
* *
* \since This function is available since SDL 3.0.0. * \since This function is available since SDL 3.0.0.
@ -391,7 +391,7 @@ extern DECLSPEC Sint64 SDLCALL SDL_RWseek(SDL_RWops *context,
* Determine the current read/write offset in an SDL_RWops data stream. * Determine the current read/write offset in an SDL_RWops data stream.
* *
* SDL_RWtell is actually a wrapper function that calls the SDL_RWops's `seek` * SDL_RWtell is actually a wrapper function that calls the SDL_RWops's `seek`
* method, with an offset of 0 bytes from `RW_SEEK_CUR`, to simplify * method, with an offset of 0 bytes from `SDL_RW_SEEK_CUR`, to simplify
* application development. * application development.
* *
* Prior to SDL 2.0.10, this function was a macro. * Prior to SDL 2.0.10, this function was a macro.

View file

@ -1520,7 +1520,7 @@ static int WaveNextChunk(SDL_RWops *src, WaveChunk *chunk)
nextposition++; nextposition++;
} }
if (SDL_RWseek(src, nextposition, RW_SEEK_SET) != nextposition) { if (SDL_RWseek(src, nextposition, SDL_RW_SEEK_SET) != nextposition) {
/* Not sure how we ended up here. Just abort. */ /* Not sure how we ended up here. Just abort. */
return -2; return -2;
} else if (SDL_RWread(src, chunkheader, sizeof(Uint32) * 2) != (sizeof(Uint32) * 2)) { } else if (SDL_RWread(src, chunkheader, sizeof(Uint32) * 2) != (sizeof(Uint32) * 2)) {
@ -1548,7 +1548,7 @@ static int WaveReadPartialChunkData(SDL_RWops *src, WaveChunk *chunk, size_t len
return SDL_OutOfMemory(); return SDL_OutOfMemory();
} }
if (SDL_RWseek(src, chunk->position, RW_SEEK_SET) != chunk->position) { if (SDL_RWseek(src, chunk->position, SDL_RW_SEEK_SET) != chunk->position) {
/* Not sure how we ended up here. Just abort. */ /* Not sure how we ended up here. Just abort. */
return -2; return -2;
} }
@ -1894,7 +1894,7 @@ static int WaveLoad(SDL_RWops *src, WaveFile *file, SDL_AudioSpec *spec, Uint8 *
file->fact.status = -1; file->fact.status = -1;
} else { } else {
/* Let's use src directly, it's just too convenient. */ /* Let's use src directly, it's just too convenient. */
Sint64 position = SDL_RWseek(src, chunk->position, RW_SEEK_SET); Sint64 position = SDL_RWseek(src, chunk->position, SDL_RW_SEEK_SET);
Uint32 samplelength; Uint32 samplelength;
if (position == chunk->position && SDL_RWread(src, &samplelength, sizeof(Uint32)) == sizeof(Uint32)) { if (position == chunk->position && SDL_RWread(src, &samplelength, sizeof(Uint32)) == sizeof(Uint32)) {
file->fact.status = 1; file->fact.status = 1;
@ -1939,7 +1939,7 @@ static int WaveLoad(SDL_RWops *src, WaveFile *file, SDL_AudioSpec *spec, Uint8 *
if (chunk->fourcc != DATA && chunk->length > 0) { if (chunk->fourcc != DATA && chunk->length > 0) {
Uint8 tmp; Uint8 tmp;
Uint64 position = (Uint64)chunk->position + chunk->length - 1; Uint64 position = (Uint64)chunk->position + chunk->length - 1;
if (position > SDL_MAX_SINT64 || SDL_RWseek(src, (Sint64)position, RW_SEEK_SET) != (Sint64)position) { if (position > SDL_MAX_SINT64 || SDL_RWseek(src, (Sint64)position, SDL_RW_SEEK_SET) != (Sint64)position) {
return SDL_SetError("Could not seek to WAVE chunk data"); return SDL_SetError("Could not seek to WAVE chunk data");
} else if (SDL_RWread(src, &tmp, 1) != 1) { } else if (SDL_RWread(src, &tmp, 1) != 1) {
return SDL_SetError("RIFF size truncates chunk"); return SDL_SetError("RIFF size truncates chunk");
@ -2117,7 +2117,7 @@ SDL_LoadWAV_RW(SDL_RWops *src, int freesrc, SDL_AudioSpec *spec, Uint8 **audio_b
if (freesrc) { if (freesrc) {
SDL_RWclose(src); SDL_RWclose(src);
} else { } else {
SDL_RWseek(src, file.chunk.position, RW_SEEK_SET); SDL_RWseek(src, file.chunk.position, SDL_RW_SEEK_SET);
} }
WaveFreeChunkData(&file.chunk); WaveFreeChunkData(&file.chunk);
SDL_free(file.decoderdata); SDL_free(file.decoderdata);

View file

@ -156,19 +156,19 @@ static Sint64 SDLCALL windows_file_seek(SDL_RWops *context, Sint64 offset, int w
} }
/* FIXME: We may be able to satisfy the seek within buffered data */ /* FIXME: We may be able to satisfy the seek within buffered data */
if (whence == RW_SEEK_CUR && context->hidden.windowsio.buffer.left) { if (whence == SDL_RW_SEEK_CUR && context->hidden.windowsio.buffer.left) {
offset -= (long)context->hidden.windowsio.buffer.left; offset -= (long)context->hidden.windowsio.buffer.left;
} }
context->hidden.windowsio.buffer.left = 0; context->hidden.windowsio.buffer.left = 0;
switch (whence) { switch (whence) {
case RW_SEEK_SET: case SDL_RW_SEEK_SET:
windowswhence = FILE_BEGIN; windowswhence = FILE_BEGIN;
break; break;
case RW_SEEK_CUR: case SDL_RW_SEEK_CUR:
windowswhence = FILE_CURRENT; windowswhence = FILE_CURRENT;
break; break;
case RW_SEEK_END: case SDL_RW_SEEK_END:
windowswhence = FILE_END; windowswhence = FILE_END;
break; break;
default: default:
@ -326,13 +326,13 @@ static Sint64 SDLCALL stdio_size(SDL_RWops *context)
{ {
Sint64 pos, size; Sint64 pos, size;
pos = SDL_RWseek(context, 0, RW_SEEK_CUR); pos = SDL_RWseek(context, 0, SDL_RW_SEEK_CUR);
if (pos < 0) { if (pos < 0) {
return -1; return -1;
} }
size = SDL_RWseek(context, 0, RW_SEEK_END); size = SDL_RWseek(context, 0, SDL_RW_SEEK_END);
SDL_RWseek(context, pos, RW_SEEK_SET); SDL_RWseek(context, pos, SDL_RW_SEEK_SET);
return size; return size;
} }
@ -341,13 +341,13 @@ static Sint64 SDLCALL stdio_seek(SDL_RWops *context, Sint64 offset, int whence)
int stdiowhence; int stdiowhence;
switch (whence) { switch (whence) {
case RW_SEEK_SET: case SDL_RW_SEEK_SET:
stdiowhence = SEEK_SET; stdiowhence = SEEK_SET;
break; break;
case RW_SEEK_CUR: case SDL_RW_SEEK_CUR:
stdiowhence = SEEK_CUR; stdiowhence = SEEK_CUR;
break; break;
case RW_SEEK_END: case SDL_RW_SEEK_END:
stdiowhence = SEEK_END; stdiowhence = SEEK_END;
break; break;
default: default:
@ -439,13 +439,13 @@ static Sint64 SDLCALL mem_seek(SDL_RWops *context, Sint64 offset, int whence)
Uint8 *newpos; Uint8 *newpos;
switch (whence) { switch (whence) {
case RW_SEEK_SET: case SDL_RW_SEEK_SET:
newpos = context->hidden.mem.base + offset; newpos = context->hidden.mem.base + offset;
break; break;
case RW_SEEK_CUR: case SDL_RW_SEEK_CUR:
newpos = context->hidden.mem.here + offset; newpos = context->hidden.mem.here + offset;
break; break;
case RW_SEEK_END: case SDL_RW_SEEK_END:
newpos = context->hidden.mem.stop + offset; newpos = context->hidden.mem.stop + offset;
break; break;
default: default:
@ -742,7 +742,7 @@ SDL_RWseek(SDL_RWops *context, Sint64 offset, int whence)
Sint64 Sint64
SDL_RWtell(SDL_RWops *context) SDL_RWtell(SDL_RWops *context)
{ {
return context->seek(context, 0, RW_SEEK_CUR); return context->seek(context, 0, SDL_RW_SEEK_CUR);
} }
Sint64 Sint64

View file

@ -332,7 +332,7 @@ SDL_LoadBMP_RW(SDL_RWops *src, int freesrc)
/* skip any header bytes we didn't handle... */ /* skip any header bytes we didn't handle... */
headerSize = (Uint32)(SDL_RWtell(src) - (fp_offset + 14)); headerSize = (Uint32)(SDL_RWtell(src) - (fp_offset + 14));
if (biSize > headerSize) { if (biSize > headerSize) {
SDL_RWseek(src, (biSize - headerSize), RW_SEEK_CUR); SDL_RWseek(src, (biSize - headerSize), SDL_RW_SEEK_CUR);
} }
} }
if (biWidth <= 0 || biHeight == 0) { if (biWidth <= 0 || biHeight == 0) {
@ -440,7 +440,7 @@ SDL_LoadBMP_RW(SDL_RWops *src, int freesrc)
/* Load the palette, if any */ /* Load the palette, if any */
palette = (surface->format)->palette; palette = (surface->format)->palette;
if (palette) { if (palette) {
if (SDL_RWseek(src, fp_offset + 14 + biSize, RW_SEEK_SET) < 0) { if (SDL_RWseek(src, fp_offset + 14 + biSize, SDL_RW_SEEK_SET) < 0) {
SDL_Error(SDL_EFSEEK); SDL_Error(SDL_EFSEEK);
was_error = SDL_TRUE; was_error = SDL_TRUE;
goto done; goto done;
@ -492,7 +492,7 @@ SDL_LoadBMP_RW(SDL_RWops *src, int freesrc)
} }
/* Read the surface pixels. Note that the bmp image is upside down */ /* Read the surface pixels. Note that the bmp image is upside down */
if (SDL_RWseek(src, fp_offset + bfOffBits, RW_SEEK_SET) < 0) { if (SDL_RWseek(src, fp_offset + bfOffBits, SDL_RW_SEEK_SET) < 0) {
SDL_Error(SDL_EFSEEK); SDL_Error(SDL_EFSEEK);
was_error = SDL_TRUE; was_error = SDL_TRUE;
goto done; goto done;
@ -614,7 +614,7 @@ SDL_LoadBMP_RW(SDL_RWops *src, int freesrc)
done: done:
if (was_error) { if (was_error) {
if (src) { if (src) {
SDL_RWseek(src, fp_offset, RW_SEEK_SET); SDL_RWseek(src, fp_offset, SDL_RW_SEEK_SET);
} }
SDL_FreeSurface(surface); SDL_FreeSurface(surface);
surface = NULL; surface = NULL;
@ -823,11 +823,11 @@ int SDL_SaveBMP_RW(SDL_Surface *surface, SDL_RWops *dst, int freedst)
/* Write the bitmap offset */ /* Write the bitmap offset */
bfOffBits = (Uint32)(SDL_RWtell(dst) - fp_offset); bfOffBits = (Uint32)(SDL_RWtell(dst) - fp_offset);
if (SDL_RWseek(dst, fp_offset + 10, RW_SEEK_SET) < 0) { if (SDL_RWseek(dst, fp_offset + 10, SDL_RW_SEEK_SET) < 0) {
SDL_Error(SDL_EFSEEK); SDL_Error(SDL_EFSEEK);
} }
SDL_WriteLE32(dst, bfOffBits); SDL_WriteLE32(dst, bfOffBits);
if (SDL_RWseek(dst, fp_offset + bfOffBits, RW_SEEK_SET) < 0) { if (SDL_RWseek(dst, fp_offset + bfOffBits, SDL_RW_SEEK_SET) < 0) {
SDL_Error(SDL_EFSEEK); SDL_Error(SDL_EFSEEK);
} }
@ -850,11 +850,11 @@ int SDL_SaveBMP_RW(SDL_Surface *surface, SDL_RWops *dst, int freedst)
/* Write the BMP file size */ /* Write the BMP file size */
bfSize = (Uint32)(SDL_RWtell(dst) - fp_offset); bfSize = (Uint32)(SDL_RWtell(dst) - fp_offset);
if (SDL_RWseek(dst, fp_offset + 2, RW_SEEK_SET) < 0) { if (SDL_RWseek(dst, fp_offset + 2, SDL_RW_SEEK_SET) < 0) {
SDL_Error(SDL_EFSEEK); SDL_Error(SDL_EFSEEK);
} }
SDL_WriteLE32(dst, bfSize); SDL_WriteLE32(dst, bfSize);
if (SDL_RWseek(dst, fp_offset + bfSize, RW_SEEK_SET) < 0) { if (SDL_RWseek(dst, fp_offset + bfSize, SDL_RW_SEEK_SET) < 0) {
SDL_Error(SDL_EFSEEK); SDL_Error(SDL_EFSEEK);
} }

View file

@ -106,9 +106,9 @@ void _testGenericRWopsValidations(SDL_RWops *rw, int write)
SDL_zeroa(buf); SDL_zeroa(buf);
/* Set to start. */ /* Set to start. */
i = SDL_RWseek(rw, 0, RW_SEEK_SET); i = SDL_RWseek(rw, 0, SDL_RW_SEEK_SET);
SDLTest_AssertPass("Call to SDL_RWseek succeeded"); SDLTest_AssertPass("Call to SDL_RWseek succeeded");
SDLTest_AssertCheck(i == (Sint64)0, "Verify seek to 0 with SDL_RWseek (RW_SEEK_SET), expected 0, got %" SDL_PRIs64, i); SDLTest_AssertCheck(i == (Sint64)0, "Verify seek to 0 with SDL_RWseek (SDL_RW_SEEK_SET), expected 0, got %" SDL_PRIs64, i);
/* Test write. */ /* Test write. */
s = SDL_RWwrite(rw, RWopsHelloWorldTestString, sizeof(RWopsHelloWorldTestString) - 1); s = SDL_RWwrite(rw, RWopsHelloWorldTestString, sizeof(RWopsHelloWorldTestString) - 1);
@ -120,14 +120,14 @@ void _testGenericRWopsValidations(SDL_RWops *rw, int write)
} }
/* Test seek to random position */ /* Test seek to random position */
i = SDL_RWseek(rw, seekPos, RW_SEEK_SET); i = SDL_RWseek(rw, seekPos, SDL_RW_SEEK_SET);
SDLTest_AssertPass("Call to SDL_RWseek succeeded"); SDLTest_AssertPass("Call to SDL_RWseek succeeded");
SDLTest_AssertCheck(i == (Sint64)seekPos, "Verify seek to %i with SDL_RWseek (RW_SEEK_SET), expected %i, got %" SDL_PRIs64, seekPos, seekPos, i); SDLTest_AssertCheck(i == (Sint64)seekPos, "Verify seek to %i with SDL_RWseek (SDL_RW_SEEK_SET), expected %i, got %" SDL_PRIs64, seekPos, seekPos, i);
/* Test seek back to start */ /* Test seek back to start */
i = SDL_RWseek(rw, 0, RW_SEEK_SET); i = SDL_RWseek(rw, 0, SDL_RW_SEEK_SET);
SDLTest_AssertPass("Call to SDL_RWseek succeeded"); SDLTest_AssertPass("Call to SDL_RWseek succeeded");
SDLTest_AssertCheck(i == (Sint64)0, "Verify seek to 0 with SDL_RWseek (RW_SEEK_SET), expected 0, got %" SDL_PRIs64, i); SDLTest_AssertCheck(i == (Sint64)0, "Verify seek to 0 with SDL_RWseek (SDL_RW_SEEK_SET), expected 0, got %" SDL_PRIs64, i);
/* Test read */ /* Test read */
s = SDL_RWread(rw, buf, sizeof(RWopsHelloWorldTestString) - 1); s = SDL_RWread(rw, buf, sizeof(RWopsHelloWorldTestString) - 1);
@ -142,19 +142,19 @@ void _testGenericRWopsValidations(SDL_RWops *rw, int write)
"Verify read bytes match expected string, expected '%s', got '%s'", RWopsHelloWorldTestString, buf); "Verify read bytes match expected string, expected '%s', got '%s'", RWopsHelloWorldTestString, buf);
/* More seek tests. */ /* More seek tests. */
i = SDL_RWseek(rw, -4, RW_SEEK_CUR); i = SDL_RWseek(rw, -4, SDL_RW_SEEK_CUR);
SDLTest_AssertPass("Call to SDL_RWseek(...,-4,RW_SEEK_CUR) succeeded"); SDLTest_AssertPass("Call to SDL_RWseek(...,-4,SDL_RW_SEEK_CUR) succeeded");
SDLTest_AssertCheck( SDLTest_AssertCheck(
i == (Sint64)(sizeof(RWopsHelloWorldTestString) - 5), i == (Sint64)(sizeof(RWopsHelloWorldTestString) - 5),
"Verify seek to -4 with SDL_RWseek (RW_SEEK_CUR), expected %i, got %i", "Verify seek to -4 with SDL_RWseek (SDL_RW_SEEK_CUR), expected %i, got %i",
(int)(sizeof(RWopsHelloWorldTestString) - 5), (int)(sizeof(RWopsHelloWorldTestString) - 5),
(int)i); (int)i);
i = SDL_RWseek(rw, -1, RW_SEEK_END); i = SDL_RWseek(rw, -1, SDL_RW_SEEK_END);
SDLTest_AssertPass("Call to SDL_RWseek(...,-1,RW_SEEK_END) succeeded"); SDLTest_AssertPass("Call to SDL_RWseek(...,-1,SDL_RW_SEEK_END) succeeded");
SDLTest_AssertCheck( SDLTest_AssertCheck(
i == (Sint64)(sizeof(RWopsHelloWorldTestString) - 2), i == (Sint64)(sizeof(RWopsHelloWorldTestString) - 2),
"Verify seek to -1 with SDL_RWseek (RW_SEEK_END), expected %i, got %i", "Verify seek to -1 with SDL_RWseek (SDL_RW_SEEK_END), expected %i, got %i",
(int)(sizeof(RWopsHelloWorldTestString) - 2), (int)(sizeof(RWopsHelloWorldTestString) - 2),
(int)i); (int)i);
@ -569,7 +569,7 @@ int rwops_testFileWriteReadEndian(void)
SDLTest_AssertCheck(objectsWritten == 1, "Validate number of objects written, expected: 1, got: %i", (int)objectsWritten); SDLTest_AssertCheck(objectsWritten == 1, "Validate number of objects written, expected: 1, got: %i", (int)objectsWritten);
/* Test seek to start */ /* Test seek to start */
result = SDL_RWseek(rw, 0, RW_SEEK_SET); result = SDL_RWseek(rw, 0, SDL_RW_SEEK_SET);
SDLTest_AssertPass("Call to SDL_RWseek succeeded"); SDLTest_AssertPass("Call to SDL_RWseek succeeded");
SDLTest_AssertCheck(result == 0, "Verify result from position 0 with SDL_RWseek, expected 0, got %i", (int)result); SDLTest_AssertCheck(result == 0, "Verify result from position 0 with SDL_RWseek, expected 0, got %i", (int)result);

View file

@ -149,7 +149,7 @@ int main(int argc, char *argv[])
if (7 != rwops->write(rwops, "1234567", 7)) { if (7 != rwops->write(rwops, "1234567", 7)) {
RWOP_ERR_QUIT(rwops); RWOP_ERR_QUIT(rwops);
} }
if (0 != rwops->seek(rwops, 0L, RW_SEEK_SET)) { if (0 != rwops->seek(rwops, 0L, SDL_RW_SEEK_SET)) {
RWOP_ERR_QUIT(rwops); RWOP_ERR_QUIT(rwops);
} }
if (0 != rwops->read(rwops, test_buf, 1)) { if (0 != rwops->read(rwops, test_buf, 1)) {
@ -162,10 +162,10 @@ int main(int argc, char *argv[])
if (rwops == NULL) { if (rwops == NULL) {
RWOP_ERR_QUIT(rwops); RWOP_ERR_QUIT(rwops);
} }
if (0 != rwops->seek(rwops, 0L, RW_SEEK_SET)) { if (0 != rwops->seek(rwops, 0L, SDL_RW_SEEK_SET)) {
RWOP_ERR_QUIT(rwops); RWOP_ERR_QUIT(rwops);
} }
if (20 != rwops->seek(rwops, -7, RW_SEEK_END)) { if (20 != rwops->seek(rwops, -7, SDL_RW_SEEK_END)) {
RWOP_ERR_QUIT(rwops); RWOP_ERR_QUIT(rwops);
} }
if (7 != rwops->read(rwops, test_buf, 7)) { if (7 != rwops->read(rwops, test_buf, 7)) {
@ -180,7 +180,7 @@ int main(int argc, char *argv[])
if (0 != rwops->read(rwops, test_buf, 1000)) { if (0 != rwops->read(rwops, test_buf, 1000)) {
RWOP_ERR_QUIT(rwops); RWOP_ERR_QUIT(rwops);
} }
if (0 != rwops->seek(rwops, -27, RW_SEEK_CUR)) { if (0 != rwops->seek(rwops, -27, SDL_RW_SEEK_CUR)) {
RWOP_ERR_QUIT(rwops); RWOP_ERR_QUIT(rwops);
} }
if (2 != rwops->read(rwops, test_buf, 30)) { if (2 != rwops->read(rwops, test_buf, 30)) {
@ -209,17 +209,17 @@ int main(int argc, char *argv[])
if (7 != rwops->write(rwops, "1234567", 7)) { if (7 != rwops->write(rwops, "1234567", 7)) {
RWOP_ERR_QUIT(rwops); RWOP_ERR_QUIT(rwops);
} }
if (0 != rwops->seek(rwops, 0L, RW_SEEK_SET)) { if (0 != rwops->seek(rwops, 0L, SDL_RW_SEEK_SET)) {
RWOP_ERR_QUIT(rwops); RWOP_ERR_QUIT(rwops);
} }
if (1 != rwops->read(rwops, test_buf, 1)) { if (1 != rwops->read(rwops, test_buf, 1)) {
RWOP_ERR_QUIT(rwops); /* we are in read/write mode */ RWOP_ERR_QUIT(rwops); /* we are in read/write mode */
} }
if (0 != rwops->seek(rwops, 0L, RW_SEEK_SET)) { if (0 != rwops->seek(rwops, 0L, SDL_RW_SEEK_SET)) {
RWOP_ERR_QUIT(rwops); RWOP_ERR_QUIT(rwops);
} }
if (20 != rwops->seek(rwops, -7, RW_SEEK_END)) { if (20 != rwops->seek(rwops, -7, SDL_RW_SEEK_END)) {
RWOP_ERR_QUIT(rwops); RWOP_ERR_QUIT(rwops);
} }
if (7 != rwops->read(rwops, test_buf, 7)) { if (7 != rwops->read(rwops, test_buf, 7)) {
@ -234,7 +234,7 @@ int main(int argc, char *argv[])
if (0 != rwops->read(rwops, test_buf, 1000)) { if (0 != rwops->read(rwops, test_buf, 1000)) {
RWOP_ERR_QUIT(rwops); RWOP_ERR_QUIT(rwops);
} }
if (0 != rwops->seek(rwops, -27, RW_SEEK_CUR)) { if (0 != rwops->seek(rwops, -27, SDL_RW_SEEK_CUR)) {
RWOP_ERR_QUIT(rwops); RWOP_ERR_QUIT(rwops);
} }
if (2 != rwops->read(rwops, test_buf, 30)) { if (2 != rwops->read(rwops, test_buf, 30)) {
@ -260,17 +260,17 @@ int main(int argc, char *argv[])
if (7 != rwops->write(rwops, "1234567", 7)) { if (7 != rwops->write(rwops, "1234567", 7)) {
RWOP_ERR_QUIT(rwops); RWOP_ERR_QUIT(rwops);
} }
if (0 != rwops->seek(rwops, 0L, RW_SEEK_SET)) { if (0 != rwops->seek(rwops, 0L, SDL_RW_SEEK_SET)) {
RWOP_ERR_QUIT(rwops); RWOP_ERR_QUIT(rwops);
} }
if (1 != rwops->read(rwops, test_buf, 1)) { if (1 != rwops->read(rwops, test_buf, 1)) {
RWOP_ERR_QUIT(rwops); /* we are in read/write mode */ RWOP_ERR_QUIT(rwops); /* we are in read/write mode */
} }
if (0 != rwops->seek(rwops, 0L, RW_SEEK_SET)) { if (0 != rwops->seek(rwops, 0L, SDL_RW_SEEK_SET)) {
RWOP_ERR_QUIT(rwops); RWOP_ERR_QUIT(rwops);
} }
if (20 != rwops->seek(rwops, -7, RW_SEEK_END)) { if (20 != rwops->seek(rwops, -7, SDL_RW_SEEK_END)) {
RWOP_ERR_QUIT(rwops); RWOP_ERR_QUIT(rwops);
} }
if (7 != rwops->read(rwops, test_buf, 7)) { if (7 != rwops->read(rwops, test_buf, 7)) {
@ -285,7 +285,7 @@ int main(int argc, char *argv[])
if (0 != rwops->read(rwops, test_buf, 1000)) { if (0 != rwops->read(rwops, test_buf, 1000)) {
RWOP_ERR_QUIT(rwops); RWOP_ERR_QUIT(rwops);
} }
if (0 != rwops->seek(rwops, -27, RW_SEEK_CUR)) { if (0 != rwops->seek(rwops, -27, SDL_RW_SEEK_CUR)) {
RWOP_ERR_QUIT(rwops); RWOP_ERR_QUIT(rwops);
} }
if (2 != rwops->read(rwops, test_buf, 30)) { if (2 != rwops->read(rwops, test_buf, 30)) {
@ -311,18 +311,18 @@ int main(int argc, char *argv[])
if (7 != rwops->write(rwops, "1234567", 7)) { if (7 != rwops->write(rwops, "1234567", 7)) {
RWOP_ERR_QUIT(rwops); RWOP_ERR_QUIT(rwops);
} }
if (0 != rwops->seek(rwops, 0L, RW_SEEK_SET)) { if (0 != rwops->seek(rwops, 0L, SDL_RW_SEEK_SET)) {
RWOP_ERR_QUIT(rwops); RWOP_ERR_QUIT(rwops);
} }
if (1 != rwops->read(rwops, test_buf, 1)) { if (1 != rwops->read(rwops, test_buf, 1)) {
RWOP_ERR_QUIT(rwops); RWOP_ERR_QUIT(rwops);
} }
if (0 != rwops->seek(rwops, 0L, RW_SEEK_SET)) { if (0 != rwops->seek(rwops, 0L, SDL_RW_SEEK_SET)) {
RWOP_ERR_QUIT(rwops); RWOP_ERR_QUIT(rwops);
} }
if (20 + 27 != rwops->seek(rwops, -7, RW_SEEK_END)) { if (20 + 27 != rwops->seek(rwops, -7, SDL_RW_SEEK_END)) {
RWOP_ERR_QUIT(rwops); RWOP_ERR_QUIT(rwops);
} }
if (7 != rwops->read(rwops, test_buf, 7)) { if (7 != rwops->read(rwops, test_buf, 7)) {
@ -338,11 +338,11 @@ int main(int argc, char *argv[])
RWOP_ERR_QUIT(rwops); RWOP_ERR_QUIT(rwops);
} }
if (27 != rwops->seek(rwops, -27, RW_SEEK_CUR)) { if (27 != rwops->seek(rwops, -27, SDL_RW_SEEK_CUR)) {
RWOP_ERR_QUIT(rwops); RWOP_ERR_QUIT(rwops);
} }
if (0 != rwops->seek(rwops, 0L, RW_SEEK_SET)) { if (0 != rwops->seek(rwops, 0L, SDL_RW_SEEK_SET)) {
RWOP_ERR_QUIT(rwops); RWOP_ERR_QUIT(rwops);
} }
if (3 != rwops->read(rwops, test_buf, 30)) { if (3 != rwops->read(rwops, test_buf, 30)) {