static INLINE _EGLContext *
_eglLookupContext(EGLContext context, _EGLDisplay *dpy)
{
- _EGLResource *res = (_EGLResource *) context;
_EGLContext *ctx = (_EGLContext *) context;
- if (!res || !dpy || !_eglCheckResource(res, _EGL_RESOURCE_CONTEXT, dpy))
+ if (!dpy || !_eglCheckResource((void *) ctx, _EGL_RESOURCE_CONTEXT, dpy))
ctx = NULL;
return ctx;
}
* own the resource.
*/
EGLBoolean
-_eglCheckResource(_EGLResource *res, _EGLResourceType type, _EGLDisplay *dpy)
+_eglCheckResource(void *res, _EGLResourceType type, _EGLDisplay *dpy)
{
_EGLResource *list = dpy->ResourceLists[type];
+ if (!res)
+ return EGL_FALSE;
+
while (list) {
- if (res == list) {
+ if (res == (void *) list) {
assert(list->Display == dpy);
break;
}
extern EGLBoolean
-_eglCheckResource(_EGLResource *res, _EGLResourceType type, _EGLDisplay *dpy);
+_eglCheckResource(void *res, _EGLResourceType type, _EGLDisplay *dpy);
#else /* !_EGL_SKIP_HANDLE_CHECK */
static INLINE EGLBoolean
-_eglCheckResource(_EGLResource *res, _EGLResourceType type, _EGLDisplay *dpy)
+_eglCheckResource(void *res, _EGLResourceType type, _EGLDisplay *dpy);
{
- return (res->Display == dpy);
+ return (((_EGLResource *) res)->Display == dpy);
}
static INLINE _EGLImage *
_eglLookupImage(EGLImageKHR image, _EGLDisplay *dpy)
{
- _EGLResource *res = (_EGLResource *) image;
_EGLImage *img = (_EGLImage *) image;
- if (!res || !dpy || !_eglCheckResource(res, _EGL_RESOURCE_IMAGE, dpy))
+ if (!dpy || !_eglCheckResource((void *) img, _EGL_RESOURCE_IMAGE, dpy))
img = NULL;
return img;
}
static INLINE _EGLSurface *
_eglLookupSurface(EGLSurface surface, _EGLDisplay *dpy)
{
- _EGLResource *res = (_EGLResource *) surface;
_EGLSurface *surf = (_EGLSurface *) surface;
- if (!res || !dpy || !_eglCheckResource(res, _EGL_RESOURCE_SURFACE, dpy))
+ if (!dpy || !_eglCheckResource((void *) surf, _EGL_RESOURCE_SURFACE, dpy))
surf = NULL;
return surf;
}