4.0.4-alt95.M41.26

- rpmio: Tweak lzma preset options for better compression.
This commit is contained in:
Alexey Tourbin 2009-09-26 02:52:55 +04:00
commit 9c4c10a89e
2 changed files with 22 additions and 5 deletions

View File

@ -4,7 +4,7 @@
Name: %rpm_name
Version: %rpm_version
Release: alt95.M41.25
Release: alt95.M41.26
%define ifdef() %if %{expand:%%{?%{1}:1}%%{!?%{1}:0}}
%define get_dep() %(rpm -q --qf '%%{NAME} >= %%|SERIAL?{%%{SERIAL}:}|%%{VERSION}-%%{RELEASE}' %1 2>/dev/null || echo '%1 >= unknown')
@ -529,6 +529,9 @@ fi
%endif #with contrib
%changelog
* Sat Sep 26 2009 Alexey Tourbin <at@altlinux.ru> 4.0.4-alt95.M41.26
- rpmio: Tweak lzma preset options for better compression.
* Thu Sep 24 2009 Alexey Tourbin <at@altlinux.ru> 4.0.4-alt95.M41.25
- rpmio: Updated lzma compression routines for xz-5.0 API.
- Packaged /usr/bin/rpm2cpio.static.

View File

@ -2758,6 +2758,8 @@ typedef struct lzfile {
uint8_t buf[kBufferSize];
lzma_stream strm;
lzma_options_lzma options;
lzma_filter filters[2];
FILE *file;
@ -2798,13 +2800,25 @@ static LZFILE *lzopen_internal(const char *path, const char *mode, int fd, int x
lzfile->eof = 0;
lzfile->strm = (lzma_stream)LZMA_STREAM_INIT;
if (encoding) {
lzma_lzma_preset(&lzfile->options, level);
#if 1 /* tweak options for better compression */
if (level >= 2) {
unsigned int dict_size = 1<<20;
if (lzfile->options.dict_size < dict_size)
lzfile->options.dict_size = dict_size;
unsigned int nice_len = (level < LZMA_PRESET_DEFAULT) ? 64 : 128;
if (lzfile->options.nice_len < nice_len)
lzfile->options.nice_len = nice_len;
}
#endif
if (xz) {
lzfile->filters[0].id = LZMA_FILTER_LZMA2;
lzfile->filters[0].options = &lzfile->options;
lzfile->filters[1].id = LZMA_VLI_UNKNOWN;
/* xz(1) uses CRC64 by default */
ret = lzma_easy_encoder(&lzfile->strm, level, LZMA_CHECK_CRC64);
ret = lzma_stream_encoder(&lzfile->strm, lzfile->filters, LZMA_CHECK_CRC64);
} else {
lzma_options_lzma options;
lzma_lzma_preset(&options, level);
ret = lzma_alone_encoder(&lzfile->strm, &options);
ret = lzma_alone_encoder(&lzfile->strm, &lzfile->options);
}
} else {
/* We set the memlimit for decompression to 100MiB which should be