]> ncurses.scripts.mit.edu Git - ncurses.git/blobdiff - ncurses/tty/tty_update.c
ncurses 5.9 - patch 20121026
[ncurses.git] / ncurses / tty / tty_update.c
index dd6c3b670597c3cafd95860d7b32fd30de05636d..368beaf4d123f95cee3fbb83aa8555b3dcfe8356 100644 (file)
@@ -1,5 +1,5 @@
 /****************************************************************************
- * Copyright (c) 1998-2009,2010 Free Software Foundation, Inc.              *
+ * Copyright (c) 1998-2011,2012 Free Software Foundation, Inc.              *
  *                                                                          *
  * Permission is hereby granted, free of charge, to any person obtaining a  *
  * copy of this software and associated documentation files (the            *
@@ -82,7 +82,7 @@
 
 #include <ctype.h>
 
-MODULE_ID("$Id: tty_update.c,v 1.263 2010/05/01 20:44:34 tom Exp $")
+MODULE_ID("$Id: tty_update.c,v 1.271 2012/08/25 21:04:03 tom Exp $")
 
 /*
  * This define controls the line-breakout optimization.  Every once in a
@@ -209,7 +209,9 @@ PutAttrChar(NCURSES_SP_DCLx CARG_CH_T ch)
 {
     int chlen = 1;
     NCURSES_CH_T my_ch;
+#if USE_WIDEC_SUPPORT
     PUTC_DATA;
+#endif
     NCURSES_CH_T tilde;
     NCURSES_CH_T attr = CHDEREF(ch);
 
@@ -288,13 +290,12 @@ PutAttrChar(NCURSES_SP_DCLx CARG_CH_T ch)
            int j = CharOfD(ch);
            chtype temp = UChar(SP_PARM->_acs_map[j]);
 
-           if (!(SP_PARM->_screen_acs_map[j])) {
+           if (temp != 0) {
+               SetChar(my_ch, temp, AttrOf(attr));
+           } else {
+               my_ch = CHDEREF(ch);
                RemAttr(attr, A_ALTCHARSET);
-               if (temp == 0)
-                   temp = ' ';
            }
-           if (temp != 0)
-               SetChar(my_ch, temp, AttrOf(attr));
        }
        ch = CHREF(my_ch);
     }
@@ -304,18 +305,10 @@ PutAttrChar(NCURSES_SP_DCLx CARG_CH_T ch)
     }
 
     UpdateAttrs(SP_PARM, attr);
+    PUTC(CHDEREF(ch));
 #if !USE_WIDEC_SUPPORT
-    /* FIXME - we do this special case for signal handling, should see how to
-     * make it work for wide characters.
-     */
-    if (SP_PARM->_outch != 0) {
-       SP_PARM->_outch(NCURSES_SP_ARGx UChar(ch));
-    } else
+    COUNT_OUTCHARS(1);
 #endif
-    {
-       PUTC(CHDEREF(ch), SP_PARM->_ofp);       /* macro's fastest... */
-       COUNT_OUTCHARS(1);
-    }
     SP_PARM->_curscol += chlen;
     if (char_padding) {
        TPUTS_TRACE("char_padding");
@@ -342,7 +335,7 @@ check_pending(NCURSES_SP_DCL0)
        struct pollfd fds[1];
        fds[0].fd = SP_PARM->_checkfd;
        fds[0].events = POLLIN;
-       if (poll(fds, 1, 0) > 0) {
+       if (poll(fds, (size_t) 1, 0) > 0) {
            have_pending = TRUE;
        }
 #elif defined(__BEOS__)
@@ -497,7 +490,9 @@ can_clear_with(NCURSES_SP_DCLx ARG_CH_T ch)
            return FALSE;
        if ((pair = GetPair(CHDEREF(ch))) != 0) {
            short fg, bg;
-           NCURSES_SP_NAME(pair_content) (NCURSES_SP_ARGx pair, &fg, &bg);
+           NCURSES_SP_NAME(pair_content) (NCURSES_SP_ARGx
+                                          (short) pair,
+                                          &fg, &bg);
            if (fg != C_MASK || bg != C_MASK)
                return FALSE;
        }
@@ -675,6 +670,9 @@ TINFO_DOUPDATE(NCURSES_SP_DCL0)
 
     T((T_CALLED("_nc_tinfo:doupdate(%p)"), (void *) SP_PARM));
 
+    if (SP_PARM == 0)
+       returnCode(ERR);
+
 #if !USE_REENTRANT
     /*
      * It is "legal" but unlikely that an application could assign a new
@@ -1074,7 +1072,7 @@ ClrUpdate(NCURSES_SP_DCL0)
 */
 
 static void
-ClrToEOL(NCURSES_SP_DCLx NCURSES_CH_T blank, bool needclear)
+ClrToEOL(NCURSES_SP_DCLx NCURSES_CH_T blank, int needclear)
 {
     int j;
 
@@ -1413,7 +1411,7 @@ TransformLine(NCURSES_SP_DCLx int const lineno)
                         nLastChar);
                memcpy(oldLine + firstChar,
                       newLine + firstChar,
-                      (nLastChar - firstChar + 1) * sizeof(NCURSES_CH_T));
+                      (unsigned) (nLastChar - firstChar + 1) * sizeof(NCURSES_CH_T));
            }
            TR(TRACE_UPDATE, (T_RETURN("")));
            return;
@@ -1535,7 +1533,7 @@ TransformLine(NCURSES_SP_DCLx int const lineno)
     if (screen_columns(SP_PARM) > firstChar)
        memcpy(oldLine + firstChar,
               newLine + firstChar,
-              (screen_columns(SP_PARM) - firstChar) * sizeof(NCURSES_CH_T));
+              (unsigned) (screen_columns(SP_PARM) - firstChar) * sizeof(NCURSES_CH_T));
     TR(TRACE_UPDATE, (T_RETURN("")));
     return;
 }
@@ -1559,7 +1557,7 @@ ClearScreen(NCURSES_SP_DCLx NCURSES_CH_T blank)
     if (SP_PARM->_coloron
        && !SP_PARM->_default_color) {
        NCURSES_SP_NAME(_nc_do_color) (NCURSES_SP_ARGx
-                                      GET_SCREEN_PAIR(SP_PARM),
+                                      (short) GET_SCREEN_PAIR(SP_PARM),
                                       0,
                                       FALSE,
                                       NCURSES_SP_NAME(_nc_outch));
@@ -2064,7 +2062,10 @@ NCURSES_SP_NAME(_nc_scrolln) (NCURSES_SP_DCLx
     if (res == ERR)
        return (ERR);
 
-    _nc_scroll_window(CurScreen(SP_PARM), n, top, bot, blank);
+    _nc_scroll_window(CurScreen(SP_PARM), n,
+                     (NCURSES_SIZE_T) top,
+                     (NCURSES_SIZE_T) bot,
+                     blank);
 
     /* shift hash values too - they can be reused */
     NCURSES_SP_NAME(_nc_scroll_oldhash) (NCURSES_SP_ARGx n, top, bot);
@@ -2099,7 +2100,8 @@ NCURSES_SP_NAME(_nc_screen_resume) (NCURSES_SP_DCL0)
        SP_PARM->_color_defs = -(SP_PARM->_color_defs);
        for (n = 0; n < SP_PARM->_color_defs; ++n) {
            if (SP_PARM->_color_table[n].init) {
-               NCURSES_SP_NAME(init_color) (NCURSES_SP_ARGx n,
+               NCURSES_SP_NAME(init_color) (NCURSES_SP_ARGx
+                                            (short) n,
                                             SP_PARM->_color_table[n].r,
                                             SP_PARM->_color_table[n].g,
                                             SP_PARM->_color_table[n].b);