mirror of
https://git.tukaani.org/xz.git
synced 2024-04-04 12:36:23 +02:00
Collection of language fixes to comments and docs.
Thanks to Jonathan Nieder.
This commit is contained in:
parent
4785f2021a
commit
eb7d51a3fa
47 changed files with 77 additions and 77 deletions
2
README
2
README
|
@ -16,7 +16,7 @@ XZ Utils
|
||||||
0. Overview
|
0. Overview
|
||||||
-----------
|
-----------
|
||||||
|
|
||||||
XZ Utils provide a general purporse data compression library and
|
XZ Utils provide a general-purpose data compression library and
|
||||||
command line tools. The native file format is the .xz format, but
|
command line tools. The native file format is the .xz format, but
|
||||||
also the legacy .lzma format is supported. The .xz format supports
|
also the legacy .lzma format is supported. The .xz format supports
|
||||||
multiple compression algorithms, which are called "filters" in
|
multiple compression algorithms, which are called "filters" in
|
||||||
|
|
|
@ -612,7 +612,7 @@ AC_SUBST([AM_CFLAGS])
|
||||||
# Set additional flags for static/dynamic linking. The idea is that every
|
# Set additional flags for static/dynamic linking. The idea is that every
|
||||||
# program (not library) being built will use either STATIC_{CPPFLAGS,LDFLAGS}
|
# program (not library) being built will use either STATIC_{CPPFLAGS,LDFLAGS}
|
||||||
# or DYNAMIC_{CPPFLAGS,LDFLAGS} depending on which type of linkage is
|
# or DYNAMIC_{CPPFLAGS,LDFLAGS} depending on which type of linkage is
|
||||||
# preferred. These preferences get overriden by use of --disable-static,
|
# preferred. These preferences get overridden by use of --disable-static,
|
||||||
# --disable-shared, or --enable-dynamic.
|
# --disable-shared, or --enable-dynamic.
|
||||||
#
|
#
|
||||||
# This is quite messy, because we want to use LZMA_API_STATIC when linking
|
# This is quite messy, because we want to use LZMA_API_STATIC when linking
|
||||||
|
|
|
@ -117,6 +117,6 @@ A: Give --enable-small to the configure script. Use also appropriate
|
||||||
for size. See INSTALL for information about configure options.
|
for size. See INSTALL for information about configure options.
|
||||||
|
|
||||||
If the result is still too big, take a look at XZ Embedded. It is
|
If the result is still too big, take a look at XZ Embedded. It is
|
||||||
a separate project, which provides a limited but signinificantly
|
a separate project, which provides a limited but significantly
|
||||||
smaller XZ decoder implementation than XZ Utils.
|
smaller XZ decoder implementation than XZ Utils.
|
||||||
|
|
||||||
|
|
|
@ -62,7 +62,7 @@ if printf '%s\n' "$INFO" | grep -q '^Block = 1'; then
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Get copmressed, uncompressed, and dictionary size.
|
# Get compressed, uncompressed, and dictionary size.
|
||||||
CSIZE=$(printf '%s\n' "$INFO" | sed -rn 's|^Packed Size = ([0-9]+$)|\1|p')
|
CSIZE=$(printf '%s\n' "$INFO" | sed -rn 's|^Packed Size = ([0-9]+$)|\1|p')
|
||||||
USIZE=$(printf '%s\n' "$INFO" | sed -rn 's|^Size = ([0-9]+$)|\1|p')
|
USIZE=$(printf '%s\n' "$INFO" | sed -rn 's|^Size = ([0-9]+$)|\1|p')
|
||||||
DICT=$(printf '%s\n' "$INFO" | sed -rn 's|^Method = LZMA:([0-9]+[bkm]?)$|\1|p')
|
DICT=$(printf '%s\n' "$INFO" | sed -rn 's|^Method = LZMA:([0-9]+[bkm]?)$|\1|p')
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
//
|
//
|
||||||
/// \file tuklib_progname.c
|
/// \file tuklib_progname.c
|
||||||
/// \brief Program name to be displayd in messages
|
/// \brief Program name to be displayed in messages
|
||||||
//
|
//
|
||||||
// Author: Lasse Collin
|
// Author: Lasse Collin
|
||||||
//
|
//
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
//
|
//
|
||||||
/// \file tuklib_progname.h
|
/// \file tuklib_progname.h
|
||||||
/// \brief Program name to be displayd in messages
|
/// \brief Program name to be displayed in messages
|
||||||
//
|
//
|
||||||
// Author: Lasse Collin
|
// Author: Lasse Collin
|
||||||
//
|
//
|
||||||
|
|
|
@ -81,7 +81,7 @@ typedef enum {
|
||||||
* the decoder. LZMA_NO_CHECK is just a warning, and
|
* the decoder. LZMA_NO_CHECK is just a warning, and
|
||||||
* the decoding can be continued normally.
|
* the decoding can be continued normally.
|
||||||
*
|
*
|
||||||
* It is possible to call lzma_get_check() immediatelly after
|
* It is possible to call lzma_get_check() immediately after
|
||||||
* lzma_code has returned LZMA_NO_CHECK. The result will
|
* lzma_code has returned LZMA_NO_CHECK. The result will
|
||||||
* naturally be LZMA_CHECK_NONE, but the possibility to call
|
* naturally be LZMA_CHECK_NONE, but the possibility to call
|
||||||
* lzma_get_check() may be convenient in some applications.
|
* lzma_get_check() may be convenient in some applications.
|
||||||
|
@ -107,7 +107,7 @@ typedef enum {
|
||||||
* errors may go undetected.
|
* errors may go undetected.
|
||||||
*
|
*
|
||||||
* With decoder, it is possible to call lzma_get_check()
|
* With decoder, it is possible to call lzma_get_check()
|
||||||
* immediatelly after lzma_code() has returned
|
* immediately after lzma_code() has returned
|
||||||
* LZMA_UNSUPPORTED_CHECK. This way it is possible to find
|
* LZMA_UNSUPPORTED_CHECK. This way it is possible to find
|
||||||
* out what the unsupported Check ID was.
|
* out what the unsupported Check ID was.
|
||||||
*/
|
*/
|
||||||
|
@ -280,7 +280,7 @@ typedef enum {
|
||||||
*
|
*
|
||||||
* Using LZMA_SYNC_FLUSH very often can dramatically reduce
|
* Using LZMA_SYNC_FLUSH very often can dramatically reduce
|
||||||
* the compression ratio. With some filters (for example,
|
* the compression ratio. With some filters (for example,
|
||||||
* LZMA2), finetuning the compression options may help
|
* LZMA2), fine-tuning the compression options may help
|
||||||
* mitigate this problem significantly.
|
* mitigate this problem significantly.
|
||||||
*
|
*
|
||||||
* Decoders don't support LZMA_SYNC_FLUSH.
|
* Decoders don't support LZMA_SYNC_FLUSH.
|
||||||
|
@ -489,7 +489,7 @@ typedef struct {
|
||||||
/**
|
/**
|
||||||
* \brief Initialization for lzma_stream
|
* \brief Initialization for lzma_stream
|
||||||
*
|
*
|
||||||
* When you declare an instance of lzma_stream, you can immediatelly
|
* When you declare an instance of lzma_stream, you can immediately
|
||||||
* initialize it so that initialization functions know that no memory
|
* initialize it so that initialization functions know that no memory
|
||||||
* has been allocated yet:
|
* has been allocated yet:
|
||||||
*
|
*
|
||||||
|
|
|
@ -77,7 +77,7 @@ typedef struct {
|
||||||
* This setting is useful only when the same filter is used
|
* This setting is useful only when the same filter is used
|
||||||
* _separately_ for multiple sections of the same executable file,
|
* _separately_ for multiple sections of the same executable file,
|
||||||
* and the sections contain cross-section branch/call/jump
|
* and the sections contain cross-section branch/call/jump
|
||||||
* instructions. In that case it is benefical to set the start
|
* instructions. In that case it is beneficial to set the start
|
||||||
* offset of the non-first sections so that the relative addresses
|
* offset of the non-first sections so that the relative addresses
|
||||||
* of the cross-section branch/call/jump instructions will use the
|
* of the cross-section branch/call/jump instructions will use the
|
||||||
* same absolute addresses as in the first section.
|
* same absolute addresses as in the first section.
|
||||||
|
|
|
@ -414,7 +414,7 @@ extern LZMA_API(lzma_vli) lzma_block_total_size(const lzma_block *block)
|
||||||
* \return - LZMA_OK: All good, continue with lzma_code().
|
* \return - LZMA_OK: All good, continue with lzma_code().
|
||||||
* - LZMA_MEM_ERROR
|
* - LZMA_MEM_ERROR
|
||||||
* - LZMA_OPTIONS_ERROR
|
* - LZMA_OPTIONS_ERROR
|
||||||
* - LZMA_UNSUPPORTED_CHECK: block->check specfies a Check ID
|
* - LZMA_UNSUPPORTED_CHECK: block->check specifies a Check ID
|
||||||
* that is not supported by this buid of liblzma. Initializing
|
* that is not supported by this buid of liblzma. Initializing
|
||||||
* the encoder failed.
|
* the encoder failed.
|
||||||
* - LZMA_PROG_ERROR
|
* - LZMA_PROG_ERROR
|
||||||
|
|
|
@ -142,7 +142,7 @@ extern LZMA_API(uint64_t) lzma_crc64(
|
||||||
/**
|
/**
|
||||||
* \brief Get the type of the integrity check
|
* \brief Get the type of the integrity check
|
||||||
*
|
*
|
||||||
* This function can be called only immediatelly after lzma_code() has
|
* This function can be called only immediately after lzma_code() has
|
||||||
* returned LZMA_NO_CHECK, LZMA_UNSUPPORTED_CHECK, or LZMA_GET_CHECK.
|
* returned LZMA_NO_CHECK, LZMA_UNSUPPORTED_CHECK, or LZMA_GET_CHECK.
|
||||||
* Calling this function in any other situation has undefined behavior.
|
* Calling this function in any other situation has undefined behavior.
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -290,7 +290,7 @@ extern LZMA_API(lzma_ret) lzma_raw_buffer_decode(
|
||||||
* using the raw encoder and decoder.
|
* using the raw encoder and decoder.
|
||||||
*
|
*
|
||||||
* \param size Pointer to uint32_t to hold the size of the properties
|
* \param size Pointer to uint32_t to hold the size of the properties
|
||||||
* \param filter Filter ID and options (the size of the propeties may
|
* \param filter Filter ID and options (the size of the properties may
|
||||||
* vary depending on the options)
|
* vary depending on the options)
|
||||||
*
|
*
|
||||||
* \return - LZMA_OK
|
* \return - LZMA_OK
|
||||||
|
@ -365,7 +365,7 @@ extern LZMA_API(lzma_ret) lzma_properties_decode(
|
||||||
*
|
*
|
||||||
* \param size Pointer to integer to hold the calculated size
|
* \param size Pointer to integer to hold the calculated size
|
||||||
* \param filters Filter ID and associated options whose encoded
|
* \param filters Filter ID and associated options whose encoded
|
||||||
* size is to be calculted
|
* size is to be calculated
|
||||||
*
|
*
|
||||||
* \return - LZMA_OK: *size set successfully. Note that this doesn't
|
* \return - LZMA_OK: *size set successfully. Note that this doesn't
|
||||||
* guarantee that filters->options is valid, thus
|
* guarantee that filters->options is valid, thus
|
||||||
|
|
|
@ -278,7 +278,7 @@ typedef enum {
|
||||||
*
|
*
|
||||||
* This function calculates an approximate amount of memory needed hold
|
* This function calculates an approximate amount of memory needed hold
|
||||||
* the given number of Streams and Blocks in lzma_index structure. This
|
* the given number of Streams and Blocks in lzma_index structure. This
|
||||||
* value may vary between CPU archtectures and also between liblzma versions
|
* value may vary between CPU architectures and also between liblzma versions
|
||||||
* if the internal implementation is modified.
|
* if the internal implementation is modified.
|
||||||
*/
|
*/
|
||||||
extern LZMA_API(uint64_t) lzma_index_memusage(
|
extern LZMA_API(uint64_t) lzma_index_memusage(
|
||||||
|
@ -477,7 +477,7 @@ extern LZMA_API(lzma_vli) lzma_index_uncompressed_size(const lzma_index *i)
|
||||||
* associated lzma_index is valid, that is, until lzma_index_end() or
|
* associated lzma_index is valid, that is, until lzma_index_end() or
|
||||||
* using it as source in lzma_index_cat(). Specifically, lzma_index doesn't
|
* using it as source in lzma_index_cat(). Specifically, lzma_index doesn't
|
||||||
* become invalid if new Blocks are added to it with lzma_index_append() or
|
* become invalid if new Blocks are added to it with lzma_index_append() or
|
||||||
* if it is used as the destionation in lzma_index_cat().
|
* if it is used as the destination in lzma_index_cat().
|
||||||
*
|
*
|
||||||
* It is safe to make copies of an initialized lzma_index_iter, for example,
|
* It is safe to make copies of an initialized lzma_index_iter, for example,
|
||||||
* to easily restart reading at some particular position.
|
* to easily restart reading at some particular position.
|
||||||
|
@ -549,7 +549,7 @@ extern LZMA_API(lzma_bool) lzma_index_iter_locate(
|
||||||
* Stream.
|
* Stream.
|
||||||
*
|
*
|
||||||
* \param dest lzma_index after which src is appended
|
* \param dest lzma_index after which src is appended
|
||||||
* \param src lzma_index to be appeneded after dest. If this
|
* \param src lzma_index to be appended after dest. If this
|
||||||
* function succeeds, the memory allocated for src
|
* function succeeds, the memory allocated for src
|
||||||
* is freed or moved to be part of dest, and all
|
* is freed or moved to be part of dest, and all
|
||||||
* iterators pointing to src will become invalid.
|
* iterators pointing to src will become invalid.
|
||||||
|
|
|
@ -307,7 +307,7 @@ typedef struct {
|
||||||
* This determines how many bytes the encoder compares from the match
|
* This determines how many bytes the encoder compares from the match
|
||||||
* candidates when looking for the best match. Once a match of at
|
* candidates when looking for the best match. Once a match of at
|
||||||
* least nice_len bytes long is found, the encoder stops looking for
|
* least nice_len bytes long is found, the encoder stops looking for
|
||||||
* better condidates and encodes the match. (Naturally, if the found
|
* better candidates and encodes the match. (Naturally, if the found
|
||||||
* match is actually longer than nice_len, the actual length is
|
* match is actually longer than nice_len, the actual length is
|
||||||
* encoded; it's not truncated to nice_len.)
|
* encoded; it's not truncated to nice_len.)
|
||||||
*
|
*
|
||||||
|
|
|
@ -18,7 +18,7 @@
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Version number splitted in components
|
* Version number split into components
|
||||||
*/
|
*/
|
||||||
#define LZMA_VERSION_MAJOR 4
|
#define LZMA_VERSION_MAJOR 4
|
||||||
#define LZMA_VERSION_MINOR 999
|
#define LZMA_VERSION_MINOR 999
|
||||||
|
|
|
@ -57,7 +57,7 @@
|
||||||
* [0, LZMA_VLI_MAX]. Unknown value is indicated with LZMA_VLI_UNKNOWN,
|
* [0, LZMA_VLI_MAX]. Unknown value is indicated with LZMA_VLI_UNKNOWN,
|
||||||
* which is the maximum value of the underlaying integer type.
|
* which is the maximum value of the underlaying integer type.
|
||||||
*
|
*
|
||||||
* In future, even if lzma_vli is typdefined to something else than uint64_t,
|
* In future, even if lzma_vli is defined to be something other than uint64_t,
|
||||||
* it is guaranteed that 2 * LZMA_VLI_MAX will not overflow lzma_vli.
|
* it is guaranteed that 2 * LZMA_VLI_MAX will not overflow lzma_vli.
|
||||||
* This simplifies integer overflow detection.
|
* This simplifies integer overflow detection.
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -73,7 +73,7 @@ lzma_block_header_size(lzma_block *block)
|
||||||
extern LZMA_API(lzma_ret)
|
extern LZMA_API(lzma_ret)
|
||||||
lzma_block_header_encode(const lzma_block *block, uint8_t *out)
|
lzma_block_header_encode(const lzma_block *block, uint8_t *out)
|
||||||
{
|
{
|
||||||
// Valdidate everything but filters.
|
// Validate everything but filters.
|
||||||
if (lzma_block_unpadded_size(block) == 0
|
if (lzma_block_unpadded_size(block) == 0
|
||||||
|| !lzma_vli_is_valid(block->uncompressed_size))
|
|| !lzma_vli_is_valid(block->uncompressed_size))
|
||||||
return LZMA_PROG_ERROR;
|
return LZMA_PROG_ERROR;
|
||||||
|
|
|
@ -20,7 +20,7 @@
|
||||||
* doing multi-threaded encoding.
|
* doing multi-threaded encoding.
|
||||||
*
|
*
|
||||||
* When compressing a large file on a system having multiple CPUs or CPU
|
* When compressing a large file on a system having multiple CPUs or CPU
|
||||||
* cores, the file can be splitted in smaller chunks, that are compressed
|
* cores, the file can be split into smaller chunks, that are compressed
|
||||||
* independently into separate Blocks in the same .lzma Stream.
|
* independently into separate Blocks in the same .lzma Stream.
|
||||||
*
|
*
|
||||||
* \return Minimum reasonable Uncompressed Size of a Block. The
|
* \return Minimum reasonable Uncompressed Size of a Block. The
|
||||||
|
@ -45,7 +45,7 @@ lzma_chunk_size(const lzma_options_filter *filters)
|
||||||
case LZMA_FILTER_ARMTHUMB:
|
case LZMA_FILTER_ARMTHUMB:
|
||||||
case LZMA_FILTER_SPARC:
|
case LZMA_FILTER_SPARC:
|
||||||
// These are very fast, thus there is no point in
|
// These are very fast, thus there is no point in
|
||||||
// splitting the data in smaller blocks.
|
// splitting the data into smaller blocks.
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case LZMA_FILTER_LZMA1:
|
case LZMA_FILTER_LZMA1:
|
||||||
|
|
|
@ -50,7 +50,7 @@
|
||||||
|
|
||||||
|
|
||||||
/// Starting value for memory usage estimates. Instead of calculating size
|
/// Starting value for memory usage estimates. Instead of calculating size
|
||||||
/// of _every_ structure and taking into accont malloc() overhead etc. we
|
/// of _every_ structure and taking into account malloc() overhead etc., we
|
||||||
/// add a base size to all memory usage estimates. It's not very accurate
|
/// add a base size to all memory usage estimates. It's not very accurate
|
||||||
/// but should be easily good enough.
|
/// but should be easily good enough.
|
||||||
#define LZMA_MEMUSAGE_BASE (UINT64_C(1) << 15)
|
#define LZMA_MEMUSAGE_BASE (UINT64_C(1) << 15)
|
||||||
|
@ -248,7 +248,7 @@ extern size_t lzma_bufcpy(const uint8_t *restrict in, size_t *restrict in_pos,
|
||||||
|
|
||||||
/// \brief Return if expression doesn't evaluate to LZMA_OK
|
/// \brief Return if expression doesn't evaluate to LZMA_OK
|
||||||
///
|
///
|
||||||
/// There are several situations where we want to return immediatelly
|
/// There are several situations where we want to return immediately
|
||||||
/// with the value of expr if it isn't LZMA_OK. This macro shortens
|
/// with the value of expr if it isn't LZMA_OK. This macro shortens
|
||||||
/// the code a little.
|
/// the code a little.
|
||||||
#define return_if_error(expr) \
|
#define return_if_error(expr) \
|
||||||
|
|
|
@ -57,7 +57,7 @@ lzma_raw_buffer_decode(const lzma_filter *filters, lzma_allocator *allocator,
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
// All the input was consumed and output
|
// All the input was consumed and output
|
||||||
// buffer is full. Now we don't immediatelly
|
// buffer is full. Now we don't immediately
|
||||||
// know the reason for the error. Try
|
// know the reason for the error. Try
|
||||||
// decoding one more byte. If it succeeds,
|
// decoding one more byte. If it succeeds,
|
||||||
// then the output buffer was too small. If
|
// then the output buffer was too small. If
|
||||||
|
|
|
@ -32,7 +32,7 @@ typedef struct {
|
||||||
uint64_t (*memusage)(const void *options);
|
uint64_t (*memusage)(const void *options);
|
||||||
|
|
||||||
/// Calculates the minimum sane size for Blocks (or other types of
|
/// Calculates the minimum sane size for Blocks (or other types of
|
||||||
/// chunks) to which the input data can be splitted to make
|
/// chunks) to which the input data can be split to make
|
||||||
/// multithreaded encoding possible. If this is NULL, it is assumed
|
/// multithreaded encoding possible. If this is NULL, it is assumed
|
||||||
/// that the encoder is fast enough with single thread.
|
/// that the encoder is fast enough with single thread.
|
||||||
lzma_vli (*chunk_size)(const void *options);
|
lzma_vli (*chunk_size)(const void *options);
|
||||||
|
@ -45,7 +45,7 @@ typedef struct {
|
||||||
|
|
||||||
/// Encodes Filter Properties.
|
/// Encodes Filter Properties.
|
||||||
///
|
///
|
||||||
/// \return - LZMA_OK: Properties encoded sucessfully.
|
/// \return - LZMA_OK: Properties encoded successfully.
|
||||||
/// - LZMA_OPTIONS_ERROR: Unsupported options
|
/// - LZMA_OPTIONS_ERROR: Unsupported options
|
||||||
/// - LZMA_PROG_ERROR: Invalid options or not enough
|
/// - LZMA_PROG_ERROR: Invalid options or not enough
|
||||||
/// output space
|
/// output space
|
||||||
|
|
|
@ -737,7 +737,7 @@ typedef struct {
|
||||||
|
|
||||||
/// Add the Stream nodes from the source index to dest using recursion.
|
/// Add the Stream nodes from the source index to dest using recursion.
|
||||||
/// Simplest iterative traversal of the source tree wouldn't work, because
|
/// Simplest iterative traversal of the source tree wouldn't work, because
|
||||||
/// we update the pointers in nodes when moving them to the destinatino tree.
|
/// we update the pointers in nodes when moving them to the destination tree.
|
||||||
static void
|
static void
|
||||||
index_cat_helper(const index_cat_info *info, index_stream *this)
|
index_cat_helper(const index_cat_info *info, index_stream *this)
|
||||||
{
|
{
|
||||||
|
@ -867,7 +867,7 @@ index_dup_stream(const index_stream *src, lzma_allocator *allocator)
|
||||||
src->node.uncompressed_base, src->number,
|
src->node.uncompressed_base, src->number,
|
||||||
src->block_number_base, allocator);
|
src->block_number_base, allocator);
|
||||||
|
|
||||||
// Return immediatelly if allocation failed or if there are
|
// Return immediately if allocation failed or if there are
|
||||||
// no groups to duplicate.
|
// no groups to duplicate.
|
||||||
if (dest == NULL || src->groups.leftmost == NULL)
|
if (dest == NULL || src->groups.leftmost == NULL)
|
||||||
return dest;
|
return dest;
|
||||||
|
@ -1202,7 +1202,7 @@ lzma_index_iter_locate(lzma_index_iter *iter, lzma_vli target)
|
||||||
{
|
{
|
||||||
const lzma_index *i = iter->internal[ITER_INDEX].p;
|
const lzma_index *i = iter->internal[ITER_INDEX].p;
|
||||||
|
|
||||||
// If the target is past the end of the file, return immediatelly.
|
// If the target is past the end of the file, return immediately.
|
||||||
if (i->uncompressed_size <= target)
|
if (i->uncompressed_size <= target)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
|
|
|
@ -218,7 +218,7 @@ extern LZMA_API(lzma_ret)
|
||||||
lzma_index_buffer_encode(const lzma_index *i,
|
lzma_index_buffer_encode(const lzma_index *i,
|
||||||
uint8_t *out, size_t *out_pos, size_t out_size)
|
uint8_t *out, size_t *out_pos, size_t out_size)
|
||||||
{
|
{
|
||||||
// Validate the arugments.
|
// Validate the arguments.
|
||||||
if (i == NULL || out == NULL || out_pos == NULL || *out_pos > out_size)
|
if (i == NULL || out == NULL || out_pos == NULL || *out_pos > out_size)
|
||||||
return LZMA_PROG_ERROR;
|
return LZMA_PROG_ERROR;
|
||||||
|
|
||||||
|
|
|
@ -105,7 +105,7 @@ stream_encode(lzma_coder *coder, lzma_allocator *allocator,
|
||||||
case SEQ_BLOCK_INIT: {
|
case SEQ_BLOCK_INIT: {
|
||||||
if (*in_pos == in_size) {
|
if (*in_pos == in_size) {
|
||||||
// If we are requested to flush or finish the current
|
// If we are requested to flush or finish the current
|
||||||
// Block, return LZMA_STREAM_END immediatelly since
|
// Block, return LZMA_STREAM_END immediately since
|
||||||
// there's nothing to do.
|
// there's nothing to do.
|
||||||
if (action != LZMA_FINISH)
|
if (action != LZMA_FINISH)
|
||||||
return action == LZMA_RUN
|
return action == LZMA_RUN
|
||||||
|
|
|
@ -47,7 +47,7 @@ lzma_vli_decode(lzma_vli *restrict vli, size_t *vli_pos,
|
||||||
|
|
||||||
do {
|
do {
|
||||||
// Read the next byte. Use a temporary variable so that we
|
// Read the next byte. Use a temporary variable so that we
|
||||||
// can update *in_pos immediatelly.
|
// can update *in_pos immediately.
|
||||||
const uint8_t byte = in[*in_pos];
|
const uint8_t byte = in[*in_pos];
|
||||||
++*in_pos;
|
++*in_pos;
|
||||||
|
|
||||||
|
|
|
@ -229,7 +229,7 @@ lz_encoder_prepare(lzma_mf *mf, lzma_allocator *allocator,
|
||||||
mf->nice_len = lz_options->nice_len;
|
mf->nice_len = lz_options->nice_len;
|
||||||
|
|
||||||
// cyclic_size has to stay smaller than 2 Gi. Note that this doesn't
|
// cyclic_size has to stay smaller than 2 Gi. Note that this doesn't
|
||||||
// mean limitting dictionary size to less than 2 GiB. With a match
|
// mean limiting dictionary size to less than 2 GiB. With a match
|
||||||
// finder that uses multibyte resolution (hashes start at e.g. every
|
// finder that uses multibyte resolution (hashes start at e.g. every
|
||||||
// fourth byte), cyclic_size would stay below 2 Gi even when
|
// fourth byte), cyclic_size would stay below 2 Gi even when
|
||||||
// dictionary size is greater than 2 GiB.
|
// dictionary size is greater than 2 GiB.
|
||||||
|
|
|
@ -182,7 +182,7 @@ typedef struct {
|
||||||
// TODO: Maybe this could be changed by making the LZ-based encoders to
|
// TODO: Maybe this could be changed by making the LZ-based encoders to
|
||||||
// store the actual literals as they do with length-distance pairs.
|
// store the actual literals as they do with length-distance pairs.
|
||||||
//
|
//
|
||||||
// Alrogithms such as LZMA2 first try to compress a chunk, and then check
|
// 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
|
// 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 uncompressible, it is better to store it in uncompressed form in
|
||||||
// the output stream. To do this, the whole uncompressed chunk has to be
|
// the output stream. To do this, the whole uncompressed chunk has to be
|
||||||
|
|
|
@ -169,7 +169,7 @@ lzma2_encode(lzma_coder *restrict coder, lzma_mf *restrict mf,
|
||||||
uint32_t limit;
|
uint32_t limit;
|
||||||
|
|
||||||
if (left < mf->match_len_max) {
|
if (left < mf->match_len_max) {
|
||||||
// Must flush immediatelly since the next LZMA symbol
|
// Must flush immediately since the next LZMA symbol
|
||||||
// could make the uncompressed size of the chunk too
|
// could make the uncompressed size of the chunk too
|
||||||
// big.
|
// big.
|
||||||
limit = 0;
|
limit = 0;
|
||||||
|
|
|
@ -195,7 +195,7 @@ struct lzma_coder_s {
|
||||||
/// 2 (i.e. MATCH_LEN_MIN), 3, 4, and [5, 273].
|
/// 2 (i.e. MATCH_LEN_MIN), 3, 4, and [5, 273].
|
||||||
probability pos_slot[LEN_TO_POS_STATES][POS_SLOTS];
|
probability pos_slot[LEN_TO_POS_STATES][POS_SLOTS];
|
||||||
|
|
||||||
/// Probility trees for additional bits for match distance when the
|
/// Probability trees for additional bits for match distance when the
|
||||||
/// distance is in the range [4, 127].
|
/// distance is in the range [4, 127].
|
||||||
probability pos_special[FULL_DISTANCES - END_POS_MODEL_INDEX];
|
probability pos_special[FULL_DISTANCES - END_POS_MODEL_INDEX];
|
||||||
|
|
||||||
|
@ -600,7 +600,7 @@ lzma_decode(lzma_coder *restrict coder, lzma_dict *restrict dictptr,
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
} else {
|
} else {
|
||||||
// The distace is >= 128. Decode the
|
// The distance is >= 128. Decode the
|
||||||
// lower bits without probabilities
|
// lower bits without probabilities
|
||||||
// except the lowest four bits.
|
// except the lowest four bits.
|
||||||
assert(symbol >= 14);
|
assert(symbol >= 14);
|
||||||
|
|
|
@ -30,7 +30,7 @@ extern lzma_ret lzma_lzma_props_decode(
|
||||||
|
|
||||||
/// \brief Decodes the LZMA Properties byte (lc/lp/pb)
|
/// \brief Decodes the LZMA Properties byte (lc/lp/pb)
|
||||||
///
|
///
|
||||||
/// \return true if error occorred, false on success
|
/// \return true if error occurred, false on success
|
||||||
///
|
///
|
||||||
extern bool lzma_lzma_lclppb_decode(
|
extern bool lzma_lzma_lclppb_decode(
|
||||||
lzma_options_lzma *options, uint8_t byte);
|
lzma_options_lzma *options, uint8_t byte);
|
||||||
|
|
|
@ -62,7 +62,7 @@ lzma_lzma_optimum_fast(lzma_coder *restrict coder, lzma_mf *restrict mf,
|
||||||
&& buf[len] == buf_back[len]; ++len) ;
|
&& buf[len] == buf_back[len]; ++len) ;
|
||||||
|
|
||||||
// If we have found a repeated match that is at least
|
// If we have found a repeated match that is at least
|
||||||
// nice_len long, return it immediatelly.
|
// nice_len long, return it immediately.
|
||||||
if (len >= nice_len) {
|
if (len >= nice_len) {
|
||||||
*back_res = i;
|
*back_res = i;
|
||||||
*len_res = len;
|
*len_res = len;
|
||||||
|
|
|
@ -838,7 +838,7 @@ lzma_lzma_optimum_normal(lzma_coder *restrict coder, lzma_mf *restrict mf,
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: This needs quite a bit of cleaning still. But splitting
|
// TODO: This needs quite a bit of cleaning still. But splitting
|
||||||
// the oroginal function to two pieces makes it at least a little
|
// the original function into two pieces makes it at least a little
|
||||||
// more readable, since those two parts don't share many variables.
|
// more readable, since those two parts don't share many variables.
|
||||||
|
|
||||||
uint32_t len_end = helper1(coder, mf, back_res, len_res, position);
|
uint32_t len_end = helper1(coder, mf, back_res, len_res, position);
|
||||||
|
|
|
@ -85,7 +85,7 @@ struct lzma_coder_s {
|
||||||
/// Number of match candidates in matches[]
|
/// Number of match candidates in matches[]
|
||||||
uint32_t matches_count;
|
uint32_t matches_count;
|
||||||
|
|
||||||
/// Varibale to hold the length of the longest match between calls
|
/// Variable to hold the length of the longest match between calls
|
||||||
/// to lzma_lzma_optimum_*().
|
/// to lzma_lzma_optimum_*().
|
||||||
uint32_t longest_match_length;
|
uint32_t longest_match_length;
|
||||||
|
|
||||||
|
|
|
@ -88,7 +88,7 @@ simple_code(lzma_coder *coder, lzma_allocator *allocator,
|
||||||
out, out_pos, out_size);
|
out, out_pos, out_size);
|
||||||
|
|
||||||
// If we couldn't flush all the filtered data, return to
|
// If we couldn't flush all the filtered data, return to
|
||||||
// application immediatelly.
|
// application immediately.
|
||||||
if (coder->pos < coder->filtered)
|
if (coder->pos < coder->filtered)
|
||||||
return LZMA_OK;
|
return LZMA_OK;
|
||||||
|
|
||||||
|
|
|
@ -516,7 +516,7 @@ subblock_buffer(lzma_coder *coder, lzma_allocator *allocator,
|
||||||
// Run-length encoder
|
// Run-length encoder
|
||||||
//
|
//
|
||||||
// First check if there is some data pending and we
|
// First check if there is some data pending and we
|
||||||
// have an obvious need to flush it immediatelly.
|
// have an obvious need to flush it immediately.
|
||||||
if (coder->rle.count > 0
|
if (coder->rle.count > 0
|
||||||
&& (coder->rle.size
|
&& (coder->rle.size
|
||||||
!= coder->options->rle
|
!= coder->options->rle
|
||||||
|
|
|
@ -24,7 +24,7 @@ xzcmp, xzdiff, lzcmp, lzdiff \- compare compressed files
|
||||||
.SH DESCRIPTION
|
.SH DESCRIPTION
|
||||||
.B xzcmp
|
.B xzcmp
|
||||||
and
|
and
|
||||||
.B xdiff
|
.B xzdiff
|
||||||
invoke
|
invoke
|
||||||
.BR cmp (1)
|
.BR cmp (1)
|
||||||
or
|
or
|
||||||
|
|
|
@ -18,8 +18,8 @@ xzless, lzless \- view xz or lzma compressed (text) files
|
||||||
.RI [ file ...]
|
.RI [ file ...]
|
||||||
.SH DESCRIPTION
|
.SH DESCRIPTION
|
||||||
.B xzless
|
.B xzless
|
||||||
is a filter that displays pagefulls of uncompressed text from compressed
|
is a filter that displays text from compressed files to a terminal.
|
||||||
file(s) to a terminal. It works on files compressed with
|
It works on files compressed with
|
||||||
.BR xz (1)
|
.BR xz (1)
|
||||||
or
|
or
|
||||||
.BR lzma (1).
|
.BR lzma (1).
|
||||||
|
@ -32,13 +32,13 @@ reads from standard input.
|
||||||
.B xzless
|
.B xzless
|
||||||
uses
|
uses
|
||||||
.BR less (1)
|
.BR less (1)
|
||||||
as its only pager. Unlike
|
to present its output. Unlike
|
||||||
.BR xzmore ,
|
.BR xzmore ,
|
||||||
the choice of pagers is not alterable by an environment variable.
|
its choice of pager cannot be altered by setting an environment variable.
|
||||||
Commands are based on both
|
Commands are based on both
|
||||||
.BR more (1)
|
.BR more (1)
|
||||||
and
|
and
|
||||||
.BR vi (1),
|
.BR vi (1)
|
||||||
and allow back and forth movement and searching.
|
and allow back and forth movement and searching.
|
||||||
See the
|
See the
|
||||||
.BR less (1)
|
.BR less (1)
|
||||||
|
|
|
@ -189,7 +189,7 @@ coder_set_compression_settings(void)
|
||||||
|
|
||||||
if (memory_usage > memory_limit) {
|
if (memory_usage > memory_limit) {
|
||||||
// If --no-auto-adjust was used or we didn't find LZMA1 or
|
// If --no-auto-adjust was used or we didn't find LZMA1 or
|
||||||
// LZMA2 as the last filter, give an error immediatelly.
|
// LZMA2 as the last filter, give an error immediately.
|
||||||
// --format=raw implies --no-auto-adjust.
|
// --format=raw implies --no-auto-adjust.
|
||||||
if (!auto_adjust || opt_format == FORMAT_RAW)
|
if (!auto_adjust || opt_format == FORMAT_RAW)
|
||||||
memlimit_too_small(memory_usage);
|
memlimit_too_small(memory_usage);
|
||||||
|
|
|
@ -54,7 +54,7 @@ extern void
|
||||||
io_init(void)
|
io_init(void)
|
||||||
{
|
{
|
||||||
// Make sure that stdin, stdout, and and stderr are connected to
|
// Make sure that stdin, stdout, and and stderr are connected to
|
||||||
// a valid file descriptor. Exit immediatelly with exit code ERROR
|
// a valid file descriptor. Exit immediately with exit code ERROR
|
||||||
// if we cannot make the file descriptors valid. Maybe we should
|
// if we cannot make the file descriptors valid. Maybe we should
|
||||||
// print an error message, but our stderr could be screwed anyway.
|
// print an error message, but our stderr could be screwed anyway.
|
||||||
tuklib_open_stdxxx(E_ERROR);
|
tuklib_open_stdxxx(E_ERROR);
|
||||||
|
|
|
@ -46,7 +46,7 @@ static const char *
|
||||||
read_name(const args_info *args)
|
read_name(const args_info *args)
|
||||||
{
|
{
|
||||||
// FIXME: Maybe we should have some kind of memory usage limit here
|
// FIXME: Maybe we should have some kind of memory usage limit here
|
||||||
// like the tool has for the actual compression and uncompression.
|
// like the tool has for the actual compression and decompression.
|
||||||
// Giving some huge text file with --files0 makes us to read the
|
// Giving some huge text file with --files0 makes us to read the
|
||||||
// whole file in RAM.
|
// whole file in RAM.
|
||||||
static char *name = NULL;
|
static char *name = NULL;
|
||||||
|
@ -188,7 +188,7 @@ main(int argc, char **argv)
|
||||||
if (opt_mode != MODE_LIST)
|
if (opt_mode != MODE_LIST)
|
||||||
signals_init();
|
signals_init();
|
||||||
|
|
||||||
// coder_run() handles compression, decopmression, and testing.
|
// coder_run() handles compression, decompression, and testing.
|
||||||
// list_file() is for --list.
|
// list_file() is for --list.
|
||||||
void (*run)(const char *filename) = opt_mode == MODE_LIST
|
void (*run)(const char *filename) = opt_mode == MODE_LIST
|
||||||
? &list_file : &coder_run;
|
? &list_file : &coder_run;
|
||||||
|
@ -226,7 +226,7 @@ main(int argc, char **argv)
|
||||||
args.arg_names[i] = (char *)stdin_filename;
|
args.arg_names[i] = (char *)stdin_filename;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Do the actual compression or uncompression.
|
// Do the actual compression or decompression.
|
||||||
run(args.arg_names[i]);
|
run(args.arg_names[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
//
|
//
|
||||||
/// \file main.h
|
/// \file main.h
|
||||||
/// \brief Miscellanous declarations
|
/// \brief Miscellaneous declarations
|
||||||
//
|
//
|
||||||
// Author: Lasse Collin
|
// Author: Lasse Collin
|
||||||
//
|
//
|
||||||
|
|
|
@ -288,7 +288,7 @@ message_progress_start(lzma_stream *strm, uint64_t in_size)
|
||||||
if (verbosity >= V_VERBOSE && progress_automatic) {
|
if (verbosity >= V_VERBOSE && progress_automatic) {
|
||||||
// Start the timer to display the first progress message
|
// Start the timer to display the first progress message
|
||||||
// after one second. An alternative would be to show the
|
// after one second. An alternative would be to show the
|
||||||
// first message almost immediatelly, but delaying by one
|
// first message almost immediately, but delaying by one
|
||||||
// second looks better to me, since extremely early
|
// second looks better to me, since extremely early
|
||||||
// progress info is pretty much useless.
|
// progress info is pretty much useless.
|
||||||
#ifdef SIGALRM
|
#ifdef SIGALRM
|
||||||
|
@ -383,8 +383,8 @@ progress_sizes(uint64_t compressed_pos, uint64_t uncompressed_pos, bool final)
|
||||||
static const char *
|
static const char *
|
||||||
progress_speed(uint64_t uncompressed_pos, uint64_t elapsed)
|
progress_speed(uint64_t uncompressed_pos, uint64_t elapsed)
|
||||||
{
|
{
|
||||||
// Don't print the speed immediatelly, since the early values look
|
// Don't print the speed immediately, since the early values look
|
||||||
// like somewhat random.
|
// somewhat random.
|
||||||
if (elapsed < 3000000)
|
if (elapsed < 3000000)
|
||||||
return "";
|
return "";
|
||||||
|
|
||||||
|
@ -870,8 +870,8 @@ message_mem_needed(enum message_verbosity v, uint64_t memusage)
|
||||||
uint64_to_str(memlimit, 1));
|
uint64_to_str(memlimit, 1));
|
||||||
} else {
|
} else {
|
||||||
// Round up just like with memusage. If this function is
|
// Round up just like with memusage. If this function is
|
||||||
// called for informational purporse (to just show the
|
// called for informational purposes (to just show the
|
||||||
// current usage and limit), we will never show that
|
// current usage and limit), we should never show that
|
||||||
// the usage is higher than the limit, which would give
|
// the usage is higher than the limit, which would give
|
||||||
// a false impression that the memory usage limit isn't
|
// a false impression that the memory usage limit isn't
|
||||||
// properly enforced.
|
// properly enforced.
|
||||||
|
|
|
@ -116,7 +116,7 @@ extern void message_set_files(unsigned int files);
|
||||||
|
|
||||||
/// \brief Set the name of the current file and possibly print it too
|
/// \brief Set the name of the current file and possibly print it too
|
||||||
///
|
///
|
||||||
/// The name is printed immediatelly if --list was used or if --verbose
|
/// The name is printed immediately if --list was used or if --verbose
|
||||||
/// was used and stderr is a terminal. Even when the filename isn't printed,
|
/// was used and stderr is a terminal. Even when the filename isn't printed,
|
||||||
/// it is stored so that it can be printed later if needed for progress
|
/// it is stored so that it can be printed later if needed for progress
|
||||||
/// messages.
|
/// messages.
|
||||||
|
|
12
src/xz/xz.1
12
src/xz/xz.1
|
@ -223,7 +223,7 @@ The absolute value of the active memory usage limit can be seen with
|
||||||
.B \-\-info-memory
|
.B \-\-info-memory
|
||||||
or near the bottom of the output of
|
or near the bottom of the output of
|
||||||
.BR \-\-long\-help .
|
.BR \-\-long\-help .
|
||||||
The default limit can be overriden with
|
The default limit can be overridden with
|
||||||
\fB\-\-memory=\fIlimit\fR.
|
\fB\-\-memory=\fIlimit\fR.
|
||||||
.SH OPTIONS
|
.SH OPTIONS
|
||||||
.SS "Integer suffixes and special values"
|
.SS "Integer suffixes and special values"
|
||||||
|
@ -399,10 +399,10 @@ This is the default. When compressing,
|
||||||
.B auto
|
.B auto
|
||||||
is equivalent to
|
is equivalent to
|
||||||
.BR xz .
|
.BR xz .
|
||||||
When decompressing, the format of the input file is autodetected. Note that
|
When decompressing, the format of the input file is automatically detected.
|
||||||
raw streams (created with
|
Note that raw streams (created with
|
||||||
.BR \-\-format=raw )
|
.BR \-\-format=raw )
|
||||||
cannot be autodetected.
|
cannot be auto-detected.
|
||||||
.IP \(bu 3
|
.IP \(bu 3
|
||||||
.BR xz :
|
.BR xz :
|
||||||
Compress to the
|
Compress to the
|
||||||
|
@ -568,7 +568,7 @@ increase a little with presets \fB\-0\fR ... \fB\-2\fR). The downside is that
|
||||||
the compression time will increase dramatically (it can easily double).
|
the compression time will increase dramatically (it can easily double).
|
||||||
.TP
|
.TP
|
||||||
\fB\-M\fR \fIlimit\fR, \fB\-\-memory=\fIlimit
|
\fB\-M\fR \fIlimit\fR, \fB\-\-memory=\fIlimit
|
||||||
Set the memory usage limit. If this option is specied multiple times,
|
Set the memory usage limit. If this option is specified multiple times,
|
||||||
the last one takes effect. The
|
the last one takes effect. The
|
||||||
.I limit
|
.I limit
|
||||||
can be specified in multiple ways:
|
can be specified in multiple ways:
|
||||||
|
@ -1260,7 +1260,7 @@ files which have dictionary size of
|
||||||
.RI "2^" n
|
.RI "2^" n
|
||||||
or
|
or
|
||||||
.RI "2^" n " + 2^(" n "\-1)."
|
.RI "2^" n " + 2^(" n "\-1)."
|
||||||
This is to decrease false positives when autodetecting
|
This is to decrease false positives when detecting
|
||||||
.B .lzma
|
.B .lzma
|
||||||
files.
|
files.
|
||||||
.PP
|
.PP
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
#define MY_TYPE VFT_APP
|
#define MY_TYPE VFT_APP
|
||||||
#define MY_NAME "lzmadec"
|
#define MY_NAME "lzmadec"
|
||||||
#define MY_SUFFIX ".exe"
|
#define MY_SUFFIX ".exe"
|
||||||
#define MY_DESC "lzmadec uncompression tool for .lzma files"
|
#define MY_DESC "lzmadec decompression tool for .lzma files"
|
||||||
#include "common_w32res.rc"
|
#include "common_w32res.rc"
|
||||||
|
|
|
@ -8,5 +8,5 @@
|
||||||
#define MY_TYPE VFT_APP
|
#define MY_TYPE VFT_APP
|
||||||
#define MY_NAME "xzdec"
|
#define MY_NAME "xzdec"
|
||||||
#define MY_SUFFIX ".exe"
|
#define MY_SUFFIX ".exe"
|
||||||
#define MY_DESC "xzdec uncompression tool for .xz files"
|
#define MY_DESC "xzdec decompression tool for .xz files"
|
||||||
#include "common_w32res.rc"
|
#include "common_w32res.rc"
|
||||||
|
|
|
@ -570,7 +570,7 @@ test_locate(void)
|
||||||
expect(r.block.uncompressed_file_offset == ubase + n * 4);
|
expect(r.block.uncompressed_file_offset == ubase + n * 4);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Test locating in concatend Index.
|
// Test locating in concatenated Index.
|
||||||
lzma_index_end(i, NULL);
|
lzma_index_end(i, NULL);
|
||||||
i = lzma_index_init(NULL);
|
i = lzma_index_init(NULL);
|
||||||
expect(i != NULL);
|
expect(i != NULL);
|
||||||
|
|
|
@ -37,10 +37,10 @@ do
|
||||||
done
|
done
|
||||||
|
|
||||||
|
|
||||||
# Abort immediatelly if something goes wrong.
|
# Abort immediately if something goes wrong.
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
# White spaces in directory names may break things so catch them immediatelly.
|
# White spaces in directory names may break things so catch them immediately.
|
||||||
case $(pwd) in
|
case $(pwd) in
|
||||||
' ' | ' ' | '
|
' ' | ' ' | '
|
||||||
') echo "Error: White space in the directory name" >&2; exit 1 ;;
|
') echo "Error: White space in the directory name" >&2; exit 1 ;;
|
||||||
|
|
Loading…
Reference in a new issue