mirror of https://github.com/mpv-player/mpv
m_option: clamp integer before adding a value
This is for the previous commit, and should affect behavior with the special M_PROPERTY_GET_CONSTRICTED_TYPE mechanism only. The effect is that cycling the "edition" property, if the option is set to "auto", will change to the second edition instead of the first. Normally, option values must always be within their range, so this should not affect anything else. M_PROPERTY_GET_CONSTRICTED_TYPE is sort-of fine with this kind of behavior. If this affects any other M_PROPERTY_GET_CONSTRICTED_TYPE users neqatively, I will revert the change.
This commit is contained in:
parent
aa5f234b43
commit
de0f9b9f2d
|
@ -282,6 +282,8 @@ static void add_int64(const m_option_t *opt, void *val, double add, bool wrap)
|
||||||
{
|
{
|
||||||
int64_t v = *(int64_t *)val;
|
int64_t v = *(int64_t *)val;
|
||||||
|
|
||||||
|
clamp_int64(opt, &v);
|
||||||
|
|
||||||
v = v + add;
|
v = v + add;
|
||||||
|
|
||||||
bool is64 = opt->type->size == sizeof(int64_t);
|
bool is64 = opt->type->size == sizeof(int64_t);
|
||||||
|
|
Loading…
Reference in New Issue