summaryrefslogtreecommitdiff
path: root/sys/dev
diff options
context:
space:
mode:
authorchristos <christos@NetBSD.org>2003-04-20 22:02:46 +0000
committerchristos <christos@NetBSD.org>2003-04-20 22:02:46 +0000
commit4a2f0334d45f8a272e186f6fe13644d645f09274 (patch)
tree865e4b4f562b2b1b9ee54a150f37525f479ecc62 /sys/dev
parent6fab16d795b9f8fb1291ab34542a8ae24f31f554 (diff)
PR/6362: der Mouse: /dev/speaker octave-tracking goes out of range
Diffstat (limited to 'sys/dev')
-rw-r--r--sys/dev/isa/spkr.c16
1 files changed, 10 insertions, 6 deletions
diff --git a/sys/dev/isa/spkr.c b/sys/dev/isa/spkr.c
index a25f9c97a33..d7524c5219a 100644
--- a/sys/dev/isa/spkr.c
+++ b/sys/dev/isa/spkr.c
@@ -1,4 +1,4 @@
-/* $NetBSD: spkr.c,v 1.12 2002/10/23 09:13:25 jdolecek Exp $ */
+/* $NetBSD: spkr.c,v 1.13 2003/04/20 22:02:46 christos Exp $ */
/*
* Copyright (c) 1990 Eric S. Raymond (esr@snark.thyrsus.com)
@@ -43,7 +43,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: spkr.c,v 1.12 2002/10/23 09:13:25 jdolecek Exp $");
+__KERNEL_RCSID(0, "$NetBSD: spkr.c,v 1.13 2003/04/20 22:02:46 christos Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -269,14 +269,18 @@ playstring(cp, slen)
{
if (abs(pitch-lastpitch) > abs(pitch+OCTAVE_NOTES-lastpitch))
{
- ++octave;
- pitch += OCTAVE_NOTES;
+ if (octave < NOCTAVES - 1) {
+ ++octave;
+ pitch += OCTAVE_NOTES;
+ }
}
if (abs(pitch-lastpitch) > abs((pitch-OCTAVE_NOTES)-lastpitch))
{
- --octave;
- pitch -= OCTAVE_NOTES;
+ if (octave > 0) {
+ --octave;
+ pitch -= OCTAVE_NOTES;
+ }
}
}
octprefix = FALSE;