mirror of
https://github.com/mpv-player/mpv
synced 2025-01-20 14:20:55 +00:00
options: Fix multiple -v by simplifying CONF_TYPE_FUNC
The CONF_TYPE_FUNC implementation counted how many times the option had appeared and called the function that many times when it was set. However each -v on the command line triggered an increase of the count _and_ as many calls as the current count indicated. Thus the resulting verbosity levels for 0 to 5 -v were really 0, 1, 3, 6, 10, 15 instead of 0, 1, 2, 3, 4, 5. Remove the counting functionality and just call the given function once at each set operation. This fixes -v; other options are not affected.
This commit is contained in:
parent
98b959ae1f
commit
6be229cbbf
@ -809,17 +809,12 @@ const m_option_type_t m_option_type_func_full = {
|
||||
/////////////// Func
|
||||
|
||||
#undef VAL
|
||||
#define VAL(x) (*(int*)(x))
|
||||
|
||||
static int parse_func(const m_option_t* opt,const char *name, char *param, void* dst, int src) {
|
||||
if(dst)
|
||||
VAL(dst) += 1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void set_func(const m_option_t* opt,void* dst, void* src) {
|
||||
int i;
|
||||
for(i = 0 ; i < VAL(src) ; i++)
|
||||
((m_opt_func_t) opt->p)(opt);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user