diff --git a/src/include/switch_bitpack.h b/src/include/switch_bitpack.h index 76a8b90147..a518b4eb39 100644 --- a/src/include/switch_bitpack.h +++ b/src/include/switch_bitpack.h @@ -75,7 +75,7 @@ static const int8_t SWITCH_REVERSE_BITPACKED_MASKS[] = {255, 254, 252, 248, 240, \param mode RFC3551 or AAL2 mode (curse you backwards folks) */ DoxyDefine(void switch_bitpack_init(switch_bitpack_t *pack, int32_t bitlen, switch_byte_t *buf, uint32_t buflen, switch_bitpack_mode_t mode)) -static inline void switch_bitpack_init(switch_bitpack_t *pack, int32_t bitlen, switch_byte_t *buf, uint32_t buflen, switch_bitpack_mode_t mode) +static inline void switch_bitpack_init(switch_bitpack_t *pack, switch_byte_t bitlen, switch_byte_t *buf, uint32_t buflen, switch_bitpack_mode_t mode) { memset(pack, 0, sizeof(*pack)); memset(buf, 0, buflen); @@ -147,7 +147,7 @@ static inline int8_t switch_bitpack_out(switch_bitpack_t *unpack, switch_byte_t { switch_byte_t this_byte; - if (unpack->cur - unpack->buf > unpack->buflen) { + if ((uint32_t)(unpack->cur - unpack->buf) > unpack->buflen) { return -1; } @@ -218,14 +218,14 @@ static inline int8_t switch_bitpack_in(switch_bitpack_t *pack, switch_byte_t in) { int next = pack->bits_cur + pack->frame_bits; - if (pack->cur - pack->buf > pack->buflen) { + if ((uint32_t)(pack->cur - pack->buf) > pack->buflen) { return -1; } pack->bits_tot += pack->frame_bits; if (next > SWITCH_BITS_PER_BYTE) { - int a = 0, b = 0, rem, nxt; + switch_byte_t a = 0, b = 0, rem, nxt; rem = SWITCH_BITS_PER_BYTE - pack->bits_cur; nxt = pack->frame_bits - rem ; if (pack->mode == SWITCH_BITPACK_MODE_RFC3551) { diff --git a/src/mod/codecs/mod_g726/mod_g726.c b/src/mod/codecs/mod_g726/mod_g726.c index 7e7749e479..0ef166d591 100644 --- a/src/mod/codecs/mod_g726/mod_g726.c +++ b/src/mod/codecs/mod_g726/mod_g726.c @@ -193,7 +193,7 @@ static switch_status_t switch_g726_decode(switch_codec_t *codec, switch_bitpack_out(&handle->unpack, in[z++]); } for(y = 0; y < handle->bytes; y++) { - *ddp++ = handle->decoder(handle->buf[y], AUDIO_ENCODING_LINEAR, context); + *ddp++ = (int16_t) handle->decoder(handle->buf[y], AUDIO_ENCODING_LINEAR, context); new_len += 2; } switch_bitpack_done(&handle->unpack);