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

@@ -40,7 +40,7 @@ SDL_TLSGet(SDL_TLSID id)
SDL_TLSData *storage;
storage = SDL_SYS_GetTLSData();
if (!storage || id == 0 || id > storage->limit) {
if (storage == NULL || id == 0 || id > storage->limit) {
return NULL;
}
return storage->array[id-1].data;
@@ -56,13 +56,13 @@ SDL_TLSSet(SDL_TLSID id, const void *value, void (SDLCALL *destructor)(void *))
}
storage = SDL_SYS_GetTLSData();
if (!storage || (id > storage->limit)) {
if (storage == NULL || (id > storage->limit)) {
unsigned int i, oldlimit, newlimit;
oldlimit = storage ? storage->limit : 0;
newlimit = (id + TLS_ALLOC_CHUNKSIZE);
storage = (SDL_TLSData *)SDL_realloc(storage, sizeof(*storage)+(newlimit-1)*sizeof(storage->array[0]));
if (!storage) {
if (storage == NULL) {
return SDL_OutOfMemory();
}
storage->limit = newlimit;
@@ -125,14 +125,14 @@ SDL_Generic_GetTLSData(void)
SDL_TLSData *storage = NULL;
#if !SDL_THREADS_DISABLED
if (!SDL_generic_TLS_mutex) {
if (SDL_generic_TLS_mutex == NULL) {
static SDL_SpinLock tls_lock;
SDL_AtomicLock(&tls_lock);
if (!SDL_generic_TLS_mutex) {
if (SDL_generic_TLS_mutex == NULL) {
SDL_mutex *mutex = SDL_CreateMutex();
SDL_MemoryBarrierRelease();
SDL_generic_TLS_mutex = mutex;
if (!SDL_generic_TLS_mutex) {
if (SDL_generic_TLS_mutex == NULL) {
SDL_AtomicUnlock(&tls_lock);
return NULL;
}
@@ -181,7 +181,7 @@ SDL_Generic_SetTLSData(SDL_TLSData *storage)
}
prev = entry;
}
if (!entry) {
if (entry == NULL) {
entry = (SDL_TLSEntry *)SDL_malloc(sizeof(*entry));
if (entry) {
entry->thread = thread;
@@ -192,7 +192,7 @@ SDL_Generic_SetTLSData(SDL_TLSData *storage)
}
SDL_UnlockMutex(SDL_generic_TLS_mutex);
if (!entry) {
if (entry == NULL) {
return SDL_OutOfMemory();
}
return 0;
@@ -260,7 +260,7 @@ SDL_GetErrBuf(void)
if (errbuf == ALLOCATION_IN_PROGRESS) {
return SDL_GetStaticErrBuf();
}
if (!errbuf) {
if (errbuf == NULL) {
/* Get the original memory functions for this allocation because the lifetime
* of the error buffer may span calls to SDL_SetMemoryFunctions() by the app
*/
@@ -271,7 +271,7 @@ SDL_GetErrBuf(void)
/* Mark that we're in the middle of allocating our buffer */
SDL_TLSSet(tls_errbuf, ALLOCATION_IN_PROGRESS, NULL);
errbuf = (SDL_error *)realloc_func(NULL, sizeof(*errbuf));
if (!errbuf) {
if (errbuf == NULL) {
SDL_TLSSet(tls_errbuf, NULL, NULL);
return SDL_GetStaticErrBuf();
}
@@ -472,7 +472,7 @@ SDL_WaitThread(SDL_Thread * thread, int *status)
void
SDL_DetachThread(SDL_Thread * thread)
{
if (!thread) {
if (thread == NULL) {
return;
}

View File

@@ -97,7 +97,7 @@ int
SDL_CondSignal_generic(SDL_cond * _cond)
{
SDL_cond_generic *cond = (SDL_cond_generic *)_cond;
if (!cond) {
if (cond == NULL) {
return SDL_InvalidParamError("cond");
}
@@ -122,7 +122,7 @@ int
SDL_CondBroadcast_generic(SDL_cond * _cond)
{
SDL_cond_generic *cond = (SDL_cond_generic *)_cond;
if (!cond) {
if (cond == NULL) {
return SDL_InvalidParamError("cond");
}
@@ -179,7 +179,7 @@ SDL_CondWaitTimeout_generic(SDL_cond * _cond, SDL_mutex * mutex, Uint32 ms)
SDL_cond_generic *cond = (SDL_cond_generic *)_cond;
int retval;
if (!cond) {
if (cond == NULL) {
return SDL_InvalidParamError("cond");
}

View File

@@ -85,7 +85,7 @@ SDL_CreateSemaphore(Uint32 initial_value)
SDL_sem *sem;
sem = (SDL_sem *) SDL_malloc(sizeof(*sem));
if (!sem) {
if (sem == NULL) {
SDL_OutOfMemory();
return NULL;
}
@@ -129,7 +129,7 @@ SDL_SemTryWait(SDL_sem * sem)
{
int retval;
if (!sem) {
if (sem == NULL) {
return SDL_InvalidParamError("sem");
}
@@ -149,7 +149,7 @@ SDL_SemWaitTimeout(SDL_sem * sem, Uint32 timeout)
{
int retval;
if (!sem) {
if (sem == NULL) {
return SDL_InvalidParamError("sem");
}
@@ -197,7 +197,7 @@ SDL_SemValue(SDL_sem * sem)
int
SDL_SemPost(SDL_sem * sem)
{
if (!sem) {
if (sem == NULL) {
return SDL_InvalidParamError("sem");
}

View File

@@ -46,13 +46,13 @@ SDL_SYS_SetupThread(const char *name)
SDL_threadID
SDL_ThreadID(void)
{
return (0);
return 0;
}
int
SDL_SYS_SetThreadPriority(SDL_ThreadPriority priority)
{
return (0);
return 0;
}
void

View File

@@ -57,7 +57,7 @@ SDL_DestroyCond(SDL_cond *cond)
int
SDL_CondSignal(SDL_cond *cond)
{
if (!cond) {
if (cond == NULL) {
return SDL_InvalidParamError("cond");
}
@@ -69,7 +69,7 @@ SDL_CondSignal(SDL_cond *cond)
int
SDL_CondBroadcast(SDL_cond *cond)
{
if (!cond) {
if (cond == NULL) {
return SDL_InvalidParamError("cond");
}
@@ -103,10 +103,10 @@ SDL_CondWaitTimeout(SDL_cond *cond, SDL_mutex *mutex, Uint32 ms)
{
Result res;
if (!cond) {
if (cond == NULL) {
return SDL_InvalidParamError("cond");
}
if (!mutex) {
if (mutex == NULL) {
return SDL_InvalidParamError("mutex");
}

View File

@@ -43,7 +43,7 @@ SDL_CreateSemaphore(Uint32 initial_value)
}
sem = (SDL_sem *) SDL_malloc(sizeof(*sem));
if (!sem) {
if (sem == NULL) {
SDL_OutOfMemory();
return NULL;
}
@@ -67,7 +67,7 @@ SDL_DestroySemaphore(SDL_sem *sem)
int
SDL_SemTryWait(SDL_sem *sem)
{
if (!sem) {
if (sem == NULL) {
return SDL_InvalidParamError("sem");
}
@@ -79,7 +79,7 @@ SDL_SemWaitTimeout(SDL_sem *sem, Uint32 timeout)
{
int retval;
if (!sem) {
if (sem == NULL) {
return SDL_InvalidParamError("sem");
}
@@ -112,7 +112,7 @@ SDL_SemWait(SDL_sem *sem)
Uint32
SDL_SemValue(SDL_sem *sem)
{
if (!sem) {
if (sem == NULL) {
return SDL_InvalidParamError("sem");
}
return sem->semaphore.current_count;
@@ -121,7 +121,7 @@ SDL_SemValue(SDL_sem *sem)
int
SDL_SemPost(SDL_sem *sem)
{
if (!sem) {
if (sem == NULL) {
return SDL_InvalidParamError("sem");
}
LightSemaphore_Release(&sem->semaphore, 1);

View File

@@ -35,7 +35,7 @@ extern TInt CreateUnique(TInt (*aFunc)(const TDesC& aName, TAny*, TAny*), TAny*,
static TInt NewMutex(const TDesC& aName, TAny* aPtr1, TAny*)
{
return ((RMutex*)aPtr1)->CreateGlobal(aName);
return ((RMutex *)aPtr1)->CreateGlobal(aName);
}
/* Create a mutex */
@@ -45,21 +45,19 @@ SDL_CreateMutex(void)
RMutex rmutex;
TInt status = CreateUnique(NewMutex, &rmutex, NULL);
if(status != KErrNone)
{
if (status != KErrNone) {
SDL_SetError("Couldn't create mutex.");
}
SDL_mutex* mutex = new /*(ELeave)*/ SDL_mutex;
mutex->handle = rmutex.Handle();
return(mutex);
return mutex;
}
/* Free the mutex */
void
SDL_DestroyMutex(SDL_mutex * mutex)
{
if (mutex)
{
if (mutex) {
RMutex rmutex;
rmutex.SetHandle(mutex->handle);
rmutex.Signal();
@@ -88,8 +86,7 @@ SDL_TryLockMutex(SDL_mutex * mutex)
int
SDL_LockMutex(SDL_mutex * mutex)
{
if (mutex == NULL)
{
if (mutex == NULL) {
return SDL_InvalidParamError("mutex");
}
@@ -97,15 +94,14 @@ SDL_LockMutex(SDL_mutex * mutex)
rmutex.SetHandle(mutex->handle);
rmutex.Wait();
return(0);
return 0;
}
/* Unlock the mutex */
int
SDL_UnlockMutex(SDL_mutex * mutex)
{
if ( mutex == NULL )
{
if (mutex == NULL) {
return SDL_InvalidParamError("mutex");
}
@@ -113,7 +109,7 @@ SDL_UnlockMutex(SDL_mutex * mutex)
rmutex.SetHandle(mutex->handle);
rmutex.Signal();
return(0);
return 0;
}
/* vi: set ts=4 sw=4 expandtab: */

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++;

View File

@@ -38,18 +38,13 @@ static int
RunThread(TAny* data)
{
SDL_RunThread((SDL_Thread*)data);
return(0);
return 0;
}
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);
}
int
@@ -73,17 +68,16 @@ SDL_SYS_CreateThread(SDL_Thread *thread)
RThread rthread;
TInt status = CreateUnique(NewThread, &rthread, thread);
if (status != KErrNone)
{
if (status != KErrNone) {
delete(((RThread*)(thread->handle)));
thread->handle = NULL;
SDL_SetError("Not enough resources to create thread");
return(-1);
return -1;
}
rthread.Resume();
thread->handle = rthread.Handle();
return(0);
return 0;
}
void
@@ -103,7 +97,7 @@ SDL_ThreadID(void)
int
SDL_SYS_SetThreadPriority(SDL_ThreadPriority priority)
{
return (0);
return 0;
}
void
@@ -111,8 +105,7 @@ SDL_SYS_WaitThread(SDL_Thread * thread)
{
RThread t;
t.Open(thread->threadid);
if(t.ExitReason() == EExitPending)
{
if (t.ExitReason() == EExitPending) {
TRequestStatus status;
t.Logon(status);
User::WaitForRequest(status);

View File

@@ -103,8 +103,9 @@ int SDL_SemWaitTimeout(SDL_sem *sem, Uint32 timeout)
ret = WaitSema(sem->semid);
StopTimerAlarm(&alarm);
if (ret < 0)
if (ret < 0) {
return SDL_MUTEX_TIMEDOUT;
}
return 0; //Wait condition satisfied.
}

View File

@@ -57,7 +57,7 @@ SDL_CreateCond(void)
} else {
SDL_OutOfMemory();
}
return (cond);
return cond;
}
/* Destroy a condition variable */
@@ -82,7 +82,7 @@ SDL_DestroyCond(SDL_cond * cond)
int
SDL_CondSignal(SDL_cond * cond)
{
if (!cond) {
if (cond == NULL) {
return SDL_InvalidParamError("cond");
}
@@ -106,7 +106,7 @@ SDL_CondSignal(SDL_cond * cond)
int
SDL_CondBroadcast(SDL_cond * cond)
{
if (!cond) {
if (cond == NULL) {
return SDL_InvalidParamError("cond");
}
@@ -162,7 +162,7 @@ SDL_CondWaitTimeout(SDL_cond * cond, SDL_mutex * mutex, Uint32 ms)
{
int retval;
if (!cond) {
if (cond == NULL) {
return SDL_InvalidParamError("cond");
}

View File

@@ -47,7 +47,7 @@ SDL_CreateCond(void)
cond = NULL;
}
}
return (cond);
return cond;
}
/* Destroy a condition variable */
@@ -66,7 +66,7 @@ SDL_CondSignal(SDL_cond * cond)
{
int retval;
if (!cond) {
if (cond == NULL) {
return SDL_InvalidParamError("cond");
}
@@ -83,7 +83,7 @@ SDL_CondBroadcast(SDL_cond * cond)
{
int retval;
if (!cond) {
if (cond == NULL) {
return SDL_InvalidParamError("cond");
}
@@ -103,7 +103,7 @@ SDL_CondWaitTimeout(SDL_cond * cond, SDL_mutex * mutex, Uint32 ms)
#endif
struct timespec abstime;
if (!cond) {
if (cond == NULL) {
return SDL_InvalidParamError("cond");
}
@@ -146,7 +146,7 @@ SDL_CondWaitTimeout(SDL_cond * cond, SDL_mutex * mutex, Uint32 ms)
int
SDL_CondWait(SDL_cond * cond, SDL_mutex * mutex)
{
if (!cond) {
if (cond == NULL) {
return SDL_InvalidParamError("cond");
} else if (pthread_cond_wait(&cond->cond, &mutex->id) != 0) {
return SDL_SetError("pthread_cond_wait() failed");

View File

@@ -63,7 +63,7 @@ SDL_CreateMutex(void)
} else {
SDL_OutOfMemory();
}
return (mutex);
return mutex;
}
void

View File

@@ -70,7 +70,7 @@ SDL_SemTryWait(SDL_sem * sem)
{
int retval;
if (!sem) {
if (sem == NULL) {
return SDL_InvalidParamError("sem");
}
retval = SDL_MUTEX_TIMEDOUT;
@@ -85,7 +85,7 @@ SDL_SemWait(SDL_sem * sem)
{
int retval;
if (!sem) {
if (sem == NULL) {
return SDL_InvalidParamError("sem");
}
@@ -112,7 +112,7 @@ SDL_SemWaitTimeout(SDL_sem * sem, Uint32 timeout)
Uint32 end;
#endif
if (!sem) {
if (sem == NULL) {
return SDL_InvalidParamError("sem");
}
@@ -196,7 +196,7 @@ SDL_SemPost(SDL_sem * sem)
{
int retval;
if (!sem) {
if (sem == NULL) {
return SDL_InvalidParamError("sem");
}

View File

@@ -176,7 +176,7 @@ SDL_SYS_SetupThread(const char *name)
SDL_threadID
SDL_ThreadID(void)
{
return ((SDL_threadID) pthread_self());
return (SDL_threadID)pthread_self();
}
int

View File

@@ -68,7 +68,7 @@ extern "C"
int
SDL_CondSignal(SDL_cond * cond)
{
if (!cond) {
if (cond == NULL) {
return SDL_InvalidParamError("cond");
}
@@ -81,7 +81,7 @@ extern "C"
int
SDL_CondBroadcast(SDL_cond * cond)
{
if (!cond) {
if (cond == NULL) {
return SDL_InvalidParamError("cond");
}
@@ -131,7 +131,7 @@ SDL_CondWaitTimeout(SDL_cond * cond, SDL_mutex * mutex, Uint32 ms)
cpp_lock.release();
return 0;
} else {
auto wait_result = cond->cpp_cond.wait_for(
auto wait_result = cond->cpp_cond.wait_for (
cpp_lock,
std::chrono::duration<Uint32, std::milli>(ms)
);

View File

@@ -97,16 +97,13 @@ SDL_SYS_SetThreadPriority(SDL_ThreadPriority priority)
if (priority == SDL_THREAD_PRIORITY_LOW) {
value = THREAD_PRIORITY_LOWEST;
}
else if (priority == SDL_THREAD_PRIORITY_HIGH) {
} else if (priority == SDL_THREAD_PRIORITY_HIGH) {
value = THREAD_PRIORITY_HIGHEST;
}
else if (priority == SDL_THREAD_PRIORITY_TIME_CRITICAL) {
} else if (priority == SDL_THREAD_PRIORITY_TIME_CRITICAL) {
// FIXME: WinRT does not support TIME_CRITICAL! -flibit
SDL_LogWarn(SDL_LOG_CATEGORY_SYSTEM, "TIME_CRITICAL unsupported, falling back to HIGHEST");
value = THREAD_PRIORITY_HIGHEST;
}
else {
} else {
value = THREAD_PRIORITY_NORMAL;
}
if (!SetThreadPriority(GetCurrentThread(), value)) {

View File

@@ -57,7 +57,7 @@ SDL_CreateCond(void)
} else {
SDL_OutOfMemory();
}
return (cond);
return cond;
}
/* Destroy a condition variable */
@@ -82,7 +82,7 @@ SDL_DestroyCond(SDL_cond * cond)
int
SDL_CondSignal(SDL_cond * cond)
{
if (!cond) {
if (cond == NULL) {
return SDL_InvalidParamError("cond");
}
@@ -106,7 +106,7 @@ SDL_CondSignal(SDL_cond * cond)
int
SDL_CondBroadcast(SDL_cond * cond)
{
if (!cond) {
if (cond == NULL) {
return SDL_InvalidParamError("cond");
}
@@ -162,7 +162,7 @@ SDL_CondWaitTimeout(SDL_cond * cond, SDL_mutex * mutex, Uint32 ms)
{
int retval;
if (!cond) {
if (cond == NULL) {
return SDL_InvalidParamError("cond");
}

View File

@@ -86,7 +86,7 @@ SDL_CreateCond_cv(void)
/* Relies on CONDITION_VARIABLE_INIT == 0. */
cond = (SDL_cond_cv *) SDL_calloc(1, sizeof(*cond));
if (!cond) {
if (cond == NULL) {
SDL_OutOfMemory();
}
@@ -106,7 +106,7 @@ static int
SDL_CondSignal_cv(SDL_cond * _cond)
{
SDL_cond_cv *cond = (SDL_cond_cv *)_cond;
if (!cond) {
if (cond == NULL) {
return SDL_InvalidParamError("cond");
}
@@ -119,7 +119,7 @@ static int
SDL_CondBroadcast_cv(SDL_cond * _cond)
{
SDL_cond_cv *cond = (SDL_cond_cv *)_cond;
if (!cond) {
if (cond == NULL) {
return SDL_InvalidParamError("cond");
}
@@ -135,10 +135,10 @@ SDL_CondWaitTimeout_cv(SDL_cond * _cond, SDL_mutex * _mutex, Uint32 ms)
DWORD timeout;
int ret;
if (!cond) {
if (cond == NULL) {
return SDL_InvalidParamError("cond");
}
if (!_mutex) {
if (_mutex == NULL) {
return SDL_InvalidParamError("mutex");
}
@@ -232,7 +232,7 @@ SDL_CreateCond(void)
if (SDL_mutex_impl_active.Type == SDL_MUTEX_INVALID) {
/* The mutex implementation isn't decided yet, trigger it */
SDL_mutex *mutex = SDL_CreateMutex();
if (!mutex) {
if (mutex == NULL) {
return NULL;
}
SDL_DestroyMutex(mutex);

View File

@@ -64,7 +64,7 @@ SDL_CreateMutex_srw(void)
/* Relies on SRWLOCK_INIT == 0. */
mutex = (SDL_mutex_srw *) SDL_calloc(1, sizeof(*mutex));
if (!mutex) {
if (mutex == NULL) {
SDL_OutOfMemory();
}

View File

@@ -118,7 +118,7 @@ SDL_SemTryWait_atom(SDL_sem * _sem)
SDL_sem_atom *sem = (SDL_sem_atom *)_sem;
LONG count;
if (!sem) {
if (sem == NULL) {
return SDL_InvalidParamError("sem");
}
@@ -140,7 +140,7 @@ SDL_SemWait_atom(SDL_sem * _sem)
SDL_sem_atom *sem = (SDL_sem_atom *)_sem;
LONG count;
if (!sem) {
if (sem == NULL) {
return SDL_InvalidParamError("sem");
}
@@ -172,7 +172,7 @@ SDL_SemWaitTimeout_atom(SDL_sem * _sem, Uint32 timeout)
return SDL_SemWait_atom(_sem);
}
if (!sem) {
if (sem == NULL) {
return SDL_InvalidParamError("sem");
}
@@ -215,7 +215,7 @@ SDL_SemValue_atom(SDL_sem * _sem)
{
SDL_sem_atom *sem = (SDL_sem_atom *)_sem;
if (!sem) {
if (sem == NULL) {
SDL_InvalidParamError("sem");
return 0;
}
@@ -228,7 +228,7 @@ SDL_SemPost_atom(SDL_sem * _sem)
{
SDL_sem_atom *sem = (SDL_sem_atom *)_sem;
if (!sem) {
if (sem == NULL) {
return SDL_InvalidParamError("sem");
}
@@ -309,7 +309,7 @@ SDL_SemWaitTimeout_kern(SDL_sem * _sem, Uint32 timeout)
int retval;
DWORD dwMilliseconds;
if (!sem) {
if (sem == NULL) {
return SDL_InvalidParamError("sem");
}
@@ -350,7 +350,7 @@ static Uint32
SDL_SemValue_kern(SDL_sem * _sem)
{
SDL_sem_kern *sem = (SDL_sem_kern *)_sem;
if (!sem) {
if (sem == NULL) {
SDL_InvalidParamError("sem");
return 0;
}
@@ -361,7 +361,7 @@ static int
SDL_SemPost_kern(SDL_sem * _sem)
{
SDL_sem_kern *sem = (SDL_sem_kern *)_sem;
if (!sem) {
if (sem == NULL) {
return SDL_InvalidParamError("sem");
}
/* Increase the counter in the first place, because
@@ -418,7 +418,7 @@ SDL_CreateSemaphore(Uint32 initial_value)
pWaitOnAddress = (pfnWaitOnAddress) GetProcAddress(synch120, "WaitOnAddress");
pWakeByAddressSingle = (pfnWakeByAddressSingle) GetProcAddress(synch120, "WakeByAddressSingle");
if(pWaitOnAddress && pWakeByAddressSingle) {
if (pWaitOnAddress && pWakeByAddressSingle) {
impl = &SDL_sem_impl_atom;
}
}

View File

@@ -76,7 +76,7 @@ RunThreadViaCreateThread(LPVOID data)
static unsigned __stdcall
RunThreadViaBeginThreadEx(void *data)
{
return (unsigned) RunThread(data);
return (unsigned)RunThread(data);
}
#ifdef SDL_PASSED_BEGINTHREAD_ENDTHREAD
@@ -187,7 +187,7 @@ SDL_SYS_SetupThread(const char *name)
SDL_threadID
SDL_ThreadID(void)
{
return ((SDL_threadID) GetCurrentThreadId());
return (SDL_threadID)GetCurrentThreadId();
}
int