From 1d6334dd0ca99923b6b55c5c047ef6b5c325f66c Mon Sep 17 00:00:00 2001 From: Jon TURNEY Date: Wed, 19 Jun 2013 13:09:35 +0100 Subject: [PATCH] hw/xwin: Undefine _XSERVER64 in hw/xwin/winclipboard Including any server header might define the macro _XSERVER64 on 64 bit machines. That macro must _NOT_ be defined for Xlib client code, otherwise bad things happen. So let's undef that macro if necessary. Remove server directories from include path to ensure no server includes are included Signed-off-by: Jon TURNEY Reviewed-by: Colin Harrison --- hw/xwin/winclipboard/Makefile.am | 3 +-- hw/xwin/winclipboard/textconv.c | 10 ++++++++++ hw/xwin/winclipboard/thread.c | 9 +++++++++ hw/xwin/winclipboard/wndproc.c | 9 +++++++++ hw/xwin/winclipboard/xevents.c | 9 +++++++++ hw/xwin/winclipboard/xwinclip.c | 9 +++++++++ 6 files changed, 47 insertions(+), 2 deletions(-) diff --git a/hw/xwin/winclipboard/Makefile.am b/hw/xwin/winclipboard/Makefile.am index 614e7ec9e..b1c95f4ef 100644 --- a/hw/xwin/winclipboard/Makefile.am +++ b/hw/xwin/winclipboard/Makefile.am @@ -9,8 +9,7 @@ libXWinclipboard_la_SOURCES = \ libXWinclipboard_la_CFLAGS = -DHAVE_XWIN_CONFIG_H \ $(DIX_CFLAGS) \ - $(XWINMODULES_CFLAGS) \ - -I$(top_srcdir) -I$(top_srcdir)/miext/rootless -I$(srcdir)/.. + $(XWINMODULES_CFLAGS) libXWinclipboard_la_LDFLAGS = -static -no-undefined diff --git a/hw/xwin/winclipboard/textconv.c b/hw/xwin/winclipboard/textconv.c index 4262d98b9..9c9cb3529 100644 --- a/hw/xwin/winclipboard/textconv.c +++ b/hw/xwin/winclipboard/textconv.c @@ -31,6 +31,16 @@ #ifdef HAVE_XWIN_CONFIG_H #include #endif + +/* + * Including any server header might define the macro _XSERVER64 on 64 bit machines. + * That macro must _NOT_ be defined for Xlib client code, otherwise bad things happen. + * So let's undef that macro if necessary. + */ +#ifdef _XSERVER64 +#undef _XSERVER64 +#endif + #include #include "internal.h" diff --git a/hw/xwin/winclipboard/thread.c b/hw/xwin/winclipboard/thread.c index a124e3e90..c179e3f83 100644 --- a/hw/xwin/winclipboard/thread.c +++ b/hw/xwin/winclipboard/thread.c @@ -36,6 +36,15 @@ #define HAS_WINSOCK 1 #endif +/* + * Including any server header might define the macro _XSERVER64 on 64 bit machines. + * That macro must _NOT_ be defined for Xlib client code, otherwise bad things happen. + * So let's undef that macro if necessary. + */ +#ifdef _XSERVER64 +#undef _XSERVER64 +#endif + #include #include #include diff --git a/hw/xwin/winclipboard/wndproc.c b/hw/xwin/winclipboard/wndproc.c index 973f9484e..165ff558a 100644 --- a/hw/xwin/winclipboard/wndproc.c +++ b/hw/xwin/winclipboard/wndproc.c @@ -34,6 +34,15 @@ #include #endif +/* + * Including any server header might define the macro _XSERVER64 on 64 bit machines. + * That macro must _NOT_ be defined for Xlib client code, otherwise bad things happen. + * So let's undef that macro if necessary. + */ +#ifdef _XSERVER64 +#undef _XSERVER64 +#endif + #include #include diff --git a/hw/xwin/winclipboard/xevents.c b/hw/xwin/winclipboard/xevents.c index 8a75bc461..d0077b846 100644 --- a/hw/xwin/winclipboard/xevents.c +++ b/hw/xwin/winclipboard/xevents.c @@ -34,6 +34,15 @@ #include #endif +/* + * Including any server header might define the macro _XSERVER64 on 64 bit machines. + * That macro must _NOT_ be defined for Xlib client code, otherwise bad things happen. + * So let's undef that macro if necessary. + */ +#ifdef _XSERVER64 +#undef _XSERVER64 +#endif + #include "internal.h" #include #include diff --git a/hw/xwin/winclipboard/xwinclip.c b/hw/xwin/winclipboard/xwinclip.c index 7b4577036..3677974c4 100644 --- a/hw/xwin/winclipboard/xwinclip.c +++ b/hw/xwin/winclipboard/xwinclip.c @@ -35,6 +35,15 @@ #include #endif +/* + * Including any server header might define the macro _XSERVER64 on 64 bit machines. + * That macro must _NOT_ be defined for Xlib client code, otherwise bad things happen. + * So let's undef that macro if necessary. + */ +#ifdef _XSERVER64 +#undef _XSERVER64 +#endif + #include #include #include