From 3bcb08f6c472b3a7cd752c740b3bbe72c90520fd Mon Sep 17 00:00:00 2001 From: Chia-I Wu Date: Sat, 2 Jan 2010 21:56:13 +0800 Subject: progs: Check the number of configs returned by eglChooseConfig. A successful eglChooseConfig call does not imply there are valid configs. Signed-off-by: Chia-I Wu --- progs/openvg/demos/eglcommon.c | 4 ++-- progs/openvg/demos/lion.c | 4 ++-- progs/openvg/trivial/eglcommon.c | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) (limited to 'progs/openvg') diff --git a/progs/openvg/demos/eglcommon.c b/progs/openvg/demos/eglcommon.c index dcec1ac4a47..0316e596c69 100644 --- a/progs/openvg/demos/eglcommon.c +++ b/progs/openvg/demos/eglcommon.c @@ -61,13 +61,13 @@ make_x_window(Display *x_dpy, EGLDisplay egl_dpy, scrnum = DefaultScreen( x_dpy ); root = RootWindow( x_dpy, scrnum ); - if (!eglChooseConfig( egl_dpy, attribs, &config, 1, &num_configs)) { + if (!eglChooseConfig( egl_dpy, attribs, &config, 1, &num_configs) || + !num_configs) { printf("Error: couldn't get an EGL visual config\n"); exit(1); } assert(config); - assert(num_configs > 0); if (!eglGetConfigAttrib(egl_dpy, config, EGL_NATIVE_VISUAL_ID, &vid)) { printf("Error: eglGetConfigAttrib() failed\n"); diff --git a/progs/openvg/demos/lion.c b/progs/openvg/demos/lion.c index 3645b22bc5b..adb269bfd86 100644 --- a/progs/openvg/demos/lion.c +++ b/progs/openvg/demos/lion.c @@ -86,13 +86,13 @@ make_x_window(Display *x_dpy, EGLDisplay egl_dpy, scrnum = DefaultScreen( x_dpy ); root = RootWindow( x_dpy, scrnum ); - if (!eglChooseConfig( egl_dpy, attribs, &config, 1, &num_configs)) { + if (!eglChooseConfig( egl_dpy, attribs, &config, 1, &num_configs) || + !num_configs) { printf("Error: couldn't get an EGL visual config\n"); exit(1); } assert(config); - assert(num_configs > 0); if (!eglGetConfigAttrib(egl_dpy, config, EGL_NATIVE_VISUAL_ID, &vid)) { printf("Error: eglGetConfigAttrib() failed\n"); diff --git a/progs/openvg/trivial/eglcommon.c b/progs/openvg/trivial/eglcommon.c index dcec1ac4a47..0316e596c69 100644 --- a/progs/openvg/trivial/eglcommon.c +++ b/progs/openvg/trivial/eglcommon.c @@ -61,13 +61,13 @@ make_x_window(Display *x_dpy, EGLDisplay egl_dpy, scrnum = DefaultScreen( x_dpy ); root = RootWindow( x_dpy, scrnum ); - if (!eglChooseConfig( egl_dpy, attribs, &config, 1, &num_configs)) { + if (!eglChooseConfig( egl_dpy, attribs, &config, 1, &num_configs) || + !num_configs) { printf("Error: couldn't get an EGL visual config\n"); exit(1); } assert(config); - assert(num_configs > 0); if (!eglGetConfigAttrib(egl_dpy, config, EGL_NATIVE_VISUAL_ID, &vid)) { printf("Error: eglGetConfigAttrib() failed\n"); -- cgit v1.2.3