mirror of
https://github.com/libsdl-org/SDL.git
synced 2026-04-23 15:56:00 +00:00
rwops: Rename everything from SDL_RWxxx to SDL_XxxRW.
This commit is contained in:
@@ -92,8 +92,8 @@ static void RWopsTearDown(void *arg)
|
||||
/**
|
||||
* Makes sure parameters work properly. Local helper function.
|
||||
*
|
||||
* \sa SDL_RWseek
|
||||
* \sa SDL_RWread
|
||||
* \sa SDL_SeekRW
|
||||
* \sa SDL_ReadRW
|
||||
*/
|
||||
static void testGenericRWopsValidations(SDL_RWops *rw, SDL_bool write)
|
||||
{
|
||||
@@ -106,35 +106,35 @@ static void testGenericRWopsValidations(SDL_RWops *rw, SDL_bool write)
|
||||
SDL_zeroa(buf);
|
||||
|
||||
/* Set to start. */
|
||||
i = SDL_RWseek(rw, 0, SDL_RW_SEEK_SET);
|
||||
SDLTest_AssertPass("Call to SDL_RWseek succeeded");
|
||||
SDLTest_AssertCheck(i == (Sint64)0, "Verify seek to 0 with SDL_RWseek (SDL_RW_SEEK_SET), expected 0, got %" SDL_PRIs64, i);
|
||||
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);
|
||||
|
||||
/* Test write */
|
||||
s = SDL_RWwrite(rw, RWopsHelloWorldTestString, sizeof(RWopsHelloWorldTestString) - 1);
|
||||
SDLTest_AssertPass("Call to SDL_RWwrite succeeded");
|
||||
s = SDL_WriteRW(rw, RWopsHelloWorldTestString, sizeof(RWopsHelloWorldTestString) - 1);
|
||||
SDLTest_AssertPass("Call to SDL_WriteRW succeeded");
|
||||
if (write) {
|
||||
SDLTest_AssertCheck(s == sizeof(RWopsHelloWorldTestString) - 1, "Verify result of writing with SDL_RWwrite, expected %i, got %i", (int)sizeof(RWopsHelloWorldTestString) - 1, (int)s);
|
||||
SDLTest_AssertCheck(s == sizeof(RWopsHelloWorldTestString) - 1, "Verify result of writing with SDL_WriteRW, expected %i, got %i", (int)sizeof(RWopsHelloWorldTestString) - 1, (int)s);
|
||||
} else {
|
||||
SDLTest_AssertCheck(s == 0, "Verify result of writing with SDL_RWwrite, expected: 0, got %i", (int)s);
|
||||
SDLTest_AssertCheck(s == 0, "Verify result of writing with SDL_WriteRW, expected: 0, got %i", (int)s);
|
||||
}
|
||||
|
||||
/* Test seek to random position */
|
||||
i = SDL_RWseek(rw, seekPos, SDL_RW_SEEK_SET);
|
||||
SDLTest_AssertPass("Call to SDL_RWseek succeeded");
|
||||
SDLTest_AssertCheck(i == (Sint64)seekPos, "Verify seek to %i with SDL_RWseek (SDL_RW_SEEK_SET), expected %i, got %" SDL_PRIs64, seekPos, seekPos, i);
|
||||
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);
|
||||
|
||||
/* Test seek back to start */
|
||||
i = SDL_RWseek(rw, 0, SDL_RW_SEEK_SET);
|
||||
SDLTest_AssertPass("Call to SDL_RWseek succeeded");
|
||||
SDLTest_AssertCheck(i == (Sint64)0, "Verify seek to 0 with SDL_RWseek (SDL_RW_SEEK_SET), expected 0, got %" SDL_PRIs64, i);
|
||||
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);
|
||||
|
||||
/* Test read */
|
||||
s = SDL_RWread(rw, buf, sizeof(RWopsHelloWorldTestString) - 1);
|
||||
SDLTest_AssertPass("Call to SDL_RWread succeeded");
|
||||
s = SDL_ReadRW(rw, buf, sizeof(RWopsHelloWorldTestString) - 1);
|
||||
SDLTest_AssertPass("Call to SDL_ReadRW succeeded");
|
||||
SDLTest_AssertCheck(
|
||||
s == (sizeof(RWopsHelloWorldTestString) - 1),
|
||||
"Verify result from SDL_RWread, expected %i, got %i",
|
||||
"Verify result from SDL_ReadRW, expected %i, got %i",
|
||||
(int)(sizeof(RWopsHelloWorldTestString) - 1),
|
||||
(int)s);
|
||||
SDLTest_AssertCheck(
|
||||
@@ -142,9 +142,9 @@ static void testGenericRWopsValidations(SDL_RWops *rw, SDL_bool write)
|
||||
"Verify read bytes match expected string, expected '%s', got '%s'", RWopsHelloWorldTestString, buf);
|
||||
|
||||
/* Test seek back to start */
|
||||
i = SDL_RWseek(rw, 0, SDL_RW_SEEK_SET);
|
||||
SDLTest_AssertPass("Call to SDL_RWseek succeeded");
|
||||
SDLTest_AssertCheck(i == (Sint64)0, "Verify seek to 0 with SDL_RWseek (SDL_RW_SEEK_SET), expected 0, got %" SDL_PRIs64, i);
|
||||
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);
|
||||
|
||||
/* Test printf */
|
||||
s = SDL_RWprintf(rw, "%s", RWopsHelloWorldTestString);
|
||||
@@ -152,20 +152,20 @@ static void testGenericRWopsValidations(SDL_RWops *rw, SDL_bool write)
|
||||
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);
|
||||
} else {
|
||||
SDLTest_AssertCheck(s == 0, "Verify result of writing with SDL_RWwrite, expected: 0, got %i", (int)s);
|
||||
SDLTest_AssertCheck(s == 0, "Verify result of writing with SDL_WriteRW, expected: 0, got %i", (int)s);
|
||||
}
|
||||
|
||||
/* Test seek back to start */
|
||||
i = SDL_RWseek(rw, 0, SDL_RW_SEEK_SET);
|
||||
SDLTest_AssertPass("Call to SDL_RWseek succeeded");
|
||||
SDLTest_AssertCheck(i == (Sint64)0, "Verify seek to 0 with SDL_RWseek (SDL_RW_SEEK_SET), expected 0, got %" SDL_PRIs64, i);
|
||||
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);
|
||||
|
||||
/* Test read */
|
||||
s = SDL_RWread(rw, buf, sizeof(RWopsHelloWorldTestString) - 1);
|
||||
SDLTest_AssertPass("Call to SDL_RWread succeeded");
|
||||
s = SDL_ReadRW(rw, buf, sizeof(RWopsHelloWorldTestString) - 1);
|
||||
SDLTest_AssertPass("Call to SDL_ReadRW succeeded");
|
||||
SDLTest_AssertCheck(
|
||||
s == (sizeof(RWopsHelloWorldTestString) - 1),
|
||||
"Verify result from SDL_RWread, expected %i, got %i",
|
||||
"Verify result from SDL_ReadRW, expected %i, got %i",
|
||||
(int)(sizeof(RWopsHelloWorldTestString) - 1),
|
||||
(int)s);
|
||||
SDLTest_AssertCheck(
|
||||
@@ -173,28 +173,28 @@ static void testGenericRWopsValidations(SDL_RWops *rw, SDL_bool write)
|
||||
"Verify read bytes match expected string, expected '%s', got '%s'", RWopsHelloWorldTestString, buf);
|
||||
|
||||
/* More seek tests. */
|
||||
i = SDL_RWseek(rw, -4, SDL_RW_SEEK_CUR);
|
||||
SDLTest_AssertPass("Call to SDL_RWseek(...,-4,SDL_RW_SEEK_CUR) succeeded");
|
||||
i = SDL_SeekRW(rw, -4, SDL_RW_SEEK_CUR);
|
||||
SDLTest_AssertPass("Call to SDL_SeekRW(...,-4,SDL_RW_SEEK_CUR) succeeded");
|
||||
SDLTest_AssertCheck(
|
||||
i == (Sint64)(sizeof(RWopsHelloWorldTestString) - 5),
|
||||
"Verify seek to -4 with SDL_RWseek (SDL_RW_SEEK_CUR), expected %i, got %i",
|
||||
"Verify seek to -4 with SDL_SeekRW (SDL_RW_SEEK_CUR), expected %i, got %i",
|
||||
(int)(sizeof(RWopsHelloWorldTestString) - 5),
|
||||
(int)i);
|
||||
|
||||
i = SDL_RWseek(rw, -1, SDL_RW_SEEK_END);
|
||||
SDLTest_AssertPass("Call to SDL_RWseek(...,-1,SDL_RW_SEEK_END) succeeded");
|
||||
i = SDL_SeekRW(rw, -1, SDL_RW_SEEK_END);
|
||||
SDLTest_AssertPass("Call to SDL_SeekRW(...,-1,SDL_RW_SEEK_END) succeeded");
|
||||
SDLTest_AssertCheck(
|
||||
i == (Sint64)(sizeof(RWopsHelloWorldTestString) - 2),
|
||||
"Verify seek to -1 with SDL_RWseek (SDL_RW_SEEK_END), expected %i, got %i",
|
||||
"Verify seek to -1 with SDL_SeekRW (SDL_RW_SEEK_END), expected %i, got %i",
|
||||
(int)(sizeof(RWopsHelloWorldTestString) - 2),
|
||||
(int)i);
|
||||
|
||||
/* Invalid whence seek */
|
||||
i = SDL_RWseek(rw, 0, 999);
|
||||
SDLTest_AssertPass("Call to SDL_RWseek(...,0,invalid_whence) succeeded");
|
||||
i = SDL_SeekRW(rw, 0, 999);
|
||||
SDLTest_AssertPass("Call to SDL_SeekRW(...,0,invalid_whence) succeeded");
|
||||
SDLTest_AssertCheck(
|
||||
i == (Sint64)(-1),
|
||||
"Verify seek with SDL_RWseek (invalid_whence); expected: -1, got %i",
|
||||
"Verify seek with SDL_SeekRW (invalid_whence); expected: -1, got %i",
|
||||
(int)i);
|
||||
}
|
||||
|
||||
@@ -431,10 +431,10 @@ static int rwops_testCompareRWFromMemWithRWFromFile(void *arg)
|
||||
/* Read/seek from memory */
|
||||
rwops_mem = SDL_RWFromMem((void *)RWopsAlphabetString, slen);
|
||||
SDLTest_AssertPass("Call to SDL_RWFromMem()");
|
||||
rv_mem = SDL_RWread(rwops_mem, buffer_mem, size * 6);
|
||||
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)");
|
||||
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)");
|
||||
SDLTest_AssertCheck(result == 0, "Verify result value is 0; got: %d", result);
|
||||
@@ -442,10 +442,10 @@ static int rwops_testCompareRWFromMemWithRWFromFile(void *arg)
|
||||
/* Read/see from file */
|
||||
rwops_file = SDL_RWFromFile(RWopsAlphabetFilename, "r");
|
||||
SDLTest_AssertPass("Call to SDL_RWFromFile()");
|
||||
rv_file = SDL_RWread(rwops_file, buffer_file, size * 6);
|
||||
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)");
|
||||
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)");
|
||||
SDLTest_AssertCheck(result == 0, "Verify result value is 0; got: %d", result);
|
||||
@@ -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_RWseek(rw, 0, SDL_RW_SEEK_SET);
|
||||
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);
|
||||
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);
|
||||
|
||||
/* Read test data */
|
||||
bresult = SDL_ReadU16BE(rw, &BE16test);
|
||||
|
||||
100
test/testfile.c
100
test/testfile.c
@@ -155,19 +155,19 @@ int main(int argc, char *argv[])
|
||||
if (!rwops) {
|
||||
RWOP_ERR_QUIT(rwops);
|
||||
}
|
||||
if (10 != SDL_RWwrite(rwops, "1234567890", 10)) {
|
||||
if (10 != SDL_WriteRW(rwops, "1234567890", 10)) {
|
||||
RWOP_ERR_QUIT(rwops);
|
||||
}
|
||||
if (10 != SDL_RWwrite(rwops, "1234567890", 10)) {
|
||||
if (10 != SDL_WriteRW(rwops, "1234567890", 10)) {
|
||||
RWOP_ERR_QUIT(rwops);
|
||||
}
|
||||
if (7 != SDL_RWwrite(rwops, "1234567", 7)) {
|
||||
if (7 != SDL_WriteRW(rwops, "1234567", 7)) {
|
||||
RWOP_ERR_QUIT(rwops);
|
||||
}
|
||||
if (0 != SDL_RWseek(rwops, 0L, SDL_RW_SEEK_SET)) {
|
||||
if (0 != SDL_SeekRW(rwops, 0L, SDL_RW_SEEK_SET)) {
|
||||
RWOP_ERR_QUIT(rwops);
|
||||
}
|
||||
if (0 != SDL_RWread(rwops, test_buf, 1)) {
|
||||
if (0 != SDL_ReadRW(rwops, test_buf, 1)) {
|
||||
RWOP_ERR_QUIT(rwops); /* we are in write only mode */
|
||||
}
|
||||
|
||||
@@ -177,34 +177,34 @@ int main(int argc, char *argv[])
|
||||
if (!rwops) {
|
||||
RWOP_ERR_QUIT(rwops);
|
||||
}
|
||||
if (0 != SDL_RWseek(rwops, 0L, SDL_RW_SEEK_SET)) {
|
||||
if (0 != SDL_SeekRW(rwops, 0L, SDL_RW_SEEK_SET)) {
|
||||
RWOP_ERR_QUIT(rwops);
|
||||
}
|
||||
if (20 != SDL_RWseek(rwops, -7, SDL_RW_SEEK_END)) {
|
||||
if (20 != SDL_SeekRW(rwops, -7, SDL_RW_SEEK_END)) {
|
||||
RWOP_ERR_QUIT(rwops);
|
||||
}
|
||||
if (7 != SDL_RWread(rwops, test_buf, 7)) {
|
||||
if (7 != SDL_ReadRW(rwops, test_buf, 7)) {
|
||||
RWOP_ERR_QUIT(rwops);
|
||||
}
|
||||
if (SDL_memcmp(test_buf, "1234567", 7) != 0) {
|
||||
RWOP_ERR_QUIT(rwops);
|
||||
}
|
||||
if (0 != SDL_RWread(rwops, test_buf, 1)) {
|
||||
if (0 != SDL_ReadRW(rwops, test_buf, 1)) {
|
||||
RWOP_ERR_QUIT(rwops);
|
||||
}
|
||||
if (0 != SDL_RWread(rwops, test_buf, 1000)) {
|
||||
if (0 != SDL_ReadRW(rwops, test_buf, 1000)) {
|
||||
RWOP_ERR_QUIT(rwops);
|
||||
}
|
||||
if (0 != SDL_RWseek(rwops, -27, SDL_RW_SEEK_CUR)) {
|
||||
if (0 != SDL_SeekRW(rwops, -27, SDL_RW_SEEK_CUR)) {
|
||||
RWOP_ERR_QUIT(rwops);
|
||||
}
|
||||
if (27 != SDL_RWread(rwops, test_buf, 30)) {
|
||||
if (27 != SDL_ReadRW(rwops, test_buf, 30)) {
|
||||
RWOP_ERR_QUIT(rwops);
|
||||
}
|
||||
if (SDL_memcmp(test_buf, "12345678901234567890", 20) != 0) {
|
||||
RWOP_ERR_QUIT(rwops);
|
||||
}
|
||||
if (0 != SDL_RWwrite(rwops, test_buf, 1)) {
|
||||
if (0 != SDL_WriteRW(rwops, test_buf, 1)) {
|
||||
RWOP_ERR_QUIT(rwops); /* readonly mode */
|
||||
}
|
||||
|
||||
@@ -215,44 +215,44 @@ int main(int argc, char *argv[])
|
||||
if (!rwops) {
|
||||
RWOP_ERR_QUIT(rwops);
|
||||
}
|
||||
if (10 != SDL_RWwrite(rwops, "1234567890", 10)) {
|
||||
if (10 != SDL_WriteRW(rwops, "1234567890", 10)) {
|
||||
RWOP_ERR_QUIT(rwops);
|
||||
}
|
||||
if (10 != SDL_RWwrite(rwops, "1234567890", 10)) {
|
||||
if (10 != SDL_WriteRW(rwops, "1234567890", 10)) {
|
||||
RWOP_ERR_QUIT(rwops);
|
||||
}
|
||||
if (7 != SDL_RWwrite(rwops, "1234567", 7)) {
|
||||
if (7 != SDL_WriteRW(rwops, "1234567", 7)) {
|
||||
RWOP_ERR_QUIT(rwops);
|
||||
}
|
||||
if (0 != SDL_RWseek(rwops, 0L, SDL_RW_SEEK_SET)) {
|
||||
if (0 != SDL_SeekRW(rwops, 0L, SDL_RW_SEEK_SET)) {
|
||||
RWOP_ERR_QUIT(rwops);
|
||||
}
|
||||
if (1 != SDL_RWread(rwops, test_buf, 1)) {
|
||||
if (1 != SDL_ReadRW(rwops, test_buf, 1)) {
|
||||
RWOP_ERR_QUIT(rwops); /* we are in read/write mode */
|
||||
}
|
||||
|
||||
if (0 != SDL_RWseek(rwops, 0L, SDL_RW_SEEK_SET)) {
|
||||
if (0 != SDL_SeekRW(rwops, 0L, SDL_RW_SEEK_SET)) {
|
||||
RWOP_ERR_QUIT(rwops);
|
||||
}
|
||||
if (20 != SDL_RWseek(rwops, -7, SDL_RW_SEEK_END)) {
|
||||
if (20 != SDL_SeekRW(rwops, -7, SDL_RW_SEEK_END)) {
|
||||
RWOP_ERR_QUIT(rwops);
|
||||
}
|
||||
if (7 != SDL_RWread(rwops, test_buf, 7)) {
|
||||
if (7 != SDL_ReadRW(rwops, test_buf, 7)) {
|
||||
RWOP_ERR_QUIT(rwops);
|
||||
}
|
||||
if (SDL_memcmp(test_buf, "1234567", 7) != 0) {
|
||||
RWOP_ERR_QUIT(rwops);
|
||||
}
|
||||
if (0 != SDL_RWread(rwops, test_buf, 1)) {
|
||||
if (0 != SDL_ReadRW(rwops, test_buf, 1)) {
|
||||
RWOP_ERR_QUIT(rwops);
|
||||
}
|
||||
if (0 != SDL_RWread(rwops, test_buf, 1000)) {
|
||||
if (0 != SDL_ReadRW(rwops, test_buf, 1000)) {
|
||||
RWOP_ERR_QUIT(rwops);
|
||||
}
|
||||
if (0 != SDL_RWseek(rwops, -27, SDL_RW_SEEK_CUR)) {
|
||||
if (0 != SDL_SeekRW(rwops, -27, SDL_RW_SEEK_CUR)) {
|
||||
RWOP_ERR_QUIT(rwops);
|
||||
}
|
||||
if (27 != SDL_RWread(rwops, test_buf, 30)) {
|
||||
if (27 != SDL_ReadRW(rwops, test_buf, 30)) {
|
||||
RWOP_ERR_QUIT(rwops);
|
||||
}
|
||||
if (SDL_memcmp(test_buf, "12345678901234567890", 20) != 0) {
|
||||
@@ -266,44 +266,44 @@ int main(int argc, char *argv[])
|
||||
if (!rwops) {
|
||||
RWOP_ERR_QUIT(rwops);
|
||||
}
|
||||
if (10 != SDL_RWwrite(rwops, "1234567890", 10)) {
|
||||
if (10 != SDL_WriteRW(rwops, "1234567890", 10)) {
|
||||
RWOP_ERR_QUIT(rwops);
|
||||
}
|
||||
if (10 != SDL_RWwrite(rwops, "1234567890", 10)) {
|
||||
if (10 != SDL_WriteRW(rwops, "1234567890", 10)) {
|
||||
RWOP_ERR_QUIT(rwops);
|
||||
}
|
||||
if (7 != SDL_RWwrite(rwops, "1234567", 7)) {
|
||||
if (7 != SDL_WriteRW(rwops, "1234567", 7)) {
|
||||
RWOP_ERR_QUIT(rwops);
|
||||
}
|
||||
if (0 != SDL_RWseek(rwops, 0L, SDL_RW_SEEK_SET)) {
|
||||
if (0 != SDL_SeekRW(rwops, 0L, SDL_RW_SEEK_SET)) {
|
||||
RWOP_ERR_QUIT(rwops);
|
||||
}
|
||||
if (1 != SDL_RWread(rwops, test_buf, 1)) {
|
||||
if (1 != SDL_ReadRW(rwops, test_buf, 1)) {
|
||||
RWOP_ERR_QUIT(rwops); /* we are in read/write mode */
|
||||
}
|
||||
|
||||
if (0 != SDL_RWseek(rwops, 0L, SDL_RW_SEEK_SET)) {
|
||||
if (0 != SDL_SeekRW(rwops, 0L, SDL_RW_SEEK_SET)) {
|
||||
RWOP_ERR_QUIT(rwops);
|
||||
}
|
||||
if (20 != SDL_RWseek(rwops, -7, SDL_RW_SEEK_END)) {
|
||||
if (20 != SDL_SeekRW(rwops, -7, SDL_RW_SEEK_END)) {
|
||||
RWOP_ERR_QUIT(rwops);
|
||||
}
|
||||
if (7 != SDL_RWread(rwops, test_buf, 7)) {
|
||||
if (7 != SDL_ReadRW(rwops, test_buf, 7)) {
|
||||
RWOP_ERR_QUIT(rwops);
|
||||
}
|
||||
if (SDL_memcmp(test_buf, "1234567", 7) != 0) {
|
||||
RWOP_ERR_QUIT(rwops);
|
||||
}
|
||||
if (0 != SDL_RWread(rwops, test_buf, 1)) {
|
||||
if (0 != SDL_ReadRW(rwops, test_buf, 1)) {
|
||||
RWOP_ERR_QUIT(rwops);
|
||||
}
|
||||
if (0 != SDL_RWread(rwops, test_buf, 1000)) {
|
||||
if (0 != SDL_ReadRW(rwops, test_buf, 1000)) {
|
||||
RWOP_ERR_QUIT(rwops);
|
||||
}
|
||||
if (0 != SDL_RWseek(rwops, -27, SDL_RW_SEEK_CUR)) {
|
||||
if (0 != SDL_SeekRW(rwops, -27, SDL_RW_SEEK_CUR)) {
|
||||
RWOP_ERR_QUIT(rwops);
|
||||
}
|
||||
if (27 != SDL_RWread(rwops, test_buf, 30)) {
|
||||
if (27 != SDL_ReadRW(rwops, test_buf, 30)) {
|
||||
RWOP_ERR_QUIT(rwops);
|
||||
}
|
||||
if (SDL_memcmp(test_buf, "12345678901234567890", 20) != 0) {
|
||||
@@ -317,50 +317,50 @@ int main(int argc, char *argv[])
|
||||
if (!rwops) {
|
||||
RWOP_ERR_QUIT(rwops);
|
||||
}
|
||||
if (10 != SDL_RWwrite(rwops, "1234567890", 10)) {
|
||||
if (10 != SDL_WriteRW(rwops, "1234567890", 10)) {
|
||||
RWOP_ERR_QUIT(rwops);
|
||||
}
|
||||
if (10 != SDL_RWwrite(rwops, "1234567890", 10)) {
|
||||
if (10 != SDL_WriteRW(rwops, "1234567890", 10)) {
|
||||
RWOP_ERR_QUIT(rwops);
|
||||
}
|
||||
if (7 != SDL_RWwrite(rwops, "1234567", 7)) {
|
||||
if (7 != SDL_WriteRW(rwops, "1234567", 7)) {
|
||||
RWOP_ERR_QUIT(rwops);
|
||||
}
|
||||
if (0 != SDL_RWseek(rwops, 0L, SDL_RW_SEEK_SET)) {
|
||||
if (0 != SDL_SeekRW(rwops, 0L, SDL_RW_SEEK_SET)) {
|
||||
RWOP_ERR_QUIT(rwops);
|
||||
}
|
||||
|
||||
if (1 != SDL_RWread(rwops, test_buf, 1)) {
|
||||
if (1 != SDL_ReadRW(rwops, test_buf, 1)) {
|
||||
RWOP_ERR_QUIT(rwops);
|
||||
}
|
||||
if (0 != SDL_RWseek(rwops, 0L, SDL_RW_SEEK_SET)) {
|
||||
if (0 != SDL_SeekRW(rwops, 0L, SDL_RW_SEEK_SET)) {
|
||||
RWOP_ERR_QUIT(rwops);
|
||||
}
|
||||
|
||||
if (20 + 27 != SDL_RWseek(rwops, -7, SDL_RW_SEEK_END)) {
|
||||
if (20 + 27 != SDL_SeekRW(rwops, -7, SDL_RW_SEEK_END)) {
|
||||
RWOP_ERR_QUIT(rwops);
|
||||
}
|
||||
if (7 != SDL_RWread(rwops, test_buf, 7)) {
|
||||
if (7 != SDL_ReadRW(rwops, test_buf, 7)) {
|
||||
RWOP_ERR_QUIT(rwops);
|
||||
}
|
||||
if (SDL_memcmp(test_buf, "1234567", 7) != 0) {
|
||||
RWOP_ERR_QUIT(rwops);
|
||||
}
|
||||
if (0 != SDL_RWread(rwops, test_buf, 1)) {
|
||||
if (0 != SDL_ReadRW(rwops, test_buf, 1)) {
|
||||
RWOP_ERR_QUIT(rwops);
|
||||
}
|
||||
if (0 != SDL_RWread(rwops, test_buf, 1000)) {
|
||||
if (0 != SDL_ReadRW(rwops, test_buf, 1000)) {
|
||||
RWOP_ERR_QUIT(rwops);
|
||||
}
|
||||
|
||||
if (27 != SDL_RWseek(rwops, -27, SDL_RW_SEEK_CUR)) {
|
||||
if (27 != SDL_SeekRW(rwops, -27, SDL_RW_SEEK_CUR)) {
|
||||
RWOP_ERR_QUIT(rwops);
|
||||
}
|
||||
|
||||
if (0 != SDL_RWseek(rwops, 0L, SDL_RW_SEEK_SET)) {
|
||||
if (0 != SDL_SeekRW(rwops, 0L, SDL_RW_SEEK_SET)) {
|
||||
RWOP_ERR_QUIT(rwops);
|
||||
}
|
||||
if (30 != SDL_RWread(rwops, test_buf, 30)) {
|
||||
if (30 != SDL_ReadRW(rwops, test_buf, 30)) {
|
||||
RWOP_ERR_QUIT(rwops);
|
||||
}
|
||||
if (SDL_memcmp(test_buf, "123456789012345678901234567123", 30) != 0) {
|
||||
|
||||
@@ -149,7 +149,7 @@ static int unifont_init(const char *fontname)
|
||||
Uint8 glyphWidth;
|
||||
Uint32 codepoint;
|
||||
|
||||
bytesRead = SDL_RWread(hexFile, hexBuffer, 9);
|
||||
bytesRead = SDL_ReadRW(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_RWread(hexFile, hexBuffer + bytesOverread, 33 - bytesOverread);
|
||||
bytesRead = SDL_ReadRW(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_RWread(hexFile, hexBuffer + 33, 32);
|
||||
bytesRead = SDL_ReadRW(hexFile, hexBuffer + 33, 32);
|
||||
if (bytesRead < 32) {
|
||||
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "unifont: Unexpected end of hex file.\n");
|
||||
return -1;
|
||||
|
||||
@@ -450,7 +450,7 @@ int main(int argc, char **argv)
|
||||
quit(2);
|
||||
}
|
||||
|
||||
SDL_RWread(handle, RawMooseData, MOOSEFRAME_SIZE * MOOSEFRAMES_COUNT);
|
||||
SDL_ReadRW(handle, RawMooseData, MOOSEFRAME_SIZE * MOOSEFRAMES_COUNT);
|
||||
|
||||
SDL_CloseRW(handle);
|
||||
|
||||
|
||||
@@ -139,7 +139,7 @@ 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_RWwrite(io, dst_buf, dst_len);
|
||||
SDL_WriteRW(io, dst_buf, dst_len);
|
||||
|
||||
if (SDL_CloseRW(io) == -1) {
|
||||
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "closing '%s' failed: %s\n", file_out, SDL_GetError());
|
||||
|
||||
@@ -170,7 +170,7 @@ int main(int argc, char **argv)
|
||||
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Can't find the file moose.dat !\n");
|
||||
quit(2);
|
||||
}
|
||||
SDL_RWread(handle, MooseFrames, MOOSEFRAME_SIZE * MOOSEFRAMES_COUNT);
|
||||
SDL_ReadRW(handle, MooseFrames, MOOSEFRAME_SIZE * MOOSEFRAMES_COUNT);
|
||||
SDL_CloseRW(handle);
|
||||
|
||||
/* Create the window and renderer */
|
||||
|
||||
Reference in New Issue
Block a user