aboutsummaryrefslogtreecommitdiff
path: root/src/liblzma/common/stream_encoder.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/liblzma/common/stream_encoder.c')
-rw-r--r--src/liblzma/common/stream_encoder.c35
1 files changed, 14 insertions, 21 deletions
diff --git a/src/liblzma/common/stream_encoder.c b/src/liblzma/common/stream_encoder.c
index 767b8014..9d56c899 100644
--- a/src/liblzma/common/stream_encoder.c
+++ b/src/liblzma/common/stream_encoder.c
@@ -17,8 +17,8 @@
//
///////////////////////////////////////////////////////////////////////////////
-#include "stream_common.h"
#include "stream_encoder.h"
+#include "stream_flags_common.h"
#include "block_encoder.h"
#include "index_encoder.h"
@@ -37,7 +37,7 @@ struct lzma_coder_s {
lzma_next_coder block_encoder;
/// Options for the Block encoder
- lzma_options_block block_options;
+ lzma_block block_options;
/// Index encoder. This is separate from Block encoder, because this
/// doesn't take much memory, and when encoding multiple Streams
@@ -86,8 +86,8 @@ stream_encode(lzma_coder *coder, lzma_allocator *allocator,
case SEQ_STREAM_HEADER:
case SEQ_BLOCK_HEADER:
case SEQ_STREAM_FOOTER:
- bufcpy(coder->buffer, &coder->buffer_pos, coder->buffer_size,
- out, out_pos, out_size);
+ lzma_bufcpy(coder->buffer, &coder->buffer_pos,
+ coder->buffer_size, out, out_pos, out_size);
if (coder->buffer_pos < coder->buffer_size)
return LZMA_OK;
@@ -202,18 +202,20 @@ stream_encode(lzma_coder *coder, lzma_allocator *allocator,
static void
stream_encoder_end(lzma_coder *coder, lzma_allocator *allocator)
{
- lzma_next_coder_end(&coder->block_encoder, allocator);
- lzma_next_coder_end(&coder->index_encoder, allocator);
+ lzma_next_end(&coder->block_encoder, allocator);
+ lzma_next_end(&coder->index_encoder, allocator);
lzma_index_end(coder->index, allocator);
lzma_free(coder, allocator);
return;
}
-static lzma_ret
-stream_encoder_init(lzma_next_coder *next, lzma_allocator *allocator,
- const lzma_options_filter *filters, lzma_check_type check)
+extern lzma_ret
+lzma_stream_encoder_init(lzma_next_coder *next, lzma_allocator *allocator,
+ const lzma_filter *filters, lzma_check check)
{
+ lzma_next_coder_init(lzma_stream_encoder_init, next, allocator);
+
if (filters == NULL)
return LZMA_PROG_ERROR;
@@ -233,7 +235,7 @@ stream_encoder_init(lzma_next_coder *next, lzma_allocator *allocator,
// Basic initializations
next->coder->sequence = SEQ_STREAM_HEADER;
next->coder->block_options.check = check;
- next->coder->block_options.filters = (lzma_options_filter *)(filters);
+ next->coder->block_options.filters = (lzma_filter *)(filters);
// Initialize the Index
next->coder->index = lzma_index_init(next->coder->index, allocator);
@@ -258,20 +260,11 @@ stream_encoder_init(lzma_next_coder *next, lzma_allocator *allocator,
}
-extern lzma_ret
-lzma_stream_encoder_init(lzma_next_coder *next, lzma_allocator *allocator,
- const lzma_options_filter *filters, lzma_check_type check)
-{
- lzma_next_coder_init(stream_encoder_init, next, allocator,
- filters, check);
-}
-
-
extern LZMA_API lzma_ret
lzma_stream_encoder(lzma_stream *strm,
- const lzma_options_filter *filters, lzma_check_type check)
+ const lzma_filter *filters, lzma_check check)
{
- lzma_next_strm_init(strm, stream_encoder_init, filters, check);
+ lzma_next_strm_init(lzma_stream_encoder_init, strm, filters, check);
strm->internal->supported_actions[LZMA_RUN] = true;
strm->internal->supported_actions[LZMA_SYNC_FLUSH] = true;