Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(324)

Unified Diff: src/xz/coder.c

Issue 62403002: Update XZ Utils to 5.0.5 (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/deps/third_party/xz/
Patch Set: Created 7 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/xz/coder.h ('k') | src/xz/file_io.c » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/xz/coder.c
===================================================================
--- src/xz/coder.c (revision 233270)
+++ src/xz/coder.c (working copy)
@@ -37,16 +37,11 @@
static io_buf out_buf;
/// Number of filters. Zero indicates that we are using a preset.
-static size_t filters_count = 0;
+static uint32_t filters_count = 0;
/// Number of the preset (0-9)
-static size_t preset_number = 6;
+static uint32_t preset_number = LZMA_PRESET_DEFAULT;
-/// If a preset is used (no custom filter chain) and preset_extreme is true,
-/// a significantly slower compression is used to achieve slightly better
-/// compression ratio.
-static bool preset_extreme = false;
-
/// Integrity check type
static lzma_check check;
@@ -63,11 +58,9 @@
}
-extern void
-coder_set_preset(size_t new_preset)
+static void
+forget_filter_chain(void)
{
- preset_number = new_preset;
-
// Setting a preset makes us forget a possibly defined custom
// filter chain.
while (filters_count > 0) {
@@ -81,9 +74,20 @@
extern void
+coder_set_preset(uint32_t new_preset)
+{
+ preset_number &= ~LZMA_PRESET_LEVEL_MASK;
+ preset_number |= new_preset;
+ forget_filter_chain();
+ return;
+}
+
+
+extern void
coder_set_extreme(void)
{
- preset_extreme = true;
+ preset_number |= LZMA_PRESET_EXTREME;
+ forget_filter_chain();
return;
}
@@ -98,6 +102,12 @@
filters[filters_count].options = options;
++filters_count;
+ // Setting a custom filter chain makes us forget the preset options.
+ // This makes a difference if one specifies e.g. "xz -9 --lzma2 -e"
+ // where the custom filter chain resets the preset level back to
+ // the default 6, making the example equivalent to "xz -6e".
+ preset_number = LZMA_PRESET_DEFAULT;
+
return;
}
@@ -134,9 +144,6 @@
}
// Get the preset for LZMA1 or LZMA2.
- if (preset_extreme)
- preset_number |= LZMA_PRESET_EXTREME;
-
if (lzma_lzma_preset(&opt_lzma, preset_number))
message_bug();
« no previous file with comments | « src/xz/coder.h ('k') | src/xz/file_io.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698