aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/xz/coder.c33
1 files changed, 20 insertions, 13 deletions
diff --git a/src/xz/coder.c b/src/xz/coder.c
index b998cb2b..159b7d8b 100644
--- a/src/xz/coder.c
+++ b/src/xz/coder.c
@@ -137,20 +137,12 @@ coder_add_filter(lzma_vli id, void *options)
}
-extern void
-coder_add_filters_from_str(const char *filter_str)
+static void
+str_to_filter(const char *str, lzma_filter *filter, uint32_t flags)
{
- // Forget presets and previously defined filter chain. See
- // coder_add_filter() above for why preset_number must be reset too.
- forget_filter_chain();
- preset_number = LZMA_PRESET_DEFAULT;
-
- string_to_filter_used = true;
-
- // Include LZMA_STR_ALL_FILTERS so this can be used with --format=raw.
int error_pos;
- const char *err = lzma_str_to_filters(filter_str, &error_pos,
- filters, LZMA_STR_ALL_FILTERS, NULL);
+ const char *err = lzma_str_to_filters(str, &error_pos, filter,
+ flags, NULL);
if (err != NULL) {
// FIXME? The message in err isn't translated.
@@ -159,10 +151,25 @@ coder_add_filters_from_str(const char *filter_str)
// liblzma might not be worth it especially since on some
// OSes it adds extra dependencies to translation libraries.
message(V_ERROR, _("Error in --filters=FILTERS option:"));
- message(V_ERROR, "%s", filter_str);
+ message(V_ERROR, "%s", str);
message(V_ERROR, "%*s^", error_pos, "");
message_fatal("%s", err);
}
+}
+
+
+extern void
+coder_add_filters_from_str(const char *filter_str)
+{
+ // Forget presets and previously defined filter chain. See
+ // coder_add_filter() above for why preset_number must be reset too.
+ forget_filter_chain();
+ preset_number = LZMA_PRESET_DEFAULT;
+
+ string_to_filter_used = true;
+
+ // Include LZMA_STR_ALL_FILTERS so this can be used with --format=raw.
+ str_to_filter(filter_str, filters, LZMA_STR_ALL_FILTERS);
// Set the filters_count to be the number of filters converted from
// the string.