X-Git-Url: http://git.tuebingen.mpg.de/?p=paraslash.git;a=blobdiff_plain;f=filter_chain.c;h=a04e2d8206a78520eaa8b95ecc8970eeb8366325;hp=312180f8afe539e72ad741c37e9c5be2107c7602;hb=68f5f7bdb30e7adcb87d0f314c67f0f80b337306;hpb=0439c3cd92853db1979001d46f8b8665bf0b31f8 diff --git a/filter_chain.c b/filter_chain.c index 312180f8..a04e2d82 100644 --- a/filter_chain.c +++ b/filter_chain.c @@ -123,7 +123,7 @@ again: int ret; if (*loaded && fn->loaded < fn->bufsize) { size_t old_fn_loaded = fn->loaded; - PARA_DEBUG_LOG("fc %p loaded: %d, calling %s convert\n", fci, *loaded, fn->filter->name); + PARA_DEBUG_LOG("fc %p loaded: %zd, calling %s convert\n", fci, *loaded, fn->filter->name); ret = fn->filter->convert(ib, *loaded, fn); if (ret < 0) { if (!fci->error) @@ -134,7 +134,7 @@ again: *loaded -= ret; conv += ret; if (*loaded && ret) { - PARA_DEBUG_LOG("moving %d bytes in input buffer for %s filter\n", + PARA_DEBUG_LOG("moving %zd bytes in input buffer for %s filter\n", *loaded, fn->filter->name); memmove(ib, ib + ret, *loaded); } @@ -186,25 +186,19 @@ static int parse_filter_args(int filter_num, char *options, void **conf) { struct filter *f = &filters[filter_num]; int i, argc = 2; - char *dummy_args[] = {"", "", NULL}; char **argv; // PARA_DEBUG_LOG("%s, options: %s, parser: %p\n", f->name, // options? options : "(none)", f->parse_config); if (!f->parse_config) - return options? -E_BAD_FILTER_OPTIONS : filter_num; - if (options) { -// PARA_DEBUG_LOG("options: %s\n", options); - argc = split_args(options, &argv, ' '); + return strlen(options)? -E_BAD_FILTER_OPTIONS : filter_num; +// PARA_DEBUG_LOG("options: %s\n", options); + argc = split_args(options, &argv, ' '); // PARA_DEBUG_LOG("argc = %d, argv[0]: %s\n", argc, argv[0]); - for (i = argc; i >= 0; i--) - argv[i + 1] = argv[i]; - argc += 2; - *conf = f->parse_config(argc, argv); - } else { - /* is it OK to have no options? */ - *conf = f->parse_config(2, dummy_args); - } + for (i = argc; i >= 0; i--) + argv[i + 1] = argv[i]; + argc += 2; + *conf = f->parse_config(argc, argv); return *conf? filter_num : -E_BAD_FILTER_OPTIONS; } @@ -245,7 +239,8 @@ int check_filter_arg(char *fa, void **conf) continue; if (c && !filters[j].parse_config) return -E_BAD_FILTER_OPTIONS; - return parse_filter_args(j, c? fa + len + 1 : NULL, conf); + return parse_filter_args(j, c? fa + len + 1 : + fa + strlen(fa), conf); } return -E_UNSUPPORTED_FILTER; }