| OLD | NEW |
| 1 /////////////////////////////////////////////////////////////////////////////// | 1 /////////////////////////////////////////////////////////////////////////////// |
| 2 // | 2 // |
| 3 /// \file filter_decoder.c | 3 /// \file filter_decoder.c |
| 4 /// \brief Filter ID mapping to filter-specific functions | 4 /// \brief Filter ID mapping to filter-specific functions |
| 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 208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 219 | 219 |
| 220 | 220 |
| 221 extern LZMA_API(uint64_t) | 221 extern LZMA_API(uint64_t) |
| 222 lzma_raw_encoder_memusage(const lzma_filter *filters) | 222 lzma_raw_encoder_memusage(const lzma_filter *filters) |
| 223 { | 223 { |
| 224 return lzma_raw_coder_memusage( | 224 return lzma_raw_coder_memusage( |
| 225 (lzma_filter_find)(&encoder_find), filters); | 225 (lzma_filter_find)(&encoder_find), filters); |
| 226 } | 226 } |
| 227 | 227 |
| 228 | 228 |
| 229 /* |
| 229 extern LZMA_API(lzma_vli) | 230 extern LZMA_API(lzma_vli) |
| 230 lzma_chunk_size(const lzma_filter *filters) | 231 lzma_chunk_size(const lzma_filter *filters) |
| 231 { | 232 { |
| 232 lzma_vli max = 0; | 233 lzma_vli max = 0; |
| 233 | 234 |
| 234 for (size_t i = 0; filters[i].id != LZMA_VLI_UNKNOWN; ++i) { | 235 for (size_t i = 0; filters[i].id != LZMA_VLI_UNKNOWN; ++i) { |
| 235 const lzma_filter_encoder *const fe | 236 const lzma_filter_encoder *const fe |
| 236 = encoder_find(filters[i].id); | 237 = encoder_find(filters[i].id); |
| 237 if (fe->chunk_size != NULL) { | 238 if (fe->chunk_size != NULL) { |
| 238 const lzma_vli size | 239 const lzma_vli size |
| 239 = fe->chunk_size(filters[i].options); | 240 = fe->chunk_size(filters[i].options); |
| 240 if (size == LZMA_VLI_UNKNOWN) | 241 if (size == LZMA_VLI_UNKNOWN) |
| 241 return LZMA_VLI_UNKNOWN; | 242 return LZMA_VLI_UNKNOWN; |
| 242 | 243 |
| 243 if (size > max) | 244 if (size > max) |
| 244 max = size; | 245 max = size; |
| 245 } | 246 } |
| 246 } | 247 } |
| 247 | 248 |
| 248 return max; | 249 return max; |
| 249 } | 250 } |
| 251 */ |
| 250 | 252 |
| 251 | 253 |
| 252 extern LZMA_API(lzma_ret) | 254 extern LZMA_API(lzma_ret) |
| 253 lzma_properties_size(uint32_t *size, const lzma_filter *filter) | 255 lzma_properties_size(uint32_t *size, const lzma_filter *filter) |
| 254 { | 256 { |
| 255 const lzma_filter_encoder *const fe = encoder_find(filter->id); | 257 const lzma_filter_encoder *const fe = encoder_find(filter->id); |
| 256 if (fe == NULL) { | 258 if (fe == NULL) { |
| 257 // Unknown filter - if the Filter ID is a proper VLI, | 259 // Unknown filter - if the Filter ID is a proper VLI, |
| 258 // return LZMA_OPTIONS_ERROR instead of LZMA_PROG_ERROR, | 260 // return LZMA_OPTIONS_ERROR instead of LZMA_PROG_ERROR, |
| 259 // because it's possible that we just don't have support | 261 // because it's possible that we just don't have support |
| (...skipping 17 matching lines...) Expand all Loading... |
| 277 { | 279 { |
| 278 const lzma_filter_encoder *const fe = encoder_find(filter->id); | 280 const lzma_filter_encoder *const fe = encoder_find(filter->id); |
| 279 if (fe == NULL) | 281 if (fe == NULL) |
| 280 return LZMA_PROG_ERROR; | 282 return LZMA_PROG_ERROR; |
| 281 | 283 |
| 282 if (fe->props_encode == NULL) | 284 if (fe->props_encode == NULL) |
| 283 return LZMA_OK; | 285 return LZMA_OK; |
| 284 | 286 |
| 285 return fe->props_encode(filter->options, props); | 287 return fe->props_encode(filter->options, props); |
| 286 } | 288 } |
| OLD | NEW |