aboutsummaryrefslogtreecommitdiff
path: root/nx-X11
diff options
context:
space:
mode:
authorDominik Muth <nxdomainuser-muth@yahoo.com>2015-03-26 07:52:58 +0100
committerUlrich Sibiller <uli42@gmx.de>2016-10-19 21:40:30 +0200
commitde4047722a243f1be2212d1af6002247c5c3c733 (patch)
tree08691f581c00abc781baec3954aef1ad24ff1637 /nx-X11
parenta3759f323a476deee8347ac3b88df1b426d7cc1a (diff)
downloadnx-libs-de4047722a243f1be2212d1af6002247c5c3c733.tar.gz
nx-libs-de4047722a243f1be2212d1af6002247c5c3c733.tar.bz2
nx-libs-de4047722a243f1be2212d1af6002247c5c3c733.zip
Xlib.h: Fix macros imitating C functions.
The basic rule "put parantheses around macro parameters" should be observed where possible. Otherwise code like ConnectionNumber(foo = bar); fails to compile. (It obviously passes if ConnectionNumber is a C function.) There are several other macros amended for the same reason. This bug appeared while building http://ioccc.org/1993/cmills.c, so historically it was not present. Signed-off-by: Dominik Muth <muth@nxdomain.no-ip.biz> Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com> Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com> Backported-to-NX-by: Ulrich Sibiller <uli42@gmx.de>
Diffstat (limited to 'nx-X11')
-rw-r--r--nx-X11/lib/X11/Xlib.h34
1 files changed, 17 insertions, 17 deletions
diff --git a/nx-X11/lib/X11/Xlib.h b/nx-X11/lib/X11/Xlib.h
index 5f2368800..1ac1ef181 100644
--- a/nx-X11/lib/X11/Xlib.h
+++ b/nx-X11/lib/X11/Xlib.h
@@ -89,39 +89,39 @@ typedef char *XPointer;
#define QueuedAfterReading 1
#define QueuedAfterFlush 2
-#define ConnectionNumber(dpy) (((_XPrivDisplay)dpy)->fd)
+#define ConnectionNumber(dpy) (((_XPrivDisplay)(dpy))->fd)
#define RootWindow(dpy, scr) (ScreenOfDisplay(dpy,scr)->root)
-#define DefaultScreen(dpy) (((_XPrivDisplay)dpy)->default_screen)
+#define DefaultScreen(dpy) (((_XPrivDisplay)(dpy))->default_screen)
#define DefaultRootWindow(dpy) (ScreenOfDisplay(dpy,DefaultScreen(dpy))->root)
#define DefaultVisual(dpy, scr) (ScreenOfDisplay(dpy,scr)->root_visual)
#define DefaultGC(dpy, scr) (ScreenOfDisplay(dpy,scr)->default_gc)
#define BlackPixel(dpy, scr) (ScreenOfDisplay(dpy,scr)->black_pixel)
#define WhitePixel(dpy, scr) (ScreenOfDisplay(dpy,scr)->white_pixel)
#define AllPlanes ((unsigned long)~0L)
-#define QLength(dpy) (((_XPrivDisplay)dpy)->qlen)
+#define QLength(dpy) (((_XPrivDisplay)(dpy))->qlen)
#define DisplayWidth(dpy, scr) (ScreenOfDisplay(dpy,scr)->width)
#define DisplayHeight(dpy, scr) (ScreenOfDisplay(dpy,scr)->height)
#define DisplayWidthMM(dpy, scr)(ScreenOfDisplay(dpy,scr)->mwidth)
#define DisplayHeightMM(dpy, scr)(ScreenOfDisplay(dpy,scr)->mheight)
#define DisplayPlanes(dpy, scr) (ScreenOfDisplay(dpy,scr)->root_depth)
#define DisplayCells(dpy, scr) (DefaultVisual(dpy,scr)->map_entries)
-#define ScreenCount(dpy) (((_XPrivDisplay)dpy)->nscreens)
-#define ServerVendor(dpy) (((_XPrivDisplay)dpy)->vendor)
-#define ProtocolVersion(dpy) (((_XPrivDisplay)dpy)->proto_major_version)
-#define ProtocolRevision(dpy) (((_XPrivDisplay)dpy)->proto_minor_version)
-#define VendorRelease(dpy) (((_XPrivDisplay)dpy)->release)
-#define DisplayString(dpy) (((_XPrivDisplay)dpy)->display_name)
+#define ScreenCount(dpy) (((_XPrivDisplay)(dpy))->nscreens)
+#define ServerVendor(dpy) (((_XPrivDisplay)(dpy))->vendor)
+#define ProtocolVersion(dpy) (((_XPrivDisplay)(dpy))->proto_major_version)
+#define ProtocolRevision(dpy) (((_XPrivDisplay)(dpy))->proto_minor_version)
+#define VendorRelease(dpy) (((_XPrivDisplay)(dpy))->release)
+#define DisplayString(dpy) (((_XPrivDisplay)(dpy))->display_name)
#define DefaultDepth(dpy, scr) (ScreenOfDisplay(dpy,scr)->root_depth)
#define DefaultColormap(dpy, scr)(ScreenOfDisplay(dpy,scr)->cmap)
-#define BitmapUnit(dpy) (((_XPrivDisplay)dpy)->bitmap_unit)
-#define BitmapBitOrder(dpy) (((_XPrivDisplay)dpy)->bitmap_bit_order)
-#define BitmapPad(dpy) (((_XPrivDisplay)dpy)->bitmap_pad)
-#define ImageByteOrder(dpy) (((_XPrivDisplay)dpy)->byte_order)
-#define NextRequest(dpy) (((_XPrivDisplay)dpy)->request + 1)
-#define LastKnownRequestProcessed(dpy) (((_XPrivDisplay)dpy)->last_request_read)
+#define BitmapUnit(dpy) (((_XPrivDisplay)(dpy))->bitmap_unit)
+#define BitmapBitOrder(dpy) (((_XPrivDisplay)(dpy))->bitmap_bit_order)
+#define BitmapPad(dpy) (((_XPrivDisplay)(dpy))->bitmap_pad)
+#define ImageByteOrder(dpy) (((_XPrivDisplay)(dpy))->byte_order)
+#define NextRequest(dpy) (((_XPrivDisplay)(dpy))->request + 1)
+#define LastKnownRequestProcessed(dpy) (((_XPrivDisplay)(dpy))->last_request_read)
/* macros for screen oriented applications (toolkit) */
-#define ScreenOfDisplay(dpy, scr)(&((_XPrivDisplay)dpy)->screens[scr])
+#define ScreenOfDisplay(dpy, scr)(&((_XPrivDisplay)(dpy))->screens[scr])
#define DefaultScreenOfDisplay(dpy) ScreenOfDisplay(dpy,DefaultScreen(dpy))
#define DisplayOfScreen(s) ((s)->display)
#define RootWindowOfScreen(s) ((s)->root)
@@ -1010,7 +1010,7 @@ typedef union _XEvent {
} XEvent;
#endif
-#define XAllocID(dpy) ((*((_XPrivDisplay)dpy)->resource_alloc)((dpy)))
+#define XAllocID(dpy) ((*((_XPrivDisplay)(dpy))->resource_alloc)((dpy)))
/*
* per character font metric information.