mirror of https://github.com/encounter/SDL.git
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:
parent
dad73b1f0c
commit
c760c02c6c
|
@ -36,10 +36,10 @@
|
|||
#define SDLTEST_ASSERT_SUMMARY_FORMAT "Assert Summary: Total=%d Passed=%d Failed=%d"
|
||||
|
||||
/* ! \brief counts the failed asserts */
|
||||
static Uint32 SDLTest_AssertsFailed = 0;
|
||||
static int SDLTest_AssertsFailed = 0;
|
||||
|
||||
/* ! \brief counts the passed asserts */
|
||||
static Uint32 SDLTest_AssertsPassed = 0;
|
||||
static int SDLTest_AssertsPassed = 0;
|
||||
|
||||
/*
|
||||
* Assert that logs and break execution flow on failures (i.e. for harness errors).
|
||||
|
@ -122,7 +122,7 @@ void SDLTest_ResetAssertSummary()
|
|||
*/
|
||||
void SDLTest_LogAssertSummary()
|
||||
{
|
||||
Uint32 totalAsserts = SDLTest_AssertsPassed + SDLTest_AssertsFailed;
|
||||
int totalAsserts = SDLTest_AssertsPassed + SDLTest_AssertsFailed;
|
||||
if (SDLTest_AssertsFailed == 0)
|
||||
{
|
||||
SDLTest_Log(SDLTEST_ASSERT_SUMMARY_FORMAT, totalAsserts, SDLTest_AssertsPassed, SDLTest_AssertsFailed);
|
||||
|
|
|
@ -394,13 +394,13 @@ int SDLTest_RunSuites(SDLTest_TestSuiteReference *testSuites[], const char *user
|
|||
SDL_bool forceTestRun = SDL_FALSE;
|
||||
int testResult = 0;
|
||||
int runResult = 0;
|
||||
Uint32 totalTestFailedCount = 0;
|
||||
Uint32 totalTestPassedCount = 0;
|
||||
Uint32 totalTestSkippedCount = 0;
|
||||
Uint32 testFailedCount = 0;
|
||||
Uint32 testPassedCount = 0;
|
||||
Uint32 testSkippedCount = 0;
|
||||
Uint32 countSum = 0;
|
||||
int totalTestFailedCount = 0;
|
||||
int totalTestPassedCount = 0;
|
||||
int totalTestSkippedCount = 0;
|
||||
int testFailedCount = 0;
|
||||
int testPassedCount = 0;
|
||||
int testSkippedCount = 0;
|
||||
int countSum = 0;
|
||||
const SDLTest_TestCaseReference **failedTests;
|
||||
|
||||
/* Sanitize test iterations */
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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()");
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Reference in New Issue