aboutsummaryrefslogtreecommitdiff
path: root/src/liblzma/common/block_encoder.c
diff options
context:
space:
mode:
authorLasse Collin <lasse.collin@tukaani.org>2009-05-26 14:48:48 +0300
committerLasse Collin <lasse.collin@tukaani.org>2009-05-26 14:48:48 +0300
commit083c23c680ff844846d177cfc58bb7a874e7e6b9 (patch)
treea6263783a9cb49f21ba562df7553e39e38ddcf99 /src/liblzma/common/block_encoder.c
parentRemove undocumented alternative option names --bcj, --ppc, (diff)
downloadxz-083c23c680ff844846d177cfc58bb7a874e7e6b9.tar.xz
Make the raw value of the Check field available to applications
via lzma_block structure. This changes ABI but not doesn't break API.
Diffstat (limited to '')
-rw-r--r--src/liblzma/common/block_encoder.c21
1 files changed, 9 insertions, 12 deletions
diff --git a/src/liblzma/common/block_encoder.c b/src/liblzma/common/block_encoder.c
index 0d7b3ef2..567889aa 100644
--- a/src/liblzma/common/block_encoder.c
+++ b/src/liblzma/common/block_encoder.c
@@ -117,18 +117,15 @@ block_encode(lzma_coder *coder, lzma_allocator *allocator,
// Fall through
case SEQ_CHECK: {
- const uint32_t check_size
- = lzma_check_size(coder->block->check);
-
- while (*out_pos < out_size) {
- out[*out_pos] = coder->check.buffer.u8[coder->pos];
- ++*out_pos;
-
- if (++coder->pos == check_size)
- return LZMA_STREAM_END;
- }
-
- return LZMA_OK;
+ const size_t check_size = lzma_check_size(coder->block->check);
+ lzma_bufcpy(coder->check.buffer.u8, &coder->pos, check_size,
+ out, out_pos, out_size);
+ if (coder->pos < check_size)
+ return LZMA_OK;
+
+ memcpy(coder->block->raw_check, coder->check.buffer.u8,
+ check_size);
+ return LZMA_STREAM_END;
}
}