diff options
author | wm4 <wm4@nowhere> | 2016-11-23 17:30:46 +0100 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2016-11-23 17:30:46 +0100 |
commit | 755e9fad2985fbaaa0c23243521ab4c90a3ceb7e (patch) | |
tree | 9ca72b3c0f8c8ff0206a026fc3e610d88f65021b /player/command.c | |
parent | f696975fe371a0c98cdcaa20bce33b55b48f5c37 (diff) | |
download | mpv-755e9fad2985fbaaa0c23243521ab4c90a3ceb7e.tar.bz2 mpv-755e9fad2985fbaaa0c23243521ab4c90a3ceb7e.tar.xz |
command: warn against deprecated properties in all cases
For some reason, some types of accesses didn't warn, for example when
using mp.observe_property() in Lua. This was because the deprecation
handling code explicitly checks certain accesses. I'm not quite certain
why it was done this way. Just make it warn always.
This could be backported to the current release, if we cared.
Diffstat (limited to 'player/command.c')
-rw-r--r-- | player/command.c | 22 |
1 files changed, 9 insertions, 13 deletions
diff --git a/player/command.c b/player/command.c index 1f112fdf65..3d56a56fca 100644 --- a/player/command.c +++ b/player/command.c @@ -3589,20 +3589,16 @@ static int mp_property_deprecated_alias(void *ctx, struct m_property *prop, MPContext *mpctx = ctx; struct command_ctx *cmd = mpctx->command_ctx; const char *real_property = prop->priv; - if (action == M_PROPERTY_SET || action == M_PROPERTY_GET || - action == M_PROPERTY_PRINT) - { - for (int n = 0; n < cmd->num_warned_deprecated; n++) { - if (strcmp(cmd->warned_deprecated[n], prop->name) == 0) - goto done; - } - MP_WARN(mpctx, "Warning: property '%s' was replaced with '%s' and " - "might be removed in the future.\n", prop->name, real_property); - MP_TARRAY_APPEND(cmd, cmd->warned_deprecated, cmd->num_warned_deprecated, - (char *)prop->name); - - done:; + for (int n = 0; n < cmd->num_warned_deprecated; n++) { + if (strcmp(cmd->warned_deprecated[n], prop->name) == 0) + goto done; } + MP_WARN(mpctx, "Warning: property '%s' was replaced with '%s' and " + "might be removed in the future.\n", prop->name, real_property); + MP_TARRAY_APPEND(cmd, cmd->warned_deprecated, cmd->num_warned_deprecated, + (char *)prop->name); + +done: return mp_property_do(real_property, action, arg, ctx); } |