mirror of
https://github.com/libsdl-org/SDL.git
synced 2026-07-25 18:11:52 +00:00
introduce new printf format macros SDL_PRISZu, SDL_PRISZx and SDL_PRISZX
This commit is contained in:
@@ -934,16 +934,6 @@ static int SDLCALL stdlib_sscanf(void *arg)
|
||||
#pragma GCC diagnostic pop
|
||||
#endif
|
||||
|
||||
#if defined(SDL_PLATFORM_CYGWIN)
|
||||
#define SIZE_FORMAT "zu"
|
||||
#elif defined(_WIN64)
|
||||
#define SIZE_FORMAT "I64u"
|
||||
#elif defined(SDL_PLATFORM_WIN32)
|
||||
#define SIZE_FORMAT "I32u"
|
||||
#else
|
||||
#define SIZE_FORMAT "zu"
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Call to SDL_aligned_alloc
|
||||
*/
|
||||
@@ -953,7 +943,7 @@ static int SDLCALL stdlib_aligned_alloc(void *arg)
|
||||
void *ptr;
|
||||
|
||||
for (i = 0; i < 2*sizeof(void *); ++i) {
|
||||
SDLTest_AssertPass("Call to SDL_aligned_alloc(%"SIZE_FORMAT")", i);
|
||||
SDLTest_AssertPass("Call to SDL_aligned_alloc(%" SDL_PRISZu ")", i);
|
||||
ptr = SDL_aligned_alloc(i, 1);
|
||||
if (i < sizeof(void *)) {
|
||||
alignment = sizeof(void *);
|
||||
@@ -961,7 +951,7 @@ static int SDLCALL stdlib_aligned_alloc(void *arg)
|
||||
alignment = i;
|
||||
}
|
||||
SDLTest_AssertCheck(ptr != NULL, "Check output, expected non-NULL, got: %p", ptr);
|
||||
SDLTest_AssertCheck((((size_t)ptr) % alignment) == 0, "Check output, expected aligned pointer, actual offset: %"SIZE_FORMAT, (((size_t)ptr) % alignment));
|
||||
SDLTest_AssertCheck((((size_t)ptr) % alignment) == 0, "Check output, expected aligned pointer, actual offset: %" SDL_PRISZu, (((size_t)ptr) % alignment));
|
||||
if (ptr != NULL) {
|
||||
SDLTest_AssertPass("Filling memory to alignment value");
|
||||
SDL_memset(ptr, 0xAA, alignment);
|
||||
@@ -1033,14 +1023,14 @@ stdlib_overflow(void *arg)
|
||||
|
||||
if (t->status) {
|
||||
SDLTest_AssertCheck(status,
|
||||
"(%" SIZE_FORMAT " * %" SIZE_FORMAT ") should succeed",
|
||||
"(%" SDL_PRISZu " * %" SDL_PRISZu ") should succeed",
|
||||
t->a, t->b);
|
||||
SDLTest_AssertCheck(result == t->result,
|
||||
"(%" SIZE_FORMAT " * %" SIZE_FORMAT "): expected %" SIZE_FORMAT ", got %" SIZE_FORMAT,
|
||||
"(%" SDL_PRISZu " * %" SDL_PRISZu "): expected %" SDL_PRISZu ", got %" SDL_PRISZu,
|
||||
t->a, t->b, t->result, result);
|
||||
} else {
|
||||
SDLTest_AssertCheck(!status,
|
||||
"(%" SIZE_FORMAT " * %" SIZE_FORMAT ") should fail",
|
||||
"(%" SDL_PRISZu " * %" SDL_PRISZu ") should fail",
|
||||
t->a, t->b);
|
||||
}
|
||||
|
||||
@@ -1058,14 +1048,14 @@ stdlib_overflow(void *arg)
|
||||
|
||||
if (t->status) {
|
||||
SDLTest_AssertCheck(status,
|
||||
"(%" SIZE_FORMAT " * %" SIZE_FORMAT ") should succeed",
|
||||
"(%" SDL_PRISZu " * %" SDL_PRISZu ") should succeed",
|
||||
t->b, t->a);
|
||||
SDLTest_AssertCheck(result == t->result,
|
||||
"(%" SIZE_FORMAT " * %" SIZE_FORMAT "): expected %" SIZE_FORMAT ", got %" SIZE_FORMAT,
|
||||
"(%" SDL_PRISZu " * %" SDL_PRISZu "): expected %" SDL_PRISZu ", got %" SDL_PRISZu,
|
||||
t->b, t->a, t->result, result);
|
||||
} else {
|
||||
SDLTest_AssertCheck(!status,
|
||||
"(%" SIZE_FORMAT " * %" SIZE_FORMAT ") should fail",
|
||||
"(%" SDL_PRISZu " * %" SDL_PRISZu ") should fail",
|
||||
t->b, t->a);
|
||||
}
|
||||
}
|
||||
@@ -1083,14 +1073,14 @@ stdlib_overflow(void *arg)
|
||||
|
||||
if (t->status) {
|
||||
SDLTest_AssertCheck(status,
|
||||
"(%" SIZE_FORMAT " + %" SIZE_FORMAT ") should succeed",
|
||||
"(%" SDL_PRISZu " + %" SDL_PRISZu ") should succeed",
|
||||
t->a, t->b);
|
||||
SDLTest_AssertCheck(result == t->result,
|
||||
"(%" SIZE_FORMAT " + %" SIZE_FORMAT "): expected %" SIZE_FORMAT ", got %" SIZE_FORMAT,
|
||||
"(%" SDL_PRISZu " + %" SDL_PRISZu "): expected %" SDL_PRISZu ", got %" SDL_PRISZu,
|
||||
t->a, t->b, t->result, result);
|
||||
} else {
|
||||
SDLTest_AssertCheck(!status,
|
||||
"(%" SIZE_FORMAT " + %" SIZE_FORMAT ") should fail",
|
||||
"(%" SDL_PRISZu " + %" SDL_PRISZu ") should fail",
|
||||
t->a, t->b);
|
||||
}
|
||||
|
||||
@@ -1108,14 +1098,14 @@ stdlib_overflow(void *arg)
|
||||
|
||||
if (t->status) {
|
||||
SDLTest_AssertCheck(status,
|
||||
"(%" SIZE_FORMAT " + %" SIZE_FORMAT ") should succeed",
|
||||
"(%" SDL_PRISZu " + %" SDL_PRISZu ") should succeed",
|
||||
t->b, t->a);
|
||||
SDLTest_AssertCheck(result == t->result,
|
||||
"(%" SIZE_FORMAT " + %" SIZE_FORMAT "): expected %" SIZE_FORMAT ", got %" SIZE_FORMAT,
|
||||
"(%" SDL_PRISZu " + %" SDL_PRISZu "): expected %" SDL_PRISZu ", got %" SDL_PRISZu,
|
||||
t->b, t->a, t->result, result);
|
||||
} else {
|
||||
SDLTest_AssertCheck(!status,
|
||||
"(%" SIZE_FORMAT " + %" SIZE_FORMAT ") should fail",
|
||||
"(%" SDL_PRISZu " + %" SDL_PRISZu ") should fail",
|
||||
t->b, t->a);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user