alone_encoder.c | alone_encoder.c | |||
---|---|---|---|---|
skipping to change at line 32 | skipping to change at line 32 | |||
SEQ_HEADER, | SEQ_HEADER, | |||
SEQ_CODE, | SEQ_CODE, | |||
} sequence; | } sequence; | |||
size_t header_pos; | size_t header_pos; | |||
uint8_t header[ALONE_HEADER_SIZE]; | uint8_t header[ALONE_HEADER_SIZE]; | |||
}; | }; | |||
static lzma_ret | static lzma_ret | |||
alone_encode(lzma_coder *coder, | alone_encode(lzma_coder *coder, | |||
lzma_allocator *allocator lzma_attribute((__unused__)), | const lzma_allocator *allocator lzma_attribute((__unused__)) , | |||
const uint8_t *restrict in, size_t *restrict in_pos, | const uint8_t *restrict in, size_t *restrict in_pos, | |||
size_t in_size, uint8_t *restrict out, | size_t in_size, uint8_t *restrict out, | |||
size_t *restrict out_pos, size_t out_size, | size_t *restrict out_pos, size_t out_size, | |||
lzma_action action) | lzma_action action) | |||
{ | { | |||
while (*out_pos < out_size) | while (*out_pos < out_size) | |||
switch (coder->sequence) { | switch (coder->sequence) { | |||
case SEQ_HEADER: | case SEQ_HEADER: | |||
lzma_bufcpy(coder->header, &coder->header_pos, | lzma_bufcpy(coder->header, &coder->header_pos, | |||
ALONE_HEADER_SIZE, | ALONE_HEADER_SIZE, | |||
skipping to change at line 64 | skipping to change at line 64 | |||
default: | default: | |||
assert(0); | assert(0); | |||
return LZMA_PROG_ERROR; | return LZMA_PROG_ERROR; | |||
} | } | |||
return LZMA_OK; | return LZMA_OK; | |||
} | } | |||
static void | static void | |||
alone_encoder_end(lzma_coder *coder, lzma_allocator *allocator) | alone_encoder_end(lzma_coder *coder, const lzma_allocator *allocator) | |||
{ | { | |||
lzma_next_end(&coder->next, allocator); | lzma_next_end(&coder->next, allocator); | |||
lzma_free(coder, allocator); | lzma_free(coder, allocator); | |||
return; | return; | |||
} | } | |||
// At least for now, this is not used by any internal function. | // At least for now, this is not used by any internal function. | |||
static lzma_ret | static lzma_ret | |||
alone_encoder_init(lzma_next_coder *next, lzma_allocator *allocator, | alone_encoder_init(lzma_next_coder *next, const lzma_allocator *allocator, | |||
const lzma_options_lzma *options) | const lzma_options_lzma *options) | |||
{ | { | |||
lzma_next_coder_init(&alone_encoder_init, next, allocator); | lzma_next_coder_init(&alone_encoder_init, next, allocator); | |||
if (next->coder == NULL) { | if (next->coder == NULL) { | |||
next->coder = lzma_alloc(sizeof(lzma_coder), allocator); | next->coder = lzma_alloc(sizeof(lzma_coder), allocator); | |||
if (next->coder == NULL) | if (next->coder == NULL) | |||
return LZMA_MEM_ERROR; | return LZMA_MEM_ERROR; | |||
next->code = &alone_encode; | next->code = &alone_encode; | |||
skipping to change at line 134 | skipping to change at line 134 | |||
}, { | }, { | |||
.init = NULL, | .init = NULL, | |||
} | } | |||
}; | }; | |||
return lzma_next_filter_init(&next->coder->next, allocator, filters) ; | return lzma_next_filter_init(&next->coder->next, allocator, filters) ; | |||
} | } | |||
/* | /* | |||
extern lzma_ret | extern lzma_ret | |||
lzma_alone_encoder_init(lzma_next_coder *next, lzma_allocator *allocator, | lzma_alone_encoder_init(lzma_next_coder *next, const lzma_allocator *alloca tor, | |||
const lzma_options_alone *options) | const lzma_options_alone *options) | |||
{ | { | |||
lzma_next_coder_init(&alone_encoder_init, next, allocator, options); | lzma_next_coder_init(&alone_encoder_init, next, allocator, options); | |||
} | } | |||
*/ | */ | |||
extern LZMA_API(lzma_ret) | extern LZMA_API(lzma_ret) | |||
lzma_alone_encoder(lzma_stream *strm, const lzma_options_lzma *options) | lzma_alone_encoder(lzma_stream *strm, const lzma_options_lzma *options) | |||
{ | { | |||
lzma_next_strm_init(alone_encoder_init, strm, options); | lzma_next_strm_init(alone_encoder_init, strm, options); | |||
End of changes. 4 change blocks. | ||||
4 lines changed or deleted | 4 lines changed or added | |||
This html diff was produced by rfcdiff 1.41. The latest version is available from http://tools.ietf.org/tools/rfcdiff/ |