alone_encoder.c (213700) | alone_encoder.c (223935) |
---|---|
1/////////////////////////////////////////////////////////////////////////////// 2// 3/// \file alone_decoder.c 4/// \brief Decoder for LZMA_Alone files 5// 6// Author: Lasse Collin 7// 8// This file has been put into the public domain. --- 18 unchanged lines hidden (view full) --- 27 28 size_t header_pos; 29 uint8_t header[ALONE_HEADER_SIZE]; 30}; 31 32 33static lzma_ret 34alone_encode(lzma_coder *coder, | 1/////////////////////////////////////////////////////////////////////////////// 2// 3/// \file alone_decoder.c 4/// \brief Decoder for LZMA_Alone files 5// 6// Author: Lasse Collin 7// 8// This file has been put into the public domain. --- 18 unchanged lines hidden (view full) --- 27 28 size_t header_pos; 29 uint8_t header[ALONE_HEADER_SIZE]; 30}; 31 32 33static lzma_ret 34alone_encode(lzma_coder *coder, |
35 lzma_allocator *allocator lzma_attribute((unused)), | 35 lzma_allocator *allocator lzma_attribute((__unused__)), |
36 const uint8_t *restrict in, size_t *restrict in_pos, 37 size_t in_size, uint8_t *restrict out, 38 size_t *restrict out_pos, size_t out_size, 39 lzma_action action) 40{ 41 while (*out_pos < out_size) 42 switch (coder->sequence) { 43 case SEQ_HEADER: --- 54 unchanged lines hidden (view full) --- 98 // - Properties (1 byte) 99 if (lzma_lzma_lclppb_encode(options, next->coder->header)) 100 return LZMA_OPTIONS_ERROR; 101 102 // - Dictionary size (4 bytes) 103 if (options->dict_size < LZMA_DICT_SIZE_MIN) 104 return LZMA_OPTIONS_ERROR; 105 | 36 const uint8_t *restrict in, size_t *restrict in_pos, 37 size_t in_size, uint8_t *restrict out, 38 size_t *restrict out_pos, size_t out_size, 39 lzma_action action) 40{ 41 while (*out_pos < out_size) 42 switch (coder->sequence) { 43 case SEQ_HEADER: --- 54 unchanged lines hidden (view full) --- 98 // - Properties (1 byte) 99 if (lzma_lzma_lclppb_encode(options, next->coder->header)) 100 return LZMA_OPTIONS_ERROR; 101 102 // - Dictionary size (4 bytes) 103 if (options->dict_size < LZMA_DICT_SIZE_MIN) 104 return LZMA_OPTIONS_ERROR; 105 |
106 // Round up to to the next 2^n or 2^n + 2^(n - 1) depending on which | 106 // Round up to the next 2^n or 2^n + 2^(n - 1) depending on which |
107 // one is the next unless it is UINT32_MAX. While the header would 108 // allow any 32-bit integer, we do this to keep the decoder of liblzma 109 // accepting the resulting files. 110 uint32_t d = options->dict_size - 1; 111 d |= d >> 2; 112 d |= d >> 3; 113 d |= d >> 4; 114 d |= d >> 8; --- 43 unchanged lines hidden --- | 107 // one is the next unless it is UINT32_MAX. While the header would 108 // allow any 32-bit integer, we do this to keep the decoder of liblzma 109 // accepting the resulting files. 110 uint32_t d = options->dict_size - 1; 111 d |= d >> 2; 112 d |= d >> 3; 113 d |= d >> 4; 114 d |= d >> 8; --- 43 unchanged lines hidden --- |