From b42be2d56a5abbc8645eac7d4d30f9e3b486dcc0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Storsj=C3=B6?= Date: Mon, 27 Aug 2012 14:07:12 +0300 Subject: [PATCH] avprobe: Get rid of ugly casts in the options table MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This also makes sure the function pointers are stored via the same union member as they are accessed via. Signed-off-by: Martin Storsjö --- avprobe.c | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/avprobe.c b/avprobe.c index 00e0ad09e0..cb610d89f9 100644 --- a/avprobe.c +++ b/avprobe.c @@ -877,34 +877,35 @@ void show_help_default(const char *opt, const char *arg) show_help_children(avformat_get_class(), AV_OPT_FLAG_DECODING_PARAM); } -static void opt_pretty(void) +static int opt_pretty(const char *opt, const char *arg) { show_value_unit = 1; use_value_prefix = 1; use_byte_value_binary_prefix = 1; use_value_sexagesimal_format = 1; + return 0; } static const OptionDef real_options[] = { #include "cmdutils_common_opts.h" - { "f", HAS_ARG, {(void*)opt_format}, "force format", "format" }, - { "of", HAS_ARG, {(void*)&opt_output_format}, "output the document either as ini or json", "output_format" }, - { "unit", OPT_BOOL, {(void*)&show_value_unit}, + { "f", HAS_ARG, {.func_arg = opt_format}, "force format", "format" }, + { "of", HAS_ARG, {.func_arg = opt_output_format}, "output the document either as ini or json", "output_format" }, + { "unit", OPT_BOOL, {&show_value_unit}, "show unit of the displayed values" }, - { "prefix", OPT_BOOL, {(void*)&use_value_prefix}, + { "prefix", OPT_BOOL, {&use_value_prefix}, "use SI prefixes for the displayed values" }, - { "byte_binary_prefix", OPT_BOOL, {(void*)&use_byte_value_binary_prefix}, + { "byte_binary_prefix", OPT_BOOL, {&use_byte_value_binary_prefix}, "use binary prefixes for byte units" }, - { "sexagesimal", OPT_BOOL, {(void*)&use_value_sexagesimal_format}, + { "sexagesimal", OPT_BOOL, {&use_value_sexagesimal_format}, "use sexagesimal format HOURS:MM:SS.MICROSECONDS for time units" }, - { "pretty", 0, {(void*)&opt_pretty}, + { "pretty", 0, {.func_arg = opt_pretty}, "prettify the format of displayed values, make it more human readable" }, - { "show_format", OPT_BOOL, {(void*)&do_show_format} , "show format/container info" }, - { "show_format_entry", HAS_ARG, {(void*)opt_show_format_entry}, + { "show_format", OPT_BOOL, {&do_show_format} , "show format/container info" }, + { "show_format_entry", HAS_ARG, {.func_arg = opt_show_format_entry}, "show a particular entry from the format/container info", "entry" }, - { "show_packets", OPT_BOOL, {(void*)&do_show_packets}, "show packets info" }, - { "show_streams", OPT_BOOL, {(void*)&do_show_streams}, "show streams info" }, - { "default", HAS_ARG | OPT_AUDIO | OPT_VIDEO | OPT_EXPERT, {(void*)opt_default}, + { "show_packets", OPT_BOOL, {&do_show_packets}, "show packets info" }, + { "show_streams", OPT_BOOL, {&do_show_streams}, "show streams info" }, + { "default", HAS_ARG | OPT_AUDIO | OPT_VIDEO | OPT_EXPERT, {.func_arg = opt_default}, "generic catch all option", "" }, { NULL, }, };