Fix some format specifier warnings

The warnings were produced by GCC 9.2.x for x86_64-linux-gnu or
i386-pc-msdosdjgpp targets.

Most of the fixes involve changing the type of a variable rather than
the format specifier. For many of the affected test conuter variables,
a basic int seems sufficient.

Some format specifier warnings still remain for cases where changing
type or casting seemed inappropriate. Those warnings will probably
require some new format specifier macros (e.g. SDL_PRIu32).
This commit is contained in:
Jay Petacat
2020-03-25 01:34:15 -04:00
parent dad73b1f0c
commit c760c02c6c
5 changed files with 16 additions and 16 deletions

View File

@@ -62,7 +62,7 @@ main(int argc, char *argv[])
}
else if (SDL_strcasecmp(argv[i], "--execKey") == 0) {
if (argv[i + 1]) {
SDL_sscanf(argv[i + 1], "%"SDL_PRIu64, (long long unsigned int *)&userExecKey);
SDL_sscanf(argv[i + 1], "%"SDL_PRIu64, &userExecKey);
consumed = 2;
}
}

View File

@@ -1163,7 +1163,7 @@ sdltest_randomAsciiStringWithMaximumLength(void *arg)
targetLen = 16 + SDLTest_RandomUint8();
result = SDLTest_RandomAsciiStringWithMaximumLength((int) targetLen);
SDLTest_AssertPass("Call to SDLTest_RandomAsciiStringWithMaximumLength(%d)", targetLen);
SDLTest_AssertPass("Call to SDLTest_RandomAsciiStringWithMaximumLength(%d)", (int) targetLen);
SDLTest_AssertCheck(result != NULL, "Validate that result is not NULL");
if (result != NULL) {
len = SDL_strlen(result);
@@ -1184,7 +1184,7 @@ sdltest_randomAsciiStringWithMaximumLength(void *arg)
/* Negative test */
targetLen = 0;
result = SDLTest_RandomAsciiStringWithMaximumLength((int) targetLen);
SDLTest_AssertPass("Call to SDLTest_RandomAsciiStringWithMaximumLength(%d)", targetLen);
SDLTest_AssertPass("Call to SDLTest_RandomAsciiStringWithMaximumLength(%d)", (int) targetLen);
SDLTest_AssertCheck(result == NULL, "Validate that result is NULL");
lastError = (char *)SDL_GetError();
SDLTest_AssertPass("SDL_GetError()");
@@ -1217,7 +1217,7 @@ sdltest_randomAsciiStringOfSize(void *arg)
/* Positive test */
targetLen = 16 + SDLTest_RandomUint8();
result = SDLTest_RandomAsciiStringOfSize((int) targetLen);
SDLTest_AssertPass("Call to SDLTest_RandomAsciiStringOfSize(%d)", targetLen);
SDLTest_AssertPass("Call to SDLTest_RandomAsciiStringOfSize(%d)", (int) targetLen);
SDLTest_AssertCheck(result != NULL, "Validate that result is not NULL");
if (result != NULL) {
len = SDL_strlen(result);
@@ -1238,7 +1238,7 @@ sdltest_randomAsciiStringOfSize(void *arg)
/* Negative test */
targetLen = 0;
result = SDLTest_RandomAsciiStringOfSize((int) targetLen);
SDLTest_AssertPass("Call to SDLTest_RandomAsciiStringOfSize(%d)", targetLen);
SDLTest_AssertPass("Call to SDLTest_RandomAsciiStringOfSize(%d)", (int) targetLen);
SDLTest_AssertCheck(result == NULL, "Validate that result is NULL");
lastError = (char *)SDL_GetError();
SDLTest_AssertPass("SDL_GetError()");

View File

@@ -107,7 +107,7 @@ main(int argc, char *argv[])
now = SDL_GetPerformanceCounter();
SDL_Log("1 million iterations of ticktock took %f ms\n", (double)((now - start)*1000) / SDL_GetPerformanceFrequency());
SDL_Log("Performance counter frequency: %"SDL_PRIu64"\n", (unsigned long long) SDL_GetPerformanceFrequency());
SDL_Log("Performance counter frequency: %"SDL_PRIu64"\n", SDL_GetPerformanceFrequency());
start32 = SDL_GetTicks();
start = SDL_GetPerformanceCounter();
SDL_Delay(1000);