Rizin
unix-like reverse engineering framework and cli tools
block_buffer_encoder.h File Reference

Single-call .xz Block encoder. More...

#include "common.h"

Go to the source code of this file.

Functions

uint64_t lzma_block_buffer_bound64 (uint64_t uncompressed_size)
 

Detailed Description

Single-call .xz Block encoder.

Definition in file block_buffer_encoder.h.

Function Documentation

◆ lzma_block_buffer_bound64()

uint64_t lzma_block_buffer_bound64 ( uint64_t  uncompressed_size)

uint64_t version of lzma_block_buffer_bound(). It is used by stream_encoder_mt.c. Probably the original lzma_block_buffer_bound() should have been 64-bit, but fixing it would break the ABI.

Definition at line 56 of file block_buffer_encoder.c.

57 {
58  // If the data doesn't compress, we always use uncompressed
59  // LZMA2 chunks.
61  if (lzma2_size == 0)
62  return 0;
63 
64  // Take Block Padding into account.
65  lzma2_size = (lzma2_size + 3) & ~UINT64_C(3);
66 
67  // No risk of integer overflow because lzma2_bound() already takes
68  // into account the size of the headers in the Block.
69  return HEADERS_BOUND + lzma2_size;
70 }
static uint64_t lzma2_bound(uint64_t uncompressed_size)
#define HEADERS_BOUND
unsigned long uint64_t
Definition: sftypes.h:28
#define UINT64_C(val)
uint64_t uncompressed_size
Definition: list.c:106

References HEADERS_BOUND, lzma2_bound(), UINT64_C, and uncompressed_size.

Referenced by get_options(), and LZMA_API().