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
This commit is contained in:
Sylvain Becker
2022-11-27 17:38:43 +01:00
committed by GitHub
parent 4958dafdc3
commit 6a2200823c
387 changed files with 6094 additions and 4633 deletions

View File

@@ -58,18 +58,13 @@ static TBool RunThread(TAny* aInfo)
static TInt
NewThread(const TDesC& aName, TAny* aPtr1, TAny* aPtr2)
{
return ((RThread*)(aPtr1))->Create
(aName,
RunThread,
KDefaultStackSize,
NULL,
aPtr2);
return ((RThread *)(aPtr1))->Create(aName, RunThread, KDefaultStackSize, NULL, aPtr2);
}
static TInt NewSema(const TDesC& aName, TAny* aPtr1, TAny* aPtr2)
{
TInt value = *((TInt*) aPtr2);
return ((RSemaphore*)aPtr1)->CreateGlobal(aName, value);
return ((RSemaphore *)aPtr1)->CreateGlobal(aName, value);
}
static void WaitAll(SDL_sem *sem)
@@ -77,8 +72,7 @@ static void WaitAll(SDL_sem *sem)
RSemaphore sema;
sema.SetHandle(sem->handle);
sema.Wait();
while(sem->count < 0)
{
while(sem->count < 0) {
sema.Wait();
}
}
@@ -88,21 +82,19 @@ SDL_CreateSemaphore(Uint32 initial_value)
{
RSemaphore s;
TInt status = CreateUnique(NewSema, &s, &initial_value);
if(status != KErrNone)
{
if (status != KErrNone) {
SDL_SetError("Couldn't create semaphore");
}
SDL_semaphore* sem = new /*(ELeave)*/ SDL_semaphore;
sem->handle = s.Handle();
sem->count = initial_value;
return(sem);
return sem;
}
void
SDL_DestroySemaphore(SDL_sem * sem)
{
if (sem)
{
if (sem) {
RSemaphore sema;
sema.SetHandle(sem->handle);
sema.Signal(sema.Count());
@@ -115,13 +107,11 @@ SDL_DestroySemaphore(SDL_sem * sem)
int
SDL_SemWaitTimeout(SDL_sem * sem, Uint32 timeout)
{
if (! sem)
{
if (sem == NULL) {
return SDL_InvalidParamError("sem");
}
if (timeout == SDL_MUTEX_MAXWAIT)
{
if (timeout == SDL_MUTEX_MAXWAIT) {
WaitAll(sem);
return SDL_MUTEX_MAXWAIT;
}
@@ -130,16 +120,14 @@ SDL_SemWaitTimeout(SDL_sem * sem, Uint32 timeout)
TInfo* info = new (ELeave)TInfo(timeout, sem->handle);
TInt status = CreateUnique(NewThread, &thread, info);
if(status != KErrNone)
{
if (status != KErrNone) {
return status;
}
thread.Resume();
WaitAll(sem);
if(thread.ExitType() == EExitPending)
{
if (thread.ExitType() == EExitPending) {
thread.Kill(SDL_MUTEX_TIMEOUT);
}
@@ -150,13 +138,11 @@ SDL_SemWaitTimeout(SDL_sem * sem, Uint32 timeout)
int
SDL_SemTryWait(SDL_sem *sem)
{
if (! sem)
{
if (sem == NULL) {
return SDL_InvalidParamError("sem");
}
if(sem->count > 0)
{
if (sem->count > 0) {
sem->count--;
}
return SDL_MUTEX_TIMEOUT;
@@ -171,8 +157,7 @@ SDL_SemWait(SDL_sem * sem)
Uint32
SDL_SemValue(SDL_sem * sem)
{
if (! sem)
{
if (sem == NULL) {
SDL_InvalidParamError("sem");
return 0;
}
@@ -182,8 +167,7 @@ SDL_SemValue(SDL_sem * sem)
int
SDL_SemPost(SDL_sem * sem)
{
if (! sem)
{
if (sem == NULL) {
return SDL_InvalidParamError("sem");
}
sem->count++;