diff options
-rw-r--r-- | configure.ac | 6 | ||||
-rw-r--r-- | src/XF86DGA2.c | 17 |
2 files changed, 22 insertions, 1 deletions
diff --git a/configure.ac b/configure.ac index 0558326..955fa3c 100644 --- a/configure.ac +++ b/configure.ac @@ -22,6 +22,12 @@ XORG_CHECK_MALLOC_ZERO # Obtain compiler/linker options for depedencies PKG_CHECK_MODULES(XXF86DGA, xproto x11 xextproto xext [xf86dgaproto >= 2.0.99.2]) +# Check for _XEatDataWords function that may be patched into older Xlib release +SAVE_LIBS="$LIBS" +LIBS="$XXF86DGA_LIBS" +AC_CHECK_FUNCS([_XEatDataWords]) +LIBS="$SAVE_LIBS" + AC_CONFIG_FILES([Makefile src/Makefile man/Makefile diff --git a/src/XF86DGA2.c b/src/XF86DGA2.c index 964de18..c17c7f1 100644 --- a/src/XF86DGA2.c +++ b/src/XF86DGA2.c @@ -6,6 +6,9 @@ Copyright (c) 1995,1996 The XFree86 Project, Inc */ /* THIS IS NOT AN X CONSORTIUM STANDARD */ +#ifdef HAVE_CONFIG_H +#include <config.h> +#endif #ifdef __UNIXOS2__ /* needed here to override certain constants in X headers */ #define INCL_DOS @@ -22,6 +25,18 @@ Copyright (c) 1995,1996 The XFree86 Project, Inc #include <stdio.h> #include <stdint.h> +#include <limits.h> + +#ifndef HAVE__XEATDATAWORDS +static inline void _XEatDataWords(Display *dpy, unsigned long n) +{ +# ifndef LONG64 + if (n >= (ULONG_MAX >> 2)) + _XIOError(dpy); +# endif + _XEatData (dpy, n << 2); +} +#endif /* If you change this, change the Bases[] array below as well */ #define MAX_HEADS 16 @@ -342,7 +357,7 @@ XDGAMode* XDGAQueryModes( } *num = rep.number; } else - _XEatData(dpy, rep.length << 2); + _XEatDataWords(dpy, rep.length); } } |