INSTALL                                   |   34 +--
 MANIFEST                                  |    2 
 aclocal.m4                                |   15 -
 button.c                                  |  140 +++++++++-------
 cachedGCs.c                               |   12 -
 charclass.c                               |    4 
 charproc.c                                |  261 ++++++++++++++++--------------
 configure                                 |   52 ++---
 configure.in                              |   18 +-
 cursor.c                                  |   14 -
 debian/changelog                          |   10 +
 debian/patches/901_xterm_manpage.diff     |    8 
 debian/patches/902_pointermode_never.diff |    8 
 debian/patches/903_windowops.diff         |   26 ++
 debian/patches/904_fontops.diff           |   26 ++
 debian/patches/series                     |    2 
 fontutils.c                               |   23 +-
 input.c                                   |   49 ++---
 misc.c                                    |   97 ++++++-----
 ptyx.h                                    |   68 ++++---
 resize.c                                  |   25 +-
 scrollbar.c                               |   30 ++-
 tabs.c                                    |    7 
 util.c                                    |   28 ---
 version.h                                 |    4 
 vttests/tcapquery.pl                      |    5 
 xcharmouse.h                              |    6 
 xstrings.c                                |   34 +++
 xstrings.h                                |    5 
 xterm.h                                   |   23 +-
 xterm.log.html                            |   50 +++++
 xterm.man                                 |   12 +
 xtermcap.c                                |   29 ++-
 33 files changed, 690 insertions(+), 437 deletions(-)

New commits:
commit 1b64a12d95823b6a1acf44c18d9ab7c0e096b763
Author: Julien Cristau <[email protected]>
Date:   Sat Jan 3 17:36:02 2009 +0100

    Prepare changelog for upload

diff --git a/debian/changelog b/debian/changelog
index 52645af..3bbc83d 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,4 +1,4 @@
-xterm (238-1) UNRELEASED; urgency=low
+xterm (238-1) unstable; urgency=low
 
   * New upstream release.
     + respond to incorrectly formatted DECRQSS with a cancel
@@ -6,7 +6,7 @@ xterm (238-1) UNRELEASED; urgency=low
   * Default the allowWindowOps and allowFontOps resources to false, to prevent
     potential security issues.  Thanks to Paul Szabo.
 
- -- Julien Cristau <[email protected]>  Sat, 03 Jan 2009 16:51:01 +0100
+ -- Julien Cristau <[email protected]>  Sat, 03 Jan 2009 17:35:46 +0100
 
 xterm (237-1) unstable; urgency=low
 

commit 11e432aab557f9852c7776f078f22e5125d3f424
Author: Julien Cristau <[email protected]>
Date:   Sat Jan 3 17:21:10 2009 +0100

    Import new upstream release, change allow{Window,Font}Ops default
    
    * respond to incorrectly formatted DECRQSS with a cancel
      (closes: #510030).  Reference: CVE-2008-2383.
    * Default the allowWindowOps and allowFontOps resources to false, to
      prevent potential security issues.

diff --git a/debian/changelog b/debian/changelog
index 8c13635..52645af 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,13 @@
+xterm (238-1) UNRELEASED; urgency=low
+
+  * New upstream release.
+    + respond to incorrectly formatted DECRQSS with a cancel
+      (closes: #510030).  Reference: CVE-2008-2383.
+  * Default the allowWindowOps and allowFontOps resources to false, to prevent
+    potential security issues.  Thanks to Paul Szabo.
+
+ -- Julien Cristau <[email protected]>  Sat, 03 Jan 2009 16:51:01 +0100
+
 xterm (237-1) unstable; urgency=low
 
   * debian/rules: don't fail in patch if the patches are already applied; also
diff --git a/debian/patches/901_xterm_manpage.diff 
b/debian/patches/901_xterm_manpage.diff
index 3f943df..c735fda 100644
--- a/debian/patches/901_xterm_manpage.diff
+++ b/debian/patches/901_xterm_manpage.diff
@@ -5,11 +5,11 @@ Make Debian-specific tweaks to xterm manpage:
 
 This patch by Branden Robinson and David Martínez.
 
-Index: a/xterm.man
+Index: xterm-238/xterm.man
 ===================================================================
---- a/xterm.man.orig
-+++ b/xterm.man
-@@ -4757,10 +4757,10 @@
+--- xterm-238.orig/xterm.man
++++ xterm-238/xterm.man
+@@ -4790,10 +4790,10 @@
  .SH FILES
  The actual pathnames given may differ on your system.
  .TP 5
diff --git a/debian/patches/902_pointermode_never.diff 
b/debian/patches/902_pointermode_never.diff
index 740dfe6..b81ec16 100644
--- a/debian/patches/902_pointermode_never.diff
+++ b/debian/patches/902_pointermode_never.diff
@@ -1,11 +1,11 @@
 Debian-specific tweak: the pointerMode resource is set to 0 (never)
 by default.
 
-Index: a/xterm.man
+Index: xterm-238/xterm.man
 ===================================================================
---- a/xterm.man.orig
-+++ b/xterm.man
-@@ -2543,11 +2543,11 @@
+--- xterm-238.orig/xterm.man
++++ xterm-238/xterm.man
+@@ -2576,11 +2576,11 @@
  .RS
  .TP 3
  0
diff --git a/debian/patches/903_windowops.diff 
b/debian/patches/903_windowops.diff
new file mode 100644
index 0000000..27bc11b
--- /dev/null
+++ b/debian/patches/903_windowops.diff
@@ -0,0 +1,26 @@
+Index: xterm-238/xterm.man
+===================================================================
+--- xterm-238.orig/xterm.man
++++ xterm-238/xterm.man
+@@ -1472,7 +1472,7 @@
+ .B "allowWindowOps (\fPclass\fB AllowWindowOps)"
+ Specifies whether extended window control sequences (as used in dtterm)
+ should be allowed.
+-The default is ``true.''
++The default is ``false.''
+ .TP 8
+ .B "altIsNotMeta (\fPclass\fB AltIsNotMeta\fP)"
+ If ``true'', treat the Alt-key as if it were the Meta-key.
+Index: xterm-238/charproc.c
+===================================================================
+--- xterm-238.orig/charproc.c
++++ xterm-238/charproc.c
+@@ -392,7 +392,7 @@
+     Bres(XtNallowFontOps, XtCAllowFontOps, screen.allowFontOp0, True),
+     Bres(XtNallowTcapOps, XtCAllowTcapOps, screen.allowTcapOp0, True),
+     Bres(XtNallowTitleOps, XtCAllowTitleOps, screen.allowTitleOp0, True),
+-    Bres(XtNallowWindowOps, XtCAllowWindowOps, screen.allowWindowOp0, True),
++    Bres(XtNallowWindowOps, XtCAllowWindowOps, screen.allowWindowOp0, False),
+     Bres(XtNaltIsNotMeta, XtCAltIsNotMeta, screen.alt_is_not_meta, False),
+     Bres(XtNaltSendsEscape, XtCAltSendsEscape, screen.alt_sends_esc, False),
+     Bres(XtNalwaysBoldMode, XtCAlwaysBoldMode, screen.always_bold_mode, 
False),
diff --git a/debian/patches/904_fontops.diff b/debian/patches/904_fontops.diff
new file mode 100644
index 0000000..8a40e2e
--- /dev/null
+++ b/debian/patches/904_fontops.diff
@@ -0,0 +1,26 @@
+Index: xterm-238/charproc.c
+===================================================================
+--- xterm-238.orig/charproc.c
++++ xterm-238/charproc.c
+@@ -389,7 +389,7 @@
+ static XtResource resources[] =
+ {
+     Bres(XtNallowSendEvents, XtCAllowSendEvents, screen.allowSendEvent0, 
False),
+-    Bres(XtNallowFontOps, XtCAllowFontOps, screen.allowFontOp0, True),
++    Bres(XtNallowFontOps, XtCAllowFontOps, screen.allowFontOp0, False),
+     Bres(XtNallowTcapOps, XtCAllowTcapOps, screen.allowTcapOp0, True),
+     Bres(XtNallowTitleOps, XtCAllowTitleOps, screen.allowTitleOp0, True),
+     Bres(XtNallowWindowOps, XtCAllowWindowOps, screen.allowWindowOp0, False),
+Index: xterm-238/xterm.man
+===================================================================
+--- xterm-238.orig/xterm.man
++++ xterm-238/xterm.man
+@@ -1448,7 +1448,7 @@
+ .TP
+ .B "allowFontOps (\fPclass\fB AllowFontOps)"
+ Specifies whether control sequences that set/query the font should be allowed.
+-The default is ``true.''
++The default is ``false.''
+ .TP 8
+ .B "allowSendEvents (\fPclass\fB AllowSendEvents)"
+ Specifies whether or not synthetic key and button events (generated using
diff --git a/debian/patches/series b/debian/patches/series
index 80fb09d..8b585bb 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -1,3 +1,5 @@
 900_debian_xterm.diff
 901_xterm_manpage.diff
 902_pointermode_never.diff
+903_windowops.diff
+904_fontops.diff

commit ccdc8f91c087c81a84abe46a77ab5560be9edd6f
Author: Julien Cristau <[email protected]>
Date:   Sat Jan 3 13:19:34 2009 +0100

    Import xterm 238

diff --git a/INSTALL b/INSTALL
index c1a550f..1485bfb 100644
--- a/INSTALL
+++ b/INSTALL
@@ -1,6 +1,6 @@
--- $XTermId: INSTALL,v 1.117 2007/12/12 01:30:43 tom Exp $
+-- $XTermId: INSTALL,v 1.118 2008/12/30 11:43:45 tom Exp $
 -------------------------------------------------------------------------------
--- Copyright 1997-2006,2007 by Thomas E. Dickey
+-- Copyright 1997-2007,2008 by Thomas E. Dickey
 --
 --                         All Rights Reserved
 --
@@ -221,6 +221,13 @@ The options (in alphabetic order):
 
        (The same ifdef controls the metaSendsEscape support).
 
+  --disable-paste64       disable support for bracketed paste mode
+
+       Do not compile-in code to support experimental bracketed paste mode,
+       i.e., provide functions for setting/getting the selection data.
+
+       (see ctlseqs.ms description of OSC 52).
+
   --disable-pty-handshake disable support for pty handshakes
 
        This feature is used to ensure that the child process's terminal modes
@@ -272,10 +279,17 @@ The options (in alphabetic order):
 
   --disable-tcap-fkeys    disable termcap function-keys
 
-       Compile-in code to support feature which allows xterm to use the
+       Do not compile-in code to support feature which allows xterm to use the
        function-key definitions from the termcap/terminfo entry which it used
        to set the $TERM variable on startup.
 
+  --disable-tcap-query    disable termcap query/report
+
+       Do not compile-in code to support DCS '+' control sequence, which
+       allows an application to ask xterm what control sequences it would
+       transmit for specified function keys, given the termcap or terminfo
+       names.
+
   --disable-tek4014       disable tek4014 emulation
 
        Do not compile-in code to support Tektronix 4014 emulation.
@@ -399,13 +413,6 @@ The options (in alphabetic order):
 
                configure --disable-imake --disable-narrowproto
 
-  --enable-paste64        enable support for bracketed paste mode
-
-       Compile-in code to support experimental bracketed paste mode, i.e.,
-       provide functions for setting/getting the selection data.
-
-       (see ctlseqs.ms description of OSC 52).
-
   --enable-readline-mouse enable support for mouse in readline applications
 
        Compile-in code to support experimental bracketed paste mode, i.e.,
@@ -423,13 +430,6 @@ The options (in alphabetic order):
 
        Compile-in code to support Sun-style function keys.
 
-  --enable-tcap-query     enable termcap query/report
-
-       Compile-in code to support experimental DCS '+' control sequence, which
-       allows an application to ask xterm what control sequences it would
-       transmit for specified function keys, given the termcap or terminfo
-       names.
-
   --enable-toolbar        enable pulldown menus on toolbar
 
        Compile-in code that builds a toolbar with pulldown menus.  The
diff --git a/MANIFEST b/MANIFEST
index 255c8b0..f8d132a 100644
--- a/MANIFEST
+++ b/MANIFEST
@@ -1,4 +1,4 @@
-MANIFEST for xterm-237, version xterm-237
+MANIFEST for xterm-238, version xterm-238
 
--------------------------------------------------------------------------------
 MANIFEST                        this file
 256colres.h                     resource-definitions for 256-color mode
diff --git a/aclocal.m4 b/aclocal.m4
index e415299..f75e048 100644
--- a/aclocal.m4
+++ b/aclocal.m4
@@ -1,4 +1,4 @@
-dnl $XTermId: aclocal.m4,v 1.253 2008/07/27 15:28:15 tom Exp $
+dnl $XTermId: aclocal.m4,v 1.254 2008/12/30 17:01:41 tom Exp $
 dnl
 dnl $XFree86: xc/programs/xterm/aclocal.m4,v 3.65 2006/06/19 00:36:50 dickey 
Exp $
 dnl
@@ -276,13 +276,14 @@ AC_TRY_LINK([#include <stdio.h>],[printf("Hello 
world");],,
 fi
 ])dnl
 dnl ---------------------------------------------------------------------------
-dnl CF_CHECK_ERRNO version: 9 updated: 2001/12/30 18:03:23
+dnl CF_CHECK_ERRNO version: 10 updated: 2008/08/22 16:33:22
 dnl --------------
 dnl Check for data that is usually declared in <stdio.h> or <errno.h>, e.g.,
 dnl the 'errno' variable.  Define a DECL_xxx symbol if we must declare it
 dnl ourselves.
 dnl
 dnl $1 = the name to check
+dnl $2 = the assumed type
 AC_DEFUN([CF_CHECK_ERRNO],
 [
 AC_CACHE_CHECK(if external $1 is declared, cf_cv_dcl_$1,[
@@ -293,7 +294,7 @@ AC_CACHE_CHECK(if external $1 is declared, cf_cv_dcl_$1,[
 #include <stdio.h>
 #include <sys/types.h>
 #include <errno.h> ],
-    [long x = (long) $1],
+    ifelse($2,,int,$2) x = (ifelse($2,,int,$2)) $1,
     [cf_cv_dcl_$1=yes],
     [cf_cv_dcl_$1=no])
 ])
@@ -304,7 +305,7 @@ if test "$cf_cv_dcl_$1" = no ; then
 fi
 
 # It's possible (for near-UNIX clones) that the data doesn't exist
-CF_CHECK_EXTERN_DATA($1,int)
+CF_CHECK_EXTERN_DATA($1,ifelse($2,,int,$2))
 ])dnl
 dnl ---------------------------------------------------------------------------
 dnl CF_CHECK_EXTERN_DATA version: 3 updated: 2001/12/30 18:03:23
@@ -2320,7 +2321,7 @@ int x = XkbBI_Info
 test "$cf_cv_xkb_bell_ext" = yes && AC_DEFINE(HAVE_XKB_BELL_EXT)
 ])
 dnl ---------------------------------------------------------------------------
-dnl CF_XOPEN_SOURCE version: 26 updated: 2008/07/27 11:26:57
+dnl CF_XOPEN_SOURCE version: 28 updated: 2008/12/27 12:30:03
 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,
@@ -2337,7 +2338,7 @@ cf_XOPEN_SOURCE=ifelse($1,,500,$1)
 cf_POSIX_C_SOURCE=ifelse($2,,199506L,$2)
 
 case $host_os in #(vi
-aix[[45]]*) #(vi
+aix[[456]]*) #(vi
        CPPFLAGS="$CPPFLAGS -D_ALL_SOURCE"
        ;;
 freebsd*|dragonfly*) #(vi
@@ -2354,7 +2355,7 @@ hpux*) #(vi
 irix[[56]].*) #(vi
        CPPFLAGS="$CPPFLAGS -D_SGI_SOURCE"
        ;;
-linux*|gnu*|k*bsd*-gnu) #(vi
+linux*|gnu*|mint*|k*bsd*-gnu) #(vi
        CF_GNU_SOURCE
        ;;
 mirbsd*) #(vi
diff --git a/button.c b/button.c
index 3cc1798..6f5f3b1 100644
--- a/button.c
+++ b/button.c
@@ -1,4 +1,4 @@
-/* $XTermId: button.c,v 1.288 2008/07/27 19:36:37 tom Exp $ */
+/* $XTermId: button.c,v 1.297 2008/10/05 23:32:52 tom Exp $ */
 
 /*
  * Copyright 1999-2007,2008 by Thomas E. Dickey
@@ -106,7 +106,8 @@ button.c    Handles button events in the terminal emulator.
 
 #define KeyModifiers (event->xbutton.state & OurModifiers)
 
-#define KeyState(x) (((x) & (ShiftMask|ControlMask)) + (((x) & Mod1Mask) ? 2 : 
0))
+#define KeyState(x) (((int) ((x) & (ShiftMask|ControlMask))) \
+                         + (((x) & Mod1Mask) ? 2 : 0))
     /* adds together the bits:
        shift key -> 1
        meta key  -> 2
@@ -204,6 +205,9 @@ SendMousePosition(XtermWidget xw, XEvent * event)
     case BTN_EVENT_MOUSE:
     case ANY_EVENT_MOUSE:
        if (KeyModifiers == 0 || KeyModifiers == ControlMask) {
+           if (event->type == MotionNotify) {
+               ((XButtonEvent *) event)->button = 0;
+           }
            EditorButton(xw, (XButtonEvent *) event);
            return True;
        }
@@ -249,7 +253,7 @@ SendLocatorPosition(XtermWidget xw, XEvent * event)
     int row, col;
     Bool oor;
     int button;
-    int state;
+    unsigned state;
 
     /* Make sure the event is an appropriate type */
     if ((event->type != ButtonPress &&
@@ -311,10 +315,10 @@ SendLocatorPosition(XtermWidget xw, XEvent * event)
     reply.a_nparam = 4;
     switch (event->type) {
     case ButtonPress:
-       reply.a_param[0] = 2 + (button << 1);
+       reply.a_param[0] = (ParmType) (2 + (button << 1));
        break;
     case ButtonRelease:
-       reply.a_param[0] = 3 + (button << 1);
+       reply.a_param[0] = (ParmType) (3 + (button << 1));
        break;
     default:
        return (True);
@@ -333,9 +337,9 @@ SendLocatorPosition(XtermWidget xw, XEvent * event)
     state ^= 1 << button;      /* update mask to "after" state */
     state = (state & ~(4 | 1)) | ((state & 1) ? 4 : 0) | ((state & 4) ? 1 : 
0);                /* swap Button1 & Button3 */
 
-    reply.a_param[1] = state;
-    reply.a_param[2] = row;
-    reply.a_param[3] = col;
+    reply.a_param[1] = (ParmType) state;
+    reply.a_param[2] = (ParmType) row;
+    reply.a_param[3] = (ParmType) col;
     reply.a_inters = '&';
     reply.a_final = 'w';
 
@@ -425,9 +429,9 @@ GetLocatorPosition(XtermWidget xw)
 
     reply.a_nparam = 4;
     reply.a_param[0] = 1;      /* Event - 1 = response to locator request */
-    reply.a_param[1] = state;
-    reply.a_param[2] = row;
-    reply.a_param[3] = col;
+    reply.a_param[1] = (ParmType) state;
+    reply.a_param[2] = (ParmType) row;
+    reply.a_param[3] = (ParmType) col;
     reply.a_inters = '&';
     reply.a_final = 'w';
     unparseseq(xw, &reply);
@@ -537,9 +541,9 @@ InitLocatorFilter(XtermWidget xw)
        reply.a_type = ANSI_CSI;
        reply.a_nparam = 4;
        reply.a_param[0] = 10;  /* Event - 10 = locator outside filter */
-       reply.a_param[1] = state;
-       reply.a_param[2] = row;
-       reply.a_param[3] = col;
+       reply.a_param[1] = (ParmType) state;
+       reply.a_param[2] = (ParmType) row;
+       reply.a_param[3] = (ParmType) col;
        reply.a_inters = '&';
        reply.a_final = 'w';
        unparseseq(xw, &reply);
@@ -594,9 +598,9 @@ CheckLocatorPosition(XtermWidget xw, XEvent * event)
 
            reply.a_nparam = 4;
            reply.a_param[0] = 10;      /* Event - 10 = locator outside filter 
*/
-           reply.a_param[1] = state;
-           reply.a_param[2] = row;
-           reply.a_param[3] = col;
+           reply.a_param[1] = (ParmType) state;
+           reply.a_param[2] = (ParmType) row;
+           reply.a_param[3] = (ParmType) col;
        }
 
        reply.a_inters = '&';
@@ -807,9 +811,13 @@ DiredButton(Widget w,
        Char Line[6];
        unsigned line, col;
 
-       if (event->type == ButtonPress || event->type == ButtonRelease) {
-           line = (event->xbutton.y - screen->border) / FontHeight(screen);
-           col = (event->xbutton.x - OriginX(screen)) / FontWidth(screen);
+       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[0] = CONTROL('X');
            Line[1] = ANSI_ESC;
            Line[2] = 'G';
@@ -1080,19 +1088,19 @@ UTF8toLatin1(Char * s, unsigned len, unsigned long 
*result)
            } else {
                unsigned eqv = ucs2dec(value);
                if (xtermIsDecGraphic(eqv)) {
-                   *q++ = DECtoASCII(eqv);
+                   *q++ = (Char) DECtoASCII(eqv);
                } else {
                    eqv = AsciiEquivs(value);
                    if (eqv == value)
                        eqv = '#';
-                   *q++ = eqv;
+                   *q++ = (Char) eqv;
                    if (iswide((wchar_t) value))
                        *q++ = ' ';
                }
            }
        }
        *q = 0;
-       *result = q - buffer;
+       *result = (unsigned long) (q - buffer);
     } else {
        *result = 0;
     }
@@ -1437,18 +1445,20 @@ _qWriteSelectionData(TScreen * screen, Char * lag, 
unsigned length)
            switch (screen->base64_count) {
            case 0:
                buf[x++] = CharOf(base64_code[*p >> 2]);
-               screen->base64_accu = (*p & 0x3);
+               screen->base64_accu = (unsigned) (*p & 0x3);
                screen->base64_count = 2;
                ++p;
                break;
            case 2:
-               buf[x++] = CharOf(base64_code[(screen->base64_accu << 4) + (*p 
>> 4)]);
-               screen->base64_accu = (*p & 0xF);
+               buf[x++] = CharOf(base64_code[(screen->base64_accu << 4) +
+                                             (*p >> 4)]);
+               screen->base64_accu = (unsigned) (*p & 0xF);
                screen->base64_count = 4;
                ++p;
                break;
            case 4:
-               buf[x++] = CharOf(base64_code[(screen->base64_accu << 2) + (*p 
>> 6)]);
+               buf[x++] = CharOf(base64_code[(screen->base64_accu << 2) +
+                                             (*p >> 6)]);
                buf[x++] = CharOf(base64_code[*p & 0x3F]);
                screen->base64_accu = 0;
                screen->base64_count = 0;
@@ -1480,7 +1490,7 @@ _qWriteSelectionData(TScreen * screen, Char * lag, 
unsigned length)
 }
 
 static void
-_WriteSelectionData(TScreen * screen, Char * line, int length)
+_WriteSelectionData(TScreen * screen, Char * line, unsigned length)
 {
     /* Write data to pty a line at a time. */
     /* Doing this one line at a time may no longer be necessary
@@ -1634,7 +1644,7 @@ SelectionReceived(Widget w,
                        new_size += size + 1;
                    }
                    new_text_list =
-                       (char **) XtMalloc(sizeof(char *) * text_list_count);
+                       (char **) XtMalloc(sizeof(char *) * (unsigned) 
text_list_count);
                    new_text_list[0] = tmp = XtMalloc(new_size);
                    for (i = 0; i < text_list_count; ++i) {
                        data = (Char *) text_list[i];
@@ -1678,7 +1688,7 @@ SelectionReceived(Widget w,
        }
 #endif
        for (i = 0; i < text_list_count; i++) {
-           int len = strlen(text_list[i]);
+           unsigned len = strlen(text_list[i]);
            _WriteSelectionData(screen, (Char *) text_list[i], len);
        }
 #if OPT_PASTE64
@@ -2621,7 +2631,7 @@ do_select_regex(TScreen * screen, CELL * startc, CELL * 
endc)
                                                firstRow,
                                                size,
                                                indexed)) != 0) {
-                   int len = strlen(search);
+                   int len = (int) strlen(search);
                    int col;
                    int best_col = -1;
                    int best_len = -1;
@@ -3036,7 +3046,7 @@ SaltTextAway(XtermWidget xw,
     TRACE(("Salted TEXT:%d:%s\n", lp - line,
           visibleChars(PAIRED_CHARS(line, 0), (unsigned) (lp - line))));
 
-    screen->selection_length = (lp - line);
+    screen->selection_length = (unsigned long) (lp - line);
     _OwnSelection(xw, params, num_params);
 }
 
@@ -3052,7 +3062,7 @@ static void
 AppendStrToSelectionBuffer(TScreen * screen, Char * text, unsigned len)
 {
     if (len != 0) {
-       int j = screen->selection_length + len;         /* New length */
+       int j = (int) (screen->selection_length + len);         /* New length */
        int k = j + (j >> 2) + 80;      /* New size if we grow buffer: grow by 
~50% */
        if (j + 1 >= screen->selection_size) {
            if (!screen->selection_length) {
@@ -3081,7 +3091,7 @@ AppendStrToSelectionBuffer(TScreen * screen, Char * text, 
unsigned len)
 void
 AppendToSelectionBuffer(TScreen * screen, unsigned c)
 {
-    int six;
+    unsigned six;
     Char ch;
 
     /* Decode base64 character */
@@ -3168,6 +3178,29 @@ _ConvertSelectionHelper(Widget w,
 }
 
 static Boolean
+SaveConvertedLength(XtPointer *target, unsigned long source)
+{
+    Boolean result = False;
+
+    *target = XtMalloc(4);
+    if (*target != 0) {
+       result = True;
+       if (sizeof(unsigned long) == 4) {
+           *(unsigned long *) *target = source;
+       } else if (sizeof(unsigned) == 4) {
+           *(unsigned *) *target = 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);
+       }
+    }
+    return result;
+}
+
+static Boolean
 ConvertSelection(Widget w,
                 Atom * selection,
                 Atom * target,
@@ -3222,7 +3255,7 @@ ConvertSelection(Widget w,
            *targetP++ = XA_LENGTH(dpy);
            *targetP++ = XA_LIST_LENGTH(dpy);
 
-           *length = std_length + (targetP - allocP);
+           *length = std_length + (unsigned long) (targetP - allocP);
 
            memcpy(targetP, std_targets, sizeof(Atom) * std_length);
            XtFree((char *) std_targets);
@@ -3303,31 +3336,17 @@ ConvertSelection(Widget w,
 #endif
     else if (*target == XA_LIST_LENGTH(dpy)) {
        TRACE(("ConvertSelection XA_LIST_LENGTH(dpy)\n"));
-       *value = XtMalloc(4);
-       if (sizeof(long) == 4)
-            *(long *) *value = 1;
-       else {
-           long temp = 1;
-           memcpy((char *) *value, ((char *) &temp) + sizeof(long) - 4, 4);
-       }
+       result = SaveConvertedLength(value, 1);
        *type = XA_INTEGER;
        *length = 1;
        *format = 32;
-       result = True;
     } else if (*target == XA_LENGTH(dpy)) {
        TRACE(("ConvertSelection XA_LENGTH(dpy)\n"));
        /* This value is wrong if we have UTF-8 text */
-       *value = XtMalloc(4);
-       if (sizeof(long) == 4) {
-           *(long *) *value = screen->selection_length;
-       } else {
-           long temp = screen->selection_length;
-           memcpy((char *) *value, ((char *) &temp) + sizeof(long) - 4, 4);
-       }
+       result = SaveConvertedLength(value, screen->selection_length);
        *type = XA_INTEGER;
        *length = 1;
        *format = 32;
-       result = True;
     } else if (XmuConvertStandardSelection(w,
                                           screen->selection_time, selection,
                                           target, type, (XPointer *) value,
@@ -3337,7 +3356,7 @@ ConvertSelection(Widget w,
     }
 
     /* else */
-    return result;
+    return (Boolean) result;
 }
 
 static void
@@ -3396,7 +3415,7 @@ _OwnSelection(XtermWidget xw,
     Cardinal i;
     Bool have_selection = False;
 
-    if (screen->selection_length < 0)
+    if (screen->selection_length == 0)
        return;
 
     TRACE(("_OwnSelection\n"));
@@ -3412,10 +3431,11 @@ _OwnSelection(XtermWidget xw,
     for (i = 0; i < count; i++) {
        int cutbuffer = CutBuffer(atoms[i]);
        if (cutbuffer >= 0) {
-           if (screen->selection_length >
-               4 * XMaxRequestSize(XtDisplay((Widget) xw)) - 32) {
+           unsigned long limit =
+           (unsigned long) (4 * XMaxRequestSize(XtDisplay((Widget) xw)) - 32);
+           if (screen->selection_length > limit) {
                fprintf(stderr,
-                       "%s: selection too big (%d bytes), not storing in 
CUT_BUFFER%d\n",
+                       "%s: selection too big (%ld bytes), not storing in 
CUT_BUFFER%d\n",
                        xterm_name, screen->selection_length, cutbuffer);
            } else {
                /* This used to just use the UTF-8 data, which was totally
@@ -3536,7 +3556,7 @@ SaveText(TScreen * screen,
     unsigned c;
     Char *result = lp;
 #if OPT_WIDE_CHARS
-    int previous = 0;
+    unsigned previous = 0;
 #endif
 
     i = Length(screen, row, scol, ecol);
@@ -3554,7 +3574,7 @@ SaveText(TScreen * screen,
        /* We want to strip out every occurrence of HIDDEN_CHAR AFTER a
         * wide character.
         */
-       if (c == HIDDEN_CHAR && iswide(previous)) {
+       if (c == HIDDEN_CHAR && iswide((int) previous)) {
            previous = c;
            /* Combining characters attached to double-width characters
               are in memory attached to the HIDDEN_CHAR */
@@ -3624,7 +3644,7 @@ SaveText(TScreen * screen,
 static Char
 BtnCode(XButtonEvent * event, int button)
 {
-    int result = 32 + (KeyState(event->state) << 2);
+    int result = (int) (32 + (KeyState(event->state) << 2));
 
     if (button < 0 || button > 5) {
        result += 3;
@@ -3652,7 +3672,7 @@ EditorButton(XtermWidget xw, XButtonEvent * event)
     Boolean changed = True;
 
     /* If button event, get button # adjusted for DEC compatibility */
-    button = event->button - 1;
+    button = (int) (event->button - 1);
     if (button >= 3)
        button++;
 
diff --git a/cachedGCs.c b/cachedGCs.c
index a72ef3f..70dac4a 100644
--- a/cachedGCs.c
+++ b/cachedGCs.c
@@ -1,4 +1,4 @@
-/* $XTermId: cachedGCs.c,v 1.48 2008/02/20 20:54:54 Julien.Cristau Exp $ */
+/* $XTermId: cachedGCs.c,v 1.49 2008/12/30 17:33:30 tom Exp $ */
 
 /************************************************************
 
@@ -396,16 +396,16 @@ newCache(XtermWidget xw, VTwin * cgsWin, CgsEnum cgsId, 
CgsCache * me)
 static Boolean
 HaveFont(XTermFonts * a)
 {
-    return (a != 0 && a->fs != 0);
+    return (Boolean) (a != 0 && a->fs != 0);
 }
 
 static Boolean
 SameFont(XTermFonts * a, XTermFonts * b)
 {
-    return (HaveFont(a)
-           && HaveFont(b)
-           && ((a->fs == b->fs)
-               || !memcmp(a->fs, b->fs, sizeof(*(a->fs)))));
+    return (Boolean) (HaveFont(a)
+                     && HaveFont(b)
+                     && ((a->fs == b->fs)
+                         || !memcmp(a->fs, b->fs, sizeof(*(a->fs)))));
 }
 
 #define SameColor(a,b) ((a) == (b))
diff --git a/charclass.c b/charclass.c
index ea2d2ed..8452842 100644
--- a/charclass.c
+++ b/charclass.c
@@ -1,4 +1,4 @@
-/* $XTermId: charclass.c,v 1.20 2008/01/31 01:07:23 tom Exp $ */
+/* $XTermId: charclass.c,v 1.21 2008/12/30 17:35:09 tom Exp $ */
 
 /*
  * Compact and efficient reimplementation of the
@@ -51,7 +51,7 @@ SetCharacterClassRange(int low, int high, int value)
     /* make sure we have at least one free entry left at table end */
     if (classtab[0].last > classtab[0].cclass - 2) {
        classtab[0].cclass += 5 + classtab[0].cclass / 4;
-       classtab = TypeRealloc(struct classentry, classtab[0].cclass, classtab);
+       classtab = TypeRealloc(struct classentry, (unsigned) 
classtab[0].cclass, classtab);
        if (!classtab)
            abort();
     }
diff --git a/charproc.c b/charproc.c
index be9408a..ee592f4 100644
--- a/charproc.c
+++ b/charproc.c
@@ -1,4 +1,4 @@
-/* $XTermId: charproc.c,v 1.852 2008/09/14 21:27:54 tom Exp $ */
+/* $XTermId: charproc.c,v 1.865 2008/12/30 14:45:41 tom Exp $ */
 
 /*
 
@@ -389,6 +389,8 @@ static XtActionsRec actionsList[] = {
 static XtResource resources[] =
 {
     Bres(XtNallowSendEvents, XtCAllowSendEvents, screen.allowSendEvent0, 
False),
+    Bres(XtNallowFontOps, XtCAllowFontOps, screen.allowFontOp0, True),
+    Bres(XtNallowTcapOps, XtCAllowTcapOps, screen.allowTcapOp0, True),
     Bres(XtNallowTitleOps, XtCAllowTitleOps, screen.allowTitleOp0, True),
     Bres(XtNallowWindowOps, XtCAllowWindowOps, screen.allowWindowOp0, True),
     Bres(XtNaltIsNotMeta, XtCAltIsNotMeta, screen.alt_is_not_meta, False),
@@ -1236,8 +1238,8 @@ doparsing(XtermWidget xw, unsigned c, struct ParseState 
*sp)
 
            WriteNow();
 
-           prev = XTERM_CELL(screen->last_written_row,
-                             screen->last_written_col);
+           prev = (int) XTERM_CELL(screen->last_written_row,
+                                   screen->last_written_col);
            precomposed = do_precomposition(prev, (int) c);
            TRACE(("do_precomposition (U+%04X [%d], U+%04X [%d]) -> U+%04X 
[%d]\n",
                   prev, my_wcwidth(prev),
@@ -1267,7 +1269,7 @@ doparsing(XtermWidget xw, unsigned c, struct ParseState 
*sp)
 
        /* Intercept characters for printer controller mode */
        if (screen->printer_controlmode == 2) {
-           if ((c = xtermPrinterControl((int) c)) == 0)
+           if ((c = (unsigned) xtermPrinterControl((int) c)) == 0)
                continue;
        }
 
@@ -1279,7 +1281,7 @@ doparsing(XtermWidget xw, unsigned c, struct ParseState 
*sp)
 #if OPT_VT52_MODE
        if (sp->vt52_cup) {
            if (nparam < NPARAM)
-               param[nparam++] = (c & 0x7f) - 32;
+               param[nparam++] = (int) (c & 0x7f) - 32;
            if (nparam < 2)
                continue;
            sp->vt52_cup = False;
@@ -1447,7 +1449,8 @@ doparsing(XtermWidget xw, unsigned c, struct ParseState 
*sp)
 #endif
            print_area = new_string;
            print_size = new_length;
-           print_area[print_used++] = sp->lastchar = thischar = c;
+           print_area[print_used++] = c;
+           sp->lastchar = thischar = (int) c;
 #if OPT_WIDE_CHARS
            sp->last_was_wide = iswide((int) c);
 #endif
@@ -1486,7 +1489,7 @@ doparsing(XtermWidget xw, unsigned c, struct ParseState 
*sp)
 #endif
            string_area = new_string;
            string_size = new_length;
-           string_area[string_used++] = c;
+           string_area[string_used++] = CharOf(c);
        } else if (sp->parsestate != esc_table) {
            /* if we were accumulating, we're not any more */
            sp->string_mode = 0;
@@ -1673,7 +1676,7 @@ doparsing(XtermWidget xw, unsigned c, struct ParseState 
*sp)
            /* digit in csi or dec mode */
            if ((row = param[nparam - 1]) == DEFAULT)
                row = 0;
-           param[nparam - 1] = 10 * row + (c - '0');
+           param[nparam - 1] = (10 * row) + ((int) c - '0');
            if (param[nparam - 1] > 65535)
                param[nparam - 1] = 65535;
            if (sp->parsestate == csi_table)
@@ -1896,7 +1899,9 @@ doparsing(XtermWidget xw, unsigned c, struct ParseState 
*sp)
                        break;
                    }
                } else {
-                   reply.a_param[count++] = 60 + screen->terminal_id / 100;
+                   reply.a_param[count++] = (ParmType) (60
+                                                        + screen->terminal_id
+                                                        / 100);
                    reply.a_param[count++] = 1;         /* 132-columns */
                    reply.a_param[count++] = 2;         /* printer */
                    reply.a_param[count++] = 6;         /* selective-erase */
@@ -1913,7 +1918,7 @@ doparsing(XtermWidget xw, unsigned c, struct ParseState 
*sp)
                    reply.a_param[count++] = 29;        /* ANSI text locator */
 #endif
                }
-               reply.a_nparam = count;
+               reply.a_nparam = (ParmType) count;
                reply.a_inters = 0;
                reply.a_final = 'c';
                unparseseq(xw, &reply);
@@ -1934,7 +1939,7 @@ doparsing(XtermWidget xw, unsigned c, struct ParseState 
*sp)
                    reply.a_param[count++] = 0;         /* VT100 (nonstandard) 
*/
                reply.a_param[count++] = XTERM_PATCH;   /* Version */
                reply.a_param[count++] = 0;     /* options (none) */
-               reply.a_nparam = count;
+               reply.a_nparam = (ParmType) count;
                reply.a_inters = 0;
                reply.a_final = 'c';
                unparseseq(xw, &reply);
@@ -2177,7 +2182,7 @@ doparsing(XtermWidget xw, unsigned c, struct ParseState 
*sp)
            TRACE(("CASE_CPR - cursor position\n"));
            count = 0;
            reply.a_type = ANSI_CSI;
-           reply.a_pintro = sp->private_function ? '?' : 0;
+           reply.a_pintro = CharOf(sp->private_function ? '?' : 0);
            reply.a_inters = 0;
            reply.a_final = 'n';
 
@@ -2189,38 +2194,48 @@ doparsing(XtermWidget xw, unsigned c, struct ParseState 
*sp)
            case 6:
                /* CPR */
                /* DECXCPR (with page=0) */
-               reply.a_param[count++] = screen->cur_row + 1;
-               reply.a_param[count++] = screen->cur_col + 1;
+               reply.a_param[count++] = (ParmType) (screen->cur_row + 1);
+               reply.a_param[count++] = (ParmType) (screen->cur_col + 1);
                reply.a_final = 'R';
                break;
            case 15:
                /* printer status */
-               reply.a_param[count++] = 13;    /* implement printer */
+               if (screen->terminal_id >= 200) {       /* VT220 */
+                   reply.a_param[count++] = 13;        /* implement printer */
+               }
                break;
            case 25:
                /* UDK status */
-               reply.a_param[count++] = 20;    /* UDK always unlocked */
+               if (screen->terminal_id >= 200) {       /* VT220 */
+                   reply.a_param[count++] = 20;        /* UDK always unlocked 
*/
+               }
                break;
            case 26:
                /* keyboard status */
-               reply.a_param[count++] = 27;
-               reply.a_param[count++] = 1;     /* North American */
-               if (screen->terminal_id >= 400) {
-                   reply.a_param[count++] = 0;         /* ready */
-                   reply.a_param[count++] = 0;         /* LK201 */
+               if (screen->terminal_id >= 200) {       /* VT220 */
+                   reply.a_param[count++] = 27;
+                   reply.a_param[count++] = 1;         /* North American */
+                   if (screen->terminal_id >= 400) {
+                       reply.a_param[count++] = 0;     /* ready */
+                       reply.a_param[count++] = 0;     /* LK201 */
+                   }
                }
                break;
            case 53:
                /* Locator status */
+               if (screen->terminal_id >= 200) {       /* VT220 */
 #if OPT_DEC_LOCATOR
-               reply.a_param[count++] = 50;    /* locator ready */
+                   reply.a_param[count++] = 50;        /* locator ready */
 #else
-               reply.a_param[count++] = 53;    /* no locator */
+                   reply.a_param[count++] = 53;        /* no locator */
 #endif
+               }
+               break;
+           default:
                break;
            }
 
-           if ((reply.a_nparam = count) != 0)
+           if ((reply.a_nparam = (ParmType) count) != 0)
                unparseseq(xw, &reply);
 
            sp->parsestate = sp->groundtable;
@@ -2279,7 +2294,7 @@ doparsing(XtermWidget xw, unsigned c, struct ParseState 
*sp)
                    reply.a_type = ANSI_CSI;
                    reply.a_pintro = 0;
                    reply.a_nparam = 7;
-                   reply.a_param[0] = row + 2;
+                   reply.a_param[0] = (ParmType) (row + 2);
                    reply.a_param[1] = 1;       /* no parity */
                    reply.a_param[2] = 1;       /* eight bits */
                    reply.a_param[3] = 128;     /* transmit 38.4k baud */
@@ -2328,7 +2343,7 @@ doparsing(XtermWidget xw, unsigned c, struct ParseState 
*sp)
        case CASE_GSETS:
            TRACE(("CASE_GSETS(%d) = '%c'\n", sp->scstype, c));
            if (screen->vtXX_level != 0)
-               screen->gsets[sp->scstype] = c;
+               screen->gsets[sp->scstype] = CharOf(c);
            sp->parsestate = sp->groundtable;
            break;
 
@@ -2785,7 +2800,7 @@ doparsing(XtermWidget xw, unsigned c, struct ParseState 
*sp)
                sp->groundtable[E2A(sp->lastchar)] == CASE_PRINT) {
                IChar repeated[2];
                count = (param[0] < 1) ? 1 : param[0];
-               repeated[0] = sp->lastchar;
+               repeated[0] = (IChar) sp->lastchar;
                while (count-- > 0) {
                    dotext(xw,
                           screen->gsets[(int) (screen->curgl)],
@@ -2907,8 +2922,8 @@ doparsing(XtermWidget xw, unsigned c, struct ParseState 
*sp)
     } while (0);
 
 #if OPT_WIDE_CHARS
-    screen->utf8_inparse = (screen->utf8_mode != uFalse
-                           && sp->parsestate != sos_table);


-- 
To UNSUBSCRIBE, email to [email protected]
with a subject of "unsubscribe". Trouble? Contact [email protected]

Reply via email to