Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/lib/libedit - Add some more Char casts



details:   https://anonhg.NetBSD.org/src/rev/a1954b8b59f0
branches:  trunk
changeset: 813668:a1954b8b59f0
user:      christos <christos%NetBSD.org@localhost>
date:      Thu Feb 11 19:21:04 2016 +0000

description:
- Add some more Char casts
- reduce ifdefs by providing empty defs for nls functions (Ingo Schwarze)

diffstat:

 lib/libedit/chartype.c |   6 +++---
 lib/libedit/common.c   |  10 +++++-----
 lib/libedit/el.c       |  11 ++++++-----
 lib/libedit/emacs.c    |   6 +++---
 lib/libedit/keymacro.c |   6 +++---
 lib/libedit/map.c      |   8 ++++----
 lib/libedit/parse.c    |   6 +++---
 lib/libedit/read.c     |   8 ++++----
 lib/libedit/refresh.c  |   8 ++++----
 lib/libedit/search.c   |   6 +++---
 lib/libedit/sys.h      |   7 ++++++-
 lib/libedit/terminal.c |   8 ++++----
 lib/libedit/tty.c      |   8 ++++----
 13 files changed, 52 insertions(+), 46 deletions(-)

diffs (truncated from 419 to 300 lines):

diff -r 27b5276fff3e -r a1954b8b59f0 lib/libedit/chartype.c
--- a/lib/libedit/chartype.c    Thu Feb 11 19:10:18 2016 +0000
+++ b/lib/libedit/chartype.c    Thu Feb 11 19:21:04 2016 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: chartype.c,v 1.12 2015/02/22 02:16:19 christos Exp $   */
+/*     $NetBSD: chartype.c,v 1.13 2016/02/11 19:21:04 christos Exp $   */
 
 /*-
  * Copyright (c) 2009 The NetBSD Foundation, Inc.
@@ -38,7 +38,7 @@
  */
 #include "config.h"
 #if !defined(lint) && !defined(SCCSID)
-__RCSID("$NetBSD: chartype.c,v 1.12 2015/02/22 02:16:19 christos Exp $");
+__RCSID("$NetBSD: chartype.c,v 1.13 2016/02/11 19:21:04 christos Exp $");
 #endif /* not lint && not SCCSID */
 #include "el.h"
 #include <stdlib.h>
@@ -333,7 +333,7 @@
                return c > 0xffff ? 8 : 7;
 #else
                *dst++ = '\\';
-#define tooctaldigit(v) ((v) + '0')
+#define tooctaldigit(v) (Char)((v) + '0')
                *dst++ = tooctaldigit(((unsigned int) c >> 6) & 0x7);
                *dst++ = tooctaldigit(((unsigned int) c >> 3) & 0x7);
                *dst++ = tooctaldigit(((unsigned int) c     ) & 0x7);
diff -r 27b5276fff3e -r a1954b8b59f0 lib/libedit/common.c
--- a/lib/libedit/common.c      Thu Feb 11 19:10:18 2016 +0000
+++ b/lib/libedit/common.c      Thu Feb 11 19:21:04 2016 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: common.c,v 1.29 2012/03/24 20:08:43 christos Exp $     */
+/*     $NetBSD: common.c,v 1.30 2016/02/11 19:21:04 christos Exp $     */
 
 /*-
  * Copyright (c) 1992, 1993
@@ -37,7 +37,7 @@
 #if 0
 static char sccsid[] = "@(#)common.c   8.1 (Berkeley) 6/4/93";
 #else
-__RCSID("$NetBSD: common.c,v 1.29 2012/03/24 20:08:43 christos Exp $");
+__RCSID("$NetBSD: common.c,v 1.30 2016/02/11 19:21:04 christos Exp $");
 #endif
 #endif /* not lint && not SCCSID */
 
@@ -85,14 +85,14 @@
                    || el->el_line.cursor >= el->el_line.lastchar)
                        c_insert(el, 1);
 
-               *el->el_line.cursor++ = c;
+               *el->el_line.cursor++ = (Char)c;
                re_fastaddc(el);                /* fast refresh for one char. */
        } else {
                if (el->el_state.inputmode != MODE_REPLACE_1)
                        c_insert(el, el->el_state.argument);
 
                while (count-- && el->el_line.cursor < el->el_line.lastchar)
-                       *el->el_line.cursor++ = c;
+                       *el->el_line.cursor++ = (Char)c;
                re_refresh(el);
        }
 
@@ -264,7 +264,7 @@
                /* must have at least two chars entered */
                c = el->el_line.cursor[-2];
                el->el_line.cursor[-2] = el->el_line.cursor[-1];
-               el->el_line.cursor[-1] = c;
+               el->el_line.cursor[-1] = (Char)c;
                return CC_REFRESH;
        } else
                return CC_ERROR;
diff -r 27b5276fff3e -r a1954b8b59f0 lib/libedit/el.c
--- a/lib/libedit/el.c  Thu Feb 11 19:10:18 2016 +0000
+++ b/lib/libedit/el.c  Thu Feb 11 19:21:04 2016 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: el.c,v 1.74 2015/12/08 12:56:55 christos Exp $ */
+/*     $NetBSD: el.c,v 1.75 2016/02/11 19:21:04 christos Exp $ */
 
 /*-
  * Copyright (c) 1992, 1993
@@ -37,7 +37,7 @@
 #if 0
 static char sccsid[] = "@(#)el.c       8.2 (Berkeley) 1/3/94";
 #else
-__RCSID("$NetBSD: el.c,v 1.74 2015/12/08 12:56:55 christos Exp $");
+__RCSID("$NetBSD: el.c,v 1.75 2016/02/11 19:21:04 christos Exp $");
 #endif
 #endif /* not lint && not SCCSID */
 
@@ -50,8 +50,11 @@
 #include <stdlib.h>
 #include <stdarg.h>
 #include <ctype.h>
+#ifdef WIDECHAR
 #include <locale.h>
 #include <langinfo.h>
+#endif
+
 #include "el.h"
 
 /* el_init():
@@ -93,12 +96,10 @@
          * Initialize all the modules. Order is important!!!
          */
        el->el_flags = 0;
-#ifdef WIDECHAR
        if (setlocale(LC_CTYPE, NULL) != NULL){
                if (strcmp(nl_langinfo(CODESET), "UTF-8") == 0)
                        el->el_flags |= CHARSET_IS_UTF8;
        }
-#endif
 
        if (terminal_init(el) == -1) {
                el_free(el->el_prog);
@@ -207,7 +208,7 @@
                el_pfunc_t p = va_arg(ap, el_pfunc_t);
                int c = va_arg(ap, int);
 
-               rv = prompt_set(el, p, c, op, 1);
+               rv = prompt_set(el, p, (Char)c, op, 1);
                break;
        }
 
diff -r 27b5276fff3e -r a1954b8b59f0 lib/libedit/emacs.c
--- a/lib/libedit/emacs.c       Thu Feb 11 19:10:18 2016 +0000
+++ b/lib/libedit/emacs.c       Thu Feb 11 19:21:04 2016 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: emacs.c,v 1.25 2011/07/29 15:16:33 christos Exp $      */
+/*     $NetBSD: emacs.c,v 1.26 2016/02/11 19:21:04 christos Exp $      */
 
 /*-
  * Copyright (c) 1992, 1993
@@ -37,7 +37,7 @@
 #if 0
 static char sccsid[] = "@(#)emacs.c    8.1 (Berkeley) 6/4/93";
 #else
-__RCSID("$NetBSD: emacs.c,v 1.25 2011/07/29 15:16:33 christos Exp $");
+__RCSID("$NetBSD: emacs.c,v 1.26 2016/02/11 19:21:04 christos Exp $");
 #endif
 #endif /* not lint && not SCCSID */
 
@@ -244,7 +244,7 @@
                /* must have at least two chars entered */
                c = el->el_line.cursor[-2];
                el->el_line.cursor[-2] = el->el_line.cursor[-1];
-               el->el_line.cursor[-1] = c;
+               el->el_line.cursor[-1] = (Char)c;
                return CC_REFRESH;
        } else
                return CC_ERROR;
diff -r 27b5276fff3e -r a1954b8b59f0 lib/libedit/keymacro.c
--- a/lib/libedit/keymacro.c    Thu Feb 11 19:10:18 2016 +0000
+++ b/lib/libedit/keymacro.c    Thu Feb 11 19:21:04 2016 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: keymacro.c,v 1.7 2011/08/16 16:25:15 christos Exp $    */
+/*     $NetBSD: keymacro.c,v 1.8 2016/02/11 19:21:04 christos Exp $    */
 
 /*-
  * Copyright (c) 1992, 1993
@@ -37,7 +37,7 @@
 #if 0
 static char sccsid[] = "@(#)key.c      8.1 (Berkeley) 6/4/93";
 #else
-__RCSID("$NetBSD: keymacro.c,v 1.7 2011/08/16 16:25:15 christos Exp $");
+__RCSID("$NetBSD: keymacro.c,v 1.8 2016/02/11 19:21:04 christos Exp $");
 #endif
 #endif /* not lint && not SCCSID */
 
@@ -465,7 +465,7 @@
        ptr = el_malloc(sizeof(*ptr));
        if (ptr == NULL)
                return NULL;
-       ptr->ch = ch;
+       ptr->ch = (Char)ch;
        ptr->type = XK_NOD;
        ptr->val.str = NULL;
        ptr->next = NULL;
diff -r 27b5276fff3e -r a1954b8b59f0 lib/libedit/map.c
--- a/lib/libedit/map.c Thu Feb 11 19:10:18 2016 +0000
+++ b/lib/libedit/map.c Thu Feb 11 19:21:04 2016 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: map.c,v 1.35 2015/05/14 10:44:15 christos Exp $        */
+/*     $NetBSD: map.c,v 1.36 2016/02/11 19:21:04 christos Exp $        */
 
 /*-
  * Copyright (c) 1992, 1993
@@ -37,7 +37,7 @@
 #if 0
 static char sccsid[] = "@(#)map.c      8.1 (Berkeley) 6/4/93";
 #else
-__RCSID("$NetBSD: map.c,v 1.35 2015/05/14 10:44:15 christos Exp $");
+__RCSID("$NetBSD: map.c,v 1.36 2016/02/11 19:21:04 christos Exp $");
 #endif
 #endif /* not lint && not SCCSID */
 
@@ -1148,9 +1148,9 @@
        Char firstbuf[2], lastbuf[2];
        char unparsbuf[EL_BUFSIZ], extrabuf[EL_BUFSIZ];
 
-       firstbuf[0] = first;
+       firstbuf[0] = (Char)first;
        firstbuf[1] = 0;
-       lastbuf[0] = last;
+       lastbuf[0] = (Char)last;
        lastbuf[1] = 0;
        if (map[first] == ED_UNASSIGNED) {
                if (first == last) {
diff -r 27b5276fff3e -r a1954b8b59f0 lib/libedit/parse.c
--- a/lib/libedit/parse.c       Thu Feb 11 19:10:18 2016 +0000
+++ b/lib/libedit/parse.c       Thu Feb 11 19:21:04 2016 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: parse.c,v 1.27 2014/07/06 18:15:34 christos Exp $      */
+/*     $NetBSD: parse.c,v 1.28 2016/02/11 19:21:04 christos Exp $      */
 
 /*-
  * Copyright (c) 1992, 1993
@@ -37,7 +37,7 @@
 #if 0
 static char sccsid[] = "@(#)parse.c    8.1 (Berkeley) 6/4/93";
 #else
-__RCSID("$NetBSD: parse.c,v 1.27 2014/07/06 18:15:34 christos Exp $");
+__RCSID("$NetBSD: parse.c,v 1.28 2016/02/11 19:21:04 christos Exp $");
 #endif
 #endif /* not lint && not SCCSID */
 
@@ -251,7 +251,7 @@
                case '^':
                        if ((n = parse__escape(&in)) == -1)
                                return NULL;
-                       *out++ = n;
+                       *out++ = (Char)n;
                        break;
 
                case 'M':
diff -r 27b5276fff3e -r a1954b8b59f0 lib/libedit/read.c
--- a/lib/libedit/read.c        Thu Feb 11 19:10:18 2016 +0000
+++ b/lib/libedit/read.c        Thu Feb 11 19:21:04 2016 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: read.c,v 1.73 2016/02/11 16:08:47 christos Exp $       */
+/*     $NetBSD: read.c,v 1.74 2016/02/11 19:21:04 christos Exp $       */
 
 /*-
  * Copyright (c) 1992, 1993
@@ -37,7 +37,7 @@
 #if 0
 static char sccsid[] = "@(#)read.c     8.1 (Berkeley) 6/4/93";
 #else
-__RCSID("$NetBSD: read.c,v 1.73 2016/02/11 16:08:47 christos Exp $");
+__RCSID("$NetBSD: read.c,v 1.74 2016/02/11 19:21:04 christos Exp $");
 #endif
 #endif /* not lint && not SCCSID */
 
@@ -259,7 +259,7 @@
 
                if (el->el_state.metanext) {
                        el->el_state.metanext = 0;
-                       *ch |= 0200;
+                       *ch |= (unsigned char)0200;
                }
 #ifdef WIDECHAR
                if (*ch >= N_KEYS)
@@ -379,7 +379,7 @@
                /* Try non-ASCII characters in a 8-bit character set */
                (bytes = ct_mbtowc(cp, cbuf, cbp)) != 1)
 #endif
-               *cp = (unsigned char)cbuf[0];
+               *cp = (Char)(unsigned char)cbuf[0];
 
        if ((el->el_flags & IGNORE_EXTCHARS) && bytes > 1) {
                cbp = 0; /* skip this character */
diff -r 27b5276fff3e -r a1954b8b59f0 lib/libedit/refresh.c
--- a/lib/libedit/refresh.c     Thu Feb 11 19:10:18 2016 +0000
+++ b/lib/libedit/refresh.c     Thu Feb 11 19:21:04 2016 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: refresh.c,v 1.37 2011/07/29 23:44:45 christos Exp $    */
+/*     $NetBSD: refresh.c,v 1.38 2016/02/11 19:21:04 christos Exp $    */
 
 /*-
  * Copyright (c) 1992, 1993
@@ -37,7 +37,7 @@
 #if 0
 static char sccsid[] = "@(#)refresh.c  8.1 (Berkeley) 6/4/93";
 #else
-__RCSID("$NetBSD: refresh.c,v 1.37 2011/07/29 23:44:45 christos Exp $");
+__RCSID("$NetBSD: refresh.c,v 1.38 2016/02/11 19:21:04 christos Exp $");
 #endif
 #endif /* not lint && not SCCSID */
 
@@ -170,7 +170,7 @@
            re_putc(el, ' ', 1);
 
        el->el_vdisplay[el->el_refresh.r_cursor.v]
-           [el->el_refresh.r_cursor.h] = c;
+           [el->el_refresh.r_cursor.h] = (Char)c;
        /* assumes !shift is only used for single-column chars */
        i = w;
        while (--i > 0)
@@ -1059,7 +1059,7 @@
            re_fastputc(el, ' ');
 



Home | Main Index | Thread Index | Old Index