Pointer as bool (libsdl-org#7214)
This commit is contained in:
@@ -241,7 +241,7 @@ int main(int argc, char *argv[])
|
||||
|
||||
/* Initialize test framework */
|
||||
state = SDLTest_CommonCreateState(argv, SDL_INIT_VIDEO);
|
||||
if (state == NULL) {
|
||||
if (!state) {
|
||||
return 1;
|
||||
}
|
||||
state->window_title = "CheckKeys Test";
|
||||
|
||||
@@ -247,7 +247,7 @@ int main(int argc, char *argv[])
|
||||
|
||||
/* Initialize test framework */
|
||||
state = SDLTest_CommonCreateState(argv, 0);
|
||||
if (state == NULL) {
|
||||
if (!state) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -267,7 +267,7 @@ int main(int argc, char *argv[])
|
||||
|
||||
/* Set 640x480 video mode */
|
||||
window = SDL_CreateWindow("CheckKeys Test", 640, 480, 0);
|
||||
if (window == NULL) {
|
||||
if (!window) {
|
||||
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't create 640x480 window: %s\n",
|
||||
SDL_GetError());
|
||||
quit(2);
|
||||
|
||||
@@ -2658,7 +2658,7 @@ SDL_GamepadType GetMappingType(const char *mapping)
|
||||
char *SetMappingType(char *mapping, SDL_GamepadType type)
|
||||
{
|
||||
const char *type_string = SDL_GetGamepadStringForType(type);
|
||||
if (type_string == NULL || type == SDL_GAMEPAD_TYPE_UNKNOWN) {
|
||||
if (!type_string || type == SDL_GAMEPAD_TYPE_UNKNOWN) {
|
||||
return RemoveMappingValue(mapping, "type");
|
||||
} else {
|
||||
return SetMappingValue(mapping, "type", type_string);
|
||||
|
||||
@@ -52,7 +52,7 @@ int SDL_AppInit(int argc, char *argv[])
|
||||
|
||||
/* Initialize test framework */
|
||||
state = SDLTest_CommonCreateState(argv, 0);
|
||||
if (state == NULL) {
|
||||
if (!state) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -87,7 +87,7 @@ int SDL_AppInit(int argc, char *argv[])
|
||||
|
||||
filename = GetResourceFilename(filename, "sample.wav");
|
||||
|
||||
if (filename == NULL) {
|
||||
if (!filename) {
|
||||
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "%s\n", SDL_GetError());
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -701,7 +701,7 @@ int main(int argc, char *argv[])
|
||||
|
||||
/* Initialize test framework */
|
||||
state = SDLTest_CommonCreateState(argv, 0);
|
||||
if (state == NULL) {
|
||||
if (!state) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
@@ -146,7 +146,7 @@ static Thing *FindThingAtPoint(const float x, const float y)
|
||||
const SDL_FPoint pt = { x, y };
|
||||
Thing *retval = NULL;
|
||||
Thing *i;
|
||||
for (i = things; i != NULL; i = i->next) {
|
||||
for (i = things; i; i = i->next) {
|
||||
if ((i != dragging_thing) && SDL_PointInRectFloat(&pt, &i->rect)) {
|
||||
retval = i; /* keep going, though, because things drawn on top are later in the list. */
|
||||
}
|
||||
@@ -188,7 +188,7 @@ static Thing *CreateThing(ThingType what, float x, float y, float z, float w, fl
|
||||
}
|
||||
|
||||
if ((w < 0) || (h < 0)) {
|
||||
SDL_assert(texture != NULL);
|
||||
SDL_assert(texture);
|
||||
if (w < 0) {
|
||||
w = texture->w;
|
||||
}
|
||||
@@ -213,12 +213,12 @@ static Thing *CreateThing(ThingType what, float x, float y, float z, float w, fl
|
||||
thing->titlebar = titlebar ? SDL_strdup(titlebar) : NULL; /* if allocation fails, oh well. */
|
||||
|
||||
/* insert in list by Z order (furthest from the "camera" first, so they get drawn over; negative Z is not drawn at all). */
|
||||
if (things == NULL) {
|
||||
if (!things) {
|
||||
things = thing;
|
||||
return thing;
|
||||
}
|
||||
|
||||
for (i = things; i != NULL; i = i->next) {
|
||||
for (i = things; i; i = i->next) {
|
||||
if (z > i->z) { /* insert here. */
|
||||
thing->next = i;
|
||||
thing->prev = i->prev;
|
||||
@@ -389,7 +389,7 @@ static void RepositionRowOfThings(const ThingType what, const float y)
|
||||
float texh = 0.0f;
|
||||
Thing *i;
|
||||
|
||||
for (i = things; i != NULL; i = i->next) {
|
||||
for (i = things; i; i = i->next) {
|
||||
if (i->what == what) {
|
||||
texw = i->rect.w;
|
||||
texh = i->rect.h;
|
||||
@@ -402,7 +402,7 @@ static void RepositionRowOfThings(const ThingType what, const float y)
|
||||
SDL_GetWindowSize(state->windows[0], &w, &h);
|
||||
const float spacing = w / ((float) total_things);
|
||||
float x = (spacing - texw) / 2.0f;
|
||||
for (i = things; i != NULL; i = i->next) {
|
||||
for (i = things; i; i = i->next) {
|
||||
if (i->what == what) {
|
||||
i->rect.x = x;
|
||||
i->rect.y = (y >= 0.0f) ? y : ((h + y) - texh);
|
||||
@@ -494,7 +494,7 @@ static void DestroyThingInPoof(Thing *thing)
|
||||
static void TrashThing(Thing *thing)
|
||||
{
|
||||
Thing *i, *next;
|
||||
for (i = things; i != NULL; i = next) {
|
||||
for (i = things; i; i = next) {
|
||||
next = i->next;
|
||||
if (i->line_connected_to == thing) {
|
||||
TrashThing(i);
|
||||
@@ -1009,7 +1009,7 @@ static void TickThings(void)
|
||||
Thing *i;
|
||||
Thing *next;
|
||||
const Uint64 now = SDL_GetTicks();
|
||||
for (i = things; i != NULL; i = next) {
|
||||
for (i = things; i; i = next) {
|
||||
next = i->next; /* in case this deletes itself. */
|
||||
if (i->ontick) {
|
||||
i->ontick(i, now);
|
||||
@@ -1024,7 +1024,7 @@ static void WindowResized(const int newwinw, const int newwinh)
|
||||
const float newh = (float) newwinh;
|
||||
const float oldw = (float) state->window_w;
|
||||
const float oldh = (float) state->window_h;
|
||||
for (i = things; i != NULL; i = i->next) {
|
||||
for (i = things; i; i = i->next) {
|
||||
const float halfw = i->rect.w / 2.0f;
|
||||
const float halfh = i->rect.h / 2.0f;
|
||||
const float x = (i->rect.x + halfw) / oldw;
|
||||
@@ -1041,7 +1041,7 @@ int SDL_AppInit(int argc, char *argv[])
|
||||
int i;
|
||||
|
||||
state = SDLTest_CommonCreateState(argv, SDL_INIT_VIDEO | SDL_INIT_AUDIO);
|
||||
if (state == NULL) {
|
||||
if (!state) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -1195,7 +1195,7 @@ int SDL_AppEvent(const SDL_Event *event)
|
||||
const SDL_AudioDeviceID which = event->adevice.which;
|
||||
Thing *i, *next;
|
||||
SDL_Log("Removing audio device %u", (unsigned int) which);
|
||||
for (i = things; i != NULL; i = next) {
|
||||
for (i = things; i; i = next) {
|
||||
next = i->next;
|
||||
if (((i->what == THING_PHYSDEV) || (i->what == THING_PHYSDEV_CAPTURE)) && (i->data.physdev.devid == which)) {
|
||||
TrashThing(i);
|
||||
@@ -1234,7 +1234,7 @@ int SDL_AppIterate(void)
|
||||
|
||||
void SDL_AppQuit(void)
|
||||
{
|
||||
while (things != NULL) {
|
||||
while (things) {
|
||||
DestroyThing(things); /* make sure all the audio devices are closed, etc. */
|
||||
}
|
||||
|
||||
|
||||
@@ -36,7 +36,7 @@ int SDL_AppInit(int argc, char **argv)
|
||||
|
||||
/* Initialize test framework */
|
||||
state = SDLTest_CommonCreateState(argv, 0);
|
||||
if (state == NULL) {
|
||||
if (!state) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
@@ -72,7 +72,7 @@ static void iteration(void)
|
||||
const SDL_AudioDeviceID which = (SDL_AudioDeviceID) e.adevice.which;
|
||||
const SDL_bool iscapture = e.adevice.iscapture ? SDL_TRUE : SDL_FALSE;
|
||||
char *name = SDL_GetAudioDeviceName(which);
|
||||
if (name != NULL) {
|
||||
if (name) {
|
||||
SDL_Log("New %s audio device at id %u: %s", devtypestr(iscapture), (unsigned int)which, name);
|
||||
} else {
|
||||
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Got new %s device, id %u, but failed to get the name: %s",
|
||||
@@ -119,7 +119,7 @@ int main(int argc, char *argv[])
|
||||
|
||||
/* Initialize test framework */
|
||||
state = SDLTest_CommonCreateState(argv, 0);
|
||||
if (state == NULL) {
|
||||
if (!state) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -154,7 +154,7 @@ int main(int argc, char *argv[])
|
||||
|
||||
/* Some targets (Mac CoreAudio) need an event queue for audio hotplug, so make and immediately hide a window. */
|
||||
window = SDL_CreateWindow("testaudiohotplug", 640, 480, 0);
|
||||
if (window == NULL) {
|
||||
if (!window) {
|
||||
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "SDL_CreateWindow failed: %s\n", SDL_GetError());
|
||||
quit(1);
|
||||
}
|
||||
@@ -162,7 +162,7 @@ int main(int argc, char *argv[])
|
||||
|
||||
filename = GetResourceFilename(filename, "sample.wav");
|
||||
|
||||
if (filename == NULL) {
|
||||
if (!filename) {
|
||||
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "%s\n", SDL_GetError());
|
||||
quit(1);
|
||||
}
|
||||
|
||||
@@ -22,7 +22,7 @@ print_devices(SDL_bool iscapture)
|
||||
int frames;
|
||||
SDL_AudioDeviceID *devices = iscapture ? SDL_GetAudioCaptureDevices(&n) : SDL_GetAudioOutputDevices(&n);
|
||||
|
||||
if (devices == NULL) {
|
||||
if (!devices) {
|
||||
SDL_Log(" Driver failed to report %s devices: %s\n\n", typestr, SDL_GetError());
|
||||
} else if (n == 0) {
|
||||
SDL_Log(" No %s devices found.\n\n", typestr);
|
||||
@@ -31,7 +31,7 @@ print_devices(SDL_bool iscapture)
|
||||
SDL_Log("Found %d %s device%s:\n", n, typestr, n != 1 ? "s" : "");
|
||||
for (i = 0; i < n; i++) {
|
||||
char *name = SDL_GetAudioDeviceName(devices[i]);
|
||||
if (name != NULL) {
|
||||
if (name) {
|
||||
SDL_Log(" %d: %s\n", i, name);
|
||||
SDL_free(name);
|
||||
} else {
|
||||
@@ -60,7 +60,7 @@ int main(int argc, char **argv)
|
||||
|
||||
/* Initialize test framework */
|
||||
state = SDLTest_CommonCreateState(argv, 0);
|
||||
if (state == NULL) {
|
||||
if (!state) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
@@ -158,7 +158,7 @@ static void skip_audio(float amount)
|
||||
num_frames = (int)(new_spec.freq * ((speed * amount) / 100.0f));
|
||||
buf = SDL_malloc(num_frames);
|
||||
|
||||
if (buf != NULL) {
|
||||
if (buf) {
|
||||
retval = SDL_GetAudioStreamData(stream, buf, num_frames);
|
||||
SDL_free(buf);
|
||||
}
|
||||
@@ -374,7 +374,7 @@ int main(int argc, char *argv[])
|
||||
|
||||
/* Initialize test framework */
|
||||
state = SDLTest_CommonCreateState(argv, SDL_INIT_AUDIO | SDL_INIT_VIDEO);
|
||||
if (state == NULL) {
|
||||
if (!state) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
@@ -72,7 +72,7 @@ int main(int argc, char *argv[])
|
||||
|
||||
/* Initialize test framework */
|
||||
state = SDLTest_CommonCreateState(argv, SDL_INIT_VIDEO | SDL_INIT_AUDIO);
|
||||
if (state == NULL) {
|
||||
if (!state) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
@@ -418,7 +418,7 @@ static SDL_Window *createMouseSuiteTestWindow(void)
|
||||
*/
|
||||
static void destroyMouseSuiteTestWindow(SDL_Window *window)
|
||||
{
|
||||
if (window != NULL) {
|
||||
if (window) {
|
||||
SDL_DestroyWindow(window);
|
||||
window = NULL;
|
||||
SDLTest_AssertPass("SDL_DestroyWindow()");
|
||||
@@ -454,7 +454,7 @@ static int mouse_warpMouseInWindow(void *arg)
|
||||
yPositions[5] = (float)h + 1;
|
||||
/* Create test window */
|
||||
window = createMouseSuiteTestWindow();
|
||||
if (window == NULL) {
|
||||
if (!window) {
|
||||
return TEST_ABORTED;
|
||||
}
|
||||
|
||||
@@ -507,7 +507,7 @@ static int mouse_getMouseFocus(void *arg)
|
||||
|
||||
/* Create test window */
|
||||
window = createMouseSuiteTestWindow();
|
||||
if (window == NULL) {
|
||||
if (!window) {
|
||||
return TEST_ABORTED;
|
||||
}
|
||||
|
||||
|
||||
@@ -76,13 +76,13 @@ static void InitCreateRenderer(void *arg)
|
||||
*/
|
||||
static void CleanupDestroyRenderer(void *arg)
|
||||
{
|
||||
if (renderer != NULL) {
|
||||
if (renderer) {
|
||||
SDL_DestroyRenderer(renderer);
|
||||
renderer = NULL;
|
||||
SDLTest_AssertPass("SDL_DestroyRenderer()");
|
||||
}
|
||||
|
||||
if (window != NULL) {
|
||||
if (window) {
|
||||
SDL_DestroyWindow(window);
|
||||
window = NULL;
|
||||
SDLTest_AssertPass("SDL_DestroyWindow");
|
||||
@@ -1054,12 +1054,12 @@ loadTestFace(void)
|
||||
SDL_Texture *tface;
|
||||
|
||||
face = SDLTest_ImageFace();
|
||||
if (face == NULL) {
|
||||
if (!face) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
tface = SDL_CreateTextureFromSurface(renderer, face);
|
||||
if (tface == NULL) {
|
||||
if (!tface) {
|
||||
SDLTest_LogError("SDL_CreateTextureFromSurface() failed with error: %s", SDL_GetError());
|
||||
}
|
||||
|
||||
@@ -1085,7 +1085,7 @@ hasTexColor(void)
|
||||
|
||||
/* Get test face. */
|
||||
tface = loadTestFace();
|
||||
if (tface == NULL) {
|
||||
if (!tface) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -1128,7 +1128,7 @@ hasTexAlpha(void)
|
||||
|
||||
/* Get test face. */
|
||||
tface = loadTestFace();
|
||||
if (tface == NULL) {
|
||||
if (!tface) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -453,10 +453,10 @@ static int stdlib_getsetenv(void *arg)
|
||||
|
||||
text = SDL_getenv(name);
|
||||
SDLTest_AssertPass("Call to SDL_getenv('%s')", name);
|
||||
if (text != NULL) {
|
||||
if (text) {
|
||||
SDLTest_Log("Expected: NULL, Got: '%s' (%i)", text, (int)SDL_strlen(text));
|
||||
}
|
||||
} while (text != NULL);
|
||||
} while (text);
|
||||
|
||||
/* Create random values to set */
|
||||
value1 = SDLTest_RandomAsciiStringOfSize(10);
|
||||
|
||||
@@ -353,21 +353,21 @@ static int surface_testCompleteSurfaceConversion(void *arg)
|
||||
for (i = 0; i < SDL_arraysize(pixel_formats); ++i) {
|
||||
for (j = 0; j < SDL_arraysize(pixel_formats); ++j) {
|
||||
fmt1 = SDL_CreatePixelFormat(pixel_formats[i]);
|
||||
SDL_assert(fmt1 != NULL);
|
||||
SDL_assert(fmt1);
|
||||
cvt1 = SDL_ConvertSurface(face, fmt1);
|
||||
SDL_assert(cvt1 != NULL);
|
||||
SDL_assert(cvt1);
|
||||
|
||||
fmt2 = SDL_CreatePixelFormat(pixel_formats[j]);
|
||||
SDL_assert(fmt1 != NULL);
|
||||
SDL_assert(fmt1);
|
||||
cvt2 = SDL_ConvertSurface(cvt1, fmt2);
|
||||
SDL_assert(cvt2 != NULL);
|
||||
SDL_assert(cvt2);
|
||||
|
||||
if (fmt1->BytesPerPixel == face->format->BytesPerPixel &&
|
||||
fmt2->BytesPerPixel == face->format->BytesPerPixel &&
|
||||
(fmt1->Amask != 0) == (face->format->Amask != 0) &&
|
||||
(fmt2->Amask != 0) == (face->format->Amask != 0)) {
|
||||
final = SDL_ConvertSurface(cvt2, face->format);
|
||||
SDL_assert(final != NULL);
|
||||
SDL_assert(final);
|
||||
|
||||
/* Compare surface. */
|
||||
ret = SDLTest_CompareSurfaces(face, final, 0);
|
||||
|
||||
@@ -542,7 +542,7 @@ static int video_getSetWindowGrab(void *arg)
|
||||
|
||||
/* Call against new test window */
|
||||
window = createVideoSuiteTestWindow(title);
|
||||
if (window == NULL) {
|
||||
if (!window) {
|
||||
return TEST_ABORTED;
|
||||
}
|
||||
|
||||
@@ -703,7 +703,7 @@ static int video_getWindowId(void *arg)
|
||||
|
||||
/* Call against new test window */
|
||||
window = createVideoSuiteTestWindow(title);
|
||||
if (window == NULL) {
|
||||
if (!window) {
|
||||
return TEST_ABORTED;
|
||||
}
|
||||
|
||||
@@ -758,7 +758,7 @@ static int video_getWindowPixelFormat(void *arg)
|
||||
|
||||
/* Call against new test window */
|
||||
window = createVideoSuiteTestWindow(title);
|
||||
if (window == NULL) {
|
||||
if (!window) {
|
||||
return TEST_ABORTED;
|
||||
}
|
||||
|
||||
@@ -828,7 +828,7 @@ static int video_getSetWindowPosition(void *arg)
|
||||
|
||||
/* Call against new test window */
|
||||
window = createVideoSuiteTestWindow(title);
|
||||
if (window == NULL) {
|
||||
if (!window) {
|
||||
return TEST_ABORTED;
|
||||
}
|
||||
|
||||
@@ -1000,7 +1000,7 @@ static int video_getSetWindowSize(void *arg)
|
||||
|
||||
/* Call against new test window */
|
||||
window = createVideoSuiteTestWindow(title);
|
||||
if (window == NULL) {
|
||||
if (!window) {
|
||||
return TEST_ABORTED;
|
||||
}
|
||||
|
||||
@@ -1183,7 +1183,7 @@ static int video_getSetWindowMinimumSize(void *arg)
|
||||
|
||||
/* Call against new test window */
|
||||
window = createVideoSuiteTestWindow(title);
|
||||
if (window == NULL) {
|
||||
if (!window) {
|
||||
return TEST_ABORTED;
|
||||
}
|
||||
|
||||
@@ -1325,7 +1325,7 @@ static int video_getSetWindowMaximumSize(void *arg)
|
||||
|
||||
/* Call against new test window */
|
||||
window = createVideoSuiteTestWindow(title);
|
||||
if (window == NULL) {
|
||||
if (!window) {
|
||||
return TEST_ABORTED;
|
||||
}
|
||||
|
||||
@@ -1463,30 +1463,30 @@ static int video_getSetWindowData(void *arg)
|
||||
|
||||
/* Call against new test window */
|
||||
window = createVideoSuiteTestWindow(title);
|
||||
if (window == NULL) {
|
||||
if (!window) {
|
||||
return TEST_ABORTED;
|
||||
}
|
||||
|
||||
/* Create testdata */
|
||||
datasize = SDLTest_RandomIntegerInRange(1, 32);
|
||||
referenceUserdata = SDLTest_RandomAsciiStringOfSize(datasize);
|
||||
if (referenceUserdata == NULL) {
|
||||
if (!referenceUserdata) {
|
||||
returnValue = TEST_ABORTED;
|
||||
goto cleanup;
|
||||
}
|
||||
userdata = SDL_strdup(referenceUserdata);
|
||||
if (userdata == NULL) {
|
||||
if (!userdata) {
|
||||
returnValue = TEST_ABORTED;
|
||||
goto cleanup;
|
||||
}
|
||||
datasize = SDLTest_RandomIntegerInRange(1, 32);
|
||||
referenceUserdata2 = SDLTest_RandomAsciiStringOfSize(datasize);
|
||||
if (referenceUserdata2 == NULL) {
|
||||
if (!referenceUserdata2) {
|
||||
returnValue = TEST_ABORTED;
|
||||
goto cleanup;
|
||||
}
|
||||
userdata2 = SDL_strdup(referenceUserdata2);
|
||||
if (userdata2 == NULL) {
|
||||
if (!userdata2) {
|
||||
returnValue = TEST_ABORTED;
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
@@ -22,7 +22,7 @@ int main(int argc, char **argv)
|
||||
|
||||
/* Initialize test framework */
|
||||
state = SDLTest_CommonCreateState(argv, 0);
|
||||
if (state == NULL) {
|
||||
if (!state) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
@@ -829,7 +829,7 @@ static void AddController(SDL_JoystickID id, SDL_bool verbose)
|
||||
}
|
||||
|
||||
new_controllers = (Controller *)SDL_realloc(controllers, (num_controllers + 1) * sizeof(*controllers));
|
||||
if (new_controllers == NULL) {
|
||||
if (!new_controllers) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1092,7 +1092,7 @@ static void OpenVirtualGamepad(void)
|
||||
SDL_Log("Couldn't attach virtual device: %s\n", SDL_GetError());
|
||||
} else {
|
||||
virtual_joystick = SDL_OpenJoystick(virtual_id);
|
||||
if (virtual_joystick == NULL) {
|
||||
if (!virtual_joystick) {
|
||||
SDL_Log("Couldn't open virtual device: %s\n", SDL_GetError());
|
||||
}
|
||||
}
|
||||
@@ -1818,7 +1818,7 @@ int main(int argc, char *argv[])
|
||||
|
||||
/* Initialize test framework */
|
||||
state = SDLTest_CommonCreateState(argv, 0);
|
||||
if (state == NULL) {
|
||||
if (!state) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -1890,13 +1890,13 @@ int main(int argc, char *argv[])
|
||||
screen_width = (int)SDL_ceilf(SCREEN_WIDTH * content_scale);
|
||||
screen_height = (int)SDL_ceilf(SCREEN_HEIGHT * content_scale);
|
||||
window = SDL_CreateWindow("SDL Controller Test", screen_width, screen_height, 0);
|
||||
if (window == NULL) {
|
||||
if (!window) {
|
||||
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't create window: %s\n", SDL_GetError());
|
||||
return 2;
|
||||
}
|
||||
|
||||
screen = SDL_CreateRenderer(window, NULL, 0);
|
||||
if (screen == NULL) {
|
||||
if (!screen) {
|
||||
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't create renderer: %s\n", SDL_GetError());
|
||||
SDL_DestroyWindow(window);
|
||||
return 2;
|
||||
@@ -1923,7 +1923,7 @@ int main(int argc, char *argv[])
|
||||
type_area.y = (float)TITLE_HEIGHT / 2 - type_area.h / 2;
|
||||
|
||||
image = CreateGamepadImage(screen);
|
||||
if (image == NULL) {
|
||||
if (!image) {
|
||||
SDL_DestroyRenderer(screen);
|
||||
SDL_DestroyWindow(window);
|
||||
return 2;
|
||||
|
||||
@@ -248,7 +248,7 @@ int main(int argc, char *argv[])
|
||||
|
||||
/* Initialize test framework */
|
||||
state = SDLTest_CommonCreateState(argv, SDL_INIT_VIDEO);
|
||||
if (state == NULL) {
|
||||
if (!state) {
|
||||
return 1;
|
||||
}
|
||||
for (i = 1; i < argc;) {
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
static void
|
||||
print_mode(const char *prefix, const SDL_DisplayMode *mode)
|
||||
{
|
||||
if (mode == NULL) {
|
||||
if (!mode) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -41,7 +41,7 @@ int main(int argc, char *argv[])
|
||||
|
||||
/* Initialize test framework */
|
||||
state = SDLTest_CommonCreateState(argv, SDL_INIT_VIDEO);
|
||||
if (state == NULL) {
|
||||
if (!state) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
@@ -229,7 +229,7 @@ int main(int argc, char *argv[])
|
||||
|
||||
/* Initialize test framework */
|
||||
state = SDLTest_CommonCreateState(argv, SDL_INIT_VIDEO);
|
||||
if (state == NULL) {
|
||||
if (!state) {
|
||||
return 1;
|
||||
}
|
||||
for (i = 1; i < argc;) {
|
||||
|
||||
@@ -106,7 +106,7 @@ int main(int argc, char *argv[])
|
||||
|
||||
/* Initialize test framework */
|
||||
state = SDLTest_CommonCreateState(argv, 0);
|
||||
if (state == NULL) {
|
||||
if (!state) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -126,13 +126,13 @@ int main(int argc, char *argv[])
|
||||
|
||||
/* Create window and renderer for given surface */
|
||||
window = SDL_CreateWindow("Chess Board", 640, 480, SDL_WINDOW_RESIZABLE);
|
||||
if (window == NULL) {
|
||||
if (!window) {
|
||||
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Window creation fail : %s\n", SDL_GetError());
|
||||
return 1;
|
||||
}
|
||||
surface = SDL_GetWindowSurface(window);
|
||||
renderer = SDL_CreateSoftwareRenderer(surface);
|
||||
if (renderer == NULL) {
|
||||
if (!renderer) {
|
||||
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Render creation for surface fail : %s\n", SDL_GetError());
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -26,7 +26,7 @@ int main(int argc, char *argv[])
|
||||
|
||||
/* Initialize test framework */
|
||||
state = SDLTest_CommonCreateState(argv, SDL_INIT_VIDEO);
|
||||
if (state == NULL) {
|
||||
if (!state) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
@@ -52,7 +52,7 @@ int main(int argc, char *argv[])
|
||||
|
||||
/* Initialize test framework */
|
||||
state = SDLTest_CommonCreateState(argv, 0);
|
||||
if (state == NULL) {
|
||||
if (!state) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -81,7 +81,7 @@ int main(int argc, char *argv[])
|
||||
|
||||
alive = 1;
|
||||
thread = SDL_CreateThread(ThreadFunc, NULL, "#1");
|
||||
if (thread == NULL) {
|
||||
if (!thread) {
|
||||
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't create thread: %s\n", SDL_GetError());
|
||||
quit(1);
|
||||
}
|
||||
|
||||
@@ -1940,7 +1940,7 @@ int main(int argc, char *argv[])
|
||||
|
||||
/* Initialize test framework */
|
||||
state = SDLTest_CommonCreateState(argv, 0);
|
||||
if (state == NULL) {
|
||||
if (!state) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
@@ -1000,7 +1000,7 @@ int main(int argc, char *argv[])
|
||||
/* Create the sprite */
|
||||
sprite = CreateTexture(renderer, icon_bmp, icon_bmp_len, &sprite_w, &sprite_h);
|
||||
|
||||
if (sprite == NULL) {
|
||||
if (!sprite) {
|
||||
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't create texture (%s)", SDL_GetError());
|
||||
return_code = 3;
|
||||
goto quit;
|
||||
@@ -1009,7 +1009,7 @@ int main(int argc, char *argv[])
|
||||
/* Allocate memory for the sprite info */
|
||||
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");
|
||||
return_code = 3;
|
||||
goto quit;
|
||||
|
||||
@@ -71,7 +71,7 @@ int main(int argc, char *argv[])
|
||||
|
||||
/* Initialize test framework */
|
||||
state = SDLTest_CommonCreateState(argv, 0);
|
||||
if (state == NULL) {
|
||||
if (!state) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -123,25 +123,25 @@ int main(int argc, char *argv[])
|
||||
RWOP_ERR_QUIT(rwops);
|
||||
}
|
||||
rwops = SDL_RWFromFile(FBASENAME2, "wb");
|
||||
if (rwops == NULL) {
|
||||
if (!rwops) {
|
||||
RWOP_ERR_QUIT(rwops);
|
||||
}
|
||||
SDL_RWclose(rwops);
|
||||
unlink(FBASENAME2);
|
||||
rwops = SDL_RWFromFile(FBASENAME2, "wb+");
|
||||
if (rwops == NULL) {
|
||||
if (!rwops) {
|
||||
RWOP_ERR_QUIT(rwops);
|
||||
}
|
||||
SDL_RWclose(rwops);
|
||||
unlink(FBASENAME2);
|
||||
rwops = SDL_RWFromFile(FBASENAME2, "ab");
|
||||
if (rwops == NULL) {
|
||||
if (!rwops) {
|
||||
RWOP_ERR_QUIT(rwops);
|
||||
}
|
||||
SDL_RWclose(rwops);
|
||||
unlink(FBASENAME2);
|
||||
rwops = SDL_RWFromFile(FBASENAME2, "ab+");
|
||||
if (rwops == NULL) {
|
||||
if (!rwops) {
|
||||
RWOP_ERR_QUIT(rwops);
|
||||
}
|
||||
SDL_RWclose(rwops);
|
||||
@@ -152,7 +152,7 @@ int main(int argc, char *argv[])
|
||||
test : w mode, r mode, w+ mode
|
||||
*/
|
||||
rwops = SDL_RWFromFile(FBASENAME1, "wb"); /* write only */
|
||||
if (rwops == NULL) {
|
||||
if (!rwops) {
|
||||
RWOP_ERR_QUIT(rwops);
|
||||
}
|
||||
if (10 != SDL_RWwrite(rwops, "1234567890", 10)) {
|
||||
@@ -174,7 +174,7 @@ int main(int argc, char *argv[])
|
||||
SDL_RWclose(rwops);
|
||||
|
||||
rwops = SDL_RWFromFile(FBASENAME1, "rb"); /* read mode, file must exist */
|
||||
if (rwops == NULL) {
|
||||
if (!rwops) {
|
||||
RWOP_ERR_QUIT(rwops);
|
||||
}
|
||||
if (0 != SDL_RWseek(rwops, 0L, SDL_RW_SEEK_SET)) {
|
||||
@@ -212,7 +212,7 @@ int main(int argc, char *argv[])
|
||||
|
||||
/* test 3: same with w+ mode */
|
||||
rwops = SDL_RWFromFile(FBASENAME1, "wb+"); /* write + read + truncation */
|
||||
if (rwops == NULL) {
|
||||
if (!rwops) {
|
||||
RWOP_ERR_QUIT(rwops);
|
||||
}
|
||||
if (10 != SDL_RWwrite(rwops, "1234567890", 10)) {
|
||||
@@ -263,7 +263,7 @@ int main(int argc, char *argv[])
|
||||
|
||||
/* test 4: same in r+ mode */
|
||||
rwops = SDL_RWFromFile(FBASENAME1, "rb+"); /* write + read + file must exists, no truncation */
|
||||
if (rwops == NULL) {
|
||||
if (!rwops) {
|
||||
RWOP_ERR_QUIT(rwops);
|
||||
}
|
||||
if (10 != SDL_RWwrite(rwops, "1234567890", 10)) {
|
||||
@@ -314,7 +314,7 @@ int main(int argc, char *argv[])
|
||||
|
||||
/* test5 : append mode */
|
||||
rwops = SDL_RWFromFile(FBASENAME1, "ab+"); /* write + read + append */
|
||||
if (rwops == NULL) {
|
||||
if (!rwops) {
|
||||
RWOP_ERR_QUIT(rwops);
|
||||
}
|
||||
if (10 != SDL_RWwrite(rwops, "1234567890", 10)) {
|
||||
|
||||
@@ -23,7 +23,7 @@ int main(int argc, char *argv[])
|
||||
|
||||
/* Initialize test framework */
|
||||
state = SDLTest_CommonCreateState(argv, 0);
|
||||
if (state == NULL) {
|
||||
if (!state) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -41,7 +41,7 @@ int main(int argc, char *argv[])
|
||||
}
|
||||
|
||||
base_path = SDL_GetBasePath();
|
||||
if (base_path == NULL) {
|
||||
if (!base_path) {
|
||||
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't find base path: %s\n",
|
||||
SDL_GetError());
|
||||
} else {
|
||||
@@ -50,7 +50,7 @@ int main(int argc, char *argv[])
|
||||
}
|
||||
|
||||
pref_path = SDL_GetPrefPath("libsdl", "test_filesystem");
|
||||
if (pref_path == NULL) {
|
||||
if (!pref_path) {
|
||||
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't find pref path: %s\n",
|
||||
SDL_GetError());
|
||||
} else {
|
||||
@@ -59,7 +59,7 @@ int main(int argc, char *argv[])
|
||||
}
|
||||
|
||||
pref_path = SDL_GetPrefPath(NULL, "test_filesystem");
|
||||
if (pref_path == NULL) {
|
||||
if (!pref_path) {
|
||||
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't find pref path without organization: %s\n",
|
||||
SDL_GetError());
|
||||
} else {
|
||||
|
||||
@@ -173,7 +173,7 @@ int main(int argc, char *argv[])
|
||||
|
||||
/* Initialize test framework */
|
||||
state = SDLTest_CommonCreateState(argv, SDL_INIT_VIDEO);
|
||||
if (state == NULL) {
|
||||
if (!state) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -224,7 +224,7 @@ int main(int argc, char *argv[])
|
||||
/* Create the windows, initialize the renderers, and load the textures */
|
||||
sprites =
|
||||
(SDL_Texture **)SDL_malloc(state->num_windows * sizeof(*sprites));
|
||||
if (sprites == NULL) {
|
||||
if (!sprites) {
|
||||
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Out of memory!\n");
|
||||
quit(2);
|
||||
}
|
||||
|
||||
@@ -220,7 +220,7 @@ int main(int argc, char *argv[])
|
||||
|
||||
/* Initialize test framework */
|
||||
state = SDLTest_CommonCreateState(argv, SDL_INIT_VIDEO);
|
||||
if (state == NULL) {
|
||||
if (!state) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
@@ -32,7 +32,7 @@ quit(int rc)
|
||||
{
|
||||
int i;
|
||||
|
||||
if (context != NULL) {
|
||||
if (context) {
|
||||
for (i = 0; i < state->num_windows; i++) {
|
||||
if (context[i]) {
|
||||
SDL_GL_DeleteContext(context[i]);
|
||||
@@ -112,7 +112,7 @@ int main(int argc, char *argv[])
|
||||
|
||||
/* Initialize test framework */
|
||||
state = SDLTest_CommonCreateState(argv, SDL_INIT_VIDEO);
|
||||
if (state == NULL) {
|
||||
if (!state) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -176,7 +176,7 @@ int main(int argc, char *argv[])
|
||||
}
|
||||
|
||||
context = (SDL_GLContext *)SDL_calloc(state->num_windows, sizeof(*context));
|
||||
if (context == NULL) {
|
||||
if (!context) {
|
||||
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Out of memory!\n");
|
||||
quit(2);
|
||||
}
|
||||
|
||||
@@ -99,7 +99,7 @@ quit(int rc)
|
||||
{
|
||||
int i;
|
||||
|
||||
if (context != NULL) {
|
||||
if (context) {
|
||||
for (i = 0; i < state->num_windows; i++) {
|
||||
if (context[i]) {
|
||||
SDL_GL_DeleteContext(context[i]);
|
||||
@@ -681,7 +681,7 @@ int main(int argc, char *argv[])
|
||||
|
||||
/* Initialize test framework */
|
||||
state = SDLTest_CommonCreateState(argv, SDL_INIT_VIDEO);
|
||||
if (state == NULL) {
|
||||
if (!state) {
|
||||
return 1;
|
||||
}
|
||||
for (i = 1; i < argc;) {
|
||||
@@ -749,7 +749,7 @@ int main(int argc, char *argv[])
|
||||
}
|
||||
|
||||
context = (SDL_GLContext *)SDL_calloc(state->num_windows, sizeof(*context));
|
||||
if (context == NULL) {
|
||||
if (!context) {
|
||||
SDL_Log("Out of memory!\n");
|
||||
quit(2);
|
||||
}
|
||||
|
||||
@@ -91,7 +91,7 @@ quit(int rc)
|
||||
{
|
||||
int i;
|
||||
|
||||
if (context != NULL) {
|
||||
if (context) {
|
||||
for (i = 0; i < state->num_windows; i++) {
|
||||
if (context[i]) {
|
||||
SDL_GL_DeleteContext(context[i]);
|
||||
@@ -449,7 +449,7 @@ int main(int argc, char *argv[])
|
||||
|
||||
/* Initialize test framework */
|
||||
state = SDLTest_CommonCreateState(argv, SDL_INIT_VIDEO);
|
||||
if (state == NULL) {
|
||||
if (!state) {
|
||||
return 1;
|
||||
}
|
||||
for (i = 1; i < argc;) {
|
||||
@@ -511,7 +511,7 @@ int main(int argc, char *argv[])
|
||||
}
|
||||
|
||||
context = (SDL_GLContext *)SDL_calloc(state->num_windows, sizeof(*context));
|
||||
if (context == NULL) {
|
||||
if (!context) {
|
||||
SDL_Log("Out of memory!\n");
|
||||
quit(2);
|
||||
}
|
||||
@@ -552,17 +552,17 @@ int main(int argc, char *argv[])
|
||||
#if 1
|
||||
path = GetNearbyFilename(f);
|
||||
|
||||
if (path == NULL) {
|
||||
if (!path) {
|
||||
path = SDL_strdup(f);
|
||||
}
|
||||
|
||||
if (path == NULL) {
|
||||
if (!path) {
|
||||
SDL_Log("out of memory\n");
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
tmp = SDL_LoadBMP(path);
|
||||
if (tmp == NULL) {
|
||||
if (!tmp) {
|
||||
SDL_Log("missing image file: %s", path);
|
||||
exit(-1);
|
||||
} else {
|
||||
|
||||
@@ -43,7 +43,7 @@ int main(int argc, char **argv)
|
||||
|
||||
/* Initialize test framework */
|
||||
state = SDLTest_CommonCreateState(argv, 0);
|
||||
if (state == NULL) {
|
||||
if (!state) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -87,7 +87,7 @@ int main(int argc, char **argv)
|
||||
}
|
||||
if (SDL_NumHaptics() > 0) {
|
||||
/* We'll just use index or the first force feedback device found */
|
||||
if (name == NULL) {
|
||||
if (!name) {
|
||||
i = (index != -1) ? index : 0;
|
||||
}
|
||||
/* Try to find matching device */
|
||||
@@ -106,7 +106,7 @@ int main(int argc, char **argv)
|
||||
}
|
||||
|
||||
haptic = SDL_HapticOpen(i);
|
||||
if (haptic == NULL) {
|
||||
if (!haptic) {
|
||||
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Unable to create the haptic device: %s\n",
|
||||
SDL_GetError());
|
||||
return 1;
|
||||
@@ -297,7 +297,7 @@ int main(int argc, char **argv)
|
||||
}
|
||||
|
||||
/* Quit */
|
||||
if (haptic != NULL) {
|
||||
if (haptic) {
|
||||
SDL_HapticClose(haptic);
|
||||
}
|
||||
SDL_Quit();
|
||||
|
||||
@@ -80,7 +80,7 @@ int main(int argc, char **argv)
|
||||
|
||||
/* Initialize test framework */
|
||||
state = SDLTest_CommonCreateState(argv, SDL_INIT_VIDEO);
|
||||
if (state == NULL) {
|
||||
if (!state) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -140,7 +140,7 @@ int main(int argc, char **argv)
|
||||
if (e.key.keysym.sym == SDLK_ESCAPE) {
|
||||
done = 1;
|
||||
} else if (e.key.keysym.sym == SDLK_x) {
|
||||
if (areas == NULL) {
|
||||
if (!areas) {
|
||||
areas = drag_areas;
|
||||
numareas = SDL_arraysize(drag_areas);
|
||||
} else {
|
||||
|
||||
@@ -32,7 +32,7 @@ int main(int argc, char *argv[])
|
||||
|
||||
/* Initialize test framework */
|
||||
state = SDLTest_CommonCreateState(argv, 0);
|
||||
if (state == NULL) {
|
||||
if (!state) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -92,7 +92,7 @@ int main(int argc, char *argv[])
|
||||
keepGoing = SDL_FALSE;
|
||||
break;
|
||||
case SDL_EVENT_JOYSTICK_ADDED:
|
||||
if (joystick != NULL) {
|
||||
if (joystick) {
|
||||
SDL_Log("Only one joystick supported by this test\n");
|
||||
} else {
|
||||
joystick = SDL_OpenJoystick(event.jdevice.which);
|
||||
|
||||
@@ -61,7 +61,7 @@ int main(int argc, char *argv[])
|
||||
|
||||
/* Initialize test framework */
|
||||
state = SDLTest_CommonCreateState(argv, 0);
|
||||
if (state == NULL) {
|
||||
if (!state) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -90,7 +90,7 @@ int main(int argc, char *argv[])
|
||||
|
||||
fname = GetResourceFilename(fname, "utf8.txt");
|
||||
file = fopen(fname, "rb");
|
||||
if (file == NULL) {
|
||||
if (!file) {
|
||||
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Unable to open %s\n", fname);
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -97,7 +97,7 @@ static Uint8 validate_hex(const char *cp, size_t len, Uint32 *np)
|
||||
}
|
||||
n = (n << 4) | c;
|
||||
}
|
||||
if (np != NULL) {
|
||||
if (np) {
|
||||
*np = n;
|
||||
}
|
||||
return 1;
|
||||
@@ -116,7 +116,7 @@ static int unifont_init(const char *fontname)
|
||||
|
||||
/* Allocate memory for the glyph data so the file can be closed after initialization. */
|
||||
unifontGlyph = (struct UnifontGlyph *)SDL_malloc(unifontGlyphSize);
|
||||
if (unifontGlyph == NULL) {
|
||||
if (!unifontGlyph) {
|
||||
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "unifont: Failed to allocate %d KiB for glyph data.\n", (int)(unifontGlyphSize + 1023) / 1024);
|
||||
return -1;
|
||||
}
|
||||
@@ -124,20 +124,20 @@ static int unifont_init(const char *fontname)
|
||||
|
||||
/* Allocate memory for texture pointers for all renderers. */
|
||||
unifontTexture = (SDL_Texture **)SDL_malloc(unifontTextureSize);
|
||||
if (unifontTexture == NULL) {
|
||||
if (!unifontTexture) {
|
||||
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "unifont: Failed to allocate %d KiB for texture pointer data.\n", (int)(unifontTextureSize + 1023) / 1024);
|
||||
return -1;
|
||||
}
|
||||
SDL_memset(unifontTexture, 0, unifontTextureSize);
|
||||
|
||||
filename = GetResourceFilename(NULL, fontname);
|
||||
if (filename == NULL) {
|
||||
if (!filename) {
|
||||
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Out of memory\n");
|
||||
return -1;
|
||||
}
|
||||
hexFile = SDL_RWFromFile(filename, "rb");
|
||||
SDL_free(filename);
|
||||
if (hexFile == NULL) {
|
||||
if (!hexFile) {
|
||||
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "unifont: Failed to open font file: %s\n", fontname);
|
||||
return -1;
|
||||
}
|
||||
@@ -279,7 +279,7 @@ static int unifont_load_texture(Uint32 textureID)
|
||||
}
|
||||
|
||||
textureRGBA = (Uint8 *)SDL_malloc(UNIFONT_TEXTURE_SIZE);
|
||||
if (textureRGBA == NULL) {
|
||||
if (!textureRGBA) {
|
||||
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "unifont: Failed to allocate %d MiB for a texture.\n", UNIFONT_TEXTURE_SIZE / 1024 / 1024);
|
||||
return -1;
|
||||
}
|
||||
@@ -334,7 +334,7 @@ static Sint32 unifont_draw_glyph(Uint32 codepoint, int rendererID, SDL_FRect *ds
|
||||
}
|
||||
}
|
||||
texture = unifontTexture[UNIFONT_NUM_TEXTURES * rendererID + textureID];
|
||||
if (texture != NULL) {
|
||||
if (texture) {
|
||||
const Uint32 cInTex = codepoint % UNIFONT_GLYPHS_IN_TEXTURE;
|
||||
srcrect.x = (float)(cInTex % UNIFONT_GLYPHS_IN_ROW * 16);
|
||||
srcrect.y = (float)(cInTex / UNIFONT_GLYPHS_IN_ROW * 16);
|
||||
@@ -348,12 +348,12 @@ static void unifont_cleanup(void)
|
||||
int i, j;
|
||||
for (i = 0; i < state->num_windows; ++i) {
|
||||
SDL_Renderer *renderer = state->renderers[i];
|
||||
if (state->windows[i] == NULL || renderer == NULL) {
|
||||
if (state->windows[i] == NULL || !renderer) {
|
||||
continue;
|
||||
}
|
||||
for (j = 0; j < UNIFONT_NUM_TEXTURES; j++) {
|
||||
SDL_Texture *tex = unifontTexture[UNIFONT_NUM_TEXTURES * i + j];
|
||||
if (tex != NULL) {
|
||||
if (tex) {
|
||||
SDL_DestroyTexture(tex);
|
||||
}
|
||||
}
|
||||
@@ -538,7 +538,7 @@ static void _Redraw(int rendererID)
|
||||
if (cursor) {
|
||||
char *p = utf8_advance(markedText, cursor);
|
||||
char c = 0;
|
||||
if (p == NULL) {
|
||||
if (!p) {
|
||||
p = &markedText[SDL_strlen(markedText)];
|
||||
}
|
||||
|
||||
@@ -639,7 +639,7 @@ int main(int argc, char *argv[])
|
||||
|
||||
/* Initialize test framework */
|
||||
state = SDLTest_CommonCreateState(argv, SDL_INIT_VIDEO);
|
||||
if (state == NULL) {
|
||||
if (!state) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -677,7 +677,7 @@ int main(int argc, char *argv[])
|
||||
TTF_Init();
|
||||
|
||||
font = TTF_OpenFont(fontname, DEFAULT_PTSIZE);
|
||||
if (font == NULL) {
|
||||
if (!font) {
|
||||
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Failed to find font: %s\n", TTF_GetError());
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -292,7 +292,7 @@ int main(int argc, char *argv[])
|
||||
|
||||
/* Initialize test framework */
|
||||
state = SDLTest_CommonCreateState(argv, SDL_INIT_VIDEO);
|
||||
if (state == NULL) {
|
||||
if (!state) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
@@ -25,7 +25,7 @@ int main(int argc, char *argv[])
|
||||
|
||||
/* Initialize test framework */
|
||||
state = SDLTest_CommonCreateState(argv, 0);
|
||||
if (state == NULL) {
|
||||
if (!state) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
@@ -41,7 +41,7 @@ int main(int argc, char *argv[])
|
||||
|
||||
/* Initialize test framework */
|
||||
state = SDLTest_CommonCreateState(argv, 0);
|
||||
if (state == NULL) {
|
||||
if (!state) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -88,13 +88,13 @@ int main(int argc, char *argv[])
|
||||
}
|
||||
|
||||
lib = SDL_LoadObject(libname);
|
||||
if (lib == NULL) {
|
||||
if (!lib) {
|
||||
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "SDL_LoadObject('%s') failed: %s\n",
|
||||
libname, SDL_GetError());
|
||||
retval = 3;
|
||||
} else {
|
||||
fn = (fntype)SDL_LoadFunction(lib, symname);
|
||||
if (fn == NULL) {
|
||||
if (!fn) {
|
||||
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "SDL_LoadFunction('%s') failed: %s\n",
|
||||
symname, SDL_GetError());
|
||||
retval = 4;
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
static void log_locales(void)
|
||||
{
|
||||
SDL_Locale *locales = SDL_GetPreferredLocales();
|
||||
if (locales == NULL) {
|
||||
if (!locales) {
|
||||
SDL_Log("Couldn't determine locales: %s", SDL_GetError());
|
||||
} else {
|
||||
SDL_Locale *l;
|
||||
@@ -40,7 +40,7 @@ int main(int argc, char **argv)
|
||||
|
||||
/* Initialize test framework */
|
||||
state = SDLTest_CommonCreateState(argv, 0);
|
||||
if (state == NULL) {
|
||||
if (!state) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
@@ -114,7 +114,7 @@ int main(int argc, char *argv[])
|
||||
|
||||
/* Initialize test framework */
|
||||
state = SDLTest_CommonCreateState(argv, 0);
|
||||
if (state == NULL) {
|
||||
if (!state) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -182,7 +182,7 @@ int main(int argc, char *argv[])
|
||||
SDL_AtomicSet(&doterminate, 0);
|
||||
|
||||
mutex = SDL_CreateMutex();
|
||||
if (mutex == NULL) {
|
||||
if (!mutex) {
|
||||
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't create mutex: %s\n", SDL_GetError());
|
||||
exit(1);
|
||||
}
|
||||
|
||||
@@ -89,7 +89,7 @@ int main(int argc, char *argv[])
|
||||
|
||||
/* Initialize test framework */
|
||||
state = SDLTest_CommonCreateState(argv, 0);
|
||||
if (state == NULL) {
|
||||
if (!state) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
@@ -87,7 +87,7 @@ static void DrawObject(SDL_Renderer *renderer, Object *object)
|
||||
static void DrawObjects(SDL_Renderer *renderer)
|
||||
{
|
||||
Object *next = objects;
|
||||
while (next != NULL) {
|
||||
while (next) {
|
||||
DrawObject(renderer, next);
|
||||
next = next->next;
|
||||
}
|
||||
@@ -97,7 +97,7 @@ static void AppendObject(Object *object)
|
||||
{
|
||||
if (objects) {
|
||||
Object *next = objects;
|
||||
while (next->next != NULL) {
|
||||
while (next->next) {
|
||||
next = next->next;
|
||||
}
|
||||
next->next = object;
|
||||
@@ -133,7 +133,7 @@ static void loop(void *arg)
|
||||
break;
|
||||
|
||||
case SDL_EVENT_MOUSE_MOTION:
|
||||
if (active == NULL) {
|
||||
if (!active) {
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -142,7 +142,7 @@ static void loop(void *arg)
|
||||
break;
|
||||
|
||||
case SDL_EVENT_MOUSE_BUTTON_DOWN:
|
||||
if (active == NULL) {
|
||||
if (!active) {
|
||||
active = SDL_calloc(1, sizeof(*active));
|
||||
active->x1 = active->x2 = event.button.x;
|
||||
active->y1 = active->y2 = event.button.y;
|
||||
@@ -176,7 +176,7 @@ static void loop(void *arg)
|
||||
break;
|
||||
|
||||
case SDL_EVENT_MOUSE_BUTTON_UP:
|
||||
if (active == NULL) {
|
||||
if (!active) {
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -259,7 +259,7 @@ int main(int argc, char *argv[])
|
||||
|
||||
/* Initialize test framework */
|
||||
state = SDLTest_CommonCreateState(argv, 0);
|
||||
if (state == NULL) {
|
||||
if (!state) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
@@ -146,7 +146,7 @@ int main(int argc, char **argv)
|
||||
|
||||
/* Initialize test framework */
|
||||
state = SDLTest_CommonCreateState(argv, 0);
|
||||
if (state == NULL) {
|
||||
if (!state) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -184,7 +184,7 @@ int main(int argc, char **argv)
|
||||
filename = GetResourceFilename(filename, "sample.wav");
|
||||
|
||||
devices = SDL_GetAudioOutputDevices(&devcount);
|
||||
if (devices == NULL) {
|
||||
if (!devices) {
|
||||
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Don't see any specific audio devices!");
|
||||
} else {
|
||||
/* Load the wave file into memory */
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -68,7 +68,7 @@ CreateWindowNative(int w, int h)
|
||||
CreateWindow("SDL Test", "", WS_OVERLAPPEDWINDOW, CW_USEDEFAULT,
|
||||
CW_USEDEFAULT, w, h, NULL, NULL, GetModuleHandle(NULL),
|
||||
NULL);
|
||||
if (hwnd == NULL) {
|
||||
if (!hwnd) {
|
||||
MessageBox(NULL, "Window Creation Failed!", "Error!",
|
||||
MB_ICONEXCLAMATION | MB_OK);
|
||||
return 0;
|
||||
|
||||
@@ -102,7 +102,7 @@ int main(int argc, char *argv[])
|
||||
|
||||
/* Initialize test framework */
|
||||
state = SDLTest_CommonCreateState(argv, 0);
|
||||
if (state == NULL) {
|
||||
if (!state) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -125,14 +125,14 @@ int main(int argc, char *argv[])
|
||||
/* If OPENGL fails to init it will fallback to using a framebuffer for rendering */
|
||||
window = SDL_CreateWindow("Offscreen Test", width, height, 0);
|
||||
|
||||
if (window == NULL) {
|
||||
if (!window) {
|
||||
SDL_Log("Couldn't create window: %s\n", SDL_GetError());
|
||||
return SDL_FALSE;
|
||||
}
|
||||
|
||||
renderer = SDL_CreateRenderer(window, NULL, 0);
|
||||
|
||||
if (renderer == NULL) {
|
||||
if (!renderer) {
|
||||
SDL_Log("Couldn't create renderer: %s\n",
|
||||
SDL_GetError());
|
||||
return SDL_FALSE;
|
||||
|
||||
@@ -231,7 +231,7 @@ static void MoveSprites(SDL_Renderer *renderer)
|
||||
}
|
||||
|
||||
tmp = SDL_CreateTextureFromSurface(renderer, MooseYUVSurfaces[i]);
|
||||
if (tmp == NULL) {
|
||||
if (!tmp) {
|
||||
SDL_Log("Error %s", SDL_GetError());
|
||||
quit(7);
|
||||
}
|
||||
@@ -326,7 +326,7 @@ int main(int argc, char **argv)
|
||||
|
||||
/* Initialize test framework */
|
||||
state = SDLTest_CommonCreateState(argv, SDL_INIT_VIDEO);
|
||||
if (state == NULL) {
|
||||
if (!state) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -430,20 +430,20 @@ int main(int argc, char **argv)
|
||||
}
|
||||
|
||||
RawMooseData = (Uint8 *)SDL_malloc(MOOSEFRAME_SIZE * MOOSEFRAMES_COUNT);
|
||||
if (RawMooseData == NULL) {
|
||||
if (!RawMooseData) {
|
||||
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Can't allocate memory for movie !\n");
|
||||
quit(1);
|
||||
}
|
||||
|
||||
/* load the trojan moose images */
|
||||
filename = GetResourceFilename(NULL, "moose.dat");
|
||||
if (filename == NULL) {
|
||||
if (!filename) {
|
||||
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Out of memory\n");
|
||||
quit(2);
|
||||
}
|
||||
handle = SDL_RWFromFile(filename, "rb");
|
||||
SDL_free(filename);
|
||||
if (handle == NULL) {
|
||||
if (!handle) {
|
||||
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Can't find the file moose.dat !\n");
|
||||
quit(2);
|
||||
}
|
||||
@@ -466,7 +466,7 @@ int main(int argc, char **argv)
|
||||
|
||||
if (streaming) {
|
||||
MooseTexture = SDL_CreateTexture(renderer, yuv_format, SDL_TEXTUREACCESS_STREAMING, MOOSEPIC_W, MOOSEPIC_H);
|
||||
if (MooseTexture == NULL) {
|
||||
if (!MooseTexture) {
|
||||
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't set create texture: %s\n", SDL_GetError());
|
||||
quit(5);
|
||||
}
|
||||
@@ -479,7 +479,7 @@ int main(int argc, char **argv)
|
||||
for (i = 0; i < MOOSEFRAMES_COUNT; i++) {
|
||||
/* Create RGB SDL_Surface */
|
||||
SDL_Surface *mooseRGBSurface = SDL_CreateSurface(MOOSEPIC_W, MOOSEPIC_H, SDL_PIXELFORMAT_RGB24);
|
||||
if (mooseRGBSurface == NULL) {
|
||||
if (!mooseRGBSurface) {
|
||||
quit(6);
|
||||
}
|
||||
|
||||
|
||||
@@ -365,7 +365,7 @@ static int Test64Bit(SDL_bool verbose)
|
||||
LL_Test *t;
|
||||
int failed = 0;
|
||||
|
||||
for (t = LL_Tests; t->routine != NULL; t++) {
|
||||
for (t = LL_Tests; t->routine; t++) {
|
||||
unsigned long long result = 0;
|
||||
unsigned int *al = (unsigned int *)&t->a;
|
||||
unsigned int *bl = (unsigned int *)&t->b;
|
||||
@@ -447,7 +447,7 @@ int main(int argc, char *argv[])
|
||||
|
||||
/* Initialize test framework */
|
||||
state = SDLTest_CommonCreateState(argv, 0);
|
||||
if (state == NULL) {
|
||||
if (!state) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
@@ -194,7 +194,7 @@ static void loop(void)
|
||||
|
||||
/* Show the tooltip if the delay period has elapsed */
|
||||
if (SDL_GetTicks() > tooltip_timer) {
|
||||
if (tooltip.win == NULL) {
|
||||
if (!tooltip.win) {
|
||||
create_popup(&tooltip, SDL_FALSE);
|
||||
}
|
||||
}
|
||||
@@ -244,7 +244,7 @@ int main(int argc, char *argv[])
|
||||
|
||||
/* Initialize test framework */
|
||||
state = SDLTest_CommonCreateState(argv, SDL_INIT_VIDEO);
|
||||
if (state == NULL) {
|
||||
if (!state) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
@@ -65,7 +65,7 @@ int main(int argc, char *argv[])
|
||||
|
||||
/* Initialize test framework */
|
||||
state = SDLTest_CommonCreateState(argv, 0);
|
||||
if (state == NULL) {
|
||||
if (!state) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
@@ -55,7 +55,7 @@ int main(int argc, char *argv[])
|
||||
|
||||
/* Initialize test framework */
|
||||
state = SDLTest_CommonCreateState(argv, 0);
|
||||
if (state == NULL) {
|
||||
if (!state) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
@@ -92,7 +92,7 @@ int main(int argc, char *argv[])
|
||||
|
||||
/* Initialize test framework */
|
||||
state = SDLTest_CommonCreateState(argv, SDL_INIT_VIDEO);
|
||||
if (state == NULL) {
|
||||
if (!state) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
@@ -120,7 +120,7 @@ int main(int argc, char *argv[])
|
||||
|
||||
/* Initialize test framework */
|
||||
state = SDLTest_CommonCreateState(argv, SDL_INIT_VIDEO);
|
||||
if (state == NULL) {
|
||||
if (!state) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
@@ -141,7 +141,7 @@ Draw(DrawState *s)
|
||||
SDL_GetRenderViewport(s->renderer, &viewport);
|
||||
|
||||
target = SDL_CreateTexture(s->renderer, SDL_PIXELFORMAT_ARGB8888, SDL_TEXTUREACCESS_TARGET, viewport.w, viewport.h);
|
||||
if (target == NULL) {
|
||||
if (!target) {
|
||||
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't create render target texture: %s\n", SDL_GetError());
|
||||
return SDL_FALSE;
|
||||
}
|
||||
@@ -217,7 +217,7 @@ int main(int argc, char *argv[])
|
||||
|
||||
/* Initialize test framework */
|
||||
state = SDLTest_CommonCreateState(argv, SDL_INIT_VIDEO);
|
||||
if (state == NULL) {
|
||||
if (!state) {
|
||||
return 1;
|
||||
}
|
||||
for (i = 1; i < argc;) {
|
||||
|
||||
@@ -41,7 +41,7 @@ int main(int argc, char **argv)
|
||||
|
||||
/* Initialize test framework */
|
||||
state = SDLTest_CommonCreateState(argv, 0);
|
||||
if (state == NULL) {
|
||||
if (!state) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -116,7 +116,7 @@ int main(int argc, char **argv)
|
||||
|
||||
/* write out a WAV header... */
|
||||
io = SDL_RWFromFile(file_out, "wb");
|
||||
if (io == NULL) {
|
||||
if (!io) {
|
||||
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "fopen('%s') failed: %s\n", file_out, SDL_GetError());
|
||||
ret = 5;
|
||||
goto end;
|
||||
|
||||
@@ -42,7 +42,7 @@ int main(int argc, char **argv)
|
||||
|
||||
/* Initialize test framework */
|
||||
state = SDLTest_CommonCreateState(argv, 0);
|
||||
if (state == NULL) {
|
||||
if (!state) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -88,7 +88,7 @@ int main(int argc, char **argv)
|
||||
SDL_Log("%d Haptic devices detected.\n", SDL_NumHaptics());
|
||||
if (SDL_NumHaptics() > 0) {
|
||||
/* We'll just use index or the first force feedback device found */
|
||||
if (name == NULL) {
|
||||
if (!name) {
|
||||
i = (index != -1) ? index : 0;
|
||||
}
|
||||
/* Try to find matching device */
|
||||
@@ -107,7 +107,7 @@ int main(int argc, char **argv)
|
||||
}
|
||||
|
||||
haptic = SDL_HapticOpen(i);
|
||||
if (haptic == NULL) {
|
||||
if (!haptic) {
|
||||
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Unable to create the haptic device: %s\n",
|
||||
SDL_GetError());
|
||||
return 1;
|
||||
@@ -146,7 +146,7 @@ int main(int argc, char **argv)
|
||||
SDL_Delay(2000);
|
||||
|
||||
/* Quit */
|
||||
if (haptic != NULL) {
|
||||
if (haptic) {
|
||||
SDL_HapticClose(haptic);
|
||||
}
|
||||
|
||||
|
||||
@@ -67,7 +67,7 @@ int main(int argc, char *argv[])
|
||||
|
||||
/* Initialize test framework */
|
||||
state = SDLTest_CommonCreateState(argv, 0);
|
||||
if (state == NULL) {
|
||||
if (!state) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -141,7 +141,7 @@ int main(int argc, char *argv[])
|
||||
SDL_AtomicSet(&doterminate, 0);
|
||||
|
||||
rwlock = SDL_CreateRWLock();
|
||||
if (rwlock == NULL) {
|
||||
if (!rwlock) {
|
||||
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't create rwlock: %s\n", SDL_GetError());
|
||||
SDL_Quit();
|
||||
SDLTest_CommonDestroyState(state);
|
||||
|
||||
@@ -107,7 +107,7 @@ int main(int argc, char *argv[])
|
||||
|
||||
/* Initialize test framework */
|
||||
state = SDLTest_CommonCreateState(argv, SDL_INIT_VIDEO);
|
||||
if (state == NULL) {
|
||||
if (!state) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
@@ -261,7 +261,7 @@ int main(int argc, char **argv)
|
||||
|
||||
/* Initialize test framework */
|
||||
state = SDLTest_CommonCreateState(argv, 0);
|
||||
if (state == NULL) {
|
||||
if (!state) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
@@ -38,7 +38,7 @@ static const char *GetSensorTypeString(SDL_SensorType type)
|
||||
static void HandleSensorEvent(SDL_SensorEvent *event)
|
||||
{
|
||||
SDL_Sensor *sensor = SDL_GetSensorFromInstanceID(event->which);
|
||||
if (sensor == NULL) {
|
||||
if (!sensor) {
|
||||
SDL_Log("Couldn't get sensor for sensor event\n");
|
||||
return;
|
||||
}
|
||||
@@ -64,7 +64,7 @@ int main(int argc, char **argv)
|
||||
|
||||
/* Initialize test framework */
|
||||
state = SDLTest_CommonCreateState(argv, 0);
|
||||
if (state == NULL) {
|
||||
if (!state) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -97,7 +97,7 @@ int main(int argc, char **argv)
|
||||
|
||||
if (SDL_GetSensorInstanceType(sensors[i]) != SDL_SENSOR_UNKNOWN) {
|
||||
SDL_Sensor *sensor = SDL_OpenSensor(sensors[i]);
|
||||
if (sensor == NULL) {
|
||||
if (!sensor) {
|
||||
SDL_Log("Couldn't open sensor %" SDL_PRIu32 ": %s\n", sensors[i], SDL_GetError());
|
||||
} else {
|
||||
++num_opened;
|
||||
|
||||
@@ -141,7 +141,7 @@ static SDL_bool CompileShader(GLhandleARB shader, const char *source)
|
||||
|
||||
glGetObjectParameterivARB(shader, GL_OBJECT_INFO_LOG_LENGTH_ARB, &length);
|
||||
info = (char *)SDL_malloc((size_t)length + 1);
|
||||
if (info == NULL) {
|
||||
if (!info) {
|
||||
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Out of memory!");
|
||||
} else {
|
||||
glGetInfoLogARB(shader, length, NULL, info);
|
||||
@@ -169,7 +169,7 @@ static SDL_bool LinkProgram(ShaderData *data)
|
||||
|
||||
glGetObjectParameterivARB(data->program, GL_OBJECT_INFO_LOG_LENGTH_ARB, &length);
|
||||
info = (char *)SDL_malloc((size_t)length + 1);
|
||||
if (info == NULL) {
|
||||
if (!info) {
|
||||
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Out of memory!");
|
||||
} else {
|
||||
glGetInfoLogARB(data->program, length, NULL, info);
|
||||
@@ -327,7 +327,7 @@ SDL_GL_LoadTexture(SDL_Surface *surface, GLfloat *texcoord)
|
||||
texcoord[3] = (GLfloat)surface->h / h; /* Max Y */
|
||||
|
||||
image = SDL_CreateSurface(w, h, SDL_PIXELFORMAT_RGBA32);
|
||||
if (image == NULL) {
|
||||
if (!image) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -454,7 +454,7 @@ int main(int argc, char **argv)
|
||||
|
||||
/* Initialize test framework */
|
||||
state = SDLTest_CommonCreateState(argv, 0);
|
||||
if (state == NULL) {
|
||||
if (!state) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -489,7 +489,7 @@ int main(int argc, char **argv)
|
||||
|
||||
/* Create a 640x480 OpenGL screen */
|
||||
window = SDL_CreateWindow("Shader Demo", 640, 480, SDL_WINDOW_OPENGL);
|
||||
if (window == NULL) {
|
||||
if (!window) {
|
||||
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Unable to create OpenGL window: %s\n", SDL_GetError());
|
||||
SDL_Quit();
|
||||
exit(2);
|
||||
@@ -505,7 +505,7 @@ int main(int argc, char **argv)
|
||||
surface = SDL_LoadBMP(filename);
|
||||
SDL_free(filename);
|
||||
|
||||
if (surface == NULL) {
|
||||
if (!surface) {
|
||||
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Unable to load icon.bmp: %s\n", SDL_GetError());
|
||||
SDL_Quit();
|
||||
exit(3);
|
||||
|
||||
@@ -102,18 +102,18 @@ static int SDL3_SetWindowShape(SDL_Window *window, SDL_Surface *shape, SDL_Windo
|
||||
g_shape_surface = NULL;
|
||||
}
|
||||
|
||||
if (shape == NULL) {
|
||||
if (!shape) {
|
||||
return SDL_SetError("shape");
|
||||
}
|
||||
|
||||
if (shape_mode == NULL) {
|
||||
if (!shape_mode) {
|
||||
return SDL_SetError("shape_mode");
|
||||
}
|
||||
|
||||
g_bitmap_w = shape->w;
|
||||
g_bitmap_h = shape->h;
|
||||
g_bitmap = (Uint8*) SDL_malloc(shape->w * shape->h);
|
||||
if (g_bitmap == NULL) {
|
||||
if (!g_bitmap) {
|
||||
return SDL_OutOfMemory();
|
||||
}
|
||||
|
||||
@@ -170,7 +170,7 @@ static void render(SDL_Renderer *renderer, SDL_Texture *texture)
|
||||
SDL_SetRenderDrawColor(renderer, r, g, b, a);
|
||||
}
|
||||
} else {
|
||||
if (g_shape_texture == NULL) {
|
||||
if (!g_shape_texture) {
|
||||
SDL_BlendMode bm;
|
||||
|
||||
g_shape_texture = SDL_CreateTextureFromSurface(renderer, g_shape_surface);
|
||||
@@ -212,7 +212,7 @@ int main(int argc, char **argv)
|
||||
|
||||
/* Initialize test framework */
|
||||
state = SDLTest_CommonCreateState(argv, 0);
|
||||
if (state == NULL) {
|
||||
if (!state) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -294,13 +294,13 @@ int main(int argc, char **argv)
|
||||
}
|
||||
|
||||
window = SDL_CreateWindow("SDL_Shape test", SHAPED_WINDOW_DIMENSION, SHAPED_WINDOW_DIMENSION, SDL_WINDOW_TRANSPARENT);
|
||||
if (window == NULL) {
|
||||
if (!window) {
|
||||
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Could not create shaped window for SDL_Shape.");
|
||||
rc = -4;
|
||||
goto ret;
|
||||
}
|
||||
renderer = SDL_CreateRenderer(window, NULL, 0);
|
||||
if (renderer == NULL) {
|
||||
if (!renderer) {
|
||||
SDL_DestroyWindow(window);
|
||||
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Could not create rendering context for SDL_Shape window.");
|
||||
rc = -4;
|
||||
|
||||
@@ -434,7 +434,7 @@ int SDL_AppInit(int argc, char *argv[])
|
||||
|
||||
/* Initialize test framework */
|
||||
state = SDLTest_CommonCreateState(argv, SDL_INIT_VIDEO);
|
||||
if (state == NULL) {
|
||||
if (!state) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -529,7 +529,7 @@ int SDL_AppInit(int argc, char *argv[])
|
||||
/* Create the windows, initialize the renderers, and load the textures */
|
||||
sprites =
|
||||
(SDL_Texture **)SDL_malloc(state->num_windows * sizeof(*sprites));
|
||||
if (sprites == NULL) {
|
||||
if (!sprites) {
|
||||
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Out of memory!\n");
|
||||
return -1;
|
||||
}
|
||||
@@ -545,7 +545,7 @@ int SDL_AppInit(int argc, char *argv[])
|
||||
/* Allocate memory for the sprite info */
|
||||
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");
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -133,7 +133,7 @@ int main(int argc, char *argv[])
|
||||
|
||||
sprite = CreateTexture(renderer, icon_bmp, icon_bmp_len, &sprite_w, &sprite_h);
|
||||
|
||||
if (sprite == NULL) {
|
||||
if (!sprite) {
|
||||
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't create texture (%s)", SDL_GetError());
|
||||
return_code = 3;
|
||||
goto quit;
|
||||
|
||||
@@ -139,7 +139,7 @@ int main(int argc, char **argv)
|
||||
|
||||
/* Initialize test framework */
|
||||
state = SDLTest_CommonCreateState(argv, 0);
|
||||
if (state == NULL) {
|
||||
if (!state) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -158,13 +158,13 @@ int main(int argc, char **argv)
|
||||
|
||||
/* load the moose images */
|
||||
filename = GetResourceFilename(NULL, "moose.dat");
|
||||
if (filename == NULL) {
|
||||
if (!filename) {
|
||||
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Out of memory\n");
|
||||
return -1;
|
||||
}
|
||||
handle = SDL_RWFromFile(filename, "rb");
|
||||
SDL_free(filename);
|
||||
if (handle == NULL) {
|
||||
if (!handle) {
|
||||
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Can't find the file moose.dat !\n");
|
||||
quit(2);
|
||||
}
|
||||
@@ -173,19 +173,19 @@ int main(int argc, char **argv)
|
||||
|
||||
/* Create the window and renderer */
|
||||
window = SDL_CreateWindow("Happy Moose", MOOSEPIC_W * 4, MOOSEPIC_H * 4, SDL_WINDOW_RESIZABLE);
|
||||
if (window == NULL) {
|
||||
if (!window) {
|
||||
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't set create window: %s\n", SDL_GetError());
|
||||
quit(3);
|
||||
}
|
||||
|
||||
renderer = SDL_CreateRenderer(window, NULL, 0);
|
||||
if (renderer == NULL) {
|
||||
if (!renderer) {
|
||||
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't set create renderer: %s\n", SDL_GetError());
|
||||
quit(4);
|
||||
}
|
||||
|
||||
MooseTexture = SDL_CreateTexture(renderer, SDL_PIXELFORMAT_ARGB8888, SDL_TEXTUREACCESS_STREAMING, MOOSEPIC_W, MOOSEPIC_H);
|
||||
if (MooseTexture == NULL) {
|
||||
if (!MooseTexture) {
|
||||
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't set create texture: %s\n", SDL_GetError());
|
||||
quit(5);
|
||||
}
|
||||
|
||||
@@ -152,7 +152,7 @@ int main(int argc, char *argv[])
|
||||
|
||||
/* Initialize test framework */
|
||||
state = SDLTest_CommonCreateState(argv, 0);
|
||||
if (state == NULL) {
|
||||
if (!state) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -212,7 +212,7 @@ int main(int argc, char *argv[])
|
||||
active_channel = 0;
|
||||
|
||||
stream = SDL_OpenAudioDeviceStream(devices[i], &spec, fill_buffer, NULL);
|
||||
if (stream == NULL) {
|
||||
if (!stream) {
|
||||
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "SDL_OpenAudioDeviceStream() failed: %s\n", SDL_GetError());
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -93,7 +93,7 @@ int main(int argc, char *argv[])
|
||||
|
||||
/* Initialize test framework */
|
||||
state = SDLTest_CommonCreateState(argv, 0);
|
||||
if (state == NULL) {
|
||||
if (!state) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -139,7 +139,7 @@ int main(int argc, char *argv[])
|
||||
|
||||
alive = 1;
|
||||
thread = SDL_CreateThread(ThreadFunc, "One", "#1");
|
||||
if (thread == NULL) {
|
||||
if (!thread) {
|
||||
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't create thread: %s\n", SDL_GetError());
|
||||
quit(1);
|
||||
}
|
||||
@@ -153,7 +153,7 @@ int main(int argc, char *argv[])
|
||||
alive = 1;
|
||||
(void)signal(SIGTERM, killed);
|
||||
thread = SDL_CreateThread(ThreadFunc, "Two", "#2");
|
||||
if (thread == NULL) {
|
||||
if (!thread) {
|
||||
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't create thread: %s\n", SDL_GetError());
|
||||
quit(1);
|
||||
}
|
||||
|
||||
@@ -76,7 +76,7 @@ int main(int argc, char *argv[])
|
||||
|
||||
/* Initialize test framework */
|
||||
state = SDLTest_CommonCreateState(argv, 0);
|
||||
if (state == NULL) {
|
||||
if (!state) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
@@ -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());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -163,7 +163,7 @@ int main(int argc, char *argv[])
|
||||
|
||||
/* Initialize test framework */
|
||||
state = SDLTest_CommonCreateState(argv, SDL_INIT_VIDEO);
|
||||
if (state == NULL) {
|
||||
if (!state) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -191,7 +191,7 @@ int main(int argc, char *argv[])
|
||||
|
||||
sprite = LoadTexture(state->renderers[0], "icon.bmp", SDL_TRUE, &sprite_w, &sprite_h);
|
||||
|
||||
if (sprite == NULL) {
|
||||
if (!sprite) {
|
||||
quit(2);
|
||||
}
|
||||
|
||||
|
||||
@@ -293,7 +293,7 @@ static void findPhysicalDevice(void)
|
||||
quit(2);
|
||||
}
|
||||
physicalDevices = (VkPhysicalDevice *)SDL_malloc(sizeof(VkPhysicalDevice) * physicalDeviceCount);
|
||||
if (physicalDevices == NULL) {
|
||||
if (!physicalDevices) {
|
||||
SDL_OutOfMemory();
|
||||
quit(2);
|
||||
}
|
||||
@@ -327,7 +327,7 @@ static void findPhysicalDevice(void)
|
||||
SDL_free(queueFamiliesProperties);
|
||||
queueFamiliesPropertiesAllocatedSize = queueFamiliesCount;
|
||||
queueFamiliesProperties = (VkQueueFamilyProperties *)SDL_malloc(sizeof(VkQueueFamilyProperties) * queueFamiliesPropertiesAllocatedSize);
|
||||
if (queueFamiliesProperties == NULL) {
|
||||
if (!queueFamiliesProperties) {
|
||||
SDL_free(physicalDevices);
|
||||
SDL_free(deviceExtensions);
|
||||
SDL_OutOfMemory();
|
||||
@@ -389,7 +389,7 @@ static void findPhysicalDevice(void)
|
||||
SDL_free(deviceExtensions);
|
||||
deviceExtensionsAllocatedSize = deviceExtensionCount;
|
||||
deviceExtensions = SDL_malloc(sizeof(VkExtensionProperties) * deviceExtensionsAllocatedSize);
|
||||
if (deviceExtensions == NULL) {
|
||||
if (!deviceExtensions) {
|
||||
SDL_free(physicalDevices);
|
||||
SDL_free(queueFamiliesProperties);
|
||||
SDL_OutOfMemory();
|
||||
@@ -918,7 +918,7 @@ static void initVulkan(void)
|
||||
SDL_Vulkan_LoadLibrary(NULL);
|
||||
|
||||
vulkanContexts = (VulkanContext *)SDL_calloc(state->num_windows, sizeof(VulkanContext));
|
||||
if (vulkanContexts == NULL) {
|
||||
if (!vulkanContexts) {
|
||||
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Out of memory!");
|
||||
quit(2);
|
||||
}
|
||||
@@ -1079,7 +1079,7 @@ int main(int argc, char **argv)
|
||||
|
||||
/* Initialize test framework */
|
||||
state = SDLTest_CommonCreateState(argv, SDL_INIT_VIDEO);
|
||||
if (state == NULL) {
|
||||
if (!state) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
@@ -205,7 +205,7 @@ static void loop(void)
|
||||
}
|
||||
if (event.type == SDL_EVENT_MOUSE_BUTTON_UP) {
|
||||
SDL_Window *window = SDL_GetMouseFocus();
|
||||
if (highlighted_mode != NULL && window != NULL) {
|
||||
if (highlighted_mode && window) {
|
||||
SDL_memcpy(&state->fullscreen_mode, highlighted_mode, sizeof(state->fullscreen_mode));
|
||||
SDL_SetWindowFullscreenMode(window, highlighted_mode);
|
||||
}
|
||||
@@ -215,7 +215,7 @@ static void loop(void)
|
||||
for (i = 0; i < state->num_windows; ++i) {
|
||||
SDL_Window *window = state->windows[i];
|
||||
SDL_Renderer *renderer = state->renderers[i];
|
||||
if (window != NULL && renderer != NULL) {
|
||||
if (window && renderer) {
|
||||
float y = 0.0f;
|
||||
SDL_Rect viewport;
|
||||
SDL_FRect menurect;
|
||||
@@ -251,7 +251,7 @@ int main(int argc, char *argv[])
|
||||
|
||||
/* Initialize test framework */
|
||||
state = SDLTest_CommonCreateState(argv, SDL_INIT_VIDEO);
|
||||
if (state == NULL) {
|
||||
if (!state) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
@@ -73,7 +73,7 @@ static SDL_bool verify_yuv_data(Uint32 format, const Uint8 *yuv, int yuv_pitch,
|
||||
SDL_bool result = SDL_FALSE;
|
||||
|
||||
rgb = (Uint8 *)SDL_malloc(size);
|
||||
if (rgb == NULL) {
|
||||
if (!rgb) {
|
||||
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Out of memory");
|
||||
return SDL_FALSE;
|
||||
}
|
||||
@@ -124,7 +124,7 @@ static int run_automated_tests(int pattern_size, int extra_pitch)
|
||||
int yuv1_pitch, yuv2_pitch;
|
||||
int result = -1;
|
||||
|
||||
if (pattern == NULL || yuv1 == NULL || yuv2 == NULL) {
|
||||
if (!pattern || !yuv1 || !yuv2) {
|
||||
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't allocate test surfaces");
|
||||
goto done;
|
||||
}
|
||||
@@ -263,7 +263,7 @@ int main(int argc, char **argv)
|
||||
|
||||
/* Initialize test framework */
|
||||
state = SDLTest_CommonCreateState(argv, 0);
|
||||
if (state == NULL) {
|
||||
if (!state) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -372,7 +372,7 @@ int main(int argc, char **argv)
|
||||
bmp = SDL_LoadBMP(filename);
|
||||
original = SDL_ConvertSurfaceFormat(bmp, SDL_PIXELFORMAT_RGB24);
|
||||
SDL_DestroySurface(bmp);
|
||||
if (original == NULL) {
|
||||
if (!original) {
|
||||
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't load %s: %s\n", filename, SDL_GetError());
|
||||
return 3;
|
||||
}
|
||||
@@ -384,7 +384,7 @@ int main(int argc, char **argv)
|
||||
pitch = CalculateYUVPitch(yuv_format, original->w);
|
||||
|
||||
converted = SDL_CreateSurface(original->w, original->h, rgb_format);
|
||||
if (converted == NULL) {
|
||||
if (!converted) {
|
||||
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't create converted surface: %s\n", SDL_GetError());
|
||||
return 3;
|
||||
}
|
||||
@@ -397,13 +397,13 @@ int main(int argc, char **argv)
|
||||
SDL_LogInfo(SDL_LOG_CATEGORY_APPLICATION, "%d iterations in %" SDL_PRIu64 " ms, %.2fms each\n", iterations, (now - then), (float)(now - then) / iterations);
|
||||
|
||||
window = SDL_CreateWindow("YUV test", original->w, original->h, 0);
|
||||
if (window == NULL) {
|
||||
if (!window) {
|
||||
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't create window: %s\n", SDL_GetError());
|
||||
return 4;
|
||||
}
|
||||
|
||||
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());
|
||||
return 4;
|
||||
}
|
||||
|
||||
@@ -84,7 +84,7 @@ int main(int argc, char *argv[])
|
||||
|
||||
/* Initialize test framework */
|
||||
state = SDLTest_CommonCreateState(argv, 0);
|
||||
if (state == NULL) {
|
||||
if (!state) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user