liblzma: Make lzma_validate_chain() available outside filter_common.c.

This commit is contained in:
Lasse Collin 2022-11-28 21:02:19 +02:00
parent 5f22bd2d37
commit 072ebf7b13
2 changed files with 7 additions and 4 deletions

View File

@ -238,8 +238,8 @@ lzma_filters_free(lzma_filter *filters, const lzma_allocator *allocator)
}
static lzma_ret
validate_chain(const lzma_filter *filters, size_t *count)
extern lzma_ret
lzma_validate_chain(const lzma_filter *filters, size_t *count)
{
// There must be at least one filter.
if (filters == NULL || filters[0].id == LZMA_VLI_UNKNOWN)
@ -293,7 +293,7 @@ lzma_raw_coder_init(lzma_next_coder *next, const lzma_allocator *allocator,
{
// Do some basic validation and get the number of filters.
size_t count;
return_if_error(validate_chain(options, &count));
return_if_error(lzma_validate_chain(options, &count));
// Set the filter functions and copy the options pointer.
lzma_filter_info filters[LZMA_FILTERS_MAX + 1];
@ -346,7 +346,7 @@ lzma_raw_coder_memusage(lzma_filter_find coder_find,
// The chain has to have at least one filter.
{
size_t tmp;
if (validate_chain(filters, &tmp) != LZMA_OK)
if (lzma_validate_chain(filters, &tmp) != LZMA_OK)
return UINT64_MAX;
}

View File

@ -35,6 +35,9 @@ typedef struct {
typedef const lzma_filter_coder *(*lzma_filter_find)(lzma_vli id);
extern lzma_ret lzma_validate_chain(const lzma_filter *filters, size_t *count);
extern lzma_ret lzma_raw_coder_init(
lzma_next_coder *next, const lzma_allocator *allocator,
const lzma_filter *filters,