Deleted Added
full compact
block_encoder.c (213700) block_encoder.c (223935)
1///////////////////////////////////////////////////////////////////////////////
2//
3/// \file block_encoder.c
4/// \brief Encodes .xz Blocks
5//
6// Author: Lasse Collin
7//
8// This file has been put into the public domain.

--- 130 unchanged lines hidden (view full) ---

139 lzma_next_end(&coder->next, allocator);
140 lzma_free(coder, allocator);
141 return;
142}
143
144
145static lzma_ret
146block_encoder_update(lzma_coder *coder, lzma_allocator *allocator,
1///////////////////////////////////////////////////////////////////////////////
2//
3/// \file block_encoder.c
4/// \brief Encodes .xz Blocks
5//
6// Author: Lasse Collin
7//
8// This file has been put into the public domain.

--- 130 unchanged lines hidden (view full) ---

139 lzma_next_end(&coder->next, allocator);
140 lzma_free(coder, allocator);
141 return;
142}
143
144
145static lzma_ret
146block_encoder_update(lzma_coder *coder, lzma_allocator *allocator,
147 const lzma_filter *filters lzma_attribute((unused)),
147 const lzma_filter *filters lzma_attribute((__unused__)),
148 const lzma_filter *reversed_filters)
149{
150 if (coder->sequence != SEQ_CODE)
151 return LZMA_PROG_ERROR;
152
153 return lzma_next_filter_update(
154 &coder->next, allocator, reversed_filters);
155}
156
157
158extern lzma_ret
159lzma_block_encoder_init(lzma_next_coder *next, lzma_allocator *allocator,
160 lzma_block *block)
161{
162 lzma_next_coder_init(&lzma_block_encoder_init, next, allocator);
163
148 const lzma_filter *reversed_filters)
149{
150 if (coder->sequence != SEQ_CODE)
151 return LZMA_PROG_ERROR;
152
153 return lzma_next_filter_update(
154 &coder->next, allocator, reversed_filters);
155}
156
157
158extern lzma_ret
159lzma_block_encoder_init(lzma_next_coder *next, lzma_allocator *allocator,
160 lzma_block *block)
161{
162 lzma_next_coder_init(&lzma_block_encoder_init, next, allocator);
163
164 if (block == NULL)
165 return LZMA_PROG_ERROR;
166
167 // The contents of the structure may depend on the version so
168 // check the version first.
164 if (block->version != 0)
165 return LZMA_OPTIONS_ERROR;
166
167 // If the Check ID is not supported, we cannot calculate the check and
168 // thus not create a proper Block.
169 if ((unsigned int)(block->check) > LZMA_CHECK_ID_MAX)
170 return LZMA_PROG_ERROR;
171

--- 41 unchanged lines hidden ---
169 if (block->version != 0)
170 return LZMA_OPTIONS_ERROR;
171
172 // If the Check ID is not supported, we cannot calculate the check and
173 // thus not create a proper Block.
174 if ((unsigned int)(block->check) > LZMA_CHECK_ID_MAX)
175 return LZMA_PROG_ERROR;
176

--- 41 unchanged lines hidden ---