More non C89 compliant comments

This commit is contained in:
Gabriel Jacobo
2013-08-20 20:34:40 -03:00
parent 63fe3a7753
commit 552b04c58a
28 changed files with 252 additions and 248 deletions

View File

@@ -79,16 +79,16 @@ static int main_testImpliedJoystickInit (void *arg)
#else
int initialized_system;
// First initialize the controller
/* First initialize the controller */
SDLTest_AssertCheck( (SDL_WasInit(joy_and_controller) & joy_and_controller) == 0, "SDL_WasInit() before init should be false for joystick & controller" );
SDLTest_AssertCheck( SDL_InitSubSystem(SDL_INIT_GAMECONTROLLER) == 0, "SDL_InitSubSystem(SDL_INIT_GAMECONTROLLER)" );
// Then make sure this implicitly initialized the joystick subsystem
/* Then make sure this implicitly initialized the joystick subsystem */
initialized_system = SDL_WasInit(joy_and_controller);
SDLTest_AssertCheck( (initialized_system & joy_and_controller) == joy_and_controller, "SDL_WasInit() should be true for joystick & controller (%x)", initialized_system );
// Then quit the controller, and make sure that implicitly also quits the
// joystick subsystem
/* Then quit the controller, and make sure that implicitly also quits the */
/* joystick subsystem */
SDL_QuitSubSystem(SDL_INIT_GAMECONTROLLER);
initialized_system = SDL_WasInit(joy_and_controller);
SDLTest_AssertCheck( (initialized_system & joy_and_controller) == 0, "SDL_WasInit() should be false for joystick & controller (%x)", initialized_system );
@@ -104,17 +104,17 @@ static int main_testImpliedJoystickQuit (void *arg)
#else
int initialized_system;
// First initialize the controller and the joystick (explicitly)
/* First initialize the controller and the joystick (explicitly) */
SDLTest_AssertCheck( (SDL_WasInit(joy_and_controller) & joy_and_controller) == 0, "SDL_WasInit() before init should be false for joystick & controller" );
SDLTest_AssertCheck( SDL_InitSubSystem(SDL_INIT_JOYSTICK) == 0, "SDL_InitSubSystem(SDL_INIT_JOYSTICK)" );
SDLTest_AssertCheck( SDL_InitSubSystem(SDL_INIT_GAMECONTROLLER) == 0, "SDL_InitSubSystem(SDL_INIT_GAMECONTROLLER)" );
// Then make sure they're both initialized properly
/* Then make sure they're both initialized properly */
initialized_system = SDL_WasInit(joy_and_controller);
SDLTest_AssertCheck( (initialized_system & joy_and_controller) == joy_and_controller, "SDL_WasInit() should be true for joystick & controller (%x)", initialized_system );
// Then quit the controller, and make sure that it does NOT quit the
// explicitly initialized joystick subsystem.
/* Then quit the controller, and make sure that it does NOT quit the */
/* explicitly initialized joystick subsystem. */
SDL_QuitSubSystem(SDL_INIT_GAMECONTROLLER);
initialized_system = SDL_WasInit(joy_and_controller);
SDLTest_AssertCheck( (initialized_system & joy_and_controller) == SDL_INIT_JOYSTICK, "SDL_WasInit() should be false for joystick & controller (%x)", initialized_system );

View File

@@ -168,7 +168,7 @@ int platform_testHasFunctions (void *arg)
{
int ret;
// TODO: independently determine and compare values as well
/* TODO: independently determine and compare values as well */
ret = SDL_HasRDTSC();
SDLTest_AssertPass("SDL_HasRDTSC()");
@@ -315,7 +315,7 @@ int platform_testGetSetClearError(void *arg)
lastError);
}
// Clean up
/* Clean up */
SDL_ClearError();
SDLTest_AssertPass("SDL_ClearError()");
@@ -351,7 +351,7 @@ int platform_testSetErrorEmptyInput(void *arg)
lastError);
}
// Clean up
/* Clean up */
SDL_ClearError();
SDLTest_AssertPass("SDL_ClearError()");
@@ -370,11 +370,11 @@ int platform_testSetErrorInvalidInput(void *arg)
char *lastError;
int len;
// Reset
/* Reset */
SDL_ClearError();
SDLTest_AssertPass("SDL_ClearError()");
// Check for no-op
/* Check for no-op */
SDL_SetError(testError);
SDLTest_AssertPass("SDL_SetError()");
lastError = (char *)SDL_GetError();
@@ -392,11 +392,11 @@ int platform_testSetErrorInvalidInput(void *arg)
lastError);
}
// Set
/* Set */
SDL_SetError(probeError);
SDLTest_AssertPass("SDL_SetError()");
// Check for no-op
/* Check for no-op */
SDL_SetError(testError);
SDLTest_AssertPass("SDL_SetError()");
lastError = (char *)SDL_GetError();
@@ -415,7 +415,7 @@ int platform_testSetErrorInvalidInput(void *arg)
lastError);
}
// Clean up
/* Clean up */
SDL_ClearError();
SDLTest_AssertPass("SDL_ClearError()");
@@ -472,7 +472,7 @@ int platform_testGetPowerInfo(void *arg)
pct);
}
// Partial return value variations
/* Partial return value variations */
stateAgain = SDL_GetPowerInfo(&secsAgain, NULL);
SDLTest_AssertCheck(
state==stateAgain,

View File

@@ -423,7 +423,7 @@ int rect_testIntersectRectInside (void *arg)
SDL_Rect result;
SDL_bool intersection;
// rectB fully contained in rectA
/* rectB fully contained in rectA */
refRectB.x = 0;
refRectB.y = 0;
refRectB.w = SDLTest_RandomIntegerInRange(refRectA.x + 1, refRectA.x + refRectA.w - 1);
@@ -451,7 +451,7 @@ int rect_testIntersectRectOutside (void *arg)
SDL_Rect result;
SDL_bool intersection;
// rectB fully outside of rectA
/* rectB fully outside of rectA */
refRectB.x = refRectA.x + refRectA.w + SDLTest_RandomIntegerInRange(1, 10);
refRectB.y = refRectA.y + refRectA.h + SDLTest_RandomIntegerInRange(1, 10);
refRectB.w = refRectA.w;
@@ -480,7 +480,7 @@ int rect_testIntersectRectPartial (void *arg)
SDL_Rect expectedResult;
SDL_bool intersection;
// rectB partially contained in rectA
/* rectB partially contained in rectA */
refRectB.x = SDLTest_RandomIntegerInRange(refRectA.x + 1, refRectA.x + refRectA.w - 1);
refRectB.y = SDLTest_RandomIntegerInRange(refRectA.y + 1, refRectA.y + refRectA.h - 1);
refRectB.w = refRectA.w;
@@ -494,7 +494,7 @@ int rect_testIntersectRectPartial (void *arg)
intersection = SDL_IntersectRect(&rectA, &rectB, &result);
_validateIntersectRectResults(intersection, SDL_TRUE, &rectA, &rectB, &refRectA, &refRectB, &result, &expectedResult);
// rectB right edge
/* rectB right edge */
refRectB.x = rectA.w - 1;
refRectB.y = rectA.y;
refRectB.w = SDLTest_RandomIntegerInRange(1, refRectA.w - 1);
@@ -508,7 +508,7 @@ int rect_testIntersectRectPartial (void *arg)
intersection = SDL_IntersectRect(&rectA, &rectB, &result);
_validateIntersectRectResults(intersection, SDL_TRUE, &rectA, &rectB, &refRectA, &refRectB, &result, &expectedResult);
// rectB left edge
/* rectB left edge */
refRectB.x = 1 - rectA.w;
refRectB.y = rectA.y;
refRectB.w = refRectA.w;
@@ -522,7 +522,7 @@ int rect_testIntersectRectPartial (void *arg)
intersection = SDL_IntersectRect(&rectA, &rectB, &result);
_validateIntersectRectResults(intersection, SDL_TRUE, &rectA, &rectB, &refRectA, &refRectB, &result, &expectedResult);
// rectB bottom edge
/* rectB bottom edge */
refRectB.x = rectA.x;
refRectB.y = rectA.h - 1;
refRectB.w = SDLTest_RandomIntegerInRange(1, refRectA.w - 1);
@@ -536,7 +536,7 @@ int rect_testIntersectRectPartial (void *arg)
intersection = SDL_IntersectRect(&rectA, &rectB, &result);
_validateIntersectRectResults(intersection, SDL_TRUE, &rectA, &rectB, &refRectA, &refRectB, &result, &expectedResult);
// rectB top edge
/* rectB top edge */
refRectB.x = rectA.x;
refRectB.y = 1 - rectA.h;
refRectB.w = SDLTest_RandomIntegerInRange(1, refRectA.w - 1);
@@ -569,7 +569,7 @@ int rect_testIntersectRectPoint (void *arg)
SDL_bool intersection;
int offsetX, offsetY;
// intersecting pixels
/* intersecting pixels */
refRectA.x = SDLTest_RandomIntegerInRange(1, 100);
refRectA.y = SDLTest_RandomIntegerInRange(1, 100);
refRectB.x = refRectA.x;
@@ -579,7 +579,7 @@ int rect_testIntersectRectPoint (void *arg)
intersection = SDL_IntersectRect(&rectA, &rectB, &result);
_validateIntersectRectResults(intersection, SDL_TRUE, &rectA, &rectB, &refRectA, &refRectB, &result, &refRectA);
// non-intersecting pixels cases
/* non-intersecting pixels cases */
for (offsetX = -1; offsetX <= 1; offsetX++) {
for (offsetY = -1; offsetY <= 1; offsetY++) {
if (offsetX != 0 || offsetY != 0) {
@@ -616,7 +616,7 @@ int rect_testIntersectRectEmpty (void *arg)
SDL_bool intersection;
SDL_bool empty;
// Rect A empty
/* Rect A empty */
result.w = SDLTest_RandomIntegerInRange(1, 100);
result.h = SDLTest_RandomIntegerInRange(1, 100);
refRectA.x = SDLTest_RandomIntegerInRange(1, 100);
@@ -633,7 +633,7 @@ int rect_testIntersectRectEmpty (void *arg)
empty = (SDL_bool)SDL_RectEmpty(&result);
SDLTest_AssertCheck(empty == SDL_TRUE, "Validate result is empty Rect; got: %s", (empty == SDL_TRUE) ? "SDL_TRUE" : "SDL_FALSE");
// Rect B empty
/* Rect B empty */
result.w = SDLTest_RandomIntegerInRange(1, 100);
result.h = SDLTest_RandomIntegerInRange(1, 100);
refRectA.x = SDLTest_RandomIntegerInRange(1, 100);
@@ -650,7 +650,7 @@ int rect_testIntersectRectEmpty (void *arg)
empty = (SDL_bool)SDL_RectEmpty(&result);
SDLTest_AssertCheck(empty == SDL_TRUE, "Validate result is empty Rect; got: %s", (empty == SDL_TRUE) ? "SDL_TRUE" : "SDL_FALSE");
// Rect A and B empty
/* Rect A and B empty */
result.w = SDLTest_RandomIntegerInRange(1, 100);
result.h = SDLTest_RandomIntegerInRange(1, 100);
refRectA.x = SDLTest_RandomIntegerInRange(1, 100);
@@ -685,7 +685,7 @@ int rect_testIntersectRectParam(void *arg)
SDL_Rect result;
SDL_bool intersection;
// invalid parameter combinations
/* invalid parameter combinations */
intersection = SDL_IntersectRect((SDL_Rect *)NULL, &rectB, &result);
SDLTest_AssertCheck(intersection == SDL_FALSE, "Check that function returns SDL_FALSE when 1st parameter is NULL");
intersection = SDL_IntersectRect(&rectA, (SDL_Rect *)NULL, &result);
@@ -716,7 +716,7 @@ int rect_testHasIntersectionInside (void *arg)
SDL_Rect rectB;
SDL_bool intersection;
// rectB fully contained in rectA
/* rectB fully contained in rectA */
refRectB.x = 0;
refRectB.y = 0;
refRectB.w = SDLTest_RandomIntegerInRange(refRectA.x + 1, refRectA.x + refRectA.w - 1);
@@ -743,7 +743,7 @@ int rect_testHasIntersectionOutside (void *arg)
SDL_Rect rectB;
SDL_bool intersection;
// rectB fully outside of rectA
/* rectB fully outside of rectA */
refRectB.x = refRectA.x + refRectA.w + SDLTest_RandomIntegerInRange(1, 10);
refRectB.y = refRectA.y + refRectA.h + SDLTest_RandomIntegerInRange(1, 10);
refRectB.w = refRectA.w;
@@ -770,7 +770,7 @@ int rect_testHasIntersectionPartial (void *arg)
SDL_Rect rectB;
SDL_bool intersection;
// rectB partially contained in rectA
/* rectB partially contained in rectA */
refRectB.x = SDLTest_RandomIntegerInRange(refRectA.x + 1, refRectA.x + refRectA.w - 1);
refRectB.y = SDLTest_RandomIntegerInRange(refRectA.y + 1, refRectA.y + refRectA.h - 1);
refRectB.w = refRectA.w;
@@ -780,7 +780,7 @@ int rect_testHasIntersectionPartial (void *arg)
intersection = SDL_HasIntersection(&rectA, &rectB);
_validateHasIntersectionResults(intersection, SDL_TRUE, &rectA, &rectB, &refRectA, &refRectB);
// rectB right edge
/* rectB right edge */
refRectB.x = rectA.w - 1;
refRectB.y = rectA.y;
refRectB.w = SDLTest_RandomIntegerInRange(1, refRectA.w - 1);
@@ -790,7 +790,7 @@ int rect_testHasIntersectionPartial (void *arg)
intersection = SDL_HasIntersection(&rectA, &rectB);
_validateHasIntersectionResults(intersection, SDL_TRUE, &rectA, &rectB, &refRectA, &refRectB);
// rectB left edge
/* rectB left edge */
refRectB.x = 1 - rectA.w;
refRectB.y = rectA.y;
refRectB.w = refRectA.w;
@@ -800,7 +800,7 @@ int rect_testHasIntersectionPartial (void *arg)
intersection = SDL_HasIntersection(&rectA, &rectB);
_validateHasIntersectionResults(intersection, SDL_TRUE, &rectA, &rectB, &refRectA, &refRectB);
// rectB bottom edge
/* rectB bottom edge */
refRectB.x = rectA.x;
refRectB.y = rectA.h - 1;
refRectB.w = SDLTest_RandomIntegerInRange(1, refRectA.w - 1);
@@ -810,7 +810,7 @@ int rect_testHasIntersectionPartial (void *arg)
intersection = SDL_HasIntersection(&rectA, &rectB);
_validateHasIntersectionResults(intersection, SDL_TRUE, &rectA, &rectB, &refRectA, &refRectB);
// rectB top edge
/* rectB top edge */
refRectB.x = rectA.x;
refRectB.y = 1 - rectA.h;
refRectB.w = SDLTest_RandomIntegerInRange(1, refRectA.w - 1);
@@ -838,7 +838,7 @@ int rect_testHasIntersectionPoint (void *arg)
SDL_bool intersection;
int offsetX, offsetY;
// intersecting pixels
/* intersecting pixels */
refRectA.x = SDLTest_RandomIntegerInRange(1, 100);
refRectA.y = SDLTest_RandomIntegerInRange(1, 100);
refRectB.x = refRectA.x;
@@ -848,7 +848,7 @@ int rect_testHasIntersectionPoint (void *arg)
intersection = SDL_HasIntersection(&rectA, &rectB);
_validateHasIntersectionResults(intersection, SDL_TRUE, &rectA, &rectB, &refRectA, &refRectB);
// non-intersecting pixels cases
/* non-intersecting pixels cases */
for (offsetX = -1; offsetX <= 1; offsetX++) {
for (offsetY = -1; offsetY <= 1; offsetY++) {
if (offsetX != 0 || offsetY != 0) {
@@ -883,7 +883,7 @@ int rect_testHasIntersectionEmpty (void *arg)
SDL_Rect rectB;
SDL_bool intersection;
// Rect A empty
/* Rect A empty */
refRectA.x = SDLTest_RandomIntegerInRange(1, 100);
refRectA.y = SDLTest_RandomIntegerInRange(1, 100);
refRectA.w = SDLTest_RandomIntegerInRange(1, 100);
@@ -896,7 +896,7 @@ int rect_testHasIntersectionEmpty (void *arg)
intersection = SDL_HasIntersection(&rectA, &rectB);
_validateHasIntersectionResults(intersection, SDL_FALSE, &rectA, &rectB, &refRectA, &refRectB);
// Rect B empty
/* Rect B empty */
refRectA.x = SDLTest_RandomIntegerInRange(1, 100);
refRectA.y = SDLTest_RandomIntegerInRange(1, 100);
refRectA.w = SDLTest_RandomIntegerInRange(1, 100);
@@ -909,7 +909,7 @@ int rect_testHasIntersectionEmpty (void *arg)
intersection = SDL_HasIntersection(&rectA, &rectB);
_validateHasIntersectionResults(intersection, SDL_FALSE, &rectA, &rectB, &refRectA, &refRectB);
// Rect A and B empty
/* Rect A and B empty */
refRectA.x = SDLTest_RandomIntegerInRange(1, 100);
refRectA.y = SDLTest_RandomIntegerInRange(1, 100);
refRectA.w = SDLTest_RandomIntegerInRange(1, 100);
@@ -939,7 +939,7 @@ int rect_testHasIntersectionParam(void *arg)
SDL_Rect rectB;
SDL_bool intersection;
// invalid parameter combinations
/* invalid parameter combinations */
intersection = SDL_HasIntersection((SDL_Rect *)NULL, &rectB);
SDLTest_AssertCheck(intersection == SDL_FALSE, "Check that function returns SDL_FALSE when 1st parameter is NULL");
intersection = SDL_HasIntersection(&rectA, (SDL_Rect *)NULL);
@@ -969,7 +969,7 @@ int rect_testEnclosePoints(void *arg)
int minx = 0, maxx = 0, miny = 0, maxy = 0;
int i;
// Create input data, tracking result
/* Create input data, tracking result */
for (i=0; i<numPoints; i++) {
newx = SDLTest_RandomIntegerInRange(-1024, 1024);
newy = SDLTest_RandomIntegerInRange(-1024, 1024);
@@ -990,7 +990,7 @@ int rect_testEnclosePoints(void *arg)
}
}
// Call function and validate - special case: no result requested
/* Call function and validate - special case: no result requested */
anyEnclosedNoResult = SDL_EnclosePoints((const SDL_Point *)points, numPoints, (const SDL_Rect *)NULL, (SDL_Rect *)NULL);
SDLTest_AssertCheck(expectedEnclosed==anyEnclosedNoResult,
"Check expected return value %s, got %s",
@@ -1002,7 +1002,7 @@ int rect_testEnclosePoints(void *arg)
i, refPoints[i].x, refPoints[i].y, points[i].x, points[i].y);
}
// Call function and validate
/* Call function and validate */
anyEnclosed = SDL_EnclosePoints((const SDL_Point *)points, numPoints, (const SDL_Rect *)NULL, &result);
SDLTest_AssertCheck(expectedEnclosed==anyEnclosed,
"Check return value %s, got %s",
@@ -1040,7 +1040,7 @@ int rect_testEnclosePointsRepeatedInput(void *arg)
int minx = 0, maxx = 0, miny = 0, maxy = 0;
int i;
// Create input data, tracking result
/* Create input data, tracking result */
for (i=0; i<numPoints; i++) {
if (i < halfPoints) {
newx = SDLTest_RandomIntegerInRange(-1024, 1024);
@@ -1066,7 +1066,7 @@ int rect_testEnclosePointsRepeatedInput(void *arg)
}
}
// Call function and validate - special case: no result requested
/* Call function and validate - special case: no result requested */
anyEnclosedNoResult = SDL_EnclosePoints((const SDL_Point *)points, numPoints, (const SDL_Rect *)NULL, (SDL_Rect *)NULL);
SDLTest_AssertCheck(expectedEnclosed==anyEnclosedNoResult,
"Check return value %s, got %s",
@@ -1078,7 +1078,7 @@ int rect_testEnclosePointsRepeatedInput(void *arg)
i, refPoints[i].x, refPoints[i].y, points[i].x, points[i].y);
}
// Call function and validate
/* Call function and validate */
anyEnclosed = SDL_EnclosePoints((const SDL_Point *)points, numPoints, (const SDL_Rect *)NULL, &result);
SDLTest_AssertCheck(expectedEnclosed==anyEnclosed,
"Check return value %s, got %s",
@@ -1117,13 +1117,13 @@ int rect_testEnclosePointsWithClipping(void *arg)
int minx = 0, maxx = 0, miny = 0, maxy = 0;
int i;
// Setup clipping rectangle
/* Setup clipping rectangle */
refClip.x = SDLTest_RandomIntegerInRange(-1024, 1024);
refClip.y = SDLTest_RandomIntegerInRange(-1024, 1024);
refClip.w = SDLTest_RandomIntegerInRange(1, 1024);
refClip.h = SDLTest_RandomIntegerInRange(1, 1024);
// Create input data, tracking result
/* Create input data, tracking result */
for (i=0; i<numPoints; i++) {
newx = SDLTest_RandomIntegerInRange(-1024, 1024);
newy = SDLTest_RandomIntegerInRange(-1024, 1024);
@@ -1148,7 +1148,7 @@ int rect_testEnclosePointsWithClipping(void *arg)
}
}
// Call function and validate - special case: no result requested
/* Call function and validate - special case: no result requested */
clip = refClip;
anyEnclosedNoResult = SDL_EnclosePoints((const SDL_Point *)points, numPoints, (const SDL_Rect *)&clip, (SDL_Rect *)NULL);
SDLTest_AssertCheck(expectedEnclosed==anyEnclosedNoResult,
@@ -1163,7 +1163,7 @@ int rect_testEnclosePointsWithClipping(void *arg)
SDLTest_AssertCheck(refClip.x==clip.x && refClip.y==clip.y && refClip.w==clip.w && refClip.h==clip.h,
"Check that source clipping rectangle was not modified");
// Call function and validate
/* Call function and validate */
anyEnclosed = SDL_EnclosePoints((const SDL_Point *)points, numPoints, (const SDL_Rect *)&clip, &result);
SDLTest_AssertCheck(expectedEnclosed==anyEnclosed,
"Check return value %s, got %s",
@@ -1209,7 +1209,7 @@ int rect_testEnclosePointsParam(void *arg)
SDL_Rect result;
SDL_bool anyEnclosed;
// invalid parameter combinations
/* invalid parameter combinations */
anyEnclosed = SDL_EnclosePoints((SDL_Point *)NULL, 1, (const SDL_Rect *)&clip, &result);
SDLTest_AssertCheck(anyEnclosed == SDL_FALSE, "Check that functions returns SDL_FALSE when 1st parameter is NULL");
anyEnclosed = SDL_EnclosePoints((const SDL_Point *)points, 0, (const SDL_Rect *)&clip, &result);
@@ -1434,7 +1434,7 @@ int rect_testUnionRectParam(void *arg)
SDL_Rect rectA, rectB;
SDL_Rect result;
// invalid parameter combinations
/* invalid parameter combinations */
SDL_UnionRect((SDL_Rect *)NULL, &rectB, &result);
SDLTest_AssertPass("Check that function returns when 1st parameter is NULL");
SDL_UnionRect(&rectA, (SDL_Rect *)NULL, &result);
@@ -1465,7 +1465,7 @@ int rect_testRectEmpty(void *arg)
SDL_bool result;
int w, h;
// Non-empty case
/* Non-empty case */
refRect.x=SDLTest_RandomIntegerInRange(-1024, 1024);
refRect.y=SDLTest_RandomIntegerInRange(-1024, 1024);
refRect.w=SDLTest_RandomIntegerInRange(256, 1024);
@@ -1475,7 +1475,7 @@ int rect_testRectEmpty(void *arg)
result = (SDL_bool)SDL_RectEmpty((const SDL_Rect *)&rect);
_validateRectEmptyResults(result, expectedResult, &rect, &refRect);
// Empty case
/* Empty case */
for (w=-1; w<2; w++) {
for (h=-1; h<2; h++) {
if ((w != 1) || (h != 1)) {
@@ -1504,7 +1504,7 @@ int rect_testRectEmptyParam(void *arg)
{
SDL_bool result;
// invalid parameter combinations
/* invalid parameter combinations */
result = (SDL_bool)SDL_RectEmpty((const SDL_Rect *)NULL);
SDLTest_AssertCheck(result == SDL_TRUE, "Check that function returns TRUE when 1st parameter is NULL");
@@ -1526,7 +1526,7 @@ int rect_testRectEquals(void *arg)
SDL_bool expectedResult;
SDL_bool result;
// Equals
/* Equals */
refRectA.x=SDLTest_RandomIntegerInRange(-1024, 1024);
refRectA.y=SDLTest_RandomIntegerInRange(-1024, 1024);
refRectA.w=SDLTest_RandomIntegerInRange(1, 1024);
@@ -1563,7 +1563,7 @@ int rect_testRectEqualsParam(void *arg)
rectB.w=SDLTest_RandomIntegerInRange(1, 1024);
rectB.h=SDLTest_RandomIntegerInRange(1, 1024);
// invalid parameter combinations
/* invalid parameter combinations */
result = (SDL_bool)SDL_RectEquals((const SDL_Rect *)NULL, (const SDL_Rect *)&rectB);
SDLTest_AssertCheck(result == SDL_FALSE, "Check that function returns SDL_FALSE when 1st parameter is NULL");
result = (SDL_bool)SDL_RectEquals((const SDL_Rect *)&rectA, (const SDL_Rect *)NULL);

View File

@@ -305,7 +305,7 @@ rwops_testFileRead(void)
SDLTest_AssertPass("Call to SDL_RWFromFile(..,\"r\") succeeded");
SDLTest_AssertCheck(rw != NULL, "Verify opening file with SDL_RWFromFile in read mode does not return NULL");
// Bail out if NULL
/* Bail out if NULL */
if (rw == NULL) return TEST_ABORTED;
/* Check type */
@@ -352,7 +352,7 @@ rwops_testFileWrite(void)
SDLTest_AssertPass("Call to SDL_RWFromFile(..,\"w+\") succeeded");
SDLTest_AssertCheck(rw != NULL, "Verify opening file with SDL_RWFromFile in write mode does not return NULL");
// Bail out if NULL
/* Bail out if NULL */
if (rw == NULL) return TEST_ABORTED;
/* Check type */
@@ -642,7 +642,7 @@ rwops_testFileWriteReadEndian(void)
SDLTest_AssertPass("Call to SDL_RWFromFile(..,\"w+\")");
SDLTest_AssertCheck(rw != NULL, "Verify opening file with SDL_RWFromFile in write mode does not return NULL");
// Bail out if NULL
/* Bail out if NULL */
if (rw == NULL) return TEST_ABORTED;
/* Write test data */

View File

@@ -8,7 +8,7 @@
#include "SDL_test.h"
// Test collections
/* Test collections */
extern SDLTest_TestSuiteReference audioTestSuite;
extern SDLTest_TestSuiteReference clipboardTestSuite;
extern SDLTest_TestSuiteReference eventsTestSuite;
@@ -27,7 +27,7 @@ extern SDLTest_TestSuiteReference syswmTestSuite;
extern SDLTest_TestSuiteReference timerTestSuite;
extern SDLTest_TestSuiteReference videoTestSuite;
// All test suites
/* All test suites */
SDLTest_TestSuiteReference *testSuites[] = {
&audioTestSuite,
&clipboardTestSuite,

View File

@@ -12,7 +12,7 @@
/* sanity tests on SDL_rwops.c (usefull for alternative implementations of stdio rwops) */
// quiet windows compiler warnings
/* quiet windows compiler warnings */
#define _CRT_NONSTDC_NO_WARNINGS
#include <stdlib.h>

View File

@@ -49,7 +49,7 @@
#define BPP 4
#define DEPTH 32
//MUST BE A POWER OF 2!
/*MUST BE A POWER OF 2!*/
#define EVENT_BUF_SIZE 256
@@ -102,9 +102,9 @@ void setpix(SDL_Surface *screen, float _x, float _y, unsigned int col)
SDL_memcpy(&colour,pixmem32,screen->format->BytesPerPixel);
SDL_GetRGB(colour,screen->format,&r,&g,&b);
//r = 0;g = 0; b = 0;
/*r = 0;g = 0; b = 0;*/
a = (float)((col>>24)&0xFF);
if(a == 0) a = 0xFF; //Hack, to make things easier.
if(a == 0) a = 0xFF; /*Hack, to make things easier.*/
a /= 0xFF;
r = (Uint8)(r*(1-a) + ((col>>16)&0xFF)*(a));
g = (Uint8)(g*(1-a) + ((col>> 8)&0xFF)*(a));
@@ -127,7 +127,7 @@ void drawCircle(SDL_Surface* screen,float x,float y,float r,unsigned int c)
float xr;
for(ty = (float)-SDL_fabs(r);ty <= (float)SDL_fabs((int)r);ty++) {
xr = (float)sqrt(r*r - ty*ty);
if(r > 0) { //r > 0 ==> filled circle
if(r > 0) { /*r > 0 ==> filled circle*/
for(tx=-xr+.5f;tx<=xr-.5;tx++) {
setpix(screen,x+tx,y+ty,c);
}
@@ -157,7 +157,7 @@ void DrawScreen(SDL_Surface* screen)
setpix(screen,(float)x,(float)y,((x%255)<<16) + ((y%255)<<8) + (x+y)%255);
#endif
//draw Touch History
/*draw Touch History*/
for(i = eventWrite; i < eventWrite+EVENT_BUF_SIZE; ++i) {
const SDL_Event *event = &events[i&(EVENT_BUF_SIZE-1)];
float age = (float)(i - eventWrite) / EVENT_BUF_SIZE;
@@ -170,7 +170,7 @@ void DrawScreen(SDL_Surface* screen)
x = event->tfinger.x;
y = event->tfinger.y;
//draw the touch:
/*draw the touch:*/
c = colors[event->tfinger.fingerId%7];
col = ((unsigned int)(c*(.1+.85))) | (unsigned int)(0xFF*age)<<24;
@@ -210,7 +210,7 @@ int main(int argc, char* argv[])
/* Enable standard application logging */
SDL_LogSetPriority(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_INFO);
//gesture variables
/*gesture variables*/
knob.r = .1f;
knob.ang = 0;
@@ -225,7 +225,7 @@ int main(int argc, char* argv[])
while(!quitting) {
while(SDL_PollEvent(&event))
{
//Record _all_ events
/*Record _all_ events*/
events[eventWrite & (EVENT_BUF_SIZE-1)] = event;
eventWrite++;

View File

@@ -135,7 +135,7 @@ void _Redraw(SDL_Renderer * renderer) {
markedRect.w = textRect.w - w;
if (markedRect.w < 0)
{
// Stop text input because we cannot hold any more characters
/* Stop text input because we cannot hold any more characters */
SDL_StopTextInput();
return;
}
@@ -342,8 +342,8 @@ int main(int argc, char *argv[]) {
SDL_Log("text inputed: %s\n", text);
// After text inputed, we can clear up markedText because it
// is committed
/* After text inputed, we can clear up markedText because it */
/* is committed*/
markedText[0] = 0;
Redraw();
break;

View File

@@ -46,12 +46,12 @@ button_messagebox(void *eventNumber)
SDL_MessageBoxData data = {
SDL_MESSAGEBOX_INFORMATION,
NULL, // no parent window
NULL, /* no parent window */
"Custom MessageBox",
"This is a custom messagebox",
2,
buttons,
NULL // Default color scheme
NULL /* Default color scheme */
};
int button = -1;

View File

@@ -127,7 +127,7 @@ Draw(DrawState *s)
/* Update the screen! */
SDL_RenderPresent(s->renderer);
//SDL_Delay(10);
/*SDL_Delay(10);*/
}
int

View File

@@ -107,12 +107,12 @@ main(int argc, char **argv)
SDL_FreeWAV(data);
SDL_Quit();
return 8;
} // if
} /* if */
SDL_free(cvt.buf);
SDL_FreeWAV(data);
SDL_Quit();
return 0;
} // main
} /* main */
// end of resample_test.c ...
/* end of resample_test.c ... */

View File

@@ -332,19 +332,19 @@ SDL_GL_LoadTexture(SDL_Surface * surface, GLfloat * texcoord)
}
/* A general OpenGL initialization function. Sets all of the initial parameters. */
void InitGL(int Width, int Height) // We call this right after our OpenGL window is created.
void InitGL(int Width, int Height) /* We call this right after our OpenGL window is created. */
{
GLdouble aspect;
glViewport(0, 0, Width, Height);
glClearColor(0.0f, 0.0f, 0.0f, 0.0f); // This Will Clear The Background Color To Black
glClearDepth(1.0); // Enables Clearing Of The Depth Buffer
glDepthFunc(GL_LESS); // The Type Of Depth Test To Do
glEnable(GL_DEPTH_TEST); // Enables Depth Testing
glShadeModel(GL_SMOOTH); // Enables Smooth Color Shading
glClearColor(0.0f, 0.0f, 0.0f, 0.0f); /* This Will Clear The Background Color To Black */
glClearDepth(1.0); /* Enables Clearing Of The Depth Buffer */
glDepthFunc(GL_LESS); /* The Type Of Depth Test To Do */
glEnable(GL_DEPTH_TEST); /* Enables Depth Testing */
glShadeModel(GL_SMOOTH); /* Enables Smooth Color Shading */
glMatrixMode(GL_PROJECTION);
glLoadIdentity(); // Reset The Projection Matrix
glLoadIdentity(); /* Reset The Projection Matrix */
aspect = (GLdouble)Width / Height;
glOrtho(-3.0, 3.0, -3.0 / aspect, 3.0 / aspect, 0.0, 1.0);
@@ -363,29 +363,29 @@ void DrawGLScene(SDL_Window *window, GLuint texture, GLfloat * texcoord)
MAXY
};
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); // Clear The Screen And The Depth Buffer
glLoadIdentity(); // Reset The View
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); /* Clear The Screen And The Depth Buffer */
glLoadIdentity(); /* Reset The View */
glTranslatef(-1.5f,0.0f,0.0f); // Move Left 1.5 Units
glTranslatef(-1.5f,0.0f,0.0f); /* Move Left 1.5 Units */
// draw a triangle (in smooth coloring mode)
glBegin(GL_POLYGON); // start drawing a polygon
glColor3f(1.0f,0.0f,0.0f); // Set The Color To Red
glVertex3f( 0.0f, 1.0f, 0.0f); // Top
glColor3f(0.0f,1.0f,0.0f); // Set The Color To Green
glVertex3f( 1.0f,-1.0f, 0.0f); // Bottom Right
glColor3f(0.0f,0.0f,1.0f); // Set The Color To Blue
glVertex3f(-1.0f,-1.0f, 0.0f); // Bottom Left
glEnd(); // we're done with the polygon (smooth color interpolation)
/* draw a triangle (in smooth coloring mode) */
glBegin(GL_POLYGON); /* start drawing a polygon */
glColor3f(1.0f,0.0f,0.0f); /* Set The Color To Red */
glVertex3f( 0.0f, 1.0f, 0.0f); /* Top */
glColor3f(0.0f,1.0f,0.0f); /* Set The Color To Green */
glVertex3f( 1.0f,-1.0f, 0.0f); /* Bottom Right */
glColor3f(0.0f,0.0f,1.0f); /* Set The Color To Blue */
glVertex3f(-1.0f,-1.0f, 0.0f); /* Bottom Left */
glEnd(); /* we're done with the polygon (smooth color interpolation) */
glTranslatef(3.0f,0.0f,0.0f); // Move Right 3 Units
glTranslatef(3.0f,0.0f,0.0f); /* Move Right 3 Units */
// Enable blending
/* Enable blending */
glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
// draw a textured square (quadrilateral)
/* draw a textured square (quadrilateral) */
glEnable(GL_TEXTURE_2D);
glBindTexture(GL_TEXTURE_2D, texture);
glColor3f(1.0f,1.0f,1.0f);
@@ -393,23 +393,23 @@ void DrawGLScene(SDL_Window *window, GLuint texture, GLfloat * texcoord)
glUseProgramObjectARB(shaders[current_shader].program);
}
glBegin(GL_QUADS); // start drawing a polygon (4 sided)
glBegin(GL_QUADS); /* start drawing a polygon (4 sided) */
glTexCoord2f(texcoord[MINX], texcoord[MINY]);
glVertex3f(-1.0f, 1.0f, 0.0f); // Top Left
glVertex3f(-1.0f, 1.0f, 0.0f); /* Top Left */
glTexCoord2f(texcoord[MAXX], texcoord[MINY]);
glVertex3f( 1.0f, 1.0f, 0.0f); // Top Right
glVertex3f( 1.0f, 1.0f, 0.0f); /* Top Right */
glTexCoord2f(texcoord[MAXX], texcoord[MAXY]);
glVertex3f( 1.0f,-1.0f, 0.0f); // Bottom Right
glVertex3f( 1.0f,-1.0f, 0.0f); /* Bottom Right */
glTexCoord2f(texcoord[MINX], texcoord[MAXY]);
glVertex3f(-1.0f,-1.0f, 0.0f); // Bottom Left
glEnd(); // done with the polygon
glVertex3f(-1.0f,-1.0f, 0.0f); /* Bottom Left */
glEnd(); /* done with the polygon */
if (shaders_supported) {
glUseProgramObjectARB(0);
}
glDisable(GL_TEXTURE_2D);
// swap buffers to display, since we're double buffered.
/* swap buffers to display, since we're double buffered. */
SDL_GL_SwapWindow(window);
}

View File

@@ -29,11 +29,11 @@ typedef struct LoadedPicture {
void render(SDL_Renderer *renderer,SDL_Texture *texture,SDL_Rect texture_dimensions)
{
//Clear render-target to blue.
/*Clear render-target to blue.*/
SDL_SetRenderDrawColor(renderer,0x00,0x00,0xff,0xff);
SDL_RenderClear(renderer);
//Render the texture.
/*Render the texture.*/
SDL_RenderCopy(renderer,texture,&texture_dimensions,&texture_dimensions);
SDL_RenderPresent(renderer);
@@ -188,17 +188,17 @@ int main(int argc,char** argv)
next_time += TICK_INTERVAL;
}
//Free the textures.
/*Free the textures.*/
for(i=0;i<num_pictures;i++)
SDL_DestroyTexture(pictures[i].texture);
SDL_DestroyRenderer(renderer);
//Destroy the window.
/*Destroy the window.*/
SDL_DestroyWindow(window);
//Free the original surfaces backing the textures.
/*Free the original surfaces backing the textures.*/
for(i=0;i<num_pictures;i++)
SDL_FreeSurface(pictures[i].surface);
SDL_free(pictures);
//Call SDL_VideoQuit() before quitting.
/*Call SDL_VideoQuit() before quitting.*/
SDL_VideoQuit();
return 0;

View File

@@ -132,7 +132,7 @@ main(int argc, char *argv[])
SDL_FreeCursor(cursor);
quit(0);
// keep the compiler happy ...
/* keep the compiler happy ... */
return(0);
}