tamp_compressor_flush

Function tamp_compressor_flush 

Source
pub unsafe extern "C" fn tamp_compressor_flush(
    compressor: *mut TampCompressor,
    output: *mut c_uchar,
    output_size: usize,
    output_written_size: *mut usize,
    write_token: bool,
) -> tamp_res
Expand description

@brief Completely flush the internal bit buffer. Makes output “complete”.

The following table contains the most number of bytes that could be flushed in a worst-case scenario:

+———————+––––––––––+—————————————––+——————————————+ | Literal Size (Bits) | Window Size (Bits) | Max Output Size write_token=false (Bytes) | Max Output Size write_token=true (Bytes) | +=====================+====================+===========================================+==========================================+ | 5 | 8 | 15 | 16 | +———————+––––––––––+—————————————––+——————————————+ | 5 | 9-15 | 16 | 17 | +———————+––––––––––+—————————————––+——————————————+ | 6 | 8 | 17 | 18 | +———————+––––––––––+—————————————––+——————————————+ | 6 | 9-15 | 18 | 19 | +———————+––––––––––+—————————————––+——————————————+ | 7 | 8 | 19 | 20 | +———————+––––––––––+—————————————––+——————————————+ | 7 | 9-15 | 20 | 21 | +———————+––––––––––+—————————————––+——————————————+ | 8 | 8 | 21 | 22 | +———————+––––––––––+—————————————––+——————————————+ | 8 | 9-15 | 22 | 23 | +———————+––––––––––+—————————————––+——————————————+

@param[in,out] compressor TampCompressor object to flush. @param[out] output Pointer to a pre-allocated buffer to hold the output compressed data. @param[in] output_size Size of the pre-allocated output buffer. @param[out] output_written_size Number of bytes written to output. May be NULL. @param[in] write_token Write the FLUSH token, if appropriate. Set to true if you want to continue using the compressor. Set to false if you are done with the compressor, usually at the end of a stream.

@return Tamp Status Code. Can return TAMP_OK, or TAMP_OUTPUT_FULL.