From ecc62d8706ad4ed7768cde31dcd4476b4d2389a9 Mon Sep 17 00:00:00 2001 From: Dario Lombardo Date: Fri, 4 Sep 2015 17:12:25 +0200 Subject: codecs/gtk: fix int to size_t Change-Id: I8f467f09375c8227c4b70aef47ff3a590a0c00d7 Reviewed-on: https://code.wireshark.org/review/10413 Petri-Dish: Anders Broman Tested-by: Petri Dish Buildbot Reviewed-by: Guy Harris --- codecs/G711a/G711adecode.c | 12 ++++++------ codecs/G711a/G711adecode.h | 8 ++++---- codecs/G711u/G711udecode.c | 12 ++++++------ codecs/G711u/G711udecode.h | 8 ++++---- codecs/codecs.c | 7 ++++--- codecs/codecs.h | 16 ++++++++-------- codecs/sbc/sbc.c | 14 +++++++------- codecs/sbc/sbc_private.h | 8 ++++---- 8 files changed, 43 insertions(+), 42 deletions(-) (limited to 'codecs') diff --git a/codecs/G711a/G711adecode.c b/codecs/G711a/G711adecode.c index 6d31657973..2ed2436058 100644 --- a/codecs/G711a/G711adecode.c +++ b/codecs/G711a/G711adecode.c @@ -39,25 +39,25 @@ codec_g711a_release(void *ctx _U_) } -int +unsigned codec_g711a_get_channels(void *ctx _U_) { return 1; } -int +unsigned codec_g711a_get_frequency(void *ctx _U_) { return 8000; } -int -codec_g711a_decode(void *ctx _U_, const void *input, int inputSizeBytes, void *output, - int *outputSizeBytes) +size_t +codec_g711a_decode(void *ctx _U_, const void *input, size_t inputSizeBytes, void *output, + size_t *outputSizeBytes) { const guint8 *dataIn = (const guint8 *) input; gint16 *dataOut = (gint16 *) output; - int i; + size_t i; if (!output || !outputSizeBytes) { return inputSizeBytes * 2; diff --git a/codecs/G711a/G711adecode.h b/codecs/G711a/G711adecode.h index d89d166217..a1a57c2580 100644 --- a/codecs/G711a/G711adecode.h +++ b/codecs/G711a/G711adecode.h @@ -25,10 +25,10 @@ void *codec_g711a_init(void); void codec_g711a_release(void *ctx); -int codec_g711a_get_channels(void *ctx); -int codec_g711a_get_frequency(void *ctx); -int codec_g711a_decode(void *ctx, const void *input, int inputSizeBytes, void *output, - int *outputSizeBytes); +unsigned codec_g711a_get_channels(void *ctx); +unsigned codec_g711a_get_frequency(void *ctx); +size_t codec_g711a_decode(void *ctx, const void *input, size_t inputSizeBytes, void *output, + size_t *outputSizeBytes); #endif /* G711adecode.h */ diff --git a/codecs/G711u/G711udecode.c b/codecs/G711u/G711udecode.c index 8399195d6e..8db44bed12 100644 --- a/codecs/G711u/G711udecode.c +++ b/codecs/G711u/G711udecode.c @@ -39,25 +39,25 @@ codec_g711u_release(void *ctx _U_) } -int +unsigned codec_g711u_get_channels(void *ctx _U_) { return 1; } -int +unsigned codec_g711u_get_frequency(void *ctx _U_) { return 8000; } -int -codec_g711u_decode(void *ctx _U_, const void *input, int inputSizeBytes, void *output, - int *outputSizeBytes) +size_t +codec_g711u_decode(void *ctx _U_, const void *input, size_t inputSizeBytes, void *output, + size_t *outputSizeBytes) { const guint8 *dataIn = (const guint8 *) input; gint16 *dataOut = (gint16 *) output; - int i; + size_t i; if (!output || !outputSizeBytes) { return inputSizeBytes * 2; diff --git a/codecs/G711u/G711udecode.h b/codecs/G711u/G711udecode.h index a0a7ad0a4e..08e086de59 100644 --- a/codecs/G711u/G711udecode.h +++ b/codecs/G711u/G711udecode.h @@ -25,10 +25,10 @@ void *codec_g711u_init(void); void codec_g711u_release(void *ctx); -int codec_g711u_get_channels(void *ctx); -int codec_g711u_get_frequency(void *ctx); -int codec_g711u_decode(void *ctx, const void *input, int inputSizeBytes, void *output, - int *outputSizeBytes); +unsigned codec_g711u_get_channels(void *ctx); +unsigned codec_g711u_get_frequency(void *ctx); +size_t codec_g711u_decode(void *ctx, const void *input, size_t inputSizeBytes, void *output, + size_t *outputSizeBytes); #endif /* G711udecode.h */ diff --git a/codecs/codecs.c b/codecs/codecs.c index 07a183ff7a..f7921eade2 100644 --- a/codecs/codecs.c +++ b/codecs/codecs.c @@ -93,6 +93,7 @@ register_codec_plugin(gpointer data, gpointer user_data _U_) (plugin->register_codec_module)(); } + /* * For all codec plugins, call their register routines. */ @@ -180,19 +181,19 @@ void codec_release(codec_handle_t codec, void *context) (codec->release_fn)(context); } -int codec_get_channels(codec_handle_t codec, void *context) +unsigned codec_get_channels(codec_handle_t codec, void *context) { if (!codec) return 0; return (codec->channels_fn)(context); } -int codec_get_frequency(codec_handle_t codec, void *context) +unsigned codec_get_frequency(codec_handle_t codec, void *context) { if (!codec) return 0; return (codec->frequency_fn)(context); } -int codec_decode(codec_handle_t codec, void *context, const void *input, int inputSizeBytes, void *output, int *outputSizeBytes) +size_t codec_decode(codec_handle_t codec, void *context, const void *input, size_t inputSizeBytes, void *output, size_t *outputSizeBytes) { if (!codec) return 0; return (codec->decode_fn)(context, input, inputSizeBytes, output, outputSizeBytes); diff --git a/codecs/codecs.h b/codecs/codecs.h index 80d0d71e2f..7ba918ac30 100644 --- a/codecs/codecs.h +++ b/codecs/codecs.h @@ -42,10 +42,10 @@ typedef struct codec_handle *codec_handle_t; typedef void *(*codec_init_fn)(void); typedef void (*codec_release_fn)(void *context); -typedef int (*codec_get_channels_fn)(void *context); -typedef int (*codec_get_frequency_fn)(void *context); -typedef int (*codec_decode_fn)(void *context, const void *input, int inputSizeBytes, - void *output, int *outputSizeBytes); +typedef unsigned (*codec_get_channels_fn)(void *context); +typedef unsigned (*codec_get_frequency_fn)(void *context); +typedef size_t (*codec_decode_fn)(void *context, const void *input, size_t inputSizeBytes, + void *output, size_t *outputSizeBytes); extern gboolean register_codec(const char *name, codec_init_fn init_fn, codec_release_fn release_fn, codec_get_channels_fn channels_fn, @@ -53,10 +53,10 @@ extern gboolean register_codec(const char *name, codec_init_fn init_fn, extern codec_handle_t find_codec(const char *name); extern void *codec_init(codec_handle_t codec); extern void codec_release(codec_handle_t codec, void *context); -extern int codec_get_channels(codec_handle_t codec, void *context); -extern int codec_get_frequency(codec_handle_t codec, void *context); -extern int codec_decode(codec_handle_t codec, void *context, const void *input, - int inputSizeBytes, void *output, int *outputSizeBytes); +extern unsigned codec_get_channels(codec_handle_t codec, void *context); +extern unsigned codec_get_frequency(codec_handle_t codec, void *context); +extern size_t codec_decode(codec_handle_t codec, void *context, const void *input, + size_t inputSizeBytes, void *output, size_t *outputSizeBytes); #ifdef __cplusplus } diff --git a/codecs/sbc/sbc.c b/codecs/sbc/sbc.c index dea07dc1a9..1fa1b69508 100644 --- a/codecs/sbc/sbc.c +++ b/codecs/sbc/sbc.c @@ -53,7 +53,7 @@ codec_sbc_release(void *ctx) g_free(sbc); } -int +unsigned codec_sbc_get_channels(void *ctx) { sbc_t *sbc = (sbc_t *) ctx; @@ -63,7 +63,7 @@ codec_sbc_get_channels(void *ctx) return 2; } -int +unsigned codec_sbc_get_frequency(void *ctx) { sbc_t *sbc = (sbc_t *) ctx; @@ -92,15 +92,15 @@ codec_sbc_get_frequency(void *ctx) return frequency; } -int -codec_sbc_decode(void *ctx, const void *input, int inputSizeBytes, void *output, - int *outputSizeBytes) +size_t +codec_sbc_decode(void *ctx, const void *input, size_t inputSizeBytes, void *output, + size_t *outputSizeBytes) { size_t size_in = (size_t) inputSizeBytes; size_t size_out = SBC_BUFFER; size_t len; - int framelen; - int xframe_pos = 0; + size_t framelen; + size_t xframe_pos = 0; const guint8 *data_in = (const guint8 *) input; guint8 *data_out = (guint8 *) output; sbc_t *sbc = (sbc_t *) ctx; diff --git a/codecs/sbc/sbc_private.h b/codecs/sbc/sbc_private.h index 10e63ca360..d2e4ab85a3 100644 --- a/codecs/sbc/sbc_private.h +++ b/codecs/sbc/sbc_private.h @@ -27,10 +27,10 @@ void *codec_sbc_init(void); void codec_sbc_release(void *ctx); -int codec_sbc_get_channels(void *ctx); -int codec_sbc_get_frequency(void *ctx); -int codec_sbc_decode(void *ctx, const void *input, int inputSizeBytes, void *output, - int *outputSizeBytes); +unsigned codec_sbc_get_channels(void *ctx); +unsigned codec_sbc_get_frequency(void *ctx); +size_t codec_sbc_decode(void *ctx, const void *input, size_t inputSizeBytes, void *output, + size_t *outputSizeBytes); #endif /* sbc.h */ -- cgit v1.2.1