mirror of
https://github.com/libsdl-org/SDL.git
synced 2026-05-03 12:34:41 +00:00
rwops: Renamed SDL_CreateRW and SDL_DestroyRW to SDL_OpenRW and SDL_CloseRW.
This commit is contained in:
@@ -273,8 +273,8 @@ static int rwops_testMem(void *arg)
|
||||
testGenericRWopsValidations(rw, SDL_TRUE);
|
||||
|
||||
/* Close */
|
||||
result = SDL_DestroyRW(rw);
|
||||
SDLTest_AssertPass("Call to SDL_DestroyRW() succeeded");
|
||||
result = SDL_CloseRW(rw);
|
||||
SDLTest_AssertPass("Call to SDL_CloseRW() succeeded");
|
||||
SDLTest_AssertCheck(result == 0, "Verify result value is 0; got: %d", result);
|
||||
|
||||
return TEST_COMPLETED;
|
||||
@@ -305,8 +305,8 @@ static int rwops_testConstMem(void *arg)
|
||||
testGenericRWopsValidations(rw, SDL_FALSE);
|
||||
|
||||
/* Close handle */
|
||||
result = SDL_DestroyRW(rw);
|
||||
SDLTest_AssertPass("Call to SDL_DestroyRW() succeeded");
|
||||
result = SDL_CloseRW(rw);
|
||||
SDLTest_AssertPass("Call to SDL_CloseRW() succeeded");
|
||||
SDLTest_AssertCheck(result == 0, "Verify result value is 0; got: %d", result);
|
||||
|
||||
return TEST_COMPLETED;
|
||||
@@ -337,8 +337,8 @@ static int rwops_testFileRead(void *arg)
|
||||
testGenericRWopsValidations(rw, SDL_FALSE);
|
||||
|
||||
/* Close handle */
|
||||
result = SDL_DestroyRW(rw);
|
||||
SDLTest_AssertPass("Call to SDL_DestroyRW() succeeded");
|
||||
result = SDL_CloseRW(rw);
|
||||
SDLTest_AssertPass("Call to SDL_CloseRW() succeeded");
|
||||
SDLTest_AssertCheck(result == 0, "Verify result value is 0; got: %d", result);
|
||||
|
||||
return TEST_COMPLETED;
|
||||
@@ -369,8 +369,8 @@ static int rwops_testFileWrite(void *arg)
|
||||
testGenericRWopsValidations(rw, SDL_TRUE);
|
||||
|
||||
/* Close handle */
|
||||
result = SDL_DestroyRW(rw);
|
||||
SDLTest_AssertPass("Call to SDL_DestroyRW() succeeded");
|
||||
result = SDL_CloseRW(rw);
|
||||
SDLTest_AssertPass("Call to SDL_CloseRW() succeeded");
|
||||
SDLTest_AssertCheck(result == 0, "Verify result value is 0; got: %d", result);
|
||||
|
||||
return TEST_COMPLETED;
|
||||
@@ -379,8 +379,8 @@ static int rwops_testFileWrite(void *arg)
|
||||
/**
|
||||
* Tests alloc and free RW context.
|
||||
*
|
||||
* \sa SDL_CreateRW
|
||||
* \sa SDL_DestroyRW
|
||||
* \sa SDL_OpenRW
|
||||
* \sa SDL_CloseRW
|
||||
*/
|
||||
static int rwops_testAllocFree(void *arg)
|
||||
{
|
||||
@@ -389,16 +389,16 @@ static int rwops_testAllocFree(void *arg)
|
||||
SDL_RWops *rw;
|
||||
|
||||
SDL_zero(iface);
|
||||
rw = SDL_CreateRW(&iface, NULL);
|
||||
SDLTest_AssertPass("Call to SDL_CreateRW() succeeded");
|
||||
SDLTest_AssertCheck(rw != NULL, "Validate result from SDL_CreateRW() is not NULL");
|
||||
rw = SDL_OpenRW(&iface, NULL);
|
||||
SDLTest_AssertPass("Call to SDL_OpenRW() succeeded");
|
||||
SDLTest_AssertCheck(rw != NULL, "Validate result from SDL_OpenRW() is not NULL");
|
||||
if (rw == NULL) {
|
||||
return TEST_ABORTED;
|
||||
}
|
||||
|
||||
/* Free context again */
|
||||
SDL_DestroyRW(rw);
|
||||
SDLTest_AssertPass("Call to SDL_DestroyRW() succeeded");
|
||||
SDL_CloseRW(rw);
|
||||
SDLTest_AssertPass("Call to SDL_CloseRW() succeeded");
|
||||
|
||||
return TEST_COMPLETED;
|
||||
}
|
||||
@@ -435,8 +435,8 @@ static int rwops_testCompareRWFromMemWithRWFromFile(void *arg)
|
||||
SDLTest_AssertPass("Call to SDL_RWread(mem, size=%d)", size * 6);
|
||||
sv_mem = SDL_RWseek(rwops_mem, 0, SEEK_END);
|
||||
SDLTest_AssertPass("Call to SDL_RWseek(mem,SEEK_END)");
|
||||
result = SDL_DestroyRW(rwops_mem);
|
||||
SDLTest_AssertPass("Call to SDL_DestroyRW(mem)");
|
||||
result = SDL_CloseRW(rwops_mem);
|
||||
SDLTest_AssertPass("Call to SDL_CloseRW(mem)");
|
||||
SDLTest_AssertCheck(result == 0, "Verify result value is 0; got: %d", result);
|
||||
|
||||
/* Read/see from file */
|
||||
@@ -446,8 +446,8 @@ static int rwops_testCompareRWFromMemWithRWFromFile(void *arg)
|
||||
SDLTest_AssertPass("Call to SDL_RWread(file, size=%d)", size * 6);
|
||||
sv_file = SDL_RWseek(rwops_file, 0, SEEK_END);
|
||||
SDLTest_AssertPass("Call to SDL_RWseek(file,SEEK_END)");
|
||||
result = SDL_DestroyRW(rwops_file);
|
||||
SDLTest_AssertPass("Call to SDL_DestroyRW(file)");
|
||||
result = SDL_CloseRW(rwops_file);
|
||||
SDLTest_AssertPass("Call to SDL_CloseRW(file)");
|
||||
SDLTest_AssertCheck(result == 0, "Verify result value is 0; got: %d", result);
|
||||
|
||||
/* Compare */
|
||||
@@ -590,8 +590,8 @@ static int rwops_testFileWriteReadEndian(void *arg)
|
||||
SDLTest_AssertCheck(LE64test == LE64value, "Validate object read from SDL_ReadU64LE, expected: %" SDL_PRIu64 ", got: %" SDL_PRIu64, LE64value, LE64test);
|
||||
|
||||
/* Close handle */
|
||||
cresult = SDL_DestroyRW(rw);
|
||||
SDLTest_AssertPass("Call to SDL_DestroyRW() succeeded");
|
||||
cresult = SDL_CloseRW(rw);
|
||||
SDLTest_AssertPass("Call to SDL_CloseRW() succeeded");
|
||||
SDLTest_AssertCheck(cresult == 0, "Verify result value is 0; got: %d", cresult);
|
||||
}
|
||||
|
||||
|
||||
@@ -55,7 +55,7 @@ rwops_error_quit(unsigned line, SDL_RWops *rwops)
|
||||
{
|
||||
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "testfile.c(%d): failed\n", line);
|
||||
if (rwops) {
|
||||
SDL_DestroyRW(rwops);
|
||||
SDL_CloseRW(rwops);
|
||||
}
|
||||
cleanup();
|
||||
SDLTest_CommonDestroyState(state);
|
||||
@@ -126,25 +126,25 @@ int main(int argc, char *argv[])
|
||||
if (!rwops) {
|
||||
RWOP_ERR_QUIT(rwops);
|
||||
}
|
||||
SDL_DestroyRW(rwops);
|
||||
SDL_CloseRW(rwops);
|
||||
unlink(FBASENAME2);
|
||||
rwops = SDL_RWFromFile(FBASENAME2, "wb+");
|
||||
if (!rwops) {
|
||||
RWOP_ERR_QUIT(rwops);
|
||||
}
|
||||
SDL_DestroyRW(rwops);
|
||||
SDL_CloseRW(rwops);
|
||||
unlink(FBASENAME2);
|
||||
rwops = SDL_RWFromFile(FBASENAME2, "ab");
|
||||
if (!rwops) {
|
||||
RWOP_ERR_QUIT(rwops);
|
||||
}
|
||||
SDL_DestroyRW(rwops);
|
||||
SDL_CloseRW(rwops);
|
||||
unlink(FBASENAME2);
|
||||
rwops = SDL_RWFromFile(FBASENAME2, "ab+");
|
||||
if (!rwops) {
|
||||
RWOP_ERR_QUIT(rwops);
|
||||
}
|
||||
SDL_DestroyRW(rwops);
|
||||
SDL_CloseRW(rwops);
|
||||
unlink(FBASENAME2);
|
||||
SDL_Log("test2 OK\n");
|
||||
|
||||
@@ -171,7 +171,7 @@ int main(int argc, char *argv[])
|
||||
RWOP_ERR_QUIT(rwops); /* we are in write only mode */
|
||||
}
|
||||
|
||||
SDL_DestroyRW(rwops);
|
||||
SDL_CloseRW(rwops);
|
||||
|
||||
rwops = SDL_RWFromFile(FBASENAME1, "rb"); /* read mode, file must exist */
|
||||
if (!rwops) {
|
||||
@@ -208,7 +208,7 @@ int main(int argc, char *argv[])
|
||||
RWOP_ERR_QUIT(rwops); /* readonly mode */
|
||||
}
|
||||
|
||||
SDL_DestroyRW(rwops);
|
||||
SDL_CloseRW(rwops);
|
||||
|
||||
/* test 3: same with w+ mode */
|
||||
rwops = SDL_RWFromFile(FBASENAME1, "wb+"); /* write + read + truncation */
|
||||
@@ -258,7 +258,7 @@ int main(int argc, char *argv[])
|
||||
if (SDL_memcmp(test_buf, "12345678901234567890", 20) != 0) {
|
||||
RWOP_ERR_QUIT(rwops);
|
||||
}
|
||||
SDL_DestroyRW(rwops);
|
||||
SDL_CloseRW(rwops);
|
||||
SDL_Log("test3 OK\n");
|
||||
|
||||
/* test 4: same in r+ mode */
|
||||
@@ -309,7 +309,7 @@ int main(int argc, char *argv[])
|
||||
if (SDL_memcmp(test_buf, "12345678901234567890", 20) != 0) {
|
||||
RWOP_ERR_QUIT(rwops);
|
||||
}
|
||||
SDL_DestroyRW(rwops);
|
||||
SDL_CloseRW(rwops);
|
||||
SDL_Log("test4 OK\n");
|
||||
|
||||
/* test5 : append mode */
|
||||
@@ -366,7 +366,7 @@ int main(int argc, char *argv[])
|
||||
if (SDL_memcmp(test_buf, "123456789012345678901234567123", 30) != 0) {
|
||||
RWOP_ERR_QUIT(rwops);
|
||||
}
|
||||
SDL_DestroyRW(rwops);
|
||||
SDL_CloseRW(rwops);
|
||||
SDL_Log("test5 OK\n");
|
||||
cleanup();
|
||||
SDL_Quit();
|
||||
|
||||
@@ -223,7 +223,7 @@ static int unifont_init(const char *fontname)
|
||||
lineNumber++;
|
||||
} while (bytesRead > 0);
|
||||
|
||||
SDL_DestroyRW(hexFile);
|
||||
SDL_CloseRW(hexFile);
|
||||
SDL_Log("unifont: Loaded %" SDL_PRIu32 " glyphs.\n", numGlyphs);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -452,7 +452,7 @@ int main(int argc, char **argv)
|
||||
|
||||
SDL_RWread(handle, RawMooseData, MOOSEFRAME_SIZE * MOOSEFRAMES_COUNT);
|
||||
|
||||
SDL_DestroyRW(handle);
|
||||
SDL_CloseRW(handle);
|
||||
|
||||
/* Create the window and renderer */
|
||||
window_w = MOOSEPIC_W * scale;
|
||||
|
||||
@@ -117,7 +117,7 @@ int main(int argc, char **argv)
|
||||
/* write out a WAV header... */
|
||||
io = SDL_RWFromFile(file_out, "wb");
|
||||
if (!io) {
|
||||
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "fopen('%s') failed: %s\n", file_out, SDL_GetError());
|
||||
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "opening '%s' failed: %s\n", file_out, SDL_GetError());
|
||||
ret = 5;
|
||||
goto end;
|
||||
}
|
||||
@@ -141,8 +141,8 @@ int main(int argc, char **argv)
|
||||
SDL_WriteU32LE(io, dst_len); /* size */
|
||||
SDL_RWwrite(io, dst_buf, dst_len);
|
||||
|
||||
if (SDL_DestroyRW(io) == -1) {
|
||||
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "fclose('%s') failed: %s\n", file_out, SDL_GetError());
|
||||
if (SDL_CloseRW(io) == -1) {
|
||||
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "closing '%s' failed: %s\n", file_out, SDL_GetError());
|
||||
ret = 6;
|
||||
goto end;
|
||||
}
|
||||
|
||||
@@ -171,7 +171,7 @@ int main(int argc, char **argv)
|
||||
quit(2);
|
||||
}
|
||||
SDL_RWread(handle, MooseFrames, MOOSEFRAME_SIZE * MOOSEFRAMES_COUNT);
|
||||
SDL_DestroyRW(handle);
|
||||
SDL_CloseRW(handle);
|
||||
|
||||
/* Create the window and renderer */
|
||||
window = SDL_CreateWindow("Happy Moose", MOOSEPIC_W * 4, MOOSEPIC_H * 4, SDL_WINDOW_RESIZABLE);
|
||||
|
||||
@@ -44,7 +44,7 @@ GetNearbyFilename(const char *file)
|
||||
|
||||
rw = SDL_RWFromFile(path, "rb");
|
||||
if (rw) {
|
||||
SDL_DestroyRW(rw);
|
||||
SDL_CloseRW(rw);
|
||||
return path;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user