diff options
| author | christos <christos@NetBSD.org> | 2016-02-11 19:21:04 +0000 |
|---|---|---|
| committer | christos <christos@NetBSD.org> | 2016-02-11 19:21:04 +0000 |
| commit | c4cb5470dbe594ffd789969fc6d603578de0da07 (patch) | |
| tree | 316c147213db205f23de83532f89fceab1ba016f /lib/libedit | |
| parent | 79a74300a0827b2ab4ff01e35a13e1c11924fb66 (diff) | |
- Add some more Char casts
- reduce ifdefs by providing empty defs for nls functions (Ingo Schwarze)
Diffstat (limited to 'lib/libedit')
| -rw-r--r-- | lib/libedit/chartype.c | 6 | ||||
| -rw-r--r-- | lib/libedit/common.c | 10 | ||||
| -rw-r--r-- | lib/libedit/el.c | 11 | ||||
| -rw-r--r-- | lib/libedit/emacs.c | 6 | ||||
| -rw-r--r-- | lib/libedit/keymacro.c | 6 | ||||
| -rw-r--r-- | lib/libedit/map.c | 8 | ||||
| -rw-r--r-- | lib/libedit/parse.c | 6 | ||||
| -rw-r--r-- | lib/libedit/read.c | 8 | ||||
| -rw-r--r-- | lib/libedit/refresh.c | 8 | ||||
| -rw-r--r-- | lib/libedit/search.c | 6 | ||||
| -rw-r--r-- | lib/libedit/sys.h | 7 | ||||
| -rw-r--r-- | lib/libedit/terminal.c | 8 | ||||
| -rw-r--r-- | lib/libedit/tty.c | 8 |
13 files changed, 52 insertions, 46 deletions
diff --git a/lib/libedit/chartype.c b/lib/libedit/chartype.c index b780bb1c3c9..825375969e4 100644 --- a/lib/libedit/chartype.c +++ b/lib/libedit/chartype.c @@ -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, Char c) 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 --git a/lib/libedit/common.c b/lib/libedit/common.c index 1726b0f812f..ec5cb2c3966 100644 --- a/lib/libedit/common.c +++ b/lib/libedit/common.c @@ -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; diff --git a/lib/libedit/el.c b/lib/libedit/el.c index 8e1b3b5701f..921af65f13d 100644 --- a/lib/libedit/el.c +++ b/lib/libedit/el.c @@ -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 12:56:55 christos Exp $"); #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, FILE *fout, FILE *ferr, * 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; } diff --git a/lib/libedit/emacs.c b/lib/libedit/emacs.c index ab1e2dfe191..cb36cf7332e 100644 --- a/lib/libedit/emacs.c +++ b/lib/libedit/emacs.c @@ -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; diff --git a/lib/libedit/keymacro.c b/lib/libedit/keymacro.c index 1cab508fa0c..d6d26dce2ce 100644 --- a/lib/libedit/keymacro.c +++ b/lib/libedit/keymacro.c @@ -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; diff --git a/lib/libedit/map.c b/lib/libedit/map.c index 96da438bc78..40af29e5f93 100644 --- a/lib/libedit/map.c +++ b/lib/libedit/map.c @@ -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_action_t *map, Int first, Int last) 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 --git a/lib/libedit/parse.c b/lib/libedit/parse.c index 47d6f7d9b9d..c814ef28907 100644 --- a/lib/libedit/parse.c +++ b/lib/libedit/parse.c @@ -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': diff --git a/lib/libedit/read.c b/lib/libedit/read.c index 23597a867c0..d55f9f48dde 100644 --- a/lib/libedit/read.c +++ b/lib/libedit/read.c @@ -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 *cmdnum, Char *ch) 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 */ diff --git a/lib/libedit/refresh.c b/lib/libedit/refresh.c index 3e1176eced6..8c7cac9d5f4 100644 --- a/lib/libedit/refresh.c +++ b/lib/libedit/refresh.c @@ -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; diff --git a/lib/libedit/search.c b/lib/libedit/search.c index a6afea92139..c466814db29 100644 --- a/lib/libedit/search.c +++ b/lib/libedit/search.c @@ -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, Int ch, int count, int tflag) } /* 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; diff --git a/lib/libedit/sys.h b/lib/libedit/sys.h index 690e1354b11..751d14e613c 100644 --- a/lib/libedit/sys.h +++ b/lib/libedit/sys.h @@ -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 *); diff --git a/lib/libedit/terminal.c b/lib/libedit/terminal.c index c4a2543e496..371a69f0b01 100644 --- a/lib/libedit/terminal.c +++ b/lib/libedit/terminal.c @@ -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'; diff --git a/lib/libedit/tty.c b/lib/libedit/tty.c index e0812129435..5dfab26936c 100644 --- a/lib/libedit/tty.c +++ b/lib/libedit/tty.c @@ -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 */ |
