summaryrefslogtreecommitdiff
path: root/modules/mpa/decode.c
diff options
context:
space:
mode:
authorAlfred E. Heggestad <aeh@db.org>2016-04-24 16:33:59 +0200
committerAlfred E. Heggestad <aeh@db.org>2016-04-24 16:33:59 +0200
commitcf368a7cbe26dcf0a1383dae441be830a63e49cd (patch)
treea850518653106db1e835b9c1214bd78dcee9b9eb /modules/mpa/decode.c
parent0179976c246f2dd18a340df21c68c90e23590b6a (diff)
mpa: fix warnings on OSX
Diffstat (limited to 'modules/mpa/decode.c')
-rw-r--r--modules/mpa/decode.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/modules/mpa/decode.c b/modules/mpa/decode.c
index d62bd60..8a68d29 100644
--- a/modules/mpa/decode.c
+++ b/modules/mpa/decode.c
@@ -113,13 +113,15 @@ int mpa_decode_frm(struct audec_state *ads, int16_t *sampv, size_t *sampc,
size_t n;
spx_uint32_t intermediate_len;
spx_uint32_t out_len;
+ uint32_t header;
if (!ads || !sampv || !sampc || !buf || len<=4)
return EINVAL;
- if(*(uint32_t*)buf != 0) {
+ header = *(uint32_t*)(void *)buf;
+ if (header != 0) {
error("MPA header is not zero %08X, not supported yet\n",
- *(uint32_t*)buf);
+ header);
return EPROTO;
}
@@ -128,9 +130,9 @@ int mpa_decode_frm(struct audec_state *ads, int16_t *sampv, size_t *sampc,
(unsigned char*)ads->intermediate_buffer,
sizeof(ads->intermediate_buffer), &n);
/* n counts bytes */
- intermediate_len = n / 2 / ads->channels;
+ intermediate_len = (uint32_t)(n / 2 / ads->channels);
/* intermediate_len counts samples per channel */
- out_len = *sampc;
+ out_len = (uint32_t)*sampc;
result=speex_resampler_process_interleaved_int(
ads->resampler, ads->intermediate_buffer,
&intermediate_len, sampv, &out_len);
@@ -159,7 +161,7 @@ int mpa_decode_frm(struct audec_state *ads, int16_t *sampv, size_t *sampc,
*sampc=0;
}
if (ads->channels==1) {
- for (i=*sampc-1;i>=0;i--)
+ for (i=(int)(*sampc-1); i>=0; i--)
sampv[i+i+1]=sampv[i+i]=sampv[i];
*sampc *= 2;
}
@@ -173,7 +175,7 @@ int mpa_decode_frm(struct audec_state *ads, int16_t *sampv, size_t *sampc,
ads->start = 0;
if (samplerate != 48000) {
ads->resampler = speex_resampler_init(channels,
- samplerate, 48000, 3, &result);
+ (uint32_t)samplerate, 48000, 3, &result);
if (result!=RESAMPLER_ERR_SUCCESS
|| ads->resampler==NULL) {
error("mpa: upsampler failed %d\n",result);