X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=src%2Fmodules%2Fentry.c;h=cf99b081adb8d244619536b1380f8c1cd6d58349;hb=c12acbd7d48431d7b5029d765e69e87378aca7a2;hp=e0b48d293faed0f5915388378fe527537b6f05ac;hpb=3c3964589ec711c9ea363e51750f431104ac1637;p=vlc diff --git a/src/modules/entry.c b/src/modules/entry.c index e0b48d293f..cf99b081ad 100644 --- a/src/modules/entry.c +++ b/src/modules/entry.c @@ -28,6 +28,7 @@ #include #include #include +#include #include "modules/modules.h" #include "config/configuration.h" @@ -136,6 +137,11 @@ static module_config_t *vlc_config_create (module_t *module, int type) } memset (tab + confsize, 0, sizeof (tab[confsize])); + if (IsConfigIntegerType (type)) + { + tab[confsize].max.i = INT_MAX; + tab[confsize].min.i = INT_MIN; + } tab[confsize].i_type = type; if (type & CONFIG_ITEM) @@ -181,9 +187,22 @@ int vlc_plugin_set (module_t *module, module_config_t *item, int propid, ...) case VLC_MODULE_SHORTCUT: { - const char *psz_new = va_arg (ap, char*); - module->pp_shortcuts = realloc (module->pp_shortcuts, sizeof( char ** ) * (module->i_shortcuts + 1)); - module->pp_shortcuts[module->i_shortcuts++] = psz_new; + unsigned i_shortcuts = va_arg (ap, unsigned); + unsigned index = module->i_shortcuts; + /* The cache loader accept only a small number of shortcuts */ + assert(i_shortcuts + index <= MODULE_SHORTCUT_MAX); + + const char *const *tab = va_arg (ap, const char *const *); + const char **pp = realloc (module->pp_shortcuts, + sizeof (pp[0]) * (index + i_shortcuts)); + if (unlikely(pp == NULL)) + { + ret = -1; + break; + } + module->pp_shortcuts = pp; + module->i_shortcuts = index + i_shortcuts; + memcpy (pp + index, tab, sizeof (pp[0]) * i_shortcuts); break; } @@ -253,7 +272,7 @@ int vlc_plugin_set (module_t *module, module_config_t *item, int propid, ...) if (IsConfigIntegerType (item->i_type)) { item->orig.i = item->saved.i = - item->value.i = va_arg (ap, int); + item->value.i = va_arg (ap, int64_t); } else if (IsConfigFloatType (item->i_type)) @@ -278,8 +297,8 @@ int vlc_plugin_set (module_t *module, module_config_t *item, int propid, ...) || item->i_type == CONFIG_ITEM_MODULE_LIST_CAT || item->i_type == CONFIG_ITEM_MODULE_CAT) { - item->min.i = va_arg (ap, int); - item->max.i = va_arg (ap, int); + item->min.i = va_arg (ap, int64_t); + item->max.i = va_arg (ap, int64_t); } else if (IsConfigFloatType (item->i_type))