Date: Sat, 4 Nov 1995 17:36:42 +0900 (JST) From: ikuo@intec.co.jp To: bugs@freebsd.org Subject: bug in /sys/i386/isa/spkr.c Message-ID: <199511040836.RAA07428@potato.isl.intec.co.jp>
next in thread | raw e-mail | index | archive | help
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 <ache@astral.msk.su>
*
! * $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 <ache@astral.msk.su>
*
! * $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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199511040836.RAA07428>
