mirror of
https://git.hardenedbsd.org/hardenedbsd/HardenedBSD.git
synced 2025-01-23 09:23:00 +01:00
Check for 0 before dividing by it. Patch from Paul Traina, modified
slightly by me.
This commit is contained in:
parent
c8911fa27e
commit
9714de6a38
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=8288
@ -4,7 +4,7 @@
|
||||
* 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.11 1995/02/03 10:19:38 ache Exp $
|
||||
* $Id: spkr.c,v 1.12 1995/03/16 18:12:05 bde Exp $
|
||||
*/
|
||||
|
||||
#include "speaker.h"
|
||||
@ -66,9 +66,14 @@ static void tone(thz, ticks)
|
||||
/* emit tone of frequency thz for given number of ticks */
|
||||
unsigned int thz, ticks;
|
||||
{
|
||||
unsigned int divisor = TIMER_CLK / thz;
|
||||
unsigned int divisor;
|
||||
int sps;
|
||||
|
||||
if (thz <= 0)
|
||||
return;
|
||||
|
||||
divisor = TIMER_CLK / thz;
|
||||
|
||||
#ifdef DEBUG
|
||||
(void) printf("tone: thz=%d ticks=%d\n", thz, ticks);
|
||||
#endif /* DEBUG */
|
||||
@ -201,6 +206,9 @@ int pitch, value, sustain;
|
||||
sdenom *= DENOM_MULT;
|
||||
}
|
||||
|
||||
if (value == 0 || sdenom == 0)
|
||||
return;
|
||||
|
||||
if (pitch == -1)
|
||||
rest(whole * snum / (value * sdenom));
|
||||
else
|
||||
|
@ -4,7 +4,7 @@
|
||||
* 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.11 1995/02/03 10:19:38 ache Exp $
|
||||
* $Id: spkr.c,v 1.12 1995/03/16 18:12:05 bde Exp $
|
||||
*/
|
||||
|
||||
#include "speaker.h"
|
||||
@ -66,9 +66,14 @@ static void tone(thz, ticks)
|
||||
/* emit tone of frequency thz for given number of ticks */
|
||||
unsigned int thz, ticks;
|
||||
{
|
||||
unsigned int divisor = TIMER_CLK / thz;
|
||||
unsigned int divisor;
|
||||
int sps;
|
||||
|
||||
if (thz <= 0)
|
||||
return;
|
||||
|
||||
divisor = TIMER_CLK / thz;
|
||||
|
||||
#ifdef DEBUG
|
||||
(void) printf("tone: thz=%d ticks=%d\n", thz, ticks);
|
||||
#endif /* DEBUG */
|
||||
@ -201,6 +206,9 @@ int pitch, value, sustain;
|
||||
sdenom *= DENOM_MULT;
|
||||
}
|
||||
|
||||
if (value == 0 || sdenom == 0)
|
||||
return;
|
||||
|
||||
if (pitch == -1)
|
||||
rest(whole * snum / (value * sdenom));
|
||||
else
|
||||
|
Loading…
Reference in New Issue
Block a user