VirtualBox

source: vbox/trunk/src/libs/liblzma-5.8.1/common/block_encoder.h@ 108911

Last change on this file since 108911 was 108911, checked in by vboxsync, 4 weeks ago

libs/liblzma: Applied and adjusted our liblzma changes to 5.8.1 and export to OSE. jiraref:VBP-1635

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
  • Property sync-process set to export
File size: 1.8 KB
Line 
1// SPDX-License-Identifier: 0BSD
2
3///////////////////////////////////////////////////////////////////////////////
4//
5/// \file block_encoder.h
6/// \brief Encodes .xz Blocks
7//
8// Author: Lasse Collin
9//
10///////////////////////////////////////////////////////////////////////////////
11
12#ifndef LZMA_BLOCK_ENCODER_H
13#define LZMA_BLOCK_ENCODER_H
14
15#include "common.h"
16
17
18/// \brief Biggest Compressed Size value that the Block encoder supports
19///
20/// The maximum size of a single Block is limited by the maximum size of
21/// a Stream, which in theory is 2^63 - 3 bytes (i.e. LZMA_VLI_MAX - 3).
22/// While the size is really big and no one should hit it in practice, we
23/// take it into account in some places anyway to catch some errors e.g. if
24/// application passes insanely big value to some function.
25///
26/// We could take into account the headers etc. to determine the exact
27/// maximum size of the Compressed Data field, but the complexity would give
28/// us nothing useful. Instead, limit the size of Compressed Data so that
29/// even with biggest possible Block Header and Check fields the total
30/// encoded size of the Block stays as a valid VLI. This doesn't guarantee
31/// that the size of the Stream doesn't grow too big, but that problem is
32/// taken care outside the Block handling code.
33///
34/// ~LZMA_VLI_C(3) is to guarantee that if we need padding at the end of
35/// the Compressed Data field, it will still stay in the proper limit.
36///
37/// This constant is in this file because it is needed in both
38/// block_encoder.c and block_buffer_encoder.c.
39#define COMPRESSED_SIZE_MAX ((LZMA_VLI_MAX - LZMA_BLOCK_HEADER_SIZE_MAX \
40 - LZMA_CHECK_SIZE_MAX) & ~LZMA_VLI_C(3))
41
42
43extern lzma_ret lzma_block_encoder_init(lzma_next_coder *next,
44 const lzma_allocator *allocator, lzma_block *block);
45
46#endif
Note: See TracBrowser for help on using the repository browser.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette