Path: blob/master/Utilities/cmliblzma/liblzma/simple/simple_private.h
3156 views
// SPDX-License-Identifier: 0BSD12///////////////////////////////////////////////////////////////////////////////3//4/// \file simple_private.h5/// \brief Private definitions for so called simple filters6//7// Author: Lasse Collin8//9///////////////////////////////////////////////////////////////////////////////1011#ifndef LZMA_SIMPLE_PRIVATE_H12#define LZMA_SIMPLE_PRIVATE_H1314#include "simple_coder.h"151617typedef struct {18/// Next filter in the chain19lzma_next_coder next;2021/// True if the next coder in the chain has returned LZMA_STREAM_END.22bool end_was_reached;2324/// True if filter() should encode the data; false to decode.25/// Currently all simple filters use the same function for encoding26/// and decoding, because the difference between encoders and decoders27/// is very small.28bool is_encoder;2930/// Pointer to filter-specific function, which does31/// the actual filtering.32size_t (*filter)(void *simple, uint32_t now_pos,33bool is_encoder, uint8_t *buffer, size_t size);3435/// Pointer to filter-specific data, or NULL if filter doesn't need36/// any extra data.37void *simple;3839/// The lowest 32 bits of the current position in the data. Most40/// filters need this to do conversions between absolute and relative41/// addresses.42uint32_t now_pos;4344/// Size of the memory allocated for the buffer.45size_t allocated;4647/// Flushing position in the temporary buffer. buffer[pos] is the48/// next byte to be copied to out[].49size_t pos;5051/// buffer[filtered] is the first unfiltered byte. When pos is smaller52/// than filtered, there is unflushed filtered data in the buffer.53size_t filtered;5455/// Total number of bytes (both filtered and unfiltered) currently56/// in the temporary buffer.57size_t size;5859/// Temporary buffer60uint8_t buffer[];61} lzma_simple_coder;626364extern lzma_ret lzma_simple_coder_init(lzma_next_coder *next,65const lzma_allocator *allocator,66const lzma_filter_info *filters,67size_t (*filter)(void *simple, uint32_t now_pos,68bool is_encoder, uint8_t *buffer, size_t size),69size_t simple_size, size_t unfiltered_max,70uint32_t alignment, bool is_encoder);7172#endif737475