diff options
author | Alfred E. Heggestad <aeh@db.org> | 2016-04-24 16:33:59 +0200 |
---|---|---|
committer | Alfred E. Heggestad <aeh@db.org> | 2016-04-24 16:33:59 +0200 |
commit | cf368a7cbe26dcf0a1383dae441be830a63e49cd (patch) | |
tree | a850518653106db1e835b9c1214bd78dcee9b9eb /modules | |
parent | 0179976c246f2dd18a340df21c68c90e23590b6a (diff) |
mpa: fix warnings on OSX
Diffstat (limited to 'modules')
-rw-r--r-- | modules/mpa/decode.c | 14 | ||||
-rw-r--r-- | modules/mpa/encode.c | 8 |
2 files changed, 12 insertions, 10 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); diff --git a/modules/mpa/encode.c b/modules/mpa/encode.c index 4e35ebe..85e8dd9 100644 --- a/modules/mpa/encode.c +++ b/modules/mpa/encode.c @@ -132,7 +132,7 @@ int mpa_encode_frm(struct auenc_state *aes, uint8_t *buf, size_t *len, return EINVAL; if (aes->resampler) { - in_len = sampc/2; + in_len = (uint32_t)sampc/2; intermediate_len = sizeof(aes->intermediate_buffer) / sizeof(aes->intermediate_buffer[0]); n=speex_resampler_process_interleaved_int(aes->resampler, @@ -145,7 +145,7 @@ int mpa_encode_frm(struct auenc_state *aes, uint8_t *buf, size_t *len, } n = twolame_encode_buffer_interleaved(aes->enc, aes->intermediate_buffer, intermediate_len, - buf+4, (*len)-4); + buf+4, (int)(*len)-4); #ifdef DEBUG debug("mpa encode %d %d %d %d %d\n",intermediate_len,sampc, aes->channels,*len,n); @@ -153,7 +153,7 @@ int mpa_encode_frm(struct auenc_state *aes, uint8_t *buf, size_t *len, } else n = twolame_encode_buffer_interleaved(aes->enc, sampv, - (int)(sampc/2), buf+4, (*len)-4); + (int)(sampc/2), buf+4, (int)(*len)-4); if (n < 0) { error("mpa: encode error: %s\n", strerror((int)n)); @@ -161,7 +161,7 @@ int mpa_encode_frm(struct auenc_state *aes, uint8_t *buf, size_t *len, } if (n > 0) { - *(uint32_t*)buf = 0; + *(uint32_t*)(void *)buf = 0; *len = n+4; } else |