Use new parameter validation macro

This commit is contained in:
Sam Lantinga
2025-09-16 21:51:03 -07:00
parent ee1c90a358
commit 25b2d2c821
60 changed files with 1113 additions and 1133 deletions

View File

@@ -168,13 +168,13 @@ bool SDL_DateTimeToTime(const SDL_DateTime *dt, SDL_Time *ticks)
static const Sint64 min_seconds = SDL_NS_TO_SECONDS(SDL_MIN_TIME) + 1;
bool result = true;
if (!dt) {
CHECK_PARAM(!dt) {
return SDL_InvalidParamError("dt");
}
if (!ticks) {
CHECK_PARAM(!ticks) {
return SDL_InvalidParamError("ticks");
}
if (!SDL_DateTimeIsValid(dt)) {
CHECK_PARAM(!SDL_DateTimeIsValid(dt)) {
// The validation function sets the error string.
return false;
}

View File

@@ -108,7 +108,7 @@ void SDL_GetSystemTimeLocalePreferences(SDL_DateFormat *df, SDL_TimeFormat *tf)
bool SDL_GetCurrentTime(SDL_Time *ticks)
{
if (!ticks) {
CHECK_PARAM(!ticks) {
return SDL_InvalidParamError("ticks");
}
@@ -123,7 +123,7 @@ bool SDL_GetCurrentTime(SDL_Time *ticks)
bool SDL_TimeToDateTime(SDL_Time ticks, SDL_DateTime *dt, bool localTime)
{
if (!dt) {
CHECK_PARAM(!dt) {
return SDL_InvalidParamError("dt");
}

View File

@@ -152,7 +152,7 @@ void SDL_GetSystemTimeLocalePreferences(SDL_DateFormat *df, SDL_TimeFormat *tf)
bool SDL_GetCurrentTime(SDL_Time *ticks)
{
if (!ticks) {
CHECK_PARAM(!ticks) {
return SDL_InvalidParamError("ticks");
}

View File

@@ -34,7 +34,7 @@ void SDL_GetSystemTimeLocalePreferences(SDL_DateFormat *df, SDL_TimeFormat *tf)
bool SDL_GetCurrentTime(SDL_Time *ticks)
{
if (!ticks) {
CHECK_PARAM(!ticks) {
return SDL_InvalidParamError("ticks");
}
@@ -45,7 +45,7 @@ bool SDL_GetCurrentTime(SDL_Time *ticks)
bool SDL_TimeToDateTime(SDL_Time ticks, SDL_DateTime *dt, bool localTime)
{
if (!dt) {
CHECK_PARAM(!dt) {
return SDL_InvalidParamError("dt");
}

View File

@@ -69,7 +69,7 @@ bool SDL_GetCurrentTime(SDL_Time *ticks)
{
u64 sceTicks;
if (!ticks) {
CHECK_PARAM(!ticks) {
return SDL_InvalidParamError("ticks");
}
@@ -99,7 +99,7 @@ bool SDL_TimeToDateTime(SDL_Time ticks, SDL_DateTime *dt, bool localTime)
u64 local;
int ret = 0;
if (!dt) {
CHECK_PARAM(!dt) {
return SDL_InvalidParamError("dt");
}

View File

@@ -101,7 +101,7 @@ found_date:
bool SDL_GetCurrentTime(SDL_Time *ticks)
{
if (!ticks) {
CHECK_PARAM(!ticks) {
return SDL_InvalidParamError("ticks");
}
#ifdef HAVE_CLOCK_GETTIME
@@ -158,7 +158,7 @@ bool SDL_TimeToDateTime(SDL_Time ticks, SDL_DateTime *dt, bool localTime)
#endif
struct tm *tm = NULL;
if (!dt) {
CHECK_PARAM(!dt) {
return SDL_InvalidParamError("dt");
}

View File

@@ -75,7 +75,7 @@ bool SDL_GetCurrentTime(SDL_Time *ticks)
{
SceRtcTick sceTicks;
if (!ticks) {
CHECK_PARAM(!ticks) {
return SDL_InvalidParamError("ticks");
}
@@ -104,7 +104,7 @@ bool SDL_TimeToDateTime(SDL_Time ticks, SDL_DateTime *dt, bool localTime)
SceRtcTick sceTicks, sceLocalTicks;
int ret = 0;
if (!dt) {
CHECK_PARAM(!dt) {
return SDL_InvalidParamError("dt");
}

View File

@@ -79,7 +79,7 @@ bool SDL_GetCurrentTime(SDL_Time *ticks)
{
FILETIME ft;
if (!ticks) {
CHECK_PARAM(!ticks) {
return SDL_InvalidParamError("ticks");
}
@@ -115,7 +115,7 @@ bool SDL_TimeToDateTime(SDL_Time ticks, SDL_DateTime *dt, bool localTime)
SYSTEMTIME *st = NULL;
Uint32 low, high;
if (!dt) {
CHECK_PARAM(!dt) {
return SDL_InvalidParamError("dt");
}