From 10248e78d8d1c8146c9eb43c8ad8292449d1c2c5 Mon Sep 17 00:00:00 2001 From: tnozaki Date: Wed, 23 Nov 2011 19:25:27 +0000 Subject: [PATCH] use ARG_CHAR_T instead of CHAR_T for integer promotion. --- dist/nvi/cl/cl_term.c | 5 +++-- dist/nvi/common/cut.c | 8 ++++---- dist/nvi/common/extern.h | 6 +++--- dist/nvi/common/put.c | 6 +++--- dist/nvi/common/screen.h | 4 ++-- dist/nvi/ex/ex.c | 6 +++--- dist/nvi/ex/ex.h | 4 ++-- dist/nvi/ex/ex_at.c | 4 ++-- dist/nvi/vi/v_at.c | 4 ++-- dist/nvi/vi/v_ch.c | 8 +++++--- dist/nvi/vi/v_txt.c | 20 ++++++++++---------- 11 files changed, 39 insertions(+), 36 deletions(-) diff --git a/dist/nvi/cl/cl_term.c b/dist/nvi/cl/cl_term.c index 556ebd4598b8..5655f775849e 100644 --- a/dist/nvi/cl/cl_term.c +++ b/dist/nvi/cl/cl_term.c @@ -1,4 +1,4 @@ -/* $NetBSD: cl_term.c,v 1.3 2011/09/24 18:57:46 jdc Exp $ */ +/* $NetBSD: cl_term.c,v 1.4 2011/11/23 19:25:27 tnozaki Exp $ */ /*- * Copyright (c) 1993, 1994 @@ -127,8 +127,9 @@ cl_term_init(SCR *sp) MEMCPYW(name, wp, wlen); CHAR2INT(sp, t, strlen(t), wp, wlen); MEMCPYW(ts, wp, wlen); + output[0] = (UCHAR_T)kp->ch; if (seq_set(sp, name, strlen(tkp->name), ts, strlen(t), - &kp->ch, 1, SEQ_INPUT, SEQ_NOOVERWRITE | SEQ_SCREEN)) + output, 1, SEQ_INPUT, SEQ_NOOVERWRITE | SEQ_SCREEN)) return (1); } diff --git a/dist/nvi/common/cut.c b/dist/nvi/common/cut.c index 5b86734ef028..432cb88f9f68 100644 --- a/dist/nvi/common/cut.c +++ b/dist/nvi/common/cut.c @@ -1,4 +1,4 @@ -/* $NetBSD: cut.c,v 1.4 2011/03/21 14:53:02 tnozaki Exp $ */ +/* $NetBSD: cut.c,v 1.5 2011/11/23 19:25:28 tnozaki Exp $ */ /*- * Copyright (c) 1992, 1993, 1994 @@ -63,10 +63,10 @@ static void cb_rotate __P((SCR *)); * replacing the contents. Hopefully it's not worth getting right, and here * we just treat the numeric buffers like any other named buffer. * - * PUBLIC: int cut __P((SCR *, CHAR_T *, MARK *, MARK *, int)); + * PUBLIC: int cut __P((SCR *, ARG_CHAR_T *, MARK *, MARK *, int)); */ int -cut(SCR *sp, CHAR_T *namep, MARK *fm, MARK *tm, int flags) +cut(SCR *sp, ARG_CHAR_T *namep, MARK *fm, MARK *tm, int flags) { CB *cbp; ARG_CHAR_T name = '\0'; @@ -97,7 +97,7 @@ cut(SCR *sp, CHAR_T *namep, MARK *fm, MARK *tm, int flags) */ append = copy_one = copy_def = 0; if (namep != NULL) { - name = (UCHAR_T)*namep; + name = *namep; if (LF_ISSET(CUT_NUMREQ) || (LF_ISSET(CUT_NUMOPT) && (LF_ISSET(CUT_LINEMODE) || fm->lno != tm->lno))) { copy_one = 1; diff --git a/dist/nvi/common/extern.h b/dist/nvi/common/extern.h index 1dc8708e3452..b65e0b4f9732 100644 --- a/dist/nvi/common/extern.h +++ b/dist/nvi/common/extern.h @@ -1,4 +1,4 @@ -/* $NetBSD: extern.h,v 1.4 2011/03/21 14:53:02 tnozaki Exp $ */ +/* $NetBSD: extern.h,v 1.5 2011/11/23 19:25:28 tnozaki Exp $ */ /* Do not edit: automatically built by build/distrib. */ SCR *api_fscreen __P((int, char *)); @@ -28,7 +28,7 @@ TAGQ * api_tagq_new __P((SCR*, char*)); void api_tagq_add __P((SCR*, TAGQ*, char*, char *, char *)); int api_tagq_push __P((SCR*, TAGQ**)); void api_tagq_free __P((SCR*, TAGQ*)); -int cut __P((SCR *, CHAR_T *, MARK *, MARK *, int)); +int cut __P((SCR *, ARG_CHAR_T *, MARK *, MARK *, int)); int cut_line __P((SCR *, db_recno_t, size_t, size_t, CB *)); void cut_close __P((WIN *)); TEXT *text_init __P((SCR *, const CHAR_T *, size_t, size_t)); @@ -133,7 +133,7 @@ int f_w9600 __P((SCR *, OPTION *, const char *, u_long *)); int f_window __P((SCR *, OPTION *, const char *, u_long *)); int f_encoding __P((SCR *, OPTION *, const char *, u_long *)); void thread_init __P((GS *gp)); -int put __P((SCR *, CB *, CHAR_T *, MARK *, MARK *, int)); +int put __P((SCR *, CB *, ARG_CHAR_T *, MARK *, MARK *, int)); int rcv_tmp __P((SCR *, EXF *, char *)); int rcv_init __P((SCR *)); int rcv_sync __P((SCR *, u_int)); diff --git a/dist/nvi/common/put.c b/dist/nvi/common/put.c index b4e0001d6e7f..e244150ca047 100644 --- a/dist/nvi/common/put.c +++ b/dist/nvi/common/put.c @@ -1,4 +1,4 @@ -/* $NetBSD: put.c,v 1.2 2008/12/05 22:51:42 christos Exp $ */ +/* $NetBSD: put.c,v 1.3 2011/11/23 19:25:28 tnozaki Exp $ */ /*- * Copyright (c) 1992, 1993, 1994 @@ -34,9 +34,9 @@ static const char sccsid[] = "Id: put.c,v 10.18 2001/06/25 15:19:11 skimo Exp (B * PUBLIC: int put __P((SCR *, CB *, CHAR_T *, MARK *, MARK *, int)); */ int -put(SCR *sp, CB *cbp, CHAR_T *namep, MARK *cp, MARK *rp, int append) +put(SCR *sp, CB *cbp, ARG_CHAR_T *namep, MARK *cp, MARK *rp, int append) { - CHAR_T name; + ARG_CHAR_T name; TEXT *ltp, *tp; db_recno_t lno; size_t blen, clen, len; diff --git a/dist/nvi/common/screen.h b/dist/nvi/common/screen.h index b40beb3fa41c..8da0ad593180 100644 --- a/dist/nvi/common/screen.h +++ b/dist/nvi/common/screen.h @@ -1,4 +1,4 @@ -/* $NetBSD: screen.h,v 1.1.1.2 2008/05/18 14:29:51 aymeric Exp $ */ +/* $NetBSD: screen.h,v 1.2 2011/11/23 19:25:28 tnozaki Exp $ */ /*- * Copyright (c) 1992, 1993, 1994 @@ -167,7 +167,7 @@ struct _scr { /* PARTIALLY OR COMPLETELY COPIED FROM PREVIOUS SCREEN. */ char *alt_name; /* Ex/vi: alternate file name. */ - CHAR_T at_lbuf; /* Ex/vi: Last executed at buffer. */ + ARG_CHAR_T at_lbuf; /* Ex/vi: Last executed at buffer. */ /* Ex/vi: re_compile flags. */ #define RE_WSTART L("[[:<:]]") /* Ex/vi: not-in-word search pattern. */ diff --git a/dist/nvi/ex/ex.c b/dist/nvi/ex/ex.c index 0490c251bffb..d26bedeb5ec8 100644 --- a/dist/nvi/ex/ex.c +++ b/dist/nvi/ex/ex.c @@ -1,4 +1,4 @@ -/* $NetBSD: ex.c,v 1.8 2011/11/23 14:14:43 tnozaki Exp $ */ +/* $NetBSD: ex.c,v 1.9 2011/11/23 19:25:28 tnozaki Exp $ */ /*- * Copyright (c) 1992, 1993, 1994 @@ -1051,7 +1051,7 @@ end_case23: break; * not a two-line deletion. */ if (!ISDIGIT((UCHAR_T)ecp->cp[0])) { - ecp->buffer = *ecp->cp; + ecp->buffer = (UCHAR_T)*ecp->cp; ++ecp->cp; --ecp->clen; FL_SET(ecp->iflags, E_C_BUFFER); @@ -2356,7 +2356,7 @@ ex_comlog(sp, ecp) if (ecp->flags) vtrace(sp, " flags 0x%x", ecp->flags); if (F_ISSET(&exc, E_BUFFER)) - vtrace(sp, " buffer %c", ecp->buffer); + vtrace(sp, " buffer "WC, ecp->buffer); if (ecp->argc) for (cnt = 0; cnt < ecp->argc; ++cnt) vtrace(sp, " arg %d: {%s}", cnt, ecp->argv[cnt]->bp); diff --git a/dist/nvi/ex/ex.h b/dist/nvi/ex/ex.h index a36351f84acd..842c99b4a07d 100644 --- a/dist/nvi/ex/ex.h +++ b/dist/nvi/ex/ex.h @@ -1,4 +1,4 @@ -/* $NetBSD: ex.h,v 1.3 2008/12/05 22:51:42 christos Exp $ */ +/* $NetBSD: ex.h,v 1.4 2011/11/23 19:25:28 tnozaki Exp $ */ /*- * Copyright (c) 1992, 1993, 1994 @@ -110,7 +110,7 @@ struct _excmd { F_SET(cmdp, L__f); \ } - CHAR_T buffer; /* Command: named buffer. */ + ARG_CHAR_T buffer; /* Command: named buffer. */ db_recno_t lineno; /* Command: line number. */ long count; /* Command: signed count. */ long flagoff; /* Command: signed flag offset. */ diff --git a/dist/nvi/ex/ex_at.c b/dist/nvi/ex/ex_at.c index 15e5e7e55d21..23d7b0322554 100644 --- a/dist/nvi/ex/ex_at.c +++ b/dist/nvi/ex/ex_at.c @@ -1,4 +1,4 @@ -/* $NetBSD: ex_at.c,v 1.2 2008/12/05 22:51:42 christos Exp $ */ +/* $NetBSD: ex_at.c,v 1.3 2011/11/23 19:25:28 tnozaki Exp $ */ /*- * Copyright (c) 1992, 1993, 1994 @@ -39,7 +39,7 @@ int ex_at(SCR *sp, EXCMD *cmdp) { CB *cbp; - CHAR_T name; + ARG_CHAR_T name; EXCMD *ecp; RANGE *rp; TEXT *tp; diff --git a/dist/nvi/vi/v_at.c b/dist/nvi/vi/v_at.c index 2c3011b77521..5ff291cf9f08 100644 --- a/dist/nvi/vi/v_at.c +++ b/dist/nvi/vi/v_at.c @@ -1,4 +1,4 @@ -/* $NetBSD: v_at.c,v 1.3 2009/04/04 01:13:42 jld Exp $ */ +/* $NetBSD: v_at.c,v 1.4 2011/11/23 19:25:28 tnozaki Exp $ */ /*- * Copyright (c) 1992, 1993, 1994 @@ -38,7 +38,7 @@ int v_at(SCR *sp, VICMD *vp) { CB *cbp; - CHAR_T name; + ARG_CHAR_T name; TEXT *tp; size_t len; char nbuf[20]; diff --git a/dist/nvi/vi/v_ch.c b/dist/nvi/vi/v_ch.c index b1ee1391c116..efb79af19f59 100644 --- a/dist/nvi/vi/v_ch.c +++ b/dist/nvi/vi/v_ch.c @@ -1,4 +1,4 @@ -/* $NetBSD: v_ch.c,v 1.1.1.2 2008/05/18 14:31:40 aymeric Exp $ */ +/* $NetBSD: v_ch.c,v 1.2 2011/11/23 19:25:28 tnozaki Exp $ */ /*- * Copyright (c) 1992, 1993, 1994 @@ -140,7 +140,8 @@ v_chf(SCR *sp, VICMD *vp) { size_t len; u_long cnt; - int isempty, key; + int isempty; + ARG_CHAR_T key; CHAR_T *endp, *p, *startp; /* @@ -221,7 +222,8 @@ v_chF(SCR *sp, VICMD *vp) { size_t len; u_long cnt; - int isempty, key; + int isempty; + ARG_CHAR_T key; CHAR_T *endp, *p; /* diff --git a/dist/nvi/vi/v_txt.c b/dist/nvi/vi/v_txt.c index c4bbd3c630e0..3a25e8c9f5de 100644 --- a/dist/nvi/vi/v_txt.c +++ b/dist/nvi/vi/v_txt.c @@ -1,4 +1,4 @@ -/* $NetBSD: v_txt.c,v 1.7 2011/03/21 14:53:04 tnozaki Exp $ */ +/* $NetBSD: v_txt.c,v 1.8 2011/11/23 19:25:28 tnozaki Exp $ */ /*- * Copyright (c) 1993, 1994 @@ -32,7 +32,7 @@ static const char sccsid[] = "Id: v_txt.c,v 10.108 2003/07/18 21:27:42 skimo Exp #include "../common/common.h" #include "vi.h" -static int txt_abbrev __P((SCR *, TEXT *, CHAR_T *, int, int *, int *)); +static int txt_abbrev __P((SCR *, TEXT *, ARG_CHAR_T *, int, int *, int *)); static void txt_ai_resolve __P((SCR *, TEXT *, int *)); static TEXT *txt_backup __P((SCR *, TEXTH *, TEXT *, u_int32_t *)); static int txt_dent __P((SCR *, TEXT *, int)); @@ -41,7 +41,7 @@ static void txt_err __P((SCR *, TEXTH *)); static int txt_fc __P((SCR *, TEXT *, int *)); static int txt_fc_col __P((SCR *, int, ARGS **)); static int txt_hex __P((SCR *, TEXT *)); -static int txt_insch __P((SCR *, TEXT *, CHAR_T *, u_int)); +static int txt_insch __P((SCR *, TEXT *, ARG_CHAR_T *, u_int)); static int txt_isrch __P((SCR *, VICMD *, TEXT *, u_int8_t *)); static int txt_map_end __P((SCR *)); static int txt_map_init __P((SCR *)); @@ -1471,7 +1471,7 @@ alloc_err: * Handle abbreviations. */ static int -txt_abbrev(SCR *sp, TEXT *tp, CHAR_T *pushcp, int isinfoline, int *didsubp, int *turnoffp) +txt_abbrev(SCR *sp, TEXT *tp, ARG_CHAR_T *pushcp, int isinfoline, int *didsubp, int *turnoffp) { VI_PRIVATE *vip; CHAR_T ch, *p; @@ -1596,7 +1596,7 @@ search: if (isinfoline) { * queue would have to be adjusted, and the line state when an initial * abbreviated character was received would have to be saved. */ - ch = *pushcp; + ch = (UCHAR_T)*pushcp; if (v_event_push(sp, NULL, &ch, 1, CH_ABBREVIATED)) return (1); if (v_event_push(sp, NULL, qp->output, qp->olen, CH_ABBREVIATED)) @@ -1898,7 +1898,7 @@ txt_backup(SCR *sp, TEXTH *tiqh, TEXT *tp, u_int32_t *flagsp) static int txt_dent(SCR *sp, TEXT *tp, int isindent) { - CHAR_T ch; + ARG_CHAR_T ch; u_long sw, ts; size_t cno, current, spaces, target, tabs; @@ -2425,7 +2425,7 @@ nothex: tp->lb[tp->cno] = savec; * of the screen space they require, but that it not overwrite other characters. */ static int -txt_insch(SCR *sp, TEXT *tp, CHAR_T *chp, u_int flags) +txt_insch(SCR *sp, TEXT *tp, ARG_CHAR_T *chp, u_int flags) { unsigned char *kp; CHAR_T savech; @@ -2439,7 +2439,7 @@ txt_insch(SCR *sp, TEXT *tp, CHAR_T *chp, u_int flags) if (LF_ISSET(TXT_REPLACE)) { if (tp->owrite) { --tp->owrite; - tp->lb[tp->cno++] = *chp; + tp->lb[tp->cno++] = (UCHAR_T)*chp; return (0); } } else if (tp->owrite) { /* Overwrite a character. */ @@ -2514,7 +2514,7 @@ txt_insch(SCR *sp, TEXT *tp, CHAR_T *chp, u_int flags) /* If we had enough overwrite characters, we're done. */ if (nlen == 0) { - tp->lb[tp->cno++] = *chp; + tp->lb[tp->cno++] = (UCHAR_T)*chp; return (0); } } @@ -2530,7 +2530,7 @@ txt_insch(SCR *sp, TEXT *tp, CHAR_T *chp, u_int flags) MEMMOVEW(tp->lb + tp->cno + 1, tp->lb + tp->cno, tp->owrite + tp->insert); } - tp->lb[tp->cno++] = *chp; + tp->lb[tp->cno++] = (UCHAR_T)*chp; return (0); }