Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/wsfont wsfont_lock(): if bitorder/byteorder doesn't ...



details:   https://anonhg.NetBSD.org/src/rev/ec9f6a31bab5
branches:  trunk
changeset: 542849:ec9f6a31bab5
user:      jdolecek <jdolecek%NetBSD.org@localhost>
date:      Sun Feb 09 18:40:31 2003 +0000

description:
wsfont_lock(): if bitorder/byteorder doesn't match, copy the font to new font
also if the font is static (and thus it's 'data' point to const/text location) -
later call to wsfont_rev{bit,byte}() needs to change the font data in-place
print info about the font copy when it's made

problem pointed out by Matthias Drochner

diffstat:

 sys/dev/wsfont/wsfont.c |  18 ++++++++++++------
 1 files changed, 12 insertions(+), 6 deletions(-)

diffs (44 lines):

diff -r 519663d49535 -r ec9f6a31bab5 sys/dev/wsfont/wsfont.c
--- a/sys/dev/wsfont/wsfont.c   Sun Feb 09 18:27:10 2003 +0000
+++ b/sys/dev/wsfont/wsfont.c   Sun Feb 09 18:40:31 2003 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: wsfont.c,v 1.31 2003/02/09 10:29:38 jdolecek Exp $     */
+/*     $NetBSD: wsfont.c,v 1.32 2003/02/09 18:40:31 jdolecek Exp $     */
 
 /*-
  * Copyright (c) 1999, 2000, 2001, 2002 The NetBSD Foundation, Inc.
@@ -37,7 +37,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: wsfont.c,v 1.31 2003/02/09 10:29:38 jdolecek Exp $");
+__KERNEL_RCSID(0, "$NetBSD: wsfont.c,v 1.32 2003/02/09 18:40:31 jdolecek Exp $");
 
 #include "opt_wsfont.h"
 
@@ -436,15 +436,21 @@
                if ((ent = wsfont_find0(cookie, WSFONT_IDENT_MASK)) == NULL)
                        return (ENOENT);
 
-               if (ent->lockcount != 0) {
+               bito = (cookie & WSFONT_BITO_MASK) >> WSFONT_BITO_SHIFT;
+               byteo = (cookie & WSFONT_BYTEO_MASK) >> WSFONT_BYTEO_SHIFT;
+
+               if (ent->lockcount != 0 || (ent->flags & WSFONT_STATIC)) {
                        neu = wsfont_add0(ent->font, 1);
                        neu->flags |= WSFONT_COPY;
+
+                       aprint_normal("wsfont: font '%s' bito %d byteo %d copied to bito %d byteo %d\n",
+                               ent->font->name,
+                               ent->font->bitorder, ent->font->byteorder,
+                               bito, byteo);
+
                        ent = neu;
                }
 
-               bito = (cookie & WSFONT_BITO_MASK) >> WSFONT_BITO_SHIFT;
-               byteo = (cookie & WSFONT_BYTEO_MASK) >> WSFONT_BYTEO_SHIFT;
-
                if (bito && bito != ent->font->bitorder) {
                        wsfont_revbit(ent->font);
                        ent->font->bitorder = bito;



Home | Main Index | Thread Index | Old Index