Changeset 64ea683969472b60ebc2b4e15e552f7bf23d017a
- Timestamp:
- 12/16/07 18:36:01 (9 months ago)
- git-parent:
- Files:
-
- include/vlc_configuration.h (modified) (3 diffs)
- include/vlc_plugin.h (added)
- src/config/core.c (modified) (1 diff)
- src/modules/entry.c (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
include/vlc_configuration.h
r0babda7 r64ea683 166 166 167 167 /* Values list */ 168 c onst char **ppsz_list; /* List of possible values for the option */168 char ** ppsz_list; /* List of possible values for the option */ 169 169 int *pi_list; /* Idem for integers */ 170 c onst char**ppsz_list_text; /* Friendly names for list values */170 char **ppsz_list_text; /* Friendly names for list values */ 171 171 int i_list; /* Options list size */ 172 172 173 173 /* Actions list */ 174 174 vlc_callback_t *ppf_action; /* List of possible actions for a config */ 175 c onst char**ppsz_action_text; /* Friendly names for actions */175 char **ppsz_action_text; /* Friendly names for actions */ 176 176 int i_action; /* actions list size */ 177 177 … … 269 269 VLC_CONFIG_CAPABILITY, 270 270 /* capability for a module or list thereof (args=const char*) */ 271 272 VLC_CONFIG_SHORTCUT, 273 /* one-character (short) command line option name (args=char) */ 274 275 VLC_CONFIG_LIST, 276 /* possible values list 277 * (args=size_t, const <type> *, const char *const *) */ 271 278 }; 272 279 … … 431 438 /* Modifier macros for the config options (used for fine tuning) */ 432 439 #define change_short( ch ) \ 433 p_config[i_config].i_short = ch;440 vlc_config_set (p_config + i_config, VLC_CONFIG_SHORTCUT, (int)(ch)) 434 441 435 442 #define change_string_list( list, list_text, list_update_func ) \ 436 p_config[i_config].i_list = sizeof(list)/sizeof(char *); \ 437 p_config[i_config].ppsz_list = list; \ 438 p_config[i_config].ppsz_list_text = list_text; 443 vlc_config_set (p_config + i_config, VLC_CONFIG_LIST, \ 444 (size_t)(sizeof (list) / sizeof (char *)), \ 445 (const char *const *)(list), \ 446 (const char *const *)(list_text)) 439 447 440 448 #define change_integer_list( list, list_text, list_update_func ) \ 441 p_config[i_config].i_list = sizeof(list)/sizeof(int); \ 442 p_config[i_config].pi_list = (int *)list; \ 443 p_config[i_config].ppsz_list_text = list_text; 449 vlc_config_set (p_config + i_config, VLC_CONFIG_LIST, \ 450 (size_t)(sizeof (list) / sizeof (int)), \ 451 (const int *)(list), \ 452 (const char *const *)(list_text)) 453 454 #define change_float_list( list, list_text, list_update_func ) \ 455 vlc_config_set (p_config + i_config, VLC_CONFIG_LIST, \ 456 (size_t)(sizeof (list) / sizeof (float)), \ 457 (const float *)(list), \ 458 (const char *const *)(list_text)) 444 459 445 460 #define change_integer_range( minv, maxv ) \ src/config/core.c
reda425f r64ea683 523 523 p_module->p_config[i].p_lock = &p_module->object_lock; 524 524 525 /* duplicate the string list */526 if( p_orig[i].i_list )527 {528 if( p_orig[i].ppsz_list )529 {530 p_module->p_config[i].ppsz_list =531 malloc( (p_orig[i].i_list + 1) * sizeof(char *) );532 if( p_module->p_config[i].ppsz_list )533 {534 for( j = 0; j < p_orig[i].i_list; j++ )535 p_module->p_config[i].ppsz_list[j] =536 strdupnull (p_orig[i].ppsz_list[j]);537 p_module->p_config[i].ppsz_list[j] = NULL;538 }539 }540 if( p_orig[i].ppsz_list_text )541 {542 p_module->p_config[i].ppsz_list_text =543 calloc( (p_orig[i].i_list + 1), sizeof(char *) );544 if( p_module->p_config[i].ppsz_list_text )545 {546 for( j = 0; j < p_orig[i].i_list; j++ )547 p_module->p_config[i].ppsz_list_text[j] =548 strdupnull (_(p_orig[i].ppsz_list_text[j]));549 p_module->p_config[i].ppsz_list_text[j] = NULL;550 }551 }552 if( p_orig[i].pi_list )553 {554 p_module->p_config[i].pi_list =555 malloc( (p_orig[i].i_list + 1) * sizeof(int) );556 if( p_module->p_config[i].pi_list )557 {558 for( j = 0; j < p_orig[i].i_list; j++ )559 p_module->p_config[i].pi_list[j] =560 p_orig[i].pi_list[j];561 }562 }563 }564 565 525 /* duplicate the actions list */ 566 526 if( p_orig[i].i_action ) src/modules/entry.c
r0babda7 r64ea683 159 159 160 160 memset (tab + confsize, 0, sizeof (tab[confsize])); 161 tab[confsize].i_type = type; 162 tab[confsize].p_lock = &module->object_lock; 163 161 164 return tab + confsize; 162 165 } … … 277 280 break; 278 281 } 282 283 case VLC_CONFIG_SHORTCUT: 284 item->i_short = va_arg (ap, int); 285 ret = 0; 286 break; 287 288 case VLC_CONFIG_LIST: 289 { 290 size_t len = va_arg (ap, size_t); 291 char **dtext = malloc (sizeof (char *) * (len + 1)); 292 293 if (dtext == NULL) 294 break; 295 296 /* Copy values */ 297 if (IsConfigIntegerType (item->i_type)) 298 { 299 const int *src = va_arg (ap, const int *); 300 int *dst = malloc (sizeof (int) * (len + 1)); 301 302 if (dst != NULL) 303 { 304 memcpy (dst, src, sizeof (int) * len); 305 dst[len] = 0; 306 } 307 item->pi_list = dst; 308 } 309 else 310 #if 0 311 if (IsConfigFloatType (item->i_type)) 312 { 313 const float *src = va_arg (ap, const float *); 314 float *dst = malloc (sizeof (float) * (len + 1)); 315 316 if (dst != NULL) 317 { 318 memcpy (dst, src, sizeof (float) * len); 319 dst[len] = 0.; 320 } 321 item->pf_list = dst; 322 } 323 else 324 #endif 325 if (IsConfigStringType (item->i_type)) 326 { 327 const char *const *src = va_arg (ap, const char *const *); 328 char **dst = malloc (sizeof (char *) * (len + 1)); 329 330 if (dst != NULL) 331 { 332 for (size_t i = 0; i < len; i++) 333 dst[i] = src[i] ? strdup (src[i]) : NULL; 334 dst[len] = NULL; 335 } 336 item->ppsz_list = dst; 337 } 338 else 339 break; 340 341 /* Copy textual descriptions */ 342 const char *const *text = va_arg (ap, const char *const *); 343 if (text != NULL) 344 { 345 for (size_t i = 0; i < len; i++) 346 dtext[i] = text[i] ? strdup (gettext (text[i])) : NULL; 347 348 dtext[len] = NULL; 349 item->ppsz_list_text = dtext; 350 } 351 else 352 item->ppsz_list_text = NULL; 353 354 item->i_list = len; 355 ret = 0; 356 break; 357 } 279 358 } 280 359
