#![no_std]
#![allow(non_upper_case_globals)]
#![allow(non_camel_case_types)]
#![allow(non_snake_case)]
pub type brotli_alloc_func = ::core::option::Option<
unsafe extern "C" fn(opaque: *mut libc::c_void, size: usize) -> *mut libc::c_void,
>;
pub type brotli_free_func = ::core::option::Option<
unsafe extern "C" fn(opaque: *mut libc::c_void, address: *mut libc::c_void),
>;
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct BrotliSharedDictionaryStruct {
_unused: [u8; 0],
}
pub type BrotliSharedDictionary = BrotliSharedDictionaryStruct;
pub const BrotliSharedDictionaryType_BROTLI_SHARED_DICTIONARY_RAW: BrotliSharedDictionaryType = 0;
pub const BrotliSharedDictionaryType_BROTLI_SHARED_DICTIONARY_SERIALIZED:
BrotliSharedDictionaryType = 1;
pub type BrotliSharedDictionaryType = libc::c_int;
extern "C" {
pub fn BrotliSharedDictionaryCreateInstance(
alloc_func: brotli_alloc_func,
free_func: brotli_free_func,
opaque: *mut libc::c_void,
) -> *mut BrotliSharedDictionary;
}
extern "C" {
pub fn BrotliSharedDictionaryDestroyInstance(dict: *mut BrotliSharedDictionary);
}
extern "C" {
pub fn BrotliSharedDictionaryAttach(
dict: *mut BrotliSharedDictionary,
type_: BrotliSharedDictionaryType,
data_size: usize,
data: *const u8,
) -> libc::c_int;
}
pub const BrotliEncoderMode_BROTLI_MODE_GENERIC: BrotliEncoderMode = 0;
pub const BrotliEncoderMode_BROTLI_MODE_TEXT: BrotliEncoderMode = 1;
pub const BrotliEncoderMode_BROTLI_MODE_FONT: BrotliEncoderMode = 2;
pub type BrotliEncoderMode = libc::c_int;
pub const BrotliEncoderOperation_BROTLI_OPERATION_PROCESS: BrotliEncoderOperation = 0;
pub const BrotliEncoderOperation_BROTLI_OPERATION_FLUSH: BrotliEncoderOperation = 1;
pub const BrotliEncoderOperation_BROTLI_OPERATION_FINISH: BrotliEncoderOperation = 2;
pub const BrotliEncoderOperation_BROTLI_OPERATION_EMIT_METADATA: BrotliEncoderOperation = 3;
pub type BrotliEncoderOperation = libc::c_int;
pub const BrotliEncoderParameter_BROTLI_PARAM_MODE: BrotliEncoderParameter = 0;
pub const BrotliEncoderParameter_BROTLI_PARAM_QUALITY: BrotliEncoderParameter = 1;
pub const BrotliEncoderParameter_BROTLI_PARAM_LGWIN: BrotliEncoderParameter = 2;
pub const BrotliEncoderParameter_BROTLI_PARAM_LGBLOCK: BrotliEncoderParameter = 3;
pub const BrotliEncoderParameter_BROTLI_PARAM_DISABLE_LITERAL_CONTEXT_MODELING:
BrotliEncoderParameter = 4;
pub const BrotliEncoderParameter_BROTLI_PARAM_SIZE_HINT: BrotliEncoderParameter = 5;
pub const BrotliEncoderParameter_BROTLI_PARAM_LARGE_WINDOW: BrotliEncoderParameter = 6;
pub const BrotliEncoderParameter_BROTLI_PARAM_NPOSTFIX: BrotliEncoderParameter = 7;
pub const BrotliEncoderParameter_BROTLI_PARAM_NDIRECT: BrotliEncoderParameter = 8;
pub const BrotliEncoderParameter_BROTLI_PARAM_STREAM_OFFSET: BrotliEncoderParameter = 9;
pub type BrotliEncoderParameter = libc::c_int;
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct BrotliEncoderStateStruct {
_unused: [u8; 0],
}
pub type BrotliEncoderState = BrotliEncoderStateStruct;
extern "C" {
pub fn BrotliEncoderSetParameter(
state: *mut BrotliEncoderState,
param: BrotliEncoderParameter,
value: u32,
) -> libc::c_int;
}
extern "C" {
pub fn BrotliEncoderCreateInstance(
alloc_func: brotli_alloc_func,
free_func: brotli_free_func,
opaque: *mut libc::c_void,
) -> *mut BrotliEncoderState;
}
extern "C" {
pub fn BrotliEncoderDestroyInstance(state: *mut BrotliEncoderState);
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct BrotliEncoderPreparedDictionaryStruct {
_unused: [u8; 0],
}
pub type BrotliEncoderPreparedDictionary = BrotliEncoderPreparedDictionaryStruct;
extern "C" {
pub fn BrotliEncoderPrepareDictionary(
type_: BrotliSharedDictionaryType,
data_size: usize,
data: *const u8,
quality: libc::c_int,
alloc_func: brotli_alloc_func,
free_func: brotli_free_func,
opaque: *mut libc::c_void,
) -> *mut BrotliEncoderPreparedDictionary;
}
extern "C" {
pub fn BrotliEncoderDestroyPreparedDictionary(dictionary: *mut BrotliEncoderPreparedDictionary);
}
extern "C" {
pub fn BrotliEncoderAttachPreparedDictionary(
state: *mut BrotliEncoderState,
dictionary: *const BrotliEncoderPreparedDictionary,
) -> libc::c_int;
}
extern "C" {
pub fn BrotliEncoderMaxCompressedSize(input_size: usize) -> usize;
}
extern "C" {
pub fn BrotliEncoderCompress(
quality: libc::c_int,
lgwin: libc::c_int,
mode: BrotliEncoderMode,
input_size: usize,
input_buffer: *const u8,
encoded_size: *mut usize,
encoded_buffer: *mut u8,
) -> libc::c_int;
}
extern "C" {
pub fn BrotliEncoderCompressStream(
state: *mut BrotliEncoderState,
op: BrotliEncoderOperation,
available_in: *mut usize,
next_in: *mut *const u8,
available_out: *mut usize,
next_out: *mut *mut u8,
total_out: *mut usize,
) -> libc::c_int;
}
extern "C" {
pub fn BrotliEncoderIsFinished(state: *mut BrotliEncoderState) -> libc::c_int;
}
extern "C" {
pub fn BrotliEncoderHasMoreOutput(state: *mut BrotliEncoderState) -> libc::c_int;
}
extern "C" {
pub fn BrotliEncoderTakeOutput(state: *mut BrotliEncoderState, size: *mut usize) -> *const u8;
}
extern "C" {
pub fn BrotliEncoderEstimatePeakMemoryUsage(
quality: libc::c_int,
lgwin: libc::c_int,
input_size: usize,
) -> usize;
}
extern "C" {
pub fn BrotliEncoderGetPreparedDictionarySize(
dictionary: *const BrotliEncoderPreparedDictionary,
) -> usize;
}
extern "C" {
pub fn BrotliEncoderVersion() -> u32;
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct BrotliDecoderStateStruct {
_unused: [u8; 0],
}
pub type BrotliDecoderState = BrotliDecoderStateStruct;
pub const BrotliDecoderResult_BROTLI_DECODER_RESULT_ERROR: BrotliDecoderResult = 0;
pub const BrotliDecoderResult_BROTLI_DECODER_RESULT_SUCCESS: BrotliDecoderResult = 1;
pub const BrotliDecoderResult_BROTLI_DECODER_RESULT_NEEDS_MORE_INPUT: BrotliDecoderResult = 2;
pub const BrotliDecoderResult_BROTLI_DECODER_RESULT_NEEDS_MORE_OUTPUT: BrotliDecoderResult = 3;
pub type BrotliDecoderResult = libc::c_int;
pub const BrotliDecoderErrorCode_BROTLI_DECODER_NO_ERROR: BrotliDecoderErrorCode = 0;
pub const BrotliDecoderErrorCode_BROTLI_DECODER_SUCCESS: BrotliDecoderErrorCode = 1;
pub const BrotliDecoderErrorCode_BROTLI_DECODER_NEEDS_MORE_INPUT: BrotliDecoderErrorCode = 2;
pub const BrotliDecoderErrorCode_BROTLI_DECODER_NEEDS_MORE_OUTPUT: BrotliDecoderErrorCode = 3;
pub const BrotliDecoderErrorCode_BROTLI_DECODER_ERROR_FORMAT_EXUBERANT_NIBBLE:
BrotliDecoderErrorCode = -1;
pub const BrotliDecoderErrorCode_BROTLI_DECODER_ERROR_FORMAT_RESERVED: BrotliDecoderErrorCode = -2;
pub const BrotliDecoderErrorCode_BROTLI_DECODER_ERROR_FORMAT_EXUBERANT_META_NIBBLE:
BrotliDecoderErrorCode = -3;
pub const BrotliDecoderErrorCode_BROTLI_DECODER_ERROR_FORMAT_SIMPLE_HUFFMAN_ALPHABET:
BrotliDecoderErrorCode = -4;
pub const BrotliDecoderErrorCode_BROTLI_DECODER_ERROR_FORMAT_SIMPLE_HUFFMAN_SAME:
BrotliDecoderErrorCode = -5;
pub const BrotliDecoderErrorCode_BROTLI_DECODER_ERROR_FORMAT_CL_SPACE: BrotliDecoderErrorCode = -6;
pub const BrotliDecoderErrorCode_BROTLI_DECODER_ERROR_FORMAT_HUFFMAN_SPACE: BrotliDecoderErrorCode =
-7;
pub const BrotliDecoderErrorCode_BROTLI_DECODER_ERROR_FORMAT_CONTEXT_MAP_REPEAT:
BrotliDecoderErrorCode = -8;
pub const BrotliDecoderErrorCode_BROTLI_DECODER_ERROR_FORMAT_BLOCK_LENGTH_1:
BrotliDecoderErrorCode = -9;
pub const BrotliDecoderErrorCode_BROTLI_DECODER_ERROR_FORMAT_BLOCK_LENGTH_2:
BrotliDecoderErrorCode = -10;
pub const BrotliDecoderErrorCode_BROTLI_DECODER_ERROR_FORMAT_TRANSFORM: BrotliDecoderErrorCode =
-11;
pub const BrotliDecoderErrorCode_BROTLI_DECODER_ERROR_FORMAT_DICTIONARY: BrotliDecoderErrorCode =
-12;
pub const BrotliDecoderErrorCode_BROTLI_DECODER_ERROR_FORMAT_WINDOW_BITS: BrotliDecoderErrorCode =
-13;
pub const BrotliDecoderErrorCode_BROTLI_DECODER_ERROR_FORMAT_PADDING_1: BrotliDecoderErrorCode =
-14;
pub const BrotliDecoderErrorCode_BROTLI_DECODER_ERROR_FORMAT_PADDING_2: BrotliDecoderErrorCode =
-15;
pub const BrotliDecoderErrorCode_BROTLI_DECODER_ERROR_FORMAT_DISTANCE: BrotliDecoderErrorCode = -16;
pub const BrotliDecoderErrorCode_BROTLI_DECODER_ERROR_COMPOUND_DICTIONARY: BrotliDecoderErrorCode =
-18;
pub const BrotliDecoderErrorCode_BROTLI_DECODER_ERROR_DICTIONARY_NOT_SET: BrotliDecoderErrorCode =
-19;
pub const BrotliDecoderErrorCode_BROTLI_DECODER_ERROR_INVALID_ARGUMENTS: BrotliDecoderErrorCode =
-20;
pub const BrotliDecoderErrorCode_BROTLI_DECODER_ERROR_ALLOC_CONTEXT_MODES: BrotliDecoderErrorCode =
-21;
pub const BrotliDecoderErrorCode_BROTLI_DECODER_ERROR_ALLOC_TREE_GROUPS: BrotliDecoderErrorCode =
-22;
pub const BrotliDecoderErrorCode_BROTLI_DECODER_ERROR_ALLOC_CONTEXT_MAP: BrotliDecoderErrorCode =
-25;
pub const BrotliDecoderErrorCode_BROTLI_DECODER_ERROR_ALLOC_RING_BUFFER_1: BrotliDecoderErrorCode =
-26;
pub const BrotliDecoderErrorCode_BROTLI_DECODER_ERROR_ALLOC_RING_BUFFER_2: BrotliDecoderErrorCode =
-27;
pub const BrotliDecoderErrorCode_BROTLI_DECODER_ERROR_ALLOC_BLOCK_TYPE_TREES:
BrotliDecoderErrorCode = -30;
pub const BrotliDecoderErrorCode_BROTLI_DECODER_ERROR_UNREACHABLE: BrotliDecoderErrorCode = -31;
pub type BrotliDecoderErrorCode = libc::c_int;
pub const BrotliDecoderParameter_BROTLI_DECODER_PARAM_DISABLE_RING_BUFFER_REALLOCATION:
BrotliDecoderParameter = 0;
pub const BrotliDecoderParameter_BROTLI_DECODER_PARAM_LARGE_WINDOW: BrotliDecoderParameter = 1;
pub type BrotliDecoderParameter = libc::c_int;
extern "C" {
pub fn BrotliDecoderSetParameter(
state: *mut BrotliDecoderState,
param: BrotliDecoderParameter,
value: u32,
) -> libc::c_int;
}
extern "C" {
pub fn BrotliDecoderAttachDictionary(
state: *mut BrotliDecoderState,
type_: BrotliSharedDictionaryType,
data_size: usize,
data: *const u8,
) -> libc::c_int;
}
extern "C" {
pub fn BrotliDecoderCreateInstance(
alloc_func: brotli_alloc_func,
free_func: brotli_free_func,
opaque: *mut libc::c_void,
) -> *mut BrotliDecoderState;
}
extern "C" {
pub fn BrotliDecoderDestroyInstance(state: *mut BrotliDecoderState);
}
extern "C" {
pub fn BrotliDecoderDecompress(
encoded_size: usize,
encoded_buffer: *const u8,
decoded_size: *mut usize,
decoded_buffer: *mut u8,
) -> BrotliDecoderResult;
}
extern "C" {
pub fn BrotliDecoderDecompressStream(
state: *mut BrotliDecoderState,
available_in: *mut usize,
next_in: *mut *const u8,
available_out: *mut usize,
next_out: *mut *mut u8,
total_out: *mut usize,
) -> BrotliDecoderResult;
}
extern "C" {
pub fn BrotliDecoderHasMoreOutput(state: *const BrotliDecoderState) -> libc::c_int;
}
extern "C" {
pub fn BrotliDecoderTakeOutput(state: *mut BrotliDecoderState, size: *mut usize) -> *const u8;
}
extern "C" {
pub fn BrotliDecoderIsUsed(state: *const BrotliDecoderState) -> libc::c_int;
}
extern "C" {
pub fn BrotliDecoderIsFinished(state: *const BrotliDecoderState) -> libc::c_int;
}
extern "C" {
pub fn BrotliDecoderGetErrorCode(state: *const BrotliDecoderState) -> BrotliDecoderErrorCode;
}
extern "C" {
pub fn BrotliDecoderErrorString(c: BrotliDecoderErrorCode) -> *const libc::c_char;
}
extern "C" {
pub fn BrotliDecoderVersion() -> u32;
}
pub type brotli_decoder_metadata_start_func =
::core::option::Option<unsafe extern "C" fn(opaque: *mut libc::c_void, size: usize)>;
pub type brotli_decoder_metadata_chunk_func = ::core::option::Option<
unsafe extern "C" fn(opaque: *mut libc::c_void, data: *const u8, size: usize),
>;
extern "C" {
pub fn BrotliDecoderSetMetadataCallbacks(
state: *mut BrotliDecoderState,
start_func: brotli_decoder_metadata_start_func,
chunk_func: brotli_decoder_metadata_chunk_func,
opaque: *mut libc::c_void,
);
}