mirror of
https://abf.rosa.ru/djam/xz.git
synced 2025-02-23 18:42:57 +00:00
134 lines
3.6 KiB
Diff
134 lines
3.6 KiB
Diff
--- xz-5.0.0/src/liblzma/api/lzma/container.h.text~ 2010-10-23 16:47:33.000000000 +0200
|
|
+++ xz-5.0.0/src/liblzma/api/lzma/container.h 2010-12-14 23:57:08.628431579 +0100
|
|
@@ -43,7 +43,7 @@
|
|
/*
|
|
* Preset flags
|
|
*
|
|
- * Currently only one flag is defined.
|
|
+ * Currently only two flags are defined.
|
|
*/
|
|
|
|
/**
|
|
@@ -59,6 +59,13 @@
|
|
*/
|
|
#define LZMA_PRESET_EXTREME (UINT32_C(1) << 31)
|
|
|
|
+/**
|
|
+ * \brief Text compression preset
|
|
+ *
|
|
+ * TODO
|
|
+ */
|
|
+#define LZMA_PRESET_TEXT (UINT32_C(1) << 18)
|
|
+
|
|
|
|
/**
|
|
* \brief Calculate approximate memory usage of easy encoder
|
|
--- xz-5.0.0/src/liblzma/lzma/lzma_encoder_presets.c.text~ 2010-10-23 16:47:33.000000000 +0200
|
|
+++ xz-5.0.0/src/liblzma/lzma/lzma_encoder_presets.c 2010-12-15 01:01:27.610442970 +0100
|
|
@@ -18,7 +18,7 @@ lzma_lzma_preset(lzma_options_lzma *opti
|
|
{
|
|
const uint32_t level = preset & LZMA_PRESET_LEVEL_MASK;
|
|
const uint32_t flags = preset & ~LZMA_PRESET_LEVEL_MASK;
|
|
- const uint32_t supported_flags = LZMA_PRESET_EXTREME;
|
|
+ const uint32_t supported_flags = LZMA_PRESET_EXTREME | LZMA_PRESET_TEXT;
|
|
|
|
if (level > 9 || (flags & ~supported_flags))
|
|
return true;
|
|
@@ -57,5 +57,18 @@ lzma_lzma_preset(lzma_options_lzma *opti
|
|
}
|
|
}
|
|
|
|
+ if (flags & LZMA_PRESET_TEXT) {
|
|
+ if (level == 0)
|
|
+ options->lc = 3;
|
|
+ else
|
|
+ options->lc = 4;
|
|
+ options->lp = 0;
|
|
+ options->pb = 0;
|
|
+ options->mode = LZMA_MODE_NORMAL;
|
|
+ options->nice_len = 273;
|
|
+ options->mf = LZMA_MF_BT4;
|
|
+ options->depth = 512;
|
|
+ }
|
|
+
|
|
return false;
|
|
}
|
|
--- xz-5.0.0/src/xz/args.c.text~ 2010-10-23 16:47:33.000000000 +0200
|
|
+++ xz-5.0.0/src/xz/args.c 2010-12-14 23:57:08.639432696 +0100
|
|
@@ -76,6 +76,7 @@ parse_real(args_info *args, int argc, ch
|
|
OPT_NO_ADJUST,
|
|
OPT_INFO_MEMORY,
|
|
OPT_ROBOT,
|
|
+ OPT_TEXT,
|
|
};
|
|
|
|
static const char short_opts[]
|
|
@@ -113,6 +114,8 @@ parse_real(args_info *args, int argc, ch
|
|
{ "extreme", no_argument, NULL, 'e' },
|
|
{ "fast", no_argument, NULL, '0' },
|
|
{ "best", no_argument, NULL, '9' },
|
|
+ { "text", no_argument, NULL, OPT_TEXT },
|
|
+
|
|
|
|
// Filters
|
|
{ "lzma1", optional_argument, NULL, OPT_LZMA1 },
|
|
@@ -401,6 +404,10 @@ parse_real(args_info *args, int argc, ch
|
|
opt_auto_adjust = false;
|
|
break;
|
|
|
|
+ case OPT_TEXT:
|
|
+ coder_set_text();
|
|
+ break;
|
|
+
|
|
default:
|
|
message_try_help();
|
|
tuklib_exit(E_ERROR, E_ERROR, false);
|
|
--- xz-5.0.0/src/xz/coder.c.text~ 2010-10-23 16:47:33.000000000 +0200
|
|
+++ xz-5.0.0/src/xz/coder.c 2010-12-14 23:57:08.640432976 +0100
|
|
@@ -47,6 +47,9 @@ static size_t preset_number = 6;
|
|
/// compression ratio.
|
|
static bool preset_extreme = false;
|
|
|
|
+/// TODO: Description..
|
|
+static bool preset_text = false;
|
|
+
|
|
/// Integrity check type
|
|
static lzma_check check;
|
|
|
|
@@ -89,6 +92,14 @@ coder_set_extreme(void)
|
|
|
|
|
|
extern void
|
|
+coder_set_text(void)
|
|
+{
|
|
+ preset_text = true;
|
|
+ return;
|
|
+}
|
|
+
|
|
+
|
|
+extern void
|
|
coder_add_filter(lzma_vli id, void *options)
|
|
{
|
|
if (filters_count == LZMA_FILTERS_MAX)
|
|
@@ -137,6 +148,9 @@ coder_set_compression_settings(void)
|
|
if (preset_extreme)
|
|
preset_number |= LZMA_PRESET_EXTREME;
|
|
|
|
+ if (preset_text)
|
|
+ preset_number |= LZMA_PRESET_TEXT;
|
|
+
|
|
if (lzma_lzma_preset(&opt_lzma, preset_number))
|
|
message_bug();
|
|
|
|
--- xz-5.0.0/src/xz/coder.h.text~ 2010-10-23 16:47:33.000000000 +0200
|
|
+++ xz-5.0.0/src/xz/coder.h 2010-12-14 23:57:08.649682731 +0100
|
|
@@ -51,6 +51,9 @@ extern void coder_set_preset(size_t new_
|
|
/// Enable extreme mode
|
|
extern void coder_set_extreme(void);
|
|
|
|
+/// Enable text mode
|
|
+extern void coder_set_text(void);
|
|
+
|
|
/// Add a filter to the custom filter chain
|
|
extern void coder_add_filter(lzma_vli id, void *options);
|
|
|