test: Change LoadContext() return value type from int to bool

It should be then consistent with SDL_SetError().
This commit is contained in:
capehill
2024-11-05 21:00:31 +02:00
committed by Sam Lantinga
parent ecfd143a26
commit 588e32ea5a
3 changed files with 9 additions and 9 deletions

View File

@@ -33,7 +33,7 @@ static SDL_GLContext context;
static GL_Context ctx; static GL_Context ctx;
static bool suspend_when_occluded; static bool suspend_when_occluded;
static int LoadContext(GL_Context *data) static bool LoadContext(GL_Context *data)
{ {
#ifdef SDL_VIDEO_DRIVER_UIKIT #ifdef SDL_VIDEO_DRIVER_UIKIT
#define __SDL_NOGETPROCADDR__ #define __SDL_NOGETPROCADDR__
@@ -55,7 +55,7 @@ static int LoadContext(GL_Context *data)
#include "../src/render/opengl/SDL_glfuncs.h" #include "../src/render/opengl/SDL_glfuncs.h"
#undef SDL_PROC #undef SDL_PROC
return 0; return true;
} }
/* Call this instead of exit(), so we can clean up SDL: atexit() is evil. */ /* Call this instead of exit(), so we can clean up SDL: atexit() is evil. */
@@ -284,7 +284,7 @@ int main(int argc, char *argv[])
} }
/* Important: call this *after* creating the context */ /* Important: call this *after* creating the context */
if (LoadContext(&ctx) < 0) { if (!LoadContext(&ctx)) {
SDL_Log("Could not load GL functions\n"); SDL_Log("Could not load GL functions\n");
quit(2); quit(2);
return 0; return 0;

View File

@@ -70,7 +70,7 @@ static bool suspend_when_occluded;
static GLES2_Context ctx; static GLES2_Context ctx;
static shader_data *datas; static shader_data *datas;
static int LoadContext(GLES2_Context *data) static bool LoadContext(GLES2_Context *data)
{ {
#ifdef SDL_VIDEO_DRIVER_UIKIT #ifdef SDL_VIDEO_DRIVER_UIKIT
#define __SDL_NOGETPROCADDR__ #define __SDL_NOGETPROCADDR__
@@ -92,7 +92,7 @@ static int LoadContext(GLES2_Context *data)
#include "../src/render/opengles2/SDL_gles2funcs.h" #include "../src/render/opengles2/SDL_gles2funcs.h"
#undef SDL_PROC #undef SDL_PROC
return 0; return true;
} }
/* Call this instead of exit(), so we can clean up SDL: atexit() is evil. */ /* Call this instead of exit(), so we can clean up SDL: atexit() is evil. */
@@ -764,7 +764,7 @@ int main(int argc, char *argv[])
} }
/* Important: call this *after* creating the context */ /* Important: call this *after* creating the context */
if (LoadContext(&ctx) < 0) { if (!LoadContext(&ctx)) {
SDL_Log("Could not load GLES2 functions\n"); SDL_Log("Could not load GLES2 functions\n");
quit(2); quit(2);
return 0; return 0;

View File

@@ -61,7 +61,7 @@ static SDL_GLContext *context = NULL;
static int depth = 16; static int depth = 16;
static GLES2_Context ctx; static GLES2_Context ctx;
static int LoadContext(GLES2_Context *data) static bool LoadContext(GLES2_Context *data)
{ {
#ifdef SDL_VIDEO_DRIVER_UIKIT #ifdef SDL_VIDEO_DRIVER_UIKIT
#define __SDL_NOGETPROCADDR__ #define __SDL_NOGETPROCADDR__
@@ -83,7 +83,7 @@ static int LoadContext(GLES2_Context *data)
#include "../src/render/opengles2/SDL_gles2funcs.h" #include "../src/render/opengles2/SDL_gles2funcs.h"
#undef SDL_PROC #undef SDL_PROC
return 0; return true;
} }
/* Call this instead of exit(), so we can clean up SDL: atexit() is evil. */ /* Call this instead of exit(), so we can clean up SDL: atexit() is evil. */
@@ -523,7 +523,7 @@ int main(int argc, char *argv[])
} }
/* Important: call this *after* creating the context */ /* Important: call this *after* creating the context */
if (LoadContext(&ctx) < 0) { if (!LoadContext(&ctx)) {
SDL_Log("Could not load GLES2 functions\n"); SDL_Log("Could not load GLES2 functions\n");
quit(2); quit(2);
return 0; return 0;