N3DS: Fix `-Wformat` warnings in tests.

All warnings were about invalid specifiers. Since U/Sint32 is a long,
using `%d` emits a -Wformat warning.
This commit is contained in:
Pierre Wendling 2022-10-10 01:31:14 -04:00 committed by Sam Lantinga
parent 43a2b0b1e5
commit 6784d84c9d
26 changed files with 162 additions and 161 deletions

View File

@ -162,7 +162,8 @@ loop()
fprintf(stderr, "starting loop\n"); fflush(stderr); fprintf(stderr, "starting loop\n"); fflush(stderr);
// while (SDL_PollEvent(&event)) { // while (SDL_PollEvent(&event)) {
while (!done && SDL_WaitEvent(&event)) { while (!done && SDL_WaitEvent(&event)) {
fprintf(stderr, "got event type: %d\n", event.type); fflush(stderr); fprintf(stderr, "got event type: %" SDL_PRIu32 "\n", event.type);
fflush(stderr);
switch (event.type) { switch (event.type) {
case SDL_KEYDOWN: case SDL_KEYDOWN:
case SDL_KEYUP: case SDL_KEYUP:

View File

@ -373,8 +373,8 @@ WatchJoystick(SDL_Joystick * joystick)
/* Print info about the joystick we are watching */ /* Print info about the joystick we are watching */
name = SDL_JoystickName(joystick); name = SDL_JoystickName(joystick);
SDL_Log("Watching joystick %d: (%s)\n", SDL_JoystickInstanceID(joystick), SDL_Log("Watching joystick %" SDL_PRIs32 ": (%s)\n", SDL_JoystickInstanceID(joystick),
name ? name : "Unknown Joystick"); name ? name : "Unknown Joystick");
SDL_Log("Joystick has %d axes, %d hats, %d balls, and %d buttons\n", SDL_Log("Joystick has %d axes, %d hats, %d balls, and %d buttons\n",
SDL_JoystickNumAxes(joystick), SDL_JoystickNumHats(joystick), SDL_JoystickNumAxes(joystick), SDL_JoystickNumHats(joystick),
SDL_JoystickNumBalls(joystick), SDL_JoystickNumButtons(joystick)); SDL_JoystickNumBalls(joystick), SDL_JoystickNumButtons(joystick));
@ -781,7 +781,7 @@ main(int argc, char *argv[])
SDL_Log(" balls: %d\n", SDL_JoystickNumBalls(joystick)); SDL_Log(" balls: %d\n", SDL_JoystickNumBalls(joystick));
SDL_Log(" hats: %d\n", SDL_JoystickNumHats(joystick)); SDL_Log(" hats: %d\n", SDL_JoystickNumHats(joystick));
SDL_Log(" buttons: %d\n", SDL_JoystickNumButtons(joystick)); SDL_Log(" buttons: %d\n", SDL_JoystickNumButtons(joystick));
SDL_Log("instance id: %d\n", SDL_JoystickInstanceID(joystick)); SDL_Log("instance id: %" SDL_PRIu32 "\n", SDL_JoystickInstanceID(joystick));
SDL_Log(" guid: %s\n", guid); SDL_Log(" guid: %s\n", guid);
SDL_Log(" VID/PID: 0x%.4x/0x%.4x\n", SDL_JoystickGetVendor(joystick), SDL_JoystickGetProduct(joystick)); SDL_Log(" VID/PID: 0x%.4x/0x%.4x\n", SDL_JoystickGetVendor(joystick), SDL_JoystickGetProduct(joystick));
SDL_JoystickClose(joystick); SDL_JoystickClose(joystick);

View File

@ -725,7 +725,7 @@ int audio_openCloseAndGetAudioStatus()
/* Open device */ /* Open device */
id = SDL_OpenAudioDevice(device, 0, &desired, &obtained, SDL_AUDIO_ALLOW_ANY_CHANGE); id = SDL_OpenAudioDevice(device, 0, &desired, &obtained, SDL_AUDIO_ALLOW_ANY_CHANGE);
SDLTest_AssertPass("SDL_OpenAudioDevice('%s',...)", device); SDLTest_AssertPass("SDL_OpenAudioDevice('%s',...)", device);
SDLTest_AssertCheck(id > 1, "Validate device ID; expected: >=2, got: %i", id); SDLTest_AssertCheck(id > 1, "Validate device ID; expected: >=2, got: %" SDL_PRIu32, id);
if (id > 1) { if (id > 1) {
/* Check device audio status */ /* Check device audio status */
@ -783,11 +783,11 @@ int audio_lockUnlockOpenAudioDevice()
/* Open device */ /* Open device */
id = SDL_OpenAudioDevice(device, 0, &desired, &obtained, SDL_AUDIO_ALLOW_ANY_CHANGE); id = SDL_OpenAudioDevice(device, 0, &desired, &obtained, SDL_AUDIO_ALLOW_ANY_CHANGE);
SDLTest_AssertPass("SDL_OpenAudioDevice('%s',...)", device); SDLTest_AssertPass("SDL_OpenAudioDevice('%s',...)", device);
SDLTest_AssertCheck(id > 1, "Validate device ID; expected: >=2, got: %i", id); SDLTest_AssertCheck(id > 1, "Validate device ID; expected: >=2, got: %" SDL_PRIu32, id);
if (id > 1) { if (id > 1) {
/* Lock to protect callback */ /* Lock to protect callback */
SDL_LockAudioDevice(id); SDL_LockAudioDevice(id);
SDLTest_AssertPass("SDL_LockAudioDevice(%i)", id); SDLTest_AssertPass("SDL_LockAudioDevice(%" SDL_PRIu32 ")", id);
/* Simulate callback processing */ /* Simulate callback processing */
SDL_Delay(10); SDL_Delay(10);
@ -795,7 +795,7 @@ int audio_lockUnlockOpenAudioDevice()
/* Unlock again */ /* Unlock again */
SDL_UnlockAudioDevice(id); SDL_UnlockAudioDevice(id);
SDLTest_AssertPass("SDL_UnlockAudioDevice(%i)", id); SDLTest_AssertPass("SDL_UnlockAudioDevice(%" SDL_PRIu32 ")", id);
/* Close device again */ /* Close device again */
SDL_CloseAudioDevice(id); SDL_CloseAudioDevice(id);
@ -945,7 +945,7 @@ int audio_openCloseAudioDeviceConnected()
/* Open device */ /* Open device */
id = SDL_OpenAudioDevice(device, 0, &desired, &obtained, SDL_AUDIO_ALLOW_ANY_CHANGE); id = SDL_OpenAudioDevice(device, 0, &desired, &obtained, SDL_AUDIO_ALLOW_ANY_CHANGE);
SDLTest_AssertPass("SDL_OpenAudioDevice('%s',...)", device); SDLTest_AssertPass("SDL_OpenAudioDevice('%s',...)", device);
SDLTest_AssertCheck(id > 1, "Validate device ID; expected: >1, got: %i", id); SDLTest_AssertCheck(id > 1, "Validate device ID; expected: >1, got: %" SDL_PRIu32, id);
if (id > 1) { if (id > 1) {
/* TODO: enable test code when function is available in SDL2 */ /* TODO: enable test code when function is available in SDL2 */

View File

@ -108,7 +108,7 @@ TestGuidToString(void *arg)
/* Check bytes before guid_str_buf */ /* Check bytes before guid_str_buf */
expected_prefix = fill_char | (fill_char << 8) | (fill_char << 16) | (fill_char << 24); expected_prefix = fill_char | (fill_char << 8) | (fill_char << 16) | (fill_char << 24);
SDL_memcpy(&actual_prefix, guid_str_buf, 4); SDL_memcpy(&actual_prefix, guid_str_buf, 4);
SDLTest_AssertCheck(expected_prefix == actual_prefix, "String buffer memory before output untouched, expected: %i, got: %i, at size=%d", expected_prefix, actual_prefix, size); SDLTest_AssertCheck(expected_prefix == actual_prefix, "String buffer memory before output untouched, expected: %" SDL_PRIu32 ", got: %" SDL_PRIu32 ", at size=%d", expected_prefix, actual_prefix, size);
/* Check that we did not overwrite too much */ /* Check that we did not overwrite too much */
written_size = 0; written_size = 0;

View File

@ -67,37 +67,37 @@ keyboard_getKeyFromName(void *arg)
/* Case where Key is known, 1 character input */ /* Case where Key is known, 1 character input */
result = SDL_GetKeyFromName("A"); result = SDL_GetKeyFromName("A");
SDLTest_AssertPass("Call to SDL_GetKeyFromName(known/single)"); SDLTest_AssertPass("Call to SDL_GetKeyFromName(known/single)");
SDLTest_AssertCheck(result == SDLK_a, "Verify result from call, expected: %i, got: %i", SDLK_a, result); SDLTest_AssertCheck(result == SDLK_a, "Verify result from call, expected: %i, got: %" SDL_PRIs32, SDLK_a, result);
/* Case where Key is known, 2 character input */ /* Case where Key is known, 2 character input */
result = SDL_GetKeyFromName("F1"); result = SDL_GetKeyFromName("F1");
SDLTest_AssertPass("Call to SDL_GetKeyFromName(known/double)"); SDLTest_AssertPass("Call to SDL_GetKeyFromName(known/double)");
SDLTest_AssertCheck(result == SDLK_F1, "Verify result from call, expected: %i, got: %i", SDLK_F1, result); SDLTest_AssertCheck(result == SDLK_F1, "Verify result from call, expected: %i, got: %" SDL_PRIs32, SDLK_F1, result);
/* Case where Key is known, 3 character input */ /* Case where Key is known, 3 character input */
result = SDL_GetKeyFromName("End"); result = SDL_GetKeyFromName("End");
SDLTest_AssertPass("Call to SDL_GetKeyFromName(known/triple)"); SDLTest_AssertPass("Call to SDL_GetKeyFromName(known/triple)");
SDLTest_AssertCheck(result == SDLK_END, "Verify result from call, expected: %i, got: %i", SDLK_END, result); SDLTest_AssertCheck(result == SDLK_END, "Verify result from call, expected: %i, got: %" SDL_PRIs32, SDLK_END, result);
/* Case where Key is known, 4 character input */ /* Case where Key is known, 4 character input */
result = SDL_GetKeyFromName("Find"); result = SDL_GetKeyFromName("Find");
SDLTest_AssertPass("Call to SDL_GetKeyFromName(known/quad)"); SDLTest_AssertPass("Call to SDL_GetKeyFromName(known/quad)");
SDLTest_AssertCheck(result == SDLK_FIND, "Verify result from call, expected: %i, got: %i", SDLK_FIND, result); SDLTest_AssertCheck(result == SDLK_FIND, "Verify result from call, expected: %i, got: %" SDL_PRIs32, SDLK_FIND, result);
/* Case where Key is known, multiple character input */ /* Case where Key is known, multiple character input */
result = SDL_GetKeyFromName("AudioStop"); result = SDL_GetKeyFromName("AudioStop");
SDLTest_AssertPass("Call to SDL_GetKeyFromName(known/multi)"); SDLTest_AssertPass("Call to SDL_GetKeyFromName(known/multi)");
SDLTest_AssertCheck(result == SDLK_AUDIOSTOP, "Verify result from call, expected: %i, got: %i", SDLK_AUDIOSTOP, result); SDLTest_AssertCheck(result == SDLK_AUDIOSTOP, "Verify result from call, expected: %i, got: %" SDL_PRIs32, SDLK_AUDIOSTOP, result);
/* Case where Key is unknown */ /* Case where Key is unknown */
result = SDL_GetKeyFromName("NotThere"); result = SDL_GetKeyFromName("NotThere");
SDLTest_AssertPass("Call to SDL_GetKeyFromName(unknown)"); SDLTest_AssertPass("Call to SDL_GetKeyFromName(unknown)");
SDLTest_AssertCheck(result == SDLK_UNKNOWN, "Verify result from call is UNKNOWN, expected: %i, got: %i", SDLK_UNKNOWN, result); SDLTest_AssertCheck(result == SDLK_UNKNOWN, "Verify result from call is UNKNOWN, expected: %i, got: %" SDL_PRIs32, SDLK_UNKNOWN, result);
/* Case where input is NULL/invalid */ /* Case where input is NULL/invalid */
result = SDL_GetKeyFromName(NULL); result = SDL_GetKeyFromName(NULL);
SDLTest_AssertPass("Call to SDL_GetKeyFromName(NULL)"); SDLTest_AssertPass("Call to SDL_GetKeyFromName(NULL)");
SDLTest_AssertCheck(result == SDLK_UNKNOWN, "Verify result from call is UNKNOWN, expected: %i, got: %i", SDLK_UNKNOWN, result); SDLTest_AssertCheck(result == SDLK_UNKNOWN, "Verify result from call is UNKNOWN, expected: %i, got: %" SDL_PRIs32, SDLK_UNKNOWN, result);
return TEST_COMPLETED; return TEST_COMPLETED;
} }
@ -134,12 +134,12 @@ keyboard_getKeyFromScancode(void *arg)
/* Case where input is valid */ /* Case where input is valid */
result = SDL_GetKeyFromScancode(SDL_SCANCODE_A); result = SDL_GetKeyFromScancode(SDL_SCANCODE_A);
SDLTest_AssertPass("Call to SDL_GetKeyFromScancode(valid)"); SDLTest_AssertPass("Call to SDL_GetKeyFromScancode(valid)");
SDLTest_AssertCheck(result == SDLK_a, "Verify result from call, expected: %i, got: %i", SDLK_a, result); SDLTest_AssertCheck(result == SDLK_a, "Verify result from call, expected: %i, got: %" SDL_PRIs32, SDLK_a, result);
/* Case where input is zero */ /* Case where input is zero */
result = SDL_GetKeyFromScancode(0); result = SDL_GetKeyFromScancode(0);
SDLTest_AssertPass("Call to SDL_GetKeyFromScancode(0)"); SDLTest_AssertPass("Call to SDL_GetKeyFromScancode(0)");
SDLTest_AssertCheck(result == SDLK_UNKNOWN, "Verify result from call is UNKNOWN, expected: %i, got: %i", SDLK_UNKNOWN, result); SDLTest_AssertCheck(result == SDLK_UNKNOWN, "Verify result from call is UNKNOWN, expected: %i, got: %" SDL_PRIs32, SDLK_UNKNOWN, result);
/* Clear error message */ /* Clear error message */
SDL_ClearError(); SDL_ClearError();
@ -148,13 +148,13 @@ keyboard_getKeyFromScancode(void *arg)
/* Case where input is invalid (too small) */ /* Case where input is invalid (too small) */
result = SDL_GetKeyFromScancode(-999); result = SDL_GetKeyFromScancode(-999);
SDLTest_AssertPass("Call to SDL_GetKeyFromScancode(-999)"); SDLTest_AssertPass("Call to SDL_GetKeyFromScancode(-999)");
SDLTest_AssertCheck(result == SDLK_UNKNOWN, "Verify result from call is UNKNOWN, expected: %i, got: %i", SDLK_UNKNOWN, result); SDLTest_AssertCheck(result == SDLK_UNKNOWN, "Verify result from call is UNKNOWN, expected: %i, got: %" SDL_PRIs32, SDLK_UNKNOWN, result);
_checkInvalidScancodeError(); _checkInvalidScancodeError();
/* Case where input is invalid (too big) */ /* Case where input is invalid (too big) */
result = SDL_GetKeyFromScancode(999); result = SDL_GetKeyFromScancode(999);
SDLTest_AssertPass("Call to SDL_GetKeyFromScancode(999)"); SDLTest_AssertPass("Call to SDL_GetKeyFromScancode(999)");
SDLTest_AssertCheck(result == SDLK_UNKNOWN, "Verify result from call is UNKNOWN, expected: %i, got: %i", SDLK_UNKNOWN, result); SDLTest_AssertCheck(result == SDLK_UNKNOWN, "Verify result from call is UNKNOWN, expected: %i, got: %" SDL_PRIs32, SDLK_UNKNOWN, result);
_checkInvalidScancodeError(); _checkInvalidScancodeError();
return TEST_COMPLETED; return TEST_COMPLETED;
@ -258,7 +258,7 @@ keyboard_getKeyNameNegative(void *arg)
/* Unknown keycode */ /* Unknown keycode */
keycode = SDLK_UNKNOWN; keycode = SDLK_UNKNOWN;
result = (char *)SDL_GetKeyName(keycode); result = (char *)SDL_GetKeyName(keycode);
SDLTest_AssertPass("Call to SDL_GetKeyName(%d/unknown)", keycode); SDLTest_AssertPass("Call to SDL_GetKeyName(%" SDL_PRIs32 "/unknown)", keycode);
SDLTest_AssertCheck(result != NULL, "Verify result from call is not NULL"); SDLTest_AssertCheck(result != NULL, "Verify result from call is not NULL");
SDLTest_AssertCheck(SDL_strcmp(result, expected) == 0, "Verify result from call is valid, expected: '%s', got: '%s'", expected, result); SDLTest_AssertCheck(SDL_strcmp(result, expected) == 0, "Verify result from call is valid, expected: '%s', got: '%s'", expected, result);
@ -269,7 +269,7 @@ keyboard_getKeyNameNegative(void *arg)
/* Negative keycode */ /* Negative keycode */
keycode = (SDL_Keycode)SDLTest_RandomIntegerInRange(-255, -1); keycode = (SDL_Keycode)SDLTest_RandomIntegerInRange(-255, -1);
result = (char *)SDL_GetKeyName(keycode); result = (char *)SDL_GetKeyName(keycode);
SDLTest_AssertPass("Call to SDL_GetKeyName(%d/negative)", keycode); SDLTest_AssertPass("Call to SDL_GetKeyName(%" SDL_PRIs32 "/negative)", keycode);
SDLTest_AssertCheck(result != NULL, "Verify result from call is not NULL"); SDLTest_AssertCheck(result != NULL, "Verify result from call is not NULL");
SDLTest_AssertCheck(SDL_strcmp(result, expected) == 0, "Verify result from call is valid, expected: '%s', got: '%s'", expected, result); SDLTest_AssertCheck(SDL_strcmp(result, expected) == 0, "Verify result from call is valid, expected: '%s', got: '%s'", expected, result);
_checkInvalidScancodeError(); _checkInvalidScancodeError();

View File

@ -183,7 +183,7 @@ helper_range(const char *func_name, d_to_d_func func)
Uint32 i; Uint32 i;
double test_value = 0.0; double test_value = 0.0;
SDLTest_AssertPass("%s: Testing a range of %u values with steps of %u", SDLTest_AssertPass("%s: Testing a range of %u values with steps of %" SDL_PRIu32,
func_name, func_name,
RANGE_TEST_ITERATIONS, RANGE_TEST_ITERATIONS,
RANGE_TEST_STEP); RANGE_TEST_STEP);
@ -770,7 +770,7 @@ copysign_rangeTest(void *args)
Uint32 i; Uint32 i;
double test_value = 0.0; double test_value = 0.0;
SDLTest_AssertPass("Copysign: Testing a range of %u values with steps of %u", SDLTest_AssertPass("Copysign: Testing a range of %u values with steps of %" SDL_PRIu32,
RANGE_TEST_ITERATIONS, RANGE_TEST_ITERATIONS,
RANGE_TEST_STEP); RANGE_TEST_STEP);
@ -973,7 +973,7 @@ fmod_rangeTest(void *args)
Uint32 i; Uint32 i;
double test_value = 0.0; double test_value = 0.0;
SDLTest_AssertPass("Fmod: Testing a range of %u values with steps of %u", SDLTest_AssertPass("Fmod: Testing a range of %u values with steps of %" SDL_PRIu32,
RANGE_TEST_ITERATIONS, RANGE_TEST_ITERATIONS,
RANGE_TEST_STEP); RANGE_TEST_STEP);
@ -1684,7 +1684,7 @@ pow_rangeTest(void *args)
Uint32 i; Uint32 i;
double test_value = 0.0; double test_value = 0.0;
SDLTest_AssertPass("Pow: Testing a range of %u values with steps of %u", SDLTest_AssertPass("Pow: Testing a range of %u values with steps of %" SDL_PRIu32,
RANGE_TEST_ITERATIONS, RANGE_TEST_ITERATIONS,
RANGE_TEST_STEP); RANGE_TEST_STEP);
@ -2011,7 +2011,7 @@ cos_rangeTest(void *args)
Uint32 i; Uint32 i;
double test_value = 0.0; double test_value = 0.0;
SDLTest_AssertPass("Cos: Testing a range of %u values with steps of %u", SDLTest_AssertPass("Cos: Testing a range of %u values with steps of %" SDL_PRIu32,
RANGE_TEST_ITERATIONS, RANGE_TEST_ITERATIONS,
RANGE_TEST_STEP); RANGE_TEST_STEP);
@ -2129,7 +2129,7 @@ sin_rangeTest(void *args)
Uint32 i; Uint32 i;
double test_value = 0.0; double test_value = 0.0;
SDLTest_AssertPass("Sin: Testing a range of %u values with steps of %u", SDLTest_AssertPass("Sin: Testing a range of %u values with steps of %" SDL_PRIu32,
RANGE_TEST_ITERATIONS, RANGE_TEST_ITERATIONS,
RANGE_TEST_STEP); RANGE_TEST_STEP);

View File

@ -41,21 +41,21 @@ mouse_getMouseState(void *arg)
/* Case where x, y pointer is NULL */ /* Case where x, y pointer is NULL */
state = SDL_GetMouseState(NULL, NULL); state = SDL_GetMouseState(NULL, NULL);
SDLTest_AssertPass("Call to SDL_GetMouseState(NULL, NULL)"); SDLTest_AssertPass("Call to SDL_GetMouseState(NULL, NULL)");
SDLTest_AssertCheck(_mouseStateCheck(state), "Validate state returned from function, got: %u", state); SDLTest_AssertCheck(_mouseStateCheck(state), "Validate state returned from function, got: %" SDL_PRIu32, state);
/* Case where x pointer is not NULL */ /* Case where x pointer is not NULL */
x = INT_MIN; x = INT_MIN;
state = SDL_GetMouseState(&x, NULL); state = SDL_GetMouseState(&x, NULL);
SDLTest_AssertPass("Call to SDL_GetMouseState(&x, NULL)"); SDLTest_AssertPass("Call to SDL_GetMouseState(&x, NULL)");
SDLTest_AssertCheck(x > INT_MIN, "Validate that value of x is > INT_MIN, got: %i", x); SDLTest_AssertCheck(x > INT_MIN, "Validate that value of x is > INT_MIN, got: %i", x);
SDLTest_AssertCheck(_mouseStateCheck(state), "Validate state returned from function, got: %u", state); SDLTest_AssertCheck(_mouseStateCheck(state), "Validate state returned from function, got: %" SDL_PRIu32, state);
/* Case where y pointer is not NULL */ /* Case where y pointer is not NULL */
y = INT_MIN; y = INT_MIN;
state = SDL_GetMouseState(NULL, &y); state = SDL_GetMouseState(NULL, &y);
SDLTest_AssertPass("Call to SDL_GetMouseState(NULL, &y)"); SDLTest_AssertPass("Call to SDL_GetMouseState(NULL, &y)");
SDLTest_AssertCheck(y > INT_MIN, "Validate that value of y is > INT_MIN, got: %i", y); SDLTest_AssertCheck(y > INT_MIN, "Validate that value of y is > INT_MIN, got: %i", y);
SDLTest_AssertCheck(_mouseStateCheck(state), "Validate state returned from function, got: %u", state); SDLTest_AssertCheck(_mouseStateCheck(state), "Validate state returned from function, got: %" SDL_PRIu32, state);
/* Case where x and y pointer is not NULL */ /* Case where x and y pointer is not NULL */
x = INT_MIN; x = INT_MIN;
@ -64,7 +64,7 @@ mouse_getMouseState(void *arg)
SDLTest_AssertPass("Call to SDL_GetMouseState(&x, &y)"); SDLTest_AssertPass("Call to SDL_GetMouseState(&x, &y)");
SDLTest_AssertCheck(x > INT_MIN, "Validate that value of x is > INT_MIN, got: %i", x); SDLTest_AssertCheck(x > INT_MIN, "Validate that value of x is > INT_MIN, got: %i", x);
SDLTest_AssertCheck(y > INT_MIN, "Validate that value of y is > INT_MIN, got: %i", y); SDLTest_AssertCheck(y > INT_MIN, "Validate that value of y is > INT_MIN, got: %i", y);
SDLTest_AssertCheck(_mouseStateCheck(state), "Validate state returned from function, got: %u", state); SDLTest_AssertCheck(_mouseStateCheck(state), "Validate state returned from function, got: %" SDL_PRIu32, state);
return TEST_COMPLETED; return TEST_COMPLETED;
} }
@ -87,21 +87,21 @@ mouse_getRelativeMouseState(void *arg)
/* Case where x, y pointer is NULL */ /* Case where x, y pointer is NULL */
state = SDL_GetRelativeMouseState(NULL, NULL); state = SDL_GetRelativeMouseState(NULL, NULL);
SDLTest_AssertPass("Call to SDL_GetRelativeMouseState(NULL, NULL)"); SDLTest_AssertPass("Call to SDL_GetRelativeMouseState(NULL, NULL)");
SDLTest_AssertCheck(_mouseStateCheck(state), "Validate state returned from function, got: %u", state); SDLTest_AssertCheck(_mouseStateCheck(state), "Validate state returned from function, got: %" SDL_PRIu32, state);
/* Case where x pointer is not NULL */ /* Case where x pointer is not NULL */
x = INT_MIN; x = INT_MIN;
state = SDL_GetRelativeMouseState(&x, NULL); state = SDL_GetRelativeMouseState(&x, NULL);
SDLTest_AssertPass("Call to SDL_GetRelativeMouseState(&x, NULL)"); SDLTest_AssertPass("Call to SDL_GetRelativeMouseState(&x, NULL)");
SDLTest_AssertCheck(x > INT_MIN, "Validate that value of x is > INT_MIN, got: %i", x); SDLTest_AssertCheck(x > INT_MIN, "Validate that value of x is > INT_MIN, got: %i", x);
SDLTest_AssertCheck(_mouseStateCheck(state), "Validate state returned from function, got: %u", state); SDLTest_AssertCheck(_mouseStateCheck(state), "Validate state returned from function, got: %" SDL_PRIu32, state);
/* Case where y pointer is not NULL */ /* Case where y pointer is not NULL */
y = INT_MIN; y = INT_MIN;
state = SDL_GetRelativeMouseState(NULL, &y); state = SDL_GetRelativeMouseState(NULL, &y);
SDLTest_AssertPass("Call to SDL_GetRelativeMouseState(NULL, &y)"); SDLTest_AssertPass("Call to SDL_GetRelativeMouseState(NULL, &y)");
SDLTest_AssertCheck(y > INT_MIN, "Validate that value of y is > INT_MIN, got: %i", y); SDLTest_AssertCheck(y > INT_MIN, "Validate that value of y is > INT_MIN, got: %i", y);
SDLTest_AssertCheck(_mouseStateCheck(state), "Validate state returned from function, got: %u", state); SDLTest_AssertCheck(_mouseStateCheck(state), "Validate state returned from function, got: %" SDL_PRIu32, state);
/* Case where x and y pointer is not NULL */ /* Case where x and y pointer is not NULL */
x = INT_MIN; x = INT_MIN;
@ -110,7 +110,7 @@ mouse_getRelativeMouseState(void *arg)
SDLTest_AssertPass("Call to SDL_GetRelativeMouseState(&x, &y)"); SDLTest_AssertPass("Call to SDL_GetRelativeMouseState(&x, &y)");
SDLTest_AssertCheck(x > INT_MIN, "Validate that value of x is > INT_MIN, got: %i", x); SDLTest_AssertCheck(x > INT_MIN, "Validate that value of x is > INT_MIN, got: %i", x);
SDLTest_AssertCheck(y > INT_MIN, "Validate that value of y is > INT_MIN, got: %i", y); SDLTest_AssertCheck(y > INT_MIN, "Validate that value of y is > INT_MIN, got: %i", y);
SDLTest_AssertCheck(_mouseStateCheck(state), "Validate state returned from function, got: %u", state); SDLTest_AssertCheck(_mouseStateCheck(state), "Validate state returned from function, got: %" SDL_PRIu32, state);
return TEST_COMPLETED; return TEST_COMPLETED;
} }

View File

@ -137,18 +137,18 @@ pixels_allocFreeFormat(void *arg)
/* Blank/unknown format */ /* Blank/unknown format */
format = 0; format = 0;
SDLTest_Log("RGB Format: %s (%u)", unknownFormat, format); SDLTest_Log("RGB Format: %s (%" SDL_PRIu32 ")", unknownFormat, format);
/* Allocate format */ /* Allocate format */
result = SDL_AllocFormat(format); result = SDL_AllocFormat(format);
SDLTest_AssertPass("Call to SDL_AllocFormat()"); SDLTest_AssertPass("Call to SDL_AllocFormat()");
SDLTest_AssertCheck(result != NULL, "Verify result is not NULL"); SDLTest_AssertCheck(result != NULL, "Verify result is not NULL");
if (result != NULL) { if (result != NULL) {
SDLTest_AssertCheck(result->format == format, "Verify value of result.format; expected: %u, got %u", format, result->format); SDLTest_AssertCheck(result->format == format, "Verify value of result.format; expected: %" SDL_PRIu32 ", got %" SDL_PRIu32, format, result->format);
SDLTest_AssertCheck(result->BitsPerPixel == 0, "Verify value of result.BitsPerPixel; expected: 0, got %u", result->BitsPerPixel); SDLTest_AssertCheck(result->BitsPerPixel == 0, "Verify value of result.BitsPerPixel; expected: 0, got %u", result->BitsPerPixel);
SDLTest_AssertCheck(result->BytesPerPixel == 0, "Verify value of result.BytesPerPixel; expected: 0, got %u", result->BytesPerPixel); SDLTest_AssertCheck(result->BytesPerPixel == 0, "Verify value of result.BytesPerPixel; expected: 0, got %u", result->BytesPerPixel);
masks = result->Rmask | result->Gmask | result->Bmask | result->Amask; masks = result->Rmask | result->Gmask | result->Bmask | result->Amask;
SDLTest_AssertCheck(masks == 0, "Verify value of result.[RGBA]mask combined; expected: 0, got %u", masks); SDLTest_AssertCheck(masks == 0, "Verify value of result.[RGBA]mask combined; expected: 0, got %" SDL_PRIu32, masks);
/* Deallocate again */ /* Deallocate again */
SDL_FreeFormat(result); SDL_FreeFormat(result);
@ -158,19 +158,19 @@ pixels_allocFreeFormat(void *arg)
/* RGB formats */ /* RGB formats */
for (i = 0; i < _numRGBPixelFormats; i++) { for (i = 0; i < _numRGBPixelFormats; i++) {
format = _RGBPixelFormats[i]; format = _RGBPixelFormats[i];
SDLTest_Log("RGB Format: %s (%u)", _RGBPixelFormatsVerbose[i], format); SDLTest_Log("RGB Format: %s (%" SDL_PRIu32 ")", _RGBPixelFormatsVerbose[i], format);
/* Allocate format */ /* Allocate format */
result = SDL_AllocFormat(format); result = SDL_AllocFormat(format);
SDLTest_AssertPass("Call to SDL_AllocFormat()"); SDLTest_AssertPass("Call to SDL_AllocFormat()");
SDLTest_AssertCheck(result != NULL, "Verify result is not NULL"); SDLTest_AssertCheck(result != NULL, "Verify result is not NULL");
if (result != NULL) { if (result != NULL) {
SDLTest_AssertCheck(result->format == format, "Verify value of result.format; expected: %u, got %u", format, result->format); SDLTest_AssertCheck(result->format == format, "Verify value of result.format; expected: %" SDL_PRIu32 ", got %" SDL_PRIu32, format, result->format);
SDLTest_AssertCheck(result->BitsPerPixel > 0, "Verify value of result.BitsPerPixel; expected: >0, got %u", result->BitsPerPixel); SDLTest_AssertCheck(result->BitsPerPixel > 0, "Verify value of result.BitsPerPixel; expected: >0, got %u", result->BitsPerPixel);
SDLTest_AssertCheck(result->BytesPerPixel > 0, "Verify value of result.BytesPerPixel; expected: >0, got %u", result->BytesPerPixel); SDLTest_AssertCheck(result->BytesPerPixel > 0, "Verify value of result.BytesPerPixel; expected: >0, got %u", result->BytesPerPixel);
if (result->palette != NULL) { if (result->palette != NULL) {
masks = result->Rmask | result->Gmask | result->Bmask | result->Amask; masks = result->Rmask | result->Gmask | result->Bmask | result->Amask;
SDLTest_AssertCheck(masks > 0, "Verify value of result.[RGBA]mask combined; expected: >0, got %u", masks); SDLTest_AssertCheck(masks > 0, "Verify value of result.[RGBA]mask combined; expected: >0, got %" SDL_PRIu32, masks);
} }
/* Deallocate again */ /* Deallocate again */
@ -182,7 +182,7 @@ pixels_allocFreeFormat(void *arg)
/* Non-RGB formats */ /* Non-RGB formats */
for (i = 0; i < _numNonRGBPixelFormats; i++) { for (i = 0; i < _numNonRGBPixelFormats; i++) {
format = _nonRGBPixelFormats[i]; format = _nonRGBPixelFormats[i];
SDLTest_Log("non-RGB Format: %s (%u)", _nonRGBPixelFormatsVerbose[i], format); SDLTest_Log("non-RGB Format: %s (%" SDL_PRIu32 ")", _nonRGBPixelFormatsVerbose[i], format);
/* Try to allocate format */ /* Try to allocate format */
result = SDL_AllocFormat(format); result = SDL_AllocFormat(format);
@ -198,7 +198,7 @@ pixels_allocFreeFormat(void *arg)
SDLTest_AssertPass("Call to SDL_ClearError()"); SDLTest_AssertPass("Call to SDL_ClearError()");
format = _invalidPixelFormats[i]; format = _invalidPixelFormats[i];
result = SDL_AllocFormat(format); result = SDL_AllocFormat(format);
SDLTest_AssertPass("Call to SDL_AllocFormat(%u)", format); SDLTest_AssertPass("Call to SDL_AllocFormat(%" SDL_PRIu32 ")", format);
SDLTest_AssertCheck(result == NULL, "Verify result is NULL"); SDLTest_AssertCheck(result == NULL, "Verify result is NULL");
error = SDL_GetError(); error = SDL_GetError();
SDLTest_AssertPass("Call to SDL_GetError()"); SDLTest_AssertPass("Call to SDL_GetError()");
@ -241,7 +241,7 @@ pixels_getPixelFormatName(void *arg)
/* Blank/undefined format */ /* Blank/undefined format */
format = 0; format = 0;
SDLTest_Log("RGB Format: %s (%u)", unknownFormat, format); SDLTest_Log("RGB Format: %s (%" SDL_PRIu32 ")", unknownFormat, format);
/* Get name of format */ /* Get name of format */
result = SDL_GetPixelFormatName(format); result = SDL_GetPixelFormatName(format);
@ -256,7 +256,7 @@ pixels_getPixelFormatName(void *arg)
/* RGB formats */ /* RGB formats */
for (i = 0; i < _numRGBPixelFormats; i++) { for (i = 0; i < _numRGBPixelFormats; i++) {
format = _RGBPixelFormats[i]; format = _RGBPixelFormats[i];
SDLTest_Log("RGB Format: %s (%u)", _RGBPixelFormatsVerbose[i], format); SDLTest_Log("RGB Format: %s (%" SDL_PRIu32 ")", _RGBPixelFormatsVerbose[i], format);
/* Get name of format */ /* Get name of format */
result = SDL_GetPixelFormatName(format); result = SDL_GetPixelFormatName(format);
@ -272,7 +272,7 @@ pixels_getPixelFormatName(void *arg)
/* Non-RGB formats */ /* Non-RGB formats */
for (i = 0; i < _numNonRGBPixelFormats; i++) { for (i = 0; i < _numNonRGBPixelFormats; i++) {
format = _nonRGBPixelFormats[i]; format = _nonRGBPixelFormats[i];
SDLTest_Log("non-RGB Format: %s (%u)", _nonRGBPixelFormatsVerbose[i], format); SDLTest_Log("non-RGB Format: %s (%" SDL_PRIu32 ")", _nonRGBPixelFormatsVerbose[i], format);
/* Get name of format */ /* Get name of format */
result = SDL_GetPixelFormatName(format); result = SDL_GetPixelFormatName(format);
@ -293,7 +293,7 @@ pixels_getPixelFormatName(void *arg)
for (i = 0; i < _numInvalidPixelFormats; i++) { for (i = 0; i < _numInvalidPixelFormats; i++) {
format = _invalidPixelFormats[i]; format = _invalidPixelFormats[i];
result = SDL_GetPixelFormatName(format); result = SDL_GetPixelFormatName(format);
SDLTest_AssertPass("Call to SDL_GetPixelFormatName(%u)", format); SDLTest_AssertPass("Call to SDL_GetPixelFormatName(%" SDL_PRIu32 ")", format);
SDLTest_AssertCheck(result != NULL, "Verify result is not NULL"); SDLTest_AssertCheck(result != NULL, "Verify result is not NULL");
if (result != NULL) { if (result != NULL) {
SDLTest_AssertCheck(result[0] != '\0', SDLTest_AssertCheck(result[0] != '\0',

View File

@ -106,7 +106,7 @@ int platform_testEndianessAndSwap(void *arg)
/* Test 32 swap. */ /* Test 32 swap. */
SDLTest_AssertCheck( SDL_Swap32(value32) == swapped32, SDLTest_AssertCheck( SDL_Swap32(value32) == swapped32,
"SDL_Swap32(): 32 bit swapped: 0x%X => 0x%X", "SDL_Swap32(): 32 bit swapped: 0x%" SDL_PRIX32 " => 0x%" SDL_PRIX32,
value32, SDL_Swap32(value32) ); value32, SDL_Swap32(value32) );
/* Test 64 swap. */ /* Test 64 swap. */

View File

@ -239,7 +239,7 @@ rwops_testMem (void)
if (rw == NULL) return TEST_ABORTED; if (rw == NULL) return TEST_ABORTED;
/* Check type */ /* Check type */
SDLTest_AssertCheck(rw->type == SDL_RWOPS_MEMORY, "Verify RWops type is SDL_RWOPS_MEMORY; expected: %d, got: %d", SDL_RWOPS_MEMORY, rw->type); SDLTest_AssertCheck(rw->type == SDL_RWOPS_MEMORY, "Verify RWops type is SDL_RWOPS_MEMORY; expected: %d, got: %" SDL_PRIu32, SDL_RWOPS_MEMORY, rw->type);
/* Run generic tests */ /* Run generic tests */
_testGenericRWopsValidations(rw, 1); _testGenericRWopsValidations(rw, 1);
@ -275,7 +275,7 @@ rwops_testConstMem (void)
if (rw == NULL) return TEST_ABORTED; if (rw == NULL) return TEST_ABORTED;
/* Check type */ /* Check type */
SDLTest_AssertCheck(rw->type == SDL_RWOPS_MEMORY_RO, "Verify RWops type is SDL_RWOPS_MEMORY_RO; expected: %d, got: %d", SDL_RWOPS_MEMORY_RO, rw->type); SDLTest_AssertCheck(rw->type == SDL_RWOPS_MEMORY_RO, "Verify RWops type is SDL_RWOPS_MEMORY_RO; expected: %d, got: %" SDL_PRIu32, SDL_RWOPS_MEMORY_RO, rw->type);
/* Run generic tests */ /* Run generic tests */
_testGenericRWopsValidations( rw, 0 ); _testGenericRWopsValidations( rw, 0 );
@ -321,8 +321,8 @@ rwops_testFileRead(void)
"Verify RWops type is SDL_RWOPS_WINFILE; expected: %d, got: %d", SDL_RWOPS_WINFILE, rw->type); "Verify RWops type is SDL_RWOPS_WINFILE; expected: %d, got: %d", SDL_RWOPS_WINFILE, rw->type);
#else #else
SDLTest_AssertCheck( SDLTest_AssertCheck(
rw->type == SDL_RWOPS_STDFILE, rw->type == SDL_RWOPS_STDFILE,
"Verify RWops type is SDL_RWOPS_STDFILE; expected: %d, got: %d", SDL_RWOPS_STDFILE, rw->type); "Verify RWops type is SDL_RWOPS_STDFILE; expected: %d, got: %" SDL_PRIu32, SDL_RWOPS_STDFILE, rw->type);
#endif #endif
/* Run generic tests */ /* Run generic tests */
@ -368,8 +368,8 @@ rwops_testFileWrite(void)
"Verify RWops type is SDL_RWOPS_WINFILE; expected: %d, got: %d", SDL_RWOPS_WINFILE, rw->type); "Verify RWops type is SDL_RWOPS_WINFILE; expected: %d, got: %d", SDL_RWOPS_WINFILE, rw->type);
#else #else
SDLTest_AssertCheck( SDLTest_AssertCheck(
rw->type == SDL_RWOPS_STDFILE, rw->type == SDL_RWOPS_STDFILE,
"Verify RWops type is SDL_RWOPS_STDFILE; expected: %d, got: %d", SDL_RWOPS_STDFILE, rw->type); "Verify RWops type is SDL_RWOPS_STDFILE; expected: %d, got: %" SDL_PRIu32, SDL_RWOPS_STDFILE, rw->type);
#endif #endif
/* Run generic tests */ /* Run generic tests */
@ -420,8 +420,8 @@ rwops_testFPRead(void)
/* Check type */ /* Check type */
SDLTest_AssertCheck( SDLTest_AssertCheck(
rw->type == SDL_RWOPS_STDFILE, rw->type == SDL_RWOPS_STDFILE,
"Verify RWops type is SDL_RWOPS_STDFILE; expected: %d, got: %d", SDL_RWOPS_STDFILE, rw->type); "Verify RWops type is SDL_RWOPS_STDFILE; expected: %d, got: %" SDL_PRIu32, SDL_RWOPS_STDFILE, rw->type);
/* Run generic tests */ /* Run generic tests */
_testGenericRWopsValidations( rw, 0 ); _testGenericRWopsValidations( rw, 0 );
@ -473,8 +473,8 @@ rwops_testFPWrite(void)
/* Check type */ /* Check type */
SDLTest_AssertCheck( SDLTest_AssertCheck(
rw->type == SDL_RWOPS_STDFILE, rw->type == SDL_RWOPS_STDFILE,
"Verify RWops type is SDL_RWOPS_STDFILE; expected: %d, got: %d", SDL_RWOPS_STDFILE, rw->type); "Verify RWops type is SDL_RWOPS_STDFILE; expected: %d, got: %" SDL_PRIu32, SDL_RWOPS_STDFILE, rw->type);
/* Run generic tests */ /* Run generic tests */
_testGenericRWopsValidations( rw, 1 ); _testGenericRWopsValidations( rw, 1 );
@ -506,8 +506,8 @@ rwops_testAllocFree (void)
/* Check type */ /* Check type */
SDLTest_AssertCheck( SDLTest_AssertCheck(
rw->type == SDL_RWOPS_UNKNOWN, rw->type == SDL_RWOPS_UNKNOWN,
"Verify RWops type is SDL_RWOPS_UNKNOWN; expected: %d, got: %d", SDL_RWOPS_UNKNOWN, rw->type); "Verify RWops type is SDL_RWOPS_UNKNOWN; expected: %d, got: %" SDL_PRIu32, SDL_RWOPS_UNKNOWN, rw->type);
/* Free context again */ /* Free context again */
SDL_FreeRW(rw); SDL_FreeRW(rw);
@ -684,7 +684,7 @@ rwops_testFileWriteReadEndian(void)
SDLTest_AssertCheck(BE16test == BE16value, "Validate return value from SDL_ReadBE16, expected: %hu, got: %hu", BE16value, BE16test); SDLTest_AssertCheck(BE16test == BE16value, "Validate return value from SDL_ReadBE16, expected: %hu, got: %hu", BE16value, BE16test);
BE32test = SDL_ReadBE32(rw); BE32test = SDL_ReadBE32(rw);
SDLTest_AssertPass("Call to SDL_ReadBE32()"); SDLTest_AssertPass("Call to SDL_ReadBE32()");
SDLTest_AssertCheck(BE32test == BE32value, "Validate return value from SDL_ReadBE32, expected: %u, got: %u", BE32value, BE32test); SDLTest_AssertCheck(BE32test == BE32value, "Validate return value from SDL_ReadBE32, expected: %" SDL_PRIu32 ", got: %" SDL_PRIu32, BE32value, BE32test);
BE64test = SDL_ReadBE64(rw); BE64test = SDL_ReadBE64(rw);
SDLTest_AssertPass("Call to SDL_ReadBE64()"); SDLTest_AssertPass("Call to SDL_ReadBE64()");
SDLTest_AssertCheck(BE64test == BE64value, "Validate return value from SDL_ReadBE64, expected: %"SDL_PRIu64", got: %"SDL_PRIu64, BE64value, BE64test); SDLTest_AssertCheck(BE64test == BE64value, "Validate return value from SDL_ReadBE64, expected: %"SDL_PRIu64", got: %"SDL_PRIu64, BE64value, BE64test);
@ -693,7 +693,7 @@ rwops_testFileWriteReadEndian(void)
SDLTest_AssertCheck(LE16test == LE16value, "Validate return value from SDL_ReadLE16, expected: %hu, got: %hu", LE16value, LE16test); SDLTest_AssertCheck(LE16test == LE16value, "Validate return value from SDL_ReadLE16, expected: %hu, got: %hu", LE16value, LE16test);
LE32test = SDL_ReadLE32(rw); LE32test = SDL_ReadLE32(rw);
SDLTest_AssertPass("Call to SDL_ReadLE32()"); SDLTest_AssertPass("Call to SDL_ReadLE32()");
SDLTest_AssertCheck(LE32test == LE32value, "Validate return value from SDL_ReadLE32, expected: %u, got: %u", LE32value, LE32test); SDLTest_AssertCheck(LE32test == LE32value, "Validate return value from SDL_ReadLE32, expected: %" SDL_PRIu32 ", got: %" SDL_PRIu32, LE32value, LE32test);
LE64test = SDL_ReadLE64(rw); LE64test = SDL_ReadLE64(rw);
SDLTest_AssertPass("Call to SDL_ReadLE64()"); SDLTest_AssertPass("Call to SDL_ReadLE64()");
SDLTest_AssertCheck(LE64test == LE64value, "Validate return value from SDL_ReadLE64, expected: %"SDL_PRIu64", got: %"SDL_PRIu64, LE64value, LE64test); SDLTest_AssertCheck(LE64test == LE64value, "Validate return value from SDL_ReadLE64, expected: %"SDL_PRIu64", got: %"SDL_PRIu64, LE64value, LE64test);

View File

@ -891,8 +891,8 @@ sdltest_randomBoundaryNumberSint32(void *arg)
sresult = (Sint64)SDLTest_RandomSint32BoundaryValue(long_min + 1, long_max, SDL_FALSE); sresult = (Sint64)SDLTest_RandomSint32BoundaryValue(long_min + 1, long_max, SDL_FALSE);
SDLTest_AssertPass("Call to SDLTest_RandomSint32BoundaryValue"); SDLTest_AssertPass("Call to SDLTest_RandomSint32BoundaryValue");
SDLTest_AssertCheck( SDLTest_AssertCheck(
sresult == long_min, sresult == long_min,
"Validate result value for parameters (LONG_MIN+1,LONG_MAX,SDL_FALSE); expected: %d, got: %"SDL_PRIs64, long_min, sresult); "Validate result value for parameters (LONG_MIN+1,LONG_MAX,SDL_FALSE); expected: %" SDL_PRIs32 ", got: %" SDL_PRIs64, long_min, sresult);
lastError = (char *)SDL_GetError(); lastError = (char *)SDL_GetError();
SDLTest_AssertPass("SDL_GetError()"); SDLTest_AssertPass("SDL_GetError()");
SDLTest_AssertCheck(lastError == NULL || lastError[0] == '\0', "Validate no error message was set"); SDLTest_AssertCheck(lastError == NULL || lastError[0] == '\0', "Validate no error message was set");
@ -901,8 +901,8 @@ sdltest_randomBoundaryNumberSint32(void *arg)
sresult = (Sint64)SDLTest_RandomSint32BoundaryValue(long_min, long_max - 1, SDL_FALSE); sresult = (Sint64)SDLTest_RandomSint32BoundaryValue(long_min, long_max - 1, SDL_FALSE);
SDLTest_AssertPass("Call to SDLTest_RandomSint32BoundaryValue"); SDLTest_AssertPass("Call to SDLTest_RandomSint32BoundaryValue");
SDLTest_AssertCheck( SDLTest_AssertCheck(
sresult == long_max, sresult == long_max,
"Validate result value for parameters (LONG_MIN,LONG_MAX - 1,SDL_FALSE); expected: %d, got: %"SDL_PRIs64, long_max, sresult); "Validate result value for parameters (LONG_MIN,LONG_MAX - 1,SDL_FALSE); expected: %" SDL_PRIs32 ", got: %" SDL_PRIs64, long_max, sresult);
lastError = (char *)SDL_GetError(); lastError = (char *)SDL_GetError();
SDLTest_AssertPass("SDL_GetError()"); SDLTest_AssertPass("SDL_GetError()");
SDLTest_AssertCheck(lastError == NULL || lastError[0] == '\0', "Validate no error message was set"); SDLTest_AssertCheck(lastError == NULL || lastError[0] == '\0', "Validate no error message was set");
@ -911,8 +911,8 @@ sdltest_randomBoundaryNumberSint32(void *arg)
sresult = (Sint64)SDLTest_RandomSint32BoundaryValue(long_min, long_max, SDL_FALSE); sresult = (Sint64)SDLTest_RandomSint32BoundaryValue(long_min, long_max, SDL_FALSE);
SDLTest_AssertPass("Call to SDLTest_RandomSint32BoundaryValue"); SDLTest_AssertPass("Call to SDLTest_RandomSint32BoundaryValue");
SDLTest_AssertCheck( SDLTest_AssertCheck(
sresult == long_min, sresult == long_min,
"Validate result value for parameters(LONG_MIN,LONG_MAX,SDL_FALSE); expected: %d, got: %"SDL_PRIs64, long_min, sresult); "Validate result value for parameters(LONG_MIN,LONG_MAX,SDL_FALSE); expected: %" SDL_PRIs32 ", got: %" SDL_PRIs64, long_min, sresult);
lastError = (char *)SDL_GetError(); lastError = (char *)SDL_GetError();
SDLTest_AssertPass("SDL_GetError()"); SDLTest_AssertPass("SDL_GetError()");
SDLTest_AssertCheck(lastError != NULL && SDL_strcmp(lastError, expectedError) == 0, SDLTest_AssertCheck(lastError != NULL && SDL_strcmp(lastError, expectedError) == 0,
@ -1058,56 +1058,56 @@ sdltest_randomIntegerInRange(void *arg)
max = min + (Sint32)SDLTest_RandomUint8() + 2; max = min + (Sint32)SDLTest_RandomUint8() + 2;
result = SDLTest_RandomIntegerInRange(min, max); result = SDLTest_RandomIntegerInRange(min, max);
SDLTest_AssertPass("Call to SDLTest_RandomIntegerInRange(min,max)"); SDLTest_AssertPass("Call to SDLTest_RandomIntegerInRange(min,max)");
SDLTest_AssertCheck(min <= result && result <= max, "Validated returned value; expected: [%d,%d], got: %d", min, max, result); SDLTest_AssertCheck(min <= result && result <= max, "Validated returned value; expected: [%" SDL_PRIs32 ",%" SDL_PRIs32 "], got: %" SDL_PRIs32, min, max, result);
/* One Range */ /* One Range */
min = (Sint32)SDLTest_RandomSint16(); min = (Sint32)SDLTest_RandomSint16();
max = min + 1; max = min + 1;
result = SDLTest_RandomIntegerInRange(min, max); result = SDLTest_RandomIntegerInRange(min, max);
SDLTest_AssertPass("Call to SDLTest_RandomIntegerInRange(min,min+1)"); SDLTest_AssertPass("Call to SDLTest_RandomIntegerInRange(min,min+1)");
SDLTest_AssertCheck(min <= result && result <= max, "Validated returned value; expected: [%d,%d], got: %d", min, max, result); SDLTest_AssertCheck(min <= result && result <= max, "Validated returned value; expected: [%" SDL_PRIs32 ",%" SDL_PRIs32 "], got: %" SDL_PRIs32, min, max, result);
/* Zero range */ /* Zero range */
min = (Sint32)SDLTest_RandomSint16(); min = (Sint32)SDLTest_RandomSint16();
max = min; max = min;
result = SDLTest_RandomIntegerInRange(min, max); result = SDLTest_RandomIntegerInRange(min, max);
SDLTest_AssertPass("Call to SDLTest_RandomIntegerInRange(min,min)"); SDLTest_AssertPass("Call to SDLTest_RandomIntegerInRange(min,min)");
SDLTest_AssertCheck(min == result, "Validated returned value; expected: %d, got: %d", min, result); SDLTest_AssertCheck(min == result, "Validated returned value; expected: %" SDL_PRIs32 ", got: %" SDL_PRIs32, min, result);
/* Zero range at zero */ /* Zero range at zero */
min = 0; min = 0;
max = 0; max = 0;
result = SDLTest_RandomIntegerInRange(min, max); result = SDLTest_RandomIntegerInRange(min, max);
SDLTest_AssertPass("Call to SDLTest_RandomIntegerInRange(0,0)"); SDLTest_AssertPass("Call to SDLTest_RandomIntegerInRange(0,0)");
SDLTest_AssertCheck(result == 0, "Validated returned value; expected: 0, got: %d", result); SDLTest_AssertCheck(result == 0, "Validated returned value; expected: 0, got: %" SDL_PRIs32, result);
/* Swapped min-max */ /* Swapped min-max */
min = (Sint32)SDLTest_RandomSint16(); min = (Sint32)SDLTest_RandomSint16();
max = min + (Sint32)SDLTest_RandomUint8() + 2; max = min + (Sint32)SDLTest_RandomUint8() + 2;
result = SDLTest_RandomIntegerInRange(max, min); result = SDLTest_RandomIntegerInRange(max, min);
SDLTest_AssertPass("Call to SDLTest_RandomIntegerInRange(max,min)"); SDLTest_AssertPass("Call to SDLTest_RandomIntegerInRange(max,min)");
SDLTest_AssertCheck(min <= result && result <= max, "Validated returned value; expected: [%d,%d], got: %d", min, max, result); SDLTest_AssertCheck(min <= result && result <= max, "Validated returned value; expected: [%" SDL_PRIs32 ",%" SDL_PRIs32 "], got: %" SDL_PRIs32, min, max, result);
/* Range with min at integer limit */ /* Range with min at integer limit */
min = long_min; min = long_min;
max = long_max + (Sint32)SDLTest_RandomSint16(); max = long_max + (Sint32)SDLTest_RandomSint16();
result = SDLTest_RandomIntegerInRange(min, max); result = SDLTest_RandomIntegerInRange(min, max);
SDLTest_AssertPass("Call to SDLTest_RandomIntegerInRange(SINT32_MIN,...)"); SDLTest_AssertPass("Call to SDLTest_RandomIntegerInRange(SINT32_MIN,...)");
SDLTest_AssertCheck(min <= result && result <= max, "Validated returned value; expected: [%d,%d], got: %d", min, max, result); SDLTest_AssertCheck(min <= result && result <= max, "Validated returned value; expected: [%" SDL_PRIs32 ",%" SDL_PRIs32 "], got: %" SDL_PRIs32, min, max, result);
/* Range with max at integer limit */ /* Range with max at integer limit */
min = long_min - (Sint32)SDLTest_RandomSint16(); min = long_min - (Sint32)SDLTest_RandomSint16();
max = long_max; max = long_max;
result = SDLTest_RandomIntegerInRange(min, max); result = SDLTest_RandomIntegerInRange(min, max);
SDLTest_AssertPass("Call to SDLTest_RandomIntegerInRange(...,SINT32_MAX)"); SDLTest_AssertPass("Call to SDLTest_RandomIntegerInRange(...,SINT32_MAX)");
SDLTest_AssertCheck(min <= result && result <= max, "Validated returned value; expected: [%d,%d], got: %d", min, max, result); SDLTest_AssertCheck(min <= result && result <= max, "Validated returned value; expected: [%" SDL_PRIs32 ",%" SDL_PRIs32 "], got: %" SDL_PRIs32, min, max, result);
/* Full integer range */ /* Full integer range */
min = long_min; min = long_min;
max = long_max; max = long_max;
result = SDLTest_RandomIntegerInRange(min, max); result = SDLTest_RandomIntegerInRange(min, max);
SDLTest_AssertPass("Call to SDLTest_RandomIntegerInRange(SINT32_MIN,SINT32_MAX)"); SDLTest_AssertPass("Call to SDLTest_RandomIntegerInRange(SINT32_MIN,SINT32_MAX)");
SDLTest_AssertCheck(min <= result && result <= max, "Validated returned value; expected: [%d,%d], got: %d", min, max, result); SDLTest_AssertCheck(min <= result && result <= max, "Validated returned value; expected: [%" SDL_PRIs32 ",%" SDL_PRIs32 "], got: %" SDL_PRIs32, min, max, result);
return TEST_COMPLETED; return TEST_COMPLETED;
} }

View File

@ -88,17 +88,17 @@ timer_delayAndGetTicks(void *arg)
/* Get ticks count - should be non-zero by now */ /* Get ticks count - should be non-zero by now */
result = SDL_GetTicks(); result = SDL_GetTicks();
SDLTest_AssertPass("Call to SDL_GetTicks()"); SDLTest_AssertPass("Call to SDL_GetTicks()");
SDLTest_AssertCheck(result > 0, "Check result value, expected: >0, got: %d", result); SDLTest_AssertCheck(result > 0, "Check result value, expected: >0, got: %" SDL_PRIu32, result);
/* Delay a bit longer and measure ticks and verify difference */ /* Delay a bit longer and measure ticks and verify difference */
SDL_Delay(testDelay); SDL_Delay(testDelay);
SDLTest_AssertPass("Call to SDL_Delay(%d)", testDelay); SDLTest_AssertPass("Call to SDL_Delay(%" SDL_PRIu32 ")", testDelay);
result2 = SDL_GetTicks(); result2 = SDL_GetTicks();
SDLTest_AssertPass("Call to SDL_GetTicks()"); SDLTest_AssertPass("Call to SDL_GetTicks()");
SDLTest_AssertCheck(result2 > 0, "Check result value, expected: >0, got: %d", result2); SDLTest_AssertCheck(result2 > 0, "Check result value, expected: >0, got: %" SDL_PRIu32, result2);
difference = result2 - result; difference = result2 - result;
SDLTest_AssertCheck(difference > (testDelay - marginOfError), "Check difference, expected: >%d, got: %d", testDelay - marginOfError, difference); SDLTest_AssertCheck(difference > (testDelay - marginOfError), "Check difference, expected: >%" SDL_PRIu32 ", got: %" SDL_PRIu32, testDelay - marginOfError, difference);
SDLTest_AssertCheck(difference < (testDelay + marginOfError), "Check difference, expected: <%d, got: %d", testDelay + marginOfError, difference); SDLTest_AssertCheck(difference < (testDelay + marginOfError), "Check difference, expected: <%" SDL_PRIu32 ", got: %" SDL_PRIu32, testDelay + marginOfError, difference);
return TEST_COMPLETED; return TEST_COMPLETED;
} }

View File

@ -346,7 +346,7 @@ video_getWindowFlags(void *arg)
if (window != NULL) { if (window != NULL) {
actualFlags = SDL_GetWindowFlags(window); actualFlags = SDL_GetWindowFlags(window);
SDLTest_AssertPass("Call to SDL_GetWindowFlags()"); SDLTest_AssertPass("Call to SDL_GetWindowFlags()");
SDLTest_AssertCheck((flags & actualFlags) == flags, "Verify returned value has flags %d set, got: %d", flags, actualFlags); SDLTest_AssertCheck((flags & actualFlags) == flags, "Verify returned value has flags %d set, got: %" SDL_PRIu32, flags, actualFlags);
} }
/* Clean up */ /* Clean up */
@ -985,13 +985,13 @@ video_getWindowId(void *arg)
/* Get window from ID */ /* Get window from ID */
result = SDL_GetWindowFromID(id); result = SDL_GetWindowFromID(id);
SDLTest_AssertPass("Call to SDL_GetWindowID(%d)", id); SDLTest_AssertPass("Call to SDL_GetWindowID(%" SDL_PRIu32 ")", id);
SDLTest_AssertCheck(result == window, "Verify result matches window pointer"); SDLTest_AssertCheck(result == window, "Verify result matches window pointer");
/* Get window from random large ID, no result check */ /* Get window from random large ID, no result check */
randomId = SDLTest_RandomIntegerInRange(UINT8_MAX,UINT16_MAX); randomId = SDLTest_RandomIntegerInRange(UINT8_MAX,UINT16_MAX);
result = SDL_GetWindowFromID(randomId); result = SDL_GetWindowFromID(randomId);
SDLTest_AssertPass("Call to SDL_GetWindowID(%d/random_large)", randomId); SDLTest_AssertPass("Call to SDL_GetWindowID(%" SDL_PRIu32 "/random_large)", randomId);
/* Get window from 0 and Uint32 max ID, no result check */ /* Get window from 0 and Uint32 max ID, no result check */
result = SDL_GetWindowFromID(0); result = SDL_GetWindowFromID(0);
@ -1004,7 +1004,7 @@ video_getWindowId(void *arg)
/* Get window from ID for closed window */ /* Get window from ID for closed window */
result = SDL_GetWindowFromID(id); result = SDL_GetWindowFromID(id);
SDLTest_AssertPass("Call to SDL_GetWindowID(%d/closed_window)", id); SDLTest_AssertPass("Call to SDL_GetWindowID(%" SDL_PRIu32 "/closed_window)", id);
SDLTest_AssertCheck(result == NULL, "Verify result is NULL"); SDLTest_AssertCheck(result == NULL, "Verify result is NULL");
/* Negative test */ /* Negative test */
@ -1036,7 +1036,7 @@ video_getWindowPixelFormat(void *arg)
/* Get format */ /* Get format */
format = SDL_GetWindowPixelFormat(window); format = SDL_GetWindowPixelFormat(window);
SDLTest_AssertPass("Call to SDL_GetWindowPixelFormat()"); SDLTest_AssertPass("Call to SDL_GetWindowPixelFormat()");
SDLTest_AssertCheck(format != SDL_PIXELFORMAT_UNKNOWN, "Verify that returned format is valid; expected: != %d, got: %d", SDL_PIXELFORMAT_UNKNOWN, format); SDLTest_AssertCheck(format != SDL_PIXELFORMAT_UNKNOWN, "Verify that returned format is valid; expected: != %d, got: %" SDL_PRIu32, SDL_PIXELFORMAT_UNKNOWN, format);
/* Clean up */ /* Clean up */
_destroyVideoSuiteTestWindow(window); _destroyVideoSuiteTestWindow(window);

View File

@ -577,28 +577,26 @@ loop(void *arg)
case SDL_CONTROLLERTOUCHPADDOWN: case SDL_CONTROLLERTOUCHPADDOWN:
case SDL_CONTROLLERTOUCHPADMOTION: case SDL_CONTROLLERTOUCHPADMOTION:
case SDL_CONTROLLERTOUCHPADUP: case SDL_CONTROLLERTOUCHPADUP:
SDL_Log("Controller %d touchpad %d finger %d %s %.2f, %.2f, %.2f\n", SDL_Log("Controller %" SDL_PRIs32 " touchpad %" SDL_PRIs32 " finger %" SDL_PRIs32 " %s %.2f, %.2f, %.2f\n",
event.ctouchpad.which, event.ctouchpad.which,
event.ctouchpad.touchpad, event.ctouchpad.touchpad,
event.ctouchpad.finger, event.ctouchpad.finger,
(event.type == SDL_CONTROLLERTOUCHPADDOWN ? "pressed at" : (event.type == SDL_CONTROLLERTOUCHPADDOWN ? "pressed at" : (event.type == SDL_CONTROLLERTOUCHPADUP ? "released at" : "moved to")),
(event.type == SDL_CONTROLLERTOUCHPADUP ? "released at" : event.ctouchpad.x,
"moved to")), event.ctouchpad.y,
event.ctouchpad.x, event.ctouchpad.pressure);
event.ctouchpad.y,
event.ctouchpad.pressure);
break; break;
#define VERBOSE_SENSORS #define VERBOSE_SENSORS
#ifdef VERBOSE_SENSORS #ifdef VERBOSE_SENSORS
case SDL_CONTROLLERSENSORUPDATE: case SDL_CONTROLLERSENSORUPDATE:
SDL_Log("Controller %d sensor %s: %.2f, %.2f, %.2f (%"SDL_PRIu64")\n", SDL_Log("Controller %" SDL_PRIs32 " sensor %s: %.2f, %.2f, %.2f (%" SDL_PRIu64 ")\n",
event.csensor.which, event.csensor.which,
GetSensorName((SDL_SensorType)event.csensor.sensor), GetSensorName((SDL_SensorType) event.csensor.sensor),
event.csensor.data[0], event.csensor.data[0],
event.csensor.data[1], event.csensor.data[1],
event.csensor.data[2], event.csensor.data[2],
event.csensor.timestamp_us); event.csensor.timestamp_us);
break; break;
#endif /* VERBOSE_SENSORS */ #endif /* VERBOSE_SENSORS */
@ -608,7 +606,7 @@ loop(void *arg)
if (event.caxis.value <= (-SDL_JOYSTICK_AXIS_MAX / 2) || event.caxis.value >= (SDL_JOYSTICK_AXIS_MAX / 2)) { if (event.caxis.value <= (-SDL_JOYSTICK_AXIS_MAX / 2) || event.caxis.value >= (SDL_JOYSTICK_AXIS_MAX / 2)) {
SetController(event.caxis.which); SetController(event.caxis.which);
} }
SDL_Log("Controller %d axis %s changed to %d\n", event.caxis.which, SDL_GameControllerGetStringForAxis((SDL_GameControllerAxis)event.caxis.axis), event.caxis.value); SDL_Log("Controller %" SDL_PRIs32 " axis %s changed to %d\n", event.caxis.which, SDL_GameControllerGetStringForAxis((SDL_GameControllerAxis) event.caxis.axis), event.caxis.value);
break; break;
#endif /* VERBOSE_AXES */ #endif /* VERBOSE_AXES */
@ -617,7 +615,7 @@ loop(void *arg)
if (event.type == SDL_CONTROLLERBUTTONDOWN) { if (event.type == SDL_CONTROLLERBUTTONDOWN) {
SetController(event.cbutton.which); SetController(event.cbutton.which);
} }
SDL_Log("Controller %d button %s %s\n", event.cbutton.which, SDL_GameControllerGetStringForButton((SDL_GameControllerButton)event.cbutton.button), event.cbutton.state ? "pressed" : "released"); SDL_Log("Controller %" SDL_PRIs32 " button %s %s\n", event.cbutton.which, SDL_GameControllerGetStringForButton((SDL_GameControllerButton) event.cbutton.button), event.cbutton.state ? "pressed" : "released");
/* Cycle PS5 trigger effects when the microphone button is pressed */ /* Cycle PS5 trigger effects when the microphone button is pressed */
if (event.type == SDL_CONTROLLERBUTTONDOWN && if (event.type == SDL_CONTROLLERBUTTONDOWN &&
@ -628,7 +626,7 @@ loop(void *arg)
break; break;
case SDL_JOYBATTERYUPDATED: case SDL_JOYBATTERYUPDATED:
SDL_Log("Controller %d battery state changed to %s\n", event.jbattery.which, power_level_strings[event.jbattery.level + 1]); SDL_Log("Controller %" SDL_PRIs32 " battery state changed to %s\n", event.jbattery.which, power_level_strings[event.jbattery.level + 1]);
break; break;
case SDL_MOUSEBUTTONDOWN: case SDL_MOUSEBUTTONDOWN:

View File

@ -79,7 +79,7 @@ main(int argc, char *argv[])
{ {
joystick = SDL_JoystickOpen(event.jdevice.which); joystick = SDL_JoystickOpen(event.jdevice.which);
instance = SDL_JoystickInstanceID(joystick); instance = SDL_JoystickInstanceID(joystick);
SDL_Log("Joy Added : %d : %s\n", event.jdevice.which, SDL_JoystickName(joystick)); SDL_Log("Joy Added : %" SDL_PRIs32 " : %s\n", event.jdevice.which, SDL_JoystickName(joystick));
if (enable_haptic) if (enable_haptic)
{ {
if (SDL_JoystickIsHaptic(joystick)) if (SDL_JoystickIsHaptic(joystick))
@ -108,7 +108,7 @@ main(int argc, char *argv[])
case SDL_JOYDEVICEREMOVED: case SDL_JOYDEVICEREMOVED:
if (instance == event.jdevice.which) if (instance == event.jdevice.which)
{ {
SDL_Log("Joy Removed: %d\n", event.jdevice.which); SDL_Log("Joy Removed: %" SDL_PRIs32 "\n", event.jdevice.which);
instance = -1; instance = -1;
if(enable_haptic && haptic) if(enable_haptic && haptic)
{ {

View File

@ -213,7 +213,7 @@ static int unifont_init(const char *fontname)
if (codepoint <= UNIFONT_MAX_CODEPOINT) if (codepoint <= UNIFONT_MAX_CODEPOINT)
{ {
if (unifontGlyph[codepoint].width > 0) if (unifontGlyph[codepoint].width > 0)
SDL_LogWarn(SDL_LOG_CATEGORY_APPLICATION, "unifont: Ignoring duplicate codepoint 0x%08x in hex file on line %d.\n", codepoint, lineNumber); SDL_LogWarn(SDL_LOG_CATEGORY_APPLICATION, "unifont: Ignoring duplicate codepoint 0x%08" SDL_PRIx32 " in hex file on line %d.\n", codepoint, lineNumber);
else else
{ {
unifontGlyph[codepoint].width = glyphWidth; unifontGlyph[codepoint].width = glyphWidth;
@ -228,7 +228,7 @@ static int unifont_init(const char *fontname)
} while (bytesRead > 0); } while (bytesRead > 0);
SDL_RWclose(hexFile); SDL_RWclose(hexFile);
SDL_Log("unifont: Loaded %u glyphs.\n", numGlyphs); SDL_Log("unifont: Loaded %" SDL_PRIu32 " glyphs.\n", numGlyphs);
return 0; return 0;
} }
@ -275,7 +275,7 @@ static int unifont_load_texture(Uint32 textureID)
if (textureID >= UNIFONT_NUM_TEXTURES) if (textureID >= UNIFONT_NUM_TEXTURES)
{ {
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "unifont: Tried to load out of range texture %u.\n", textureID); SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "unifont: Tried to load out of range texture %" SDL_PRIu32 "\n", textureID);
return -1; return -1;
} }
@ -309,14 +309,14 @@ static int unifont_load_texture(Uint32 textureID)
tex = SDL_CreateTexture(renderer, SDL_PIXELFORMAT_ARGB8888, SDL_TEXTUREACCESS_STATIC, UNIFONT_TEXTURE_WIDTH, UNIFONT_TEXTURE_WIDTH); tex = SDL_CreateTexture(renderer, SDL_PIXELFORMAT_ARGB8888, SDL_TEXTUREACCESS_STATIC, UNIFONT_TEXTURE_WIDTH, UNIFONT_TEXTURE_WIDTH);
if (tex == NULL) if (tex == NULL)
{ {
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "unifont: Failed to create texture %u for renderer %d.\n", textureID, i); SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "unifont: Failed to create texture %" SDL_PRIu32 " for renderer %d.\n", textureID, i);
return -1; return -1;
} }
unifontTexture[UNIFONT_NUM_TEXTURES * i + textureID] = tex; unifontTexture[UNIFONT_NUM_TEXTURES * i + textureID] = tex;
SDL_SetTextureBlendMode(tex, SDL_BLENDMODE_BLEND); SDL_SetTextureBlendMode(tex, SDL_BLENDMODE_BLEND);
if (SDL_UpdateTexture(tex, NULL, textureRGBA, UNIFONT_TEXTURE_PITCH) != 0) if (SDL_UpdateTexture(tex, NULL, textureRGBA, UNIFONT_TEXTURE_PITCH) != 0)
{ {
SDL_Log("unifont error: Failed to update texture %u data for renderer %d.\n", textureID, i); SDL_Log("unifont error: Failed to update texture %" SDL_PRIu32 " data for renderer %d.\n", textureID, i);
} }
} }
@ -762,10 +762,11 @@ int main(int argc, char *argv[])
break; break;
} }
SDL_Log("Keyboard: scancode 0x%08X = %s, keycode 0x%08X = %s\n", SDL_Log("Keyboard: scancode 0x%08X = %s, keycode 0x%08" SDL_PRIX32 " = %s\n",
event.key.keysym.scancode, event.key.keysym.scancode,
SDL_GetScancodeName(event.key.keysym.scancode), SDL_GetScancodeName(event.key.keysym.scancode),
event.key.keysym.sym, SDL_GetKeyName(event.key.keysym.sym)); SDL_static_cast(Uint32, event.key.keysym.sym),
SDL_GetKeyName(event.key.keysym.sym));
break; break;
case SDL_TEXTINPUT: case SDL_TEXTINPUT:
@ -787,7 +788,7 @@ int main(int argc, char *argv[])
break; break;
case SDL_TEXTEDITING: case SDL_TEXTEDITING:
SDL_Log("text editing \"%s\", selected range (%d, %d)\n", SDL_Log("text editing \"%s\", selected range (%" SDL_PRIs32 ", %" SDL_PRIs32 ")\n",
event.edit.text, event.edit.start, event.edit.length); event.edit.text, event.edit.start, event.edit.length);
SDL_strlcpy(markedText, event.edit.text, SDL_TEXTEDITINGEVENT_TEXT_SIZE); SDL_strlcpy(markedText, event.edit.text, SDL_TEXTEDITINGEVENT_TEXT_SIZE);

View File

@ -87,7 +87,7 @@ PrintJoystick(SDL_Joystick *joy)
SDL_Log(" balls: %d\n", SDL_JoystickNumBalls(joy)); SDL_Log(" balls: %d\n", SDL_JoystickNumBalls(joy));
SDL_Log(" hats: %d\n", SDL_JoystickNumHats(joy)); SDL_Log(" hats: %d\n", SDL_JoystickNumHats(joy));
SDL_Log(" buttons: %d\n", SDL_JoystickNumButtons(joy)); SDL_Log(" buttons: %d\n", SDL_JoystickNumButtons(joy));
SDL_Log(" instance id: %d\n", SDL_JoystickInstanceID(joy)); SDL_Log(" instance id: %" SDL_PRIs32 "\n", SDL_JoystickInstanceID(joy));
SDL_Log(" guid: %s\n", guid); SDL_Log(" guid: %s\n", guid);
SDL_Log(" VID/PID: 0x%.4x/0x%.4x\n", SDL_JoystickGetVendor(joy), SDL_JoystickGetProduct(joy)); SDL_Log(" VID/PID: 0x%.4x/0x%.4x\n", SDL_JoystickGetVendor(joy), SDL_JoystickGetProduct(joy));
} }
@ -137,13 +137,13 @@ loop(void *arg)
break; break;
case SDL_JOYAXISMOTION: case SDL_JOYAXISMOTION:
SDL_Log("Joystick %d axis %d value: %d\n", SDL_Log("Joystick %" SDL_PRIs32 " axis %d value: %d\n",
event.jaxis.which, event.jaxis.which,
event.jaxis.axis, event.jaxis.value); event.jaxis.axis, event.jaxis.value);
break; break;
case SDL_JOYHATMOTION: case SDL_JOYHATMOTION:
SDL_Log("Joystick %d hat %d value:", SDL_Log("Joystick %" SDL_PRIs32 " hat %d value:",
event.jhat.which, event.jhat.hat); event.jhat.which, event.jhat.hat);
if (event.jhat.value == SDL_HAT_CENTERED) if (event.jhat.value == SDL_HAT_CENTERED)
SDL_Log(" centered"); SDL_Log(" centered");
if (event.jhat.value & SDL_HAT_UP) if (event.jhat.value & SDL_HAT_UP)
@ -157,21 +157,21 @@ loop(void *arg)
SDL_Log("\n"); SDL_Log("\n");
break; break;
case SDL_JOYBALLMOTION: case SDL_JOYBALLMOTION:
SDL_Log("Joystick %d ball %d delta: (%d,%d)\n", SDL_Log("Joystick %" SDL_PRIs32 " ball %d delta: (%d,%d)\n",
event.jball.which, event.jball.which,
event.jball.ball, event.jball.xrel, event.jball.yrel); event.jball.ball, event.jball.xrel, event.jball.yrel);
break; break;
case SDL_JOYBUTTONDOWN: case SDL_JOYBUTTONDOWN:
SDL_Log("Joystick %d button %d down\n", SDL_Log("Joystick %" SDL_PRIs32 " button %d down\n",
event.jbutton.which, event.jbutton.button); event.jbutton.which, event.jbutton.button);
/* First button triggers a 0.5 second full strength rumble */ /* First button triggers a 0.5 second full strength rumble */
if (event.jbutton.button == 0) { if (event.jbutton.button == 0) {
SDL_JoystickRumble(joystick, 0xFFFF, 0xFFFF, 500); SDL_JoystickRumble(joystick, 0xFFFF, 0xFFFF, 500);
} }
break; break;
case SDL_JOYBUTTONUP: case SDL_JOYBUTTONUP:
SDL_Log("Joystick %d button %d up\n", SDL_Log("Joystick %" SDL_PRIs32 " button %d up\n",
event.jbutton.which, event.jbutton.button); event.jbutton.which, event.jbutton.button);
break; break;
case SDL_KEYDOWN: case SDL_KEYDOWN:
/* Press the L key to lag for 3 seconds, to see what happens /* Press the L key to lag for 3 seconds, to see what happens

View File

@ -66,8 +66,8 @@ save_surface_to_bmp()
surface = SDL_CreateRGBSurface(0, width, height, bbp, r_mask, g_mask, b_mask, a_mask); surface = SDL_CreateRGBSurface(0, width, height, bbp, r_mask, g_mask, b_mask, a_mask);
SDL_RenderReadPixels(renderer, NULL, pixel_format, (void*)surface->pixels, surface->pitch); SDL_RenderReadPixels(renderer, NULL, pixel_format, (void*)surface->pixels, surface->pitch);
SDL_snprintf(file, sizeof(file), "SDL_window%d-%8.8d.bmp", SDL_snprintf(file, sizeof(file), "SDL_window%" SDL_PRIs32 "-%8.8d.bmp",
SDL_GetWindowID(window), ++frame_number); SDL_GetWindowID(window), ++frame_number);
SDL_SaveBMP(surface, file); SDL_SaveBMP(surface, file);
SDL_FreeSurface(surface); SDL_FreeSurface(surface);
@ -154,7 +154,7 @@ main(int argc, char *argv[])
now = SDL_GetTicks(); now = SDL_GetTicks();
if (now > then) { if (now > then) {
double fps = ((double) frames * 1000) / (now - then); double fps = ((double) frames * 1000) / (now - then);
SDL_Log("Frames remaining: %i rendering at %2.2f frames per second\n", max_frames - frames, fps); SDL_Log("Frames remaining: %" SDL_PRIu32 " rendering at %2.2f frames per second\n", max_frames - frames, fps);
} }
} }
} }

View File

@ -149,8 +149,9 @@ TestEndian(SDL_bool verbose)
++error; ++error;
} }
if (verbose) { if (verbose) {
SDL_Log("Value 32 = 0x%X, swapped = 0x%X\n", value32, SDL_Log("Value 32 = 0x%" SDL_PRIX32 ", swapped = 0x%" SDL_PRIX32 "\n",
SDL_Swap32(value32)); value32,
SDL_Swap32(value32));
} }
if (SDL_Swap32(value32) != swapped32) { if (SDL_Swap32(value32) != swapped32) {
if (verbose) { if (verbose) {

View File

@ -72,7 +72,7 @@ DrawComposite(DrawState *s)
SDL_RenderCopy(s->renderer, A, NULL, NULL); SDL_RenderCopy(s->renderer, A, NULL, NULL);
SDL_RenderReadPixels(s->renderer, NULL, SDL_PIXELFORMAT_ARGB8888, &P, sizeof(P)); SDL_RenderReadPixels(s->renderer, NULL, SDL_PIXELFORMAT_ARGB8888, &P, sizeof(P));
SDL_Log("Blended pixel: 0x%8.8X\n", P); SDL_Log("Blended pixel: 0x%8.8" SDL_PRIX32 "\n", P);
SDL_DestroyTexture(A); SDL_DestroyTexture(A);
SDL_DestroyTexture(B); SDL_DestroyTexture(B);

View File

@ -47,11 +47,11 @@ ThreadFuncRealWorld(void *data)
Thread_State *state = (Thread_State *) data; Thread_State *state = (Thread_State *) data;
while (alive) { while (alive) {
SDL_SemWait(sem); SDL_SemWait(sem);
SDL_Log("Thread number %d has got the semaphore (value = %d)!\n", SDL_Log("Thread number %d has got the semaphore (value = %" SDL_PRIu32 ")!\n",
state->number, SDL_SemValue(sem)); state->number, SDL_SemValue(sem));
SDL_Delay(200); SDL_Delay(200);
SDL_SemPost(sem); SDL_SemPost(sem);
SDL_Log("Thread number %d has released the semaphore (value = %d)!\n", SDL_Log("Thread number %d has released the semaphore (value = %" SDL_PRIu32 ")!\n",
state->number, SDL_SemValue(sem)); state->number, SDL_SemValue(sem));
++state->loop_count; ++state->loop_count;
SDL_Delay(1); /* For the scheduler */ SDL_Delay(1); /* For the scheduler */
@ -114,7 +114,7 @@ TestWaitTimeout(void)
/* Accept a little offset in the effective wait */ /* Accept a little offset in the effective wait */
SDL_assert(duration > 1900 && duration < 2050); SDL_assert(duration > 1900 && duration < 2050);
SDL_Log("Wait took %d milliseconds\n\n", duration); SDL_Log("Wait took %" SDL_PRIu32 " milliseconds\n\n", duration);
/* Check to make sure the return value indicates timed out */ /* Check to make sure the return value indicates timed out */
if (retval != SDL_MUTEX_TIMEDOUT) if (retval != SDL_MUTEX_TIMEDOUT)
@ -146,7 +146,7 @@ TestOverheadUncontended(void)
end_ticks = SDL_GetTicks(); end_ticks = SDL_GetTicks();
duration = end_ticks - start_ticks; duration = end_ticks - start_ticks;
SDL_Log("Took %d milliseconds\n\n", duration); SDL_Log("Took %" SDL_PRIu32 " milliseconds\n\n", duration);
SDL_DestroySemaphore(sem); SDL_DestroySemaphore(sem);
} }
@ -221,9 +221,9 @@ TestOverheadContended(SDL_bool try_wait)
SDL_assert_release((loop_count - content_count) == NUM_OVERHEAD_OPS * NUM_OVERHEAD_OPS_MULT); SDL_assert_release((loop_count - content_count) == NUM_OVERHEAD_OPS * NUM_OVERHEAD_OPS_MULT);
duration = end_ticks - start_ticks; duration = end_ticks - start_ticks;
SDL_Log("Took %d milliseconds, threads %s %d out of %d times in total (%.2f%%)\n", SDL_Log("Took %" SDL_PRIu32 " milliseconds, threads %s %d out of %d times in total (%.2f%%)\n",
duration, try_wait ? "where contended" : "timed out", content_count, duration, try_wait ? "where contended" : "timed out", content_count,
loop_count, ((float)content_count * 100) / loop_count); loop_count, ((float) content_count * 100) / loop_count);
/* Print how many semaphores where consumed per thread */ /* Print how many semaphores where consumed per thread */
SDL_snprintf(textBuffer, sizeof(textBuffer), "{ "); SDL_snprintf(textBuffer, sizeof(textBuffer), "{ ");
for (i = 0; i < NUM_THREADS; ++i) { for (i = 0; i < NUM_THREADS; ++i) {

View File

@ -72,16 +72,16 @@ main(int argc, char **argv)
SDL_Log("There are %d sensors available\n", num_sensors); SDL_Log("There are %d sensors available\n", num_sensors);
for (i = 0; i < num_sensors; ++i) { for (i = 0; i < num_sensors; ++i) {
SDL_Log("Sensor %d: %s, type %s, platform type %d\n", SDL_Log("Sensor %" SDL_PRIs32 ": %s, type %s, platform type %d\n",
SDL_SensorGetDeviceInstanceID(i), SDL_SensorGetDeviceInstanceID(i),
SDL_SensorGetDeviceName(i), SDL_SensorGetDeviceName(i),
GetSensorTypeString(SDL_SensorGetDeviceType(i)), GetSensorTypeString(SDL_SensorGetDeviceType(i)),
SDL_SensorGetDeviceNonPortableType(i)); SDL_SensorGetDeviceNonPortableType(i));
if (SDL_SensorGetDeviceType(i) != SDL_SENSOR_UNKNOWN) { if (SDL_SensorGetDeviceType(i) != SDL_SENSOR_UNKNOWN) {
SDL_Sensor *sensor = SDL_SensorOpen(i); SDL_Sensor *sensor = SDL_SensorOpen(i);
if (sensor == NULL) { if (sensor == NULL) {
SDL_Log("Couldn't open sensor %d: %s\n", SDL_SensorGetDeviceInstanceID(i), SDL_GetError()); SDL_Log("Couldn't open sensor %" SDL_PRIs32 ": %s\n", SDL_SensorGetDeviceInstanceID(i), SDL_GetError());
} else { } else {
++num_opened; ++num_opened;
} }

View File

@ -33,7 +33,7 @@ ticktock(Uint32 interval, void *param)
static Uint32 SDLCALL static Uint32 SDLCALL
callback(Uint32 interval, void *param) callback(Uint32 interval, void *param)
{ {
SDL_Log("Timer %d : param = %d\n", interval, (int) (uintptr_t) param); SDL_Log("Timer %" SDL_PRIu32 " : param = %d\n", interval, (int) (uintptr_t) param);
return interval; return interval;
} }

View File

@ -1101,7 +1101,7 @@ int main(int argc, char **argv)
} }
SDL_GetCurrentDisplayMode(0, &mode); SDL_GetCurrentDisplayMode(0, &mode);
SDL_Log("Screen BPP : %d\n", SDL_BITSPERPIXEL(mode.format)); SDL_Log("Screen BPP : %" SDL_PRIu32 "\n", SDL_BITSPERPIXEL(mode.format));
SDL_GetWindowSize(state->windows[0], &dw, &dh); SDL_GetWindowSize(state->windows[0], &dw, &dh);
SDL_Log("Window Size : %d,%d\n", dw, dh); SDL_Log("Window Size : %d,%d\n", dw, dh);
SDL_Vulkan_GetDrawableSize(state->windows[0], &dw, &dh); SDL_Vulkan_GetDrawableSize(state->windows[0], &dw, &dh);

View File

@ -156,20 +156,20 @@ loop()
if (event.window.event == SDL_WINDOWEVENT_RESIZED) { if (event.window.event == SDL_WINDOWEVENT_RESIZED) {
SDL_Window *window = SDL_GetWindowFromID(event.window.windowID); SDL_Window *window = SDL_GetWindowFromID(event.window.windowID);
if (window) { if (window) {
SDL_Log("Window %d resized to %dx%d\n", SDL_Log("Window %" SDL_PRIu32 " resized to %" SDL_PRIs32 "x%" SDL_PRIs32 "\n",
event.window.windowID, event.window.windowID,
event.window.data1, event.window.data1,
event.window.data2); event.window.data2);
} }
} }
if (event.window.event == SDL_WINDOWEVENT_MOVED) { if (event.window.event == SDL_WINDOWEVENT_MOVED) {
SDL_Window *window = SDL_GetWindowFromID(event.window.windowID); SDL_Window *window = SDL_GetWindowFromID(event.window.windowID);
if (window) { if (window) {
SDL_Log("Window %d moved to %d,%d (display %s)\n", SDL_Log("Window %" SDL_PRIu32 " moved to %" SDL_PRIs32 ",%" SDL_PRIs32 " (display %s)\n",
event.window.windowID, event.window.windowID,
event.window.data1, event.window.data1,
event.window.data2, event.window.data2,
SDL_GetDisplayName(SDL_GetWindowDisplayIndex(window))); SDL_GetDisplayName(SDL_GetWindowDisplayIndex(window)));
} }
} }
if (event.window.event == SDL_WINDOWEVENT_FOCUS_LOST) { if (event.window.event == SDL_WINDOWEVENT_FOCUS_LOST) {

View File

@ -354,7 +354,7 @@ main(int argc, char **argv)
SDL_ConvertPixels(original->w, original->h, yuv_format, raw_yuv, pitch, rgb_format, converted->pixels, converted->pitch); SDL_ConvertPixels(original->w, original->h, yuv_format, raw_yuv, pitch, rgb_format, converted->pixels, converted->pitch);
} }
now = SDL_GetTicks(); now = SDL_GetTicks();
SDL_LogInfo(SDL_LOG_CATEGORY_APPLICATION, "%d iterations in %d ms, %.2fms each\n", iterations, (now - then), (float)(now - then)/iterations); SDL_LogInfo(SDL_LOG_CATEGORY_APPLICATION, "%" SDL_PRIu32 " iterations in %" SDL_PRIu32 " ms, %.2fms each\n", iterations, (now - then), (float) (now - then) / iterations);
window = SDL_CreateWindow("YUV test", window = SDL_CreateWindow("YUV test",
SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED,