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

@@ -250,10 +250,10 @@ static bool SDLCALL CopyOneProperty(void *userdata, const SDL_HashTable *table,
bool SDL_CopyProperties(SDL_PropertiesID src, SDL_PropertiesID dst)
{
if (!src) {
CHECK_PARAM(!src) {
return SDL_InvalidParamError("src");
}
if (!dst) {
CHECK_PARAM(!dst) {
return SDL_InvalidParamError("dst");
}
@@ -261,11 +261,11 @@ bool SDL_CopyProperties(SDL_PropertiesID src, SDL_PropertiesID dst)
SDL_Properties *dst_properties = NULL;
SDL_FindInHashTable(SDL_properties, (const void *)(uintptr_t)src, (const void **)&src_properties);
if (!src_properties) {
CHECK_PARAM(!src_properties) {
return SDL_InvalidParamError("src");
}
SDL_FindInHashTable(SDL_properties, (const void *)(uintptr_t)dst, (const void **)&dst_properties);
if (!dst_properties) {
CHECK_PARAM(!dst_properties) {
return SDL_InvalidParamError("dst");
}
@@ -287,12 +287,12 @@ bool SDL_LockProperties(SDL_PropertiesID props)
{
SDL_Properties *properties = NULL;
if (!props) {
CHECK_PARAM(!props) {
return SDL_InvalidParamError("props");
}
SDL_FindInHashTable(SDL_properties, (const void *)(uintptr_t)props, (const void **)&properties);
if (!properties) {
CHECK_PARAM(!properties) {
return SDL_InvalidParamError("props");
}
@@ -321,17 +321,17 @@ static bool SDL_PrivateSetProperty(SDL_PropertiesID props, const char *name, SDL
SDL_Properties *properties = NULL;
bool result = true;
if (!props) {
CHECK_PARAM(!props) {
SDL_FreePropertyWithCleanup(NULL, property, NULL, true);
return SDL_InvalidParamError("props");
}
if (!name || !*name) {
CHECK_PARAM(!name || !*name) {
SDL_FreePropertyWithCleanup(NULL, property, NULL, true);
return SDL_InvalidParamError("name");
}
SDL_FindInHashTable(SDL_properties, (const void *)(uintptr_t)props, (const void **)&properties);
if (!properties) {
CHECK_PARAM(!properties) {
SDL_FreePropertyWithCleanup(NULL, property, NULL, true);
return SDL_InvalidParamError("props");
}
@@ -755,15 +755,15 @@ bool SDL_EnumerateProperties(SDL_PropertiesID props, SDL_EnumeratePropertiesCall
{
SDL_Properties *properties = NULL;
if (!props) {
CHECK_PARAM(!props) {
return SDL_InvalidParamError("props");
}
if (!callback) {
CHECK_PARAM(!callback) {
return SDL_InvalidParamError("callback");
}
SDL_FindInHashTable(SDL_properties, (const void *)(uintptr_t)props, (const void **)&properties);
if (!properties) {
CHECK_PARAM(!properties) {
return SDL_InvalidParamError("props");
}