Prevent two division by zeros and one problem causing a crash in the

mp3 metadata parser.


git-svn-id: svn://svn.rockbox.org/rockbox/trunk@9438 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Miika Pekkarinen 2006-04-02 20:19:00 +00:00
parent ea6b4cbe4f
commit 93b6a1d12c
3 changed files with 19 additions and 2 deletions

View file

@ -629,7 +629,10 @@ void dsp_set_eq_coefs(int band)
cutoff = 0xffffffff / NATIVE_FREQUENCY * (*setting++);
q = ((*setting++) << 16) / 10; /* 16.16 */
gain = ((*setting++) << 16) / 10; /* s15.16 */
if (q == 0)
q = 1;
/* The coef functions assume the EMAC unit is in fractional mode */
#if defined(CPU_COLDFIRE) && !defined(SIMULATOR)
/* set emac unit for dsp processing, and save old macsr, we're running in

View file

@ -2359,8 +2359,11 @@ static void mp3_set_elapsed(struct mp3entry* id3)
}
}
else
{
/* constant bitrate, use exact calculation */
id3->elapsed = id3->offset / (id3->bitrate / 8);
if (id3->bitrate != 0)
id3->elapsed = id3->offset / (id3->bitrate / 8);
}
}
/* Copied from mpeg.c. Should be moved somewhere else. */