Module Name: src Committed By: christos Date: Thu Feb 11 19:21:04 UTC 2016
Modified Files: src/lib/libedit: chartype.c common.c el.c emacs.c keymacro.c map.c parse.c read.c refresh.c search.c sys.h terminal.c tty.c Log Message: - Add some more Char casts - reduce ifdefs by providing empty defs for nls functions (Ingo Schwarze) To generate a diff of this commit: cvs rdiff -u -r1.12 -r1.13 src/lib/libedit/chartype.c cvs rdiff -u -r1.29 -r1.30 src/lib/libedit/common.c cvs rdiff -u -r1.74 -r1.75 src/lib/libedit/el.c cvs rdiff -u -r1.25 -r1.26 src/lib/libedit/emacs.c cvs rdiff -u -r1.7 -r1.8 src/lib/libedit/keymacro.c cvs rdiff -u -r1.35 -r1.36 src/lib/libedit/map.c cvs rdiff -u -r1.27 -r1.28 src/lib/libedit/parse.c cvs rdiff -u -r1.73 -r1.74 src/lib/libedit/read.c cvs rdiff -u -r1.37 -r1.38 src/lib/libedit/refresh.c cvs rdiff -u -r1.31 -r1.32 src/lib/libedit/search.c cvs rdiff -u -r1.17 -r1.18 src/lib/libedit/sys.h cvs rdiff -u -r1.14 -r1.15 src/lib/libedit/terminal.c cvs rdiff -u -r1.49 -r1.50 src/lib/libedit/tty.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/lib/libedit/chartype.c diff -u src/lib/libedit/chartype.c:1.12 src/lib/libedit/chartype.c:1.13 --- src/lib/libedit/chartype.c:1.12 Sat Feb 21 21:16:19 2015 +++ src/lib/libedit/chartype.c Thu Feb 11 14:21:04 2016 @@ -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 @@ ct_visual_char(Char *dst, size_t len, Ch 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); Index: src/lib/libedit/common.c diff -u src/lib/libedit/common.c:1.29 src/lib/libedit/common.c:1.30 --- src/lib/libedit/common.c:1.29 Sat Mar 24 16:08:43 2012 +++ src/lib/libedit/common.c Thu Feb 11 14:21:04 2016 @@ -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 @@ ed_insert(EditLine *el, Int c) || 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 @@ ed_transpose_chars(EditLine *el, Int c) /* 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; Index: src/lib/libedit/el.c diff -u src/lib/libedit/el.c:1.74 src/lib/libedit/el.c:1.75 --- src/lib/libedit/el.c:1.74 Tue Dec 8 07:56:55 2015 +++ src/lib/libedit/el.c Thu Feb 11 14:21:04 2016 @@ -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 @@ __RCSID("$NetBSD: el.c,v 1.74 2015/12/08 #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 @@ el_init_fd(const char *prog, FILE *fin, * 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 @@ FUN(el,set)(EditLine *el, int op, ...) 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; } Index: src/lib/libedit/emacs.c diff -u src/lib/libedit/emacs.c:1.25 src/lib/libedit/emacs.c:1.26 --- src/lib/libedit/emacs.c:1.25 Fri Jul 29 11:16:33 2011 +++ src/lib/libedit/emacs.c Thu Feb 11 14:21:04 2016 @@ -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 @@ em_gosmacs_transpose(EditLine *el, Int c /* 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; Index: src/lib/libedit/keymacro.c diff -u src/lib/libedit/keymacro.c:1.7 src/lib/libedit/keymacro.c:1.8 --- src/lib/libedit/keymacro.c:1.7 Tue Aug 16 12:25:15 2011 +++ src/lib/libedit/keymacro.c Thu Feb 11 14:21:04 2016 @@ -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 @@ node__get(Int ch) 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; Index: src/lib/libedit/map.c diff -u src/lib/libedit/map.c:1.35 src/lib/libedit/map.c:1.36 --- src/lib/libedit/map.c:1.35 Thu May 14 06:44:15 2015 +++ src/lib/libedit/map.c Thu Feb 11 14:21:04 2016 @@ -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 @@ map_print_some_keys(EditLine *el, el_act 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) { Index: src/lib/libedit/parse.c diff -u src/lib/libedit/parse.c:1.27 src/lib/libedit/parse.c:1.28 --- src/lib/libedit/parse.c:1.27 Sun Jul 6 14:15:34 2014 +++ src/lib/libedit/parse.c Thu Feb 11 14:21:04 2016 @@ -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 @@ parse__string(Char *out, const Char *in) case '^': if ((n = parse__escape(&in)) == -1) return NULL; - *out++ = n; + *out++ = (Char)n; break; case 'M': Index: src/lib/libedit/read.c diff -u src/lib/libedit/read.c:1.73 src/lib/libedit/read.c:1.74 --- src/lib/libedit/read.c:1.73 Thu Feb 11 11:08:47 2016 +++ src/lib/libedit/read.c Thu Feb 11 14:21:04 2016 @@ -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 @@ read_getcmd(EditLine *el, el_action_t *c 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 @@ again_lastbyte: /* 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 */ Index: src/lib/libedit/refresh.c diff -u src/lib/libedit/refresh.c:1.37 src/lib/libedit/refresh.c:1.38 --- src/lib/libedit/refresh.c:1.37 Fri Jul 29 19:44:45 2011 +++ src/lib/libedit/refresh.c Thu Feb 11 14:21:04 2016 @@ -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(EditLine *el, Int c, int shift) 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(EditLine *el, Int c) re_fastputc(el, ' '); terminal__putc(el, c); - el->el_display[el->el_cursor.v][el->el_cursor.h++] = c; + el->el_display[el->el_cursor.v][el->el_cursor.h++] = (Char)c; while (--w > 0) el->el_display[el->el_cursor.v][el->el_cursor.h++] = MB_FILL_CHAR; Index: src/lib/libedit/search.c diff -u src/lib/libedit/search.c:1.31 src/lib/libedit/search.c:1.32 --- src/lib/libedit/search.c:1.31 Fri Jan 29 23:02:51 2016 +++ src/lib/libedit/search.c Thu Feb 11 14:21:04 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: search.c,v 1.31 2016/01/30 04:02:51 christos Exp $ */ +/* $NetBSD: search.c,v 1.32 2016/02/11 19:21:04 christos Exp $ */ /*- * Copyright (c) 1992, 1993 @@ -37,7 +37,7 @@ #if 0 static char sccsid[] = "@(#)search.c 8.1 (Berkeley) 6/4/93"; #else -__RCSID("$NetBSD: search.c,v 1.31 2016/01/30 04:02:51 christos Exp $"); +__RCSID("$NetBSD: search.c,v 1.32 2016/02/11 19:21:04 christos Exp $"); #endif #endif /* not lint && not SCCSID */ @@ -608,7 +608,7 @@ cv_csearch(EditLine *el, int direction, } /* Save for ';' and ',' commands */ - el->el_search.chacha = ch; + el->el_search.chacha = (Char)ch; el->el_search.chadir = direction; el->el_search.chatflg = (char)tflag; Index: src/lib/libedit/sys.h diff -u src/lib/libedit/sys.h:1.17 src/lib/libedit/sys.h:1.18 --- src/lib/libedit/sys.h:1.17 Wed Sep 28 10:08:04 2011 +++ src/lib/libedit/sys.h Thu Feb 11 14:21:04 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: sys.h,v 1.17 2011/09/28 14:08:04 christos Exp $ */ +/* $NetBSD: sys.h,v 1.18 2016/02/11 19:21:04 christos Exp $ */ /*- * Copyright (c) 1992, 1993 @@ -116,6 +116,11 @@ typedef unsigned int u_int32_t; #define REGEX /* Use POSIX.2 regular expression functions */ #undef REGEXP /* Use UNIX V8 regular expression functions */ +#ifndef WIDECHAR +#define setlocale(c, l) /*LINTED*/NULL +#define nl_langinfo(i) "" +#endif + #if defined(__sun) extern int tgetent(char *, const char *); extern int tgetflag(char *); Index: src/lib/libedit/terminal.c diff -u src/lib/libedit/terminal.c:1.14 src/lib/libedit/terminal.c:1.15 --- src/lib/libedit/terminal.c:1.14 Wed May 30 14:21:14 2012 +++ src/lib/libedit/terminal.c Thu Feb 11 14:21:04 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: terminal.c,v 1.14 2012/05/30 18:21:14 christos Exp $ */ +/* $NetBSD: terminal.c,v 1.15 2016/02/11 19:21:04 christos Exp $ */ /*- * Copyright (c) 1992, 1993 @@ -37,7 +37,7 @@ #if 0 static char sccsid[] = "@(#)term.c 8.2 (Berkeley) 4/30/95"; #else -__RCSID("$NetBSD: terminal.c,v 1.14 2012/05/30 18:21:14 christos Exp $"); +__RCSID("$NetBSD: terminal.c,v 1.15 2016/02/11 19:21:04 christos Exp $"); #endif #endif /* not lint && not SCCSID */ @@ -1245,7 +1245,7 @@ terminal__putc(EditLine *el, Int c) ssize_t i; if (c == (Int)MB_FILL_CHAR) return 0; - i = ct_encode_char(buf, (size_t)MB_LEN_MAX, c); + i = ct_encode_char(buf, (size_t)MB_LEN_MAX, (Char)c); if (i <= 0) return (int)i; buf[i] = '\0'; @@ -1269,7 +1269,7 @@ protected void terminal_writec(EditLine *el, Int c) { Char visbuf[VISUAL_WIDTH_MAX +1]; - ssize_t vcnt = ct_visual_char(visbuf, VISUAL_WIDTH_MAX, c); + ssize_t vcnt = ct_visual_char(visbuf, VISUAL_WIDTH_MAX, (Char)c); if (vcnt < 0) vcnt = 0; visbuf[vcnt] = '\0'; Index: src/lib/libedit/tty.c diff -u src/lib/libedit/tty.c:1.49 src/lib/libedit/tty.c:1.50 --- src/lib/libedit/tty.c:1.49 Tue Dec 8 11:53:27 2015 +++ src/lib/libedit/tty.c Thu Feb 11 14:21:04 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: tty.c,v 1.49 2015/12/08 16:53:27 gson Exp $ */ +/* $NetBSD: tty.c,v 1.50 2016/02/11 19:21:04 christos Exp $ */ /*- * Copyright (c) 1992, 1993 @@ -37,7 +37,7 @@ #if 0 static char sccsid[] = "@(#)tty.c 8.1 (Berkeley) 6/4/93"; #else -__RCSID("$NetBSD: tty.c,v 1.49 2015/12/08 16:53:27 gson Exp $"); +__RCSID("$NetBSD: tty.c,v 1.50 2016/02/11 19:21:04 christos Exp $"); #endif #endif /* not lint && not SCCSID */ @@ -903,8 +903,8 @@ tty_bind_char(EditLine *el, int force) } for (tp = tty_map; tp->nch != (Int)-1; tp++) { - new[0] = t_n[tp->nch]; - old[0] = t_o[tp->och]; + new[0] = (Char)t_n[tp->nch]; + old[0] = (Char)t_o[tp->och]; if (new[0] == old[0] && !force) continue; /* Put the old default binding back, and set the new binding */