mirror of
https://github.com/mpv-player/mpv
synced 2024-08-24 07:21:49 +02:00
Fix function declarations to avoid casting function pointers.
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@30164 b3059339-0415-0410-9bf9-f77b7e298cf2
This commit is contained in:
parent
5f684e1b32
commit
f102ac7a8c
@ -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}
|
||||
};
|
||||
|
||||
|
@ -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}
|
||||
};
|
||||
|
||||
|
@ -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},
|
||||
|
@ -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}
|
||||
};
|
||||
|
@ -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}
|
||||
};
|
||||
|
@ -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;
|
||||
|
@ -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}
|
||||
};
|
||||
|
@ -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;
|
||||
|
@ -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}
|
||||
};
|
||||
|
@ -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 }
|
||||
|
@ -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 },
|
||||
|
@ -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 }
|
||||
};
|
||||
|
||||
|
@ -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;
|
||||
|
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user