diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 03:10:08 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 03:10:08 +0000 |
commit | 5262a872f308b3b584c97d621992fb3877e392b8 (patch) | |
tree | b956c322376141abeafe639bd72cfecdf16954b5 /doc/api/vli_8h.html | |
parent | Initial commit. (diff) | |
download | xz-utils-5262a872f308b3b584c97d621992fb3877e392b8.tar.xz xz-utils-5262a872f308b3b584c97d621992fb3877e392b8.zip |
Adding upstream version 5.6.1+really5.4.5.upstream/5.6.1+really5.4.5
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'doc/api/vli_8h.html')
-rw-r--r-- | doc/api/vli_8h.html | 323 |
1 files changed, 323 insertions, 0 deletions
diff --git a/doc/api/vli_8h.html b/doc/api/vli_8h.html new file mode 100644 index 0000000..4e3da1f --- /dev/null +++ b/doc/api/vli_8h.html @@ -0,0 +1,323 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml" lang="en-US"> +<head> +<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/> +<meta http-equiv="X-UA-Compatible" content="IE=11"/> +<meta name="generator" content="Doxygen 1.9.7"/> +<meta name="viewport" content="width=device-width, initial-scale=1"/> +<title>liblzma (XZ Utils): lzma/vli.h File Reference</title> +<link href="tabs.css" rel="stylesheet" type="text/css"/> + + +<link href="doxygen.css" rel="stylesheet" type="text/css" /> +</head> +<body> +<div id="top"><!-- do not remove this div, it is closed by doxygen! --> +<div id="titlearea"> +<table cellspacing="0" cellpadding="0"> + <tbody> + <tr id="projectrow"> + <td id="projectalign"> + <div id="projectname">liblzma (XZ Utils)<span id="projectnumber"> 5.4.5</span> + </div> + </td> + </tr> + </tbody> +</table> +</div> +<!-- end header part --> +<!-- Generated by Doxygen 1.9.7 --> + <div id="navrow1" class="tabs"> + <ul class="tablist"> + <li><a href="index.html"><span>Main Page</span></a></li> + <li><a href="annotated.html"><span>Data Structures</span></a></li> + <li class="current"><a href="files.html"><span>Files</span></a></li> + </ul> + </div> + <div id="navrow2" class="tabs2"> + <ul class="tablist"> + <li><a href="files.html"><span>File List</span></a></li> + <li><a href="globals.html"><span>Globals</span></a></li> + </ul> + </div> +<div id="nav-path" class="navpath"> + <ul> +<li class="navelem"><a class="el" href="dir_b17a1d403082bd69a703ed987cf158fb.html">lzma</a></li> </ul> +</div> +</div><!-- top --> +<div class="header"> + <div class="summary"> +<a href="#define-members">Macros</a> | +<a href="#typedef-members">Typedefs</a> | +<a href="#func-members">Functions</a> </div> + <div class="headertitle"><div class="title">vli.h File Reference</div></div> +</div><!--header--> +<div class="contents"> + +<p>Variable-length integer handling. +<a href="#details">More...</a></p> +<table class="memberdecls"> +<tr class="heading"><td colspan="2"><h2 class="groupheader"><a id="define-members" name="define-members"></a> +Macros</h2></td></tr> +<tr class="memitem:a7b782528bd1934db7c020adbedb20ec9"><td class="memItemLeft" align="right" valign="top"><a id="a7b782528bd1934db7c020adbedb20ec9" name="a7b782528bd1934db7c020adbedb20ec9"></a> +#define </td><td class="memItemRight" valign="bottom"><b>LZMA_VLI_MAX</b>   (UINT64_MAX / 2)</td></tr> +<tr class="memdesc:a7b782528bd1934db7c020adbedb20ec9"><td class="mdescLeft"> </td><td class="mdescRight">Maximum supported value of a variable-length integer. <br /></td></tr> +<tr class="separator:a7b782528bd1934db7c020adbedb20ec9"><td class="memSeparator" colspan="2"> </td></tr> +<tr class="memitem:a5a4b28254a30c859018b896ed371d69a"><td class="memItemLeft" align="right" valign="top"><a id="a5a4b28254a30c859018b896ed371d69a" name="a5a4b28254a30c859018b896ed371d69a"></a> +#define </td><td class="memItemRight" valign="bottom"><b>LZMA_VLI_UNKNOWN</b>   UINT64_MAX</td></tr> +<tr class="memdesc:a5a4b28254a30c859018b896ed371d69a"><td class="mdescLeft"> </td><td class="mdescRight">VLI value to denote that the value is unknown. <br /></td></tr> +<tr class="separator:a5a4b28254a30c859018b896ed371d69a"><td class="memSeparator" colspan="2"> </td></tr> +<tr class="memitem:a063ecff4133aa2f8899b9fa3fdefd310"><td class="memItemLeft" align="right" valign="top"><a id="a063ecff4133aa2f8899b9fa3fdefd310" name="a063ecff4133aa2f8899b9fa3fdefd310"></a> +#define </td><td class="memItemRight" valign="bottom"><b>LZMA_VLI_BYTES_MAX</b>   9</td></tr> +<tr class="memdesc:a063ecff4133aa2f8899b9fa3fdefd310"><td class="mdescLeft"> </td><td class="mdescRight">Maximum supported encoded length of variable length integers. <br /></td></tr> +<tr class="separator:a063ecff4133aa2f8899b9fa3fdefd310"><td class="memSeparator" colspan="2"> </td></tr> +<tr class="memitem:a2d8bf5322898bfa11945848420585881"><td class="memItemLeft" align="right" valign="top"><a id="a2d8bf5322898bfa11945848420585881" name="a2d8bf5322898bfa11945848420585881"></a> +#define </td><td class="memItemRight" valign="bottom"><b>LZMA_VLI_C</b>(n)   UINT64_C(n)</td></tr> +<tr class="memdesc:a2d8bf5322898bfa11945848420585881"><td class="mdescLeft"> </td><td class="mdescRight">VLI constant suffix. <br /></td></tr> +<tr class="separator:a2d8bf5322898bfa11945848420585881"><td class="memSeparator" colspan="2"> </td></tr> +<tr class="memitem:a4f67ed698215d865a2b87a95ab1320dd"><td class="memItemLeft" align="right" valign="top">#define </td><td class="memItemRight" valign="bottom"><a class="el" href="vli_8h.html#a4f67ed698215d865a2b87a95ab1320dd">lzma_vli_is_valid</a>(vli)    ((vli) <= <a class="el" href="vli_8h.html#a7b782528bd1934db7c020adbedb20ec9">LZMA_VLI_MAX</a> || (vli) == <a class="el" href="vli_8h.html#a5a4b28254a30c859018b896ed371d69a">LZMA_VLI_UNKNOWN</a>)</td></tr> +<tr class="memdesc:a4f67ed698215d865a2b87a95ab1320dd"><td class="mdescLeft"> </td><td class="mdescRight">Validate a variable-length integer. <br /></td></tr> +<tr class="separator:a4f67ed698215d865a2b87a95ab1320dd"><td class="memSeparator" colspan="2"> </td></tr> +</table><table class="memberdecls"> +<tr class="heading"><td colspan="2"><h2 class="groupheader"><a id="typedef-members" name="typedef-members"></a> +Typedefs</h2></td></tr> +<tr class="memitem:a1dbc0ffc3e72748f64df8f7f71898272"><td class="memItemLeft" align="right" valign="top">typedef uint64_t </td><td class="memItemRight" valign="bottom"><a class="el" href="vli_8h.html#a1dbc0ffc3e72748f64df8f7f71898272">lzma_vli</a></td></tr> +<tr class="memdesc:a1dbc0ffc3e72748f64df8f7f71898272"><td class="mdescLeft"> </td><td class="mdescRight">Variable-length integer type. <br /></td></tr> +<tr class="separator:a1dbc0ffc3e72748f64df8f7f71898272"><td class="memSeparator" colspan="2"> </td></tr> +</table><table class="memberdecls"> +<tr class="heading"><td colspan="2"><h2 class="groupheader"><a id="func-members" name="func-members"></a> +Functions</h2></td></tr> +<tr class="memitem:a50bbb77e9ec3b72c25586aa700c20970"><td class="memItemLeft" align="right" valign="top"><a class="el" href="base_8h.html#a8494e0457e1463d6d2b6836018d87b6e">lzma_ret</a> </td><td class="memItemRight" valign="bottom"><a class="el" href="vli_8h.html#a50bbb77e9ec3b72c25586aa700c20970">lzma_vli_encode</a> (<a class="el" href="vli_8h.html#a1dbc0ffc3e72748f64df8f7f71898272">lzma_vli</a> vli, size_t *vli_pos, uint8_t *out, size_t *out_pos, size_t out_size) lzma_nothrow</td></tr> +<tr class="memdesc:a50bbb77e9ec3b72c25586aa700c20970"><td class="mdescLeft"> </td><td class="mdescRight">Encode a variable-length integer. <br /></td></tr> +<tr class="separator:a50bbb77e9ec3b72c25586aa700c20970"><td class="memSeparator" colspan="2"> </td></tr> +<tr class="memitem:a7b7d50e1074e0e2bcd81c29a5f7461c7"><td class="memItemLeft" align="right" valign="top"><a class="el" href="base_8h.html#a8494e0457e1463d6d2b6836018d87b6e">lzma_ret</a> </td><td class="memItemRight" valign="bottom"><a class="el" href="vli_8h.html#a7b7d50e1074e0e2bcd81c29a5f7461c7">lzma_vli_decode</a> (<a class="el" href="vli_8h.html#a1dbc0ffc3e72748f64df8f7f71898272">lzma_vli</a> *vli, size_t *vli_pos, const uint8_t *in, size_t *in_pos, size_t in_size) lzma_nothrow</td></tr> +<tr class="memdesc:a7b7d50e1074e0e2bcd81c29a5f7461c7"><td class="mdescLeft"> </td><td class="mdescRight">Decode a variable-length integer. <br /></td></tr> +<tr class="separator:a7b7d50e1074e0e2bcd81c29a5f7461c7"><td class="memSeparator" colspan="2"> </td></tr> +<tr class="memitem:a8d53e0b69934b43da8721fa6f1e8cc4f"><td class="memItemLeft" align="right" valign="top">uint32_t </td><td class="memItemRight" valign="bottom"><a class="el" href="vli_8h.html#a8d53e0b69934b43da8721fa6f1e8cc4f">lzma_vli_size</a> (<a class="el" href="vli_8h.html#a1dbc0ffc3e72748f64df8f7f71898272">lzma_vli</a> vli) lzma_nothrow lzma_attr_pure</td></tr> +<tr class="memdesc:a8d53e0b69934b43da8721fa6f1e8cc4f"><td class="mdescLeft"> </td><td class="mdescRight">Get the number of bytes required to encode a VLI. <br /></td></tr> +<tr class="separator:a8d53e0b69934b43da8721fa6f1e8cc4f"><td class="memSeparator" colspan="2"> </td></tr> +</table> +<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2> +<div class="textblock"><p>Variable-length integer handling. </p> +<dl class="section note"><dt>Note</dt><dd>Never include this file directly. Use <<a class="el" href="lzma_8h.html" title="The public API of liblzma data compression library.">lzma.h</a>> instead.</dd></dl> +<p>In the .xz format, most integers are encoded in a variable-length representation, which is sometimes called little endian base-128 encoding. This saves space when smaller values are more likely than bigger values.</p> +<p>The encoding scheme encodes seven bits to every byte, using minimum number of bytes required to represent the given value. Encodings that use non-minimum number of bytes are invalid, thus every integer has exactly one encoded representation. The maximum number of bits in a VLI is 63, thus the vli argument must be less than or equal to UINT64_MAX / 2. You should use LZMA_VLI_MAX for clarity. </p> +</div><h2 class="groupheader">Macro Definition Documentation</h2> +<a id="a4f67ed698215d865a2b87a95ab1320dd" name="a4f67ed698215d865a2b87a95ab1320dd"></a> +<h2 class="memtitle"><span class="permalink"><a href="#a4f67ed698215d865a2b87a95ab1320dd">◆ </a></span>lzma_vli_is_valid</h2> + +<div class="memitem"> +<div class="memproto"> + <table class="memname"> + <tr> + <td class="memname">#define lzma_vli_is_valid</td> + <td>(</td> + <td class="paramtype"> </td> + <td class="paramname">vli</td><td>)</td> + <td>    ((vli) <= <a class="el" href="vli_8h.html#a7b782528bd1934db7c020adbedb20ec9">LZMA_VLI_MAX</a> || (vli) == <a class="el" href="vli_8h.html#a5a4b28254a30c859018b896ed371d69a">LZMA_VLI_UNKNOWN</a>)</td> + </tr> + </table> +</div><div class="memdoc"> + +<p>Validate a variable-length integer. </p> +<p>This is useful to test that application has given acceptable values for example in the uncompressed_size and compressed_size variables.</p> +<dl class="section return"><dt>Returns</dt><dd>True if the integer is representable as VLI or if it indicates unknown value. False if the integer cannot be represented as VLI. </dd></dl> + +</div> +</div> +<h2 class="groupheader">Typedef Documentation</h2> +<a id="a1dbc0ffc3e72748f64df8f7f71898272" name="a1dbc0ffc3e72748f64df8f7f71898272"></a> +<h2 class="memtitle"><span class="permalink"><a href="#a1dbc0ffc3e72748f64df8f7f71898272">◆ </a></span>lzma_vli</h2> + +<div class="memitem"> +<div class="memproto"> + <table class="memname"> + <tr> + <td class="memname">typedef uint64_t <a class="el" href="vli_8h.html#a1dbc0ffc3e72748f64df8f7f71898272">lzma_vli</a></td> + </tr> + </table> +</div><div class="memdoc"> + +<p>Variable-length integer type. </p> +<p>Valid VLI values are in the range [0, LZMA_VLI_MAX]. Unknown value is indicated with LZMA_VLI_UNKNOWN, which is the maximum value of the underlying integer type.</p> +<p>lzma_vli will be uint64_t for the foreseeable future. If a bigger size is needed in the future, it is guaranteed that 2 * LZMA_VLI_MAX will not overflow lzma_vli. This simplifies integer overflow detection. </p> + +</div> +</div> +<h2 class="groupheader">Function Documentation</h2> +<a id="a50bbb77e9ec3b72c25586aa700c20970" name="a50bbb77e9ec3b72c25586aa700c20970"></a> +<h2 class="memtitle"><span class="permalink"><a href="#a50bbb77e9ec3b72c25586aa700c20970">◆ </a></span>lzma_vli_encode()</h2> + +<div class="memitem"> +<div class="memproto"> + <table class="memname"> + <tr> + <td class="memname"><a class="el" href="base_8h.html#a8494e0457e1463d6d2b6836018d87b6e">lzma_ret</a> lzma_vli_encode </td> + <td>(</td> + <td class="paramtype"><a class="el" href="vli_8h.html#a1dbc0ffc3e72748f64df8f7f71898272">lzma_vli</a> </td> + <td class="paramname"><em>vli</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">size_t * </td> + <td class="paramname"><em>vli_pos</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">uint8_t * </td> + <td class="paramname"><em>out</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">size_t * </td> + <td class="paramname"><em>out_pos</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">size_t </td> + <td class="paramname"><em>out_size</em> </td> + </tr> + <tr> + <td></td> + <td>)</td> + <td></td><td></td> + </tr> + </table> +</div><div class="memdoc"> + +<p>Encode a variable-length integer. </p> +<p>This function has two modes: single-call and multi-call. Single-call mode encodes the whole integer at once; it is an error if the output buffer is too small. Multi-call mode saves the position in *vli_pos, and thus it is possible to continue encoding if the buffer becomes full before the whole integer has been encoded.</p> +<dl class="params"><dt>Parameters</dt><dd> + <table class="params"> + <tr><td class="paramdir"></td><td class="paramname">vli</td><td>Integer to be encoded </td></tr> + <tr><td class="paramdir">[out]</td><td class="paramname">vli_pos</td><td>How many VLI-encoded bytes have already been written out. When starting to encode a new integer in multi-call mode, *vli_pos must be set to zero. To use single-call encoding, set vli_pos to NULL. </td></tr> + <tr><td class="paramdir">[out]</td><td class="paramname">out</td><td>Beginning of the output buffer </td></tr> + <tr><td class="paramdir">[out]</td><td class="paramname">out_pos</td><td>The next byte will be written to out[*out_pos]. </td></tr> + <tr><td class="paramdir"></td><td class="paramname">out_size</td><td>Size of the out buffer; the first byte into which no data is written to is out[out_size].</td></tr> + </table> + </dd> +</dl> +<dl class="section return"><dt>Returns</dt><dd>Slightly different return values are used in multi-call and single-call modes.</dd></dl> +<p>Single-call (vli_pos == NULL):</p><ul> +<li>LZMA_OK: Integer successfully encoded.</li> +<li>LZMA_PROG_ERROR: Arguments are not sane. This can be due to too little output space; single-call mode doesn't use LZMA_BUF_ERROR, since the application should have checked the encoded size with <a class="el" href="vli_8h.html#a8d53e0b69934b43da8721fa6f1e8cc4f" title="Get the number of bytes required to encode a VLI.">lzma_vli_size()</a>.</li> +</ul> +<p>Multi-call (vli_pos != NULL):</p><ul> +<li>LZMA_OK: So far all OK, but the integer is not completely written out yet.</li> +<li>LZMA_STREAM_END: Integer successfully encoded.</li> +<li>LZMA_BUF_ERROR: No output space was provided.</li> +<li>LZMA_PROG_ERROR: Arguments are not sane. </li> +</ul> + +</div> +</div> +<a id="a7b7d50e1074e0e2bcd81c29a5f7461c7" name="a7b7d50e1074e0e2bcd81c29a5f7461c7"></a> +<h2 class="memtitle"><span class="permalink"><a href="#a7b7d50e1074e0e2bcd81c29a5f7461c7">◆ </a></span>lzma_vli_decode()</h2> + +<div class="memitem"> +<div class="memproto"> + <table class="memname"> + <tr> + <td class="memname"><a class="el" href="base_8h.html#a8494e0457e1463d6d2b6836018d87b6e">lzma_ret</a> lzma_vli_decode </td> + <td>(</td> + <td class="paramtype"><a class="el" href="vli_8h.html#a1dbc0ffc3e72748f64df8f7f71898272">lzma_vli</a> * </td> + <td class="paramname"><em>vli</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">size_t * </td> + <td class="paramname"><em>vli_pos</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">const uint8_t * </td> + <td class="paramname"><em>in</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">size_t * </td> + <td class="paramname"><em>in_pos</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">size_t </td> + <td class="paramname"><em>in_size</em> </td> + </tr> + <tr> + <td></td> + <td>)</td> + <td></td><td></td> + </tr> + </table> +</div><div class="memdoc"> + +<p>Decode a variable-length integer. </p> +<p>Like <a class="el" href="vli_8h.html#a50bbb77e9ec3b72c25586aa700c20970" title="Encode a variable-length integer.">lzma_vli_encode()</a>, this function has single-call and multi-call modes.</p> +<dl class="params"><dt>Parameters</dt><dd> + <table class="params"> + <tr><td class="paramdir">[out]</td><td class="paramname">vli</td><td>Pointer to decoded integer. The decoder will initialize it to zero when *vli_pos == 0, so application isn't required to initialize *vli. </td></tr> + <tr><td class="paramdir">[out]</td><td class="paramname">vli_pos</td><td>How many bytes have already been decoded. When starting to decode a new integer in multi-call mode, *vli_pos must be initialized to zero. To use single-call decoding, set vli_pos to NULL. </td></tr> + <tr><td class="paramdir"></td><td class="paramname">in</td><td>Beginning of the input buffer </td></tr> + <tr><td class="paramdir">[out]</td><td class="paramname">in_pos</td><td>The next byte will be read from in[*in_pos]. </td></tr> + <tr><td class="paramdir"></td><td class="paramname">in_size</td><td>Size of the input buffer; the first byte that won't be read is in[in_size].</td></tr> + </table> + </dd> +</dl> +<dl class="section return"><dt>Returns</dt><dd>Slightly different return values are used in multi-call and single-call modes.</dd></dl> +<p>Single-call (vli_pos == NULL):</p><ul> +<li>LZMA_OK: Integer successfully decoded.</li> +<li>LZMA_DATA_ERROR: Integer is corrupt. This includes hitting the end of the input buffer before the whole integer was decoded; providing no input at all will use LZMA_DATA_ERROR.</li> +<li>LZMA_PROG_ERROR: Arguments are not sane.</li> +</ul> +<p>Multi-call (vli_pos != NULL):</p><ul> +<li>LZMA_OK: So far all OK, but the integer is not completely decoded yet.</li> +<li>LZMA_STREAM_END: Integer successfully decoded.</li> +<li>LZMA_DATA_ERROR: Integer is corrupt.</li> +<li>LZMA_BUF_ERROR: No input was provided.</li> +<li>LZMA_PROG_ERROR: Arguments are not sane. </li> +</ul> + +</div> +</div> +<a id="a8d53e0b69934b43da8721fa6f1e8cc4f" name="a8d53e0b69934b43da8721fa6f1e8cc4f"></a> +<h2 class="memtitle"><span class="permalink"><a href="#a8d53e0b69934b43da8721fa6f1e8cc4f">◆ </a></span>lzma_vli_size()</h2> + +<div class="memitem"> +<div class="memproto"> + <table class="memname"> + <tr> + <td class="memname">uint32_t lzma_vli_size </td> + <td>(</td> + <td class="paramtype"><a class="el" href="vli_8h.html#a1dbc0ffc3e72748f64df8f7f71898272">lzma_vli</a> </td> + <td class="paramname"><em>vli</em></td><td>)</td> + <td></td> + </tr> + </table> +</div><div class="memdoc"> + +<p>Get the number of bytes required to encode a VLI. </p> +<dl class="params"><dt>Parameters</dt><dd> + <table class="params"> + <tr><td class="paramname">vli</td><td>Integer whose encoded size is to be determined</td></tr> + </table> + </dd> +</dl> +<dl class="section return"><dt>Returns</dt><dd>Number of bytes on success (1-9). If vli isn't valid, zero is returned. </dd></dl> + +</div> +</div> +</div><!-- contents --> +<!-- start footer part --> +<hr class="footer"/><address class="footer"><small> +Generated by <a href="https://www.doxygen.org/index.html"><img class="footer" src="doxygen.svg" width="104" height="31" alt="doxygen"/></a> 1.9.7 +</small></address> +</body> +</html> |