003 File Manager
Current Path:
/usr/src/contrib/xz/src/liblzma/common
usr
/
src
/
contrib
/
xz
/
src
/
liblzma
/
common
/
📁
..
📄
alone_decoder.c
(5.53 KB)
📄
alone_decoder.h
(601 B)
📄
alone_encoder.c
(3.66 KB)
📄
auto_decoder.c
(4.79 KB)
📄
block_buffer_decoder.c
(2.31 KB)
📄
block_buffer_encoder.c
(9.89 KB)
📄
block_buffer_encoder.h
(763 B)
📄
block_decoder.c
(6.82 KB)
📄
block_decoder.h
(576 B)
📄
block_encoder.c
(5.63 KB)
📄
block_encoder.h
(1.85 KB)
📄
block_header_decoder.c
(3.62 KB)
📄
block_header_encoder.c
(3.27 KB)
📄
block_util.c
(2.58 KB)
📄
common.c
(10.4 KB)
📄
common.h
(10.22 KB)
📄
easy_buffer_encoder.c
(840 B)
📄
easy_decoder_memusage.c
(668 B)
📄
easy_encoder.c
(678 B)
📄
easy_encoder_memusage.c
(654 B)
📄
easy_preset.c
(727 B)
📄
easy_preset.h
(921 B)
📄
filter_buffer_decoder.c
(2.45 KB)
📄
filter_buffer_encoder.c
(1.5 KB)
📄
filter_common.c
(8.5 KB)
📄
filter_common.h
(1.23 KB)
📄
filter_decoder.c
(4.32 KB)
📄
filter_decoder.h
(617 B)
📄
filter_encoder.c
(7.17 KB)
📄
filter_encoder.h
(732 B)
📄
filter_flags_decoder.c
(1.16 KB)
📄
filter_flags_encoder.c
(1.37 KB)
📄
hardware_cputhreads.c
(526 B)
📄
hardware_physmem.c
(683 B)
📄
index.c
(34.61 KB)
📄
index.h
(1.93 KB)
📄
index_decoder.c
(8.4 KB)
📄
index_encoder.c
(5.72 KB)
📄
index_encoder.h
(584 B)
📄
index_hash.c
(8.77 KB)
📄
memcmplen.h
(4.71 KB)
📄
outqueue.c
(4.48 KB)
📄
outqueue.h
(4.88 KB)
📄
stream_buffer_decoder.c
(2.72 KB)
📄
stream_buffer_encoder.c
(3.96 KB)
📄
stream_decoder.c
(12.7 KB)
📄
stream_decoder.h
(599 B)
📄
stream_encoder.c
(9.63 KB)
📄
stream_encoder_mt.c
(29.64 KB)
📄
stream_flags_common.c
(1.29 KB)
📄
stream_flags_common.h
(883 B)
📄
stream_flags_decoder.c
(2.23 KB)
📄
stream_flags_encoder.c
(2.01 KB)
📄
vli_decoder.c
(2.5 KB)
📄
vli_encoder.c
(1.89 KB)
📄
vli_size.c
(630 B)
Editing: vli_decoder.c
/////////////////////////////////////////////////////////////////////////////// // /// \file vli_decoder.c /// \brief Decodes variable-length integers // // Author: Lasse Collin // // This file has been put into the public domain. // You can do whatever you want with this file. // /////////////////////////////////////////////////////////////////////////////// #include "common.h" extern LZMA_API(lzma_ret) lzma_vli_decode(lzma_vli *restrict vli, size_t *vli_pos, const uint8_t *restrict in, size_t *restrict in_pos, size_t in_size) { // If we haven't been given vli_pos, work in single-call mode. size_t vli_pos_internal = 0; if (vli_pos == NULL) { vli_pos = &vli_pos_internal; *vli = 0; // If there's no input, use LZMA_DATA_ERROR. This way it is // easy to decode VLIs from buffers that have known size, // and get the correct error code in case the buffer is // too short. if (*in_pos >= in_size) return LZMA_DATA_ERROR; } else { // Initialize *vli when starting to decode a new integer. if (*vli_pos == 0) *vli = 0; // Validate the arguments. if (*vli_pos >= LZMA_VLI_BYTES_MAX || (*vli >> (*vli_pos * 7)) != 0) return LZMA_PROG_ERROR;; if (*in_pos >= in_size) return LZMA_BUF_ERROR; } do { // Read the next byte. Use a temporary variable so that we // can update *in_pos immediately. const uint8_t byte = in[*in_pos]; ++*in_pos; // Add the newly read byte to *vli. *vli += (lzma_vli)(byte & 0x7F) << (*vli_pos * 7); ++*vli_pos; // Check if this is the last byte of a multibyte integer. if ((byte & 0x80) == 0) { // We don't allow using variable-length integers as // padding i.e. the encoding must use the most the // compact form. if (byte == 0x00 && *vli_pos > 1) return LZMA_DATA_ERROR; return vli_pos == &vli_pos_internal ? LZMA_OK : LZMA_STREAM_END; } // There is at least one more byte coming. If we have already // read maximum number of bytes, the integer is considered // corrupt. // // If we need bigger integers in future, old versions liblzma // will confusingly indicate the file being corrupt instead of // unsupported. I suppose it's still better this way, because // in the foreseeable future (writing this in 2008) the only // reason why files would appear having over 63-bit integers // is that the files are simply corrupt. if (*vli_pos == LZMA_VLI_BYTES_MAX) return LZMA_DATA_ERROR; } while (*in_pos < in_size); return vli_pos == &vli_pos_internal ? LZMA_DATA_ERROR : LZMA_OK; }
Upload File
Create Folder