From c199053bcd6f8645e5be2b1edd4c2840039c78f2 Mon Sep 17 00:00:00 2001 From: Michael Jerris Date: Fri, 20 Feb 2009 21:21:48 +0000 Subject: [PATCH] cleanup msvc 2005 build warnings git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@12200 d0543943-73ff-0310-b7d9-9358b9ac24b2 --- libs/spandsp/src/complex_vector_int.c | 4 ++-- libs/spandsp/src/dds_int.c | 4 ++-- libs/spandsp/src/g722.c | 8 ++++---- libs/spandsp/src/lpc10_decode.c | 2 +- libs/spandsp/src/oki_adpcm.c | 8 ++++---- libs/spandsp/src/spandsp/complex.h | 8 ++++---- libs/spandsp/src/vector_int.c | 2 +- 7 files changed, 18 insertions(+), 18 deletions(-) diff --git a/libs/spandsp/src/complex_vector_int.c b/libs/spandsp/src/complex_vector_int.c index 1d8d0fb423..e614d4fede 100644 --- a/libs/spandsp/src/complex_vector_int.c +++ b/libs/spandsp/src/complex_vector_int.c @@ -123,8 +123,8 @@ SPAN_DECLARE(void) cvec_lmsi16(const complexi16_t x[], complexi16_t y[], int n, for (i = 0; i < n; i++) { - y[i].re += ((int32_t) x[i].im*(int32_t) error->im + (int32_t) x[i].re*(int32_t) error->re) >> 12; - y[i].im += ((int32_t) x[i].re*(int32_t) error->im - (int32_t) x[i].im*(int32_t) error->re) >> 12; + y[i].re = (int16_t)(y[i].re + (((int32_t) x[i].im*(int32_t) error->im + (int32_t) x[i].re*(int32_t) error->re) >> 12)); + y[i].im = (int16_t)(y[i].im + (((int32_t) x[i].re*(int32_t) error->im - (int32_t) x[i].im*(int32_t) error->re) >> 12)); } } /*- End of function --------------------------------------------------------*/ diff --git a/libs/spandsp/src/dds_int.c b/libs/spandsp/src/dds_int.c index 56902d6fe1..aebd844479 100644 --- a/libs/spandsp/src/dds_int.c +++ b/libs/spandsp/src/dds_int.c @@ -309,8 +309,8 @@ SPAN_DECLARE(complexi16_t) dds_complexi16_mod(uint32_t *phase_acc, int32_t phase { complexi16_t amp; - amp = complex_seti16(((int32_t) dds_lookup(*phase_acc + phase + (1 << 30))*(int32_t) scale) >> 15, - ((int32_t) dds_lookup(*phase_acc + phase)*(int32_t) scale) >> 15); + amp = complex_seti16((int16_t)(((int32_t) dds_lookup(*phase_acc + phase + (1 << 30))*(int32_t) scale) >> 15), + (int16_t)(((int32_t) dds_lookup(*phase_acc + phase)*(int32_t) scale) >> 15)); *phase_acc += phase_rate; return amp; } diff --git a/libs/spandsp/src/g722.c b/libs/spandsp/src/g722.c index eb3425c6ec..e51c4d96a6 100644 --- a/libs/spandsp/src/g722.c +++ b/libs/spandsp/src/g722.c @@ -214,7 +214,7 @@ static void block4(g722_band_t *s, int16_t dx) /* UPPOL1 */ wd1 = ((p ^ s->p[0]) & 0x8000) ? -192 : 192; - wd2 = ((int32_t) s->a[0]*(int32_t) 32640) >> 15; + wd2 = (int16_t)(((int32_t) s->a[0]*(int32_t) 32640) >> 15); ap[0] = saturated_add16(wd1, wd2); wd3 = saturated_sub16(15360, ap[1]); @@ -223,9 +223,9 @@ static void block4(g722_band_t *s, int16_t dx) /* FILTEP */ wd1 = saturated_add16(r, r); - wd1 = ((int32_t) ap[0]*(int32_t) wd1) >> 15; + wd1 = (int16_t)(((int32_t) ap[0]*(int32_t) wd1) >> 15); wd2 = saturated_add16(s->r, s->r); - wd2 = ((int32_t) ap[1]*(int32_t) wd2) >> 15; + wd2 = (int16_t)(((int32_t) ap[1]*(int32_t) wd2) >> 15); sp = saturated_add16(wd1, wd2); s->r = r; s->a[1] = ap[1]; @@ -242,7 +242,7 @@ static void block4(g722_band_t *s, int16_t dx) for (i = 5; i >= 0; i--) { wd2 = ((s->d[i + 1] ^ dx) & 0x8000) ? -wd1 : wd1; - wd3 = ((int32_t) s->b[i]*(int32_t) 32640) >> 15; + wd3 = (int16_t)(((int32_t) s->b[i]*(int32_t) 32640) >> 15); s->b[i] = saturated_add16(wd2, wd3); wd3 = saturated_add16(s->d[i], s->d[i]); sz += ((int32_t) s->b[i]*(int32_t) wd3) >> 15; diff --git a/libs/spandsp/src/lpc10_decode.c b/libs/spandsp/src/lpc10_decode.c index 88a88f404b..0cb54bfcd4 100644 --- a/libs/spandsp/src/lpc10_decode.c +++ b/libs/spandsp/src/lpc10_decode.c @@ -68,7 +68,7 @@ static int32_t lpc10_random(lpc10_decode_state_t *s) /* The following is a 16 bit 2's complement addition, with overflow checking disabled */ - s->y[s->k] += s->y[s->j]; + s->y[s->k] = (int16_t)(s->y[s->k] + s->y[s->j]); ret_val = s->y[s->k]; if (--s->k < 0) s->k = 4; diff --git a/libs/spandsp/src/oki_adpcm.c b/libs/spandsp/src/oki_adpcm.c index 787df3e322..d20f22f0fb 100644 --- a/libs/spandsp/src/oki_adpcm.c +++ b/libs/spandsp/src/oki_adpcm.c @@ -178,7 +178,7 @@ static int16_t decode(oki_adpcm_state_t *s, uint8_t adpcm) e += (ss >> 1); /*endif*/ if (adpcm & 0x04) - e += ss; + e = (int16_t)(e + ss); /*endif*/ if (adpcm & 0x08) e = -e; @@ -193,7 +193,7 @@ static int16_t decode(oki_adpcm_state_t *s, uint8_t adpcm) /*endif*/ s->last = linear; - s->step_index += step_adjustment[adpcm & 0x07]; + s->step_index = (int16_t)(s->step_index + step_adjustment[adpcm & 0x07]); if (s->step_index < 0) s->step_index = 0; else if (s->step_index > 48) @@ -222,13 +222,13 @@ static uint8_t encode(oki_adpcm_state_t *s, int16_t linear) if (e >= ss) { adpcm |= (uint8_t) 0x04; - e -= ss; + e = (int16_t)(e - ss); } /*endif*/ if (e >= (ss >> 1)) { adpcm |= (uint8_t) 0x02; - e -= ss; + e = (int16_t)(e - ss); } /*endif*/ if (e >= (ss >> 2)) diff --git a/libs/spandsp/src/spandsp/complex.h b/libs/spandsp/src/spandsp/complex.h index d1a6ec9658..955b1b1367 100644 --- a/libs/spandsp/src/spandsp/complex.h +++ b/libs/spandsp/src/spandsp/complex.h @@ -343,8 +343,8 @@ static __inline__ complexi16_t complex_muli16(const complexi16_t *x, const compl { complexi16_t z; - z.re = (int32_t) x->re*(int32_t) y->re - (int32_t) x->im*(int32_t) y->im; - z.im = (int32_t) x->re*(int32_t) y->im + (int32_t) x->im*(int32_t) y->re; + z.re = (int16_t)((int32_t) x->re*(int32_t) y->re - (int32_t) x->im*(int32_t) y->im); + z.im = (int16_t)((int32_t) x->re*(int32_t) y->im + (int32_t) x->im*(int32_t) y->re); return z; } /*- End of function --------------------------------------------------------*/ @@ -353,8 +353,8 @@ static __inline__ complexi16_t complex_mul_q1_15(const complexi16_t *x, const co { complexi16_t z; - z.re = ((int32_t) x->re*(int32_t) y->re - (int32_t) x->im*(int32_t) y->im) >> 15; - z.im = ((int32_t) x->re*(int32_t) y->im + (int32_t) x->im*(int32_t) y->re) >> 15; + z.re = (int16_t)(((int32_t) x->re*(int32_t) y->re - (int32_t) x->im*(int32_t) y->im) >> 15); + z.im = (int16_t)(((int32_t) x->re*(int32_t) y->im + (int32_t) x->im*(int32_t) y->re) >> 15); return z; } /*- End of function --------------------------------------------------------*/ diff --git a/libs/spandsp/src/vector_int.c b/libs/spandsp/src/vector_int.c index 09e057a6f3..17d5883a4d 100644 --- a/libs/spandsp/src/vector_int.c +++ b/libs/spandsp/src/vector_int.c @@ -300,7 +300,7 @@ SPAN_DECLARE(void) vec_lmsi16(const int16_t x[], int16_t y[], int n, int16_t err int i; for (i = 0; i < n; i++) - y[i] += ((int32_t) x[i]*(int32_t) error) >> 15; + y[i] = (int16_t) (y[i] + (((int32_t) x[i]*(int32_t) error) >> 15)); } /*- End of function --------------------------------------------------------*/