mirror of
https://github.com/libsdl-org/SDL.git
synced 2025-09-19 09:48:14 +00:00
Patch from Sylvain to fix clang warnings
This commit is contained in:
@@ -69,7 +69,7 @@ int SDLTest_Crc32Init(SDLTest_Crc32Context *crcContext)
|
||||
}
|
||||
|
||||
/* Complete CRC32 calculation on a memory block */
|
||||
|
||||
/* un-used
|
||||
int SDLTest_Crc32Calc(SDLTest_Crc32Context * crcContext, CrcUint8 *inBuf, CrcUint32 inLen, CrcUint32 *crc32)
|
||||
{
|
||||
if (SDLTest_Crc32CalcStart(crcContext,crc32)) {
|
||||
@@ -86,6 +86,7 @@ int SDLTest_Crc32Calc(SDLTest_Crc32Context * crcContext, CrcUint8 *inBuf, CrcUin
|
||||
|
||||
return 0;
|
||||
}
|
||||
*/
|
||||
|
||||
/* Start crc calculation */
|
||||
|
||||
|
@@ -196,7 +196,7 @@ SDLTest_RandomIntegerInRange(Sint32 pMin, Sint32 pMax)
|
||||
*
|
||||
* \returns Returns a random boundary value for the domain or 0 in case of error
|
||||
*/
|
||||
Uint64
|
||||
static Uint64
|
||||
SDLTest_GenerateUnsignedBoundaryValues(const Uint64 maxValue, Uint64 boundary1, Uint64 boundary2, SDL_bool validDomain)
|
||||
{
|
||||
Uint64 b1, b2;
|
||||
@@ -328,7 +328,7 @@ SDLTest_RandomUint64BoundaryValue(Uint64 boundary1, Uint64 boundary2, SDL_bool v
|
||||
*
|
||||
* \returns Returns a random boundary value for the domain or 0 in case of error
|
||||
*/
|
||||
Sint64
|
||||
static Sint64
|
||||
SDLTest_GenerateSignedBoundaryValues(const Sint64 minValue, const Sint64 maxValue, Sint64 boundary1, Sint64 boundary2, SDL_bool validDomain)
|
||||
{
|
||||
Sint64 b1, b2;
|
||||
|
@@ -50,7 +50,7 @@ static Uint32 SDLTest_TestCaseTimeout = 3600;
|
||||
*
|
||||
* \returns The generated seed string
|
||||
*/
|
||||
char *
|
||||
static char *
|
||||
SDLTest_GenerateRunSeed(const int length)
|
||||
{
|
||||
char *seed = NULL;
|
||||
@@ -97,8 +97,8 @@ SDLTest_GenerateRunSeed(const int length)
|
||||
* \returns The generated execution key to initialize the fuzzer with.
|
||||
*
|
||||
*/
|
||||
Uint64
|
||||
SDLTest_GenerateExecKey(char *runSeed, char *suiteName, char *testName, int iteration)
|
||||
static Uint64
|
||||
SDLTest_GenerateExecKey(const char *runSeed, char *suiteName, char *testName, int iteration)
|
||||
{
|
||||
SDLTest_Md5Context md5Context;
|
||||
Uint64 *keys;
|
||||
@@ -168,7 +168,7 @@ SDLTest_GenerateExecKey(char *runSeed, char *suiteName, char *testName, int iter
|
||||
*
|
||||
* \return Timer id or -1 on failure.
|
||||
*/
|
||||
SDL_TimerID
|
||||
static SDL_TimerID
|
||||
SDLTest_SetTestTimeout(int timeout, void (*callback)())
|
||||
{
|
||||
Uint32 timeoutInMilliseconds;
|
||||
@@ -206,8 +206,8 @@ SDLTest_SetTestTimeout(int timeout, void (*callback)())
|
||||
/**
|
||||
* \brief Timeout handler. Aborts test run and exits harness process.
|
||||
*/
|
||||
void
|
||||
SDLTest_BailOut()
|
||||
static void
|
||||
SDLTest_BailOut()
|
||||
{
|
||||
SDLTest_LogError("TestCaseTimeout timer expired. Aborting test run.");
|
||||
exit(TEST_ABORTED); /* bail out from the test */
|
||||
@@ -223,8 +223,8 @@ void
|
||||
*
|
||||
* \returns Test case result.
|
||||
*/
|
||||
int
|
||||
SDLTest_RunTest(SDLTest_TestSuiteReference *testSuite, SDLTest_TestCaseReference *testCase, Uint64 execKey, SDL_bool forceTestRun)
|
||||
static int
|
||||
SDLTest_RunTest(SDLTest_TestSuiteReference *testSuite, const SDLTest_TestCaseReference *testCase, Uint64 execKey, SDL_bool forceTestRun)
|
||||
{
|
||||
SDL_TimerID timer = 0;
|
||||
int testCaseResult = 0;
|
||||
@@ -313,7 +313,8 @@ SDLTest_RunTest(SDLTest_TestSuiteReference *testSuite, SDLTest_TestCaseReference
|
||||
}
|
||||
|
||||
/* Prints summary of all suites/tests contained in the given reference */
|
||||
void SDLTest_LogTestSuiteSummary(SDLTest_TestSuiteReference *testSuites)
|
||||
#if 0
|
||||
static void SDLTest_LogTestSuiteSummary(SDLTest_TestSuiteReference *testSuites)
|
||||
{
|
||||
int suiteCounter;
|
||||
int testCounter;
|
||||
@@ -340,12 +341,13 @@ void SDLTest_LogTestSuiteSummary(SDLTest_TestSuiteReference *testSuites)
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Gets a timer value in seconds */
|
||||
float GetClock()
|
||||
static float GetClock()
|
||||
{
|
||||
float currentClock = (float)clock();
|
||||
return currentClock / (float)CLOCKS_PER_SEC;
|
||||
float currentClock = clock() / (float) CLOCKS_PER_SEC;
|
||||
return currentClock;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -370,7 +372,7 @@ int SDLTest_RunSuites(SDLTest_TestSuiteReference *testSuites[], const char *user
|
||||
int testCounter;
|
||||
int iterationCounter;
|
||||
SDLTest_TestSuiteReference *testSuite;
|
||||
SDLTest_TestCaseReference *testCase;
|
||||
const SDLTest_TestCaseReference *testCase;
|
||||
const char *runSeed = NULL;
|
||||
char *currentSuiteName;
|
||||
char *currentTestName;
|
||||
@@ -396,7 +398,7 @@ int SDLTest_RunSuites(SDLTest_TestSuiteReference *testSuites[], const char *user
|
||||
Uint32 testPassedCount = 0;
|
||||
Uint32 testSkippedCount = 0;
|
||||
Uint32 countSum = 0;
|
||||
SDLTest_TestCaseReference **failedTests;
|
||||
const SDLTest_TestCaseReference **failedTests;
|
||||
|
||||
/* Sanitize test iterations */
|
||||
if (testIterations < 1) {
|
||||
@@ -440,7 +442,7 @@ int SDLTest_RunSuites(SDLTest_TestSuiteReference *testSuites[], const char *user
|
||||
}
|
||||
|
||||
/* Pre-allocate an array for tracking failed tests (potentially all test cases) */
|
||||
failedTests = (SDLTest_TestCaseReference **)SDL_malloc(totalNumberOfTests * sizeof(SDLTest_TestCaseReference *));
|
||||
failedTests = (const SDLTest_TestCaseReference **)SDL_malloc(totalNumberOfTests * sizeof(SDLTest_TestCaseReference *));
|
||||
if (failedTests == NULL) {
|
||||
SDLTest_LogError("Unable to allocate cache for failed tests");
|
||||
SDL_Error(SDL_ENOMEM);
|
||||
@@ -466,7 +468,7 @@ int SDLTest_RunSuites(SDLTest_TestSuiteReference *testSuites[], const char *user
|
||||
testCounter = 0;
|
||||
while (testSuite->testCases[testCounter] && testFilter == 0)
|
||||
{
|
||||
testCase=(SDLTest_TestCaseReference *)testSuite->testCases[testCounter];
|
||||
testCase = testSuite->testCases[testCounter];
|
||||
testCounter++;
|
||||
if (testCase->name != NULL && SDL_strcmp(filter, testCase->name) == 0) {
|
||||
/* Matched a test name */
|
||||
@@ -521,7 +523,7 @@ int SDLTest_RunSuites(SDLTest_TestSuiteReference *testSuites[], const char *user
|
||||
testCounter = 0;
|
||||
while(testSuite->testCases[testCounter])
|
||||
{
|
||||
testCase=(SDLTest_TestCaseReference *)testSuite->testCases[testCounter];
|
||||
testCase = testSuite->testCases[testCounter];
|
||||
currentTestName = (char *)((testCase->name) ? testCase->name : SDLTEST_INVALID_NAME_FORMAT);
|
||||
testCounter++;
|
||||
|
||||
@@ -562,7 +564,7 @@ int SDLTest_RunSuites(SDLTest_TestSuiteReference *testSuites[], const char *user
|
||||
if (userExecKey != 0) {
|
||||
execKey = userExecKey;
|
||||
} else {
|
||||
execKey = SDLTest_GenerateExecKey((char *)runSeed, testSuite->name, testCase->name, iterationCounter);
|
||||
execKey = SDLTest_GenerateExecKey(runSeed, testSuite->name, testCase->name, iterationCounter);
|
||||
}
|
||||
|
||||
SDLTest_Log("Test Iteration %i: execKey %" SDL_PRIu64, iterationCounter, execKey);
|
||||
|
@@ -24,7 +24,7 @@
|
||||
|
||||
/* GIMP RGB C-Source image dump (blit.c) */
|
||||
|
||||
const SDLTest_SurfaceImage_t SDLTest_imageBlit = {
|
||||
static const SDLTest_SurfaceImage_t SDLTest_imageBlit = {
|
||||
80, 60, 3,
|
||||
"\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
|
||||
"\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
|
||||
@@ -561,7 +561,7 @@ SDL_Surface *SDLTest_ImageBlit()
|
||||
return surface;
|
||||
}
|
||||
|
||||
const SDLTest_SurfaceImage_t SDLTest_imageBlitColor = {
|
||||
static const SDLTest_SurfaceImage_t SDLTest_imageBlitColor = {
|
||||
80, 60, 3,
|
||||
"\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
|
||||
"\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
|
||||
@@ -1044,7 +1044,7 @@ SDL_Surface *SDLTest_ImageBlitColor()
|
||||
return surface;
|
||||
}
|
||||
|
||||
const SDLTest_SurfaceImage_t SDLTest_imageBlitAlpha = {
|
||||
static const SDLTest_SurfaceImage_t SDLTest_imageBlitAlpha = {
|
||||
80, 60, 3,
|
||||
"\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
|
||||
"\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
|
||||
|
@@ -24,7 +24,7 @@
|
||||
|
||||
/* GIMP RGB C-Source image dump (alpha.c) */
|
||||
|
||||
const SDLTest_SurfaceImage_t SDLTest_imageBlitBlendAdd = {
|
||||
static const SDLTest_SurfaceImage_t SDLTest_imageBlitBlendAdd = {
|
||||
80, 60, 3,
|
||||
"\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
|
||||
"\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
|
||||
@@ -601,7 +601,7 @@ SDL_Surface *SDLTest_ImageBlitBlendAdd()
|
||||
return surface;
|
||||
}
|
||||
|
||||
const SDLTest_SurfaceImage_t SDLTest_imageBlitBlend = {
|
||||
static const SDLTest_SurfaceImage_t SDLTest_imageBlitBlend = {
|
||||
80, 60, 3,
|
||||
"\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
|
||||
"\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
|
||||
@@ -1131,7 +1131,7 @@ SDL_Surface *SDLTest_ImageBlitBlend()
|
||||
return surface;
|
||||
}
|
||||
|
||||
const SDLTest_SurfaceImage_t SDLTest_imageBlitBlendMod = {
|
||||
static const SDLTest_SurfaceImage_t SDLTest_imageBlitBlendMod = {
|
||||
80, 60, 3,
|
||||
"\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
|
||||
"\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
|
||||
@@ -1561,7 +1561,7 @@ SDL_Surface *SDLTest_ImageBlitBlendMod()
|
||||
return surface;
|
||||
}
|
||||
|
||||
const SDLTest_SurfaceImage_t SDLTest_imageBlitBlendNone = {
|
||||
static const SDLTest_SurfaceImage_t SDLTest_imageBlitBlendNone = {
|
||||
80, 60, 3,
|
||||
"\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
|
||||
"\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
|
||||
@@ -2374,7 +2374,7 @@ SDL_Surface *SDLTest_ImageBlitBlendNone()
|
||||
return surface;
|
||||
}
|
||||
|
||||
const SDLTest_SurfaceImage_t SDLTest_imageBlitBlendAll = {
|
||||
static const SDLTest_SurfaceImage_t SDLTest_imageBlitBlendAll = {
|
||||
80, 60, 3,
|
||||
"\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
|
||||
"\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
|
||||
|
@@ -24,7 +24,7 @@
|
||||
|
||||
/* GIMP RGBA C-Source image dump (face.c) */
|
||||
|
||||
const SDLTest_SurfaceImage_t SDLTest_imageFace = {
|
||||
static const SDLTest_SurfaceImage_t SDLTest_imageFace = {
|
||||
32, 32, 4,
|
||||
"\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377"
|
||||
"\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377"
|
||||
|
@@ -24,7 +24,7 @@
|
||||
|
||||
/* GIMP RGB C-Source image dump (primitives.c) */
|
||||
|
||||
const SDLTest_SurfaceImage_t SDLTest_imagePrimitives = {
|
||||
static const SDLTest_SurfaceImage_t SDLTest_imagePrimitives = {
|
||||
80, 60, 3,
|
||||
"\5ii\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
|
||||
"\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
|
||||
|
@@ -24,7 +24,7 @@
|
||||
|
||||
/* GIMP RGB C-Source image dump (alpha.c) */
|
||||
|
||||
const SDLTest_SurfaceImage_t SDLTest_imagePrimitivesBlend = {
|
||||
static const SDLTest_SurfaceImage_t SDLTest_imagePrimitivesBlend = {
|
||||
80, 60, 3,
|
||||
"\260e\15\222\356/\37\313\15\36\330\17K\3745D\3471\0\20\0D\3502D\3502<\321"
|
||||
",\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\0-\0\377\377"
|
||||
|
@@ -50,7 +50,7 @@
|
||||
*
|
||||
* \return Ascii representation of the timestamp in localtime in the format '08/23/01 14:55:02'
|
||||
*/
|
||||
char *SDLTest_TimestampToString(const time_t timestamp)
|
||||
static char *SDLTest_TimestampToString(const time_t timestamp)
|
||||
{
|
||||
time_t copy;
|
||||
static char buffer[64];
|
||||
|
Reference in New Issue
Block a user