From 9fbcec0f33b62362aa01e6b8a785995c55954bd1 Mon Sep 17 00:00:00 2001 From: Shohei Urabe Date: Sun, 17 Oct 2004 22:48:29 +0000 Subject: [PATCH] fix division by zero --- ChangeLog | 10 ++++++++-- libunimod/mlutil.c | 1 + timidity/mod2midi.c | 6 +++--- 3 files changed, 12 insertions(+), 5 deletions(-) diff --git a/ChangeLog b/ChangeLog index 5d2e893d..f5539ed7 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,7 +1,13 @@ +2004-10-18 Eric A. Welsh + + * libunimod/mlutil.c (getAmigaPeriod): Avoid division by zero + * timidity/mod2midi.c: Change all VERB_NORMAL and VERB_VERBOSE + messages to VERB_NOISY. + 2004-10-17 URABE Shyouhei - * libunimod/mloader.c (SL_LoadSamples): - too many arguments to function `FreeSampleList' + * libunimod/mloader.c (SL_LoadSamples): too many arguments to + function `FreeSampleList' * timidity/common.c, timidiyt/timidiyt.c: avoid confliction of time.h and sys/time.h * timidity/aq.c: fix wrong prototype (int -> void) diff --git a/libunimod/mlutil.c b/libunimod/mlutil.c index 3fc944dd..ea667ce0 100644 --- a/libunimod/mlutil.c +++ b/libunimod/mlutil.c @@ -321,6 +321,7 @@ ULONG getAmigaPeriod (UBYTE flags, ULONG period) if (flags & UF_LINEAR) { period = lintab[period % 768] >> (period / 768); + if (period < 1) period = 1; period = (8363L * 1712L) / period; } diff --git a/timidity/mod2midi.c b/timidity/mod2midi.c index 72c02931..dd534d77 100644 --- a/timidity/mod2midi.c +++ b/timidity/mod2midi.c @@ -195,7 +195,7 @@ period2note (int period, int *finetune) if (period < 14 || period > 13696) { - ctl->cmsg(CMSG_WARNING, VERB_NORMAL, "BAD period %d\n", period); + ctl->cmsg(CMSG_WARNING, VERB_NOISY, "BAD period %d\n", period); return -1; } @@ -278,7 +278,7 @@ Voice_SetPeriod (UBYTE v, ULONG period) if (new_noteon < 0) { - ctl->cmsg(CMSG_WARNING, VERB_VERBOSE, + ctl->cmsg(CMSG_WARNING, VERB_NOISY, "Strange period %d", ModV[v].period); return; @@ -332,7 +332,7 @@ Voice_Play (UBYTE v, SAMPLE * s, ULONG start) new_noteon = period2note (ModV[v].period, &bend); bend = WHEEL_VALUE(bend); if (new_noteon < 0) { - ctl->cmsg(CMSG_WARNING, VERB_VERBOSE, + ctl->cmsg(CMSG_WARNING, VERB_NOISY, "Strange period %d", ModV[v].period); return; -- 2.11.0