Fix warning drop const qualifier

main
Sylvain 2023-03-08 21:18:02 +01:00 committed by Sylvain Becker
parent ba87b96cea
commit 4053876bf6
6 changed files with 69 additions and 69 deletions

View File

@ -19,7 +19,7 @@ typedef struct SDLTest_SurfaceImage_s {
int width;
int height;
unsigned int bytes_per_pixel; /* 3:RGB, 4:RGBA */
const char *pixel_data;
char *pixel_data;
} SDLTest_SurfaceImage_t;
/* Test images */

View File

@ -18,16 +18,16 @@
static int keyboard_getKeyboardState(void *arg)
{
int numkeys;
Uint8 *state;
const Uint8 *state;
/* Case where numkeys pointer is NULL */
state = (Uint8 *)SDL_GetKeyboardState(NULL);
state = SDL_GetKeyboardState(NULL);
SDLTest_AssertPass("Call to SDL_GetKeyboardState(NULL)");
SDLTest_AssertCheck(state != NULL, "Validate that return value from SDL_GetKeyboardState is not NULL");
/* Case where numkeys pointer is not NULL */
numkeys = -1;
state = (Uint8 *)SDL_GetKeyboardState(&numkeys);
state = SDL_GetKeyboardState(&numkeys);
SDLTest_AssertPass("Call to SDL_GetKeyboardState(&numkeys)");
SDLTest_AssertCheck(state != NULL, "Validate that return value from SDL_GetKeyboardState is not NULL");
SDLTest_AssertCheck(numkeys >= 0, "Validate that value of numkeys is >= 0, got: %i", numkeys);
@ -164,42 +164,42 @@ static int keyboard_getKeyName(void *arg)
/* Case where key has a 1 character name */
expected = "3";
result = (char *)SDL_GetKeyName(SDLK_3);
result = SDL_GetKeyName(SDLK_3);
SDLTest_AssertPass("Call to SDL_GetKeyName()");
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);
/* Case where key has a 2 character name */
expected = "F1";
result = (char *)SDL_GetKeyName(SDLK_F1);
result = SDL_GetKeyName(SDLK_F1);
SDLTest_AssertPass("Call to SDL_GetKeyName()");
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);
/* Case where key has a 3 character name */
expected = "Cut";
result = (char *)SDL_GetKeyName(SDLK_CUT);
result = SDL_GetKeyName(SDLK_CUT);
SDLTest_AssertPass("Call to SDL_GetKeyName()");
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);
/* Case where key has a 4 character name */
expected = "Down";
result = (char *)SDL_GetKeyName(SDLK_DOWN);
result = SDL_GetKeyName(SDLK_DOWN);
SDLTest_AssertPass("Call to SDL_GetKeyName()");
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);
/* Case where key has a N character name */
expected = "BrightnessUp";
result = (char *)SDL_GetKeyName(SDLK_BRIGHTNESSUP);
result = SDL_GetKeyName(SDLK_BRIGHTNESSUP);
SDLTest_AssertPass("Call to SDL_GetKeyName()");
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);
/* Case where key has a N character name with space */
expected = "Keypad MemStore";
result = (char *)SDL_GetKeyName(SDLK_KP_MEMSTORE);
result = SDL_GetKeyName(SDLK_KP_MEMSTORE);
SDLTest_AssertPass("Call to SDL_GetKeyName()");
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);
@ -224,7 +224,7 @@ static int keyboard_getScancodeNameNegative(void *arg)
/* Out-of-bounds scancode */
scancode = (SDL_Scancode)SDL_NUM_SCANCODES;
result = (char *)SDL_GetScancodeName(scancode);
result = SDL_GetScancodeName(scancode);
SDLTest_AssertPass("Call to SDL_GetScancodeName(%d/large)", scancode);
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);
@ -246,7 +246,7 @@ static int keyboard_getKeyNameNegative(void *arg)
/* Unknown keycode */
keycode = SDLK_UNKNOWN;
result = (char *)SDL_GetKeyName(keycode);
result = SDL_GetKeyName(keycode);
SDLTest_AssertPass("Call to SDL_GetKeyName(%" SDL_PRIs32 "/unknown)", keycode);
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);
@ -257,7 +257,7 @@ static int keyboard_getKeyNameNegative(void *arg)
/* Negative keycode */
keycode = (SDL_Keycode)SDLTest_RandomIntegerInRange(-255, -1);
result = (char *)SDL_GetKeyName(keycode);
result = SDL_GetKeyName(keycode);
SDLTest_AssertPass("Call to SDL_GetKeyName(%" SDL_PRIs32 "/negative)", keycode);
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);
@ -592,7 +592,7 @@ static void checkInvalidNameError(void)
*/
static int keyboard_getScancodeFromNameNegative(void *arg)
{
const char *name;
char *name;
SDL_Scancode scancode;
/* Clear error message */
@ -607,7 +607,7 @@ static int keyboard_getScancodeFromNameNegative(void *arg)
}
scancode = SDL_GetScancodeFromName(name);
SDLTest_AssertPass("Call to SDL_GetScancodeFromName('%s')", name);
SDL_free((void *)name);
SDL_free(name);
SDLTest_AssertCheck(scancode == SDL_SCANCODE_UNKNOWN, "Validate return value from SDL_GetScancodeFromName, expected: %i, got: %i", SDL_SCANCODE_UNKNOWN, scancode);
checkInvalidNameError();

View File

@ -126,12 +126,12 @@ static int platform_testEndianessAndSwap(void *arg)
*/
static int platform_testGetFunctions(void *arg)
{
char *platform;
char *revision;
const char *platform;
const char *revision;
int ret;
size_t len;
platform = (char *)SDL_GetPlatform();
platform = SDL_GetPlatform();
SDLTest_AssertPass("SDL_GetPlatform()");
SDLTest_AssertCheck(platform != NULL, "SDL_GetPlatform() != NULL");
if (platform != NULL) {
@ -154,7 +154,7 @@ static int platform_testGetFunctions(void *arg)
"SDL_GetCPUCacheLineSize(): expected size >= 0, was: %i",
ret);
revision = (char *)SDL_GetRevision();
revision = SDL_GetRevision();
SDLTest_AssertPass("SDL_GetRevision()");
SDLTest_AssertCheck(revision != NULL, "SDL_GetRevision() != NULL");
@ -284,13 +284,13 @@ static int platform_testGetSetClearError(void *arg)
{
int result;
const char *testError = "Testing";
char *lastError;
const char *lastError;
size_t len;
SDL_ClearError();
SDLTest_AssertPass("SDL_ClearError()");
lastError = (char *)SDL_GetError();
lastError = SDL_GetError();
SDLTest_AssertPass("SDL_GetError()");
SDLTest_AssertCheck(lastError != NULL,
"SDL_GetError() != NULL");
@ -303,7 +303,7 @@ static int platform_testGetSetClearError(void *arg)
result = SDL_SetError("%s", testError);
SDLTest_AssertPass("SDL_SetError()");
SDLTest_AssertCheck(result == -1, "SDL_SetError: expected -1, got: %i", result);
lastError = (char *)SDL_GetError();
lastError = SDL_GetError();
SDLTest_AssertCheck(lastError != NULL,
"SDL_GetError() != NULL");
if (lastError != NULL) {
@ -333,13 +333,13 @@ static int platform_testSetErrorEmptyInput(void *arg)
{
int result;
const char *testError = "";
char *lastError;
const char *lastError;
size_t len;
result = SDL_SetError("%s", testError);
SDLTest_AssertPass("SDL_SetError()");
SDLTest_AssertCheck(result == -1, "SDL_SetError: expected -1, got: %i", result);
lastError = (char *)SDL_GetError();
lastError = SDL_GetError();
SDLTest_AssertCheck(lastError != NULL,
"SDL_GetError() != NULL");
if (lastError != NULL) {
@ -375,7 +375,7 @@ static int platform_testSetErrorInvalidInput(void *arg)
int result;
const char *invalidError = NULL;
const char *probeError = "Testing";
char *lastError;
const char *lastError;
size_t len;
/* Reset */
@ -386,7 +386,7 @@ static int platform_testSetErrorInvalidInput(void *arg)
result = SDL_SetError("%s", invalidError);
SDLTest_AssertPass("SDL_SetError()");
SDLTest_AssertCheck(result == -1, "SDL_SetError: expected -1, got: %i", result);
lastError = (char *)SDL_GetError();
lastError = SDL_GetError();
SDLTest_AssertCheck(lastError != NULL,
"SDL_GetError() != NULL");
if (lastError != NULL) {
@ -405,7 +405,7 @@ static int platform_testSetErrorInvalidInput(void *arg)
result = SDL_SetError("%s", invalidError);
SDLTest_AssertPass("SDL_SetError(NULL)");
SDLTest_AssertCheck(result == -1, "SDL_SetError: expected -1, got: %i", result);
lastError = (char *)SDL_GetError();
lastError = SDL_GetError();
SDLTest_AssertCheck(lastError != NULL,
"SDL_GetError() != NULL");
if (lastError != NULL) {
@ -423,7 +423,7 @@ static int platform_testSetErrorInvalidInput(void *arg)
result = SDL_SetError("%s", probeError);
SDLTest_AssertPass("SDL_SetError()");
SDLTest_AssertCheck(result == -1, "SDL_SetError: expected -1, got: %i", result);
lastError = (char *)SDL_GetError();
lastError = SDL_GetError();
SDLTest_AssertCheck(lastError != NULL,
"SDL_GetError() != NULL");
if (lastError != NULL) {

View File

@ -136,7 +136,7 @@ static int sdltest_randomNumber(void *arg)
static int sdltest_randomBoundaryNumberUint8(void *arg)
{
const char *expectedError = "That operation is not supported";
char *lastError;
const char *lastError;
Uint64 uresult;
/* Clean error messages */
@ -205,7 +205,7 @@ static int sdltest_randomBoundaryNumberUint8(void *arg)
SDLTest_AssertCheck(
uresult == 0,
"Validate result value for parameters (1,255,SDL_FALSE); expected: 0, got: %" SDL_PRIs64, uresult);
lastError = (char *)SDL_GetError();
lastError = SDL_GetError();
SDLTest_AssertPass("SDL_GetError()");
SDLTest_AssertCheck(lastError == NULL || lastError[0] == '\0', "Validate no error message was set");
@ -215,7 +215,7 @@ static int sdltest_randomBoundaryNumberUint8(void *arg)
SDLTest_AssertCheck(
uresult == 0xff,
"Validate result value for parameters (0,254,SDL_FALSE); expected: 0xff, got: %" SDL_PRIs64, uresult);
lastError = (char *)SDL_GetError();
lastError = SDL_GetError();
SDLTest_AssertPass("SDL_GetError()");
SDLTest_AssertCheck(lastError == NULL || lastError[0] == '\0', "Validate no error message was set");
@ -225,7 +225,7 @@ static int sdltest_randomBoundaryNumberUint8(void *arg)
SDLTest_AssertCheck(
uresult == 0,
"Validate result value for parameters(0,255,SDL_FALSE); expected: 0, got: %" SDL_PRIs64, uresult);
lastError = (char *)SDL_GetError();
lastError = SDL_GetError();
SDLTest_AssertPass("SDL_GetError()");
SDLTest_AssertCheck(lastError != NULL && SDL_strcmp(lastError, expectedError) == 0,
"SDL_GetError(): expected message '%s', was message: '%s'",
@ -245,7 +245,7 @@ static int sdltest_randomBoundaryNumberUint8(void *arg)
static int sdltest_randomBoundaryNumberUint16(void *arg)
{
const char *expectedError = "That operation is not supported";
char *lastError;
const char *lastError;
Uint64 uresult;
/* Clean error messages */
@ -314,7 +314,7 @@ static int sdltest_randomBoundaryNumberUint16(void *arg)
SDLTest_AssertCheck(
uresult == 0,
"Validate result value for parameters (1,0xffff,SDL_FALSE); expected: 0, got: %" SDL_PRIs64, uresult);
lastError = (char *)SDL_GetError();
lastError = SDL_GetError();
SDLTest_AssertPass("SDL_GetError()");
SDLTest_AssertCheck(lastError == NULL || lastError[0] == '\0', "Validate no error message was set");
@ -324,7 +324,7 @@ static int sdltest_randomBoundaryNumberUint16(void *arg)
SDLTest_AssertCheck(
uresult == 0xffff,
"Validate result value for parameters (0,0xfffe,SDL_FALSE); expected: 0xffff, got: %" SDL_PRIs64, uresult);
lastError = (char *)SDL_GetError();
lastError = SDL_GetError();
SDLTest_AssertPass("SDL_GetError()");
SDLTest_AssertCheck(lastError == NULL || lastError[0] == '\0', "Validate no error message was set");
@ -334,7 +334,7 @@ static int sdltest_randomBoundaryNumberUint16(void *arg)
SDLTest_AssertCheck(
uresult == 0,
"Validate result value for parameters(0,0xffff,SDL_FALSE); expected: 0, got: %" SDL_PRIs64, uresult);
lastError = (char *)SDL_GetError();
lastError = SDL_GetError();
SDLTest_AssertPass("SDL_GetError()");
SDLTest_AssertCheck(lastError != NULL && SDL_strcmp(lastError, expectedError) == 0,
"SDL_GetError(): expected message '%s', was message: '%s'",
@ -354,7 +354,7 @@ static int sdltest_randomBoundaryNumberUint16(void *arg)
static int sdltest_randomBoundaryNumberUint32(void *arg)
{
const char *expectedError = "That operation is not supported";
char *lastError;
const char *lastError;
Uint64 uresult;
/* Clean error messages */
@ -423,7 +423,7 @@ static int sdltest_randomBoundaryNumberUint32(void *arg)
SDLTest_AssertCheck(
uresult == 0,
"Validate result value for parameters (1,0xffffffff,SDL_FALSE); expected: 0, got: %" SDL_PRIs64, uresult);
lastError = (char *)SDL_GetError();
lastError = SDL_GetError();
SDLTest_AssertPass("SDL_GetError()");
SDLTest_AssertCheck(lastError == NULL || lastError[0] == '\0', "Validate no error message was set");
@ -433,7 +433,7 @@ static int sdltest_randomBoundaryNumberUint32(void *arg)
SDLTest_AssertCheck(
uresult == 0xffffffff,
"Validate result value for parameters (0,0xfffffffe,SDL_FALSE); expected: 0xffffffff, got: %" SDL_PRIs64, uresult);
lastError = (char *)SDL_GetError();
lastError = SDL_GetError();
SDLTest_AssertPass("SDL_GetError()");
SDLTest_AssertCheck(lastError == NULL || lastError[0] == '\0', "Validate no error message was set");
@ -443,7 +443,7 @@ static int sdltest_randomBoundaryNumberUint32(void *arg)
SDLTest_AssertCheck(
uresult == 0,
"Validate result value for parameters(0,0xffffffff,SDL_FALSE); expected: 0, got: %" SDL_PRIs64, uresult);
lastError = (char *)SDL_GetError();
lastError = SDL_GetError();
SDLTest_AssertPass("SDL_GetError()");
SDLTest_AssertCheck(lastError != NULL && SDL_strcmp(lastError, expectedError) == 0,
"SDL_GetError(): expected message '%s', was message: '%s'",
@ -463,7 +463,7 @@ static int sdltest_randomBoundaryNumberUint32(void *arg)
static int sdltest_randomBoundaryNumberUint64(void *arg)
{
const char *expectedError = "That operation is not supported";
char *lastError;
const char *lastError;
Uint64 uresult;
/* Clean error messages */
@ -532,7 +532,7 @@ static int sdltest_randomBoundaryNumberUint64(void *arg)
SDLTest_AssertCheck(
uresult == 0,
"Validate result value for parameters (1,0xffffffffffffffff,SDL_FALSE); expected: 0, got: %" SDL_PRIs64, uresult);
lastError = (char *)SDL_GetError();
lastError = SDL_GetError();
SDLTest_AssertPass("SDL_GetError()");
SDLTest_AssertCheck(lastError == NULL || lastError[0] == '\0', "Validate no error message was set");
@ -542,7 +542,7 @@ static int sdltest_randomBoundaryNumberUint64(void *arg)
SDLTest_AssertCheck(
uresult == 0xffffffffffffffffULL,
"Validate result value for parameters (0,0xfffffffffffffffe,SDL_FALSE); expected: 0xffffffffffffffff, got: %" SDL_PRIs64, uresult);
lastError = (char *)SDL_GetError();
lastError = SDL_GetError();
SDLTest_AssertPass("SDL_GetError()");
SDLTest_AssertCheck(lastError == NULL || lastError[0] == '\0', "Validate no error message was set");
@ -552,7 +552,7 @@ static int sdltest_randomBoundaryNumberUint64(void *arg)
SDLTest_AssertCheck(
uresult == 0,
"Validate result value for parameters(0,0xffffffffffffffff,SDL_FALSE); expected: 0, got: %" SDL_PRIs64, uresult);
lastError = (char *)SDL_GetError();
lastError = SDL_GetError();
SDLTest_AssertPass("SDL_GetError()");
SDLTest_AssertCheck(lastError != NULL && SDL_strcmp(lastError, expectedError) == 0,
"SDL_GetError(): expected message '%s', was message: '%s'",
@ -572,7 +572,7 @@ static int sdltest_randomBoundaryNumberUint64(void *arg)
static int sdltest_randomBoundaryNumberSint8(void *arg)
{
const char *expectedError = "That operation is not supported";
char *lastError;
const char *lastError;
Sint64 sresult;
/* Clean error messages */
@ -641,7 +641,7 @@ static int sdltest_randomBoundaryNumberSint8(void *arg)
SDLTest_AssertCheck(
sresult == SCHAR_MIN,
"Validate result value for parameters (SCHAR_MIN + 1,SCHAR_MAX,SDL_FALSE); expected: %d, got: %" SDL_PRIs64, SCHAR_MIN, sresult);
lastError = (char *)SDL_GetError();
lastError = SDL_GetError();
SDLTest_AssertPass("SDL_GetError()");
SDLTest_AssertCheck(lastError == NULL || lastError[0] == '\0', "Validate no error message was set");
@ -651,7 +651,7 @@ static int sdltest_randomBoundaryNumberSint8(void *arg)
SDLTest_AssertCheck(
sresult == SCHAR_MAX,
"Validate result value for parameters (SCHAR_MIN,SCHAR_MAX - 1,SDL_FALSE); expected: %d, got: %" SDL_PRIs64, SCHAR_MAX, sresult);
lastError = (char *)SDL_GetError();
lastError = SDL_GetError();
SDLTest_AssertPass("SDL_GetError()");
SDLTest_AssertCheck(lastError == NULL || lastError[0] == '\0', "Validate no error message was set");
@ -661,7 +661,7 @@ static int sdltest_randomBoundaryNumberSint8(void *arg)
SDLTest_AssertCheck(
sresult == SCHAR_MIN,
"Validate result value for parameters(SCHAR_MIN,SCHAR_MAX,SDL_FALSE); expected: %d, got: %" SDL_PRIs64, SCHAR_MIN, sresult);
lastError = (char *)SDL_GetError();
lastError = SDL_GetError();
SDLTest_AssertPass("SDL_GetError()");
SDLTest_AssertCheck(lastError != NULL && SDL_strcmp(lastError, expectedError) == 0,
"SDL_GetError(): expected message '%s', was message: '%s'",
@ -681,7 +681,7 @@ static int sdltest_randomBoundaryNumberSint8(void *arg)
static int sdltest_randomBoundaryNumberSint16(void *arg)
{
const char *expectedError = "That operation is not supported";
char *lastError;
const char *lastError;
Sint64 sresult;
/* Clean error messages */
@ -750,7 +750,7 @@ static int sdltest_randomBoundaryNumberSint16(void *arg)
SDLTest_AssertCheck(
sresult == SHRT_MIN,
"Validate result value for parameters (SHRT_MIN+1,SHRT_MAX,SDL_FALSE); expected: %d, got: %" SDL_PRIs64, SHRT_MIN, sresult);
lastError = (char *)SDL_GetError();
lastError = SDL_GetError();
SDLTest_AssertPass("SDL_GetError()");
SDLTest_AssertCheck(lastError == NULL || lastError[0] == '\0', "Validate no error message was set");
@ -760,7 +760,7 @@ static int sdltest_randomBoundaryNumberSint16(void *arg)
SDLTest_AssertCheck(
sresult == SHRT_MAX,
"Validate result value for parameters (SHRT_MIN,SHRT_MAX - 1,SDL_FALSE); expected: %d, got: %" SDL_PRIs64, SHRT_MAX, sresult);
lastError = (char *)SDL_GetError();
lastError = SDL_GetError();
SDLTest_AssertPass("SDL_GetError()");
SDLTest_AssertCheck(lastError == NULL || lastError[0] == '\0', "Validate no error message was set");
@ -770,7 +770,7 @@ static int sdltest_randomBoundaryNumberSint16(void *arg)
SDLTest_AssertCheck(
sresult == SHRT_MIN,
"Validate result value for parameters(SHRT_MIN,SHRT_MAX,SDL_FALSE); expected: %d, got: %" SDL_PRIs64, SHRT_MIN, sresult);
lastError = (char *)SDL_GetError();
lastError = SDL_GetError();
SDLTest_AssertPass("SDL_GetError()");
SDLTest_AssertCheck(lastError != NULL && SDL_strcmp(lastError, expectedError) == 0,
"SDL_GetError(): expected message '%s', was message: '%s'",
@ -790,7 +790,7 @@ static int sdltest_randomBoundaryNumberSint16(void *arg)
static int sdltest_randomBoundaryNumberSint32(void *arg)
{
const char *expectedError = "That operation is not supported";
char *lastError;
const char *lastError;
Sint64 sresult;
#if ((ULONG_MAX) == (UINT_MAX))
Sint32 long_min = LONG_MIN;
@ -866,7 +866,7 @@ static int sdltest_randomBoundaryNumberSint32(void *arg)
SDLTest_AssertCheck(
sresult == long_min,
"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 = SDL_GetError();
SDLTest_AssertPass("SDL_GetError()");
SDLTest_AssertCheck(lastError == NULL || lastError[0] == '\0', "Validate no error message was set");
@ -876,7 +876,7 @@ static int sdltest_randomBoundaryNumberSint32(void *arg)
SDLTest_AssertCheck(
sresult == long_max,
"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 = SDL_GetError();
SDLTest_AssertPass("SDL_GetError()");
SDLTest_AssertCheck(lastError == NULL || lastError[0] == '\0', "Validate no error message was set");
@ -886,7 +886,7 @@ static int sdltest_randomBoundaryNumberSint32(void *arg)
SDLTest_AssertCheck(
sresult == long_min,
"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 = SDL_GetError();
SDLTest_AssertPass("SDL_GetError()");
SDLTest_AssertCheck(lastError != NULL && SDL_strcmp(lastError, expectedError) == 0,
"SDL_GetError(): expected message '%s', was message: '%s'",
@ -906,7 +906,7 @@ static int sdltest_randomBoundaryNumberSint32(void *arg)
static int sdltest_randomBoundaryNumberSint64(void *arg)
{
const char *expectedError = "That operation is not supported";
char *lastError;
const char *lastError;
Sint64 sresult;
/* Clean error messages */
@ -975,7 +975,7 @@ static int sdltest_randomBoundaryNumberSint64(void *arg)
SDLTest_AssertCheck(
sresult == INT64_MIN,
"Validate result value for parameters (LLONG_MIN+1,LLONG_MAX,SDL_FALSE); expected: %" SDL_PRIs64 ", got: %" SDL_PRIs64, INT64_MIN, sresult);
lastError = (char *)SDL_GetError();
lastError = SDL_GetError();
SDLTest_AssertPass("SDL_GetError()");
SDLTest_AssertCheck(lastError == NULL || lastError[0] == '\0', "Validate no error message was set");
@ -985,7 +985,7 @@ static int sdltest_randomBoundaryNumberSint64(void *arg)
SDLTest_AssertCheck(
sresult == INT64_MAX,
"Validate result value for parameters (LLONG_MIN,LLONG_MAX - 1,SDL_FALSE); expected: %" SDL_PRIs64 ", got: %" SDL_PRIs64, INT64_MAX, sresult);
lastError = (char *)SDL_GetError();
lastError = SDL_GetError();
SDLTest_AssertPass("SDL_GetError()");
SDLTest_AssertCheck(lastError == NULL || lastError[0] == '\0', "Validate no error message was set");
@ -995,7 +995,7 @@ static int sdltest_randomBoundaryNumberSint64(void *arg)
SDLTest_AssertCheck(
sresult == INT64_MIN,
"Validate result value for parameters(LLONG_MIN,LLONG_MAX,SDL_FALSE); expected: %" SDL_PRIs64 ", got: %" SDL_PRIs64, INT64_MIN, sresult);
lastError = (char *)SDL_GetError();
lastError = SDL_GetError();
SDLTest_AssertPass("SDL_GetError()");
SDLTest_AssertCheck(lastError != NULL && SDL_strcmp(lastError, expectedError) == 0,
"SDL_GetError(): expected message '%s', was message: '%s'",
@ -1121,7 +1121,7 @@ static int sdltest_randomAsciiString(void *arg)
static int sdltest_randomAsciiStringWithMaximumLength(void *arg)
{
const char *expectedError = "Parameter 'maxLength' is invalid";
char *lastError;
const char *lastError;
char *result;
size_t targetLen;
size_t len;
@ -1153,7 +1153,7 @@ static int sdltest_randomAsciiStringWithMaximumLength(void *arg)
result = SDLTest_RandomAsciiStringWithMaximumLength((int)targetLen);
SDLTest_AssertPass("Call to SDLTest_RandomAsciiStringWithMaximumLength(%d)", (int)targetLen);
SDLTest_AssertCheck(result == NULL, "Validate that result is NULL");
lastError = (char *)SDL_GetError();
lastError = SDL_GetError();
SDLTest_AssertPass("SDL_GetError()");
SDLTest_AssertCheck(lastError != NULL && SDL_strcmp(lastError, expectedError) == 0,
"SDL_GetError(): expected message '%s', was message: '%s'",
@ -1173,7 +1173,7 @@ static int sdltest_randomAsciiStringWithMaximumLength(void *arg)
static int sdltest_randomAsciiStringOfSize(void *arg)
{
const char *expectedError = "Parameter 'size' is invalid";
char *lastError;
const char *lastError;
char *result;
size_t targetLen;
size_t len;
@ -1206,7 +1206,7 @@ static int sdltest_randomAsciiStringOfSize(void *arg)
result = SDLTest_RandomAsciiStringOfSize((int)targetLen);
SDLTest_AssertPass("Call to SDLTest_RandomAsciiStringOfSize(%d)", (int)targetLen);
SDLTest_AssertCheck(result == NULL, "Validate that result is NULL");
lastError = (char *)SDL_GetError();
lastError = SDL_GetError();
SDLTest_AssertPass("SDL_GetError()");
SDLTest_AssertCheck(lastError != NULL && SDL_strcmp(lastError, expectedError) == 0,
"SDL_GetError(): expected message '%s', was message: '%s'",

View File

@ -387,9 +387,9 @@ static int video_getWindowDisplayMode(void *arg)
static void checkInvalidWindowError(void)
{
const char *invalidWindowError = "Invalid window";
char *lastError;
const char *lastError;
lastError = (char *)SDL_GetError();
lastError = SDL_GetError();
SDLTest_AssertPass("SDL_GetError()");
SDLTest_AssertCheck(lastError != NULL, "Verify error message is not NULL");
if (lastError != NULL) {
@ -856,9 +856,9 @@ static int video_getSetWindowPosition(void *arg)
static void checkInvalidParameterError(void)
{
const char *invalidParameterError = "Parameter";
char *lastError;
const char *lastError;
lastError = (char *)SDL_GetError();
lastError = SDL_GetError();
SDLTest_AssertPass("SDL_GetError()");
SDLTest_AssertCheck(lastError != NULL, "Verify error message is not NULL");
if (lastError != NULL) {

View File

@ -970,7 +970,7 @@ run_test(void)
unsigned long abs[NBITS(ABS_MAX)];
unsigned long keys[NBITS(KEY_MAX)];
unsigned long rel[NBITS(REL_MAX)];
} caps = {};
} caps;
printf("%s...\n", t->name);