diff options
Diffstat (limited to 'options/m_option.c')
-rw-r--r-- | options/m_option.c | 47 |
1 files changed, 0 insertions, 47 deletions
diff --git a/options/m_option.c b/options/m_option.c index 94dab9f59f..45709b9c16 100644 --- a/options/m_option.c +++ b/options/m_option.c @@ -133,14 +133,6 @@ static void copy_opt(const m_option_t *opt, void *dst, const void *src) #define VAL(x) (*(int *)(x)) -static int clamp_flag(const m_option_t *opt, void *val) -{ - if (VAL(val) == 0 || VAL(val) == 1) - return 0; - VAL(val) = 0; - return M_OPT_OUT_OF_RANGE; -} - static int parse_flag(struct mp_log *log, const m_option_t *opt, struct bstr name, struct bstr param, void *dst) { @@ -202,7 +194,6 @@ const m_option_type_t m_option_type_flag = { .print = print_flag, .copy = copy_opt, .add = add_flag, - .clamp = clamp_flag, .set = flag_set, .get = flag_get, }; @@ -336,14 +327,6 @@ static int parse_longlong(struct mp_log *log, const m_option_t *opt, return 1; } -static int clamp_int(const m_option_t *opt, void *val) -{ - long long tmp = *(int *)val; - int r = clamp_longlong(opt, &tmp); - *(int *)val = tmp; - return r; -} - static int clamp_int64(const m_option_t *opt, void *val) { long long tmp = *(int64_t *)val; @@ -475,7 +458,6 @@ const m_option_type_t m_option_type_int = { .copy = copy_opt, .add = add_int, .multiply = multiply_int, - .clamp = clamp_int, .set = int_set, .get = int_get, }; @@ -488,7 +470,6 @@ const m_option_type_t m_option_type_int64 = { .copy = copy_opt, .add = add_int64, .multiply = multiply_int64, - .clamp = clamp_int64, .set = int64_set, .get = int64_get, }; @@ -546,21 +527,6 @@ const char *m_opt_choice_str(const struct m_opt_choice_alternatives *choices, return NULL; } -static int clamp_choice(const m_option_t *opt, void *val) -{ - int v = *(int *)val; - if ((opt->flags & M_OPT_MIN) && (opt->flags & M_OPT_MAX)) { - if (v >= opt->min && v <= opt->max) - return 0; - } - ; - for (struct m_opt_choice_alternatives *alt = opt->priv; alt->name; alt++) { - if (alt->value == v) - return 0; - } - return M_OPT_INVALID; -} - static int parse_choice(struct mp_log *log, const struct m_option *opt, struct bstr name, struct bstr param, void *dst) { @@ -750,7 +716,6 @@ const struct m_option_type m_option_type_choice = { .print = print_choice, .copy = copy_opt, .add = add_choice, - .clamp = clamp_choice, .set = choice_set, .get = choice_get, }; @@ -999,7 +964,6 @@ const m_option_type_t m_option_type_double = { .print = print_double, .pretty_print = print_double_f3, .copy = copy_opt, - .clamp = clamp_double, .add = add_double, .multiply = multiply_double, .set = double_set, @@ -1009,14 +973,6 @@ const m_option_type_t m_option_type_double = { #undef VAL #define VAL(x) (*(float *)(x)) -static int clamp_float(const m_option_t *opt, void *val) -{ - double tmp = VAL(val); - int r = clamp_double(opt, &tmp); - VAL(val) = tmp; - return r; -} - static int parse_float(struct mp_log *log, const m_option_t *opt, struct bstr name, struct bstr param, void *dst) { @@ -1078,7 +1034,6 @@ const m_option_type_t m_option_type_float = { .copy = copy_opt, .add = add_float, .multiply = multiply_float, - .clamp = clamp_float, .set = float_set, .get = float_get, }; @@ -1179,7 +1134,6 @@ const m_option_type_t m_option_type_string = { .print = print_str, .copy = copy_str, .free = free_str, - .clamp = clamp_str, .set = str_set, .get = str_get, }; @@ -2462,7 +2416,6 @@ const m_option_type_t m_option_type_time = { .pretty_print = pretty_print_time, .copy = copy_opt, .add = add_double, - .clamp = clamp_double, .set = time_set, .get = time_get, }; |