Skip to content
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

Merged
merged 1 commit into from
Apr 24, 2017

Conversation

LocutusOfBorg
Copy link
Contributor

…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

Copy link
Collaborator

@ebassi ebassi left a 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?

@@ -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;
Copy link
Collaborator

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.

@@ -62,12 +62,16 @@ epoxy_egl_version(EGLDisplay dpy)
{
int major, minor;
const char *version_string;
int ret;
int ret=0, sscanf_ret;
Copy link
Collaborator

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.

ret = sscanf(version_string, "%d.%d", &major, &minor);
assert(ret == 2);
return major * 10 + minor;
if ((version_string = eglQueryString(dpy, EGL_VERSION)))
Copy link
Collaborator

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;
```

@LocutusOfBorg
Copy link
Contributor Author

sorry I copy-pasted the code from an outdated history, this should be better
(your revert commit trapped me)

@@ -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;
Copy link
Collaborator

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);
     ^~~

Copy link
Contributor Author

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
@ebassi ebassi merged commit 10c2cdf into anholt:master Apr 24, 2017
@ebassi
Copy link
Collaborator

ebassi commented Apr 24, 2017

Thanks!

@LocutusOfBorg
Copy link
Contributor Author

thanks for merging!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants