diff options
author | Jean-Marc Valin <jean-marc.valin@octasic.com> | 2009-04-08 22:42:28 +0400 |
---|---|---|
committer | Jean-Marc Valin <jean-marc.valin@octasic.com> | 2009-04-08 22:42:28 +0400 |
commit | 5647f1411babe01b274449814f48b1d28d56c8fb (patch) | |
tree | f8d33c76f5ea318ea2e51eae99c9adf891cc3961 /libspeex | |
parent | b9534638a51b37dd2aaf592ffa45deff307a9f9f (diff) |
Fixed a "conditional jump depends on uninitialised value in speex_decode_int()
even though it wasn't an actual bug.
Diffstat (limited to 'libspeex')
-rw-r--r-- | libspeex/speex.c | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/libspeex/speex.c b/libspeex/speex.c index b425155..dd384c8 100644 --- a/libspeex/speex.c +++ b/libspeex/speex.c @@ -162,14 +162,17 @@ EXPORT int speex_decode_int(void *state, SpeexBits *bits, spx_int16_t *out) int ret; speex_decoder_ctl(state, SPEEX_GET_FRAME_SIZE, &N); ret = (*((SpeexMode**)state))->dec(state, bits, float_out); - for (i=0;i<N;i++) + if (ret == 0) { - if (float_out[i]>32767.f) - out[i] = 32767; - else if (float_out[i]<-32768.f) - out[i] = -32768; - else - out[i] = (spx_int16_t)floor(.5+float_out[i]); + for (i=0;i<N;i++) + { + if (float_out[i]>32767.f) + out[i] = 32767; + else if (float_out[i]<-32768.f) + out[i] = -32768; + else + out[i] = (spx_int16_t)floor(.5+float_out[i]); + } } return ret; } |