Some threading related helper macros and functions.
More...
#include "sysdefs.h"
#include <signal.h>
|
#define | mythread_once(func) |
|
|
static void | mythread_sigmask (int how, const sigset_t *restrict set, sigset_t *restrict oset) |
|
Some threading related helper macros and functions.
◆ mythread_once
#define mythread_once |
( |
|
func | ) |
|
Value:do { \
static bool once_ = false; \
if (!once_) { \
func(); \
once_ = true; \
} \
} while (0)
lzma_ret lzma_block_header_decode(lzma_block *block, const lzma_allocator *allocator, const uint8_t *in) lzma_nothrow lzma_attr_warn_unused_result
Decode Block Header.
Definition: block_header_decoder.c:34
char * dest_name
Definition: file_io.h:41
lzma_ret lzma_block_decoder(lzma_stream *strm, lzma_block *block)
Initialize .xz Block decoder.
Definition: block_decoder.c:249
Definition: alone_decoder.c:18
uint64_t lzma_easy_decoder_memusage(uint32_t preset) lzma_nothrow lzma_attr_pure
Calculate approximate decoder memory usage of a preset.
Definition: easy_decoder_memusage.c:17
lzma_vli uncompressed_size
Sum of the Uncompressed Size fields.
Definition: index_hash.c:23
lzma_vli uncompressed_base
Definition: index.c:34
uint64_t lzma_crc64(const uint8_t *buf, size_t size, uint64_t crc) lzma_nothrow lzma_attr_pure
Calculate CRC64.
Definition: crc64_fast.c:30
uint32_t lzma_crc32(const uint8_t *buf, size_t size, uint32_t crc)
Calculate CRC32.
Definition: crc32_small.c:49
uint32_t nice_len
Nice length of a match.
Definition: lzma12.h:342
size_t pos
Position in the header fields.
Definition: alone_decoder.c:35
#define update_match(state)
Indicate that the latest state was a match.
Definition: lzma_common.h:88
lzma_vli unpadded_size
The most recent Unpadded Size field.
Definition: index_decoder.c:43
bool opt_auto_adjust
Definition: coder.c:26
static unsigned int files_total
Total number of input files; zero if unknown.
Definition: message.c:22
Options specific to the LZMA1 and LZMA2 filters.
Definition: lzma12.h:185
lzma_outbuf * lzma_outq_get_buf(lzma_outq *outq)
Get a new buffer.
Definition: outqueue.c:114
Filter-specific stuff common for both encoder and decoder.
uint8_t * buf
Definition: lz_decoder.h:24
lzma_bool lzma_index_iter_locate(lzma_index_iter *iter, lzma_vli target)
Locate a Block.
Definition: index.c:1210
Definition: delta_private.h:18
uint64_t lzma_index_memused(const lzma_index *i) lzma_nothrow
Calculate the memory usage of an existing lzma_index.
Definition: index.c:491
void message_filename(const char *src_name)
Set the name of the current file and possibly print it too.
Definition: message.c:232
#define LZMA_BUFFER_SIZE
Size of temporary buffers needed in some filters.
Definition: common.h:49
uint32_t threads_max
Definition: stream_encoder_mt.c:150
static void parse_options(const char *str, const option_map *opts, void(*set)(void *filter_options, unsigned key, uint64_t value, const char *valuestr), void *filter_options)
Definition: options.c:60
lzma_check check
Integrity check type.
Definition: container.h:160
lzma_ret lzma_filters_update(lzma_stream *strm, const lzma_filter *filters) lzma_nothrow
Update the filter chain in the encoder.
Definition: filter_encoder.c:172
lzma_vli compressed_size
Size of the Compressed Data in bytes.
Definition: block.h:148
uint32_t sons_count
Number of elements in son[].
Definition: lz_encoder.h:125
bool tell_no_check
Definition: stream_decoder.c:51
void hardware_memlimit_set(uint64_t new_memlimit, bool set_compress, bool set_decompress, bool is_percentage)
Definition: hardware.c:62
static bool lzmainfo(const char *name, FILE *f)
Parse the .lzma header and display information about it.
Definition: lzmainfo.c:101
lzma_mode
Compression modes.
Definition: lzma12.h:138
lzma_vli lzma_index_hash_size(const lzma_index_hash *index_hash) lzma_nothrow lzma_attr_pure
Get the size of the Index field as bytes.
Definition: index_hash.c:114
static void index_tree_node_end(index_tree_node *node, const lzma_allocator *allocator, void(*free_func)(void *node, const lzma_allocator *allocator))
Helper for index_tree_end()
Definition: index.c:194
lzma_ret lzma_memlimit_set(lzma_stream *strm, uint64_t new_memlimit)
Set the memory usage limit.
Definition: common.c:432
Kind of two-bit version of bit scan reverse.
Common things for range encoder and decoder.
lzma_vli number_in_stream
Block number in this Stream.
Definition: index.h:154
#define rc_update_0(prob)
Definition: range_decoder.h:119
void list_totals(void)
Show the totals after all files have been listed.
Definition: list.c:1121
Common stuff for Delta encoder and decoder.
#define xmalloc(size)
Safe malloc() that never returns NULL.
Definition: util.h:18
uint64_t lzma_stream_encoder_mt_memusage(const lzma_mt *options)
Calculate approximate memory usage of multithreaded .xz encoder.
Definition: stream_encoder_mt.c:1097
uint32_t depth
Maximum search depth.
Definition: lz_encoder.h:154
size_t dict_size
Size of the history buffer.
Definition: lz_decoder.h:48
void *(* alloc)(void *opaque, size_t nmemb, size_t size)
Pointer to a custom memory allocation function.
Definition: base.h:407
void coder_set_extreme(void)
Enable extreme mode.
Definition: coder.c:98
static bool parse_check_value(file_pair *pair, const lzma_index_iter *iter)
Parse the Check field and put it into check_value[].
Definition: list.c:546
Common filter related types and functions.
static void split_block(uint64_t *block_remaining, uint64_t *next_block_remaining, size_t *list_pos)
Definition: coder.c:571
static lzma_vli index_size_unpadded(lzma_vli count, lzma_vli index_list_size)
Calculate the size of the Index field excluding Index Padding.
Definition: index.h:48
uint32_t nice_len
Maximum length of a match that the match finder will try to find.
Definition: lz_encoder.h:109
lzma_vli lzma_index_hash_size(const lzma_index_hash *index_hash)
Get the size of the Index field as bytes.
Definition: index_hash.c:114
uint64_t lzma_outq_memusage(uint64_t buf_size_max, uint32_t threads)
Calculate the memory usage of an output queue.
Definition: outqueue.c:42
@ LZMA_PROG_ERROR
Programming error.
Definition: base.h:218
uint32_t read_limit
Definition: lz_encoder.h:75
LZ in window and match finder API.
@ LZMA_INDEX_ITER_NONEMPTY_BLOCK
Get the next non-empty Block.
Definition: index.h:260
void lzma_get_progress(lzma_stream *strm, uint64_t *progress_in, uint64_t *progress_out)
Get progress information.
Definition: common.c:370
uint64_t lzma_raw_encoder_memusage(const lzma_filter *filters)
Calculate approximate memory requirements for raw encoder.
Definition: filter_encoder.c:222
Definition: lz_decoder.h:47
lzma_bool lzma_check_is_supported(lzma_check check) lzma_nothrow lzma_attr_const
Test if the given Check ID is supported.
Definition: check.c:17
uint32_t longest_match_length
Definition: lzma_encoder_private.h:89
lzma_internal * internal
Definition: base.h:505
bool src_eof
True once end of the source file has been detected.
Definition: file_io.h:50
uint32_t dict_size
Dictionary size in bytes.
Definition: lzma12.h:217
void lzma_check_init(lzma_check_state *check, lzma_check type)
Initialize *check depending on type.
Definition: check.c:84
uint32_t lzma_index_padding_size(const lzma_index *i)
Definition: index.c:593
static volatile sig_atomic_t exit_signal
Definition: signals.c:24
#define EMPTY_HASH_VALUE
Definition: lz_encoder_mf.c:86
const uint8_t * preset_dict
TODO: Comment.
Definition: lz_decoder.h:49
lzma_ret lzma_raw_buffer_encode(const lzma_filter *filters, const lzma_allocator *allocator, const uint8_t *in, size_t in_size, uint8_t *out, size_t *out_pos, size_t out_size)
Single-call raw encoder.
Definition: filter_buffer_encoder.c:17
lzma_ret lzma_filters_copy(const lzma_filter *src, lzma_filter *dest, const lzma_allocator *allocator) lzma_nothrow
Copy the filters array.
Definition: filter_common.c:125
void void void void message_fatal(const char *fmt,...) lzma_attribute((__format__(__printf__
Prints an error message and exits with EXIT_ERROR.
lzma_ret lzma_stream_header_decode(lzma_stream_flags *options, const uint8_t *in) lzma_nothrow lzma_attr_warn_unused_result
Decode Stream Header.
Definition: stream_flags_decoder.c:31
void message_progress_start(lzma_stream *strm, bool is_passthru, uint64_t in_size)
Start progress info handling.
Definition: message.c:249
size_t compressed_size
Definition: lzma2_decoder.c:42
size_t buf_pos
Read position in buf[].
Definition: lzma2_encoder.c:47
enum operation_mode opt_mode
Definition: coder.c:24
char * xstrdup(const char *src) lzma_attribute((__malloc__))
Safe strdup() that never returns NULL.
Definition: util.c:48
Get the number of CPU cores online.
lzma_options_lzma options
Definition: alone_decoder.c:48
void message_progress_update(void)
Definition: message.c:545
uint32_t pb
Number of position bits.
Definition: lzma12.h:316
static void index_tree_append(index_tree *tree, index_tree_node *node)
Definition: index.c:230
const lzma_allocator * allocator
Custom memory allocation functions.
Definition: base.h:502
uint32_t stream_number_add
Definition: index.c:733
lzma_ret lzma_properties_size(uint32_t *size, const lzma_filter *filter)
Get the size of the Filter Properties field.
Definition: filter_encoder.c:253
lzma_ret lzma_block_uncomp_encode(lzma_block *block, const uint8_t *in, size_t in_size, uint8_t *out, size_t *out_pos, size_t out_size)
Single-call uncompressed .xz Block encoder.
Definition: block_buffer_encoder.c:329
lzma_next_coder next
Next coder in the chain.
Definition: lz_decoder.c:33
static size_t test_suffix(const char *suffix, const char *src_name, size_t src_len)
Checks if src_name has given compressed_suffix.
Definition: suffix.c:87
worker_thread * threads_free
Definition: stream_encoder_mt.c:159
static char bufs[4][128]
Buffers for uint64_to_str() and uint64_to_nicestr()
Definition: util.c:18
size_t full
Definition: lz_decoder.h:33
uint32_t depth
Maximum number of loops in the match finder.
Definition: lz_encoder.h:106
void lzma_index_prealloc(lzma_index *i, lzma_vli records)
Definition: index.c:431
static bool progress_started
Definition: message.c:49
void hardware_init(void)
Definition: hardware.c:169
bool src_has_seen_input
Definition: file_io.h:54
const lzma_filter * filters
Filter chain (alternative to a preset)
Definition: container.h:151
@ LZMA_FINISH
Finish the coding operation.
Definition: base.h:328
#define LZMA_TELL_UNSUPPORTED_CHECK
Definition: container.h:466
void lzma_sha256_init(lzma_check_state *check)
Prepare SHA-256 state for new input.
Definition: sha256.c:127
int tuklib_mbstr_fw(const char *str, int columns_min)
Get the field width for printf() e.g. to align table columns.
Definition: tuklib_mbstr_fw.c:17
Definition: lz_encoder.h:192
void coder_add_filter(lzma_vli id, void *options)
Add a filter to the custom filter chain.
Definition: coder.c:107
void signals_block(void)
Definition: signals.c:120
bool need_reset
True when dictionary should be reset before decoding more data.
Definition: lz_decoder.h:42
uint64_t progress_in
Amount of uncompressed data that has already been compressed.
Definition: stream_encoder_mt.c:77
size_t pos
Write position in buffer[] and position in Stream Padding.
Definition: stream_decoder.c:78
lzma_vli lzma_index_uncompressed_size(const lzma_index *i) lzma_nothrow lzma_attr_pure
Get the uncompressed size of the file.
Definition: index.c:572
void lzma_sha256_finish(lzma_check_state *check)
Finish the SHA-256 calculation and store the result to check->buffer.u8.
Definition: sha256.c:169
void coder_set_preset(uint32_t new_preset)
Set preset number.
Definition: coder.c:88
lzma_ret lzma_auto_decoder(lzma_stream *strm, uint64_t memlimit, uint32_t flags)
Decode .xz Streams and .lzma files with autodetection.
Definition: auto_decoder.c:187
static void threads_end(lzma_stream_coder *coder, const lzma_allocator *allocator)
Definition: stream_encoder_mt.c:450
bool fast_mode
True if using getoptimumfast.
Definition: lzma_encoder_private.h:92
static const char * xz_ver_to_str(uint32_t ver)
Convert XZ Utils version number to a string.
Definition: list.c:117
static bool coder_passthru(file_pair *pair)
Definition: coder.c:846
void lzma_index_iter_rewind(lzma_index_iter *iter) lzma_nothrow
Rewind the iterator.
Definition: index.c:1092
volatile sig_atomic_t user_abort
Definition: signals.c:16
Get the amount of physical memory.
worker_thread * next
Next structure in the stack of free worker threads.
Definition: stream_encoder_mt.c:89
void message_set_files(unsigned int files)
Set the total number of files to be processed.
Definition: message.c:188
bool lzma_outq_is_readable(const lzma_outq *outq)
Test if there is data ready to be read.
Definition: outqueue.c:136
lzma_next_coder index_encoder
Index encoder.
Definition: stream_encoder_mt.c:120
uint64_t progress_out
Amount of compressed data that is ready.
Definition: stream_encoder_mt.c:80
void message_version(void)
Prints the version number to stdout and exits with exit status SUCCESS.
Definition: message.c:1074
uint32_t rep0
Distance of the latest match.
Definition: lzma_decoder.c:228
lzma_ret lzma_easy_encoder(lzma_stream *strm, uint32_t preset, lzma_check check) lzma_nothrow lzma_attr_warn_unused_result
Initialize .xz Stream encoder using a preset number.
Definition: easy_encoder.c:17
#define rc_direct(dest, seq)
Decode a bit without using a probability.
Definition: range_decoder.h:171
Definition: lz_decoder.c:23
lzma_index * index
Target Index.
Definition: index_decoder.c:33
lzma_vli compressed_size
Compressed size of this Stream.
Definition: index.h:94
index_tree_node * root
Root node.
Definition: index.c:48
lzma_vli id
Definition: common.h:141
size_t size
Amount of data written to buf.
Definition: outqueue.h:22
@ THR_STOP
Definition: stream_encoder_mt.c:39
static lzma_vli index_stream_size(lzma_vli blocks_size, lzma_vli count, lzma_vli index_list_size)
Calculate the total size of the Stream.
Definition: index.h:65
lzma_check check
Type of integrity Check.
Definition: block.h:93
static void threads_stop(lzma_stream_coder *coder, bool wait_for_threads)
Make the threads stop but not exit. Optionally wait for them to stop.
Definition: stream_encoder_mt.c:421
lzma_delta_type type
Definition: delta.h:47
lzma_vli lzma_index_size(const lzma_index *i) lzma_nothrow lzma_attr_pure
Get the size of the Index field as bytes.
Definition: index.c:512
Multithreading options.
Definition: container.h:66
static bool io_close_dest(file_pair *pair, bool success)
Closes destination file of the file_pair structure.
Definition: file_io.c:1008
uint64_t total_out
Definition: base.h:492
uint64_t(* memusage)(const void *options)
Definition: filter_common.h:30
lzma_ret lzma_outq_init(lzma_outq *outq, const lzma_allocator *allocator, uint64_t buf_size_max, uint32_t threads)
Initialize an output queue.
Definition: outqueue.c:57
probability dist_slot[DIST_STATES][DIST_SLOTS]
Definition: lzma_decoder.c:202
static enum exit_status_type exit_status
Exit status to use. This can be changed with set_exit_status().
Definition: main.c:17
static void io_unlink(const char *name, const struct stat *known_st)
Unlink a file.
Definition: file_io.c:290
uint32_t lzma_version_number(void) lzma_nothrow lzma_attr_const
Run-time version number as an integer.
Definition: common.c:21
lzma_ret lzma_stream_buffer_encode(lzma_filter *filters, lzma_check check, const lzma_allocator *allocator, const uint8_t *in, size_t in_size, uint8_t *out, size_t *out_pos, size_t out_size) lzma_nothrow lzma_attr_warn_unused_result
Single-call .xz Stream encoder.
Definition: stream_buffer_encoder.c:44
lzma_vli compressed_offset
Compressed start offset of this Stream.
Definition: index.h:78
#define rc_bit_case(prob, action0, action1, seq)
Definition: range_decoder.h:166
static void move_pos(lzma_mf *mf)
Mark the current byte as processed from point of view of the match finder.
Definition: lz_encoder_mf.c:150
#define rc_bit(prob, action0, action1, seq)
Definition: range_decoder.h:154
index_tree_node * rightmost
Definition: index.c:57
Length decoder probabilities; see comments in lzma_common.h.
Definition: lzma_decoder.c:161
uint32_t number
Number of this Stream (first one is 1)
Definition: index.c:112
@ LZMA_CHECK_NONE
Definition: check.h:28
.xz Stream Header and Stream Footer encoder and decoder
probability * probs[RC_SYMBOLS_MAX]
Probabilities associated with RC_BIT_0 or RC_BIT_1.
Definition: range_encoder.h:49
void set_exit_status(enum exit_status_type new_status)
Definition: main.c:31
static const char * progress_percentage(uint64_t in_pos)
Make the string indicating completion percentage.
Definition: message.c:291
lzma_ret lzma_index_hash_decode(lzma_index_hash *index_hash, const uint8_t *in, size_t *in_pos, size_t in_size)
Decode and validate the Index field.
Definition: index_hash.c:175
lzma_vli blocks_size
Sum of the Block sizes (including Block Padding)
Definition: index_hash.c:20
void hardware_threads_set(uint32_t threadlimit)
Set the maximum number of worker threads.
Definition: hardware.c:31
lzma_ret lzma_stream_footer_decode(lzma_stream_flags *options, const uint8_t *in) lzma_nothrow lzma_attr_warn_unused_result
Decode Stream Footer.
Definition: stream_flags_decoder.c:60
lzma_action action
Definition: lz_encoder.h:119
uint64_t lzma_easy_encoder_memusage(uint32_t preset) lzma_nothrow lzma_attr_pure
Calculate approximate memory usage of easy encoder.
Definition: easy_encoder_memusage.c:17
probability is_rep2[STATES]
If 0, distance of a repeated match is rep2. Otherwise it is rep3.
Definition: lzma_decoder.c:193
static int stdin_flags
Definition: file_io.c:77
bool io_open_dest(file_pair *pair)
Open the destination file.
Definition: file_io.c:991
@ LZMA_GET_CHECK
Integrity check type is now available.
Definition: base.h:115
#define MUST_NORMALIZE_POS
Definition: lz_encoder_mf.c:91
lzma_action
The ‘action’ argument for lzma_code()
Definition: base.h:250
lzma_vli compressed_stream_offset
Compressed start offset of this Block.
Definition: index.h:162
#define rc_to_local(range_decoder, in_pos)
Definition: range_decoder.h:54
static void dict_write(lzma_dict *restrict dict, const uint8_t *restrict in, size_t *restrict in_pos, size_t in_size, size_t *restrict left)
Copies arbitrary amount of data into the dictionary.
Definition: lz_decoder.h:203
char files_delim
Delimiter for filenames read from files_file.
Definition: args.h:29
void message_set_files(unsigned int files)
Set the total number of files to be processed.
Definition: message.c:188
Definition: block_decoder.c:18
void coder_set_check(lzma_check check)
Set the integrity check type used when compressing.
Definition: coder.c:64
uint32_t lzma_index_checks(const lzma_index *i)
Get the types of integrity Checks.
Definition: index.c:579
struct stat dest_st
Stat of the destination file.
Definition: file_io.h:72
bool is_empty_filename(const char *filename)
Check if filename is empty and print an error message.
Definition: util.c:264
#define rc_normalize(seq)
Definition: range_decoder.h:87
lzma_ret lzma_filter_flags_decode(lzma_filter *filter, const lzma_allocator *allocator, const uint8_t *in, size_t *in_pos, size_t in_size) lzma_nothrow lzma_attr_warn_unused_result
Decode Filter Flags from given buffer.
Definition: filter_flags_decoder.c:17
Some endian-dependent macros for CRC32 and CRC64.
uint32_t size
Definition: lz_encoder.h:39
lzma_index * lzma_index_init(const lzma_allocator *allocator)
Allocate and initialize a new lzma_index structure.
Definition: index.c:398
Make sure that file descriptors 0, 1, and 2 are open.
uint64_t hardware_memlimit_get(enum operation_mode mode)
Get the current memory usage limit for compression or decompression.
Definition: hardware.c:112
lzma_vli uncompressed_size
Uncompressed size of the destination.
Definition: index.c:722
lzma_vli uncompressed_size
Uncompressed Size calculated while decoding.
Definition: block_decoder.c:36
size_t lzma_stream_buffer_bound(size_t uncompressed_size) lzma_nothrow
Calculate output buffer size for single-call Stream encoder.
Definition: stream_buffer_encoder.c:26
static lzma_check check
Integrity check type.
Definition: coder.c:49
lzma_ret lzma_index_hash_append(lzma_index_hash *index_hash, lzma_vli unpadded_size, lzma_vli uncompressed_size)
Add a new Record to an Index hash.
Definition: index_hash.c:144
const char * message_strm(lzma_ret code)
Convert lzma_ret to a string.
Definition: message.c:803
lzma_vli total_size
Total size of all the Blocks in the Stream(s)
Definition: index.c:155
lzma_vli lzma_index_size(const lzma_index *i)
Get the size of the Index field as bytes.
Definition: index.c:512
#define LZMA_NEXT_CODER_INIT
Macro to initialize lzma_next_coder structure.
Definition: common.h:180
lzma_ret lzma_auto_decoder(lzma_stream *strm, uint64_t memlimit, uint32_t flags) lzma_nothrow lzma_attr_warn_unused_result
Decode .xz Streams and .lzma files with autodetection.
Definition: auto_decoder.c:187
Detection of available hardware resources.
Common stuff for Stream flags coders.
uint32_t timeout
Definition: stream_encoder_mt.c:139
#define lzma_block_header_size_decode(b)
Decode the Block Header Size field.
Definition: block.h:285
lzma_ret lzma_stream_footer_encode(const lzma_stream_flags *options, uint8_t *out) lzma_nothrow lzma_attr_warn_unused_result
Encode Stream Footer.
Definition: stream_flags_encoder.c:57
#define mf_find
Since everything else begins with mf_, use it also for lzma_mf_find().
Definition: lz_encoder.h:259
static const char check_names[LZMA_CHECK_ID_MAX+1][12]
Check ID to string mapping.
Definition: list.c:61
void message_verbosity_increase(void)
Increase verbosity level by one step unless it was at maximum.
Definition: message.c:161
lzma_lz_decoder lzma
LZMA decoder.
Definition: lzma2_decoder.c:35
void message_mem_needed(enum message_verbosity v, uint64_t memusage)
Display how much memory was needed and how much the limit was.
Definition: message.c:846
file_pair * io_open_src(const char *src_name)
Open the source file.
Definition: file_io.c:741
lzma_match matches[MATCH_LEN_MAX+1]
Array of match candidates.
Definition: lzma_encoder_private.h:82
lzma_ret lzma_raw_encoder(lzma_stream *strm, const lzma_filter *filters) lzma_nothrow lzma_attr_warn_unused_result
Initialize raw encoder.
Definition: filter_encoder.c:208
lzma_options_lzma * options_lzma(const char *str)
Parser for LZMA options.
Definition: options.c:317
void list_file(const char *filename)
List information about the given .xz file.
Definition: list.c:1143
uint32_t limit
Definition: lzma_decoder.c:277
void message_filters_to_str(char buf[FILTERS_STR_SIZE], const lzma_filter *filters, bool all_known)
Get the filter chain as a string.
Definition: message.c:917
probability is_rep0_long[STATES][POS_STATES_MAX]
Definition: lzma_decoder.c:197
lzma_stream_flags stream_flags
Stream Flags for encoding the Stream Header and Stream Footer.
Definition: stream_encoder_mt.c:124
lzma_options_bcj * options_bcj(const char *str)
Parser for BCJ options.
Definition: options.c:209
uint64_t memlimit
Memory usage limit.
Definition: index_decoder.c:30
uint64_t lzma_outq_memusage(uint64_t buf_size_max, uint32_t threads)
Calculate the memory usage of an output queue.
Definition: outqueue.c:42
static bool wait_for_work(lzma_stream_coder *coder, mythread_condtime *wait_abs, bool *has_blocked, bool has_input)
Definition: stream_encoder_mt.c:621
#define LZMA2_HEADER_UNCOMPRESSED
Size of a header for uncompressed chunk.
Definition: lzma2_encoder.h:30
lzma_ret lzma_block_buffer_decode(lzma_block *block, const lzma_allocator *allocator, const uint8_t *in, size_t *in_pos, size_t in_size, uint8_t *out, size_t *out_pos, size_t out_size) lzma_nothrow
Single-call .xz Block decoder.
Definition: block_buffer_decoder.c:17
lzma_check
Type of the integrity check (Check ID)
Definition: check.h:27
uint32_t hash_count
Number of elements in hash[].
Definition: lz_encoder.h:122
lzma_next_coder next
The actual coder that should do something useful.
Definition: common.h:198
lzma_ret lzma_properties_size(uint32_t *size, const lzma_filter *filter) lzma_nothrow
Get the size of the Filter Properties field.
Definition: filter_encoder.c:253
lzma_vli uncompressed_size
Uncompressed size decoded from the header.
Definition: alone_decoder.c:38
const lzma_stream_flags * flags
Pointer to Stream Flags.
Definition: index.h:51
#define POS_STATES_MAX
Definition: lzma_common.h:28
static void index_stream_end(void *node, const lzma_allocator *allocator)
Free the memory allocated for a Stream and its Record groups.
Definition: index.c:370
static lzma_ret initialize_new_thread(lzma_stream_coder *coder, const lzma_allocator *allocator)
Initialize a new worker_thread structure and create a new thread.
Definition: stream_encoder_mt.c:472
lzma_lz_decoder lz
The actual LZ-based decoder e.g. LZMA.
Definition: lz_decoder.c:28
lzma_ret lzma_stream_footer_decode(lzma_stream_flags *options, const uint8_t *in)
Decode Stream Footer.
Definition: stream_flags_decoder.c:60
probability is_rep1[STATES]
Definition: lzma_decoder.c:190
lzma_ret lzma_block_decoder(lzma_stream *strm, lzma_block *block) lzma_nothrow lzma_attr_warn_unused_result
Initialize .xz Block decoder.
Definition: block_decoder.c:249
uint8_t history[LZMA_DELTA_DIST_MAX]
Buffer to hold history of the original data.
Definition: delta_private.h:29
size_t header_pos
Read position in header[].
Definition: stream_encoder_mt.c:130
lzma_vli index_list_size
Definition: index.c:166
size_t io_read(file_pair *pair, io_buf *buf, size_t size)
Reads from the source file to a buffer.
Definition: file_io.c:1116
lzma_ret lzma_index_hash_append(lzma_index_hash *index_hash, lzma_vli unpadded_size, lzma_vli uncompressed_size) lzma_nothrow lzma_attr_warn_unused_result
Add a new Record to an Index hash.
Definition: index_hash.c:144
lzma_ret lzma_filter_flags_encode(const lzma_filter *filter, uint8_t *out, size_t *out_pos, size_t out_size)
Encode Filter Flags into given buffer.
Definition: filter_flags_encoder.c:31
lzma_ret lzma_stream_buffer_decode(uint64_t *memlimit, uint32_t flags, const lzma_allocator *allocator, const uint8_t *in, size_t *in_pos, size_t in_size, uint8_t *out, size_t *out_pos, size_t out_size) lzma_nothrow lzma_attr_warn_unused_result
Single-call .xz Stream decoder.
Definition: stream_buffer_decoder.c:17
lzma_lz_encoder lz
LZ-based encoder e.g. LZMA.
Definition: lz_encoder.c:28
static void parse_options(int argc, char **argv)
Parses command line options.
Definition: xzdec.c:96
void * opaque
Pointer passed to .alloc() and .free()
Definition: base.h:432
void void message_warning(const char *fmt,...) lzma_attribute((__format__(__printf__
Prints a warning and possibly sets exit status.
size_t avail_out
Definition: base.h:491
void coder_run(const char *filename)
Compress or decompress the given file.
Definition: coder.c:869
#define HEADERS_BOUND
Stream Header, Stream Footer, and Index.
Definition: stream_buffer_encoder.c:22
size_t buffer_size
Total number of bytes in buffer[].
Definition: stream_encoder.c:53
uint32_t lc
Number of literal context bits.
Definition: lzma12.h:281
lzma_ret lzma_filter_flags_decode(lzma_filter *filter, const lzma_allocator *allocator, const uint8_t *in, size_t *in_pos, size_t in_size)
Decode Filter Flags from given buffer.
Definition: filter_flags_decoder.c:17
static char * compressed_name(const char *src_name, size_t src_len)
Appends suffix to src_name.
Definition: suffix.c:196
lzma_bool lzma_filter_encoder_is_supported(lzma_vli id)
Test if the given Filter ID is supported for encoding.
Definition: filter_encoder.c:165
@ LZMA_RUN
Continue coding.
Definition: base.h:251
lzma_vli uncompressed_offset
Uncompressed start offset of this Stream.
Definition: index.h:86
uint64_t mytime_get_elapsed(void)
Get the number of milliseconds since the operation started.
Definition: mytime.c:59
lzma_vli id
Filter ID.
Definition: filter_decoder.c:23
lzma_ret lzma_filters_update(lzma_stream *strm, const lzma_filter *filters)
Update the filter chain in the encoder.
Definition: filter_encoder.c:172
uint64_t lzma_raw_decoder_memusage(const lzma_filter *filters) lzma_nothrow lzma_attr_pure
Calculate approximate memory requirements for raw decoder.
Definition: filter_decoder.c:161
@ LZMA_MF_BT4
Binary Tree with 2-, 3-, and 4-byte hashing.
Definition: lzma12.h:101
lzma_vli index_list_size
Definition: index.c:130
bool is_flushed
Definition: lzma_encoder_private.h:100
#define return_if_error(expr)
Return if expression doesn't evaluate to LZMA_OK.
Definition: common.h:278
Definition: index_hash.c:18
#define rc_update_1(prob)
Definition: range_decoder.h:128
@ LZMA_STREAM_END
End of stream was reached.
Definition: base.h:63
lzma_vli uncompressed_size
Uncompressed size of this Stream.
Definition: index.h:99
void io_init(void)
Initialize the I/O module.
Definition: file_io.c:95
lzma_ret lzma_index_stream_padding(lzma_index *i, lzma_vli stream_padding) lzma_nothrow lzma_attr_warn_unused_result
Set the amount of Stream Padding.
Definition: index.c:618
void coder_set_preset(uint32_t new_preset)
Set preset number.
Definition: coder.c:88
size_t nice_len
Definition: lz_encoder.h:148
#define PREALLOC_MAX
How many Records can be allocated at once at maximum.
Definition: index.c:25
Parser for filter-specific options.
const char * lzma_version_string(void) lzma_nothrow lzma_attr_const
Run-time version as a string.
Definition: common.c:28
lzma_ret lzma_easy_buffer_encode(uint32_t preset, lzma_check check, const lzma_allocator *allocator, const uint8_t *in, size_t in_size, uint8_t *out, size_t *out_pos, size_t out_size) lzma_nothrow
Single-call .xz Stream encoding using a preset number.
Definition: easy_buffer_encoder.c:17
@ V_ERROR
Only error messages.
Definition: message.h:16
uint32_t header_size
Size of the Block Header field.
Definition: block.h:72
void set_exit_no_warn(void)
Definition: main.c:51
mythread thread_id
Definition: stream_encoder_mt.c:96
#define rc_reset(range_decoder)
Resets the range decoder structure.
Definition: range_decoder.h:69
void lzma_end(lzma_stream *strm)
Free memory allocated for the coder data structures.
Definition: common.c:357
@ LZMA_INDEX_ITER_STREAM
Get the next Stream.
Definition: index.h:238
const int message_progress_sigs[]
Signals used for progress message handling.
void coder_set_check(lzma_check new_check)
Set the integrity check type used when compressing.
Definition: coder.c:64
size_t tuklib_mbstr_width(const char *str, size_t *bytes)
Get the number of columns needed for the multibyte string.
Definition: tuklib_mbstr_width.c:22
bool end_was_reached
True if the next coder in the chain has returned LZMA_STREAM_END.
Definition: simple_private.h:24
void * coder
Data specific to the LZ-based decoder.
Definition: lz_decoder.h:56
#define LZMA_CONCATENATED
Definition: container.h:515
static bool dict_repeat(lzma_dict *dict, uint32_t distance, uint32_t *len)
Repeat *len bytes at distance.
Definition: lz_decoder.h:128
lzma_vli block_count
Number of Blocks in the Stream.
Definition: index.h:70
void lzma_free(void *ptr, const lzma_allocator *allocator)
Frees memory.
Definition: common.c:78
char * files_name
Definition: args.h:22
AVL tree to hold index_stream or index_group structures.
Definition: index.c:46
size_t after_size
Definition: lz_encoder.h:139
union lzma_check_state::@3 buffer
Buffer to hold the final result and a temporary buffer for SHA256.
bool lzma_lzma_lclppb_decode(lzma_options_lzma *options, uint8_t byte)
Decodes the LZMA Properties byte (lc/lp/pb)
Definition: lzma_decoder.c:1000
struct lzma_coder::@20 temp
static sigset_t hooked_signals
Definition: signals.c:28
lzma_ret lzma_properties_decode(lzma_filter *filter, const lzma_allocator *allocator, const uint8_t *props, size_t props_size)
Decode the Filter Properties field.
Definition: filter_decoder.c:169
lzma_vli uncompressed_size
Uncompressed Size in bytes.
Definition: block.h:172
uint8_t * next_out
Definition: base.h:490
enum lzma_range_encoder::@23 symbols[RC_SYMBOLS_MAX]
Symbols to encode.
uint64_t * opt_block_list
Definition: coder.c:29
size_t filtered
Definition: simple_private.h:55
lzma_init_function init
Definition: filter_common.h:26
lzma_index_hash * lzma_index_hash_init(lzma_index_hash *index_hash, const lzma_allocator *allocator)
Allocate and initialize a new lzma_index_hash structure.
Definition: index_hash.c:73
void suffix_set(const char *suffix)
Set a custom filename suffix.
Definition: suffix.c:388
static bool progress_automatic
Definition: message.c:45
static lzma_ret hash_append(lzma_index_hash_info *info, lzma_vli unpadded_size, lzma_vli uncompressed_size)
Updates the sizes and the hash without any validation.
Definition: index_hash.c:126
#define LZMA_FILTER_IA64
Definition: bcj.h:32
lzma_index * index
Index to hold sizes of the Blocks.
Definition: stream_encoder.c:47
void(* skip)(lzma_mf *mf, uint32_t num)
Definition: lz_encoder.h:97
probability pos_align[ALIGN_SIZE]
Definition: lzma_decoder.c:210
static void copy_and_encode(lzma_delta_coder *coder, const uint8_t *restrict in, uint8_t *restrict out, size_t size)
Definition: delta_encoder.c:21
Options for the Delta filter.
Definition: delta.h:45
Data types and functions used in many places in liblzma API.
uint32_t start_offset
Start offset for conversions.
Definition: bcj.h:88
uint32_t lzma_index_checks(const lzma_index *i) lzma_nothrow lzma_attr_pure
Get the types of integrity Checks.
Definition: index.c:579
static void mf_read(lzma_mf *mf, uint8_t *out, size_t *out_pos, size_t out_size, size_t *left)
Definition: lz_encoder.h:279
#define CHECKS_STR_SIZE
Definition: list.c:90
uint32_t threads_initialized
Definition: stream_encoder_mt.c:154
static enum @28 thousand
Thousand separator support in uint64_to_str() and uint64_to_nicestr()
size_t pos
Definition: simple_private.h:51
void(* end)(void *coder, const lzma_allocator *allocator)
Free allocated resources.
Definition: lz_decoder.h:69
const char * message_strm(lzma_ret code)
Convert lzma_ret to a string.
Definition: message.c:803
Definition: stream_encoder_mt.c:100
lzma_ret(* props_decode)(void **options, const lzma_allocator *allocator, const uint8_t *props, size_t props_size)
Definition: filter_decoder.c:38
void(* free)(void *opaque, void *ptr)
Pointer to a custom memory freeing function.
Definition: base.h:421
void message_help(bool long_help)
Print the help message.
Definition: message.c:1091
lzma_code_function code
Pointer to function to do the actual coding.
Definition: common.h:150
lzma_vli lzma_index_uncompressed_size(const lzma_index *i)
Get the uncompressed size of the file.
Definition: index.c:572
uint8_t * in
Definition: stream_encoder_mt.c:56
void * xrealloc(void *ptr, size_t size)
Safe realloc() that never returns NULL.
Definition: util.c:25
char ** arg_names
Filenames from command line.
Definition: args.h:15
size_t lzma_bufcpy(const uint8_t *restrict in, size_t *restrict in_pos, size_t in_size, uint8_t *restrict out, size_t *restrict out_pos, size_t out_size)
Definition: common.c:94
void lzma_end(lzma_stream *strm) lzma_nothrow
Free memory allocated for the coder data structures.
Definition: common.c:357
lzma_next_coder next
The filters in the chain; initialized with lzma_raw_decoder_init().
Definition: block_decoder.c:26
uint32_t keep_size_before
Definition: lz_encoder.h:45
@ THR_RUN
Encoding is in progress.
Definition: stream_encoder_mt.c:31
Private definitions for so called simple filters.
lzma_ret(* options_update)(void *coder, const lzma_filter *filter)
Update the options in the middle of the encoding.
Definition: lz_encoder.h:205
Optimized comparison of two buffers.
lzma_vli remaining
Number of Records not fully decoded.
Definition: index_hash.c:55
uint32_t min_version
Oldest XZ Utils version that will decompress the file.
Definition: list.c:33
lzma_ret lzma_filter_flags_size(uint32_t *size, const lzma_filter *filter) lzma_nothrow lzma_attr_warn_unused_result
Calculate encoded size of a Filter Flags field.
Definition: filter_flags_encoder.c:17
uint64_t lzma_memlimit_get(const lzma_stream *strm) lzma_nothrow lzma_attr_pure
Get the current memory usage limit.
Definition: common.c:415
#define LZMA_FILTERS_MAX
Maximum number of filters in a chain.
Definition: filter.h:26
#define LZMA_CHECK_SIZE_MAX
Maximum size of a Check field.
Definition: check.h:102
lzma_vli lzma_index_file_size(const lzma_index *i) lzma_nothrow lzma_attr_pure
Get the total size of the file.
Definition: index.c:560
lzma_stream_flags stream_flags
Definition: index.c:136
void * coder
Pointer to coder-specific data.
Definition: common.h:137
uint8_t buffer[LZMA_BLOCK_HEADER_SIZE_MAX]
Definition: stream_decoder.c:82
void signals_exit(void)
Definition: signals.c:153
static uint32_t filters_count
Number of filters. Zero indicates that we are using a preset.
Definition: coder.c:43
size_t size
Definition: simple_private.h:59
void io_fix_src_pos(file_pair *pair, size_t rewind_size)
Fix the position in src_fd.
Definition: file_io.c:1101
static bool progress_active
Definition: message.c:54
uint32_t offset
Definition: lzma_decoder.c:281
#define LZMA_STREAM_HEADER_SIZE
Size of Stream Header and Stream Footer.
Definition: stream_flags.h:27
@ LZMA_FULL_FLUSH
Finish encoding of the current Block.
Definition: base.h:290
lzma_match_finder
Match finders.
Definition: lzma12.h:58
#define lzma_next_strm_init(func, strm,...)
Definition: common.h:303
lzma_vli number_base
Number of Blocks in this Stream before this group.
Definition: index.c:76
lzma_ret lzma_stream_encoder_mt(lzma_stream *strm, const lzma_mt *options) lzma_nothrow lzma_attr_warn_unused_result
Initialize multithreaded .xz Stream encoder.
Definition: stream_encoder_mt.c:1079
#define LZMA_STREAM_INIT
Initialization for lzma_stream.
Definition: base.h:545
bool opt_single_stream
If true, stop after decoding the first stream.
Definition: coder.c:27
bool lzma_lzma_lclppb_decode(lzma_options_lzma *options, uint8_t byte)
Decodes the LZMA Properties byte (lc/lp/pb)
Definition: lzma_decoder.c:1000
bool picky
Definition: alone_decoder.c:32
static char * uncompressed_name(const char *src_name, const size_t src_len)
Removes the filename suffix of the compressed file.
Definition: suffix.c:110
Some threading related helper macros and functions.
lzma_bool ignore_check
A flag to Block decoder to not verify the Check field.
Definition: block.h:261
static uint32_t preset_number
Number of the preset (0-9)
Definition: coder.c:46
uint8_t * buffer
Pointer to buffer with data to be compressed.
Definition: lz_encoder.h:35
lzma_ret lzma_block_encoder(lzma_stream *strm, lzma_block *block)
Initialize .xz Block encoder.
Definition: block_encoder.c:215
bool tell_any_check
If true, LZMA_GET_CHECK is returned after decoding Stream Header.
Definition: stream_decoder.c:58
bool lzma_lzma_lclppb_encode(const lzma_options_lzma *options, uint8_t *byte)
Encodes lc/lp/pb into one byte. Returns false on success and true on error.
Definition: lzma_encoder.c:645
@ LZMA_MF_BT2
Binary Tree with 2-byte hashing.
Definition: lzma12.h:81
lzma_length_decoder rep_len_decoder
Length of a repeated match.
Definition: lzma_decoder.c:216
lzma_outq outq
Output buffer queue for compressed data.
Definition: stream_encoder_mt.c:134
bool io_write(file_pair *pair, const io_buf *buf, size_t size)
Writes a buffer to the destination file.
Definition: file_io.c:1275
lzma_vli lzma_index_stream_size(const lzma_index *i)
Get the total size of the Stream.
Definition: index.c:526
void(* lzma_end_function)(void *coder, const lzma_allocator *allocator)
Type of a function to free the memory allocated for the coder.
Definition: common.h:113
lzma_ret lzma_stream_decoder(lzma_stream *strm, uint64_t memlimit, uint32_t flags) lzma_nothrow lzma_attr_warn_unused_result
Initialize .xz Stream decoder.
Definition: stream_decoder.c:459
lzma_bool lzma_index_iter_next(lzma_index_iter *iter, lzma_index_iter_mode mode) lzma_nothrow lzma_attr_warn_unused_result
Get the next Block or Stream.
Definition: index.c:1103
lzma_index_iter iter
Iterator for the Index being encoded.
Definition: index_encoder.c:33
lzma_lzma_state state
State.
Definition: lzma_encoder_private.h:76
lzma_next_coder next
Next coder in the chain.
Definition: delta_private.h:20
#define UNPADDED_SIZE_MAX
Maximum Unpadded Size.
Definition: index.h:23
#define LZMA_IGNORE_CHECK
Definition: container.h:498
lzma_vli unpadded_size
Unpadded Size currently being read from an Index Record.
Definition: index_hash.c:58
uint64_t lzma_index_memusage(lzma_vli streams, lzma_vli blocks)
Calculate memory usage of lzma_index.
Definition: index.c:442
@ LZMA_FULL_BARRIER
Finish encoding of the current Block.
Definition: base.h:305
size_t size
Size of the dictionary.
Definition: lz_decoder.h:39
void io_no_sparse(void)
Disable creation of sparse files when decompressing.
Definition: file_io.c:151
const lzma_allocator * allocator
Definition: stream_encoder_mt.c:74
size_t check_pos
Position when reading the Check field.
Definition: block_decoder.c:44
uint32_t lp
Number of literal position bits.
Definition: lzma12.h:293
uint32_t dist
Delta distance.
Definition: delta.h:59
static uint32_t threads_max
Definition: hardware.c:18
void signals_unblock(void)
Unblock the signals blocked by signals_block().
Definition: signals.c:135
static int display_errors
Definition: xzdec.c:40
char * suffix_get_dest_name(const char *src_name)
Get the name of the destination file.
Definition: suffix.c:373
void message_filters_show(enum message_verbosity v, const lzma_filter *filters)
Print the filter chain.
Definition: message.c:1050
static bool parse_details(file_pair *pair, const lzma_index_iter *iter, block_header_info *bhi, xz_file_info *xfi)
Parse detailed information about a Block.
Definition: list.c:594
lzma_ret lzma_block_compressed_size(lzma_block *block, lzma_vli unpadded_size)
Validate and set Compressed Size according to Unpadded Size.
Definition: block_util.c:18
bool is_tty_stdin(void)
Test if stdin is a terminal.
Definition: util.c:276
enum message_verbosity message_verbosity_get(void)
Get the current verbosity level.
Definition: message.c:181
Definition: simple_private.h:19
@ LZMA_MODE_FAST
Fast compression.
Definition: lzma12.h:139
size_t tuklib_mbstr_width(const char *str, size_t *bytes)
Get the number of columns needed for the multibyte string.
Definition: tuklib_mbstr_width.c:22
uint64_t lzma_physmem(void)
Get the total amount of physical memory (RAM) in bytes.
Definition: hardware_physmem.c:19
size_t block_size
Definition: stream_encoder_mt.c:110
lzma_vli total_size
Total compressed size.
Definition: index.h:197
lzma_ret lzma_index_append(lzma_index *i, const lzma_allocator *allocator, lzma_vli unpadded_size, lzma_vli uncompressed_size)
Add a new Block to lzma_index.
Definition: index.c:640
uint64_t hardware_memlimit_get(enum operation_mode mode)
Get the current memory usage limit for compression or decompression.
Definition: hardware.c:112
Options for BCJ filters.
Definition: bcj.h:73
static lzma_ret lzma_decoder_init(lzma_lz_decoder *lz, const lzma_allocator *allocator, const void *options, lzma_lz_options *lz_options)
Definition: lzma_decoder.c:970
bool is_initialized
Definition: lzma_encoder_private.h:96
lzma_block * block
Definition: block_decoder.c:30
lzma_vli index_list_size
Size of the List of Index Records as bytes.
Definition: index_hash.c:29
#define LZMA_VERSION_STRING
Compile-time version as a string.
Definition: version.h:92
lzma_ret lzma_stream_flags_compare(const lzma_stream_flags *a, const lzma_stream_flags *b) lzma_nothrow lzma_attr_pure
Compare two lzma_stream_flags structures.
Definition: stream_flags_common.c:21
uint64_t(* block_size)(const void *options)
Definition: filter_encoder.c:37
uint64_t lzma_memusage(const lzma_stream *strm) lzma_nothrow lzma_attr_pure
Get the memory usage of decoder filter chain.
Definition: common.c:398
Definition: easy_preset.h:16
static io_wait_ret io_wait(file_pair *pair, int timeout, bool is_reading)
Waits for input or output to become available or for a signal.
Definition: file_io.c:241
lzma_ret lzma_alone_encoder(lzma_stream *strm, const lzma_options_lzma *options) lzma_nothrow lzma_attr_warn_unused_result
Initialize .lzma encoder (legacy file format)
Definition: alone_encoder.c:154
uint64_t opt_block_size
Definition: coder.c:28
lzma_ret lzma_index_cat(lzma_index *dest, lzma_index *src, const lzma_allocator *allocator) lzma_nothrow lzma_attr_warn_unused_result
Concatenate lzma_indexes.
uint32_t keep_size_after
Definition: lz_encoder.h:51
Definition: index_hash.c:37
static const char * progress_sizes(uint64_t compressed_pos, uint64_t uncompressed_pos, bool final)
Definition: message.c:315
lzma_next_coder next
Next filter in the chain.
Definition: simple_private.h:21
@ LZMA_INDEX_ITER_BLOCK
Get the next Block.
Definition: index.h:249
size_t prealloc
Definition: index.c:171
void io_close(file_pair *pair, bool success)
Closes the file descriptors and frees possible allocated memory.
Definition: file_io.c:1052
lzma_init_function init
Definition: filter_decoder.c:27
uint32_t lzma_check_size(lzma_check type)
Get the size of the Check field with the given Check ID.
Definition: check.c:64
const uint8_t * preset_dict
Pointer to an initial dictionary.
Definition: lzma12.h:240
uint32_t rep2
Distance of third latest match.
Definition: lzma_decoder.c:230
lzma_ret lzma_next_filter_update(lzma_next_coder *next, const lzma_allocator *allocator, const lzma_filter *reversed_filters)
Definition: common.c:127
static void * index_tree_next(const index_tree_node *node)
Get the next node in the tree. Return NULL if there are no more nodes.
Definition: index.c:294
#define LZMA2_UNCOMPRESSED_MAX
Maximum uncompressed size of LZMA chunk (no headers)
Definition: lzma2_encoder.h:24
#define LZMA2_CHUNK_MAX
Maximum number of bytes of actual data per chunk (no headers)
Definition: lzma2_encoder.h:21
@ THR_FINISH
Definition: stream_encoder_mt.c:35
lzma_vli lzma_index_total_size(const lzma_index *i) lzma_nothrow lzma_attr_pure
Get the total size of the Blocks.
Definition: index.c:519
lzma_options_bcj * options_bcj(const char *str)
Parser for BCJ options.
Definition: options.c:209
uint32_t lzma_cputhreads(void)
Get the number of processor cores or threads.
Definition: hardware_cputhreads.c:19
lzma_ret lzma_lzma_decoder_init(lzma_next_coder *next, const lzma_allocator *allocator, const lzma_filter_info *filters)
Allocates and initializes LZMA decoder.
Definition: lzma_decoder.c:987
lzma_vli block_number_add
Same as above but for Block numbers.
Definition: index.c:728
void message_filters_show(enum message_verbosity v, const lzma_filter *filters)
Print the filter chain.
Definition: message.c:1050
@ V_VERBOSE
Errors, warnings, and verbose statistics.
Definition: message.h:18
size_t distance
Delta distance.
Definition: delta_private.h:23
lzma_bool lzma_mf_is_supported(lzma_match_finder match_finder) lzma_nothrow lzma_attr_const
Test if given match finder is supported.
Definition: lz_encoder.c:586
index_tree groups
Definition: index.c:122
bool is_tty_stdin(void)
Test if stdin is a terminal.
Definition: util.c:276
enum message_verbosity message_verbosity_get(void)
Get the current verbosity level.
Definition: message.c:181
size_t options_size
Size of the filter-specific options structure.
Definition: filter_common.c:21
void hardware_memlimit_set(uint64_t new_memlimit, bool set_compress, bool set_decompress, bool is_percentage)
Definition: hardware.c:62
lzma_ret lzma_index_decoder(lzma_stream *strm, lzma_index **i, uint64_t memlimit) lzma_nothrow lzma_attr_warn_unused_result
Initialize .xz Index decoder.
Definition: index_decoder.c:297
lzma_ret(* memconfig)(void *coder, uint64_t *memusage, uint64_t *old_memlimit, uint64_t new_memlimit)
Definition: common.h:168
lzma_vli padding
Size of Stream Padding after this Stream.
Definition: index.h:108
Structure to pass info to index_cat_helper()
Definition: index.c:720
static const uint8_t * mf_ptr(const lzma_mf *mf)
Get pointer to the first byte not ran through the match finder.
Definition: lz_encoder.h:221
lzma_stream_coder * coder
Definition: stream_encoder_mt.c:69
#define lzma_next_coder_init(func, next, allocator)
Definition: common.h:291
uint32_t lzma_index_padding_size(const lzma_index *i)
Definition: index.c:593
void(* end)(void *coder, const lzma_allocator *allocator)
Free allocated resources.
Definition: lz_encoder.h:202
uint64_t str_to_uint64(const char *name, const char *value, uint64_t min, uint64_t max)
Fancy version of strtoull()
Definition: util.c:58
uint32_t lzma_cputhreads(void) lzma_nothrow
Get the number of processor cores or threads.
Definition: hardware_cputhreads.c:19
lzma_ret lzma_raw_decoder(lzma_stream *strm, const lzma_filter *options)
Initialize raw decoder.
Definition: filter_decoder.c:149
void message_version(void) lzma_attribute((__noreturn__))
Prints the version number to stdout and exits with exit status SUCCESS.
Definition: message.c:1074
size_t io_read(file_pair *pair, io_buf *buf, size_t size)
Reads from the source file to a buffer.
Definition: file_io.c:1116
lzma_options_delta * options_delta(const char *str)
Parser for Delta options.
Definition: options.c:165
#define header_skip(is_bt, len_min)
Definition: lz_encoder_mf.c:214
static void move_pending(lzma_mf *mf)
Definition: lz_encoder_mf.c:178
void lzma_check_update(lzma_check_state *check, lzma_check type, const uint8_t *buf, size_t size)
Update the check state.
Definition: check.c:117
lzma_ret lzma_index_encoder(lzma_stream *strm, const lzma_index *i) lzma_nothrow lzma_attr_warn_unused_result
Initialize .xz Index encoder.
Definition: index_encoder.c:210
Definition: lzma_encoder_private.h:39
void lzma_check_update(lzma_check_state *check, lzma_check type, const uint8_t *buf, size_t size)
Update the check state.
Definition: check.c:117
static bool try_sparse
If true, try to create sparse files when decompressing.
Definition: file_io.c:67
static uint32_t mf_avail(const lzma_mf *mf)
Get the number of bytes that haven't been ran through the match finder yet.
Definition: lz_encoder.h:229
static uint32_t lzma_attribute((__always_inline__)) lzma_memcmplen(const uint8_t *buf1
static bool progress_is_from_passthru
Definition: message.c:62
void * options
Pointer to filter-specific options structure.
Definition: filter.h:63
size_t count
Number of symbols in the tables.
Definition: range_encoder.h:34
#define LOOP_INPUT_MAX
Definition: lzma_encoder.c:308
uint64_t lzma_easy_decoder_memusage(uint32_t preset)
Calculate approximate decoder memory usage of a preset.
Definition: easy_decoder_memusage.c:17
int mytime_get_flush_timeout(void)
Get the number of milliseconds until the next flush.
Definition: mytime.c:74
lzma_ret lzma_next_filter_init(lzma_next_coder *next, const lzma_allocator *allocator, const lzma_filter_info *filters)
Definition: common.c:116
lzma_block block_options
Compression options for this Block.
Definition: stream_encoder_mt.c:86
Printing messages to stderr.
@ LZMA_MF_BT3
Binary Tree with 2- and 3-byte hashing.
Definition: lzma12.h:90
#define LZMA_PRESET_DEFAULT
Default compression preset.
Definition: container.h:31
uint32_t symbol
Definition: lzma_decoder.c:273
static lzma_vli vli_ceil4(lzma_vli vli)
Round the variable-length integer to the next multiple of four.
Definition: index.h:39
uint32_t reps[REPS]
The four most recent match distances.
Definition: lzma_encoder_private.h:79
lzma_init_function init
Definition: filter_encoder.c:27
static bool io_open_src_real(file_pair *pair)
Opens the source file. Returns false on success, true on error.
Definition: file_io.c:502
#define LZMA_FILTER_LZMA2
LZMA2 Filter ID.
Definition: lzma12.h:40
uint64_t lzma_index_memusage(lzma_vli streams, lzma_vli blocks) lzma_nothrow
Calculate memory usage of lzma_index.
Definition: index.c:442
uint32_t bufs_used
Number of buffers in use.
Definition: outqueue.h:55
void lzma_sha256_update(const uint8_t *buf, size_t size, lzma_check_state *check)
Update the SHA-256 hash state.
Definition: sha256.c:142
size_t pos
Definition: lz_decoder.h:28
void message_signal_handler(void) lzma_attribute((__noreturn__))
Definition: message.c:796
lzma_ret lzma_memlimit_set(lzma_stream *strm, uint64_t memlimit) lzma_nothrow
Set the memory usage limit.
Definition: common.c:432
uint64_t stream_padding
Total amount of Stream Padding.
Definition: list.c:23
void lzma_sha256_init(lzma_check_state *check)
Prepare SHA-256 state for new input.
Definition: sha256.c:127
const char * uint64_to_nicestr(uint64_t value, enum nicestr_unit unit_min, enum nicestr_unit unit_max, bool always_also_bytes, uint32_t slot)
Convert uint64_t to a nice human readable string.
Definition: util.c:187
void signals_exit(void)
Definition: signals.c:153
Program name to be displayed in messages.
lzma_ret lzma_index_buffer_encode(const lzma_index *i, uint8_t *out, size_t *out_pos, size_t out_size)
Single-call .xz Index encoder.
Definition: index_encoder.c:222
Various integer and bit operations.
lzma_ret lzma_index_buffer_encode(const lzma_index *i, uint8_t *out, size_t *out_pos, size_t out_size) lzma_nothrow
Single-call .xz Index encoder.
Definition: index_encoder.c:222
State for the internal SHA-256 implementation.
Definition: check.h:41
const uint32_t lzma_crc32_table[8][256]
Definition: crc32_small.c:16
void io_init(void)
Initialize the I/O module.
Definition: file_io.c:95
#define rc_if_0(prob, seq)
Definition: range_decoder.h:111
void message_help(bool long_help) lzma_attribute((__noreturn__))
Print the help message.
Definition: message.c:1091
bool opt_single_stream
If true, stop after decoding the first stream.
Definition: coder.c:27
size_t limit
Write limit.
Definition: lz_decoder.h:36
lzma_ret lzma_stream_header_decode(lzma_stream_flags *options, const uint8_t *in)
Decode Stream Header.
Definition: stream_flags_decoder.c:31
Branch/Call/Jump conversion filters.
lzma_vli number_in_file
Block number in the file.
Definition: index.h:122
uint32_t crc32
CRC32 of the List of Records field.
Definition: index_decoder.c:52
size_t pos
rc_encode()'s position in the tables
Definition: range_encoder.h:37
static void normalize(lzma_mf *mf)
Normalizes hash values.
Definition: lz_encoder_mf.c:108
enum lzma_internal_s::@10 sequence
lzma_ret lzma_alone_encoder(lzma_stream *strm, const lzma_options_lzma *options)
Initialize .lzma encoder (legacy file format)
Definition: alone_encoder.c:154
void set_exit_no_warn(void)
Definition: main.c:51
uint32_t offset
Definition: lz_encoder.h:58
static uint32_t my_log2(uint32_t n)
Primitive base-2 logarithm for integers.
Definition: lzmainfo.c:91
bool ignore_check
Definition: stream_decoder.c:62
lzma_vli unpadded_size
Additional size information.
Definition: outqueue.h:25
Options for encoding/decoding Stream Header and Stream Footer.
Definition: stream_flags.h:33
#define LZMA2_HEADER_MAX
Maximum size of LZMA2 headers.
Definition: lzma2_encoder.h:27
lzma_vli id
Filter ID.
Definition: filter_common.h:22
Validate Index by using a hash function.
uint32_t lzma_version_number(void)
Run-time version number as an integer.
Definition: common.c:21
#define LZMA_FILTER_LZMA1
LZMA1 Filter ID.
Definition: lzma12.h:30
lzma_ret lzma_filter_flags_encode(const lzma_filter *filter, uint8_t *out, size_t *out_pos, size_t out_size) lzma_nothrow lzma_attr_warn_unused_result
Encode Filter Flags into given buffer.
Definition: filter_flags_encoder.c:31
lzma_bool lzma_filter_decoder_is_supported(lzma_vli id) lzma_nothrow lzma_attr_const
Test if the given Filter ID is supported for decoding.
Definition: filter_decoder.c:133
lzma_ret lzma_outq_read(lzma_outq *restrict outq, uint8_t *restrict out, size_t *restrict out_pos, size_t out_size, lzma_vli *restrict unpadded_size, lzma_vli *restrict uncompressed_size)
Read finished data.
Definition: outqueue.c:147
void message_init(void)
Initializes the message functions.
Definition: message.c:114
uint64_t lzma_block_buffer_bound64(uint64_t uncompressed_size)
Definition: block_buffer_encoder.c:56
uint32_t threads
Number of worker threads to use.
Definition: container.h:79
@ LZMA_OK
Operation completed successfully.
Definition: base.h:58
static bool is_dir_sep(char c)
Test if the char is a directory separator.
Definition: suffix.c:30
uint64_t lzma_memusage(const lzma_stream *strm)
Get the memory usage of decoder filter chain.
Definition: common.c:398
lzma_ret(* lzma_code_function)(void *coder, const lzma_allocator *allocator, const uint8_t *restrict in, size_t *restrict in_pos, size_t in_size, uint8_t *restrict out, size_t *restrict out_pos, size_t out_size, lzma_action action)
Definition: common.h:105
char * suffix_get_dest_name(const char *src_name)
Get the name of the destination file.
Definition: suffix.c:373
lzma_ret lzma_block_header_size(lzma_block *block) lzma_nothrow lzma_attr_warn_unused_result
Calculate Block Header Size.
Definition: block_header_encoder.c:18
void lzma_get_progress(lzma_stream *strm, uint64_t *progress_in, uint64_t *progress_out) lzma_nothrow
Get progress information.
Definition: common.c:370
static uint64_t memlimit_compress
Memory usage limit for compression.
Definition: hardware.c:21
uint64_t lzma_physmem(void) lzma_nothrow
Get the total amount of physical memory (RAM) in bytes.
Definition: hardware_physmem.c:19
const uint8_t * next_in
Definition: base.h:486
lzma_next_coder block_encoder
Block encoder.
Definition: stream_encoder_mt.c:83
lzma_options_lzma opt_lzma
Options for LZMA2.
Definition: easy_preset.h:22
static size_t signals_block_count
signals_block() and signals_unblock() can be called recursively.
Definition: signals.c:36
static void progress_pos(uint64_t *in_pos, uint64_t *compressed_pos, uint64_t *uncompressed_pos)
Get how much uncompressed and compressed data has been processed.
Definition: message.c:512
uint64_t round_up_to_mib(uint64_t n)
Round an integer up to the next full MiB and convert to MiB.
Definition: util.c:139
lzma_delta_type
Type of the delta calculation.
Definition: delta.h:35
lzma_vli id
Filter ID.
Definition: filter_encoder.c:23
lzma_ret lzma_stream_encoder_mt(lzma_stream *strm, const lzma_mt *options)
Initialize multithreaded .xz Stream encoder.
Definition: stream_encoder_mt.c:1079
Close stdout and stderr, and exit.
void * lzma_attribute((__malloc__)) lzma_attr_alloc_size(1) lzma_alloc_zero(size_t size
Internal API to different integrity check functions.
lzma_vli record_count
Number of Records in this Stream.
Definition: index.c:125
uint32_t flags
Flags.
Definition: container.h:74
static void worker_error(worker_thread *thr, lzma_ret ret)
Tell the main thread that something has gone wrong.
Definition: stream_encoder_mt.c:182
lzma_ret(* update)(void *coder, const lzma_allocator *allocator, const lzma_filter *filters, const lzma_filter *reversed_filters)
Definition: common.h:173
probability is_rep0[STATES]
Definition: lzma_decoder.c:186
lzma_length_decoder match_len_decoder
Length of a normal match.
Definition: lzma_decoder.c:213
lzma_index_hash * index_hash
Definition: stream_decoder.c:41
lzma_ret lzma_stream_buffer_decode(uint64_t *memlimit, uint32_t flags, const lzma_allocator *allocator, const uint8_t *in, size_t *in_pos, size_t in_size, uint8_t *out, size_t *out_pos, size_t out_size)
Single-call .xz Stream decoder.
Definition: stream_buffer_decoder.c:17
uint64_t memusage_max
Highest memory usage so far.
Definition: list.c:26
lzma_ret lzma_raw_buffer_encode(const lzma_filter *filters, const lzma_allocator *allocator, const uint8_t *in, size_t in_size, uint8_t *out, size_t *out_pos, size_t out_size) lzma_nothrow
Single-call raw encoder.
Definition: filter_buffer_encoder.c:17
size_t match_len_max
Definition: lz_encoder.h:144
index_tree_node node
Every Record group is part of index_stream.groups tree.
Definition: index.c:73
worker_state
Definition: stream_encoder_mt.c:26
lzma_vli compressed_file_offset
Compressed start offset of this Block.
Definition: index.h:132
lzma_ret lzma_properties_decode(lzma_filter *filter, const lzma_allocator *allocator, const uint8_t *props, size_t props_size) lzma_nothrow
Decode the Filter Properties field.
Definition: filter_decoder.c:169
lzma_ret lzma_lzma_decoder_init(lzma_next_coder *next, const lzma_allocator *allocator, const lzma_filter_info *filters)
Allocates and initializes LZMA decoder.
Definition: lzma_decoder.c:987
uint32_t crc32
CRC32 of the Index.
Definition: index_hash.c:68
lzma_ret lzma_block_uncomp_encode(lzma_block *block, const uint8_t *in, size_t in_size, uint8_t *out, size_t *out_pos, size_t out_size) lzma_nothrow lzma_attr_warn_unused_result
Single-call uncompressed .xz Block encoder.
Definition: block_buffer_encoder.c:329
size_t avail_in
Definition: common.h:217
bool need_properties
Definition: lzma2_decoder.c:46
lzma_ret lzma_stream_buffer_encode(lzma_filter *filters, lzma_check check, const lzma_allocator *allocator, const uint8_t *in, size_t in_size, uint8_t *out, size_t *out_pos_ptr, size_t out_size)
Single-call .xz Stream encoder.
Definition: stream_buffer_encoder.c:44
uint32_t count
Number of nodes in the tree.
Definition: index.c:60
void message_init(void)
Initializes the message functions.
Definition: message.c:114
size_t(* filter)(void *simple, uint32_t now_pos, bool is_encoder, uint8_t *buffer, size_t size)
Definition: simple_private.h:34
static void mf_skip(lzma_mf *mf, uint32_t amount)
Definition: lz_encoder.h:267
void(* set_uncompressed)(void *coder, lzma_vli uncompressed_size)
Set the uncompressed size.
Definition: lz_decoder.h:66
uint32_t version
Block format version.
Definition: block.h:52
uint8_t header[LZMA_STREAM_HEADER_SIZE]
Buffer to hold Stream Header and Stream Footer.
Definition: stream_encoder_mt.c:127
uint32_t matches_count
Number of match candidates in matches[].
Definition: lzma_encoder_private.h:85
lzma_ret lzma_next_filter_update(lzma_next_coder *next, const lzma_allocator *allocator, const lzma_filter *reversed_filters)
Definition: common.c:127
lzma_bool lzma_check_is_supported(lzma_check type)
Test if the given Check ID is supported.
Definition: check.c:17
void io_write_to_user_abort_pipe(void)
Write a byte to user_abort_pipe[1].
Definition: file_io.c:135
lzma_ret lzma_stream_decoder(lzma_stream *strm, uint64_t memlimit, uint32_t flags)
Initialize .xz Stream decoder.
Definition: stream_decoder.c:459
lzma_options_lzma opt_cur
LZMA options currently in use.
Definition: lzma2_encoder.c:33
bool dest_try_sparse
Definition: file_io.h:61
static uint32_t mf_position(const lzma_mf *mf)
Definition: lz_encoder.h:252
lzma_index * index
Index to hold sizes of the Blocks.
Definition: stream_encoder_mt.c:117
lzma_ret lzma_stream_footer_encode(const lzma_stream_flags *options, uint8_t *out)
Encode Stream Footer.
Definition: stream_flags_encoder.c:57
lzma_ret(* props_encode)(const void *options, uint8_t *out)
Definition: filter_encoder.c:51
lzma_end_function end
Definition: common.h:155
Definition: lzma2_decoder.c:19
@ LZMA_CHECK_CRC32
Definition: check.h:35
lzma_ret lzma_block_header_encode(const lzma_block *block, uint8_t *out) lzma_nothrow lzma_attr_warn_unused_result
Encode Block Header.
Definition: block_header_encoder.c:74
struct stat src_st
Stat of the source file.
Definition: file_io.h:69
lzma_vli lzma_index_stream_count(const lzma_index *i) lzma_nothrow lzma_attr_pure
Get the number of Streams.
Definition: index.c:505
void lzma_index_iter_init(lzma_index_iter *iter, const lzma_index *i)
Initialize an iterator.
Definition: index.c:1083
@ V_DEBUG
Very verbose.
Definition: message.h:19
lzma_vli uncompressed_size
Definition: lzma_decoder.c:239
Hash macros for match finders.
void mytime_set_flush_time(void)
Store the time of when compressor was flushed.
Definition: mytime.c:66
Definition: range_decoder.h:20
lzma_filter filters[LZMA_FILTERS_MAX+1]
Definition: easy_preset.h:19
static bool dict_is_distance_valid(const lzma_dict *const dict, const size_t distance)
Validate the match distance.
Definition: lz_decoder.h:120
static int stdout_flags
Definition: file_io.c:82
lzma_bool lzma_mf_is_supported(lzma_match_finder mf)
Test if given match finder is supported.
Definition: lz_encoder.c:586
const uint8_t lzma_rc_prices[RC_PRICE_TABLE_SIZE]
Lookup table for the inline functions defined in this file.
Definition: price_table.c:5
bool io_open_dest(file_pair *pair)
Open the destination file.
Definition: file_io.c:991
@ LZMA_INDEX_ITER_ANY
Get the next Block or Stream.
Definition: index.h:227
lzma_vli block_number_base
Total number of Blocks before this Stream.
Definition: index.c:115
lzma_check(* get_check)(const void *coder)
Definition: common.h:164
bool io_pread(file_pair *pair, io_buf *buf, size_t size, off_t pos)
Read from source file from given offset to a buffer.
Definition: file_io.c:1186
void lzma_index_prealloc(lzma_index *i, lzma_vli records)
Definition: index.c:431
uint8_t pos
Position in history[].
Definition: delta_private.h:26
lzma_options_delta * options_delta(const char *str)
Parser for Delta options.
Definition: options.c:165
#define is_literal_state(state)
Test if the previous state was a literal.
Definition: lzma_common.h:100
uint64_t lzma_raw_encoder_memusage(const lzma_filter *filters) lzma_nothrow lzma_attr_pure
Calculate approximate memory requirements for raw encoder.
Definition: filter_encoder.c:222
#define BLOCK_SIZE_MAX
Definition: stream_encoder_mt.c:23
Filter options.
Definition: filter.h:43
#define LZMA_VLI_MAX
Maximum supported value of a variable-length integer.
Definition: vli.h:34
lzma_ret lzma_filters_copy(const lzma_filter *src, lzma_filter *dest, const lzma_allocator *allocator)
Copy the filters array.
Definition: filter_common.c:125
Handling signals to abort operation.
static bool lzma_outq_is_empty(const lzma_outq *outq)
Test if the queue is completely empty.
Definition: outqueue.h:153
@ LZMA_FORMAT_ERROR
Memory usage limit was reached.
Definition: base.h:150
@ THR_EXIT
Definition: stream_encoder_mt.c:43
lzma_vli uncompressed_file_offset
Uncompressed start offset of this Block.
Definition: index.h:147
lzma_ret lzma_next_filter_init(lzma_next_coder *next, const lzma_allocator *allocator, const lzma_filter_info *filters)
Definition: common.c:116
static lzma_stream * progress_strm
Pointer to lzma_stream used to do the encoding or decoding.
Definition: message.c:57
lzma_vli lzma_block_total_size(const lzma_block *block)
Calculate the total encoded size of a Block.
Definition: block_util.c:82
static bool dict_put(lzma_dict *dict, uint8_t byte)
Definition: lz_decoder.h:187
@ LZMA_MF_HC4
Hash Chain with 2-, 3-, and 4-byte hashing.
Definition: lzma12.h:70
lzma_ret lzma_stream_header_encode(const lzma_stream_flags *options, uint8_t *out)
Encode Stream Header.
Definition: stream_flags_encoder.c:30
lzma_ret lzma_block_buffer_decode(lzma_block *block, const lzma_allocator *allocator, const uint8_t *in, size_t *in_pos, size_t in_size, uint8_t *out, size_t *out_pos, size_t out_size)
Single-call .xz Block decoder.
Definition: block_buffer_decoder.c:17
void * xrealloc(void *ptr, size_t size) lzma_attribute((__malloc__)) lzma_attr_alloc_size(2)
Safe realloc() that never returns NULL.
Definition: util.c:25
const char * lzma_version_string(void)
Run-time version as a string.
Definition: common.c:28
#define LZMA_FILTER_RESERVED_START
Definition: common.h:67
#define LZMA_THREADS_MAX
Definition: common.h:56
uint32_t write_pos
Definition: lz_encoder.h:80
lzma_options_lzma * options_lzma(const char *str)
Parser for LZMA options.
Definition: options.c:317
lzma_ret lzma_alone_decoder(lzma_stream *strm, uint64_t memlimit) lzma_nothrow lzma_attr_warn_unused_result
Initialize .lzma decoder (legacy file format)
Definition: alone_decoder.c:234
uint32_t depth
Maximum search depth in the match finder.
Definition: lzma12.h:375
lzma_ret lzma_index_stream_flags(lzma_index *i, const lzma_stream_flags *stream_flags)
Set the Stream Flags.
Definition: index.c:601
void io_no_sparse(void)
Disable creation of sparse files when decompressing.
Definition: file_io.c:151
static void index_tree_end(index_tree *tree, const lzma_allocator *allocator, void(*free_func)(void *node, const lzma_allocator *allocator))
Definition: index.c:215
const char * uint64_to_nicestr(uint64_t value, enum nicestr_unit unit_min, enum nicestr_unit unit_max, bool always_also_bytes, uint32_t slot)
Convert uint64_t to a nice human readable string.
Definition: util.c:187
Utility functions for handling multibyte strings.
off_t dest_pending_sparse
Definition: file_io.h:66
bool first_stream
Definition: stream_decoder.c:75
Definition: lzma_encoder_private.h:53
lzma_bool lzma_mode_is_supported(lzma_mode mode) lzma_nothrow lzma_attr_const
Test if given compression mode is supported.
Definition: lzma_encoder.c:674
lzma_ret lzma_block_buffer_encode(lzma_block *block, const lzma_allocator *allocator, const uint8_t *in, size_t in_size, uint8_t *out, size_t *out_pos, size_t out_size) lzma_nothrow lzma_attr_warn_unused_result
Single-call .xz Block encoder.
Definition: block_buffer_encoder.c:319
Definition: lz_encoder.h:29
size_t last
Index of the last Record in use.
Definition: index.c:82
uint32_t(* find)(lzma_mf *mf, lzma_match *matches)
Definition: lz_encoder.h:92
lzma_index * lzma_index_init(const lzma_allocator *allocator) lzma_nothrow
Allocate and initialize a new lzma_index structure.
Definition: index.c:398
bool flush_needed
For –flush-timeout: True when flushing is needed.
Definition: file_io.h:57
lzma_outbuf * lzma_outq_get_buf(lzma_outq *outq)
Get a new buffer.
Definition: outqueue.c:114
static bool signals_are_initialized
Definition: signals.c:33
uint64_t lzma_stream_encoder_mt_memusage(const lzma_mt *options) lzma_nothrow lzma_attr_pure
Calculate approximate memory usage of multithreaded .xz encoder.
Definition: stream_encoder_mt.c:1097
FILE * files_file
Definition: args.h:26
lzma_index * lzma_index_dup(const lzma_index *src, const lzma_allocator *allocator)
Duplicate lzma_index.
Definition: index.c:926
The public API of liblzma data compression library.
uint64_t lzma_raw_decoder_memusage(const lzma_filter *filters)
Calculate approximate memory requirements for raw decoder.
Definition: filter_decoder.c:161
lzma_vli uncompressed_size
The most recent Uncompressed Size field.
Definition: index_decoder.c:46
static void * index_tree_locate(const index_tree *tree, lzma_vli target)
Definition: index.c:315
static bool dict_is_empty(const lzma_dict *const dict)
Test if dictionary is empty.
Definition: lz_decoder.h:112
Common definitions for tuklib modules.
lzma_ret(* props_size_get)(uint32_t *size, const void *options)
Definition: filter_encoder.c:42
Definition: lzma_decoder.c:170
#define header_find(is_bt, len_min)
Definition: lz_encoder_mf.c:207
lzma_vli uncompressed_stream_offset
Uncompressed start offset of this Block.
Definition: index.h:170
size_t lzma_stream_buffer_bound(size_t uncompressed_size)
Calculate output buffer size for single-call Stream encoder.
Definition: stream_buffer_encoder.c:26
#define LZMA_ACTION_MAX
Largest valid lzma_action value as unsigned integer.
Definition: common.h:81
void message_progress_end(bool finished)
Finishes the progress message if we were in verbose mode.
Definition: message.c:707
uint64_t memlimit
Memory usage limit.
Definition: alone_decoder.c:41
Definition: auto_decoder.c:17
uint32_t now_pos
Definition: simple_private.h:44
@ LZMA_MF_HC3
Hash Chain with 2- and 3-byte hashing.
Definition: lzma12.h:59
static void io_copy_attrs(const file_pair *pair)
Copies owner/group and permissions.
Definition: file_io.c:352
static uint64_t memlimit_decompress
Memory usage limit for decompression.
Definition: hardware.c:24
void coder_set_extreme(void)
Enable extreme mode.
Definition: coder.c:98
uint64_t opt_flush_timeout
Number of milliseconds to between LZMA_SYNC_FLUSHes.
Definition: mytime.c:19
#define rc_is_finished(range_decoder)
Definition: range_decoder.h:80
lzma_bool lzma_index_iter_locate(lzma_index_iter *iter, lzma_vli target) lzma_nothrow
Locate a Block.
Definition: index.c:1210
enum format_type opt_format
Definition: coder.c:25
lzma_vli lzma_index_stream_size(const lzma_index *i) lzma_nothrow lzma_attr_pure
Get the total size of the Stream.
Definition: index.c:526
static void get_check_names(char buf[CHECKS_STR_SIZE], uint32_t checks, bool space_after_comma)
Get a comma-separated list of Check names.
Definition: list.c:638
uint64_t mytime_get_elapsed(void)
Get the number of milliseconds since the operation started.
Definition: mytime.c:59
static void io_close_src(file_pair *pair, bool success)
Closes source file of the file_pair structure.
Definition: file_io.c:783
lzma_vli lzma_index_stream_count(const lzma_index *i)
Get the number of Streams.
Definition: index.c:505
char * xstrdup(const char *src)
Safe strdup() that never returns NULL.
Definition: util.c:48
#define update_long_rep(state)
Indicate that the latest state was a long repeated match.
Definition: lzma_common.h:92
#define UNPADDED_SIZE_MIN
Minimum Unpadded Size.
Definition: index.h:20
static const char * progress_remaining(uint64_t in_pos, uint64_t elapsed)
Definition: message.c:426
bool lzma_easy_preset(lzma_options_easy *easy, uint32_t preset)
Definition: easy_preset.c:17
size_t avail_in
Definition: base.h:487
uint32_t lzma_vli_size(lzma_vli vli) lzma_nothrow lzma_attr_pure
Get the number of bytes required to encode a VLI.
Definition: vli_size.c:17
lzma_vli id
Filter ID.
Definition: filter.h:54
Decoder for LZMA_Alone files.
uint8_t buf[LZMA2_HEADER_MAX+LZMA2_CHUNK_MAX]
Buffer to hold the chunk header and LZMA compressed data.
Definition: lzma2_encoder.c:50
void lzma_index_end(lzma_index *i, const lzma_allocator *allocator) lzma_nothrow
Deallocate lzma_index.
Definition: index.c:417
lzma_index_hash_info records
Information collected from the Index field.
Definition: index_hash.c:52
static const char * progress_time(uint64_t mseconds)
Definition: message.c:393
void lzma_outq_end(lzma_outq *outq, const lzma_allocator *allocator)
Free the memory associated with the output queue.
Definition: outqueue.c:101
static void encode_in_place(lzma_delta_coder *coder, uint8_t *buffer, size_t size)
Definition: delta_encoder.c:38
#define LZMA_FILTER_SPARC
Definition: bcj.h:47
lzma_vli lzma_block_unpadded_size(const lzma_block *block) lzma_nothrow lzma_attr_pure
Calculate Unpadded Size.
Definition: block_util.c:46
Definition: outqueue.h:37
uint64_t str_to_uint64(const char *name, const char *value, uint64_t min, uint64_t max)
Fancy version of strtoull()
Definition: util.c:58
static lzma_ret rc_read_init(lzma_range_decoder *rc, const uint8_t *restrict in, size_t *restrict in_pos, size_t in_size)
Reads the first five bytes to initialize the range decoder.
Definition: range_decoder.h:29
#define LZMA_FILTER_ARMTHUMB
Definition: bcj.h:42
lzma_index_iter_mode
Operation mode for lzma_index_iter_next()
Definition: index.h:226
Custom functions for memory handling.
Definition: base.h:372
Output buffer for a single thread.
Definition: outqueue.h:17
uint32_t lzma_crc32(const uint8_t *buf, size_t size, uint32_t crc) lzma_nothrow lzma_attr_pure
Calculate CRC32.
Definition: crc32_fast.c:27
bool changes_size
Definition: filter_common.c:34
lzma_check lzma_get_check(const lzma_stream *strm) lzma_nothrow
Get the type of the integrity check.
Definition: common.c:386
void lzma_next_end(lzma_next_coder *next, const lzma_allocator *allocator)
Definition: common.c:145
static enum coder_init_ret coder_init(file_pair *pair)
Definition: coder.c:435
lzma_ret lzma_filter_flags_size(uint32_t *size, const lzma_filter *filter)
Calculate encoded size of a Filter Flags field.
Definition: filter_flags_encoder.c:17
lzma_vli compressed_base
Compressed start offset of this Stream or Block.
Definition: index.c:37
uint32_t lzma_mf_find(lzma_mf *mf, uint32_t *count, lzma_match *matches)
Find matches starting from the current byte.
Definition: lz_encoder_mf.c:23
static uint64_t mytime_now(void)
Get the current time as milliseconds.
Definition: mytime.c:29
lzma_filter filters[LZMA_FILTERS_MAX+1]
The filter chain currently in use.
Definition: stream_encoder_mt.c:113
uint64_t progress_in
Definition: stream_encoder_mt.c:168
static uint64_t progress_next_update
Elapsed time when the next progress message update should be done.
Definition: message.c:108
static const char * filename
Filename which we will print with the verbose messages.
Definition: message.c:28
uint64_t memlimit
Memory usage limit.
Definition: stream_decoder.c:44
#define LITERAL_CODERS_MAX
Maximum number of literal coders.
Definition: lzma_common.h:118
lzma_filter * filters
Array of filters.
Definition: block.h:200
static bool coder_normal(file_pair *pair)
Compress or decompress using liblzma.
Definition: coder.c:631
lzma_ret lzma_index_stream_padding(lzma_index *i, lzma_vli stream_padding)
Set the amount of Stream Padding.
Definition: index.c:618
Private definitions common to LZMA encoder and decoder.
size_t pos
Definition: index_hash.c:65
bool tell_unsupported_check
Definition: stream_decoder.c:55
uint32_t preset_dict_size
Size of the preset dictionary.
Definition: lzma12.h:254
void lzma_free(void *ptr, const lzma_allocator *allocator)
Frees memory.
Definition: common.c:78
Hold data and function pointers of the next filter in the chain.
Definition: common.h:135
index_tree_node node
Every index_stream is a node in the tree of Streams.
Definition: index.c:109
Filter ID mapping to filter-specific functions.
probability pos_special[FULL_DISTANCES - DIST_MODEL_END]
Definition: lzma_decoder.c:206
static int user_abort_pipe[2]
Definition: file_io.c:87
lzma_ret lzma_stream_flags_compare(const lzma_stream_flags *a, const lzma_stream_flags *b)
Compare two lzma_stream_flags structures.
Definition: stream_flags_common.c:21
size_t buf_size_max
Amount of buffer space available in each buffer.
Definition: outqueue.h:45
const char * src_name
Definition: file_io.h:37
enum format_type opt_format
Definition: coder.c:25
static unsigned int files_pos
Number of the current file.
Definition: message.c:19
lzma_ret lzma_raw_decoder(lzma_stream *strm, const lzma_filter *filters) lzma_nothrow lzma_attr_warn_unused_result
Initialize raw decoder.
Definition: filter_decoder.c:149
@ LZMA_UNSUPPORTED_CHECK
Cannot calculate the integrity check.
Definition: base.h:90
lzma_reserved_enum
Type of reserved enumeration variable in structures.
Definition: base.h:44
void message_try_help(void)
Print a message that user should try –help.
Definition: message.c:1063
lzma_ret lzma_properties_encode(const lzma_filter *filter, uint8_t *props) lzma_nothrow
Encode the Filter Properties field.
Definition: filter_encoder.c:276
lzma_next_coder block_decoder
Definition: stream_decoder.c:30
static const char * uint32_to_optstr(uint32_t num)
Convert uint32_t to a nice string for –lzma[12]=dict=SIZE.
Definition: message.c:901
@ V_WARNING
Errors and warnings.
Definition: message.h:17
void coder_add_filter(lzma_vli id, void *options)
Add a filter to the custom filter chain.
Definition: coder.c:107
#define LITERAL_CODER_SIZE
Definition: lzma_common.h:115
void lzma_index_iter_init(lzma_index_iter *iter, const lzma_index *i) lzma_nothrow
Initialize an iterator.
Definition: index.c:1083
uint64_t * opt_block_list
Definition: coder.c:29
void(* get_progress)(void *coder, uint64_t *progress_in, uint64_t *progress_out)
Definition: common.h:159
lzma_vli stream_padding
Definition: index.c:140
Wrapper for simple filters.
void suffix_set(const char *suffix)
Set a custom filename suffix.
Definition: suffix.c:388
message_verbosity
Verbosity levels.
Definition: message.h:14
lzma_index ** index_ptr
Definition: index_decoder.c:37
@ LZMA_MEM_ERROR
Cannot allocate memory.
Definition: base.h:128
Definition: lz_encoder.h:22
#define LZMA_TIMED_OUT
Definition: common.h:88
void lzma_index_hash_end(lzma_index_hash *index_hash, const lzma_allocator *allocator)
Deallocate lzma_index_hash structure.
Definition: index_hash.c:105
lzma_vli lzma_index_block_count(const lzma_index *i)
Get the number of Blocks.
Definition: index.c:498
@ LZMA_CHECK_SHA256
Definition: check.h:49
probability * probs
Base of the current probability tree.
Definition: lzma_decoder.c:269
Definitions common to the whole liblzma library.
lzma_ret lzma_stream_encoder(lzma_stream *strm, const lzma_filter *filters, lzma_check check) lzma_nothrow lzma_attr_warn_unused_result
Initialize .xz Stream encoder using a custom filter chain.
Definition: stream_encoder.c:328
size_t buffer_pos
Read position in buffer[].
Definition: stream_encoder.c:50
worker_thread * thr
Definition: stream_encoder_mt.c:163
void lzma_sha256_update(const uint8_t *buf, size_t size, lzma_check_state *check)
Update the SHA-256 hash state.
Definition: sha256.c:142
probability literal[LITERAL_CODERS_MAX][LITERAL_CODER_SIZE]
Literals; see comments in lzma_common.h.
Definition: lzma_decoder.c:176
lzma_next_coder index_encoder
Definition: stream_encoder.c:44
lzma_ret lzma_vli_encode(lzma_vli vli, size_t *vli_pos, uint8_t *out, size_t *out_pos, size_t out_size) lzma_nothrow
Encode a variable-length integer.
uint8_t * buf
Pointer to the output buffer of lzma_outq.buf_size_max bytes.
Definition: outqueue.h:19
const char * uint64_to_str(uint64_t value, uint32_t slot)
Convert uint64_t to a string.
Definition: util.c:171
lzma_ret
Return values used by several functions in liblzma.
Definition: base.h:57
void mytime_set_start_time(void)
Store the time when (de)compression was started.
Definition: mytime.c:51
lzma_ret lzma_raw_encoder(lzma_stream *strm, const lzma_filter *options)
Initialize raw encoder.
Definition: filter_encoder.c:208
lzma_ret lzma_block_buffer_encode(lzma_block *block, const lzma_allocator *allocator, const uint8_t *in, size_t in_size, uint8_t *out, size_t *out_pos, size_t out_size)
Single-call .xz Block encoder.
Definition: block_buffer_encoder.c:319
Wrapper for gettext and friends.
void message_bug(void)
Definition: message.c:789
@ THR_IDLE
Waiting for work.
Definition: stream_encoder_mt.c:28
#define LZMA_SUPPORTED_FLAGS
Definition: common.h:72
size_t lzma_bufcpy(const uint8_t *restrict in, size_t *restrict in_pos, size_t in_size, uint8_t *restrict out, size_t *restrict out_pos, size_t out_size)
Definition: common.c:94
uint64_t lzma_block_buffer_bound64(uint64_t uncompressed_size)
Definition: block_buffer_encoder.c:56
void hardware_threads_set(uint32_t n)
Set the maximum number of worker threads.
Definition: hardware.c:31
size_t uncompressed_size
Uncompressed size of LZMA chunk.
Definition: lzma2_decoder.c:38
bool allow_buf_error
Definition: common.h:224
lzma_vli number
Stream number in the lzma_index.
Definition: index.h:62
void lzma_check_finish(lzma_check_state *check, lzma_check type)
Finish the check calculation and store the result to check->buffer.u8.
Definition: check.c:148
void * options
Pointer to filter's options structure.
Definition: common.h:130
void lzma_check_finish(lzma_check_state *check, lzma_check type)
Finish the check calculation and store the result to check->buffer.u8.
Definition: check.c:148
index_tree_node * leftmost
Definition: index.c:53
Miscellaneous declarations.
lzma_ret lzma_block_encoder(lzma_stream *strm, lzma_block *block) lzma_nothrow lzma_attr_warn_unused_result
Initialize .xz Block encoder.
Definition: block_encoder.c:215
size_t allocated
Number of Records that can be put in records[].
Definition: index.c:79
#define rc_from_local(range_decoder, in_pos)
Stores the local copes back to the range decoder structure.
Definition: range_decoder.h:61
#define update_literal(state)
Indicate that the latest state was a literal.
Definition: lzma_common.h:80
lzma_vli lzma_index_file_size(const lzma_index *i)
Get the total size of the file.
Definition: index.c:560
static void move_window(lzma_mf *mf)
Moves the data in the input window to free space for new data.
Definition: lz_encoder.c:46
Definition: filter_decoder.c:21
lzma_block block_options
Options for the Block encoder.
Definition: stream_decoder.c:34
static lzma_stream strm
Stream used to communicate with liblzma.
Definition: coder.c:33
static io_buf in_buf
Input and output buffers.
Definition: coder.c:39
uint64_t memusage
Amount of memory actually needed (only an estimate)
Definition: stream_decoder.c:47
uint32_t read_ahead
Definition: lz_encoder.h:67
lzma_index_hash * lzma_index_hash_init(lzma_index_hash *index_hash, const lzma_allocator *allocator) lzma_nothrow lzma_attr_warn_unused_result
Allocate and initialize a new lzma_index_hash structure.
Definition: index_hash.c:73
void lzma_index_hash_end(lzma_index_hash *index_hash, const lzma_allocator *allocator) lzma_nothrow
Deallocate lzma_index_hash structure.
Definition: index_hash.c:105
void set_exit_status(enum exit_status_type new_status)
Definition: main.c:31
Checks filename suffix and creates the destination filename.
uint32_t bufs_pos
Definition: outqueue.h:52
#define LZMA_TELL_NO_CHECK
Definition: container.h:457
lzma_ret lzma_index_encoder(lzma_stream *strm, const lzma_index *i)
Initialize .xz Index encoder.
Definition: index_encoder.c:210
static lzma_ret get_options(const lzma_mt *options, lzma_options_easy *opt_easy, const lzma_filter **filters, uint64_t *block_size, uint64_t *outbuf_size_max)
Definition: stream_encoder_mt.c:866
const lzma_index * index
Index being encoded.
Definition: index_encoder.c:30
uint64_t round_up_to_mib(uint64_t n)
Round an integer up to the next full MiB and convert to MiB.
Definition: util.c:139
uint32_t bufs_allocated
Number of buffers allocated.
Definition: outqueue.h:48
Common includes, definitions, and prototypes.
static void msg_suffix(const char *src_name, const char *suffix)
Definition: suffix.c:183
uint64_t lzma_memlimit_get(const lzma_stream *strm)
Get the current memory usage limit.
Definition: common.c:415
unsigned char lzma_bool
Boolean.
Definition: base.h:29
lzma_vli file_size
Compressed file size of the destination.
Definition: index.c:725
lzma_vli unpadded_size
Unpadded size of this Block.
Definition: index.h:188
Definition: lz_decoder.h:54
#define HEADERS_BOUND
Definition: block_buffer_encoder.c:28
lzma_ret lzma_index_stream_flags(lzma_index *i, const lzma_stream_flags *stream_flags) lzma_nothrow lzma_attr_warn_unused_result
Set the Stream Flags.
Definition: index.c:601
static bool no_warn
Definition: main.c:27
lzma_ret(* lzma_init_function)(lzma_next_coder *next, const lzma_allocator *allocator, const lzma_filter_info *filters)
Type of a function used to initialize a filter encoder or decoder.
Definition: common.h:97
uint32_t timeout
Timeout to allow lzma_code() to return early.
Definition: container.h:135
lzma_ret lzma_properties_encode(const lzma_filter *filter, uint8_t *props)
Encode the Filter Properties field.
Definition: filter_encoder.c:276
@ LZMA_OPTIONS_ERROR
Invalid or unsupported options.
Definition: base.h:160
uint64_t lzma_vli
Variable-length integer type.
Definition: vli.h:63
lzma_mf mf
History buffer and match finder.
Definition: lz_encoder.c:31
bool concatenated
Definition: stream_decoder.c:69
#define LZMA_PRESET_LEVEL_MASK
Mask for preset level.
Definition: container.h:40
Passing data to and from liblzma.
Definition: base.h:485
uint32_t version
Stream Flags format version.
Definition: stream_flags.h:51
bool this_finished
Definition: lz_decoder.c:40
const char * uint64_to_str(uint64_t value, uint32_t slot)
Convert uint64_t to a string.
Definition: util.c:171
bool io_write(file_pair *pair, const io_buf *buf, size_t size)
Writes a buffer to the destination file.
Definition: file_io.c:1275
struct lzma_index_s lzma_index
Opaque data type to hold the Index(es) and other information.
Definition: index.h:37
unsigned int arg_count
Number of filenames from command line.
Definition: args.h:18
lzma_outbuf * outbuf
Definition: stream_encoder_mt.c:65
lzma_lzma_state
Definition: lzma_common.h:56
static uint64_t expected_in_size
Definition: message.c:66
void signals_init(void)
Definition: signals.c:54
Structure to hold internal state of the check being calculated.
Definition: check.h:81
bool is_encoder
Definition: simple_private.h:30
#define LZMA_VLI_UNKNOWN
VLI value to denote that the value is unknown.
Definition: vli.h:39
static uint8_t dict_get(const lzma_dict *const dict, const uint32_t distance)
Get a byte from the history buffer.
Definition: lz_decoder.h:103
static bool has_dir_sep(const char *str)
Test if the string contains a directory separator.
Definition: suffix.c:42
void io_write_to_user_abort_pipe(void)
Write a byte to user_abort_pipe[1].
Definition: file_io.c:135
bool supported_actions[LZMA_ACTION_MAX+1]
Indicates which lzma_action values are allowed by next.code.
Definition: common.h:220
static bool parse_block_header(file_pair *pair, const lzma_index_iter *iter, block_header_info *bhi, xz_file_info *xfi)
Parse the Block Header.
Definition: list.c:406
index_tree streams
Definition: index.c:149
Definition: range_encoder.h:27
bool is_tty_stdout(void)
Test if stdout is a terminal.
Definition: util.c:289
void message_bug(void) lzma_attribute((__noreturn__))
Definition: message.c:789
void signals_unblock(void)
Unblock the signals blocked by signals_block().
Definition: signals.c:135
uint64_t lzma_index_memused(const lzma_index *i)
Calculate the memory usage of an existing lzma_index.
Definition: index.c:491
lzma_next_coder next
Stream decoder or LZMA_Alone decoder.
Definition: auto_decoder.c:19
@ LZMA_CHECK_CRC64
Definition: check.h:42
lzma_ret lzma_block_compressed_size(lzma_block *block, lzma_vli unpadded_size) lzma_nothrow lzma_attr_warn_unused_result
Validate and set Compressed Size according to Unpadded Size.
Definition: block_util.c:18
uint64_t total_in
Definition: base.h:488
void message_verbosity_decrease(void)
Decrease verbosity level by one step unless it was at minimum.
Definition: message.c:171
#define update_short_rep(state)
Indicate that the latest state was a short match.
Definition: lzma_common.h:96
lzma_bool lzma_lzma_preset(lzma_options_lzma *options, uint32_t preset) lzma_nothrow
Set a compression preset to lzma_options_lzma structure.
Definition: lzma_encoder_presets.c:18
lzma_ret lzma_stream_encoder(lzma_stream *strm, const lzma_filter *filters, lzma_check check)
Initialize .xz Stream encoder using a custom filter chain.
Definition: stream_encoder.c:328
bool finished
Definition: outqueue.h:32
bool opt_auto_adjust
Definition: coder.c:26
uint16_t probability
Type of probabilities used with range coder.
Definition: range_common.h:69
@ LZMA_SYNC_FLUSH
Make all the input available at output.
Definition: base.h:265
void lzma_outq_end(lzma_outq *outq, const lzma_allocator *allocator)
Free the memory associated with the output queue.
Definition: outqueue.c:101
void bool is_empty_filename(const char *filename)
Check if filename is empty and print an error message.
Definition: util.c:264
lzma_next_coder block_encoder
Block.
Definition: stream_encoder.c:33
lzma_ret thread_error
Error code from a worker thread.
Definition: stream_encoder_mt.c:143
lzma_mode mode
Definition: lzma12.h:322
#define LZMA_STREAM_FLAGS_SIZE
Size of the Stream Flags field.
Definition: stream_flags_common.h:19
lzma_vli compressed_size
Compressed Size calculated while decoding.
Definition: block_decoder.c:33
Definition: stream_encoder_mt.c:50
static lzma_vli index_size(lzma_vli count, lzma_vli index_list_size)
Calculate the size of the Index field including Index Padding.
Definition: index.h:57
lzma_bool lzma_filter_decoder_is_supported(lzma_vli id)
Test if the given Filter ID is supported for decoding.
Definition: filter_decoder.c:133
#define COMPRESSED_SIZE_MAX
Biggest Compressed Size value that the Block encoder supports.
Definition: block_encoder.h:40
lzma_ret lzma_easy_encoder(lzma_stream *strm, uint32_t preset, lzma_check check)
Initialize .xz Stream encoder using a preset number.
Definition: easy_encoder.c:17
void lzma_next_end(lzma_next_coder *next, const lzma_allocator *allocator)
Definition: common.c:145
size_t lzma_block_buffer_bound(size_t uncompressed_size) lzma_nothrow
Calculate maximum output size for single-call Block encoding.
Definition: block_buffer_encoder.c:74
void lzma_sha256_finish(lzma_check_state *check)
Finish the SHA-256 calculation and store the result to check->buffer.u8.
Definition: sha256.c:169
#define LZMA_VERSION
Compile-time version number.
Definition: version.h:57
lzma_ret lzma_index_append(lzma_index *i, const lzma_allocator *allocator, lzma_vli unpadded_size, lzma_vli uncompressed_size) lzma_nothrow lzma_attr_warn_unused_result
Add a new Block to lzma_index.
Definition: index.c:640
lzma_ret lzma_alone_decoder(lzma_stream *strm, uint64_t memlimit)
Initialize .lzma decoder (legacy file format)
Definition: alone_decoder.c:234
Probability price calculation.
lzma_vli id
Filter ID.
Definition: filter_common.c:18
Private definitions for LZMA encoder.
uint32_t rep1
Distance of second latest match.
Definition: lzma_decoder.c:229
void coder_run(const char *filename)
Compress or decompress the given file.
Definition: coder.c:869
void list_totals(void)
Show the totals after all files have been listed.
Definition: list.c:1121
void signals_init(void)
Definition: signals.c:54
void void void message_error(const char *fmt,...) lzma_attribute((__format__(__printf__
Prints an error message and sets exit status.
lzma_ret lzma_index_buffer_decode(lzma_index **i, uint64_t *memlimit, const lzma_allocator *allocator, const uint8_t *in, size_t *in_pos, size_t in_size)
Single-call .xz Index decoder.
Definition: index_decoder.c:309
void * lzma
LZMA encoder.
Definition: lzma2_encoder.c:30
void io_close(file_pair *pair, bool success)
Closes the file descriptors and frees possible allocated memory.
Definition: file_io.c:1052
static lzma_ret fill_window(lzma_coder *coder, const lzma_allocator *allocator, const uint8_t *in, size_t *in_pos, size_t in_size, lzma_action action)
Tries to fill the input window (mf->buffer)
Definition: lz_encoder.c:81
Output queue handling in multithreaded coding.
void hardware_memlimit_show(void)
Display the amount of RAM and memory usage limits and exit.
Definition: hardware.c:148
#define LZMA_CHECK_ID_MAX
Maximum valid Check ID.
Definition: check.h:68
void coder_free(void)
Free the memory allocated for the coder and kill the worker threads.
Definition: coder.c:939
probability is_match[STATES][POS_STATES_MAX]
If 1, it's a match. Otherwise it's a single 8-bit literal.
Definition: lzma_decoder.c:179
#define INDEX_GROUP_SIZE
How many Records to allocate at once.
Definition: index.c:21
uint8_t buffer[]
Temporary buffer.
Definition: simple_private.h:62
int src_fd
File descriptor of the source file.
Definition: file_io.h:44
static void parse_memlimit(const char *name, const char *name_percentage, char *str, bool set_compress, bool set_decompress)
Parse and set the memory usage limit for compression and/or decompression.
Definition: args.c:34
lzma_vli uncompressed_size
Uncompressed size of all the Blocks in the Stream(s)
Definition: index.c:152
Single-call .xz Block encoder.
void hardware_init(void)
Definition: hardware.c:169
void message_verbosity_decrease(void)
Decrease verbosity level by one step unless it was at minimum.
Definition: message.c:171
Definition: lz_decoder.h:20
lzma_vli count
Number of Records.
Definition: index_hash.c:26
lzma_check_state check
Check calculated from Unpadded Sizes and Uncompressed Sizes.
Definition: index_hash.c:32
lzma_vli uncompressed_size
Uncompressed Size currently being read from an Index Record.
Definition: index_hash.c:61
Handling of .xz Index and related information.
lzma_ret lzma_code(lzma_stream *strm, lzma_action action) lzma_nothrow lzma_attr_warn_unused_result
Encode or decode data.
Definition: common.c:197
uint8_t raw_check[LZMA_CHECK_SIZE_MAX]
Raw value stored in the Check field.
Definition: block.h:217
uint64_t lzma_easy_encoder_memusage(uint32_t preset)
Calculate approximate memory usage of easy encoder.
Definition: easy_encoder_memusage.c:17
static bool current_filename_printed
Definition: message.c:41
static lzma_filter filters[LZMA_FILTERS_MAX+1]
Filters needed for all encoding all formats, and also decoding in raw data.
Definition: coder.c:36
#define LZMA_VLI_C(n)
VLI constant suffix.
Definition: vli.h:49
enum operation_mode opt_mode
Definition: coder.c:24
Both lzma_filter_encoder and lzma_filter_decoder begin with these members.
Definition: filter_common.h:20
size_t read_pos
Position in the buffer in lzma_outq_read()
Definition: outqueue.h:58
uint32_t lzma_mf_find(lzma_mf *mf, uint32_t *count_ptr, lzma_match *matches)
Find matches starting from the current byte.
Definition: lz_encoder_mf.c:23
static uint64_t total_ram
Total amount of physical RAM.
Definition: hardware.c:27
void message_signal_handler(void)
Definition: message.c:796
uint32_t match_len_max
Definition: lz_encoder.h:114
int mytime_get_flush_timeout(void)
Get the number of milliseconds until the next flush.
Definition: mytime.c:74
uint32_t len
Definition: lzma_decoder.c:285
Private common stuff for Delta encoder and decoder.
static bool lzma_outq_has_buf(const lzma_outq *outq)
Test if there is at least one buffer free.
Definition: outqueue.h:145
Preset handling for easy encoder and decoder.
uint32_t read_pos
Definition: lz_encoder.h:63
bool need_dictionary_reset
Definition: lzma2_decoder.c:50
lzma_ret lzma_vli_decode(lzma_vli *vli, size_t *vli_pos, const uint8_t *in, size_t *in_pos, size_t in_size) lzma_nothrow
Decode a variable-length integer.
size_t pos
Position in the Check field.
Definition: block_encoder.c:40
static bool first_filename_printed
Definition: message.c:35
uint64_t opt_flush_timeout
Number of milliseconds to between LZMA_SYNC_FLUSHes.
Definition: mytime.c:19
lzma_init_function init
Definition: common.h:127
uint32_t lzma_check_size(lzma_check check) lzma_nothrow lzma_attr_const
Get the size of the Check field with the given Check ID.
Definition: check.c:64
lzma_vli lzma_block_total_size(const lzma_block *block) lzma_nothrow lzma_attr_pure
Calculate the total encoded size of a Block.
Definition: block_util.c:82
lzma_vli count
Number of Records left to decode.
Definition: index_decoder.c:40
bool lzma_lzma_lclppb_encode(const lzma_options_lzma *options, uint8_t *byte)
Encodes lc/lp/pb into one byte. Returns false on success and true on error.
Definition: lzma_encoder.c:645
static void parse_args(int argc, char **argv)
Parse command line options.
Definition: lzmainfo.c:58
uint64_t lzma_crc64(const uint8_t *buf, size_t size, uint64_t crc)
Calculate CRC64.
Definition: crc64_small.c:41
#define lzma_vli_is_valid(vli)
Validate a variable-length integer.
Definition: vli.h:75
worker_thread * threads
Array of allocated thread-specific structures.
Definition: stream_encoder_mt.c:146
uint64_t size
Size of the message excluding padding.
Definition: check.h:46
size_t before_size
Definition: lz_encoder.h:132
bool lzma_easy_preset(lzma_options_easy *opt_easy, uint32_t preset)
Definition: easy_preset.c:17
lzma_ret lzma_strm_init(lzma_stream *strm)
Definition: common.c:170
size_t allocated
Size of the memory allocated for the buffer.
Definition: simple_private.h:47
bool non_last_ok
Definition: filter_common.c:25
#define LZMA_PRESET_EXTREME
Extreme compression preset.
Definition: container.h:60
void signals_block(void)
Definition: signals.c:120
index_tree * streams
Destination index' Stream tree.
Definition: index.c:736
Information about a .xz file.
Definition: list.c:18
probability is_rep[STATES]
If 1, it's a repeated match. The distance is one of rep0 .. rep3.
Definition: lzma_decoder.c:182
uint64_t block_size
Maximum uncompressed size of a Block.
Definition: container.h:104
lzma_vli record_count
Total number of Records in all Streams in this lzma_index.
Definition: index.c:158
lzma_ret lzma_index_decoder(lzma_stream *strm, lzma_index **i, uint64_t memlimit)
Initialize .xz Index decoder.
Definition: index_decoder.c:297
lzma_ret lzma_code(lzma_stream *strm, lzma_action action)
Encode or decode data.
Definition: common.c:197
#define LZMA_FILTER_ARM
Definition: bcj.h:37
uint32_t lzma_vli_size(lzma_vli vli)
Get the number of bytes required to encode a VLI.
Definition: vli_size.c:17
static lzma_ret copy_or_code(lzma_simple_coder *coder, const lzma_allocator *allocator, const uint8_t *restrict in, size_t *restrict in_pos, size_t in_size, uint8_t *restrict out, size_t *restrict out_pos, size_t out_size, lzma_action action)
Copied or encodes/decodes more data to out[].
Definition: simple_coder.c:21
List information about .xz files.
size_t pos
Position in integers.
Definition: index_decoder.c:49
volatile sig_atomic_t user_abort
Definition: signals.c:16
#define header(is_bt, len_min, ret_op)
Definition: lz_encoder_mf.c:191
uint32_t pos_mask
(1 << pos_bits) - 1
Definition: lzma_encoder_private.h:102
uint32_t rep3
Distance of fourth latest match.
Definition: lzma_decoder.c:231
void message_filename(const char *src_name)
Set the name of the current file and possibly print it too.
Definition: message.c:232
lzma_ret(* code)(void *coder, lzma_mf *restrict mf, uint8_t *restrict out, size_t *restrict out_pos, size_t out_size)
Function to encode from *dict to out[].
Definition: lz_encoder.h:197
bool lzma_outq_is_readable(const lzma_outq *outq)
Test if there is data ready to be read.
Definition: outqueue.c:136
uint64_t progress_out
Definition: stream_encoder_mt.c:172
exit_status_type
Possible exit status values. These are the same as used by gzip and bzip2.
Definition: main.h:14
static bool is_lclppb_valid(const lzma_options_lzma *options)
Validates lc, lp, and pb.
Definition: lzma_common.h:33
void * simple
Definition: simple_private.h:39
uint32_t hardware_threads_get(void)
Get the maximum number of worker threads.
Definition: hardware.c:55
#define literal_subcoder(probs, lc, lp_mask, pos, prev_byte)
Definition: lzma_common.h:124
@ LZMA_MODE_NORMAL
Normal compression.
Definition: lzma12.h:147
lzma_ret lzma_raw_buffer_decode(const lzma_filter *filters, const lzma_allocator *allocator, const uint8_t *in, size_t *in_pos, size_t in_size, uint8_t *out, size_t *out_pos, size_t out_size) lzma_nothrow
Single-call raw decoder.
Definition: filter_buffer_decoder.c:17
lzma_filter filters[LZMA_FILTERS_MAX+1]
The filter chain currently in use.
Definition: stream_encoder.c:39
lzma_check lzma_get_check(const lzma_stream *strm)
Get the type of the integrity check.
Definition: common.c:386
@ V_SILENT
No messages.
Definition: message.h:15
uint32_t preset
Compression preset (level and possible flags)
Definition: container.h:143
Definition: index_decoder.c:17
#define LZMA_FILTER_X86
Definition: bcj.h:22
size_t in_size
Definition: stream_encoder_mt.c:60
static bool parse_indexes(xz_file_info *xfi, file_pair *pair)
Parse the Index(es) from the given .xz file.
Definition: list.c:150
lzma_match_finder match_finder
Type of the match finder to use.
Definition: lz_encoder.h:151
lzma_ret lzma_outq_read(lzma_outq *restrict outq, uint8_t *restrict out, size_t *restrict out_pos, size_t out_size, lzma_vli *restrict unpadded_size, lzma_vli *restrict uncompressed_size)
Read finished data.
Definition: outqueue.c:147
uint8_t * bufs_mem
Memory allocated for all the buffers.
Definition: outqueue.h:42
#define LZMA_MEMUSAGE_BASE
Definition: common.h:63
lzma_vli lzma_block_unpadded_size(const lzma_block *block)
Calculate Unpadded Size.
Definition: block_util.c:46
#define STATES
Total number of states.
Definition: lzma_common.h:73
void my_snprintf(char **pos, size_t *left, const char *fmt,...) lzma_attribute((__format__(__printf__
Wrapper for snprintf() to help constructing a string in pieces.
lzma_stream_flags stream_flags
Stream Flags from Stream Header.
Definition: stream_decoder.c:37
Definition: stream_decoder.c:17
int tuklib_mbstr_fw(const char *str, int columns_min)
Get the field width for printf() e.g. to align table columns.
Definition: tuklib_mbstr_fw.c:17
lzma_ret lzma_outq_init(lzma_outq *outq, const lzma_allocator *allocator, uint64_t buf_size_max, uint32_t threads)
Initialize an output queue.
Definition: outqueue.c:57
bool is_tty_stdout(void)
Test if stdout is a terminal.
Definition: util.c:289
index_record records[]
Definition: index.c:102
void lzma_index_iter_rewind(lzma_index_iter *iter)
Rewind the iterator.
Definition: index.c:1092
#define LZMA_FILTER_DELTA
Filter ID.
Definition: delta.h:25
Iterator to get information about Blocks and Streams.
Definition: index.h:43
Properties decoder for simple filters.
void message_try_help(void)
Print a message that user should try –help.
Definition: message.c:1063
lzma_ret lzma_strm_init(lzma_stream *strm)
Definition: common.c:170
lzma_ret lzma_raw_buffer_decode(const lzma_filter *filters, const lzma_allocator *allocator, const uint8_t *in, size_t *in_pos, size_t in_size, uint8_t *out, size_t *out_pos, size_t out_size)
Single-call raw decoder.
Definition: filter_buffer_decoder.c:17
static const char * progress_speed(uint64_t uncompressed_pos, uint64_t elapsed)
Make the string containing the processing speed of uncompressed data.
Definition: message.c:351
void hardware_memlimit_show(void) lzma_attribute((__noreturn__))
Display the amount of RAM and memory usage limits and exit.
Definition: hardware.c:148
void * lzma_alloc(size_t size, const lzma_allocator *allocator) lzma_attribute((__malloc__)) lzma_attr_alloc_size(1)
Allocates memory.
uintptr_t init
Definition: common.h:147
void io_fix_src_pos(file_pair *pair, size_t rewind_size)
Fix the position in src_fd.
Definition: file_io.c:1101
static bool check_default
This becomes false if the –check=CHECK option is used.
Definition: coder.c:52
lzma_vli compressed_limit
Definition: block_decoder.c:41
Miscellaneous utility functions.
bool last_ok
Definition: filter_common.c:29
lzma_ret lzma_index_buffer_decode(lzma_index **i, uint64_t *memlimit, const lzma_allocator *allocator, const uint8_t *in, size_t *in_pos, size_t in_size) lzma_nothrow
Single-call .xz Index decoder.
Definition: index_decoder.c:309
lzma_vli lzma_index_block_count(const lzma_index *i) lzma_nothrow lzma_attr_pure
Get the number of Blocks.
Definition: index.c:498
bool block_encoder_is_initialized
Definition: stream_encoder.c:30
bool all_have_sizes
Definition: list.c:30
uint32_t pending
Definition: lz_encoder.h:84
@ LZMA_BUF_ERROR
No progress is possible.
Definition: base.h:191
static char check_value[2 *LZMA_CHECK_SIZE_MAX+1]
Definition: list.c:95
bool next_finished
True if the next filter in the chain has returned LZMA_STREAM_END.
Definition: lz_decoder.c:36
#define FILTERS_STR_SIZE
Buffer size for message_filters_to_str()
Definition: message.h:94
void message_progress_start(lzma_stream *strm, bool is_passthru, uint64_t in_size)
Start progress info handling.
Definition: message.c:249
void message_progress_update(void)
Definition: message.c:545
lzma_ret lzma_easy_buffer_encode(uint32_t preset, lzma_check check, const lzma_allocator *allocator, const uint8_t *in, size_t in_size, uint8_t *out, size_t *out_pos, size_t out_size)
Single-call .xz Stream encoding using a preset number.
Definition: easy_buffer_encoder.c:17
void message_progress_end(bool success)
Finishes the progress message if we were in verbose mode.
Definition: message.c:707
void mytime_set_start_time(void)
Store the time when (de)compression was started.
Definition: mytime.c:51
uint32_t lzma_crc32_table[1][256]
Definition: crc32_small.c:16
const uint32_t lzma_crc32_table[8][256]
Definition: crc32_small.c:16
void message_verbosity_increase(void)
Increase verbosity level by one step unless it was at maximum.
Definition: message.c:161
static void check_thousand_sep(uint32_t slot)
Definition: util.c:156
int dest_fd
File descriptor of the target file.
Definition: file_io.h:47
void message_mem_needed(enum message_verbosity v, uint64_t memusage)
Display how much memory was needed and how much the limit was.
Definition: message.c:846
static index_stream * index_dup_stream(const index_stream *src, const lzma_allocator *allocator)
Duplicate an index_stream.
Definition: index.c:865
#define BUF_SIZE_MAX
Definition: outqueue.c:19
file_pair * io_open_src(const char *src_name)
Open the source file.
Definition: file_io.c:741
void coder_free(void)
Free the memory allocated for the coder and kill the worker threads.
Definition: coder.c:939
void list_file(const char *filename)
List information about the given .xz file.
Definition: list.c:1143
enum lzma_lzma1_decoder::@22 sequence
Position where to continue the decoder loop.
void message_filters_to_str(char buf[FILTERS_STR_SIZE], const lzma_filter *filters, bool all_known)
Get the filter chain as a string.
Definition: message.c:917
lzma_ret lzma_stream_header_encode(const lzma_stream_flags *options, uint8_t *out) lzma_nothrow lzma_attr_warn_unused_result
Encode Stream Header.
Definition: stream_flags_encoder.c:30
void lzma_check_init(lzma_check_state *check, lzma_check type)
Initialize *check depending on type.
Definition: check.c:84
#define RC_SYMBOLS_MAX
Definition: range_encoder.h:24
Compresses or uncompresses a file.
uint32_t checks
Definition: index.c:177
lzma_bool lzma_mode_is_supported(lzma_mode mode)
Test if given compression mode is supported.
Definition: lzma_encoder.c:674
lzma_vli lzma_index_total_size(const lzma_index *i)
Get the total size of the Blocks.
Definition: index.c:519
static const char * get_ratio(uint64_t compressed_size, uint64_t uncompressed_size)
Get the compression ratio.
Definition: list.c:611
lzma_vli backward_size
Backward Size.
Definition: stream_flags.h:69
lzma_check_state check
Check of the uncompressed data.
Definition: block_decoder.c:47
#define LZMA_FILTER_POWERPC
Definition: bcj.h:27
Variable-length integer handling.
Options for the Block and Block Header encoders and decoders.
Definition: block.h:30
void * coder
Data specific to the LZ-based encoder.
Definition: lz_encoder.h:194
static index_stream * index_stream_init(lzma_vli compressed_base, lzma_vli uncompressed_base, uint32_t stream_number, lzma_vli block_number_base, const lzma_allocator *allocator)
Allocate and initialize a new Stream using the given base offsets.
Definition: index.c:340
static enum message_verbosity verbosity
Verbosity level.
Definition: message.c:25
lzma_bool lzma_filter_encoder_is_supported(lzma_vli id) lzma_nothrow lzma_attr_const
Test if the given Filter ID is supported for encoding.
Definition: filter_encoder.c:165
lzma_ret(* code)(void *coder, lzma_dict *restrict dict, const uint8_t *restrict in, size_t *restrict in_pos, size_t in_size)
Function to decode from in[] to *dict.
Definition: lz_decoder.h:59
lzma_match_finder mf
Definition: lzma12.h:345
lzma_index * idx
Combined Index of all Streams in the file.
Definition: list.c:20
void mytime_set_flush_time(void)
Store the time of when compressor was flushed.
Definition: mytime.c:66
#define tuklib_physmem
Get the amount of physical memory in bytes.
Definition: tuklib_physmem.h:19
lzma_bool lzma_index_iter_next(lzma_index_iter *iter, lzma_index_iter_mode mode)
Get the next Block or Stream.
Definition: index.c:1103
void message(enum message_verbosity verbosity, const char *fmt,...) lzma_attribute((__format__(__printf__
Print a message if verbosity level is at least "verbosity".
static uint32_t mf_unencoded(const lzma_mf *mf)
Definition: lz_encoder.h:238
lzma_outbuf * bufs
Array of buffers that are used cyclically.
Definition: outqueue.h:39
size_t lzma_block_buffer_bound(size_t uncompressed_size)
Calculate maximum output size for single-call Block encoding.
Definition: block_buffer_encoder.c:74
bool ignore_check
True if the integrity check won't be calculated and verified.
Definition: block_decoder.c:50
static void memlimit_show(const char *str, uint64_t value)
Helper for hardware_memlimit_show() to print one human-readable info line.
Definition: hardware.c:131
bool io_pread(file_pair *pair, io_buf *buf, size_t size, off_t pos)
Read from source file from given offset to a buffer.
Definition: file_io.c:1186
static void print_filename(void)
Definition: message.c:200
static bool progress_needs_updating
Definition: message.c:105
coder_init_ret
Return value type for coder_init().
Definition: coder.c:17
lzma_bool lzma_lzma_preset(lzma_options_lzma *options, uint32_t preset)
Set a compression preset to lzma_options_lzma structure.
Definition: lzma_encoder_presets.c:18
@ LZMA_NO_CHECK
Input stream has no integrity check.
Definition: base.h:75
lzma_check check
Check ID.
Definition: stream_flags.h:79
Common includes, definitions, system-specific things etc.
lzma_index_hash_info blocks
Information collected while decoding the actual Blocks.
Definition: index_hash.c:49
lzma_dict dict
Dictionary (history buffer)
Definition: lz_decoder.c:25
static void index_cat_helper(const index_cat_info *info, index_stream *this)
Definition: index.c:745
Definition: filter_encoder.c:21
lzma_vli id
Definition: common.h:123
uint64_t opt_block_size
Definition: coder.c:28
uint32_t hardware_threads_get(void)
Get the maximum number of worker threads.
Definition: hardware.c:55
#define LZMA_VLI_BYTES_MAX
Maximum supported encoded length of variable length integers.
Definition: vli.h:44
lzma_ret lzma_index_hash_decode(lzma_index_hash *index_hash, const uint8_t *in, size_t *in_pos, size_t in_size) lzma_nothrow lzma_attr_warn_unused_result
Decode and validate the Index field.
Definition: index_hash.c:175
lzma_index * lzma_index_dup(const lzma_index *i, const lzma_allocator *allocator) lzma_nothrow lzma_attr_warn_unused_result
Duplicate lzma_index.
Definition: index.c:926
Definition: lzma_encoder_private.h:71
#define rc_bit_last(prob, action0, action1, seq)
Definition: range_decoder.h:140
lzma_range_encoder rc
Range encoder.
Definition: lzma_encoder_private.h:73
uint64_t memusage
Amount of memory actually needed (only an estimate)
Definition: alone_decoder.c:44
#define LZMA_TELL_ANY_CHECK
Definition: container.h:474
void lzma_index_end(lzma_index *i, const lzma_allocator *allocator)
Deallocate lzma_index.
Definition: index.c:417
@ LZMA_DATA_ERROR
Data is corrupt.
Definition: base.h:172