After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 740605 - Fix Build In gdkgl.c (Avoid GCCism In Pointer Arithmetic)
Fix Build In gdkgl.c (Avoid GCCism In Pointer Arithmetic)
Status: RESOLVED FIXED
Product: gtk+
Classification: Platform
Component: Widget: GtkGLArea
3.15.x
Other Windows
: Normal normal
: ---
Assigned To: gtk-bugs
gtk-bugs
Depends on:
Blocks:
 
 
Reported: 2014-11-24 03:04 UTC by Fan, Chun-wei
Modified: 2014-11-24 15:01 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
gdkgl.c: Avoid GCCism In Pointer Arithmetic (1.12 KB, patch)
2014-11-24 03:06 UTC, Fan, Chun-wei
committed Details | Review

Description Fan, Chun-wei 2014-11-24 03:04:23 UTC
Hi,

In commit 6ffba86 there was a line that was added:
glVertexAttribPointer (program->uv_location, 2, GL_FLOAT, GL_FALSE, sizeof(float) * 4, NULL + sizeof(float) * 2);

As compilers like Visual Studio, and possibly others, see NULL-plus-something as adding something to a void * in pointer arithmetic, the build fails as doing so is non-standard and is a GCCism.

Instead, I think we could achieve the same results by doing (void *) (sizeof(float) * 2) for the 6th argument to the glVertexAttribPointer() call to fix this.

I will enclose a patch for this shortly.
Comment 1 Fan, Chun-wei 2014-11-24 03:06:27 UTC
Created attachment 291334 [details] [review]
gdkgl.c: Avoid GCCism In Pointer Arithmetic

Hi,

Here comes the patch.

With blessings, thank you!
Comment 2 Matthias Clasen 2014-11-24 14:09:36 UTC
Review of attachment 291334 [details] [review]:

looks good
Comment 3 Fan, Chun-wei 2014-11-24 15:00:44 UTC
Review of attachment 291334 [details] [review]:

Hello Matthias,

Thanks for the review, the patch was pushed as 16e863c.

I will close this bug shortly.

With blessings, thank you!