From 755e9fad2985fbaaa0c23243521ab4c90a3ceb7e Mon Sep 17 00:00:00 2001 From: wm4 Date: Wed, 23 Nov 2016 17:30:46 +0100 Subject: 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. --- player/command.c | 22 +++++++++------------- 1 file 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); } -- cgit v1.2.3