summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormiod <miod@openbsd.org>2015-09-10 15:02:32 +0000
committermiod <miod@openbsd.org>2015-09-10 15:02:32 +0000
commit57646176c82b24254d842128cc6c0197dd1efe2e (patch)
treedf89d28d3a49c7d841296a82c886ee13f1e66abd
parentdocument changed tls_read and tls_write semantics. (diff)
downloadwireguard-openbsd-57646176c82b24254d842128cc6c0197dd1efe2e.tar.xz
wireguard-openbsd-57646176c82b24254d842128cc6c0197dd1efe2e.zip
Fix a zx_putchar() stupid bug I introduced nine years ago by actually
initializing variables before they get used.
-rw-r--r--sys/arch/sparc/dev/zx.c10
-rw-r--r--sys/dev/sbus/zx.c10
2 files changed, 10 insertions, 10 deletions
diff --git a/sys/arch/sparc/dev/zx.c b/sys/arch/sparc/dev/zx.c
index c8e11c55dd5..2574d3ba6d9 100644
--- a/sys/arch/sparc/dev/zx.c
+++ b/sys/arch/sparc/dev/zx.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: zx.c,v 1.27 2015/03/28 19:07:08 miod Exp $ */
+/* $OpenBSD: zx.c,v 1.28 2015/09/10 15:02:32 miod Exp $ */
/* $NetBSD: zx.c,v 1.5 2002/10/02 16:52:46 thorpej Exp $ */
/*
@@ -724,6 +724,10 @@ zx_putchar(void *cookie, int row, int col, u_int uc, long attr)
dp = (volatile u_int32_t *)ri->ri_bits +
ZX_COORDS(col * font->fontwidth, row * font->fontheight);
+ sc = ri->ri_hw;
+ zc = sc->sc_zc;
+ zd = sc->sc_zd_ss0;
+
if (uc == ' ') {
zx_fillrect(ri, col, row, 1, 1, attr, ZX_STD_ROP);
if (ul == 0)
@@ -739,10 +743,6 @@ zx_putchar(void *cookie, int row, int col, u_int uc, long attr)
SETREG(zd->zd_bg, bg << 24);
SETREG(zc->zc_fontmsk, 0xffffffff << (32 - font->fontwidth));
} else {
- sc = ri->ri_hw;
- zc = sc->sc_zc;
- zd = sc->sc_zd_ss0;
-
fb = (u_int8_t *)font->data + (uc - font->firstchar) *
ri->ri_fontscale;
fs = font->stride;
diff --git a/sys/dev/sbus/zx.c b/sys/dev/sbus/zx.c
index e84ca3d73a3..629fa74c866 100644
--- a/sys/dev/sbus/zx.c
+++ b/sys/dev/sbus/zx.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: zx.c,v 1.19 2013/10/20 20:07:31 miod Exp $ */
+/* $OpenBSD: zx.c,v 1.20 2015/09/10 15:02:32 miod Exp $ */
/* $NetBSD: zx.c,v 1.5 2002/10/02 16:52:46 thorpej Exp $ */
/*
@@ -729,6 +729,10 @@ zx_putchar(void *cookie, int row, int col, u_int uc, long attr)
dp = (volatile u_int32_t *)ri->ri_bits +
ZX_COORDS(col * font->fontwidth, row * font->fontheight);
+ sc = ri->ri_hw;
+ zc = sc->sc_zc;
+ zd = sc->sc_zd_ss0;
+
if (uc == ' ') {
zx_fillrect(ri, col, row, 1, 1, attr, ZX_STD_ROP);
if (ul == 0)
@@ -744,10 +748,6 @@ zx_putchar(void *cookie, int row, int col, u_int uc, long attr)
SETREG(zd->zd_bg, bg << 24);
SETREG(zc->zc_fontmsk, 0xffffffff << (32 - font->fontwidth));
} else {
- sc = ri->ri_hw;
- zc = sc->sc_zc;
- zd = sc->sc_zd_ss0;
-
fb = (u_int8_t *)font->data + (uc - font->firstchar) *
ri->ri_fontscale;
fs = font->stride;