summaryrefslogtreecommitdiffstats
path: root/src/egl
diff options
context:
space:
mode:
authorChia-I Wu <[email protected]>2010-01-25 11:39:44 +0800
committerChia-I Wu <[email protected]>2010-01-25 11:44:13 +0800
commitdbb866ab33862defc2749134805bafebf323fd11 (patch)
tree7f6c37e9371d6341838bbb7c3eed7b702fe784dd /src/egl
parent3f932a444021958d632e3e6334d7b168304dfd74 (diff)
egl: Make resource void pointer in _eglCheckResource.
This emphasizes the fact that the resource to be checked could really be invalid and have an unknown type.
Diffstat (limited to 'src/egl')
-rw-r--r--src/egl/main/eglcontext.h3
-rw-r--r--src/egl/main/egldisplay.c7
-rw-r--r--src/egl/main/egldisplay.h6
-rw-r--r--src/egl/main/eglimage.h3
-rw-r--r--src/egl/main/eglsurface.h3
5 files changed, 11 insertions, 11 deletions
diff --git a/src/egl/main/eglcontext.h b/src/egl/main/eglcontext.h
index b81dc1ed820..be00642d134 100644
--- a/src/egl/main/eglcontext.h
+++ b/src/egl/main/eglcontext.h
@@ -95,9 +95,8 @@ _eglUnlinkContext(_EGLContext *ctx)
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;
}
diff --git a/src/egl/main/egldisplay.c b/src/egl/main/egldisplay.c
index c978adb47f5..74c655df411 100644
--- a/src/egl/main/egldisplay.c
+++ b/src/egl/main/egldisplay.c
@@ -214,12 +214,15 @@ _eglCheckDisplayHandle(EGLDisplay dpy)
* 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;
}
diff --git a/src/egl/main/egldisplay.h b/src/egl/main/egldisplay.h
index 70fe29513c1..5d44eb1ea88 100644
--- a/src/egl/main/egldisplay.h
+++ b/src/egl/main/egldisplay.h
@@ -107,7 +107,7 @@ _eglCheckDisplayHandle(EGLDisplay dpy);
extern EGLBoolean
-_eglCheckResource(_EGLResource *res, _EGLResourceType type, _EGLDisplay *dpy);
+_eglCheckResource(void *res, _EGLResourceType type, _EGLDisplay *dpy);
#else /* !_EGL_SKIP_HANDLE_CHECK */
@@ -122,9 +122,9 @@ _eglCheckDisplayHandle(EGLDisplay dpy)
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);
}
diff --git a/src/egl/main/eglimage.h b/src/egl/main/eglimage.h
index 026b10307de..43107c23e9f 100644
--- a/src/egl/main/eglimage.h
+++ b/src/egl/main/eglimage.h
@@ -61,9 +61,8 @@ _eglUnlinkImage(_EGLImage *img)
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;
}
diff --git a/src/egl/main/eglsurface.h b/src/egl/main/eglsurface.h
index da07133c2c1..f1642356b0b 100644
--- a/src/egl/main/eglsurface.h
+++ b/src/egl/main/eglsurface.h
@@ -141,9 +141,8 @@ _eglUnlinkSurface(_EGLSurface *surf)
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;
}