Skip to content

Commit

Permalink
MFV: xz 5.4.4.
Browse files Browse the repository at this point in the history
MFC-after:	2 weeks
  • Loading branch information
delphij committed Aug 3, 2023
2 parents a93409f + 42df52d commit 1f3ced2
Show file tree
Hide file tree
Showing 26 changed files with 774 additions and 55 deletions.
704 changes: 704 additions & 0 deletions contrib/xz/ChangeLog

Large diffs are not rendered by default.

4 changes: 4 additions & 0 deletions contrib/xz/README
Original file line number Diff line number Diff line change
Expand Up @@ -289,6 +289,10 @@ XZ Utils

https://tukaani.org/xz/embedded.html

XZ for Java is a complete implementation written in pure Java.

https://tukaani.org/xz/java.html


6. Contact information
----------------------
Expand Down
3 changes: 3 additions & 0 deletions contrib/xz/THANKS
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ has been important. :-) In alphabetical order:
- Jakub Bogusz
- Adam Borowski
- Maarten Bosmans
- Benjamin Buch
- Trent W. Buck
- Kevin R. Bulgrien
- James Buren
Expand Down Expand Up @@ -103,6 +104,7 @@ has been important. :-) In alphabetical order:
- Jonathan Nieder
- Andre Noll
- Peter O'Gorman
- Dimitri Papadopoulos Orfanos
- Daniel Packard
- Filip Palian
- Peter Pallinger
Expand Down Expand Up @@ -143,6 +145,7 @@ has been important. :-) In alphabetical order:
- Paul Townsend
- Mohammed Adnène Trojette
- Alexey Tourbin
- Taiki Tsunekawa
- Loganaden Velvindron
- Patrick J. Volkerding
- Martin Väth
Expand Down
2 changes: 1 addition & 1 deletion contrib/xz/src/common/mythread.h
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ do { \
} while (0)


#if !(defined(_WIN32) && !defined(__CYGWIN__))
#if !(defined(_WIN32) && !defined(__CYGWIN__)) && !defined(__wasm__)
// Use sigprocmask() to set the signal mask in single-threaded programs.
#include <signal.h>

Expand Down
9 changes: 5 additions & 4 deletions contrib/xz/src/liblzma/api/lzma/container.h
Original file line number Diff line number Diff line change
Expand Up @@ -468,7 +468,7 @@ extern LZMA_API(lzma_ret) lzma_alone_encoder(
/**
* \brief Calculate output buffer size for single-call Stream encoder
*
* When trying to compress uncompressible data, the encoded size will be
* When trying to compress incompressible data, the encoded size will be
* slightly bigger than the input data. This function calculates how much
* output buffer space is required to be sure that lzma_stream_buffer_encode()
* doesn't return LZMA_BUF_ERROR.
Expand All @@ -484,7 +484,7 @@ extern LZMA_API(lzma_ret) lzma_alone_encoder(
* \note The limit calculated by this function applies only to
* single-call encoding. Multi-call encoding may (and probably
* will) have larger maximum expansion when encoding
* uncompressible data. Currently there is no function to
* incompressible data. Currently there is no function to
* calculate the maximum expansion of multi-call encoding.
*
* \param uncompressed_size Size in bytes of the uncompressed
Expand Down Expand Up @@ -587,7 +587,8 @@ extern LZMA_API(lzma_ret) lzma_stream_buffer_encode(
* output space (6 bytes) to create a valid MicroLZMA stream.
*/
extern LZMA_API(lzma_ret) lzma_microlzma_encoder(
lzma_stream *strm, const lzma_options_lzma *options);
lzma_stream *strm, const lzma_options_lzma *options)
lzma_nothrow;


/************
Expand Down Expand Up @@ -964,4 +965,4 @@ extern LZMA_API(lzma_ret) lzma_stream_buffer_decode(
extern LZMA_API(lzma_ret) lzma_microlzma_decoder(
lzma_stream *strm, uint64_t comp_size,
uint64_t uncomp_size, lzma_bool uncomp_size_is_exact,
uint32_t dict_size);
uint32_t dict_size) lzma_nothrow;
4 changes: 2 additions & 2 deletions contrib/xz/src/liblzma/api/lzma/filter.h
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,7 @@ extern LZMA_API(lzma_ret) lzma_raw_decoder(
* chain to be used for the next Block(s).
*
* - After LZMA_SYNC_FLUSH: Raw encoder (lzma_raw_encoder()),
* Block encocder (lzma_block_encoder()), and single-threaded .xz Stream
* Block encoder (lzma_block_encoder()), and single-threaded .xz Stream
* encoder (lzma_stream_encoder()) allow changing certain filter-specific
* options in the middle of encoding. The actual filters in the chain
* (Filter IDs) must not be changed! Currently only the lc, lp, and pb
Expand Down Expand Up @@ -731,7 +731,7 @@ extern LZMA_API(lzma_ret) lzma_str_from_filters(
*
* If a filter_id is given then only one line is created which contains the
* filter name. If LZMA_STR_ENCODER or LZMA_STR_DECODER is used then the
* options required for encoding or decoding are listed on the same line too.
* options read by the encoder or decoder are printed on the same line.
*
* If filter_id is LZMA_VLI_UNKNOWN then all supported .xz-compatible filters
* are listed:
Expand Down
4 changes: 2 additions & 2 deletions contrib/xz/src/liblzma/api/lzma/lzma12.h
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
*
* Usually you want this instead of LZMA1. Compared to LZMA1, LZMA2 adds
* support for LZMA_SYNC_FLUSH, uncompressed chunks (smaller expansion
* when trying to compress uncompressible data), possibility to change
* when trying to compress incompressible data), possibility to change
* lc/lp/pb in the middle of encoding, and some other internal improvements.
*/
#define LZMA_FILTER_LZMA2 LZMA_VLI_C(0x21)
Expand Down Expand Up @@ -417,7 +417,7 @@ typedef struct {
* like it is with LZMA_FILTER_LZMA1. Without this flag the
* end marker isn't written and the application has to store
* the uncompressed size somewhere outside the compressed stream.
* To decompress streams without the end marker, the appliation
* To decompress streams without the end marker, the application
* has to set the correct uncompressed size in ext_size_low and
* ext_size_high.
*
Expand Down
2 changes: 1 addition & 1 deletion contrib/xz/src/liblzma/api/lzma/version.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
#define LZMA_VERSION_MINOR 4

/** \brief Patch version number of the liblzma release. */
#define LZMA_VERSION_PATCH 3
#define LZMA_VERSION_PATCH 4

/**
* \brief Version stability marker
Expand Down
2 changes: 1 addition & 1 deletion contrib/xz/src/liblzma/common/block_buffer_encoder.c
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,7 @@ block_buffer_encode(lzma_block *block, const lzma_allocator *allocator,
if (ret != LZMA_BUF_ERROR)
return ret;

// The data was uncompressible (at least with the options
// The data was incompressible (at least with the options
// given to us) or the output buffer was too small. Use the
// uncompressed chunks of LZMA2 to wrap the data into a valid
// Block. If we haven't been given enough output space, even
Expand Down
2 changes: 1 addition & 1 deletion contrib/xz/src/liblzma/common/common.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
// to 2 then symbol versioning is done only if also PIC is defined.
// By default Libtool defines PIC when building a shared library and
// doesn't define it when building a static library but it can be
// overriden with --with-pic and --without-pic. configure let's rely
// overridden with --with-pic and --without-pic. configure let's rely
// on PIC if neither --with-pic or --without-pic was used.
#if defined(HAVE_SYMBOL_VERSIONS_LINUX) \
&& (HAVE_SYMBOL_VERSIONS_LINUX == 2 && !defined(PIC))
Expand Down
2 changes: 1 addition & 1 deletion contrib/xz/src/liblzma/common/file_info.c
Original file line number Diff line number Diff line change
Expand Up @@ -350,7 +350,7 @@ file_info_decode(void *coder_ptr, const lzma_allocator *allocator,
// coder->temp[coder->temp_size - LZMA_STREAM_HEADER_SIZE].
//
// Otherwise we will need to seek. The seeking is done so
// that Stream Footer wil be at the end of coder->temp.
// that Stream Footer will be at the end of coder->temp.
// This way it's likely that we also get a complete Index
// field into coder->temp without needing a separate seek
// for that (unless the Index field is big).
Expand Down
2 changes: 1 addition & 1 deletion contrib/xz/src/liblzma/common/lzip_decoder.c
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ lzip_decode(void *coder_ptr, const lzma_allocator *allocator,
// The five lowest bits are for the base-2 logarithm of
// the dictionary size and the highest three bits are
// the fractional part (0/16 to 7/16) that will be
// substracted to get the final value.
// subtracted to get the final value.
//
// For example, with 0xB5:
// b2log = 21
Expand Down
10 changes: 6 additions & 4 deletions contrib/xz/src/liblzma/common/memcmplen.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@
// on Windows when using an MSVC compatible compiler. The Intel compiler
// can use the intrinsics without the header file.
#if defined(TUKLIB_FAST_UNALIGNED_ACCESS) \
&& (defined(_MSC_VER) \
&& defined(_MSC_VER) \
&& defined(_M_X64) \
&& !defined(__INTEL_COMPILER))
&& !defined(__INTEL_COMPILER)
# include <intrin.h>
#endif

Expand Down Expand Up @@ -69,11 +69,13 @@ lzma_memcmplen(const uint8_t *buf1, const uint8_t *buf2,
while (len < limit) {
const uint64_t x = read64ne(buf1 + len) - read64ne(buf2 + len);
if (x != 0) {
# if defined(_M_X64) // MSVC or Intel C compiler on Windows
// MSVC or Intel C compiler on Windows
# if (defined(_MSC_VER) || defined(__INTEL_COMPILER)) && defined(_M_X64)
unsigned long tmp;
_BitScanForward64(&tmp, x);
len += (uint32_t)tmp >> 3;
# else // GCC, clang, or Intel C compiler
// GCC, Clang, or Intel C compiler
# else
len += (uint32_t)__builtin_ctzll(x) >> 3;
# endif
return my_min(len, limit);
Expand Down
8 changes: 4 additions & 4 deletions contrib/xz/src/liblzma/common/stream_decoder_mt.c
Original file line number Diff line number Diff line change
Expand Up @@ -629,7 +629,7 @@ get_thread(struct lzma_stream_coder *coder, const lzma_allocator *allocator)
coder->thr = coder->threads_free;
coder->threads_free = coder->threads_free->next;

// The thread is no longer in the cache so substract
// The thread is no longer in the cache so subtract
// it from the cached memory usage. Don't add it
// to mem_in_use though; the caller will handle it
// since it knows how much memory it will actually
Expand Down Expand Up @@ -1359,7 +1359,7 @@ stream_decode_mt(void *coder_ptr, const lzma_allocator *allocator,
// towards more favorable conditions (less memory in use,
// more in cache).
//
// These are initalized to silence warnings.
// These are initialized to silence warnings.
uint64_t mem_in_use = 0;
uint64_t mem_cached = 0;
struct worker_thread *thr = NULL;
Expand Down Expand Up @@ -1425,7 +1425,7 @@ stream_decode_mt(void *coder_ptr, const lzma_allocator *allocator,
}

// Update the memory usage counters. Note that coder->mem_*
// may have changed since we read them so we must substract
// may have changed since we read them so we must subtract
// or add the changes.
mythread_sync(coder->mutex) {
coder->mem_cached -= mem_freed;
Expand All @@ -1438,7 +1438,7 @@ stream_decode_mt(void *coder_ptr, const lzma_allocator *allocator,
// coder->mem_cached might count the same thing twice.
// If so, this will get corrected in get_thread() when
// a worker_thread is picked from coder->free_threads
// and its memory usage is substracted from mem_cached.
// and its memory usage is subtracted from mem_cached.
coder->mem_in_use += coder->mem_next_in
+ coder->mem_next_filters;
}
Expand Down
2 changes: 1 addition & 1 deletion contrib/xz/src/liblzma/common/stream_encoder_mt.c
Original file line number Diff line number Diff line change
Expand Up @@ -743,7 +743,7 @@ stream_encode_mt(void *coder_ptr, const lzma_allocator *allocator,

// These are for wait_for_work().
bool has_blocked = false;
mythread_condtime wait_abs;
mythread_condtime wait_abs = { 0 };

while (true) {
mythread_sync(coder->mutex) {
Expand Down
10 changes: 5 additions & 5 deletions contrib/xz/src/liblzma/common/string_conversion.c
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ typedef struct {
/// (default is uint32_t).
///
/// Stringifying a filter is done by processing a given number of options
/// in oder from the beginning of an option_map array. The integer is
/// in order from the beginning of an option_map array. The integer is
/// read from filter_options at .offset using the type from .type.
///
/// If the integer is zero and .flags has OPTMAP_NO_STRFY_ZERO then the
Expand Down Expand Up @@ -466,9 +466,9 @@ static const struct {
/// If the flag LZMA_STR_ENCODER is used then the first
/// strfy_encoder elements of optmap are stringified.
/// With LZMA_STR_DECODER strfy_decoder is used.
/// Currently encoders use all flags that decoders do but if
/// Currently encoders use all options that decoders do but if
/// that changes then this needs to be changed too, for example,
/// add a new OPTMAP flag to skip printing some decoder-only flags.
/// add a new OPTMAP flag to skip printing some decoder-only options.
const option_map *optmap;
uint8_t strfy_encoder;
uint8_t strfy_decoder;
Expand Down Expand Up @@ -538,7 +538,7 @@ static const struct {
///
/// The input string starts at *str and the address in str_end is the first
/// char that is not part of the string anymore. So no '\0' terminator is
/// used. *str is advanced everytime something has been decoded successfully.
/// used. *str is advanced every time something has been decoded successfully.
static const char *
parse_options(const char **const str, const char *str_end,
void *filter_options,
Expand Down Expand Up @@ -844,7 +844,7 @@ parse_filter(const char **const str, const char *str_end, lzma_filter *filter,

/// Converts the string to a filter chain (array of lzma_filter structures).
///
/// *str is advanced everytime something has been decoded successfully.
/// *str is advanced every time something has been decoded successfully.
/// This way the caller knows where in the string a possible error occurred.
static const char *
str_to_filters(const char **const str, lzma_filter *filters, uint32_t flags,
Expand Down
2 changes: 1 addition & 1 deletion contrib/xz/src/liblzma/lz/lz_encoder.h
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ typedef struct {
//
// Algorithms such as LZMA2 first try to compress a chunk, and then check
// if the encoded result is smaller than the uncompressed one. If the chunk
// was uncompressible, it is better to store it in uncompressed form in
// was incompressible, it is better to store it in uncompressed form in
// the output stream. To do this, the whole uncompressed chunk has to be
// still available in the history buffer. before_size achieves that.

Expand Down
4 changes: 2 additions & 2 deletions contrib/xz/src/liblzma/lzma/lzma_encoder.c
Original file line number Diff line number Diff line change
Expand Up @@ -633,7 +633,7 @@ lzma_lzma_encoder_create(void **coder_ptr, const lzma_allocator *allocator,
// Currently the maximum encoder dictionary size
// is 1.5 GiB due to lz_encoder.c and here we need
// to be below 2 GiB to make the rounded up value
// fit in an uint32_t and avoid an infite while-loop
// fit in an uint32_t and avoid an infinite while-loop
// (and undefined behavior due to a too large shift).
// So do the same check as in LZ encoder,
// limiting to 1.5 GiB.
Expand Down Expand Up @@ -673,7 +673,7 @@ lzma_lzma_encoder_create(void **coder_ptr, const lzma_allocator *allocator,
coder->uncomp_size = 0;
coder->uncomp_size_ptr = NULL;

// Output size limitting is disabled by default.
// Output size limiting is disabled by default.
coder->out_limit = 0;

// Determine if end marker is wanted:
Expand Down
5 changes: 4 additions & 1 deletion contrib/xz/src/xz/args.c
Original file line number Diff line number Diff line change
Expand Up @@ -527,7 +527,10 @@ parse_real(args_info *args, int argc, char **argv)
args->files_file = fopen(optarg,
c == OPT_FILES ? "r" : "rb");
if (args->files_file == NULL)
message_fatal("%s: %s", optarg,
// TRANSLATORS: This is a translatable
// string because French needs a space
// before the colon ("%s : %s").
message_fatal(_("%s: %s"), optarg,
strerror(errno));
}

Expand Down
8 changes: 4 additions & 4 deletions contrib/xz/src/xz/coder.c
Original file line number Diff line number Diff line change
Expand Up @@ -688,7 +688,7 @@ coder_init(file_pair *pair)
strm.avail_out = 0;
while ((ret = lzma_code(&strm, LZMA_RUN))
== LZMA_UNSUPPORTED_CHECK)
message_warning("%s: %s", pair->src_name,
message_warning(_("%s: %s"), pair->src_name,
message_strm(ret));

// With --single-stream lzma_code won't wait for
Expand All @@ -704,7 +704,7 @@ coder_init(file_pair *pair)
}

if (ret != LZMA_OK) {
message_error("%s: %s", pair->src_name, message_strm(ret));
message_error(_("%s: %s"), pair->src_name, message_strm(ret));
if (ret == LZMA_MEMLIMIT_ERROR)
message_mem_needed(V_ERROR, lzma_memusage(&strm));

Expand Down Expand Up @@ -964,10 +964,10 @@ coder_normal(file_pair *pair)
// wrong and we print an error. Otherwise it's just
// a warning and coding can continue.
if (stop) {
message_error("%s: %s", pair->src_name,
message_error(_("%s: %s"), pair->src_name,
message_strm(ret));
} else {
message_warning("%s: %s", pair->src_name,
message_warning(_("%s: %s"), pair->src_name,
message_strm(ret));

// When compressing, all possible errors set
Expand Down
8 changes: 4 additions & 4 deletions contrib/xz/src/xz/file_io.c
Original file line number Diff line number Diff line change
Expand Up @@ -602,7 +602,7 @@ io_open_src_real(file_pair *pair)
if (!follow_symlinks) {
struct stat st;
if (lstat(pair->src_name, &st)) {
message_error("%s: %s", pair->src_name,
message_error(_("%s: %s"), pair->src_name,
strerror(errno));
return true;

Expand Down Expand Up @@ -676,7 +676,7 @@ io_open_src_real(file_pair *pair)
// Something else than O_NOFOLLOW failing
// (assuming that the race conditions didn't
// confuse us).
message_error("%s: %s", pair->src_name,
message_error(_("%s: %s"), pair->src_name,
strerror(errno));

return true;
Expand Down Expand Up @@ -766,7 +766,7 @@ io_open_src_real(file_pair *pair)
return false;

error_msg:
message_error("%s: %s", pair->src_name, strerror(errno));
message_error(_("%s: %s"), pair->src_name, strerror(errno));
error:
(void)close(pair->src_fd);
return true;
Expand Down Expand Up @@ -937,7 +937,7 @@ io_open_dest_real(file_pair *pair)
pair->dest_fd = open(pair->dest_name, flags, mode);

if (pair->dest_fd == -1) {
message_error("%s: %s", pair->dest_name,
message_error(_("%s: %s"), pair->dest_name,
strerror(errno));
free(pair->dest_name);
return true;
Expand Down
4 changes: 2 additions & 2 deletions contrib/xz/src/xz/hardware.c
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ static uint64_t memlimit_decompress = 0;
///
/// - Default value for --memlimit-mt-decompress
///
/// This value is caluclated in hardware_init() and cannot be changed later.
/// This value is calculated in hardware_init() and cannot be changed later.
static uint64_t memlimit_mt_default;

/// Memory usage limit for multithreaded decompression. This is a soft limit:
Expand Down Expand Up @@ -147,7 +147,7 @@ hardware_memlimit_set(uint64_t new_memlimit,
// for the xz program and so on. Don't use 4000 MiB because
// it could look like someone mixed up base-2 and base-10.
#ifdef __mips__
// For MIPS32, due to architectural pecularities,
// For MIPS32, due to architectural peculiarities,
// the limit is even lower.
const uint64_t limit_max = UINT64_C(2000) << 20;
#else
Expand Down
Loading

0 comments on commit 1f3ced2

Please sign in to comment.