From f102ac7a8c62491761b7b3d32baa87dcb665f9ed Mon Sep 17 00:00:00 2001 From: reimar Date: Fri, 1 Jan 2010 13:18:49 +0000 Subject: [PATCH] Fix function declarations to avoid casting function pointers. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@30164 b3059339-0415-0410-9bf9-f77b7e298cf2 --- libao2/ao_alsa.c | 5 +++-- libao2/ao_dart.c | 2 +- libvo/vo_gl.c | 10 +++++----- libvo/vo_gl2.c | 2 +- libvo/vo_ivtv.c | 2 +- libvo/vo_jpeg.c | 11 ++++++----- libvo/vo_png.c | 5 +++-- libvo/vo_pnm.c | 2 +- libvo/vo_v4l2.c | 2 +- libvo/vo_xv.c | 4 ++-- libvo/vo_xvmc.c | 4 ++-- libvo/vo_zr2.c | 10 ++++++---- subopt-helper.c | 6 ++++-- subopt-helper.h | 4 ++-- 14 files changed, 38 insertions(+), 31 deletions(-) diff --git a/libao2/ao_alsa.c b/libao2/ao_alsa.c index 7376c0f18d..ba49231b28 100644 --- a/libao2/ao_alsa.c +++ b/libao2/ao_alsa.c @@ -263,7 +263,8 @@ static void print_help (void) MSGTR_AO_ALSA_CommandlineHelp); } -static int str_maxlen(strarg_t *str) { +static int str_maxlen(void *strp) { + strarg_t *str = strp; if (str->len > ALSA_DEVICE_SIZE) return 0; return 1; @@ -328,7 +329,7 @@ static int init(int rate_hz, int channels, int format, int flags) snd_pcm_uframes_t boundary; const opt_t subopts[] = { {"block", OPT_ARG_BOOL, &block, NULL}, - {"device", OPT_ARG_STR, &device, (opt_test_f)str_maxlen}, + {"device", OPT_ARG_STR, &device, str_maxlen}, {NULL} }; diff --git a/libao2/ao_dart.c b/libao2/ao_dart.c index 58ee4d1886..e1df7d32f7 100644 --- a/libao2/ao_dart.c +++ b/libao2/ao_dart.c @@ -148,7 +148,7 @@ static int init(int rate, int channels, int format, int flags) const opt_t subopts[] = { {"share", OPT_ARG_BOOL, &fShare, NULL}, - {"bufsize", OPT_ARG_INT, &nDartSamples, (opt_test_f)int_non_neg}, + {"bufsize", OPT_ARG_INT, &nDartSamples, int_non_neg}, {NULL} }; diff --git a/libvo/vo_gl.c b/libvo/vo_gl.c index 51e5b0fb03..071fccebb2 100644 --- a/libvo/vo_gl.c +++ b/libvo/vo_gl.c @@ -1012,12 +1012,12 @@ static const opt_t subopts[] = { {"scaled-osd", OPT_ARG_BOOL, &scaled_osd, NULL}, {"aspect", OPT_ARG_BOOL, &use_aspect, NULL}, {"ycbcr", OPT_ARG_BOOL, &use_ycbcr, NULL}, - {"slice-height", OPT_ARG_INT, &slice_height, (opt_test_f)int_non_neg}, - {"rectangle", OPT_ARG_INT, &use_rectangle,(opt_test_f)int_non_neg}, - {"yuv", OPT_ARG_INT, &use_yuv, (opt_test_f)int_non_neg}, + {"slice-height", OPT_ARG_INT, &slice_height, int_non_neg}, + {"rectangle", OPT_ARG_INT, &use_rectangle,int_non_neg}, + {"yuv", OPT_ARG_INT, &use_yuv, int_non_neg}, {"colorspace", OPT_ARG_INT, &colorspace, valid_csp}, - {"lscale", OPT_ARG_INT, &lscale, (opt_test_f)int_non_neg}, - {"cscale", OPT_ARG_INT, &cscale, (opt_test_f)int_non_neg}, + {"lscale", OPT_ARG_INT, &lscale, int_non_neg}, + {"cscale", OPT_ARG_INT, &cscale, int_non_neg}, {"filter-strength", OPT_ARG_FLOAT, &filter_strength, NULL}, {"ati-hack", OPT_ARG_BOOL, &ati_hack, NULL}, {"force-pbo", OPT_ARG_BOOL, &force_pbo, NULL}, diff --git a/libvo/vo_gl2.c b/libvo/vo_gl2.c index 626da44c2a..b65acf589c 100644 --- a/libvo/vo_gl2.c +++ b/libvo/vo_gl2.c @@ -853,7 +853,7 @@ uninit(void) } static const opt_t subopts[] = { - {"yuv", OPT_ARG_INT, &use_yuv, (opt_test_f)int_non_neg}, + {"yuv", OPT_ARG_INT, &use_yuv, int_non_neg}, {"glfinish", OPT_ARG_BOOL, &use_glFinish, NULL}, {NULL} }; diff --git a/libvo/vo_ivtv.c b/libvo/vo_ivtv.c index e62308722a..8c79bf4041 100644 --- a/libvo/vo_ivtv.c +++ b/libvo/vo_ivtv.c @@ -60,7 +60,7 @@ static int output = -1; static char *device = NULL; static const opt_t subopts[] = { - {"output", OPT_ARG_INT, &output, (opt_test_f)int_non_neg}, + {"output", OPT_ARG_INT, &output, int_non_neg}, {"device", OPT_ARG_MSTRZ, &device, NULL}, {NULL} }; diff --git a/libvo/vo_jpeg.c b/libvo/vo_jpeg.c index 72cb2a5b22..5f9a5d1f6d 100644 --- a/libvo/vo_jpeg.c +++ b/libvo/vo_jpeg.c @@ -330,8 +330,9 @@ static void check_events(void) /** \brief Validation function for values [0-100] */ -static int int_zero_hundred(int *val) +static int int_zero_hundred(void *valp) { + int *val = valp; if ( (*val >=0) && (*val<=100) ) return 1; return 0; @@ -343,15 +344,15 @@ static int preinit(const char *arg) {"progressive", OPT_ARG_BOOL, &jpeg_progressive_mode, NULL}, {"baseline", OPT_ARG_BOOL, &jpeg_baseline, NULL}, {"optimize", OPT_ARG_INT, &jpeg_optimize, - (opt_test_f)int_zero_hundred}, + int_zero_hundred}, {"smooth", OPT_ARG_INT, &jpeg_smooth, - (opt_test_f)int_zero_hundred}, + int_zero_hundred}, {"quality", OPT_ARG_INT, &jpeg_quality, - (opt_test_f)int_zero_hundred}, + int_zero_hundred}, {"dpi", OPT_ARG_INT, &jpeg_dpi, NULL}, {"outdir", OPT_ARG_MSTRZ, &jpeg_outdir, NULL}, {"subdirs", OPT_ARG_MSTRZ, &jpeg_subdirs, NULL}, - {"maxfiles", OPT_ARG_INT, &jpeg_maxfiles, (opt_test_f)int_pos}, + {"maxfiles", OPT_ARG_INT, &jpeg_maxfiles, int_pos}, {NULL, 0, NULL, NULL} }; const char *info_message = NULL; diff --git a/libvo/vo_png.c b/libvo/vo_png.c index 8110f859df..e404785736 100644 --- a/libvo/vo_png.c +++ b/libvo/vo_png.c @@ -283,8 +283,9 @@ static void uninit(void){ static void check_events(void){} -static int int_zero_to_nine(int *sh) +static int int_zero_to_nine(void *value) { + int *sh = value; if ( (*sh < 0) || (*sh > 9) ) return 0; return 1; @@ -292,7 +293,7 @@ static int int_zero_to_nine(int *sh) static const opt_t subopts[] = { {"alpha", OPT_ARG_BOOL, &use_alpha, NULL}, - {"z", OPT_ARG_INT, &z_compression, (opt_test_f)int_zero_to_nine}, + {"z", OPT_ARG_INT, &z_compression, int_zero_to_nine}, {"outdir", OPT_ARG_MSTRZ, &png_outdir, NULL}, {NULL} }; diff --git a/libvo/vo_pnm.c b/libvo/vo_pnm.c index 90caf55e24..20290272bc 100644 --- a/libvo/vo_pnm.c +++ b/libvo/vo_pnm.c @@ -128,7 +128,7 @@ static int preinit(const char *arg) {"ascii", OPT_ARG_BOOL, &ascii_mode, NULL}, {"outdir", OPT_ARG_MSTRZ, &pnm_outdir, NULL}, {"subdirs", OPT_ARG_MSTRZ, &pnm_subdirs, NULL}, - {"maxfiles", OPT_ARG_INT, &pnm_maxfiles, (opt_test_f)int_pos}, + {"maxfiles", OPT_ARG_INT, &pnm_maxfiles, int_pos}, {NULL, 0, NULL, NULL} }; const char *info_message = NULL; diff --git a/libvo/vo_v4l2.c b/libvo/vo_v4l2.c index 62808f8291..f2e6535bab 100644 --- a/libvo/vo_v4l2.c +++ b/libvo/vo_v4l2.c @@ -54,7 +54,7 @@ static int output = -1; static char *device = NULL; static const opt_t subopts[] = { - {"output", OPT_ARG_INT, &output, (opt_test_f)int_non_neg}, + {"output", OPT_ARG_INT, &output, int_non_neg}, {"device", OPT_ARG_MSTRZ, &device, NULL}, {NULL} }; diff --git a/libvo/vo_xv.c b/libvo/vo_xv.c index 451d575884..6f1f7b6a36 100644 --- a/libvo/vo_xv.c +++ b/libvo/vo_xv.c @@ -612,8 +612,8 @@ static int preinit(const char *arg) const opt_t subopts[] = { /* name arg type arg var test */ - { "port", OPT_ARG_INT, &xv_port, (opt_test_f)int_pos }, - { "adaptor", OPT_ARG_INT, &xv_adaptor, (opt_test_f)int_non_neg }, + { "port", OPT_ARG_INT, &xv_port, int_pos }, + { "adaptor", OPT_ARG_INT, &xv_adaptor, int_non_neg }, { "ck", OPT_ARG_STR, &ck_src_arg, xv_test_ck }, { "ck-method", OPT_ARG_STR, &ck_method_arg, xv_test_ckm }, { NULL } diff --git a/libvo/vo_xvmc.c b/libvo/vo_xvmc.c index 1673fa8774..76954b2649 100644 --- a/libvo/vo_xvmc.c +++ b/libvo/vo_xvmc.c @@ -382,8 +382,8 @@ static int preinit(const char *arg){ const opt_t subopts [] = { /* name arg type arg var test */ - { "port", OPT_ARG_INT, &xv_port_request, (opt_test_f)int_pos }, - { "adaptor", OPT_ARG_INT, &xv_adaptor, (opt_test_f)int_non_neg }, + { "port", OPT_ARG_INT, &xv_port_request, int_pos }, + { "adaptor", OPT_ARG_INT, &xv_adaptor, int_non_neg }, { "ck", OPT_ARG_STR, &ck_src_arg, xv_test_ck }, { "ck-method", OPT_ARG_STR, &ck_method_arg, xv_test_ckm }, { "benchmark", OPT_ARG_BOOL, &benchmark, NULL }, diff --git a/libvo/vo_zr2.c b/libvo/vo_zr2.c index 21347cb1d7..9f086cc4e1 100644 --- a/libvo/vo_zr2.c +++ b/libvo/vo_zr2.c @@ -192,14 +192,16 @@ static int get_norm(const char *n) { return -1; /* invalid */ } -static int nc(const char **norm) { +static int nc(void *normp) { + const char **norm = normp; if (get_norm(*norm) == -1) { ERROR("norm \"%s\" is not supported, choose from PAL, NTSC, SECAM and auto\n", *norm); return 0; } else return 1; } -static int pbc(int *prebuf) { +static int pbc(void *prebufp) { + int *prebuf = prebufp; if (*prebuf) WARNING("prebuffering is not yet supported\n"); return 1; } @@ -211,8 +213,8 @@ static int preinit(const char *arg) { int norm = VIDEO_MODE_AUTO, prebuf = 0; const opt_t subopts[] = { /* don't want warnings with -Wall... */ { "dev", OPT_ARG_MSTRZ, &dev_arg, NULL }, - { "prebuf", OPT_ARG_BOOL, &prebuf, (opt_test_f)pbc }, - { "norm", OPT_ARG_MSTRZ, &norm_arg, (opt_test_f)nc }, + { "prebuf", OPT_ARG_BOOL, &prebuf, pbc }, + { "norm", OPT_ARG_MSTRZ, &norm_arg, nc }, { NULL, 0, NULL, NULL } }; diff --git a/subopt-helper.c b/subopt-helper.c index 50283cfbf3..e40f9f40d0 100644 --- a/subopt-helper.c +++ b/subopt-helper.c @@ -300,15 +300,17 @@ static char const * parse_str( char const * str, strarg_t * const valp ) /*** common test functions ***/ /** \brief Test if i is not negative */ -int int_non_neg( int * i ) +int int_non_neg(void *iptr) { + int *i = iptr; if ( *i < 0 ) { return 0; } return 1; } /** \brief Test if i is positive. */ -int int_pos( int * i ) +int int_pos(void *iptr) { + int *i = iptr; if ( *i > 0 ) { return 1; } return 0; diff --git a/subopt-helper.h b/subopt-helper.h index 18c6b4bf86..ec8ff7f378 100644 --- a/subopt-helper.h +++ b/subopt-helper.h @@ -38,8 +38,8 @@ typedef struct strarg_s } strarg_t; -int int_non_neg( int * i ); -int int_pos( int * i ); +int int_non_neg(void *iptr); +int int_pos(void *iptr); int strargcmp(strarg_t *arg, const char *str); int strargcasecmp(strarg_t *arg, char *str);