From owner-freebsd-bugs Sat Nov 4 01:21:17 1995 Return-Path: owner-bugs Received: (from root@localhost) by freefall.freebsd.org (8.6.12/8.6.6) id BAA21491 for bugs-outgoing; Sat, 4 Nov 1995 01:21:17 -0800 Received: from ns.intec.co.jp (ns.intec.co.jp [133.230.1.35]) by freefall.freebsd.org (8.6.12/8.6.6) with ESMTP id BAA21479 for ; Sat, 4 Nov 1995 01:21:10 -0800 Received: from coms1.isl.intec.co.jp (coms1.isl.intec.co.jp [133.230.64.63]) by ns.intec.co.jp (8.6.12+2.5Wb7/3.4W-gate) with ESMTP id SAA29831 for ; Sat, 4 Nov 1995 18:21:05 +0900 Received: (from uucp@localhost) by coms1.isl.intec.co.jp (8.7.1/3.4W-coms1) with UUCP id SAA06190 for bugs@freebsd.org; Sat, 4 Nov 1995 18:21:03 +0900 (JST) Received: (from ikuo@localhost) by potato.isl.intec.co.jp (8.7.1/3.4W3-potato) id RAA07428; Sat, 4 Nov 1995 17:36:42 +0900 (JST) Date: Sat, 4 Nov 1995 17:36:42 +0900 (JST) Message-Id: <199511040836.RAA07428@potato.isl.intec.co.jp> To: bugs@freebsd.org Subject: bug in /sys/i386/isa/spkr.c From: ikuo@intec.co.jp Reply-To: ikuo@intec.co.jp Sender: owner-bugs@freebsd.org Precedence: bulk Hi. I found a bug in "/sys/i386/isa/spkr.c" of FreeBSD-current, and made a patch for it. Thanks. -------------------- cut here -------------------- *** spkr.c.old Sat Nov 4 17:09:58 1995 --- spkr.c Sat Nov 4 17:30:25 1995 *************** *** 4,10 **** * v1.4 by Eric S. Raymond (esr@snark.thyrsus.com) Aug 1993 * modified for FreeBSD by Andrew A. Chernov * ! * $Id: spkr.c,v 1.17 1995/09/09 18:09:55 davidg Exp $ */ #include "speaker.h" --- 4,10 ---- * v1.4 by Eric S. Raymond (esr@snark.thyrsus.com) Aug 1993 * modified for FreeBSD by Andrew A. Chernov * ! * $Id: spkr.c,v 1.18 1995/11/04 08:20:15 ikuo Exp $ */ #include "speaker.h" *************** *** 254,266 **** static void playstring(cp, slen) /* interpret and play an item from a notation string */ char *cp; ! size_t slen; { int pitch, oldfill, lastpitch = OCTAVE_NOTES * DFLT_OCTAVE; ! #define GETNUM(cp, v) for(v=0; isdigit(cp[1]) && slen > 0; ) \ ! {v = v * 10 + (*++cp - '0'); slen--;} ! for (; slen--; cp++) { int sustain, timeval, tempo; register char c = toupper(*cp); --- 254,267 ---- static void playstring(cp, slen) /* interpret and play an item from a notation string */ char *cp; ! /* size_t slen; */ ! int slen; { int pitch, oldfill, lastpitch = OCTAVE_NOTES * DFLT_OCTAVE; ! #define GETNUM(cp, v) for (v = 0; slen > 0 && isdigit(cp[1]); slen--) \ ! { v = v * 10 + (*++cp - '0'); } ! for (; slen-- > 0; cp++) { int sustain, timeval, tempo; register char c = toupper(*cp); *************** *** 277,289 **** pitch = notetab[c - 'A'] + octave * OCTAVE_NOTES; /* this may be followed by an accidental sign */ ! if (cp[1] == '#' || cp[1] == '+') { ++pitch; ++cp; slen--; } ! else if (cp[1] == '-') { --pitch; ++cp; --- 278,290 ---- pitch = notetab[c - 'A'] + octave * OCTAVE_NOTES; /* this may be followed by an accidental sign */ ! if (slen > 0 && (cp[1] == '#' || cp[1] == '+')) { ++pitch; ++cp; slen--; } ! else if (slen > 0 && cp[1] == '-') { --pitch; ++cp; *************** *** 318,324 **** timeval = value; /* ...and/or sustain dots */ ! for (sustain = 0; cp[1] == '.'; cp++) { slen--; sustain++; --- 319,325 ---- timeval = value; /* ...and/or sustain dots */ ! for (sustain = 0; slen > 0 && cp[1] == '.'; cp++) { slen--; sustain++; *************** *** 326,332 **** /* ...and/or a slur mark */ oldfill = fill; ! if (cp[1] == '_') { fill = LEGATO; ++cp; --- 327,333 ---- /* ...and/or a slur mark */ oldfill = fill; ! if (slen > 0 && cp[1] == '_') { fill = LEGATO; ++cp; *************** *** 340,352 **** break; case 'O': ! if (cp[1] == 'N' || cp[1] == 'n') { octprefix = octtrack = FALSE; ++cp; slen--; } ! else if (cp[1] == 'L' || cp[1] == 'l') { octtrack = TRUE; ++cp; --- 341,353 ---- break; case 'O': ! if (slen > 0 && (cp[1] == 'N' || cp[1] == 'n')) { octprefix = octtrack = FALSE; ++cp; slen--; } ! else if (slen > 0 && (cp[1] == 'L' || cp[1] == 'l')) { octtrack = TRUE; ++cp; *************** *** 375,387 **** case 'N': GETNUM(cp, pitch); ! for (sustain = 0; cp[1] == '.'; cp++) { slen--; sustain++; } oldfill = fill; ! if (cp[1] == '_') { fill = LEGATO; ++cp; --- 376,388 ---- case 'N': GETNUM(cp, pitch); ! for (sustain = 0; slen > 0 && cp[1] == '.'; cp++) { slen--; sustain++; } oldfill = fill; ! if (slen > 0 && cp[1] == '_') { fill = LEGATO; ++cp; *************** *** 403,409 **** GETNUM(cp, timeval); if (timeval <= 0 || timeval > MIN_VALUE) timeval = value; ! for (sustain = 0; cp[1] == '.'; cp++) { slen--; sustain++; --- 404,410 ---- GETNUM(cp, timeval); if (timeval <= 0 || timeval > MIN_VALUE) timeval = value; ! for (sustain = 0; slen > 0 && cp[1] == '.'; cp++) { slen--; sustain++; *************** *** 419,437 **** break; case 'M': ! if (cp[1] == 'N' || cp[1] == 'n') { fill = NORMAL; ++cp; slen--; } ! else if (cp[1] == 'L' || cp[1] == 'l') { fill = LEGATO; ++cp; slen--; } ! else if (cp[1] == 'S' || cp[1] == 's') { fill = STACCATO; ++cp; --- 420,438 ---- break; case 'M': ! if (slen > 0 && (cp[1] == 'N' || cp[1] == 'n')) { fill = NORMAL; ++cp; slen--; } ! else if (slen > 0 && (cp[1] == 'L' || cp[1] == 'l')) { fill = LEGATO; ++cp; slen--; } ! else if (slen > 0 && (cp[1] == 'S' || cp[1] == 's')) { fill = STACCATO; ++cp; -- ikuo@intec.co.jp