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

@@ -1520,7 +1520,7 @@ static int WaveNextChunk(SDL_RWops *src, WaveChunk *chunk)
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. */
return -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();
}
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. */
return -2;
}
@@ -1894,7 +1894,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_RWseek(src, chunk->position, RW_SEEK_SET);
Sint64 position = SDL_RWseek(src, chunk->position, SDL_RW_SEEK_SET);
Uint32 samplelength;
if (position == chunk->position && SDL_RWread(src, &samplelength, sizeof(Uint32)) == sizeof(Uint32)) {
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) {
Uint8 tmp;
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");
} else if (SDL_RWread(src, &tmp, 1) != 1) {
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) {
SDL_RWclose(src);
} else {
SDL_RWseek(src, file.chunk.position, RW_SEEK_SET);
SDL_RWseek(src, file.chunk.position, SDL_RW_SEEK_SET);
}
WaveFreeChunkData(&file.chunk);
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 */
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;
}
context->hidden.windowsio.buffer.left = 0;
switch (whence) {
case RW_SEEK_SET:
case SDL_RW_SEEK_SET:
windowswhence = FILE_BEGIN;
break;
case RW_SEEK_CUR:
case SDL_RW_SEEK_CUR:
windowswhence = FILE_CURRENT;
break;
case RW_SEEK_END:
case SDL_RW_SEEK_END:
windowswhence = FILE_END;
break;
default:
@@ -326,13 +326,13 @@ static Sint64 SDLCALL stdio_size(SDL_RWops *context)
{
Sint64 pos, size;
pos = SDL_RWseek(context, 0, RW_SEEK_CUR);
pos = SDL_RWseek(context, 0, SDL_RW_SEEK_CUR);
if (pos < 0) {
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;
}
@@ -341,13 +341,13 @@ static Sint64 SDLCALL stdio_seek(SDL_RWops *context, Sint64 offset, int whence)
int stdiowhence;
switch (whence) {
case RW_SEEK_SET:
case SDL_RW_SEEK_SET:
stdiowhence = SEEK_SET;
break;
case RW_SEEK_CUR:
case SDL_RW_SEEK_CUR:
stdiowhence = SEEK_CUR;
break;
case RW_SEEK_END:
case SDL_RW_SEEK_END:
stdiowhence = SEEK_END;
break;
default:
@@ -439,13 +439,13 @@ static Sint64 SDLCALL mem_seek(SDL_RWops *context, Sint64 offset, int whence)
Uint8 *newpos;
switch (whence) {
case RW_SEEK_SET:
case SDL_RW_SEEK_SET:
newpos = context->hidden.mem.base + offset;
break;
case RW_SEEK_CUR:
case SDL_RW_SEEK_CUR:
newpos = context->hidden.mem.here + offset;
break;
case RW_SEEK_END:
case SDL_RW_SEEK_END:
newpos = context->hidden.mem.stop + offset;
break;
default:
@@ -742,7 +742,7 @@ SDL_RWseek(SDL_RWops *context, Sint64 offset, int whence)
Sint64
SDL_RWtell(SDL_RWops *context)
{
return context->seek(context, 0, RW_SEEK_CUR);
return context->seek(context, 0, SDL_RW_SEEK_CUR);
}
Sint64

View File

@@ -332,7 +332,7 @@ SDL_LoadBMP_RW(SDL_RWops *src, int freesrc)
/* skip any header bytes we didn't handle... */
headerSize = (Uint32)(SDL_RWtell(src) - (fp_offset + 14));
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) {
@@ -440,7 +440,7 @@ SDL_LoadBMP_RW(SDL_RWops *src, int freesrc)
/* Load the palette, if any */
palette = (surface->format)->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);
was_error = SDL_TRUE;
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 */
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);
was_error = SDL_TRUE;
goto done;
@@ -614,7 +614,7 @@ SDL_LoadBMP_RW(SDL_RWops *src, int freesrc)
done:
if (was_error) {
if (src) {
SDL_RWseek(src, fp_offset, RW_SEEK_SET);
SDL_RWseek(src, fp_offset, SDL_RW_SEEK_SET);
}
SDL_FreeSurface(surface);
surface = NULL;
@@ -823,11 +823,11 @@ int SDL_SaveBMP_RW(SDL_Surface *surface, SDL_RWops *dst, int freedst)
/* Write the bitmap 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_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);
}
@@ -850,11 +850,11 @@ int SDL_SaveBMP_RW(SDL_Surface *surface, SDL_RWops *dst, int freedst)
/* Write the BMP file size */
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_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);
}