changeset 30122:1772a5171ac7

Fix function declarations to avoid casting function pointers.
author reimar
date Fri, 01 Jan 2010 13:18:49 +0000
parents 28cbec606cbb
children 0f5f75b4a015
files libao2/ao_alsa.c libao2/ao_dart.c libvo/vo_gl.c libvo/vo_gl2.c libvo/vo_ivtv.c libvo/vo_jpeg.c libvo/vo_png.c libvo/vo_pnm.c libvo/vo_v4l2.c libvo/vo_xv.c libvo/vo_xvmc.c libvo/vo_zr2.c subopt-helper.c subopt-helper.h
diffstat 14 files changed, 38 insertions(+), 31 deletions(-) [+]
line wrap: on
line diff
--- a/libao2/ao_alsa.c	Fri Jan 01 12:54:09 2010 +0000
+++ b/libao2/ao_alsa.c	Fri Jan 01 13:18:49 2010 +0000
@@ -263,7 +263,8 @@
            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 @@
     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}
     };
 
--- a/libao2/ao_dart.c	Fri Jan 01 12:54:09 2010 +0000
+++ b/libao2/ao_dart.c	Fri Jan 01 13:18:49 2010 +0000
@@ -148,7 +148,7 @@
 
     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}
     };
 
--- a/libvo/vo_gl.c	Fri Jan 01 12:54:09 2010 +0000
+++ b/libvo/vo_gl.c	Fri Jan 01 13:18:49 2010 +0000
@@ -1012,12 +1012,12 @@
   {"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},
--- a/libvo/vo_gl2.c	Fri Jan 01 12:54:09 2010 +0000
+++ b/libvo/vo_gl2.c	Fri Jan 01 13:18:49 2010 +0000
@@ -853,7 +853,7 @@
 }
 
 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}
 };
--- a/libvo/vo_ivtv.c	Fri Jan 01 12:54:09 2010 +0000
+++ b/libvo/vo_ivtv.c	Fri Jan 01 13:18:49 2010 +0000
@@ -60,7 +60,7 @@
 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}
 };
--- a/libvo/vo_jpeg.c	Fri Jan 01 12:54:09 2010 +0000
+++ b/libvo/vo_jpeg.c	Fri Jan 01 13:18:49 2010 +0000
@@ -330,8 +330,9 @@
 /** \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 @@
         {"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;
--- a/libvo/vo_png.c	Fri Jan 01 12:54:09 2010 +0000
+++ b/libvo/vo_png.c	Fri Jan 01 13:18:49 2010 +0000
@@ -283,8 +283,9 @@
 
 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 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}
 };
--- a/libvo/vo_pnm.c	Fri Jan 01 12:54:09 2010 +0000
+++ b/libvo/vo_pnm.c	Fri Jan 01 13:18:49 2010 +0000
@@ -128,7 +128,7 @@
         {"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;
--- a/libvo/vo_v4l2.c	Fri Jan 01 12:54:09 2010 +0000
+++ b/libvo/vo_v4l2.c	Fri Jan 01 13:18:49 2010 +0000
@@ -54,7 +54,7 @@
 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}
 };
--- a/libvo/vo_xv.c	Fri Jan 01 12:54:09 2010 +0000
+++ b/libvo/vo_xv.c	Fri Jan 01 13:18:49 2010 +0000
@@ -612,8 +612,8 @@
     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 }
--- a/libvo/vo_xvmc.c	Fri Jan 01 12:54:09 2010 +0000
+++ b/libvo/vo_xvmc.c	Fri Jan 01 13:18:49 2010 +0000
@@ -382,8 +382,8 @@
     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 },
--- a/libvo/vo_zr2.c	Fri Jan 01 12:54:09 2010 +0000
+++ b/libvo/vo_zr2.c	Fri Jan 01 13:18:49 2010 +0000
@@ -192,14 +192,16 @@
 	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 @@
 	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 	       }
 	};
 
--- a/subopt-helper.c	Fri Jan 01 12:54:09 2010 +0000
+++ b/subopt-helper.c	Fri Jan 01 13:18:49 2010 +0000
@@ -300,15 +300,17 @@
 /*** 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;
--- a/subopt-helper.h	Fri Jan 01 12:54:09 2010 +0000
+++ b/subopt-helper.h	Fri Jan 01 13:18:49 2010 +0000
@@ -38,8 +38,8 @@
 } 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);