[Piglit] [PATCH 25/29] tests/egl: Add missing type cast

Chad Versace chad.versace at linux.intel.com
Tue May 22 15:43:46 PDT 2012


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 05/21/2012 11:09 AM, Pauli Nieminen wrote:
> Protable code should cast to EGL native types always before passing
> variables to functions taking a native parameter.
> 
> Signed-off-by: Pauli Nieminen <pauli.nieminen at linux.intel.com>
> ---
>  tests/egl/egl-util.c |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
> 
> diff --git a/tests/egl/egl-util.c b/tests/egl/egl-util.c
> index 41fc31f..639515e 100644
> --- a/tests/egl/egl-util.c
> +++ b/tests/egl/egl-util.c
> @@ -179,7 +179,7 @@ egl_util_run(const struct egl_test *test, int argc, char *argv[])
>  	}
>  
>  
> -	state.egl_dpy = eglGetDisplay(state.dpy);
> +	state.egl_dpy = eglGetDisplay((EGLNativeDisplayType)state.dpy);
>  	if (state.egl_dpy == EGL_NO_DISPLAY) {
>  		fprintf(stderr, "eglGetDisplay() failed\n");
>  		piglit_report_result(PIGLIT_FAIL);

I think that this indicates that there is a type mismatch somewhere.
I don't believe such casting is ever necessary. In fact, I believe such
casts will mask real bugs.

Waffle never makes casts for EGLNative types, and it compiles without any warnings.
For example, in the x11_egl backend, Waffle passes a Display* to eglGetDisplay without any typecast;
see the two lines below:

line 54, http://cgit.freedesktop.org/~chadversary/waffle/tree/src/waffle/x11_egl/xegl_display.c?id=0.3#n54
line 29, http://cgit.freedesktop.org/~chadversary/waffle/tree/src/waffle/egl/egl_native_template.c?id=0.3

What problem did you encounter that prompted this patch?

- ----
Chad Versace
chad.versace at linux.intel.com
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.19 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iQIcBAEBAgAGBQJPvBahAAoJEAIvNt057x8i/3AP/0aE+5uT73hKGndqA10+7GWF
7wMHCGjxSdShZUv/+fz+vkFXMq7Q1jV3ehvLEF9CD5A1vkMOwxddlXIJicPOqPk2
RFCyzlJXH/h0Zs+zSnX+Gdkwuh4Xjem6YQSNLHLOvNNXhDOsgRgkkfsKOft21Ozz
6KbF8HVece7Wt8U4T1vDQYxao2jb3vCOFxhVy/7hQ0xEkVU73BbkDerPSW2lhsS2
JYxNcxryMK77ouEguvd57CwW4dlCegrPE4uH4FWNhN+C9PMOju+3KfM5w0CZnQyd
pEa1sNejtznTfc92tMxPiDoJ2DKMQkWLsRogvEzuaxd1IX/f8UA57myOt1C3lLaV
ETvF/s60pR+tK9/7kHU6Ay+3rABwu988vqHsRAmo0DKCoqR6kn5ofpJFi9fzlqJ1
F1rBEg8Z91kV29a/cRnws2LmyGu3cuz9HiJmYkhZlLZC5+AUil1Hi5byk6ecuMoA
j9ckHxCEZx5HlmiH6gCsTI1kiWdruuNZP6gsG5SDoO15aC0XKuUGtcAktEU+Ar9q
+ryS+nBpMD7AMYT/QLOCm/VJ7fxu+0JwLoRYOUA/2UM9pXxL81rGUacAw3VqPJdJ
Lt4NilLlZqEGnshzutegeDEBkG2+Z6NyDkRX3fh7bm9mTPiprnWhWQYgIo8mWQGn
+dGlPIcnSfGoziT8QaT/
=EH4N
-----END PGP SIGNATURE-----


More information about the Piglit mailing list