Pointer as bool (libsdl-org#7214)
This commit is contained in:
@@ -48,7 +48,7 @@ static void
|
||||
quit(int rc)
|
||||
{
|
||||
SDL_Quit();
|
||||
if (native_window != NULL && factory != NULL) {
|
||||
if (native_window && factory) {
|
||||
factory->DestroyNativeWindow(native_window);
|
||||
}
|
||||
SDLTest_CommonDestroyState(state);
|
||||
@@ -109,7 +109,7 @@ int main(int argc, char *argv[])
|
||||
|
||||
/* Initialize test framework */
|
||||
state = SDLTest_CommonCreateState(argv, 0);
|
||||
if (state == NULL) {
|
||||
if (!state) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -135,19 +135,19 @@ int main(int argc, char *argv[])
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (factory == NULL) {
|
||||
if (!factory) {
|
||||
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't find native window code for %s driver\n",
|
||||
driver);
|
||||
quit(2);
|
||||
}
|
||||
SDL_Log("Creating native window for %s driver\n", driver);
|
||||
native_window = factory->CreateNativeWindow(WINDOW_W, WINDOW_H);
|
||||
if (native_window == NULL) {
|
||||
if (!native_window) {
|
||||
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't create native window\n");
|
||||
quit(3);
|
||||
}
|
||||
window = SDL_CreateWindowFrom(native_window);
|
||||
if (window == NULL) {
|
||||
if (!window) {
|
||||
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't create SDL window: %s\n", SDL_GetError());
|
||||
quit(4);
|
||||
}
|
||||
@@ -155,7 +155,7 @@ int main(int argc, char *argv[])
|
||||
|
||||
/* Create the renderer */
|
||||
renderer = SDL_CreateRenderer(window, NULL, 0);
|
||||
if (renderer == NULL) {
|
||||
if (!renderer) {
|
||||
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't create renderer: %s\n", SDL_GetError());
|
||||
quit(5);
|
||||
}
|
||||
@@ -165,7 +165,7 @@ int main(int argc, char *argv[])
|
||||
SDL_RenderClear(renderer);
|
||||
|
||||
sprite = LoadTexture(renderer, "icon.bmp", SDL_TRUE, NULL, NULL);
|
||||
if (sprite == NULL) {
|
||||
if (!sprite) {
|
||||
quit(6);
|
||||
}
|
||||
|
||||
@@ -174,7 +174,7 @@ int main(int argc, char *argv[])
|
||||
SDL_QueryTexture(sprite, NULL, NULL, &sprite_w, &sprite_h);
|
||||
positions = (SDL_FRect *)SDL_malloc(NUM_SPRITES * sizeof(*positions));
|
||||
velocities = (SDL_FRect *)SDL_malloc(NUM_SPRITES * sizeof(*velocities));
|
||||
if (positions == NULL || velocities == NULL) {
|
||||
if (!positions || !velocities) {
|
||||
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Out of memory!\n");
|
||||
quit(2);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user