From owner-svn-src-head@freebsd.org Fri Mar 10 14:25:39 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id EF0AAD06004; Fri, 10 Mar 2017 14:25:39 +0000 (UTC) (envelope-from bde@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id BC0CABE; Fri, 10 Mar 2017 14:25:39 +0000 (UTC) (envelope-from bde@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v2AEPcHC080912; Fri, 10 Mar 2017 14:25:38 GMT (envelope-from bde@FreeBSD.org) Received: (from bde@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v2AEPcDq080911; Fri, 10 Mar 2017 14:25:38 GMT (envelope-from bde@FreeBSD.org) Message-Id: <201703101425.v2AEPcDq080911@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bde set sender to bde@FreeBSD.org using -f From: Bruce Evans Date: Fri, 10 Mar 2017 14:25:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r315003 - head/sys/dev/syscons X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 10 Mar 2017 14:25:40 -0000 Author: bde Date: Fri Mar 10 14:25:38 2017 New Revision: 315003 URL: https://svnweb.freebsd.org/changeset/base/315003 Log: Rename scteken_revattr() to scteken_sc_to_te_attr(). scteken_revattr() looked like it might handle reverse attributes, but it actually handles conversion of attributes in the direction indicated by the new name. Reverse attributes are just broken. Rename scteken_attr() to scteken_te_to_sc_attr(). scteken_attr() looked like it might give teken attributes, but it actually gives sc attributes. Change scteken_te_to_sc_attr() to return int instead of unsigned int. u_char would be enough, and it promotes to int, and syscons uses int or u_short for its attributes everywhere else (u_short holds a shifted form and it promotes to int too). Modified: head/sys/dev/syscons/scterm-teken.c Modified: head/sys/dev/syscons/scterm-teken.c ============================================================================== --- head/sys/dev/syscons/scterm-teken.c Fri Mar 10 13:39:16 2017 (r315002) +++ head/sys/dev/syscons/scterm-teken.c Fri Mar 10 14:25:38 2017 (r315003) @@ -51,8 +51,8 @@ __FBSDID("$FreeBSD$"); #include -static void scteken_revattr(unsigned char, teken_attr_t *); -static unsigned int scteken_attr(const teken_attr_t *); +static void scteken_sc_to_te_attr(unsigned char, teken_attr_t *); +static int scteken_te_to_sc_attr(const teken_attr_t *); static sc_term_init_t scteken_init; static sc_term_term_t scteken_term; @@ -176,7 +176,7 @@ scteken_puts(scr_stat *scp, u_char *buf, if (kernel) { /* Use special colors for kernel messages. */ backup = *teken_get_curattr(&ts->ts_teken); - scteken_revattr(sc_kattr(), &kattr); + scteken_sc_to_te_attr(sc_kattr(), &kattr); teken_set_curattr(&ts->ts_teken, &kattr); teken_input(&ts->ts_teken, buf, len); teken_set_curattr(&ts->ts_teken, &backup); @@ -193,19 +193,19 @@ scteken_ioctl(scr_stat *scp, struct tty { teken_stat *ts = scp->ts; vid_info_t *vi; - unsigned int attr; + int attr; switch (cmd) { case GIO_ATTR: /* get current attributes */ *(int*)data = - scteken_attr(teken_get_curattr(&ts->ts_teken)); + scteken_te_to_sc_attr(teken_get_curattr(&ts->ts_teken)); return (0); case CONS_GETINFO: /* get current (virtual) console info */ vi = (vid_info_t *)data; if (vi->size != sizeof(struct vid_info)) return EINVAL; - attr = scteken_attr(teken_get_defattr(&ts->ts_teken)); + attr = scteken_te_to_sc_attr(teken_get_defattr(&ts->ts_teken)); vi->mv_norm.fore = attr & 0x0f; vi->mv_norm.back = (attr >> 4) & 0x0f; vi->mv_rev.fore = vi->mv_norm.back; @@ -225,7 +225,7 @@ scteken_default_attr(scr_stat *scp, int teken_stat *ts = scp->ts; teken_attr_t ta; - scteken_revattr(color, &ta); + scteken_sc_to_te_attr(color, &ta); teken_set_defattr(&ts->ts_teken, &ta); } @@ -321,7 +321,7 @@ static const unsigned char bgcolors[TC_N }; static void -scteken_revattr(unsigned char color, teken_attr_t *a) +scteken_sc_to_te_attr(unsigned char color, teken_attr_t *a) { teken_color_t fg, bg; @@ -360,10 +360,10 @@ scteken_revattr(unsigned char color, tek } } -static unsigned int -scteken_attr(const teken_attr_t *a) +static int +scteken_te_to_sc_attr(const teken_attr_t *a) { - unsigned int attr = 0; + int attr = 0; teken_color_t fg, bg; if (a->ta_format & TF_REVERSE) { @@ -558,7 +558,7 @@ scteken_putchar(void *arg, const teken_p * characters. Simply print a space and assume that the left * hand side describes the entire character. */ - attr = scteken_attr(a) << 8; + attr = scteken_te_to_sc_attr(a) << 8; if (a->ta_format & TF_CJK_RIGHT) c = ' '; #ifdef TEKEN_UTF8 @@ -590,7 +590,7 @@ scteken_fill(void *arg, const teken_rect unsigned int width; int attr, row; - attr = scteken_attr(a) << 8; + attr = scteken_te_to_sc_attr(a) << 8; #ifdef TEKEN_UTF8 scteken_get_cp437(&c, &attr); #endif /* TEKEN_UTF8 */