use ARG_CHAR_T instead of CHAR_T for integer promotion. trunk
authortnozaki <tnozaki@NetBSD.org>
Wed, 23 Nov 2011 19:25:27 +0000
branchtrunk
changeset 207028 8003da5a99fc
parent 207027 2a18135e7b92
child 207029 5372649f012e
use ARG_CHAR_T instead of CHAR_T for integer promotion.
dist/nvi/cl/cl_term.c
dist/nvi/common/cut.c
dist/nvi/common/extern.h
dist/nvi/common/put.c
dist/nvi/common/screen.h
dist/nvi/ex/ex.c
dist/nvi/ex/ex.h
dist/nvi/ex/ex_at.c
dist/nvi/vi/v_at.c
dist/nvi/vi/v_ch.c
dist/nvi/vi/v_txt.c
--- a/dist/nvi/cl/cl_term.c	Wed Nov 23 19:18:53 2011 +0000
+++ b/dist/nvi/cl/cl_term.c	Wed Nov 23 19:25:27 2011 +0000
@@ -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 @@
 		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);
 	}
 
--- a/dist/nvi/common/cut.c	Wed Nov 23 19:18:53 2011 +0000
+++ b/dist/nvi/common/cut.c	Wed Nov 23 19:25:27 2011 +0000
@@ -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 @@
  * 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 @@
 	 */
 	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;
--- a/dist/nvi/common/extern.h	Wed Nov 23 19:18:53 2011 +0000
+++ b/dist/nvi/common/extern.h	Wed Nov 23 19:25:27 2011 +0000
@@ -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 @@
 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_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));
--- a/dist/nvi/common/put.c	Wed Nov 23 19:18:53 2011 +0000
+++ b/dist/nvi/common/put.c	Wed Nov 23 19:25:27 2011 +0000
@@ -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 @@
  * 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;
--- a/dist/nvi/common/screen.h	Wed Nov 23 19:18:53 2011 +0000
+++ b/dist/nvi/common/screen.h	Wed Nov 23 19:25:27 2011 +0000
@@ -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 @@
 /* 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. */
--- a/dist/nvi/ex/ex.c	Wed Nov 23 19:18:53 2011 +0000
+++ b/dist/nvi/ex/ex.c	Wed Nov 23 19:25:27 2011 +0000
@@ -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 @@
 			 * 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 @@
 	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);
--- a/dist/nvi/ex/ex.h	Wed Nov 23 19:18:53 2011 +0000
+++ b/dist/nvi/ex/ex.h	Wed Nov 23 19:25:27 2011 +0000
@@ -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 @@
 	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. */
--- a/dist/nvi/ex/ex_at.c	Wed Nov 23 19:18:53 2011 +0000
+++ b/dist/nvi/ex/ex_at.c	Wed Nov 23 19:25:27 2011 +0000
@@ -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 @@
 ex_at(SCR *sp, EXCMD *cmdp)
 {
 	CB *cbp;
-	CHAR_T name;
+	ARG_CHAR_T name;
 	EXCMD *ecp;
 	RANGE *rp;
 	TEXT *tp;
--- a/dist/nvi/vi/v_at.c	Wed Nov 23 19:18:53 2011 +0000
+++ b/dist/nvi/vi/v_at.c	Wed Nov 23 19:25:27 2011 +0000
@@ -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 @@
 v_at(SCR *sp, VICMD *vp)
 {
 	CB *cbp;
-	CHAR_T name;
+	ARG_CHAR_T name;
 	TEXT *tp;
 	size_t len;
 	char nbuf[20];
--- a/dist/nvi/vi/v_ch.c	Wed Nov 23 19:18:53 2011 +0000
+++ b/dist/nvi/vi/v_ch.c	Wed Nov 23 19:25:27 2011 +0000
@@ -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 @@
 {
 	size_t len;
 	u_long cnt;
-	int isempty, key;
+	int isempty;
+	ARG_CHAR_T key;
 	CHAR_T *endp, *p, *startp;
 
 	/*
@@ -221,7 +222,8 @@
 {
 	size_t len;
 	u_long cnt;
-	int isempty, key;
+	int isempty;
+	ARG_CHAR_T key;
 	CHAR_T *endp, *p;
 
 	/*
--- a/dist/nvi/vi/v_txt.c	Wed Nov 23 19:18:53 2011 +0000
+++ b/dist/nvi/vi/v_txt.c	Wed Nov 23 19:25:27 2011 +0000
@@ -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 @@
 #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 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 @@
  *	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 @@
 	 * 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 @@
 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 @@
  * 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 @@
 	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 @@
 
 		/* 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 @@
 			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);
 }