aboutsummaryrefslogtreecommitdiffstats
path: root/codecs
diff options
context:
space:
mode:
authorGerald Combs <gerald@wireshark.org>2015-10-02 13:23:08 -0700
committerGerald Combs <gerald@wireshark.org>2015-10-02 20:25:01 +0000
commit93d8bbd586c1d6b919d3e4911aca5a9b9b3275de (patch)
treebd921f5d84506cda68c2a280e9a6f9be91f56d5a /codecs
parentbe41ebccfe079b5f3777c6f2e805b86deae131b7 (diff)
Add casts to the speex resampler.
Try to fix speex/resample.c:294: warning: implicit conversion shortens 64-bit value into a 32-bit value speex/resample.c:294: warning: implicit conversion shortens 64-bit value into a 32-bit value speex/resample.c:324: warning: implicit conversion shortens 64-bit value into a 32-bit value speex/resample.c:419: warning: implicit conversion shortens 64-bit value into a 32-bit value speex/resample.c:536: warning: implicit conversion shortens 64-bit value into a 32-bit value speex/resample.c:632: warning: implicit conversion shortens 64-bit value into a 32-bit value speex/resample.c:638: warning: implicit conversion shortens 64-bit value into a 32-bit value speex/resample.c:645: warning: implicit conversion shortens 64-bit value into a 32-bit value speex/resample.c:697: warning: implicit conversion shortens 64-bit value into a 32-bit value speex/resample.c:699: warning: implicit conversion shortens 64-bit value into a 32-bit value speex/resample.c:817: warning: implicit conversion shortens 64-bit value into a 32-bit value speex/resample.c:818: warning: implicit conversion shortens 64-bit value into a 32-bit value speex/resample.c:819: warning: implicit conversion shortens 64-bit value into a 32-bit value on the 64-bit OS X builder. Change-Id: Ifad32f5cd6ffe1186c8f9db593cc1c34e67357ce Reviewed-on: https://code.wireshark.org/review/10752 Reviewed-by: Gerald Combs <gerald@wireshark.org>
Diffstat (limited to 'codecs')
-rw-r--r--codecs/speex/arch.h4
-rw-r--r--codecs/speex/resample.c14
2 files changed, 9 insertions, 9 deletions
diff --git a/codecs/speex/arch.h b/codecs/speex/arch.h
index c2de991dd9..225315d66b 100644
--- a/codecs/speex/arch.h
+++ b/codecs/speex/arch.h
@@ -161,7 +161,7 @@ typedef float spx_word32_t;
#define SHR32(a,shift) (a)
#define SHL32(a,shift) (a)
#define PSHR16(a,shift) (a)
-#define PSHR32(a,shift) (a)
+#define PSHR32(a,shift) ((spx_word16_t)(a))
#define VSHR32(a,shift) (a)
#define SATURATE16(x,a) (x)
#define SATURATE32(x,a) (x)
@@ -183,7 +183,7 @@ typedef float spx_word32_t;
#define MULT16_32_Q11(a,b) ((a)*(b))
#define MULT16_32_Q13(a,b) ((a)*(b))
#define MULT16_32_Q14(a,b) ((a)*(b))
-#define MULT16_32_Q15(a,b) ((a)*(b))
+#define MULT16_32_Q15(a,b) ((spx_word32_t)((a)*(b)))
#define MULT16_32_P15(a,b) ((a)*(b))
#define MAC16_32_Q11(c,a,b) ((c)+(a)*(b))
diff --git a/codecs/speex/resample.c b/codecs/speex/resample.c
index c5f663432b..1faf88b0bd 100644
--- a/codecs/speex/resample.c
+++ b/codecs/speex/resample.c
@@ -64,8 +64,8 @@
#ifdef OUTSIDE_SPEEX
#include <stdlib.h>
-static void *speex_alloc (int size) {return calloc(size,1);}
-static void *speex_realloc (void *ptr, int size) {return realloc(ptr, size);}
+static void *speex_alloc (size_t size) {return calloc(size,1);}
+static void *speex_realloc (void *ptr, size_t size) {return realloc(ptr, size);}
static void speex_free (void *ptr) {free(ptr);}
#include "speex_resampler.h"
#include "arch.h"
@@ -291,7 +291,7 @@ static spx_word16_t sinc(float cutoff, float x, int N, const struct FuncDef *win
else if (fabs(x) > .5*N)
return 0;
/*FIXME: Can it really be any slower than this? */
- return cutoff*sin(M_PI*xx)/(M_PI*xx) * compute_func(fabs(2.*x/N), window_func);
+ return (spx_word16_t)(cutoff*sin(M_PI*xx)/(M_PI*xx) * compute_func((float)fabs(2.*x/N), window_func));
}
#endif
@@ -321,7 +321,7 @@ static void cubic_coef(spx_word16_t frac, spx_word16_t interp[4])
/*interp[2] = 1.f - 0.5f*frac - frac*frac + 0.5f*frac*frac*frac;*/
interp[3] = -0.33333f*frac + 0.5f*frac*frac - 0.16667f*frac*frac*frac;
/* Just to make sure we don't have rounding problems */
- interp[2] = 1.-interp[0]-interp[1]-interp[3];
+ interp[2] = (spx_word16_t)(1.-interp[0]-interp[1]-interp[3]);
}
#endif
@@ -629,13 +629,13 @@ static int update_filter(SpeexResamplerState *st)
goto fail;
#else
use_direct = st->filt_len*st->den_rate <= st->filt_len*st->oversample+8
- && INT_MAX/sizeof(spx_word16_t)/st->den_rate >= st->filt_len;
+ && INT_MAX/(spx_uint32_t)sizeof(spx_word16_t)/st->den_rate >= st->filt_len;
#endif
if (use_direct)
{
min_sinc_table_length = st->filt_len*st->den_rate;
} else {
- if ((INT_MAX/sizeof(spx_word16_t)-8)/st->oversample < st->filt_len)
+ if ((INT_MAX/(spx_uint32_t)sizeof(spx_word16_t)-8)/st->oversample < st->filt_len)
goto fail;
min_sinc_table_length = st->filt_len*st->oversample+8;
@@ -694,7 +694,7 @@ static int update_filter(SpeexResamplerState *st)
if (min_alloc_size > st->mem_alloc_size)
{
spx_word16_t *mem;
- if (INT_MAX/sizeof(spx_word16_t)/st->nb_channels < min_alloc_size)
+ if (INT_MAX/(spx_uint32_t)sizeof(spx_word16_t)/st->nb_channels < min_alloc_size)
goto fail;
else if (!(mem = (spx_word16_t*)speex_realloc(st->mem, st->nb_channels*min_alloc_size * sizeof(*mem))))
goto fail;