Module Name:    xsrc
Committed By:   mrg
Date:           Tue Aug 28 05:52:12 UTC 2018

Modified Files:
        xsrc/external/mit/libX11/dist/m4: libtool.m4
        xsrc/external/mit/libX11/dist/modules/im/ximcp: imLcLkup.c
        xsrc/external/mit/libX11/dist/src: FontNames.c GetFPath.c ListExt.c
            ModMap.c XlibInt.c

Log Message:
merge libX11 1.6.6.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 xsrc/external/mit/libX11/dist/m4/libtool.m4
cvs rdiff -u -r1.2 -r1.3 \
    xsrc/external/mit/libX11/dist/modules/im/ximcp/imLcLkup.c
cvs rdiff -u -r1.6 -r1.7 xsrc/external/mit/libX11/dist/src/FontNames.c \
    xsrc/external/mit/libX11/dist/src/ModMap.c
cvs rdiff -u -r1.5 -r1.6 xsrc/external/mit/libX11/dist/src/GetFPath.c \
    xsrc/external/mit/libX11/dist/src/ListExt.c
cvs rdiff -u -r1.9 -r1.10 xsrc/external/mit/libX11/dist/src/XlibInt.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/libX11/dist/m4/libtool.m4
diff -u xsrc/external/mit/libX11/dist/m4/libtool.m4:1.4 xsrc/external/mit/libX11/dist/m4/libtool.m4:1.5
--- xsrc/external/mit/libX11/dist/m4/libtool.m4:1.4	Sat Mar  4 22:00:21 2017
+++ xsrc/external/mit/libX11/dist/m4/libtool.m4	Tue Aug 28 05:52:12 2018
@@ -2666,14 +2666,7 @@ freebsd* | dragonfly*)
     *) objformat=elf ;;
     esac
   fi
-  # Handle Gentoo/FreeBSD as it was Linux
-  case $host_vendor in
-    gentoo)
-      version_type=linux ;;
-    *)
-      version_type=freebsd-$objformat ;;
-  esac
-
+  version_type=freebsd-$objformat
   case $version_type in
     freebsd-elf*)
       library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext'
@@ -2685,12 +2678,6 @@ freebsd* | dragonfly*)
       library_names_spec='$libname$release$shared_ext$versuffix $libname$shared_ext$versuffix'
       need_version=yes
       ;;
-    linux)
-      library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}'
-      soname_spec='${libname}${release}${shared_ext}$major'
-      need_lib_prefix=no
-      need_version=no
-      ;;
   esac
   shlibpath_var=LD_LIBRARY_PATH
   case $host_os in
@@ -2900,6 +2887,18 @@ linux* | k*bsd*-gnu | kopensolaris*-gnu 
   dynamic_linker='GNU/Linux ld.so'
   ;;
 
+netbsdelf*-gnu)
+  version_type=linux
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=no
+  hardcode_into_libs=yes
+  dynamic_linker='NetBSD ld.elf_so'
+  ;;
+
 netbsd*)
   version_type=sunos
   need_lib_prefix=no
@@ -3559,7 +3558,7 @@ linux* | k*bsd*-gnu | kopensolaris*-gnu 
   lt_cv_deplibs_check_method=pass_all
   ;;
 
-netbsd*)
+netbsd* | netbsdelf*-gnu)
   if echo __ELF__ | $CC -E - | $GREP __ELF__ > /dev/null; then
     lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so\.[[0-9]]+\.[[0-9]]+|_pic\.a)$'
   else
@@ -4437,7 +4436,7 @@ m4_if([$1], [CXX], [
 	    ;;
 	esac
 	;;
-      netbsd*)
+      netbsd* | netbsdelf*-gnu)
 	;;
       *qnx* | *nto*)
         # QNX uses GNU C++, but need to define -shared option too, otherwise
@@ -4949,6 +4948,9 @@ m4_if([$1], [CXX], [
       ;;
     esac
     ;;
+  linux* | k*bsd*-gnu | gnu*)
+    _LT_TAGVAR(link_all_deplibs, $1)=no
+    ;;
   *)
     _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols'
     ;;
@@ -5011,6 +5013,9 @@ dnl Note also adjust exclude_expsyms for
   openbsd* | bitrig*)
     with_gnu_ld=no
     ;;
+  linux* | k*bsd*-gnu | gnu*)
+    _LT_TAGVAR(link_all_deplibs, $1)=no
+    ;;
   esac
 
   _LT_TAGVAR(ld_shlibs, $1)=yes
@@ -5265,7 +5270,7 @@ _LT_EOF
       fi
       ;;
 
-    netbsd*)
+    netbsd* | netbsdelf*-gnu)
       if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then
 	_LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib'
 	wlarc=
@@ -5786,6 +5791,7 @@ _LT_EOF
 	if test yes = "$lt_cv_irix_exported_symbol"; then
           _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname `test -n "$verstring" && func_echo_all "$wl-set_version $wl$verstring"` $wl-update_registry $wl$output_objdir/so_locations $wl-exports_file $wl$export_symbols -o $lib'
 	fi
+	_LT_TAGVAR(link_all_deplibs, $1)=no
       else
 	_LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry $output_objdir/so_locations -o $lib'
 	_LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry $output_objdir/so_locations -exports_file $export_symbols -o $lib'
@@ -5807,7 +5813,7 @@ _LT_EOF
       esac
       ;;
 
-    netbsd*)
+    netbsd* | netbsdelf*-gnu)
       if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then
 	_LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags'  # a.out
       else

Index: xsrc/external/mit/libX11/dist/modules/im/ximcp/imLcLkup.c
diff -u xsrc/external/mit/libX11/dist/modules/im/ximcp/imLcLkup.c:1.2 xsrc/external/mit/libX11/dist/modules/im/ximcp/imLcLkup.c:1.3
--- xsrc/external/mit/libX11/dist/modules/im/ximcp/imLcLkup.c:1.2	Thu Oct 13 23:38:47 2016
+++ xsrc/external/mit/libX11/dist/modules/im/ximcp/imLcLkup.c	Tue Aug 28 05:52:12 2018
@@ -61,8 +61,8 @@ _XimLocalMbLookupString(XIC xic, XKeyEve
 	    ||(ic->private.local.brl_committed != 0))) {
 	if (ic->private.local.brl_committed != 0) { /* Braille Event */
 	    unsigned char pattern = ic->private.local.brl_committed;
-	    char mb[XLC_PUBLIC(ic->core.im->core.lcd, mb_cur_max)];
-	    ret = _Xlcwctomb(ic->core.im->core.lcd, mb, BRL_UC_ROW | pattern);
+	    char mb2[XLC_PUBLIC(ic->core.im->core.lcd, mb_cur_max)];
+	    ret = _Xlcwctomb(ic->core.im->core.lcd, mb2, BRL_UC_ROW | pattern);
 	    if(ret > bytes) {
 		if(status) *status = XBufferOverflow;
 		return(ret);
@@ -74,7 +74,7 @@ _XimLocalMbLookupString(XIC xic, XKeyEve
 		} else {
 		    if(status) *status = XLookupChars;
 		}
-		memcpy(buffer, mb, ret);
+		memcpy(buffer, mb2, ret);
 	    } else {
 		if(keysym) {
 		    if(status) *status = XLookupKeySym;

Index: xsrc/external/mit/libX11/dist/src/FontNames.c
diff -u xsrc/external/mit/libX11/dist/src/FontNames.c:1.6 xsrc/external/mit/libX11/dist/src/FontNames.c:1.7
--- xsrc/external/mit/libX11/dist/src/FontNames.c:1.6	Sat Mar  4 22:00:21 2017
+++ xsrc/external/mit/libX11/dist/src/FontNames.c	Tue Aug 28 05:52:12 2018
@@ -88,24 +88,16 @@ int *actualCount)	/* RETURN */
 	 * unpack into null terminated strings.
 	 */
 	chstart = ch;
-	chend = ch + (rlen + 1);
+	chend = ch + rlen;
 	length = *(unsigned char *)ch;
 	*ch = 1; /* make sure it is non-zero for XFreeFontNames */
 	for (i = 0; i < rep.nFonts; i++) {
 	    if (ch + length < chend) {
 		flist[i] = ch + 1;  /* skip over length */
 		ch += length + 1;  /* find next length ... */
-		if (ch <= chend) {
-		    length = *(unsigned char *)ch;
-		    *ch = '\0';  /* and replace with null-termination */
-		    count++;
-		} else {
-                    Xfree(chstart);
-                    Xfree(flist);
-                    flist = NULL;
-                    count = 0;
-                    break;
-		}
+		length = *(unsigned char *)ch;
+		*ch = '\0';  /* and replace with null-termination */
+		count++;
 	    } else {
                 Xfree(chstart);
                 Xfree(flist);
Index: xsrc/external/mit/libX11/dist/src/ModMap.c
diff -u xsrc/external/mit/libX11/dist/src/ModMap.c:1.6 xsrc/external/mit/libX11/dist/src/ModMap.c:1.7
--- xsrc/external/mit/libX11/dist/src/ModMap.c:1.6	Tue Oct  4 22:04:39 2016
+++ xsrc/external/mit/libX11/dist/src/ModMap.c	Tue Aug 28 05:52:12 2018
@@ -34,7 +34,7 @@ XModifierKeymap *
 XGetModifierMapping(register Display *dpy)
 {
     xGetModifierMappingReply rep;
-    register xReq *req;
+    _X_UNUSED register xReq *req;
     unsigned long nbytes;
     XModifierKeymap *res;
 
@@ -84,7 +84,7 @@ XSetModifierMapping(
     req->length += mapSize >> 2;
     req->numKeyPerModifier = modifier_map->max_keypermod;
 
-    Data(dpy, (char *)modifier_map->modifiermap, mapSize);
+    Data(dpy, (const char *)modifier_map->modifiermap, mapSize);
 
     (void) _XReply(dpy, (xReply *) & rep,
 	(SIZEOF(xSetModifierMappingReply) - SIZEOF(xReply)) >> 2, xTrue);

Index: xsrc/external/mit/libX11/dist/src/GetFPath.c
diff -u xsrc/external/mit/libX11/dist/src/GetFPath.c:1.5 xsrc/external/mit/libX11/dist/src/GetFPath.c:1.6
--- xsrc/external/mit/libX11/dist/src/GetFPath.c:1.5	Tue Oct  4 22:04:39 2016
+++ xsrc/external/mit/libX11/dist/src/GetFPath.c	Tue Aug 28 05:52:12 2018
@@ -42,7 +42,7 @@ char **XGetFontPath(
 	int count = 0;
 	register unsigned i;
 	register int length;
-	register xReq *req;
+	_X_UNUSED register xReq *req;
 
 	LockDisplay(dpy);
 	GetEmptyReq (GetFontPath, req);
@@ -69,15 +69,20 @@ char **XGetFontPath(
 	    /*
 	     * unpack into null terminated strings.
 	     */
-	    chend = ch + (nbytes + 1);
-	    length = *ch;
+	    chend = ch + nbytes;
+	    length = *(unsigned char *)ch;
 	    for (i = 0; i < rep.nPaths; i++) {
 		if (ch + length < chend) {
 		    flist[i] = ch+1;  /* skip over length */
 		    ch += length + 1; /* find next length ... */
-		    length = *ch;
+		    length = *(unsigned char *)ch;
 		    *ch = '\0'; /* and replace with null-termination */
 		    count++;
+		} else if (i == 0) {
+		    Xfree(flist);
+		    Xfree(ch);
+		    flist = NULL;
+		    break;
 		} else
 		    flist[i] = NULL;
 	    }
Index: xsrc/external/mit/libX11/dist/src/ListExt.c
diff -u xsrc/external/mit/libX11/dist/src/ListExt.c:1.5 xsrc/external/mit/libX11/dist/src/ListExt.c:1.6
--- xsrc/external/mit/libX11/dist/src/ListExt.c:1.5	Tue Oct  4 22:04:39 2016
+++ xsrc/external/mit/libX11/dist/src/ListExt.c	Tue Aug 28 05:52:12 2018
@@ -41,7 +41,7 @@ char **XListExtensions(
 	int count = 0;
 	register unsigned i;
 	register int length;
-	register xReq *req;
+	_X_UNUSED register xReq *req;
 	unsigned long rlen = 0;
 
 	LockDisplay(dpy);
@@ -74,19 +74,20 @@ char **XListExtensions(
 	    /*
 	     * unpack into null terminated strings.
 	     */
-	    chend = ch + (rlen + 1);
-	    length = *ch;
+	    chend = ch + rlen;
+	    length = *(unsigned char *)ch;
 	    for (i = 0; i < rep.nExtensions; i++) {
 		if (ch + length < chend) {
 		    list[i] = ch+1;  /* skip over length */
 		    ch += length + 1; /* find next length ... */
-		    if (ch <= chend) {
-			length = *ch;
-			*ch = '\0'; /* and replace with null-termination */
-			count++;
-		    } else {
-			list[i] = NULL;
-		    }
+		    length = *(unsigned char *)ch;
+		    *ch = '\0'; /* and replace with null-termination */
+		    count++;
+		} else if (i == 0) {
+		    Xfree(list);
+		    Xfree(ch);
+		    list = NULL;
+		    break;
 		} else
 		    list[i] = NULL;
 	    }

Index: xsrc/external/mit/libX11/dist/src/XlibInt.c
diff -u xsrc/external/mit/libX11/dist/src/XlibInt.c:1.9 xsrc/external/mit/libX11/dist/src/XlibInt.c:1.10
--- xsrc/external/mit/libX11/dist/src/XlibInt.c:1.9	Tue Oct  4 22:04:39 2016
+++ xsrc/external/mit/libX11/dist/src/XlibInt.c	Tue Aug 28 05:52:12 2018
@@ -196,7 +196,7 @@ void _XSeqSyncFunction(
     register Display *dpy)
 {
     xGetInputFocusReply rep;
-    register xReq *req;
+    _X_UNUSED register xReq *req;
 
     if ((X_DPY_GET_REQUEST(dpy) - X_DPY_GET_LAST_REQUEST_READ(dpy)) >= (65535 - BUFSIZE/SIZEOF(xReq))) {
 	GetEmptyReq(GetInputFocus, req);
@@ -1238,7 +1238,7 @@ _XWireToEvent(
  * _XDefaultIOError - Default fatal system error reporting routine.  Called
  * when an X internal system error is encountered.
  */
-int _XDefaultIOError(
+_X_NORETURN int _XDefaultIOError(
 	Display *dpy)
 {
 	if (ECHECK(EPIPE)) {
@@ -1382,6 +1382,16 @@ int _XDefaultError(
 	XErrorEvent *event)
 {
     if (_XPrintDefaultError (dpy, event, stderr) == 0) return 0;
+
+    /*
+     * Store in dpy flags that the client is exiting on an unhandled XError
+     * (pretend it is an IOError, since the application is dying anyway it
+     * does not make a difference).
+     * This is useful for _XReply not to hang if the application makes Xlib
+     * calls in _fini as part of process termination.
+     */
+    dpy->flags |= XlibDisplayIOError;
+
     exit(1);
     /*NOTREACHED*/
 }

Reply via email to