| OLD | NEW |
| 1 /////////////////////////////////////////////////////////////////////////////// | 1 /////////////////////////////////////////////////////////////////////////////// |
| 2 // | 2 // |
| 3 /// \file stream_encoder.c | 3 /// \file stream_encoder.c |
| 4 /// \brief Encodes .xz Streams | 4 /// \brief Encodes .xz Streams |
| 5 // | 5 // |
| 6 // Author: Lasse Collin | 6 // Author: Lasse Collin |
| 7 // | 7 // |
| 8 // This file has been put into the public domain. | 8 // This file has been put into the public domain. |
| 9 // You can do whatever you want with this file. | 9 // You can do whatever you want with this file. |
| 10 // | 10 // |
| (...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 273 | 273 |
| 274 if (next->coder == NULL) { | 274 if (next->coder == NULL) { |
| 275 next->coder = lzma_alloc(sizeof(lzma_coder), allocator); | 275 next->coder = lzma_alloc(sizeof(lzma_coder), allocator); |
| 276 if (next->coder == NULL) | 276 if (next->coder == NULL) |
| 277 return LZMA_MEM_ERROR; | 277 return LZMA_MEM_ERROR; |
| 278 | 278 |
| 279 next->code = &stream_encode; | 279 next->code = &stream_encode; |
| 280 next->end = &stream_encoder_end; | 280 next->end = &stream_encoder_end; |
| 281 next->update = &stream_encoder_update; | 281 next->update = &stream_encoder_update; |
| 282 | 282 |
| 283 next->coder->filters[0].id = LZMA_VLI_UNKNOWN; |
| 283 next->coder->block_encoder = LZMA_NEXT_CODER_INIT; | 284 next->coder->block_encoder = LZMA_NEXT_CODER_INIT; |
| 284 next->coder->index_encoder = LZMA_NEXT_CODER_INIT; | 285 next->coder->index_encoder = LZMA_NEXT_CODER_INIT; |
| 285 next->coder->index = NULL; | 286 next->coder->index = NULL; |
| 286 } | 287 } |
| 287 | 288 |
| 288 // Basic initializations | 289 // Basic initializations |
| 289 next->coder->sequence = SEQ_STREAM_HEADER; | 290 next->coder->sequence = SEQ_STREAM_HEADER; |
| 290 next->coder->block_options.version = 0; | 291 next->coder->block_options.version = 0; |
| 291 next->coder->block_options.check = check; | 292 next->coder->block_options.check = check; |
| 292 next->coder->filters[0].id = LZMA_VLI_UNKNOWN; | |
| 293 | 293 |
| 294 // Initialize the Index | 294 // Initialize the Index |
| 295 lzma_index_end(next->coder->index, allocator); | 295 lzma_index_end(next->coder->index, allocator); |
| 296 next->coder->index = lzma_index_init(allocator); | 296 next->coder->index = lzma_index_init(allocator); |
| 297 if (next->coder->index == NULL) | 297 if (next->coder->index == NULL) |
| 298 return LZMA_MEM_ERROR; | 298 return LZMA_MEM_ERROR; |
| 299 | 299 |
| 300 // Encode the Stream Header | 300 // Encode the Stream Header |
| 301 lzma_stream_flags stream_flags = { | 301 lzma_stream_flags stream_flags = { |
| 302 .version = 0, | 302 .version = 0, |
| (...skipping 19 matching lines...) Expand all Loading... |
| 322 { | 322 { |
| 323 lzma_next_strm_init(lzma_stream_encoder_init, strm, filters, check); | 323 lzma_next_strm_init(lzma_stream_encoder_init, strm, filters, check); |
| 324 | 324 |
| 325 strm->internal->supported_actions[LZMA_RUN] = true; | 325 strm->internal->supported_actions[LZMA_RUN] = true; |
| 326 strm->internal->supported_actions[LZMA_SYNC_FLUSH] = true; | 326 strm->internal->supported_actions[LZMA_SYNC_FLUSH] = true; |
| 327 strm->internal->supported_actions[LZMA_FULL_FLUSH] = true; | 327 strm->internal->supported_actions[LZMA_FULL_FLUSH] = true; |
| 328 strm->internal->supported_actions[LZMA_FINISH] = true; | 328 strm->internal->supported_actions[LZMA_FINISH] = true; |
| 329 | 329 |
| 330 return LZMA_OK; | 330 return LZMA_OK; |
| 331 } | 331 } |
| OLD | NEW |