INSTALL | 16 MANIFEST | 2 Makefile.in | 9 Tekproc.c | 4 VTPrsTbl.c | 10 VTparse.def | 3 VTparse.h | 3 aclocal.m4 | 314 ++++- button.c | 142 +- cachedGCs.c | 8 charproc.c | 267 +++- configure | 3157 +++++++++++++++++++++++++++++++------------------------ configure.in | 12 ctlseqs.ms | 15 ctlseqs.txt | 11 cursor.c | 8 debian/changelog | 9 doublechr.c | 4 fontutils.c | 41 fontutils.h | 4 input.c | 211 ++- linedata.c | 31 main.c | 46 main.h | 6 menu.c | 16 misc.c | 58 - print.c | 6 ptydata.c | 13 ptyx.h | 47 resize.c | 18 screen.c | 77 - scrollback.c | 22 scrollbar.c | 326 ++++- tabs.c | 10 testxmc.c | 12 trace.c | 7 trace.h | 8 util.c | 188 +-- version.h | 4 xstrings.c | 6 xterm.h | 48 xterm.log.html | 69 + xterm.man | 26 xtermcap.c | 6 xtermcfg.hin | 7 45 files changed, 3368 insertions(+), 1939 deletions(-)
New commits: commit 7ceab310166aa3ae6224d0c52c8d65778caff271 Author: Julien Cristau <[email protected]> Date: Thu Apr 22 18:34:37 2010 +0200 Update changelog diff --git a/debian/changelog b/debian/changelog index 8b04e70..6e348b6 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,9 +1,14 @@ -xterm (256-2) UNRELEASED; urgency=low +xterm (257-1) UNRELEASED; urgency=low * terminfo: derive xterm{16,256,88}-color from xterm-debian (patch by Sven Joachim), closes: #547443. + * New upstream release + + modify AllocateTermColor() to separate initialization from control + sequences, fixing problem from patch #254 changes where enabling + allowSendEvents resource prevents setting cursor color on command-line + (closes: #572928) - -- Julien Cristau <[email protected]> Fri, 09 Apr 2010 14:17:48 +0200 + -- Julien Cristau <[email protected]> Thu, 22 Apr 2010 18:32:23 +0200 xterm (256-1) unstable; urgency=low commit 628a46ec01513a19e3aa11a7662e00c06244f1fa Author: Julien Cristau <[email protected]> Date: Thu Apr 22 18:11:09 2010 +0200 Import xterm 257 diff --git a/INSTALL b/INSTALL index 2f85f3a..d2afa33 100644 --- a/INSTALL +++ b/INSTALL @@ -1,6 +1,6 @@ --- $XTermId: INSTALL,v 1.121 2009/08/06 00:39:09 tom Exp $ +-- $XTermId: INSTALL,v 1.122 2010/04/14 10:56:29 tom Exp $ ------------------------------------------------------------------------------- --- Copyright 1997-2007,2008 by Thomas E. Dickey +-- Copyright 1997-2009,2010 by Thomas E. Dickey -- -- All Rights Reserved -- @@ -258,6 +258,11 @@ The options (in alphabetic order): leaving the right scrollbar incorrectly positioned after changing the font size. + --disable-rpath-hack don't add rpath options for additional libraries + + By default, the configure script looks for libraries in unusual places + and adds an rpath linker option to help. + --disable-samename disable check for redundant name-change Do not compile-in code that suppresses redundant updates to the @@ -561,6 +566,13 @@ The options (in alphabetic order): If regular expressions are not disable (--disable-regex), use PCRE rather than the POSIX regular expressions. + --with-pkg-config{=path} enable/disable use of pkg-config + + The configure script looks for certain libraries which have well + established pkg-config scripts, and will use those settings if + available. Not all pkg-config scripts work; this option suppresses + the check and relies on normal library search paths. + --with-reference=XXX program to use as permissions-reference To install xterm with setuid permissions, the scripts usually compare diff --git a/MANIFEST b/MANIFEST index 282f20a..c82ef69 100644 --- a/MANIFEST +++ b/MANIFEST @@ -1,4 +1,4 @@ -MANIFEST for xterm-255, version xterm-255 +MANIFEST for xterm-257, version xterm-257 -------------------------------------------------------------------------------- MANIFEST this file 256colres.h resource-definitions for 256-color mode diff --git a/Makefile.in b/Makefile.in index 07b1f74..0c0bff6 100644 --- a/Makefile.in +++ b/Makefile.in @@ -1,4 +1,4 @@ -## $XTermId: Makefile.in,v 1.170 2010/03/04 02:03:33 tom Exp $ +## $XTermId: Makefile.in,v 1.171 2010/04/04 22:41:32 tom Exp $ # ----------------------------------------------------------------------------- # this file is part of xterm # @@ -46,6 +46,9 @@ CPP = @CPP@ AWK = @AWK@ LINK = $(CC) $(CFLAGS) +CTAGS = @CTAGS@ +ETAGS = @ETAGS@ + LN_S = @LN_S@ RM = rm -f LINT = @LINT@ @@ -397,10 +400,10 @@ lint : $(LINT) $(CPPFLAGS) $(SRCS2) tags : - ctags $(SRCS) $(HDRS) + $(CTAGS) $(SRCS) $(HDRS) TAGS : - etags $(SRCS) $(HDRS) + $(ETAGS) $(SRCS) $(HDRS) $(TERMINFO_DIR) $(INSTALL_DIRS) : mkdir -p $@ diff --git a/Tekproc.c b/Tekproc.c index 52dc9f2..b5ae9d2 100644 --- a/Tekproc.c +++ b/Tekproc.c @@ -1,4 +1,4 @@ -/* $XTermId: Tekproc.c,v 1.175 2009/12/09 23:25:34 Jochen.Voss Exp $ */ +/* $XTermId: Tekproc.c,v 1.176 2010/04/18 16:22:54 tom Exp $ */ /* * Warning, there be crufty dragons here. @@ -754,7 +754,7 @@ Tekparse(TekWidget tw) Char buf2[512]; IChar c2; - unsigned len = 0; + size_t len = 0; while ((c2 = input()) != ANSI_BEL) { if (!isprint((int) (c2 & 0x7f)) || len + 2 >= (int) sizeof(buf2)) diff --git a/VTPrsTbl.c b/VTPrsTbl.c index e0057fd..095b3c1 100644 --- a/VTPrsTbl.c +++ b/VTPrsTbl.c @@ -1,4 +1,4 @@ -/* $XTermId: VTPrsTbl.c,v 1.55 2009/12/29 22:01:11 tom Exp $ */ +/* $XTermId: VTPrsTbl.c,v 1.57 2010/04/10 00:19:56 tom Exp $ */ /* * @@ -550,7 +550,7 @@ CASE_CPR, CASE_GROUND_STATE, /* p q r s */ CASE_GROUND_STATE, -CASE_GROUND_STATE, +CASE_DECLL, CASE_DECSTBM, CASE_DECSC, /* t u v w */ @@ -710,7 +710,7 @@ CASE_CPR, CASE_GROUND_STATE, /* eth ntilde ograve oacute */ CASE_GROUND_STATE, -CASE_GROUND_STATE, +CASE_DECLL, CASE_DECSTBM, CASE_DECSC, /* ocircumflex otilde odiaeresis division */ @@ -874,7 +874,7 @@ CASE_CPR, CASE_GROUND_STATE, /* p q r s */ CASE_GROUND_STATE, -CASE_GROUND_STATE, +CASE_DECLL, CASE_DECSTBM, CASE_DECSC, /* t u v w */ @@ -1034,7 +1034,7 @@ CASE_CPR, CASE_GROUND_STATE, /* eth ntilde ograve oacute */ CASE_GROUND_STATE, -CASE_GROUND_STATE, +CASE_DECLL, CASE_DECSTBM, CASE_DECSC, /* ocircumflex otilde odiaeresis division */ diff --git a/VTparse.def b/VTparse.def index 8a9f08f..8e8d629 100644 --- a/VTparse.def +++ b/VTparse.def @@ -1,4 +1,4 @@ -# $XTermId: VTparse.def,v 1.37 2009/12/29 22:57:10 tom Exp $ +# $XTermId: VTparse.def,v 1.38 2010/04/09 10:47:24 tom Exp $ # # vile:confmode rs=lf # ----------------------------------------------------------------------------- @@ -181,3 +181,4 @@ CASE_SM_TITLE CASE_RM_TITLE CASE_DECSMBV CASE_DECSWBV +CASE_DECLL diff --git a/VTparse.h b/VTparse.h index 1df063b..0fd5110 100644 --- a/VTparse.h +++ b/VTparse.h @@ -1,4 +1,4 @@ -/* $XTermId: VTparse.h,v 1.50 2009/12/29 22:57:16 tom Exp $ */ +/* $XTermId: VTparse.h,v 1.51 2010/04/09 22:29:17 tom Exp $ */ /* * Copyright 2002-2008,2009 by Thomas E. Dickey @@ -261,5 +261,6 @@ extern Const PARSE_T esc_pct_table[]; #define CASE_RM_TITLE 140 #define CASE_DECSMBV 141 #define CASE_DECSWBV 142 +#define CASE_DECLL 143 #endif /* included_VTparse_h */ diff --git a/aclocal.m4 b/aclocal.m4 index e2a9af6..70fb1fc 100644 --- a/aclocal.m4 +++ b/aclocal.m4 @@ -1,4 +1,4 @@ -dnl $XTermId: aclocal.m4,v 1.263 2010/01/20 09:23:58 tom Exp $ +dnl $XTermId: aclocal.m4,v 1.269 2010/04/17 20:32:28 tom Exp $ dnl dnl --------------------------------------------------------------------------- dnl @@ -381,6 +381,25 @@ AC_SUBST(SHOW_CC) AC_SUBST(ECHO_CC) ])dnl dnl --------------------------------------------------------------------------- +dnl CF_DISABLE_RPATH_HACK version: 1 updated: 2010/04/11 10:54:00 +dnl --------------------- +dnl The rpath-hack makes it simpler to build programs, particularly with the +dnl *BSD ports which may have essential libraries in unusual places. But it +dnl can interfere with building an executable for the base system. Use this +dnl option in that case. +AC_DEFUN([CF_DISABLE_RPATH_HACK], +[ +AC_MSG_CHECKING(if rpath should be not be set) +CF_ARG_DISABLE(rpath-hack, + [ --disable-rpath-hack don't add rpath options for additional libraries], + [cf_disable_rpath_hack=yes], + [cf_disable_rpath_hack=no]) +AC_MSG_RESULT($cf_disable_rpath_hack) +if test "$cf_disable_rpath_hack" = no ; then + CF_RPATH_HACK +fi +]) +dnl --------------------------------------------------------------------------- dnl CF_ENABLE_NARROWPROTO version: 3 updated: 2006/02/12 17:46:00 dnl --------------------- dnl If this is not set properly, Xaw's scrollbars will not work. @@ -1082,6 +1101,127 @@ AC_TRY_COMPILE([ test $cf_cv_path_lastlog != no && AC_DEFINE(USE_LASTLOG) ])dnl dnl --------------------------------------------------------------------------- +dnl CF_LD_RPATH_OPT version: 2 updated: 2010/03/27 19:27:54 +dnl --------------- +dnl For the given system and compiler, find the compiler flags to pass to the +dnl loader to use the "rpath" feature. +AC_DEFUN([CF_LD_RPATH_OPT], +[ +AC_REQUIRE([CF_CHECK_CACHE]) + +LD_RPATH_OPT= +AC_MSG_CHECKING(for an rpath option) +case $cf_cv_system_name in #(vi +irix*) #(vi + if test "$GCC" = yes; then + LD_RPATH_OPT="-Wl,-rpath," + else + LD_RPATH_OPT="-rpath " + fi + ;; +linux*|gnu*|k*bsd*-gnu) #(vi + LD_RPATH_OPT="-Wl,-rpath," + ;; +openbsd[[2-9]].*) #(vi + LD_RPATH_OPT="-Wl,-rpath," + ;; +freebsd*) #(vi + LD_RPATH_OPT="-rpath " + ;; +netbsd*) #(vi + LD_RPATH_OPT="-Wl,-rpath," + ;; +osf*|mls+*) #(vi + LD_RPATH_OPT="-rpath " + ;; +solaris2*) #(vi + LD_RPATH_OPT="-R" + ;; +*) + ;; +esac +AC_MSG_RESULT($LD_RPATH_OPT) + +case "x$LD_RPATH_OPT" in #(vi +x-R*) + AC_MSG_CHECKING(if we need a space after rpath option) + cf_save_LIBS="$LIBS" + LIBS="${LD_RPATH_OPT}$libdir $LIBS" + AC_TRY_LINK(, , cf_rpath_space=no, cf_rpath_space=yes) + LIBS="$cf_save_LIBS" + AC_MSG_RESULT($cf_rpath_space) + test "$cf_rpath_space" = yes && LD_RPATH_OPT="$LD_RPATH_OPT " + ;; +esac +])dnl +dnl --------------------------------------------------------------------------- +dnl CF_MAKE_TAGS version: 5 updated: 2010/04/03 20:07:32 +dnl ------------ +dnl Generate tags/TAGS targets for makefiles. Do not generate TAGS if we have +dnl a monocase filesystem. +AC_DEFUN([CF_MAKE_TAGS],[ +AC_REQUIRE([CF_MIXEDCASE_FILENAMES]) + +AC_CHECK_PROGS(CTAGS, exctags ctags) +AC_CHECK_PROGS(ETAGS, exetags etags) + +AC_CHECK_PROG(MAKE_LOWER_TAGS, ${CTAGS-ctags}, yes, no) + +if test "$cf_cv_mixedcase" = yes ; then + AC_CHECK_PROG(MAKE_UPPER_TAGS, ${ETAGS-etags}, yes, no) +else + MAKE_UPPER_TAGS=no +fi + +if test "$MAKE_UPPER_TAGS" = yes ; then + MAKE_UPPER_TAGS= +else + MAKE_UPPER_TAGS="#" +fi + +if test "$MAKE_LOWER_TAGS" = yes ; then + MAKE_LOWER_TAGS= +else + MAKE_LOWER_TAGS="#" +fi + +AC_SUBST(CTAGS) +AC_SUBST(ETAGS) + +AC_SUBST(MAKE_UPPER_TAGS) +AC_SUBST(MAKE_LOWER_TAGS) +])dnl +dnl --------------------------------------------------------------------------- +dnl CF_MIXEDCASE_FILENAMES version: 3 updated: 2003/09/20 17:07:55 +dnl ---------------------- +dnl Check if the file-system supports mixed-case filenames. If we're able to +dnl create a lowercase name and see it as uppercase, it doesn't support that. +AC_DEFUN([CF_MIXEDCASE_FILENAMES], +[ +AC_CACHE_CHECK(if filesystem supports mixed-case filenames,cf_cv_mixedcase,[ +if test "$cross_compiling" = yes ; then + case $target_alias in #(vi + *-os2-emx*|*-msdosdjgpp*|*-cygwin*|*-mingw32*|*-uwin*) #(vi + cf_cv_mixedcase=no + ;; + *) + cf_cv_mixedcase=yes + ;; + esac +else + rm -f conftest CONFTEST + echo test >conftest + if test -f CONFTEST ; then + cf_cv_mixedcase=no + else + cf_cv_mixedcase=yes + fi + rm -f conftest CONFTEST +fi +]) +test "$cf_cv_mixedcase" = yes && AC_DEFINE(MIXEDCASE_FILENAMES) +])dnl +dnl --------------------------------------------------------------------------- dnl CF_MSG_LOG version: 4 updated: 2007/07/29 09:55:12 dnl ---------- dnl Write a debug message to config.log, along with the line number in the @@ -1435,42 +1575,69 @@ AC_SUBST(PROG_EXT) test -n "$PROG_EXT" && AC_DEFINE_UNQUOTED(PROG_EXT,"$PROG_EXT") ])dnl dnl --------------------------------------------------------------------------- -dnl CF_REGEX version: 5 updated: 2009/12/19 13:18:53 +dnl CF_REGEX version: 6 updated: 2010/03/27 13:41:56 dnl -------- dnl Attempt to determine if we've got one of the flavors of regular-expression dnl code that we can support. AC_DEFUN([CF_REGEX], [ -AC_CHECK_FUNC(regcomp,,[ - AC_CHECK_LIB(regex,regcomp,[LIBS="-lregex $LIBS"],[ - AC_CHECK_LIB(re,regcomp,[LIBS="-lre $LIBS"],[ - AC_CHECK_FUNC(compile,,[ - AC_CHECK_LIB(gen,compile,[LIBS="-lgen $LIBS"],[ - AC_MSG_WARN(cannot find regular expression library) - ]) - ]) - ]) - ]) +cf_regex_func=no + +AC_CHECK_FUNC(regcomp,[cf_regex_func=regcomp],[ + for cf_regex_lib in regex re + do + AC_CHECK_LIB($cf_regex_lib,regcomp,[ + LIBS="-l$cf_regex_lib $LIBS" + cf_regex_func=regcomp + break]) + done ]) +if test "$cf_regex_func" = no ; then + AC_CHECK_FUNC(compile,[cf_regex_func=compile],[ + AC_CHECK_LIB(gen,compile,[ + LIBS="-lgen $LIBS" + cf_regex_func=compile])]) +fi + +if test "$cf_regex_func" = no ; then + AC_MSG_WARN(cannot find regular expression library) +fi + AC_CACHE_CHECK(for regular-expression headers,cf_cv_regex_hdrs,[ + cf_cv_regex_hdrs=no -AC_TRY_LINK([#include <sys/types.h> -#include <regex.h>],[ - regex_t *p; - int x = regcomp(p, "", 0); - int y = regexec(p, "", 0, 0, 0); - regfree(p); - ],[cf_cv_regex_hdrs="regex.h"],[ - AC_TRY_LINK([#include <regexp.h>],[ - char *p = compile("", "", "", 0); - int x = step("", ""); - ],[cf_cv_regex_hdrs="regexp.h"],[ - AC_TRY_LINK([#include <regexpr.h>],[ - char *p = compile("", "", ""); +case $cf_regex_func in #(vi +compile) #(vi + for cf_regex_hdr in regexp.h regexpr.h + do + AC_TRY_LINK([#include <$cf_regex_hdr>],[ + char *p = compile("", "", "", 0); int x = step("", ""); - ],[cf_cv_regex_hdrs="regexpr.h"])])]) + ],[ + cf_cv_regex_hdrs=$cf_regex_hdr + break + ]) + done + ;; +*) + for cf_regex_hdr in regex.h + do + AC_TRY_LINK([#include <sys/types.h> +#include <$cf_regex_hdr>],[ + regex_t *p; + int x = regcomp(p, "", 0); + int y = regexec(p, "", 0, 0, 0); + regfree(p); + ],[ + cf_cv_regex_hdrs=$cf_regex_hdr + break + ]) + done + ;; +esac + ]) case $cf_cv_regex_hdrs in #(vi @@ -1498,6 +1665,94 @@ $1=`echo "$2" | \ -e 's/-[[UD]]'"$3"'\(=[[^ ]]*\)\?[$]//g'` ])dnl dnl --------------------------------------------------------------------------- +dnl CF_RPATH_HACK version: 8 updated: 2010/04/17 15:38:58 +dnl ------------- +AC_DEFUN([CF_RPATH_HACK], +[ +AC_REQUIRE([CF_LD_RPATH_OPT]) +AC_MSG_CHECKING(for updated LDFLAGS) +if test -n "$LD_RPATH_OPT" ; then + AC_MSG_RESULT(maybe) + + AC_CHECK_PROGS(cf_ldd_prog,ldd,no) + cf_rpath_list="/usr/lib /lib" + if test "$cf_ldd_prog" != no + then +AC_TRY_LINK([#include <stdio.h>], + [printf("Hello");], + [cf_rpath_list=`$cf_ldd_prog conftest$ac_exeext | fgrep / | sed -e 's%^.*[[ ]]/%/%' -e 's%/[[^/]][[^/]]*$%%' |sort -u`]) + fi + + CF_VERBOSE(...checking EXTRA_LDFLAGS $EXTRA_LDFLAGS) + + CF_RPATH_HACK_2(LDFLAGS) + CF_RPATH_HACK_2(LIBS) + + CF_VERBOSE(...checked EXTRA_LDFLAGS $EXTRA_LDFLAGS) +fi +AC_SUBST(EXTRA_LDFLAGS) +])dnl +dnl --------------------------------------------------------------------------- +dnl CF_RPATH_HACK_2 version: 6 updated: 2010/04/17 16:31:24 +dnl --------------- +dnl Do one set of substitutions for CF_RPATH_HACK, adding an rpath option to +dnl EXTRA_LDFLAGS for each -L option found. +dnl +dnl $cf_rpath_list contains a list of directories to ignore. +dnl +dnl $1 = variable name to update. The LDFLAGS variable should be the only one, +dnl but LIBS often has misplaced -L options. +AC_DEFUN([CF_RPATH_HACK_2], +[ +CF_VERBOSE(...checking $1 [$]$1) + +cf_rpath_dst= +for cf_rpath_src in [$]$1 +do + case $cf_rpath_src in #(vi + -L*) #(vi + + # check if this refers to a directory which we will ignore + cf_rpath_skip=no + if test -n "$cf_rpath_list" + then + for cf_rpath_item in $cf_rpath_list + do + if test "x$cf_rpath_src" = "x-L$cf_rpath_item" + then + cf_rpath_skip=yes + break + fi + done + fi + + if test "$cf_rpath_skip" = no + then + # transform the option + if test "$LD_RPATH_OPT" = "-R " ; then + cf_rpath_tmp=`echo "$cf_rpath_src" |sed -e "s%-L%-R %"` + else + cf_rpath_tmp=`echo "$cf_rpath_src" |sed -e "s%-L%$LD_RPATH_OPT%"` + fi + + # if we have not already added this, add it now + cf_rpath_tst=`echo "$EXTRA_LDFLAGS" | sed -e "s%$cf_rpath_tmp %%"` + if test "x$cf_rpath_tst" = "x$EXTRA_LDFLAGS" + then + CF_VERBOSE(...Filter $cf_rpath_src ->$cf_rpath_tmp) + EXTRA_LDFLAGS="$cf_rpath_tmp $EXTRA_LDFLAGS" + fi + fi + ;; + esac + cf_rpath_dst="$cf_rpath_dst $cf_rpath_src" +done +$1=$cf_rpath_dst + +CF_VERBOSE(...checked $1 [$]$1) +AC_SUBST(EXTRA_LDFLAGS) +])dnl +dnl --------------------------------------------------------------------------- dnl CF_SIGWINCH version: 1 updated: 2006/04/02 16:41:09 dnl ----------- dnl Use this macro after CF_XOPEN_SOURCE, but do not require it (not all @@ -2410,7 +2665,7 @@ AC_TRY_LINK([ test "$cf_cv_xkb_bell_ext" = yes && AC_DEFINE(HAVE_XKB_BELL_EXT) ]) dnl --------------------------------------------------------------------------- -dnl CF_XOPEN_SOURCE version: 32 updated: 2010/01/09 11:05:50 +dnl CF_XOPEN_SOURCE version: 33 updated: 2010/03/28 15:35:52 dnl --------------- dnl Try to get _XOPEN_SOURCE defined properly that we can use POSIX functions, dnl or adapt to the vendor's definitions to get equivalent functionality, @@ -2473,7 +2728,10 @@ nto-qnx*) #(vi sco*) #(vi # setting _XOPEN_SOURCE breaks Lynx on SCO Unix / OpenServer ;; -solaris*) #(vi +solaris2.1[[0-9]]) #(vi + cf_xopen_source="-D__EXTENSIONS__ -D_XOPEN_SOURCE=$cf_XOPEN_SOURCE" + ;; +solaris2.[[1-9]]) #(vi cf_xopen_source="-D__EXTENSIONS__" ;; *) diff --git a/button.c b/button.c index 0cd6b97..2976538 100644 --- a/button.c +++ b/button.c @@ -1,7 +1,7 @@ -/* $XTermId: button.c,v 1.364 2010/01/04 23:13:01 tom Exp $ */ +/* $XTermId: button.c,v 1.375 2010/04/18 17:48:58 tom Exp $ */ /* - * Copyright 1999-2008,2009 by Thomas E. Dickey + * Copyright 1999-2009,2010 by Thomas E. Dickey * * All Rights Reserved * @@ -346,7 +346,7 @@ SendLocatorPosition(XtermWidget xw, XEvent * event) state = (event->xbutton.state & (Button1Mask | Button2Mask | Button3Mask | Button4Mask)) >> 8; /* update mask to "after" state */ - state ^= 1 << button; + state ^= ((unsigned) (1 << button)); /* swap Button1 & Button3 */ state = ((state & (unsigned) ~(4 | 1)) | ((state & 1) ? 4 : 0) @@ -836,10 +836,10 @@ DiredButton(Widget w, if ((event->type == ButtonPress || event->type == ButtonRelease) && (event->xbutton.y >= screen->border) && (event->xbutton.x >= OriginX(screen))) { - line = ((unsigned) (event->xbutton.y - screen->border) - / FontHeight(screen)); - col = ((unsigned) (event->xbutton.x - OriginX(screen)) - / FontWidth(screen)); + line = (unsigned) ((event->xbutton.y - screen->border) + / FontHeight(screen)); + col = (unsigned) ((event->xbutton.x - OriginX(screen)) + / FontWidth(screen)); Line[0] = CONTROL('X'); Line[1] = ANSI_ESC; Line[2] = 'G'; @@ -1075,28 +1075,38 @@ DECtoASCII(unsigned ch) } return ch; } + +#if OPT_WIDE_CHARS +static Cardinal +addXtermChar(Char ** buffer, Cardinal *used, Cardinal offset, unsigned value) +{ + if (offset + 1 >= *used) { + *used = 1 + (2 * (offset + 1)); + allocXtermChars(buffer, *used); + } + (*buffer)[offset++] = (Char) value; + return offset; +} +#define AddChar(buffer, used, offset, value) \ + offset = addXtermChar(buffer, used, offset, (unsigned) value) + /* * Convert a UTF-8 string to Latin-1, replacing non Latin-1 characters by `#', * or ASCII/Latin-1 equivalents for special cases. */ -#if OPT_WIDE_CHARS static Char * -UTF8toLatin1(TScreen * screen, Char * s, unsigned len, unsigned long *result) +UTF8toLatin1(TScreen * screen, Char * s, unsigned long len, unsigned long *result) { static Char *buffer; static Cardinal used; - Char *p, *q; + Cardinal offset = 0; - if (len > used) { - used = 1 + (2 * len); - allocXtermChars(&buffer, used); - } + Char *p; - if (buffer != 0) { + if (len != 0) { PtyData data; - q = buffer; fakePtyData(&data, s, s + len); while (decodeUtf8(&data)) { Bool fails = False; @@ -1105,17 +1115,17 @@ UTF8toLatin1(TScreen * screen, Char * s, unsigned len, unsigned long *result) if (value == UCS_REPL) { fails = True; } else if (value < 256) { - *q++ = CharOf(value); + AddChar(&buffer, &used, offset, CharOf(value)); } else { unsigned eqv = ucs2dec(value); if (xtermIsDecGraphic(eqv)) { - *q++ = (Char) DECtoASCII(eqv); + AddChar(&buffer, &used, offset, DECtoASCII(eqv)); } else { eqv = AsciiEquivs(value); if (eqv == value) { fails = True; } else { - *q++ = (Char) eqv; + AddChar(&buffer, &used, offset, eqv); } if (isWide((wchar_t) value)) extra = True; @@ -1129,19 +1139,14 @@ UTF8toLatin1(TScreen * screen, Char * s, unsigned len, unsigned long *result) */ if (fails) { for (p = (Char *) screen->default_string; *p != '\0'; ++p) { - len = (unsigned) (3 + q - buffer); - if (len >= used) { - used = 1 + (2 * len); - allocXtermChars(&buffer, used); - } - *q++ = *p; + AddChar(&buffer, &used, offset, *p); } } if (extra) - *q++ = ' '; + AddChar(&buffer, &used, offset, ' '); } - *q = 0; - *result = (unsigned long) (q - buffer); + AddChar(&buffer, &used, offset, '\0'); + *result = (unsigned long) (offset - 1); } else { *result = 0; } @@ -1184,8 +1189,8 @@ xtermUtf8ToTextList(XtermWidget xw, new_size += size + 1; } new_text_list = - (char **) XtMalloc(sizeof(char *) * (unsigned) *text_list_count); - new_text_list[0] = tmp = XtMalloc(new_size); + (char **) XtMalloc((Cardinal) sizeof(char *) * (unsigned) *text_list_count); + new_text_list[0] = tmp = XtMalloc((Cardinal) new_size); for (i = 0; i < (*text_list_count); ++i) { data = (Char *) (*text_list)[i]; size = strlen((*text_list)[i]) + 1; @@ -1264,12 +1269,13 @@ overrideTargets(Widget w, String value, Atom ** resultp) if (copied[n] == ',') ++count; } - result = (Atom *) XtMalloc(((2 * count) + 1) * sizeof(Atom)); + result = (Atom *) XtMalloc(((2 * count) + 1) + * (Cardinal) sizeof(Atom)); if (result == NULL) { TRACE(("Couldn't allocate selection types\n")); } else { char nextc = '?'; - char *listp = copied; + char *listp = (char *) copied; count = 0; do { char *nextp = parseItem(listp, &nextc); @@ -1418,7 +1424,7 @@ UnmapSelections(XtermWidget xw) if (screen->mappedSelect) { for (n = 0; screen->mappedSelect[n] != 0; ++n) - free(screen->mappedSelect[n]); + free((void *) screen->mappedSelect[n]); free(screen->mappedSelect); screen->mappedSelect = 0; } @@ -1478,10 +1484,10 @@ MapSelections(XtermWidget xw, String * params, Cardinal num_params) * If it is not a cut-buffer, it is the primary selection (-1). */ static int -CutBuffer(unsigned code) +CutBuffer(Atom code) { int cutbuffer; - switch (code) { + switch ((unsigned) code) { case XA_CUT_BUFFER0: cutbuffer = 0; break; @@ -1544,6 +1550,8 @@ xtermGetSelection(Widget w, XtermWidget xw; + if (num_params == 0) + return; if ((xw = getXtermWidget(w)) == 0) return; @@ -1739,7 +1747,7 @@ _qWriteSelectionData(TScreen * screen, Char * lag, unsigned length) } static void -_WriteSelectionData(TScreen * screen, Char * line, unsigned length) +_WriteSelectionData(TScreen * screen, Char * line, size_t length) { /* Write data to pty a line at a time. */ /* Doing this one line at a time may no longer be necessary @@ -1792,7 +1800,7 @@ _WriteKey(TScreen * screen, Char * in) { Char line[16]; unsigned count = 0; - unsigned length = strlen((char *) in); + size_t length = strlen((char *) in); if (screen->control_eight_bits) { line[count++] = ANSI_CSI; @@ -1912,7 +1920,7 @@ SelectionReceived(Widget w, } #endif for (i = 0; i < text_list_count; i++) { - unsigned len = strlen(text_list[i]); + size_t len = strlen(text_list[i]); _WriteSelectionData(screen, (Char *) text_list[i], len); } #if OPT_PASTE64 @@ -2496,23 +2504,23 @@ PointToCELL(TScreen * screen, static int LastTextCol(TScreen * screen, LineData * ld, int row) { - int i; + int i = -1; Char *ch; - if (okScrnRow(screen, row)) { - for (i = screen->max_col, - ch = ld->attribs + i; - i >= 0 && !(*ch & CHARDRAWN); - ch--, i--) { - ; - } + if (ld != 0) { + if (okScrnRow(screen, row)) { + for (i = screen->max_col, + ch = ld->attribs + i; + i >= 0 && !(*ch & CHARDRAWN); + ch--, i--) { + ; + } #if OPT_DEC_CHRSET - if (CSET_DOUBLE(GetLineDblCS(ld))) { - i *= 2; - } + if (CSET_DOUBLE(GetLineDblCS(ld))) { + i *= 2; + } #endif - } else { - i = -1; + } } return (i); } @@ -2736,7 +2744,7 @@ static char * make_indexed_text(TScreen * screen, int row, unsigned length, int *indexed) { Char *result = 0; - unsigned need = (length + 1); + size_t need = (length + 1); /* * Get a quick upper bound to the number of bytes needed, if the whole @@ -2781,13 +2789,13 @@ make_indexed_text(TScreen * screen, int row, unsigned length, int *indexed) } }); - indexed[used] = last - result; + indexed[used] = (int) (last - result); *next = 0; /* TRACE(("index[%d.%d] %d:%s\n", row, used, indexed[used], last)); */ last = next; ++used; ++col; - indexed[used] = next - result; + indexed[used] = (int) (next - result); } } while (used < length && LineTstWrapped(ld) && @@ -2903,7 +2911,7 @@ do_select_regex(TScreen * screen, CELL * startc, CELL * endc) for (col = 0; indexed[col] < len; ++col) { if (regexec(&preg, search + indexed[col], - 1, &match, 0) == 0) { + (size_t) 1, &match, 0) == 0) { int start_inx = match.rm_so + indexed[col]; int finis_inx = match.rm_eo + indexed[col]; int start_col = indexToCol(indexed, len, start_inx); @@ -3317,7 +3325,7 @@ SaltTextAway(XtermWidget xw, /* now get some memory to save it in */ if (screen->selection_size <= j) { - if ((line = (Char *) malloc((unsigned) j + 1)) == 0) + if ((line = (Char *) malloc((size_t) j + 1)) == 0) SysError(ERROR_BMALLOC2); XtFree((char *) screen->selection_data); screen->selection_data = line; @@ -3364,7 +3372,7 @@ ClearSelectionBuffer(TScreen * screen) } static void -AppendStrToSelectionBuffer(TScreen * screen, Char * text, unsigned len) +AppendStrToSelectionBuffer(TScreen * screen, Char * text, size_t len) { if (len != 0) { int j = (int) (screen->selection_length + len); /* New length */ @@ -3373,7 +3381,7 @@ AppendStrToSelectionBuffer(TScreen * screen, Char * text, unsigned len) if (!screen->selection_length) { /* New buffer */ Char *line; - if ((line = (Char *) malloc((unsigned) k)) == 0) + if ((line = (Char *) malloc((size_t) k)) == 0) SysError(ERROR_BMALLOC2); XtFree((char *) screen->selection_data); screen->selection_data = line; @@ -3381,7 +3389,7 @@ AppendStrToSelectionBuffer(TScreen * screen, Char * text, unsigned len) /* Realloc buffer */ screen->selection_data = (Char *) realloc(screen->selection_data, - (unsigned) k); + (size_t) k); if (screen->selection_data == 0) SysError(ERROR_BMALLOC2); } @@ -3423,21 +3431,21 @@ AppendToSelectionBuffer(TScreen * screen, unsigned c) case 2: ch = CharOf((screen->base64_accu << 6) + six); screen->base64_count = 0; - AppendStrToSelectionBuffer(screen, &ch, 1); + AppendStrToSelectionBuffer(screen, &ch, (size_t) 1); break; case 4: ch = CharOf((screen->base64_accu << 4) + (six >> 2)); screen->base64_accu = (six & 0x3); screen->base64_count = 2; - AppendStrToSelectionBuffer(screen, &ch, 1); + AppendStrToSelectionBuffer(screen, &ch, (size_t) 1); break; case 6: ch = CharOf((screen->base64_accu << 2) + (six >> 4)); screen->base64_accu = (six & 0xF); screen->base64_count = 4; - AppendStrToSelectionBuffer(screen, &ch, 1); + AppendStrToSelectionBuffer(screen, &ch, (size_t) 1); break; } } @@ -3497,13 +3505,15 @@ SaveConvertedLength(XtPointer *target, unsigned long source) if (sizeof(unsigned long) == 4) { *(unsigned long *) *target = source; } else if (sizeof(unsigned) == 4) { - *(unsigned *) *target = source; + *(unsigned *) *target = (unsigned) source; } else if (sizeof(unsigned short) == 4) { *(unsigned short *) *target = (unsigned short) source; } else { /* FIXME - does this depend on byte-order? */ unsigned long temp = source; - memcpy((char *) *target, ((char *) &temp) + sizeof(temp) - 4, 4); + memcpy((char *) *target, + ((char *) &temp) + sizeof(temp) - 4, + (size_t) 4); } -- To UNSUBSCRIBE, email to [email protected] with a subject of "unsubscribe". Trouble? Contact [email protected] Archive: http://lists.debian.org/[email protected]

