rwops: Renamed SDL_CreateRW and SDL_DestroyRW to SDL_OpenRW and SDL_CloseRW.

This commit is contained in:
Ryan C. Gordon
2024-03-12 09:01:37 -04:00
parent 525919b315
commit 655ceb3b31
22 changed files with 81 additions and 95 deletions

View File

@@ -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();