mirror of
https://github.com/libsdl-org/SDL.git
synced 2025-12-15 19:05:32 +00:00
Pointer as bool (libsdl-org#7214)
This commit is contained in:
@@ -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());
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user