diff options
author | wm4 <wm4@nowhere> | 2013-03-01 11:21:13 +0100 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2013-03-01 11:21:13 +0100 |
commit | 9180263c4d7174def26d07eb3e91fe4b459d9698 (patch) | |
tree | 186d74c496949241dd7226b5dc43273add7aabf0 /core/cfg-mplayer.h | |
parent | fdc1560a0ed31f0c275c47ac8cb7521c0c636ddf (diff) | |
download | mpv-9180263c4d7174def26d07eb3e91fe4b459d9698.tar.bz2 mpv-9180263c4d7174def26d07eb3e91fe4b459d9698.tar.xz |
m_options: more typesafety
Change the option definition macros so that they cause compiler warnings
if the type of the referenced option struct member doesn't match the
type implied by the macro. The compiler warning printed isn't very
telling, but it's better than silently invoking undefined behavior by
violating the C strict aliasing rules.
Also fix some minor cases that violate the type rules. For the option
"no-aspect" we have to add a new option type to handle it properly.
Some option types are hard to check, so we don't in these cases.
Diffstat (limited to 'core/cfg-mplayer.h')
-rw-r--r-- | core/cfg-mplayer.h | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/core/cfg-mplayer.h b/core/cfg-mplayer.h index 57dd5253c8..22017f930b 100644 --- a/core/cfg-mplayer.h +++ b/core/cfg-mplayer.h @@ -456,8 +456,7 @@ const m_option_t common_opts[] = { {"sws", &sws_flags, CONF_TYPE_INT, 0, 0, 2, NULL}, {"ssf", (void *) scaler_filter_conf, CONF_TYPE_SUBCONFIG, 0, 0, 0, NULL}, OPT_FLOATRANGE("aspect", movie_aspect, 0, 0.1, 10.0), - // xxx: this aliases int with float, which is very evil (but works in this case) - OPT_FLAG_STORE("no-aspect", movie_aspect, 0, 0), + OPT_FLOAT_STORE("no-aspect", movie_aspect, 0, 0), OPT_FLAG_CONSTANTS("flip", flip, 0, 0, 1), |