#include <vlc_memory.h>
#include <assert.h>
#include <stdarg.h>
+#include <limits.h>
#include "modules/modules.h"
#include "config/configuration.h"
}
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)
{
unsigned i_shortcuts = va_arg (ap, unsigned);
unsigned index = module->i_shortcuts;
- module->i_shortcuts += i_shortcuts;
+ /* The cache loader accept only a small number of shortcuts */
+ assert(i_shortcuts + index <= MODULE_SHORTCUT_MAX);
- module->pp_shortcuts = realloc (module->pp_shortcuts, sizeof( char ** ) * module->i_shortcuts);
- for (; index < module->i_shortcuts; index++)
+ 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))
{
- const char *psz_new = va_arg (ap, const char*);
- module->pp_shortcuts[index] = psz_new;
+ ret = -1;
+ break;
}
+ module->pp_shortcuts = pp;
+ module->i_shortcuts = index + i_shortcuts;
+ memcpy (pp + index, tab, sizeof (pp[0]) * i_shortcuts);
break;
}
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))
|| 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))