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

@@ -70,8 +70,7 @@ int
SDL_CondSignal(SDL_cond * cond)
{
if (!cond) {
SDL_SetError("Passed a NULL condition variable");
return -1;
return SDL_InvalidParamError("cond");
}
cond->cpp_cond.notify_one();
@@ -84,8 +83,7 @@ int
SDL_CondBroadcast(SDL_cond * cond)
{
if (!cond) {
SDL_SetError("Passed a NULL condition variable");
return -1;
return SDL_InvalidParamError("cond");
}
cond->cpp_cond.notify_all();
@@ -118,13 +116,11 @@ int
SDL_CondWaitTimeout(SDL_cond * cond, SDL_mutex * mutex, Uint32 ms)
{
if (!cond) {
SDL_SetError("Passed a NULL condition variable");
return -1;
return SDL_InvalidParamError("cond");
}
if (!mutex) {
SDL_SetError("Passed a NULL mutex variable");
return -1;
return SDL_InvalidParamError("mutex");
}
try {
@@ -148,8 +144,7 @@ SDL_CondWaitTimeout(SDL_cond * cond, SDL_mutex * mutex, Uint32 ms)
}
}
} catch (std::system_error & ex) {
SDL_SetError("unable to wait on a C++ condition variable: code=%d; %s", ex.code(), ex.what());
return -1;
return SDL_SetError("unable to wait on a C++ condition variable: code=%d; %s", ex.code(), ex.what());
}
}