Cleanup add brace (#6545)

* Add braces after if conditions

* More add braces after if conditions

* Add braces after while() conditions

* Fix compilation because of macro being modified

* Add braces to for loop

* Add braces after if/goto

* Move comments up

* Remove extra () in the 'return ...;' statements

* More remove extra () in the 'return ...;' statements

* More remove extra () in the 'return ...;' statements after merge

* Fix inconsistent patterns are xxx == NULL vs !xxx

* More "{}" for "if() break;"  and "if() continue;"

* More "{}" after if() short statement

* More "{}" after "if () return;" statement

* More fix inconsistent patterns are xxx == NULL vs !xxx

* Revert some modificaion on SDL_RLEaccel.c

* SDL_RLEaccel: no short statement

* Cleanup 'if' where the bracket is in a new line

* Cleanup 'while' where the bracket is in a new line

* Cleanup 'for' where the bracket is in a new line

* Cleanup 'else' where the bracket is in a new line

(cherry picked from commit 6a2200823c to reduce conflicts merging between SDL2 and SDL3)
This commit is contained in:
Sylvain Becker authored and Sam Lantinga committed 2022-11-28 12:33:03 -08:00
1 parent 0739d237ad
commit fb0ce375f0
386 files changed
+6103 -4637

No files matched your search

+26 -12
View File
@@ -47,7 +47,9 @@ RWopsSetUp(void *arg)
/* Create a test file */
handle = fopen(RWopsReadTestFilename, "w");
SDLTest_AssertCheck(handle != NULL, "Verify creation of file '%s' returned non NULL handle", RWopsReadTestFilename);
if (handle == NULL) return;
if (handle == NULL) {
return;
}
/* Write some known text into it */
fileLen = SDL_strlen(RWopsHelloWorldTestString);
@@ -59,7 +61,9 @@ RWopsSetUp(void *arg)
/* Create a second test file */
handle = fopen(RWopsAlphabetFilename, "w");
SDLTest_AssertCheck(handle != NULL, "Verify creation of file '%s' returned non NULL handle", RWopsAlphabetFilename);
if (handle == NULL) return;
if (handle == NULL) {
return;
}
/* Write alphabet text into it */
fileLen = SDL_strlen(RWopsAlphabetString);
@@ -114,8 +118,7 @@ _testGenericRWopsValidations(SDL_RWops *rw, int write)
SDLTest_AssertPass("Call to SDL_RWwrite succeeded");
if (write) {
SDLTest_AssertCheck(s == (size_t)1, "Verify result of writing one byte with SDL_RWwrite, expected 1, got %i", (int) s);
}
else {
} else {
SDLTest_AssertCheck(s == (size_t)0, "Verify result of writing with SDL_RWwrite, expected: 0, got %i", (int) s);
}
@@ -236,7 +239,9 @@ rwops_testMem (void)
SDLTest_AssertCheck(rw != NULL, "Verify opening memory with SDL_RWFromMem does not return NULL");
/* Bail out if NULL */
if (rw == NULL) return TEST_ABORTED;
if (rw == NULL) {
return TEST_ABORTED;
}
/* Check type */
SDLTest_AssertCheck(rw->type == SDL_RWOPS_MEMORY, "Verify RWops type is SDL_RWOPS_MEMORY; expected: %d, got: %" SDL_PRIu32, SDL_RWOPS_MEMORY, rw->type);
@@ -272,7 +277,9 @@ rwops_testConstMem (void)
SDLTest_AssertCheck(rw != NULL, "Verify opening memory with SDL_RWFromConstMem does not return NULL");
/* Bail out if NULL */
if (rw == NULL) return TEST_ABORTED;
if (rw == NULL) {
return TEST_ABORTED;
}
/* Check type */
SDLTest_AssertCheck(rw->type == SDL_RWOPS_MEMORY_RO, "Verify RWops type is SDL_RWOPS_MEMORY_RO; expected: %d, got: %" SDL_PRIu32, SDL_RWOPS_MEMORY_RO, rw->type);
@@ -308,7 +315,9 @@ rwops_testFileRead(void)
SDLTest_AssertCheck(rw != NULL, "Verify opening file with SDL_RWFromFile in read mode does not return NULL");
/* Bail out if NULL */
if (rw == NULL) return TEST_ABORTED;
if (rw == NULL) {
return TEST_ABORTED;
}
/* Check type */
#if defined(__ANDROID__)
@@ -355,7 +364,9 @@ rwops_testFileWrite(void)
SDLTest_AssertCheck(rw != NULL, "Verify opening file with SDL_RWFromFile in write mode does not return NULL");
/* Bail out if NULL */
if (rw == NULL) return TEST_ABORTED;
if (rw == NULL) {
return TEST_ABORTED;
}
/* Check type */
#if defined(__ANDROID__)
@@ -502,7 +513,9 @@ rwops_testAllocFree (void)
SDL_RWops *rw = SDL_AllocRW();
SDLTest_AssertPass("Call to SDL_AllocRW() succeeded");
SDLTest_AssertCheck(rw != NULL, "Validate result from SDL_AllocRW() is not NULL");
if (rw==NULL) return TEST_ABORTED;
if (rw == NULL) {
return TEST_ABORTED;
}
/* Check type */
SDLTest_AssertCheck(
@@ -538,8 +551,7 @@ rwops_testCompareRWFromMemWithRWFromFile(void)
int result;
for (size=5; size<10; size++)
{
for (size=5; size<10; size++) {
/* Terminate buffer */
buffer_file[slen] = 0;
buffer_mem[slen] = 0;
@@ -652,7 +664,9 @@ rwops_testFileWriteReadEndian(void)
SDLTest_AssertCheck(rw != NULL, "Verify opening file with SDL_RWFromFile in write mode does not return NULL");
/* Bail out if NULL */
if (rw == NULL) return TEST_ABORTED;
if (rw == NULL) {
return TEST_ABORTED;
}
/* Write test data */
objectsWritten = SDL_WriteBE16(rw, BE16value);