-
Notifications
You must be signed in to change notification settings - Fork 161
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
epoxy_internal_has_gl_extension, epoxy_egl_version: add some missing … #118
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for your contribution!
Could you please split this pull request into two separate commits — one for the glGetStringi()
and the other for the EGL check?
src/dispatch_common.c
Outdated
@@ -478,6 +478,7 @@ epoxy_internal_has_gl_extension(const char *ext, bool invalid_op_mode) | |||
|
|||
for (i = 0; i < num_extensions; i++) { | |||
const char *gl_ext = (const char *)glGetStringi(GL_EXTENSIONS, i); | |||
if(! gl_ext) return false; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would be great if you could respect the coding style, and add a newline break for return false
.
src/dispatch_egl.c
Outdated
@@ -62,12 +62,16 @@ epoxy_egl_version(EGLDisplay dpy) | |||
{ | |||
int major, minor; | |||
const char *version_string; | |||
int ret; | |||
int ret=0, sscanf_ret; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please, add a space between ret
and =
, and between =
and 0.
src/dispatch_egl.c
Outdated
ret = sscanf(version_string, "%d.%d", &major, &minor); | ||
assert(ret == 2); | ||
return major * 10 + minor; | ||
if ((version_string = eglQueryString(dpy, EGL_VERSION))) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The coding style is also off, here.
It would be great to replace the whole block with a simple NULL check, e.g.:
version_string = eglQueryString(dpy, EGL_VERSION);
if (!version_string)
return 0;
```
sorry I copy-pasted the code from an outdated history, this should be better |
src/dispatch_common.c
Outdated
@@ -443,6 +443,9 @@ bool | |||
epoxy_extension_in_string(const char *extension_list, const char *ext) | |||
{ | |||
const char *ptr = extension_list; | |||
if (!ext) | |||
return false; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This chunk generates a warning:
../src/dispatch_common.c: In function ‘epoxy_extension_in_string’:
../src/dispatch_common.c:449:5: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
int len = strlen(ext);
^~~
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should be better now
…nullpointer checks from https://bugzilla.redhat.com/show_bug.cgi?id=1395366 Related commit: b3b8bd9 Fix "epoxy_glx_version" to handle the case when GLX is not active on the display. Patch is tweak from the original version posted by Tom Horsley
Thanks! |
thanks for merging! |
…nullpointer checks from https://bugzilla.redhat.com/show_bug.cgi?id=1395366
Related commit: b3b8bd9
Fix "epoxy_glx_version" to handle the case when GLX is not active on the display.
Patch is tweak from the original version posted by Tom Horsley