Module Name:    xsrc
Committed By:   mrg
Date:           Sat Jun  1 07:45:50 UTC 2013

Modified Files:
        xsrc/external/mit/libXext/dist/include/X11/extensions: Xdbe.h dpms.h
        xsrc/external/mit/libXext/dist/src: XSync.c Xge.c extutil.c

Log Message:
merge libXext 1.3.2


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 \
    xsrc/external/mit/libXext/dist/include/X11/extensions/Xdbe.h
cvs rdiff -u -r1.6 -r1.7 \
    xsrc/external/mit/libXext/dist/include/X11/extensions/dpms.h
cvs rdiff -u -r1.2 -r1.3 xsrc/external/mit/libXext/dist/src/XSync.c
cvs rdiff -u -r1.4 -r1.5 xsrc/external/mit/libXext/dist/src/Xge.c
cvs rdiff -u -r1.5 -r1.6 xsrc/external/mit/libXext/dist/src/extutil.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: xsrc/external/mit/libXext/dist/include/X11/extensions/Xdbe.h
diff -u xsrc/external/mit/libXext/dist/include/X11/extensions/Xdbe.h:1.4 xsrc/external/mit/libXext/dist/include/X11/extensions/Xdbe.h:1.5
--- xsrc/external/mit/libXext/dist/include/X11/extensions/Xdbe.h:1.4	Thu Feb 24 08:18:03 2011
+++ xsrc/external/mit/libXext/dist/include/X11/extensions/Xdbe.h	Sat Jun  1 07:45:50 2013
@@ -1,5 +1,5 @@
 /******************************************************************************
- * 
+ *
  * Copyright (c) 1994, 1995  Hewlett-Packard Company
  *
  * Permission is hereby granted, free of charge, to any person obtaining
@@ -9,10 +9,10 @@
  * distribute, sublicense, and/or sell copies of the Software, and to
  * permit persons to whom the Software is furnished to do so, subject to
  * the following conditions:
- * 
+ *
  * The above copyright notice and this permission notice shall be included
  * in all copies or substantial portions of the Software.
- * 
+ *
  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
  * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
@@ -20,12 +20,12 @@
  * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
  * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR
  * THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- * 
+ *
  * Except as contained in this notice, the name of the Hewlett-Packard
  * Company shall not be used in advertising or otherwise to promote the
  * sale, use or other dealings in this Software without prior written
  * authorization from the Hewlett-Packard Company.
- * 
+ *
  *     Header file for Xlib-related DBE
  *
  *****************************************************************************/

Index: xsrc/external/mit/libXext/dist/include/X11/extensions/dpms.h
diff -u xsrc/external/mit/libXext/dist/include/X11/extensions/dpms.h:1.6 xsrc/external/mit/libXext/dist/include/X11/extensions/dpms.h:1.7
--- xsrc/external/mit/libXext/dist/include/X11/extensions/dpms.h:1.6	Thu Feb 24 08:18:03 2011
+++ xsrc/external/mit/libXext/dist/include/X11/extensions/dpms.h	Sat Jun  1 07:45:50 2013
@@ -14,14 +14,14 @@ all copies or substantial portions of th
 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
-DIGITAL EQUIPMENT CORPORATION BE LIABLE FOR ANY CLAIM, DAMAGES, INCLUDING, 
-BUT NOT LIMITED TO CONSEQUENTIAL OR INCIDENTAL DAMAGES, OR OTHER LIABILITY, 
-WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR 
+DIGITAL EQUIPMENT CORPORATION BE LIABLE FOR ANY CLAIM, DAMAGES, INCLUDING,
+BUT NOT LIMITED TO CONSEQUENTIAL OR INCIDENTAL DAMAGES, OR OTHER LIABILITY,
+WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
 IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 
-Except as contained in this notice, the name of Digital Equipment Corporation 
+Except as contained in this notice, the name of Digital Equipment Corporation
 shall not be used in advertising or otherwise to promote the sale, use or other
-dealings in this Software without prior written authorization from Digital 
+dealings in this Software without prior written authorization from Digital
 Equipment Corporation.
 
 ******************************************************************/

Index: xsrc/external/mit/libXext/dist/src/XSync.c
diff -u xsrc/external/mit/libXext/dist/src/XSync.c:1.2 xsrc/external/mit/libXext/dist/src/XSync.c:1.3
--- xsrc/external/mit/libXext/dist/src/XSync.c:1.2	Sun Jul 24 13:01:13 2011
+++ xsrc/external/mit/libXext/dist/src/XSync.c	Sat Jun  1 07:45:50 2013
@@ -59,10 +59,12 @@ PERFORMANCE OF THIS SOFTWARE.
 #include <X11/extensions/extutil.h>
 #include <X11/extensions/sync.h>
 #include <X11/extensions/syncproto.h>
+#include <limits.h>
+#include "eat.h"
 
 static XExtensionInfo _sync_info_data;
 static XExtensionInfo *sync_info = &_sync_info_data;
-static char    *sync_extension_name = SYNC_NAME;
+static const char     *sync_extension_name = SYNC_NAME;
 
 #define SyncCheckExtension(dpy,i,val) \
 		XextCheckExtension(dpy, i, sync_extension_name, val)
@@ -89,7 +91,7 @@ static XExtensionHooks sync_extension_ho
     error_string,		/* error_string */
 };
 
-static char    *sync_error_list[] = {
+static const char *sync_error_list[] = {
     "BadCounter",
     "BadAlarm",
     "BadFence",
@@ -351,20 +353,29 @@ XSyncListSystemCounters(Display *dpy, in
     if (rep.nCounters > 0)
     {
 	xSyncSystemCounter *pWireSysCounter, *pNextWireSysCounter;
+	xSyncSystemCounter *pLastWireSysCounter;
 	XSyncCounter counter;
-	int replylen;
+	unsigned int replylen;
 	int i;
 
-	list = Xmalloc(rep.nCounters * sizeof(XSyncSystemCounter));
-	replylen = rep.length << 2;
-	pWireSysCounter = Xmalloc ((unsigned) replylen + sizeof(XSyncCounter));
-        /* +1 to leave room for last counter read-ahead */
+	if (rep.nCounters < (INT_MAX / sizeof(XSyncSystemCounter)))
+	    list = Xmalloc(rep.nCounters * sizeof(XSyncSystemCounter));
+	if (rep.length < (INT_MAX >> 2)) {
+	    replylen = rep.length << 2;
+	    pWireSysCounter = Xmalloc (replylen + sizeof(XSyncCounter));
+	    /* +1 to leave room for last counter read-ahead */
+	    pLastWireSysCounter = (xSyncSystemCounter *)
+		((char *)pWireSysCounter) + replylen;
+	} else {
+	    replylen = 0;
+	    pWireSysCounter = NULL;
+	}
 
 	if ((!list) || (!pWireSysCounter))
 	{
-	    if (list) Xfree((char *) list);
-	    if (pWireSysCounter)   Xfree((char *) pWireSysCounter);
-	    _XEatData(dpy, (unsigned long) replylen);
+	    Xfree(list);
+	    Xfree(pWireSysCounter);
+	    _XEatDataWords(dpy, rep.length);
 	    list = NULL;
 	    goto bail;
 	}
@@ -387,6 +398,14 @@ XSyncListSystemCounters(Display *dpy, in
 	    pNextWireSysCounter = (xSyncSystemCounter *)
 		(((char *)pWireSysCounter) + ((SIZEOF(xSyncSystemCounter) +
 				     pWireSysCounter->name_length + 3) & ~3));
+	    /* Make sure we haven't gone too far */
+	    if (pNextWireSysCounter > pLastWireSysCounter) {
+		Xfree(list);
+		Xfree(pWireSysCounter);
+		list = NULL;
+		goto bail;
+	    }
+
 	    counter = pNextWireSysCounter->counter;
 
 	    list[i].name = ((char *)pWireSysCounter) +
@@ -414,7 +433,7 @@ XSyncFreeSystemCounterList(XSyncSystemCo
 }
 
 
-XSyncCounter 
+XSyncCounter
 XSyncCreateCounter(Display *dpy, XSyncValue initial_value)
 {
     XExtDisplayInfo *info = find_display(dpy);

Index: xsrc/external/mit/libXext/dist/src/Xge.c
diff -u xsrc/external/mit/libXext/dist/src/Xge.c:1.4 xsrc/external/mit/libXext/dist/src/Xge.c:1.5
--- xsrc/external/mit/libXext/dist/src/Xge.c:1.4	Sat Jul 23 21:32:31 2011
+++ xsrc/external/mit/libXext/dist/src/Xge.c	Sat Jun  1 07:45:50 2013
@@ -76,7 +76,7 @@ static Bool _xgeCheckExtension(Display* 
 
 /* main extension information data */
 static XExtensionInfo *xge_info;
-static char xge_extension_name[] = GE_NAME;
+static const char xge_extension_name[] = GE_NAME;
 static XExtensionHooks xge_extension_hooks = {
     NULL,	        /* create_gc */
     NULL,	        /* copy_gc */
@@ -218,7 +218,15 @@ _xgeDpyClose(Display* dpy, XExtCodes* co
         XFree(xge_data);
     }
 
-    return XextRemoveDisplay(xge_info, dpy);
+    if(!XextRemoveDisplay(xge_info, dpy))
+        return 0;
+
+    if (xge_info->ndisplays == 0) {
+        XextDestroyExtension(xge_info);
+        xge_info = NULL;
+    }
+
+    return 1;
 }
 
 /*

Index: xsrc/external/mit/libXext/dist/src/extutil.c
diff -u xsrc/external/mit/libXext/dist/src/extutil.c:1.5 xsrc/external/mit/libXext/dist/src/extutil.c:1.6
--- xsrc/external/mit/libXext/dist/src/extutil.c:1.5	Thu Feb 24 08:18:03 2011
+++ xsrc/external/mit/libXext/dist/src/extutil.c	Sat Jun  1 07:45:50 2013
@@ -24,23 +24,23 @@ in this Software without prior written a
  *
  * Author:  Jim Fulton, MIT X Consortium
  *
- * 
+ *
  * 		       Xlib Extension-Writing Utilities
- * 
+ *
  * This package contains utilities for writing the client API for various
  * protocol extensions.  THESE INTERFACES ARE NOT PART OF THE X STANDARD AND
  * ARE SUBJECT TO CHANGE!
- * 
+ *
  *  Routines include:
- * 
+ *
  *         XextCreateExtension		called once per extension
  *         XextDestroyExtension		if no longer using extension
  *         XextAddDisplay		add another display
  *         XextRemoveDisplay		remove a display
  *         XextFindDisplay		is a display open
- * 
+ *
  * In addition, the following Xlib-style interfaces are provided:
- * 
+ *
  *         XSetExtensionErrorHandler	establish an extension error handler
  *         XMissingExtension		raise an error about missing ext
  */
@@ -55,12 +55,12 @@ in this Software without prior written a
 #include <X11/extensions/ge.h>
 
 /* defined in Xge.c */
-extern _X_HIDDEN Bool 
+extern _X_HIDDEN Bool
 xgeExtRegister(Display* dpy, int extension, XExtensionHooks* callbacks);
 
 /*
  * XextCreateExtension - return an extension descriptor containing context
- * information for this extension.  This object is passed to all Xext 
+ * information for this extension.  This object is passed to all Xext
  * routines.
  */
 XExtensionInfo *XextCreateExtension (void)
@@ -96,7 +96,7 @@ void XextDestroyExtension (XExtensionInf
 XExtDisplayInfo *XextAddDisplay (
     XExtensionInfo *extinfo,
     Display *dpy,
-    char *ext_name,
+    _Xconst char *ext_name,
     XExtensionHooks *hooks,
     int nevents,
     XPointer data)
@@ -110,7 +110,7 @@ XExtDisplayInfo *XextAddDisplay (
     dpyinfo->codes = XInitExtension (dpy, ext_name);
 
     /*
-     * if the server has the extension, then we can initialize the 
+     * if the server has the extension, then we can initialize the
      * appropriate function vectors
      */
     if (dpyinfo->codes) {
@@ -138,7 +138,7 @@ XExtDisplayInfo *XextAddDisplay (
 	if (hooks->free_font)
 	  XESetFreeFont (dpy, dpyinfo->codes->extension, hooks->free_font);
 	if (hooks->close_display)
-	  XESetCloseDisplay (dpy, dpyinfo->codes->extension, 
+	  XESetCloseDisplay (dpy, dpyinfo->codes->extension,
 			     hooks->close_display);
 	if (hooks->error)
 	  XESetError (dpy, dpyinfo->codes->extension, hooks->error);
@@ -251,7 +251,7 @@ static int _default_exterror (Display *d
 
 
 /*
- * XSetExtensionErrorHandler - sets the handler that gets called when a 
+ * XSetExtensionErrorHandler - sets the handler that gets called when a
  * requested extension is referenced.  This should eventually move into Xlib.
  */
 

Reply via email to