Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/dev/rasops Correctly check whether character is in font ...



details:   https://anonhg.NetBSD.org/src/rev/1ee1d0ec53a5
branches:  trunk
changeset: 844259:1ee1d0ec53a5
user:      rin <rin%NetBSD.org@localhost>
date:      Fri Aug 09 12:05:51 2019 +0000

description:
Correctly check whether character is in font in rasops_mapchar().
Also, make sure that in putchar functions for completeness.

diffstat:

 sys/dev/rasops/rasops.c                |  13 +++----------
 sys/dev/rasops/rasops1-4_putchar.h     |   5 ++++-
 sys/dev/rasops/rasops1.c               |   7 +++++--
 sys/dev/rasops/rasops1_putchar_width.h |   5 ++++-
 sys/dev/rasops/rasops_putchar.h        |   4 ++--
 sys/dev/rasops/rasops_putchar_width.h  |   4 ++--
 6 files changed, 20 insertions(+), 18 deletions(-)

diffs (140 lines):

diff -r 46f274925ecb -r 1ee1d0ec53a5 sys/dev/rasops/rasops.c
--- a/sys/dev/rasops/rasops.c   Fri Aug 09 11:42:03 2019 +0000
+++ b/sys/dev/rasops/rasops.c   Fri Aug 09 12:05:51 2019 +0000
@@ -1,4 +1,4 @@
-/*      $NetBSD: rasops.c,v 1.119 2019/08/09 11:42:03 rin Exp $        */
+/*      $NetBSD: rasops.c,v 1.120 2019/08/09 12:05:51 rin Exp $        */
 
 /*-
  * Copyright (c) 1999 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: rasops.c,v 1.119 2019/08/09 11:42:03 rin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rasops.c,v 1.120 2019/08/09 12:05:51 rin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_rasops.h"
@@ -598,18 +598,11 @@
        KASSERT(ri->ri_font != NULL);
 
        if ((c = wsfont_map_unichar(ri->ri_font, c)) < 0 ||
-           c < ri->ri_font->firstchar) {
+           !CHAR_IN_FONT(c, ri->ri_font)) {
                *cp = ' ';
                return 0;
        }
 
-#if 0 /* XXXRO */
-       if (CHAR_IN_FONT(c, ri->ri_font)) {
-               *cp = ' ';
-               return 0;
-       }
-#endif
-
        *cp = c;
        return 5;
 }
diff -r 46f274925ecb -r 1ee1d0ec53a5 sys/dev/rasops/rasops1-4_putchar.h
--- a/sys/dev/rasops/rasops1-4_putchar.h        Fri Aug 09 11:42:03 2019 +0000
+++ b/sys/dev/rasops/rasops1-4_putchar.h        Fri Aug 09 12:05:51 2019 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: rasops1-4_putchar.h,v 1.1 2019/08/07 12:36:36 rin Exp $ */
+/* $NetBSD: rasops1-4_putchar.h,v 1.2 2019/08/09 12:05:51 rin Exp $ */
 
 /* NetBSD: rasops_bitops.h,v 1.23 2019/08/02 04:39:09 rin Exp */
 /*-
@@ -97,6 +97,9 @@
 
        hp = NULL;      /* XXX GCC */
 
+       if (__predict_false(!CHAR_IN_FONT(uc, font)))
+               return;
+
 #ifdef RASOPS_CLIPPING
        /* Catches 'row < 0' case too */
        if ((unsigned)row >= (unsigned)ri->ri_rows)
diff -r 46f274925ecb -r 1ee1d0ec53a5 sys/dev/rasops/rasops1.c
--- a/sys/dev/rasops/rasops1.c  Fri Aug 09 11:42:03 2019 +0000
+++ b/sys/dev/rasops/rasops1.c  Fri Aug 09 12:05:51 2019 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: rasops1.c,v 1.35 2019/08/07 12:27:49 rin Exp $ */
+/*     $NetBSD: rasops1.c,v 1.36 2019/08/09 12:05:51 rin Exp $ */
 
 /*-
  * Copyright (c) 1999 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: rasops1.c,v 1.35 2019/08/07 12:27:49 rin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rasops1.c,v 1.36 2019/08/09 12:05:51 rin Exp $");
 
 #include "opt_rasops.h"
 
@@ -100,6 +100,9 @@
 
        hp = NULL;      /* XXX GCC */
 
+       if (__predict_false(!CHAR_IN_FONT(uc, font)))
+               return;
+
 #ifdef RASOPS_CLIPPING
        /* Catches 'row < 0' case too */
        if ((unsigned)row >= (unsigned)ri->ri_rows)
diff -r 46f274925ecb -r 1ee1d0ec53a5 sys/dev/rasops/rasops1_putchar_width.h
--- a/sys/dev/rasops/rasops1_putchar_width.h    Fri Aug 09 11:42:03 2019 +0000
+++ b/sys/dev/rasops/rasops1_putchar_width.h    Fri Aug 09 12:05:51 2019 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: rasops1_putchar_width.h,v 1.4 2019/08/07 12:27:49 rin Exp $ */
+/* $NetBSD: rasops1_putchar_width.h,v 1.5 2019/08/09 12:05:51 rin Exp $ */
 
 /* NetBSD: rasops1.c,v 1.28 2019/07/25 03:02:44 rin Exp */
 /*-
@@ -69,6 +69,9 @@
 
        hp = NULL;      /* XXX GCC */
 
+       if (__predict_false(!CHAR_IN_FONT(uc, font)))
+               return;
+
 #ifdef RASOPS_CLIPPING
        /* Catches 'row < 0' case too */
        if ((unsigned)row >= (unsigned)ri->ri_rows)
diff -r 46f274925ecb -r 1ee1d0ec53a5 sys/dev/rasops/rasops_putchar.h
--- a/sys/dev/rasops/rasops_putchar.h   Fri Aug 09 11:42:03 2019 +0000
+++ b/sys/dev/rasops/rasops_putchar.h   Fri Aug 09 12:05:51 2019 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: rasops_putchar.h,v 1.6 2019/08/07 12:33:48 rin Exp $ */
+/* $NetBSD: rasops_putchar.h,v 1.7 2019/08/09 12:05:51 rin Exp $ */
 
 /* NetBSD: rasops8.c,v 1.41 2019/07/25 03:02:44 rin Exp  */
 /*-
@@ -106,7 +106,7 @@
 
        hp = NULL;      /* XXX GCC */
 
-       if (!CHAR_IN_FONT(uc, font))
+       if (__predict_false(!CHAR_IN_FONT(uc, font)))
                return;
 
 #ifdef RASOPS_CLIPPING
diff -r 46f274925ecb -r 1ee1d0ec53a5 sys/dev/rasops/rasops_putchar_width.h
--- a/sys/dev/rasops/rasops_putchar_width.h     Fri Aug 09 11:42:03 2019 +0000
+++ b/sys/dev/rasops/rasops_putchar_width.h     Fri Aug 09 12:05:51 2019 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: rasops_putchar_width.h,v 1.12 2019/08/07 12:27:49 rin Exp $ */
+/* $NetBSD: rasops_putchar_width.h,v 1.13 2019/08/09 12:05:51 rin Exp $ */
 
 /* NetBSD: rasops8.c,v 1.41 2019/07/25 03:02:44 rin Exp  */
 /*-
@@ -220,7 +220,7 @@
 #endif
 
        /* check if character fits into font limits */
-       if (!CHAR_IN_FONT(uc, font))
+       if (__predict_false(!CHAR_IN_FONT(uc, font)))
                return;
 
        /* Recompute stamp? */



Home | Main Index | Thread Index | Old Index