use SDL_InvalidParamError or SDL_assert instead of custom SDL_SetError

This commit is contained in:
pionere
2022-01-17 16:26:02 +01:00
committed by Ryan C. Gordon
parent 4a17612bff
commit ebdd536676
36 changed files with 109 additions and 123 deletions

View File

@@ -88,7 +88,7 @@ SDL_LockMutex_srw(SDL_mutex * _mutex)
DWORD this_thread;
if (mutex == NULL) {
return SDL_SetError("Passed a NULL mutex");
return SDL_InvalidParamError("mutex");
}
this_thread = GetCurrentThreadId();
@@ -115,7 +115,7 @@ SDL_TryLockMutex_srw(SDL_mutex * _mutex)
int retval = 0;
if (mutex == NULL) {
return SDL_SetError("Passed a NULL mutex");
return SDL_InvalidParamError("mutex");
}
this_thread = GetCurrentThreadId();
@@ -139,7 +139,7 @@ SDL_UnlockMutex_srw(SDL_mutex * _mutex)
SDL_mutex_srw *mutex = (SDL_mutex_srw *)_mutex;
if (mutex == NULL) {
return SDL_SetError("Passed a NULL mutex");
return SDL_InvalidParamError("mutex");
}
if (mutex->owner == GetCurrentThreadId()) {
@@ -208,7 +208,7 @@ SDL_LockMutex_cs(SDL_mutex * mutex_)
{
SDL_mutex_cs *mutex = (SDL_mutex_cs *)mutex_;
if (mutex == NULL) {
return SDL_SetError("Passed a NULL mutex");
return SDL_InvalidParamError("mutex");
}
EnterCriticalSection(&mutex->cs);
@@ -222,7 +222,7 @@ SDL_TryLockMutex_cs(SDL_mutex * mutex_)
SDL_mutex_cs *mutex = (SDL_mutex_cs *)mutex_;
int retval = 0;
if (mutex == NULL) {
return SDL_SetError("Passed a NULL mutex");
return SDL_InvalidParamError("mutex");
}
if (TryEnterCriticalSection(&mutex->cs) == 0) {
@@ -237,7 +237,7 @@ SDL_UnlockMutex_cs(SDL_mutex * mutex_)
{
SDL_mutex_cs *mutex = (SDL_mutex_cs *)mutex_;
if (mutex == NULL) {
return SDL_SetError("Passed a NULL mutex");
return SDL_InvalidParamError("mutex");
}
LeaveCriticalSection(&mutex->cs);