From 749c63dbff0ab66223f30af1bad4ca56bd26d5d2 Mon Sep 17 00:00:00 2001 From: Jack Palevich <> Date: Wed, 25 Mar 2009 15:12:17 -0700 Subject: Automated import from //branches/master/...@142578,142578 --- opengl/libagl/egl.cpp | 24 ++++++++++++++++++------ opengl/libs/EGL/egl.cpp | 35 ++++++++++++++++++++--------------- 2 files changed, 38 insertions(+), 21 deletions(-) diff --git a/opengl/libagl/egl.cpp b/opengl/libagl/egl.cpp index 5b90bf0..3b4c041 100644 --- a/opengl/libagl/egl.cpp +++ b/opengl/libagl/egl.cpp @@ -1055,8 +1055,12 @@ EGLBoolean eglChooseConfig( EGLDisplay dpy, const EGLint *attrib_list, { if (egl_display_t::is_valid(dpy) == EGL_FALSE) return setError(EGL_BAD_DISPLAY, EGL_FALSE); + + if (ggl_unlikely(num_config==0)) { + return setError(EGL_BAD_PARAMETER, EGL_FALSE); + } - if (ggl_unlikely(configs==0 || attrib_list==0)) { + if (ggl_unlikely(attrib_list==0)) { *num_config = 0; return EGL_TRUE; } @@ -1102,11 +1106,19 @@ EGLBoolean eglChooseConfig( EGLDisplay dpy, const EGLint *attrib_list, // return the configurations found int n=0; if (possibleMatch) { - for (int i=0 ; config_size && i0) { // n has to be 0 or 1, by construction, and we already know // which config it will return (since there can be only one). - configs[0] = MAKE_CONFIG(i, index); + if (configs) { + configs[0] = MAKE_CONFIG(i, index); + } *num_config = 1; } } @@ -798,19 +799,23 @@ EGLBoolean eglChooseConfig( EGLDisplay dpy, const EGLint *attrib_list, if (cnx->dso) { if (cnx->hooks->egl.eglChooseConfig( dp->dpys[i], attrib_list, configs, config_size, &n)) { - // now we need to convert these client EGLConfig to our - // internal EGLConfig format. This is done in O(n log n). - for (int j=0 ; j( - dp->configs[i], 0, dp->numConfigs[i]-1, configs[j]); - if (index >= 0) { - configs[j] = MAKE_CONFIG(i, index); - } else { - return setError(EGL_BAD_CONFIG, EGL_FALSE); + if (configs) { + // now we need to convert these client EGLConfig to our + // internal EGLConfig format. This is done in O(n log n). + for (int j=0 ; j( + dp->configs[i], 0, dp->numConfigs[i]-1, configs[j]); + if (index >= 0) { + if (configs) { + configs[j] = MAKE_CONFIG(i, index); + } + } else { + return setError(EGL_BAD_CONFIG, EGL_FALSE); + } } + configs += n; + config_size -= n; } - configs += n; - config_size -= n; *num_config += n; res = EGL_TRUE; } -- cgit v1.1