Pointer as bool (libsdl-org#7214)

This commit is contained in:
Sylvain
2023-11-09 22:29:15 +01:00
committed by Sam Lantinga
parent 23db971681
commit d8600f717e
371 changed files with 2448 additions and 2442 deletions

View File

@@ -28,13 +28,13 @@ GetNearbyFilename(const char *file)
base = SDL_GetBasePath();
if (base != NULL) {
if (base) {
SDL_RWops *rw;
size_t len = SDL_strlen(base) + SDL_strlen(file) + 1;
path = SDL_malloc(len);
if (path == NULL) {
if (!path) {
SDL_free(base);
SDL_OutOfMemory();
return NULL;
@@ -54,7 +54,7 @@ GetNearbyFilename(const char *file)
}
path = SDL_strdup(file);
if (path == NULL) {
if (!path) {
SDL_OutOfMemory();
}
return path;
@@ -72,10 +72,10 @@ GetNearbyFilename(const char *file)
char *
GetResourceFilename(const char *user_specified, const char *def)
{
if (user_specified != NULL) {
if (user_specified) {
char *ret = SDL_strdup(user_specified);
if (ret == NULL) {
if (!ret) {
SDL_OutOfMemory();
}
@@ -105,12 +105,12 @@ LoadTexture(SDL_Renderer *renderer, const char *file, SDL_bool transparent,
path = GetNearbyFilename(file);
if (path != NULL) {
if (path) {
file = path;
}
temp = SDL_LoadBMP(file);
if (temp == NULL) {
if (!temp) {
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't load %s: %s", file, SDL_GetError());
} else {
/* Set transparent pixel as the pixel at (0,0) */
@@ -137,16 +137,16 @@ LoadTexture(SDL_Renderer *renderer, const char *file, SDL_bool transparent,
}
}
if (width_out != NULL) {
if (width_out) {
*width_out = temp->w;
}
if (height_out != NULL) {
if (height_out) {
*height_out = temp->h;
}
texture = SDL_CreateTextureFromSurface(renderer, temp);
if (texture == NULL) {
if (!texture) {
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't create texture: %s\n", SDL_GetError());
}
}