OLD | NEW |
1 /** | 1 /** |
2 * \file lzma/index.h | 2 * \file lzma/index.h |
3 * \brief Handling of .xz Index and related information | 3 * \brief Handling of .xz Index and related information |
4 */ | 4 */ |
5 | 5 |
6 /* | 6 /* |
7 * Author: Lasse Collin | 7 * Author: Lasse Collin |
8 * | 8 * |
9 * This file has been put into the public domain. | 9 * This file has been put into the public domain. |
10 * You can do whatever you want with this file. | 10 * You can do whatever you want with this file. |
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
129 * Normally this is where you should seek in the .xz file | 129 * Normally this is where you should seek in the .xz file |
130 * to start decompressing this Block. | 130 * to start decompressing this Block. |
131 */ | 131 */ |
132 lzma_vli compressed_file_offset; | 132 lzma_vli compressed_file_offset; |
133 | 133 |
134 /** | 134 /** |
135 * \brief Uncompressed start offset of this Block | 135 * \brief Uncompressed start offset of this Block |
136 * | 136 * |
137 * This offset is relative to the beginning of the lzma_index | 137 * This offset is relative to the beginning of the lzma_index |
138 * (i.e. usually the beginning of the .xz file). | 138 * (i.e. usually the beginning of the .xz file). |
| 139 * |
| 140 * When doing random-access reading, it is possible that |
| 141 * the target offset is not exactly at Block boundary. One |
| 142 * will need to compare the target offset against |
| 143 * uncompressed_file_offset or uncompressed_stream_offset, |
| 144 * and possibly decode and throw away some amount of data |
| 145 * before reaching the target offset. |
139 */ | 146 */ |
140 lzma_vli uncompressed_file_offset; | 147 lzma_vli uncompressed_file_offset; |
141 | 148 |
142 /** | 149 /** |
143 * \brief Block number in this Stream | 150 * \brief Block number in this Stream |
144 * | 151 * |
145 * The first Block is 1. | 152 * The first Block is 1. |
146 */ | 153 */ |
147 lzma_vli number_in_stream; | 154 lzma_vli number_in_stream; |
148 | 155 |
(...skipping 10 matching lines...) Expand all Loading... |
159 * | 166 * |
160 * This offset is relative to the beginning of the Stream | 167 * This offset is relative to the beginning of the Stream |
161 * containing this Block. | 168 * containing this Block. |
162 */ | 169 */ |
163 lzma_vli uncompressed_stream_offset; | 170 lzma_vli uncompressed_stream_offset; |
164 | 171 |
165 /** | 172 /** |
166 * \brief Uncompressed size of this Block | 173 * \brief Uncompressed size of this Block |
167 * | 174 * |
168 * You should pass this to the Block decoder if you will | 175 * You should pass this to the Block decoder if you will |
169 » » * decode this Block. | 176 » » * decode this Block. It will allow the Block decoder to |
170 » » * | 177 » » * validate the uncompressed size. |
171 » » * When doing random-access reading, it is possible that | |
172 » » * the target offset is not exactly at Block boundary. One | |
173 » » * will need to compare the target offset against | |
174 » » * uncompressed_file_offset or uncompressed_stream_offset, | |
175 » » * and possibly decode and throw away some amount of data | |
176 » » * before reaching the target offset. | |
177 */ | 178 */ |
178 lzma_vli uncompressed_size; | 179 lzma_vli uncompressed_size; |
179 | 180 |
180 /** | 181 /** |
181 * \brief Unpadded size of this Block | 182 * \brief Unpadded size of this Block |
182 * | 183 * |
183 * You should pass this to the Block decoder if you will | 184 * You should pass this to the Block decoder if you will |
184 » » * decode this Block. | 185 » » * decode this Block. It will allow the Block decoder to |
| 186 » » * validate the unpadded size. |
185 */ | 187 */ |
186 lzma_vli unpadded_size; | 188 lzma_vli unpadded_size; |
187 | 189 |
188 /** | 190 /** |
189 * \brief Total compressed size | 191 * \brief Total compressed size |
190 * | 192 * |
191 * This includes all headers and padding in this Block. | 193 * This includes all headers and padding in this Block. |
192 * This is useful if you need to know how many bytes | 194 * This is useful if you need to know how many bytes |
193 * the Block decoder will actually read. | 195 * the Block decoder will actually read. |
194 */ | 196 */ |
(...skipping 381 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
576 const lzma_index *i, lzma_allocator *allocator) | 578 const lzma_index *i, lzma_allocator *allocator) |
577 lzma_nothrow lzma_attr_warn_unused_result; | 579 lzma_nothrow lzma_attr_warn_unused_result; |
578 | 580 |
579 | 581 |
580 /** | 582 /** |
581 * \brief Initialize .xz Index encoder | 583 * \brief Initialize .xz Index encoder |
582 * | 584 * |
583 * \param strm Pointer to properly prepared lzma_stream | 585 * \param strm Pointer to properly prepared lzma_stream |
584 * \param i Pointer to lzma_index which should be encoded. | 586 * \param i Pointer to lzma_index which should be encoded. |
585 * | 587 * |
586 * The only valid action value for lzma_code() is LZMA_RUN. | 588 * The valid `action' values for lzma_code() are LZMA_RUN and LZMA_FINISH. |
| 589 * It is enough to use only one of them (you can choose freely; use LZMA_RUN |
| 590 * to support liblzma versions older than 5.0.0). |
587 * | 591 * |
588 * \return - LZMA_OK: Initialization succeeded, continue with lzma_code(). | 592 * \return - LZMA_OK: Initialization succeeded, continue with lzma_code(). |
589 * - LZMA_MEM_ERROR | 593 * - LZMA_MEM_ERROR |
590 * - LZMA_PROG_ERROR | 594 * - LZMA_PROG_ERROR |
591 */ | 595 */ |
592 extern LZMA_API(lzma_ret) lzma_index_encoder( | 596 extern LZMA_API(lzma_ret) lzma_index_encoder( |
593 lzma_stream *strm, const lzma_index *i) | 597 lzma_stream *strm, const lzma_index *i) |
594 lzma_nothrow lzma_attr_warn_unused_result; | 598 lzma_nothrow lzma_attr_warn_unused_result; |
595 | 599 |
596 | 600 |
597 /** | 601 /** |
598 * \brief Initialize .xz Index decoder | 602 * \brief Initialize .xz Index decoder |
599 * | 603 * |
600 * \param strm Pointer to properly prepared lzma_stream | 604 * \param strm Pointer to properly prepared lzma_stream |
601 * \param i The decoded Index will be made available via | 605 * \param i The decoded Index will be made available via |
602 * this pointer. Initially this function will | 606 * this pointer. Initially this function will |
603 * set *i to NULL (the old value is ignored). If | 607 * set *i to NULL (the old value is ignored). If |
604 * decoding succeeds (lzma_code() returns | 608 * decoding succeeds (lzma_code() returns |
605 * LZMA_STREAM_END), *i will be set to point | 609 * LZMA_STREAM_END), *i will be set to point |
606 * to a new lzma_index, which the application | 610 * to a new lzma_index, which the application |
607 * has to later free with lzma_index_end(). | 611 * has to later free with lzma_index_end(). |
608 * \param memlimit How much memory the resulting lzma_index is | 612 * \param memlimit How much memory the resulting lzma_index is |
609 * allowed to require. | 613 * allowed to require. |
610 * | 614 * |
611 * The only valid action value for lzma_code() is LZMA_RUN. | 615 * The valid `action' values for lzma_code() are LZMA_RUN and LZMA_FINISH. |
| 616 * It is enough to use only one of them (you can choose freely; use LZMA_RUN |
| 617 * to support liblzma versions older than 5.0.0). |
612 * | 618 * |
613 * \return - LZMA_OK: Initialization succeeded, continue with lzma_code(). | 619 * \return - LZMA_OK: Initialization succeeded, continue with lzma_code(). |
614 * - LZMA_MEM_ERROR | 620 * - LZMA_MEM_ERROR |
615 * - LZMA_MEMLIMIT_ERROR | 621 * - LZMA_MEMLIMIT_ERROR |
616 * - LZMA_PROG_ERROR | 622 * - LZMA_PROG_ERROR |
617 */ | 623 */ |
618 extern LZMA_API(lzma_ret) lzma_index_decoder( | 624 extern LZMA_API(lzma_ret) lzma_index_decoder( |
619 lzma_stream *strm, lzma_index **i, uint64_t memlimit) | 625 lzma_stream *strm, lzma_index **i, uint64_t memlimit) |
620 lzma_nothrow lzma_attr_warn_unused_result; | 626 lzma_nothrow lzma_attr_warn_unused_result; |
621 | 627 |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
667 * - LZMA_MEM_ERROR | 673 * - LZMA_MEM_ERROR |
668 * - LZMA_MEMLIMIT_ERROR: Memory usage limit was reached. | 674 * - LZMA_MEMLIMIT_ERROR: Memory usage limit was reached. |
669 * The minimum required memlimit value was stored to *memlimit. | 675 * The minimum required memlimit value was stored to *memlimit. |
670 * - LZMA_DATA_ERROR | 676 * - LZMA_DATA_ERROR |
671 * - LZMA_PROG_ERROR | 677 * - LZMA_PROG_ERROR |
672 */ | 678 */ |
673 extern LZMA_API(lzma_ret) lzma_index_buffer_decode(lzma_index **i, | 679 extern LZMA_API(lzma_ret) lzma_index_buffer_decode(lzma_index **i, |
674 uint64_t *memlimit, lzma_allocator *allocator, | 680 uint64_t *memlimit, lzma_allocator *allocator, |
675 const uint8_t *in, size_t *in_pos, size_t in_size) | 681 const uint8_t *in, size_t *in_pos, size_t in_size) |
676 lzma_nothrow; | 682 lzma_nothrow; |
OLD | NEW |