done again

This commit is contained in:
neuecc 2023-02-28 08:08:46 +09:00
parent 7c65b5a72c
commit 7e4e5467af
18 changed files with 152 additions and 485061 deletions

View File

@ -9,15 +9,15 @@ fn main() -> Result<(), Box<dyn Error>> {
//.header("c/lz4/lz4frame.h") //.header("c/lz4/lz4frame.h")
//.header("c/lz4/xxhash.h") //.header("c/lz4/xxhash.h")
.generate()? .generate()?
.write_to_file("src/lz4/mod.rs")?; .write_to_file("src/lz4.rs")?;
// TODO:build this // TODO:build this
// cc::Build::new().file("c/lz4/lz4.c").compile("csharp_lz4"); cc::Build::new().file("c/lz4/lz4.c").compile("lz4");
bindgen::Builder::default() // bindgen::Builder::default()
.header("c/zstd/zstd.h") // .header("c/zstd/zstd.h")
.generate()? // .generate()?
.write_to_file("src/zstd.rs")?; // .write_to_file("src/zstd.rs")?;
// bindgen::Builder::default() // bindgen::Builder::default()
// .header("c/quiche/quiche.h") // .header("c/quiche/quiche.h")
@ -34,34 +34,34 @@ fn main() -> Result<(), Box<dyn Error>> {
// .write_to_file("src/bullet3.rs")?; // .write_to_file("src/bullet3.rs")?;
csbindgen::Builder::new() csbindgen::Builder::new()
.input_bindgen_file("src/lz4/mod.rs") .input_bindgen_file("src/lz4.rs")
.rust_method_prefix("csbindgen_") .rust_method_prefix("csbindgen_")
.rust_file_header("use super::lz4;")
.rust_method_type_path("lz4")
.csharp_class_name("LibLz4") .csharp_class_name("LibLz4")
.csharp_dll_name("liblz4") .csharp_dll_name("liblz4")
.generate_to_file("src/ffi.rs", "../dotnet-sandbox/bindgen.cs")?; .generate_to_file("src/lz4_ffi.rs", "../dotnet-sandbox/lz4_bindgen.cs")?;
csbindgen::Builder::new() // csbindgen::Builder::new()
.input_bindgen_file("src/zstd.rs") // .input_bindgen_file("src/zstd.rs")
.rust_method_prefix("csbindgen_zstd_") // .rust_method_prefix("csbindgen_zstd_")
.csharp_class_name("LibZstd") // .csharp_class_name("LibZstd")
.csharp_dll_name("libzsd") // .csharp_dll_name("libzsd")
.generate_to_file("src/zstd_ffi.rs", "../dotnet-sandbox/zstd_bindgen.cs")?; // .generate_to_file("src/zstd_ffi.rs", "../dotnet-sandbox/zstd_bindgen.cs")?;
// TODO: build failed? // csbindgen::Builder::new()
csbindgen::Builder::new() // .input_bindgen_file("src/quiche.rs")
.input_bindgen_file("src/quiche.rs") // .rust_method_prefix("csbindgen_quiche_")
.rust_method_prefix("csbindgen_quiche_") // .csharp_class_name("LibQuiche")
.csharp_class_name("LibQuiche") // .csharp_dll_name("libquiche")
.csharp_dll_name("libquiche") // .generate_to_file("src/quiche_ffi.rs", "../dotnet-sandbox/quiche_bindgen.cs")?;
.generate_to_file("src/quiche_ffi.rs", "../dotnet-sandbox/quiche_bindgen.cs")?;
// // TODO: build failed? // csbindgen::Builder::new()
csbindgen::Builder::new() // .input_bindgen_file("src/bullet3.rs")
.input_bindgen_file("src/bullet3.rs") // .rust_method_prefix("csbindgen_bullet3_")
.rust_method_prefix("csbindgen_bullet3_") // .csharp_class_name("LibBullet3")
.csharp_class_name("LibBullet3") // .csharp_dll_name("libbullet3")
.csharp_dll_name("libbullet3") // .generate_to_file("src/bullet3_ffi.rs", "../dotnet-sandbox/bullet3_bindgen.cs")?;
.generate_to_file("src/bullet3_ffi.rs", "../dotnet-sandbox/bullet3_bindgen.cs")?;
Ok(()) Ok(())
} }

View File

@ -1,23 +0,0 @@
use std::env;
#[allow(dead_code)]
#[allow(non_snake_case)]
#[allow(non_camel_case_types)]
#[allow(non_upper_case_globals)]
mod lz4;
fn main() {
let path = env::current_dir().unwrap();
println!("starting dir: {}", path.display());
unsafe {
let num = lz4::LZ4_versionNumber();
println!("lz4 num: {}", num);
}
csbindgen::run(
"csbindgen-tests/src/lz4/mod.rs",
"csbindgen-tests/src/ffi.rs",
"dotnet-sandbox/bindgen.cs",
);
}

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -1,13 +1,13 @@
// #[allow(dead_code)] #[allow(dead_code)]
// #[allow(non_snake_case)] #[allow(non_snake_case)]
// #[allow(non_camel_case_types)] #[allow(non_camel_case_types)]
// #[allow(non_upper_case_globals)] #[allow(non_upper_case_globals)]
// mod lz4; mod lz4;
// #[allow(dead_code)] #[allow(dead_code)]
// #[allow(non_snake_case)] #[allow(non_snake_case)]
// #[allow(non_camel_case_types)] #[allow(non_camel_case_types)]
// mod ffi; mod lz4_ffi;
#[test] #[test]
fn build_test() { fn build_test() {

View File

@ -1,9 +1,9 @@
// auto-generated via csbindgen /* automatically generated by csbindgen */
#[allow(unused)] #[allow(unused)]
use ::std::os::raw::*; use ::std::os::raw::*;
use super::lz4;
#[no_mangle] #[no_mangle]
@ -12,7 +12,7 @@ pub extern "C" fn csbindgen_LZ4_versionNumber(
) -> c_int ) -> c_int
{ {
unsafe { unsafe {
return LZ4_versionNumber( return lz4::LZ4_versionNumber(
) )
} }
@ -24,7 +24,7 @@ pub extern "C" fn csbindgen_LZ4_versionString(
) -> *const c_char ) -> *const c_char
{ {
unsafe { unsafe {
return LZ4_versionString( return lz4::LZ4_versionString(
) )
} }
@ -39,7 +39,7 @@ pub extern "C" fn csbindgen_LZ4_compress_default(
) -> c_int ) -> c_int
{ {
unsafe { unsafe {
return LZ4_compress_default( return lz4::LZ4_compress_default(
src, src,
dst, dst,
srcSize, srcSize,
@ -57,7 +57,7 @@ pub extern "C" fn csbindgen_LZ4_decompress_safe(
) -> c_int ) -> c_int
{ {
unsafe { unsafe {
return LZ4_decompress_safe( return lz4::LZ4_decompress_safe(
src, src,
dst, dst,
compressedSize, compressedSize,
@ -72,7 +72,7 @@ pub extern "C" fn csbindgen_LZ4_compressBound(
) -> c_int ) -> c_int
{ {
unsafe { unsafe {
return LZ4_compressBound( return lz4::LZ4_compressBound(
inputSize inputSize
) )
} }
@ -88,7 +88,7 @@ pub extern "C" fn csbindgen_LZ4_compress_fast(
) -> c_int ) -> c_int
{ {
unsafe { unsafe {
return LZ4_compress_fast( return lz4::LZ4_compress_fast(
src, src,
dst, dst,
srcSize, srcSize,
@ -104,7 +104,7 @@ pub extern "C" fn csbindgen_LZ4_sizeofState(
) -> c_int ) -> c_int
{ {
unsafe { unsafe {
return LZ4_sizeofState( return lz4::LZ4_sizeofState(
) )
} }
@ -121,7 +121,7 @@ pub extern "C" fn csbindgen_LZ4_compress_fast_extState(
) -> c_int ) -> c_int
{ {
unsafe { unsafe {
return LZ4_compress_fast_extState( return lz4::LZ4_compress_fast_extState(
state, state,
src, src,
dst, dst,
@ -141,7 +141,7 @@ pub extern "C" fn csbindgen_LZ4_compress_destSize(
) -> c_int ) -> c_int
{ {
unsafe { unsafe {
return LZ4_compress_destSize( return lz4::LZ4_compress_destSize(
src, src,
dst, dst,
srcSizePtr, srcSizePtr,
@ -160,7 +160,7 @@ pub extern "C" fn csbindgen_LZ4_decompress_safe_partial(
) -> c_int ) -> c_int
{ {
unsafe { unsafe {
return LZ4_decompress_safe_partial( return lz4::LZ4_decompress_safe_partial(
src, src,
dst, dst,
srcSize, srcSize,
@ -173,10 +173,10 @@ pub extern "C" fn csbindgen_LZ4_decompress_safe_partial(
#[no_mangle] #[no_mangle]
pub extern "C" fn csbindgen_LZ4_createStream( pub extern "C" fn csbindgen_LZ4_createStream(
) -> *mut LZ4_stream_t ) -> *mut lz4::LZ4_stream_t
{ {
unsafe { unsafe {
return LZ4_createStream( return lz4::LZ4_createStream(
) )
} }
@ -184,11 +184,11 @@ pub extern "C" fn csbindgen_LZ4_createStream(
#[no_mangle] #[no_mangle]
pub extern "C" fn csbindgen_LZ4_freeStream( pub extern "C" fn csbindgen_LZ4_freeStream(
streamPtr: *mut LZ4_stream_t streamPtr: *mut lz4::LZ4_stream_t
) -> c_int ) -> c_int
{ {
unsafe { unsafe {
return LZ4_freeStream( return lz4::LZ4_freeStream(
streamPtr streamPtr
) )
} }
@ -196,11 +196,11 @@ pub extern "C" fn csbindgen_LZ4_freeStream(
#[no_mangle] #[no_mangle]
pub extern "C" fn csbindgen_LZ4_resetStream_fast( pub extern "C" fn csbindgen_LZ4_resetStream_fast(
streamPtr: *mut LZ4_stream_t streamPtr: *mut lz4::LZ4_stream_t
) )
{ {
unsafe { unsafe {
return LZ4_resetStream_fast( return lz4::LZ4_resetStream_fast(
streamPtr streamPtr
) )
} }
@ -208,13 +208,13 @@ pub extern "C" fn csbindgen_LZ4_resetStream_fast(
#[no_mangle] #[no_mangle]
pub extern "C" fn csbindgen_LZ4_loadDict( pub extern "C" fn csbindgen_LZ4_loadDict(
streamPtr: *mut LZ4_stream_t, streamPtr: *mut lz4::LZ4_stream_t,
dictionary: *const c_char, dictionary: *const c_char,
dictSize: c_int dictSize: c_int
) -> c_int ) -> c_int
{ {
unsafe { unsafe {
return LZ4_loadDict( return lz4::LZ4_loadDict(
streamPtr, streamPtr,
dictionary, dictionary,
dictSize dictSize
@ -224,7 +224,7 @@ pub extern "C" fn csbindgen_LZ4_loadDict(
#[no_mangle] #[no_mangle]
pub extern "C" fn csbindgen_LZ4_compress_fast_continue( pub extern "C" fn csbindgen_LZ4_compress_fast_continue(
streamPtr: *mut LZ4_stream_t, streamPtr: *mut lz4::LZ4_stream_t,
src: *const c_char, src: *const c_char,
dst: *mut c_char, dst: *mut c_char,
srcSize: c_int, srcSize: c_int,
@ -233,7 +233,7 @@ pub extern "C" fn csbindgen_LZ4_compress_fast_continue(
) -> c_int ) -> c_int
{ {
unsafe { unsafe {
return LZ4_compress_fast_continue( return lz4::LZ4_compress_fast_continue(
streamPtr, streamPtr,
src, src,
dst, dst,
@ -246,13 +246,13 @@ pub extern "C" fn csbindgen_LZ4_compress_fast_continue(
#[no_mangle] #[no_mangle]
pub extern "C" fn csbindgen_LZ4_saveDict( pub extern "C" fn csbindgen_LZ4_saveDict(
streamPtr: *mut LZ4_stream_t, streamPtr: *mut lz4::LZ4_stream_t,
safeBuffer: *mut c_char, safeBuffer: *mut c_char,
maxDictSize: c_int maxDictSize: c_int
) -> c_int ) -> c_int
{ {
unsafe { unsafe {
return LZ4_saveDict( return lz4::LZ4_saveDict(
streamPtr, streamPtr,
safeBuffer, safeBuffer,
maxDictSize maxDictSize
@ -263,10 +263,10 @@ pub extern "C" fn csbindgen_LZ4_saveDict(
#[no_mangle] #[no_mangle]
pub extern "C" fn csbindgen_LZ4_createStreamDecode( pub extern "C" fn csbindgen_LZ4_createStreamDecode(
) -> *mut LZ4_streamDecode_t ) -> *mut lz4::LZ4_streamDecode_t
{ {
unsafe { unsafe {
return LZ4_createStreamDecode( return lz4::LZ4_createStreamDecode(
) )
} }
@ -274,11 +274,11 @@ pub extern "C" fn csbindgen_LZ4_createStreamDecode(
#[no_mangle] #[no_mangle]
pub extern "C" fn csbindgen_LZ4_freeStreamDecode( pub extern "C" fn csbindgen_LZ4_freeStreamDecode(
LZ4_stream: *mut LZ4_streamDecode_t LZ4_stream: *mut lz4::LZ4_streamDecode_t
) -> c_int ) -> c_int
{ {
unsafe { unsafe {
return LZ4_freeStreamDecode( return lz4::LZ4_freeStreamDecode(
LZ4_stream LZ4_stream
) )
} }
@ -286,13 +286,13 @@ pub extern "C" fn csbindgen_LZ4_freeStreamDecode(
#[no_mangle] #[no_mangle]
pub extern "C" fn csbindgen_LZ4_setStreamDecode( pub extern "C" fn csbindgen_LZ4_setStreamDecode(
LZ4_streamDecode: *mut LZ4_streamDecode_t, LZ4_streamDecode: *mut lz4::LZ4_streamDecode_t,
dictionary: *const c_char, dictionary: *const c_char,
dictSize: c_int dictSize: c_int
) -> c_int ) -> c_int
{ {
unsafe { unsafe {
return LZ4_setStreamDecode( return lz4::LZ4_setStreamDecode(
LZ4_streamDecode, LZ4_streamDecode,
dictionary, dictionary,
dictSize dictSize
@ -306,7 +306,7 @@ pub extern "C" fn csbindgen_LZ4_decoderRingBufferSize(
) -> c_int ) -> c_int
{ {
unsafe { unsafe {
return LZ4_decoderRingBufferSize( return lz4::LZ4_decoderRingBufferSize(
maxBlockSize maxBlockSize
) )
} }
@ -314,7 +314,7 @@ pub extern "C" fn csbindgen_LZ4_decoderRingBufferSize(
#[no_mangle] #[no_mangle]
pub extern "C" fn csbindgen_LZ4_decompress_safe_continue( pub extern "C" fn csbindgen_LZ4_decompress_safe_continue(
LZ4_streamDecode: *mut LZ4_streamDecode_t, LZ4_streamDecode: *mut lz4::LZ4_streamDecode_t,
src: *const c_char, src: *const c_char,
dst: *mut c_char, dst: *mut c_char,
srcSize: c_int, srcSize: c_int,
@ -322,7 +322,7 @@ pub extern "C" fn csbindgen_LZ4_decompress_safe_continue(
) -> c_int ) -> c_int
{ {
unsafe { unsafe {
return LZ4_decompress_safe_continue( return lz4::LZ4_decompress_safe_continue(
LZ4_streamDecode, LZ4_streamDecode,
src, src,
dst, dst,
@ -343,7 +343,7 @@ pub extern "C" fn csbindgen_LZ4_decompress_safe_usingDict(
) -> c_int ) -> c_int
{ {
unsafe { unsafe {
return LZ4_decompress_safe_usingDict( return lz4::LZ4_decompress_safe_usingDict(
src, src,
dst, dst,
srcSize, srcSize,
@ -366,7 +366,7 @@ pub extern "C" fn csbindgen_LZ4_decompress_safe_partial_usingDict(
) -> c_int ) -> c_int
{ {
unsafe { unsafe {
return LZ4_decompress_safe_partial_usingDict( return lz4::LZ4_decompress_safe_partial_usingDict(
src, src,
dst, dst,
compressedSize, compressedSize,
@ -378,50 +378,14 @@ pub extern "C" fn csbindgen_LZ4_decompress_safe_partial_usingDict(
} }
} }
#[no_mangle]
pub extern "C" fn csbindgen___va_start(
arg1: *mut *mut c_char
)
{
unsafe {
return __va_start(
arg1
)
}
}
#[no_mangle]
pub extern "C" fn csbindgen___security_init_cookie(
)
{
unsafe {
return __security_init_cookie(
)
}
}
#[no_mangle]
pub extern "C" fn csbindgen___security_check_cookie(
_StackCookie: usize
)
{
unsafe {
return __security_check_cookie(
_StackCookie
)
}
}
#[no_mangle] #[no_mangle]
pub extern "C" fn csbindgen_LZ4_initStream( pub extern "C" fn csbindgen_LZ4_initStream(
buffer: *mut c_void, buffer: *mut c_void,
size: usize size: usize
) -> *mut LZ4_stream_t ) -> *mut lz4::LZ4_stream_t
{ {
unsafe { unsafe {
return LZ4_initStream( return lz4::LZ4_initStream(
buffer, buffer,
size size
) )
@ -436,7 +400,7 @@ pub extern "C" fn csbindgen_LZ4_compress(
) -> c_int ) -> c_int
{ {
unsafe { unsafe {
return LZ4_compress( return lz4::LZ4_compress(
src, src,
dest, dest,
srcSize srcSize
@ -453,7 +417,7 @@ pub extern "C" fn csbindgen_LZ4_compress_limitedOutput(
) -> c_int ) -> c_int
{ {
unsafe { unsafe {
return LZ4_compress_limitedOutput( return lz4::LZ4_compress_limitedOutput(
src, src,
dest, dest,
srcSize, srcSize,
@ -471,7 +435,7 @@ pub extern "C" fn csbindgen_LZ4_compress_withState(
) -> c_int ) -> c_int
{ {
unsafe { unsafe {
return LZ4_compress_withState( return lz4::LZ4_compress_withState(
state, state,
source, source,
dest, dest,
@ -490,7 +454,7 @@ pub extern "C" fn csbindgen_LZ4_compress_limitedOutput_withState(
) -> c_int ) -> c_int
{ {
unsafe { unsafe {
return LZ4_compress_limitedOutput_withState( return lz4::LZ4_compress_limitedOutput_withState(
state, state,
source, source,
dest, dest,
@ -502,14 +466,14 @@ pub extern "C" fn csbindgen_LZ4_compress_limitedOutput_withState(
#[no_mangle] #[no_mangle]
pub extern "C" fn csbindgen_LZ4_compress_continue( pub extern "C" fn csbindgen_LZ4_compress_continue(
LZ4_streamPtr: *mut LZ4_stream_t, LZ4_streamPtr: *mut lz4::LZ4_stream_t,
source: *const c_char, source: *const c_char,
dest: *mut c_char, dest: *mut c_char,
inputSize: c_int inputSize: c_int
) -> c_int ) -> c_int
{ {
unsafe { unsafe {
return LZ4_compress_continue( return lz4::LZ4_compress_continue(
LZ4_streamPtr, LZ4_streamPtr,
source, source,
dest, dest,
@ -520,7 +484,7 @@ pub extern "C" fn csbindgen_LZ4_compress_continue(
#[no_mangle] #[no_mangle]
pub extern "C" fn csbindgen_LZ4_compress_limitedOutput_continue( pub extern "C" fn csbindgen_LZ4_compress_limitedOutput_continue(
LZ4_streamPtr: *mut LZ4_stream_t, LZ4_streamPtr: *mut lz4::LZ4_stream_t,
source: *const c_char, source: *const c_char,
dest: *mut c_char, dest: *mut c_char,
inputSize: c_int, inputSize: c_int,
@ -528,7 +492,7 @@ pub extern "C" fn csbindgen_LZ4_compress_limitedOutput_continue(
) -> c_int ) -> c_int
{ {
unsafe { unsafe {
return LZ4_compress_limitedOutput_continue( return lz4::LZ4_compress_limitedOutput_continue(
LZ4_streamPtr, LZ4_streamPtr,
source, source,
dest, dest,
@ -546,7 +510,7 @@ pub extern "C" fn csbindgen_LZ4_uncompress(
) -> c_int ) -> c_int
{ {
unsafe { unsafe {
return LZ4_uncompress( return lz4::LZ4_uncompress(
source, source,
dest, dest,
outputSize outputSize
@ -563,7 +527,7 @@ pub extern "C" fn csbindgen_LZ4_uncompress_unknownOutputSize(
) -> c_int ) -> c_int
{ {
unsafe { unsafe {
return LZ4_uncompress_unknownOutputSize( return lz4::LZ4_uncompress_unknownOutputSize(
source, source,
dest, dest,
isize_, isize_,
@ -578,7 +542,7 @@ pub extern "C" fn csbindgen_LZ4_create(
) -> *mut c_void ) -> *mut c_void
{ {
unsafe { unsafe {
return LZ4_create( return lz4::LZ4_create(
inputBuffer inputBuffer
) )
} }
@ -590,7 +554,7 @@ pub extern "C" fn csbindgen_LZ4_sizeofStreamState(
) -> c_int ) -> c_int
{ {
unsafe { unsafe {
return LZ4_sizeofStreamState( return lz4::LZ4_sizeofStreamState(
) )
} }
@ -603,7 +567,7 @@ pub extern "C" fn csbindgen_LZ4_resetStreamState(
) -> c_int ) -> c_int
{ {
unsafe { unsafe {
return LZ4_resetStreamState( return lz4::LZ4_resetStreamState(
state, state,
inputBuffer inputBuffer
) )
@ -616,7 +580,7 @@ pub extern "C" fn csbindgen_LZ4_slideInputBuffer(
) -> *mut c_char ) -> *mut c_char
{ {
unsafe { unsafe {
return LZ4_slideInputBuffer( return lz4::LZ4_slideInputBuffer(
state state
) )
} }
@ -631,7 +595,7 @@ pub extern "C" fn csbindgen_LZ4_decompress_safe_withPrefix64k(
) -> c_int ) -> c_int
{ {
unsafe { unsafe {
return LZ4_decompress_safe_withPrefix64k( return lz4::LZ4_decompress_safe_withPrefix64k(
src, src,
dst, dst,
compressedSize, compressedSize,
@ -648,7 +612,7 @@ pub extern "C" fn csbindgen_LZ4_decompress_fast_withPrefix64k(
) -> c_int ) -> c_int
{ {
unsafe { unsafe {
return LZ4_decompress_fast_withPrefix64k( return lz4::LZ4_decompress_fast_withPrefix64k(
src, src,
dst, dst,
originalSize originalSize
@ -664,7 +628,7 @@ pub extern "C" fn csbindgen_LZ4_decompress_fast(
) -> c_int ) -> c_int
{ {
unsafe { unsafe {
return LZ4_decompress_fast( return lz4::LZ4_decompress_fast(
src, src,
dst, dst,
originalSize originalSize
@ -674,14 +638,14 @@ pub extern "C" fn csbindgen_LZ4_decompress_fast(
#[no_mangle] #[no_mangle]
pub extern "C" fn csbindgen_LZ4_decompress_fast_continue( pub extern "C" fn csbindgen_LZ4_decompress_fast_continue(
LZ4_streamDecode: *mut LZ4_streamDecode_t, LZ4_streamDecode: *mut lz4::LZ4_streamDecode_t,
src: *const c_char, src: *const c_char,
dst: *mut c_char, dst: *mut c_char,
originalSize: c_int originalSize: c_int
) -> c_int ) -> c_int
{ {
unsafe { unsafe {
return LZ4_decompress_fast_continue( return lz4::LZ4_decompress_fast_continue(
LZ4_streamDecode, LZ4_streamDecode,
src, src,
dst, dst,
@ -700,7 +664,7 @@ pub extern "C" fn csbindgen_LZ4_decompress_fast_usingDict(
) -> c_int ) -> c_int
{ {
unsafe { unsafe {
return LZ4_decompress_fast_usingDict( return lz4::LZ4_decompress_fast_usingDict(
src, src,
dst, dst,
originalSize, originalSize,
@ -712,11 +676,11 @@ pub extern "C" fn csbindgen_LZ4_decompress_fast_usingDict(
#[no_mangle] #[no_mangle]
pub extern "C" fn csbindgen_LZ4_resetStream( pub extern "C" fn csbindgen_LZ4_resetStream(
streamPtr: *mut LZ4_stream_t streamPtr: *mut lz4::LZ4_stream_t
) )
{ {
unsafe { unsafe {
return LZ4_resetStream( return lz4::LZ4_resetStream(
streamPtr streamPtr
) )
} }

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -1,688 +0,0 @@
/* automatically generated by rust-bindgen 0.64.0 */
pub const _VCRT_COMPILER_PREPROCESSOR: u32 = 1;
pub const _SAL_VERSION: u32 = 20;
pub const __SAL_H_VERSION: u32 = 180000000;
pub const _USE_DECLSPECS_FOR_SAL: u32 = 0;
pub const _USE_ATTRIBUTES_FOR_SAL: u32 = 0;
pub const _CRT_PACKING: u32 = 8;
pub const _HAS_EXCEPTIONS: u32 = 1;
pub const _STL_LANG: u32 = 0;
pub const _HAS_CXX17: u32 = 0;
pub const _HAS_CXX20: u32 = 0;
pub const _HAS_CXX23: u32 = 0;
pub const _HAS_NODISCARD: u32 = 0;
pub const CHAR_BIT: u32 = 8;
pub const SCHAR_MIN: i32 = -128;
pub const SCHAR_MAX: u32 = 127;
pub const UCHAR_MAX: u32 = 255;
pub const CHAR_MIN: i32 = -128;
pub const CHAR_MAX: u32 = 127;
pub const MB_LEN_MAX: u32 = 5;
pub const SHRT_MIN: i32 = -32768;
pub const SHRT_MAX: u32 = 32767;
pub const USHRT_MAX: u32 = 65535;
pub const INT_MIN: i32 = -2147483648;
pub const INT_MAX: u32 = 2147483647;
pub const UINT_MAX: u32 = 4294967295;
pub const LONG_MIN: i32 = -2147483648;
pub const LONG_MAX: u32 = 2147483647;
pub const ULONG_MAX: u32 = 4294967295;
pub const ZSTD_VERSION_MAJOR: u32 = 1;
pub const ZSTD_VERSION_MINOR: u32 = 5;
pub const ZSTD_VERSION_RELEASE: u32 = 4;
pub const ZSTD_VERSION_NUMBER: u32 = 10504;
pub const ZSTD_CLEVEL_DEFAULT: u32 = 3;
pub const ZSTD_MAGICNUMBER: u32 = 4247762216;
pub const ZSTD_MAGIC_DICTIONARY: u32 = 3962610743;
pub const ZSTD_MAGIC_SKIPPABLE_START: u32 = 407710288;
pub const ZSTD_MAGIC_SKIPPABLE_MASK: u32 = 4294967280;
pub const ZSTD_BLOCKSIZELOG_MAX: u32 = 17;
pub const ZSTD_BLOCKSIZE_MAX: u32 = 131072;
pub const ZSTD_CONTENTSIZE_UNKNOWN: i32 = -1;
pub const ZSTD_CONTENTSIZE_ERROR: i32 = -2;
pub type va_list = *mut ::std::os::raw::c_char;
extern "C" {
pub fn __va_start(arg1: *mut *mut ::std::os::raw::c_char, ...);
}
pub type __vcrt_bool = bool;
pub type wchar_t = ::std::os::raw::c_ushort;
extern "C" {
pub fn __security_init_cookie();
}
extern "C" {
pub fn __security_check_cookie(_StackCookie: usize);
}
extern "C" {
pub fn __report_gsfailure(_StackCookie: usize) -> !;
}
extern "C" {
pub static mut __security_cookie: usize;
}
pub type max_align_t = f64;
extern "C" {
#[doc = " ZSTD_versionNumber() :\n Return runtime library version, the value is (MAJOR*100*100 + MINOR*100 + RELEASE)."]
pub fn ZSTD_versionNumber() -> ::std::os::raw::c_uint;
}
extern "C" {
#[doc = " ZSTD_versionString() :\n Return runtime library version, like \"1.4.5\". Requires v1.3.0+."]
pub fn ZSTD_versionString() -> *const ::std::os::raw::c_char;
}
extern "C" {
#[doc = " Simple API\n/\n/*! ZSTD_compress() :\n Compresses `src` content as a single zstd compressed frame into already allocated `dst`.\n Hint : compression runs faster if `dstCapacity` >= `ZSTD_compressBound(srcSize)`.\n @return : compressed size written into `dst` (<= `dstCapacity),\n or an error code if it fails (which can be tested using ZSTD_isError())."]
pub fn ZSTD_compress(
dst: *mut ::std::os::raw::c_void,
dstCapacity: usize,
src: *const ::std::os::raw::c_void,
srcSize: usize,
compressionLevel: ::std::os::raw::c_int,
) -> usize;
}
extern "C" {
#[doc = " ZSTD_decompress() :\n `compressedSize` : must be the _exact_ size of some number of compressed and/or skippable frames.\n `dstCapacity` is an upper bound of originalSize to regenerate.\n If user cannot imply a maximum upper bound, it's better to use streaming mode to decompress data.\n @return : the number of bytes decompressed into `dst` (<= `dstCapacity`),\n or an errorCode if it fails (which can be tested using ZSTD_isError())."]
pub fn ZSTD_decompress(
dst: *mut ::std::os::raw::c_void,
dstCapacity: usize,
src: *const ::std::os::raw::c_void,
compressedSize: usize,
) -> usize;
}
extern "C" {
pub fn ZSTD_getFrameContentSize(
src: *const ::std::os::raw::c_void,
srcSize: usize,
) -> ::std::os::raw::c_ulonglong;
}
extern "C" {
#[doc = " ZSTD_getDecompressedSize() :\n NOTE: This function is now obsolete, in favor of ZSTD_getFrameContentSize().\n Both functions work the same way, but ZSTD_getDecompressedSize() blends\n \"empty\", \"unknown\" and \"error\" results to the same return value (0),\n while ZSTD_getFrameContentSize() gives them separate return values.\n @return : decompressed size of `src` frame content _if known and not empty_, 0 otherwise."]
pub fn ZSTD_getDecompressedSize(
src: *const ::std::os::raw::c_void,
srcSize: usize,
) -> ::std::os::raw::c_ulonglong;
}
extern "C" {
#[doc = " ZSTD_findFrameCompressedSize() : Requires v1.4.0+\n `src` should point to the start of a ZSTD frame or skippable frame.\n `srcSize` must be >= first frame size\n @return : the compressed size of the first frame starting at `src`,\n suitable to pass as `srcSize` to `ZSTD_decompress` or similar,\n or an error code if input is invalid"]
pub fn ZSTD_findFrameCompressedSize(
src: *const ::std::os::raw::c_void,
srcSize: usize,
) -> usize;
}
extern "C" {
pub fn ZSTD_compressBound(srcSize: usize) -> usize;
}
extern "C" {
pub fn ZSTD_isError(code: usize) -> ::std::os::raw::c_uint;
}
extern "C" {
pub fn ZSTD_getErrorName(code: usize) -> *const ::std::os::raw::c_char;
}
extern "C" {
pub fn ZSTD_minCLevel() -> ::std::os::raw::c_int;
}
extern "C" {
pub fn ZSTD_maxCLevel() -> ::std::os::raw::c_int;
}
extern "C" {
pub fn ZSTD_defaultCLevel() -> ::std::os::raw::c_int;
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct ZSTD_CCtx_s {
_unused: [u8; 0],
}
#[doc = " Explicit context"]
pub type ZSTD_CCtx = ZSTD_CCtx_s;
extern "C" {
pub fn ZSTD_createCCtx() -> *mut ZSTD_CCtx;
}
extern "C" {
pub fn ZSTD_freeCCtx(cctx: *mut ZSTD_CCtx) -> usize;
}
extern "C" {
#[doc = " ZSTD_compressCCtx() :\n Same as ZSTD_compress(), using an explicit ZSTD_CCtx.\n Important : in order to behave similarly to `ZSTD_compress()`,\n this function compresses at requested compression level,\n __ignoring any other parameter__ .\n If any advanced parameter was set using the advanced API,\n they will all be reset. Only `compressionLevel` remains."]
pub fn ZSTD_compressCCtx(
cctx: *mut ZSTD_CCtx,
dst: *mut ::std::os::raw::c_void,
dstCapacity: usize,
src: *const ::std::os::raw::c_void,
srcSize: usize,
compressionLevel: ::std::os::raw::c_int,
) -> usize;
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct ZSTD_DCtx_s {
_unused: [u8; 0],
}
pub type ZSTD_DCtx = ZSTD_DCtx_s;
extern "C" {
pub fn ZSTD_createDCtx() -> *mut ZSTD_DCtx;
}
extern "C" {
pub fn ZSTD_freeDCtx(dctx: *mut ZSTD_DCtx) -> usize;
}
extern "C" {
#[doc = " ZSTD_decompressDCtx() :\n Same as ZSTD_decompress(),\n requires an allocated ZSTD_DCtx.\n Compatible with sticky parameters."]
pub fn ZSTD_decompressDCtx(
dctx: *mut ZSTD_DCtx,
dst: *mut ::std::os::raw::c_void,
dstCapacity: usize,
src: *const ::std::os::raw::c_void,
srcSize: usize,
) -> usize;
}
pub const ZSTD_strategy_ZSTD_fast: ZSTD_strategy = 1;
pub const ZSTD_strategy_ZSTD_dfast: ZSTD_strategy = 2;
pub const ZSTD_strategy_ZSTD_greedy: ZSTD_strategy = 3;
pub const ZSTD_strategy_ZSTD_lazy: ZSTD_strategy = 4;
pub const ZSTD_strategy_ZSTD_lazy2: ZSTD_strategy = 5;
pub const ZSTD_strategy_ZSTD_btlazy2: ZSTD_strategy = 6;
pub const ZSTD_strategy_ZSTD_btopt: ZSTD_strategy = 7;
pub const ZSTD_strategy_ZSTD_btultra: ZSTD_strategy = 8;
pub const ZSTD_strategy_ZSTD_btultra2: ZSTD_strategy = 9;
#[doc = " Advanced compression API (Requires v1.4.0+)"]
pub type ZSTD_strategy = ::std::os::raw::c_int;
pub const ZSTD_cParameter_ZSTD_c_compressionLevel: ZSTD_cParameter = 100;
pub const ZSTD_cParameter_ZSTD_c_windowLog: ZSTD_cParameter = 101;
pub const ZSTD_cParameter_ZSTD_c_hashLog: ZSTD_cParameter = 102;
pub const ZSTD_cParameter_ZSTD_c_chainLog: ZSTD_cParameter = 103;
pub const ZSTD_cParameter_ZSTD_c_searchLog: ZSTD_cParameter = 104;
pub const ZSTD_cParameter_ZSTD_c_minMatch: ZSTD_cParameter = 105;
pub const ZSTD_cParameter_ZSTD_c_targetLength: ZSTD_cParameter = 106;
pub const ZSTD_cParameter_ZSTD_c_strategy: ZSTD_cParameter = 107;
pub const ZSTD_cParameter_ZSTD_c_enableLongDistanceMatching: ZSTD_cParameter = 160;
pub const ZSTD_cParameter_ZSTD_c_ldmHashLog: ZSTD_cParameter = 161;
pub const ZSTD_cParameter_ZSTD_c_ldmMinMatch: ZSTD_cParameter = 162;
pub const ZSTD_cParameter_ZSTD_c_ldmBucketSizeLog: ZSTD_cParameter = 163;
pub const ZSTD_cParameter_ZSTD_c_ldmHashRateLog: ZSTD_cParameter = 164;
pub const ZSTD_cParameter_ZSTD_c_contentSizeFlag: ZSTD_cParameter = 200;
pub const ZSTD_cParameter_ZSTD_c_checksumFlag: ZSTD_cParameter = 201;
pub const ZSTD_cParameter_ZSTD_c_dictIDFlag: ZSTD_cParameter = 202;
pub const ZSTD_cParameter_ZSTD_c_nbWorkers: ZSTD_cParameter = 400;
pub const ZSTD_cParameter_ZSTD_c_jobSize: ZSTD_cParameter = 401;
pub const ZSTD_cParameter_ZSTD_c_overlapLog: ZSTD_cParameter = 402;
pub const ZSTD_cParameter_ZSTD_c_experimentalParam1: ZSTD_cParameter = 500;
pub const ZSTD_cParameter_ZSTD_c_experimentalParam2: ZSTD_cParameter = 10;
pub const ZSTD_cParameter_ZSTD_c_experimentalParam3: ZSTD_cParameter = 1000;
pub const ZSTD_cParameter_ZSTD_c_experimentalParam4: ZSTD_cParameter = 1001;
pub const ZSTD_cParameter_ZSTD_c_experimentalParam5: ZSTD_cParameter = 1002;
pub const ZSTD_cParameter_ZSTD_c_experimentalParam6: ZSTD_cParameter = 1003;
pub const ZSTD_cParameter_ZSTD_c_experimentalParam7: ZSTD_cParameter = 1004;
pub const ZSTD_cParameter_ZSTD_c_experimentalParam8: ZSTD_cParameter = 1005;
pub const ZSTD_cParameter_ZSTD_c_experimentalParam9: ZSTD_cParameter = 1006;
pub const ZSTD_cParameter_ZSTD_c_experimentalParam10: ZSTD_cParameter = 1007;
pub const ZSTD_cParameter_ZSTD_c_experimentalParam11: ZSTD_cParameter = 1008;
pub const ZSTD_cParameter_ZSTD_c_experimentalParam12: ZSTD_cParameter = 1009;
pub const ZSTD_cParameter_ZSTD_c_experimentalParam13: ZSTD_cParameter = 1010;
pub const ZSTD_cParameter_ZSTD_c_experimentalParam14: ZSTD_cParameter = 1011;
pub const ZSTD_cParameter_ZSTD_c_experimentalParam15: ZSTD_cParameter = 1012;
pub const ZSTD_cParameter_ZSTD_c_experimentalParam16: ZSTD_cParameter = 1013;
pub const ZSTD_cParameter_ZSTD_c_experimentalParam17: ZSTD_cParameter = 1014;
pub const ZSTD_cParameter_ZSTD_c_experimentalParam18: ZSTD_cParameter = 1015;
pub const ZSTD_cParameter_ZSTD_c_experimentalParam19: ZSTD_cParameter = 1016;
pub type ZSTD_cParameter = ::std::os::raw::c_int;
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct ZSTD_bounds {
pub error: usize,
pub lowerBound: ::std::os::raw::c_int,
pub upperBound: ::std::os::raw::c_int,
}
#[test]
fn bindgen_test_layout_ZSTD_bounds() {
const UNINIT: ::std::mem::MaybeUninit<ZSTD_bounds> = ::std::mem::MaybeUninit::uninit();
let ptr = UNINIT.as_ptr();
assert_eq!(
::std::mem::size_of::<ZSTD_bounds>(),
16usize,
concat!("Size of: ", stringify!(ZSTD_bounds))
);
assert_eq!(
::std::mem::align_of::<ZSTD_bounds>(),
8usize,
concat!("Alignment of ", stringify!(ZSTD_bounds))
);
assert_eq!(
unsafe { ::std::ptr::addr_of!((*ptr).error) as usize - ptr as usize },
0usize,
concat!(
"Offset of field: ",
stringify!(ZSTD_bounds),
"::",
stringify!(error)
)
);
assert_eq!(
unsafe { ::std::ptr::addr_of!((*ptr).lowerBound) as usize - ptr as usize },
8usize,
concat!(
"Offset of field: ",
stringify!(ZSTD_bounds),
"::",
stringify!(lowerBound)
)
);
assert_eq!(
unsafe { ::std::ptr::addr_of!((*ptr).upperBound) as usize - ptr as usize },
12usize,
concat!(
"Offset of field: ",
stringify!(ZSTD_bounds),
"::",
stringify!(upperBound)
)
);
}
extern "C" {
#[doc = " ZSTD_cParam_getBounds() :\n All parameters must belong to an interval with lower and upper bounds,\n otherwise they will either trigger an error or be automatically clamped.\n @return : a structure, ZSTD_bounds, which contains\n - an error status field, which must be tested using ZSTD_isError()\n - lower and upper bounds, both inclusive"]
pub fn ZSTD_cParam_getBounds(cParam: ZSTD_cParameter) -> ZSTD_bounds;
}
extern "C" {
#[doc = " ZSTD_CCtx_setParameter() :\n Set one compression parameter, selected by enum ZSTD_cParameter.\n All parameters have valid bounds. Bounds can be queried using ZSTD_cParam_getBounds().\n Providing a value beyond bound will either clamp it, or trigger an error (depending on parameter).\n Setting a parameter is generally only possible during frame initialization (before starting compression).\n Exception : when using multi-threading mode (nbWorkers >= 1),\n the following parameters can be updated _during_ compression (within same frame):\n => compressionLevel, hashLog, chainLog, searchLog, minMatch, targetLength and strategy.\n new parameters will be active for next job only (after a flush()).\n @return : an error code (which can be tested using ZSTD_isError())."]
pub fn ZSTD_CCtx_setParameter(
cctx: *mut ZSTD_CCtx,
param: ZSTD_cParameter,
value: ::std::os::raw::c_int,
) -> usize;
}
extern "C" {
#[doc = " ZSTD_CCtx_setPledgedSrcSize() :\n Total input data size to be compressed as a single frame.\n Value will be written in frame header, unless if explicitly forbidden using ZSTD_c_contentSizeFlag.\n This value will also be controlled at end of frame, and trigger an error if not respected.\n @result : 0, or an error code (which can be tested with ZSTD_isError()).\n Note 1 : pledgedSrcSize==0 actually means zero, aka an empty frame.\n In order to mean \"unknown content size\", pass constant ZSTD_CONTENTSIZE_UNKNOWN.\n ZSTD_CONTENTSIZE_UNKNOWN is default value for any new frame.\n Note 2 : pledgedSrcSize is only valid once, for the next frame.\n It's discarded at the end of the frame, and replaced by ZSTD_CONTENTSIZE_UNKNOWN.\n Note 3 : Whenever all input data is provided and consumed in a single round,\n for example with ZSTD_compress2(),\n or invoking immediately ZSTD_compressStream2(,,,ZSTD_e_end),\n this value is automatically overridden by srcSize instead."]
pub fn ZSTD_CCtx_setPledgedSrcSize(
cctx: *mut ZSTD_CCtx,
pledgedSrcSize: ::std::os::raw::c_ulonglong,
) -> usize;
}
pub const ZSTD_ResetDirective_ZSTD_reset_session_only: ZSTD_ResetDirective = 1;
pub const ZSTD_ResetDirective_ZSTD_reset_parameters: ZSTD_ResetDirective = 2;
pub const ZSTD_ResetDirective_ZSTD_reset_session_and_parameters: ZSTD_ResetDirective = 3;
pub type ZSTD_ResetDirective = ::std::os::raw::c_int;
extern "C" {
#[doc = " ZSTD_CCtx_reset() :\n There are 2 different things that can be reset, independently or jointly :\n - The session : will stop compressing current frame, and make CCtx ready to start a new one.\n Useful after an error, or to interrupt any ongoing compression.\n Any internal data not yet flushed is cancelled.\n Compression parameters and dictionary remain unchanged.\n They will be used to compress next frame.\n Resetting session never fails.\n - The parameters : changes all parameters back to \"default\".\n This also removes any reference to any dictionary or external sequence producer.\n Parameters can only be changed between 2 sessions (i.e. no compression is currently ongoing)\n otherwise the reset fails, and function returns an error value (which can be tested using ZSTD_isError())\n - Both : similar to resetting the session, followed by resetting parameters."]
pub fn ZSTD_CCtx_reset(cctx: *mut ZSTD_CCtx, reset: ZSTD_ResetDirective) -> usize;
}
extern "C" {
#[doc = " ZSTD_compress2() :\n Behave the same as ZSTD_compressCCtx(), but compression parameters are set using the advanced API.\n ZSTD_compress2() always starts a new frame.\n Should cctx hold data from a previously unfinished frame, everything about it is forgotten.\n - Compression parameters are pushed into CCtx before starting compression, using ZSTD_CCtx_set*()\n - The function is always blocking, returns when compression is completed.\n Hint : compression runs faster if `dstCapacity` >= `ZSTD_compressBound(srcSize)`.\n @return : compressed size written into `dst` (<= `dstCapacity),\n or an error code if it fails (which can be tested using ZSTD_isError())."]
pub fn ZSTD_compress2(
cctx: *mut ZSTD_CCtx,
dst: *mut ::std::os::raw::c_void,
dstCapacity: usize,
src: *const ::std::os::raw::c_void,
srcSize: usize,
) -> usize;
}
pub const ZSTD_dParameter_ZSTD_d_windowLogMax: ZSTD_dParameter = 100;
pub const ZSTD_dParameter_ZSTD_d_experimentalParam1: ZSTD_dParameter = 1000;
pub const ZSTD_dParameter_ZSTD_d_experimentalParam2: ZSTD_dParameter = 1001;
pub const ZSTD_dParameter_ZSTD_d_experimentalParam3: ZSTD_dParameter = 1002;
pub const ZSTD_dParameter_ZSTD_d_experimentalParam4: ZSTD_dParameter = 1003;
pub const ZSTD_dParameter_ZSTD_d_experimentalParam5: ZSTD_dParameter = 1004;
#[doc = " Advanced decompression API (Requires v1.4.0+)"]
pub type ZSTD_dParameter = ::std::os::raw::c_int;
extern "C" {
#[doc = " ZSTD_dParam_getBounds() :\n All parameters must belong to an interval with lower and upper bounds,\n otherwise they will either trigger an error or be automatically clamped.\n @return : a structure, ZSTD_bounds, which contains\n - an error status field, which must be tested using ZSTD_isError()\n - both lower and upper bounds, inclusive"]
pub fn ZSTD_dParam_getBounds(dParam: ZSTD_dParameter) -> ZSTD_bounds;
}
extern "C" {
#[doc = " ZSTD_DCtx_setParameter() :\n Set one compression parameter, selected by enum ZSTD_dParameter.\n All parameters have valid bounds. Bounds can be queried using ZSTD_dParam_getBounds().\n Providing a value beyond bound will either clamp it, or trigger an error (depending on parameter).\n Setting a parameter is only possible during frame initialization (before starting decompression).\n @return : 0, or an error code (which can be tested using ZSTD_isError())."]
pub fn ZSTD_DCtx_setParameter(
dctx: *mut ZSTD_DCtx,
param: ZSTD_dParameter,
value: ::std::os::raw::c_int,
) -> usize;
}
extern "C" {
#[doc = " ZSTD_DCtx_reset() :\n Return a DCtx to clean state.\n Session and parameters can be reset jointly or separately.\n Parameters can only be reset when no active frame is being decompressed.\n @return : 0, or an error code, which can be tested with ZSTD_isError()"]
pub fn ZSTD_DCtx_reset(dctx: *mut ZSTD_DCtx, reset: ZSTD_ResetDirective) -> usize;
}
#[doc = " Streaming"]
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct ZSTD_inBuffer_s {
#[doc = "< start of input buffer"]
pub src: *const ::std::os::raw::c_void,
#[doc = "< size of input buffer"]
pub size: usize,
#[doc = "< position where reading stopped. Will be updated. Necessarily 0 <= pos <= size"]
pub pos: usize,
}
#[test]
fn bindgen_test_layout_ZSTD_inBuffer_s() {
const UNINIT: ::std::mem::MaybeUninit<ZSTD_inBuffer_s> = ::std::mem::MaybeUninit::uninit();
let ptr = UNINIT.as_ptr();
assert_eq!(
::std::mem::size_of::<ZSTD_inBuffer_s>(),
24usize,
concat!("Size of: ", stringify!(ZSTD_inBuffer_s))
);
assert_eq!(
::std::mem::align_of::<ZSTD_inBuffer_s>(),
8usize,
concat!("Alignment of ", stringify!(ZSTD_inBuffer_s))
);
assert_eq!(
unsafe { ::std::ptr::addr_of!((*ptr).src) as usize - ptr as usize },
0usize,
concat!(
"Offset of field: ",
stringify!(ZSTD_inBuffer_s),
"::",
stringify!(src)
)
);
assert_eq!(
unsafe { ::std::ptr::addr_of!((*ptr).size) as usize - ptr as usize },
8usize,
concat!(
"Offset of field: ",
stringify!(ZSTD_inBuffer_s),
"::",
stringify!(size)
)
);
assert_eq!(
unsafe { ::std::ptr::addr_of!((*ptr).pos) as usize - ptr as usize },
16usize,
concat!(
"Offset of field: ",
stringify!(ZSTD_inBuffer_s),
"::",
stringify!(pos)
)
);
}
#[doc = " Streaming"]
pub type ZSTD_inBuffer = ZSTD_inBuffer_s;
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct ZSTD_outBuffer_s {
#[doc = "< start of output buffer"]
pub dst: *mut ::std::os::raw::c_void,
#[doc = "< size of output buffer"]
pub size: usize,
#[doc = "< position where writing stopped. Will be updated. Necessarily 0 <= pos <= size"]
pub pos: usize,
}
#[test]
fn bindgen_test_layout_ZSTD_outBuffer_s() {
const UNINIT: ::std::mem::MaybeUninit<ZSTD_outBuffer_s> = ::std::mem::MaybeUninit::uninit();
let ptr = UNINIT.as_ptr();
assert_eq!(
::std::mem::size_of::<ZSTD_outBuffer_s>(),
24usize,
concat!("Size of: ", stringify!(ZSTD_outBuffer_s))
);
assert_eq!(
::std::mem::align_of::<ZSTD_outBuffer_s>(),
8usize,
concat!("Alignment of ", stringify!(ZSTD_outBuffer_s))
);
assert_eq!(
unsafe { ::std::ptr::addr_of!((*ptr).dst) as usize - ptr as usize },
0usize,
concat!(
"Offset of field: ",
stringify!(ZSTD_outBuffer_s),
"::",
stringify!(dst)
)
);
assert_eq!(
unsafe { ::std::ptr::addr_of!((*ptr).size) as usize - ptr as usize },
8usize,
concat!(
"Offset of field: ",
stringify!(ZSTD_outBuffer_s),
"::",
stringify!(size)
)
);
assert_eq!(
unsafe { ::std::ptr::addr_of!((*ptr).pos) as usize - ptr as usize },
16usize,
concat!(
"Offset of field: ",
stringify!(ZSTD_outBuffer_s),
"::",
stringify!(pos)
)
);
}
pub type ZSTD_outBuffer = ZSTD_outBuffer_s;
pub type ZSTD_CStream = ZSTD_CCtx;
extern "C" {
pub fn ZSTD_createCStream() -> *mut ZSTD_CStream;
}
extern "C" {
pub fn ZSTD_freeCStream(zcs: *mut ZSTD_CStream) -> usize;
}
pub const ZSTD_EndDirective_ZSTD_e_continue: ZSTD_EndDirective = 0;
pub const ZSTD_EndDirective_ZSTD_e_flush: ZSTD_EndDirective = 1;
pub const ZSTD_EndDirective_ZSTD_e_end: ZSTD_EndDirective = 2;
pub type ZSTD_EndDirective = ::std::os::raw::c_int;
extern "C" {
#[doc = " ZSTD_compressStream2() : Requires v1.4.0+\n Behaves about the same as ZSTD_compressStream, with additional control on end directive.\n - Compression parameters are pushed into CCtx before starting compression, using ZSTD_CCtx_set*()\n - Compression parameters cannot be changed once compression is started (save a list of exceptions in multi-threading mode)\n - output->pos must be <= dstCapacity, input->pos must be <= srcSize\n - output->pos and input->pos will be updated. They are guaranteed to remain below their respective limit.\n - endOp must be a valid directive\n - When nbWorkers==0 (default), function is blocking : it completes its job before returning to caller.\n - When nbWorkers>=1, function is non-blocking : it copies a portion of input, distributes jobs to internal worker threads, flush to output whatever is available,\n and then immediately returns, just indicating that there is some data remaining to be flushed.\n The function nonetheless guarantees forward progress : it will return only after it reads or write at least 1+ byte.\n - Exception : if the first call requests a ZSTD_e_end directive and provides enough dstCapacity, the function delegates to ZSTD_compress2() which is always blocking.\n - @return provides a minimum amount of data remaining to be flushed from internal buffers\n or an error code, which can be tested using ZSTD_isError().\n if @return != 0, flush is not fully completed, there is still some data left within internal buffers.\n This is useful for ZSTD_e_flush, since in this case more flushes are necessary to empty all buffers.\n For ZSTD_e_end, @return == 0 when internal buffers are fully flushed and frame is completed.\n - after a ZSTD_e_end directive, if internal buffer is not fully flushed (@return != 0),\n only ZSTD_e_end or ZSTD_e_flush operations are allowed.\n Before starting a new compression job, or changing compression parameters,\n it is required to fully flush internal buffers."]
pub fn ZSTD_compressStream2(
cctx: *mut ZSTD_CCtx,
output: *mut ZSTD_outBuffer,
input: *mut ZSTD_inBuffer,
endOp: ZSTD_EndDirective,
) -> usize;
}
extern "C" {
pub fn ZSTD_CStreamInSize() -> usize;
}
extern "C" {
pub fn ZSTD_CStreamOutSize() -> usize;
}
extern "C" {
#[doc = " Equivalent to:\n\n ZSTD_CCtx_reset(zcs, ZSTD_reset_session_only);\n ZSTD_CCtx_refCDict(zcs, NULL); // clear the dictionary (if any)\n ZSTD_CCtx_setParameter(zcs, ZSTD_c_compressionLevel, compressionLevel);\n\n Note that ZSTD_initCStream() clears any previously set dictionary. Use the new API\n to compress with a dictionary."]
pub fn ZSTD_initCStream(
zcs: *mut ZSTD_CStream,
compressionLevel: ::std::os::raw::c_int,
) -> usize;
}
extern "C" {
#[doc = " Alternative for ZSTD_compressStream2(zcs, output, input, ZSTD_e_continue).\n NOTE: The return value is different. ZSTD_compressStream() returns a hint for\n the next read size (if non-zero and not an error). ZSTD_compressStream2()\n returns the minimum nb of bytes left to flush (if non-zero and not an error)."]
pub fn ZSTD_compressStream(
zcs: *mut ZSTD_CStream,
output: *mut ZSTD_outBuffer,
input: *mut ZSTD_inBuffer,
) -> usize;
}
extern "C" {
#[doc = " Equivalent to ZSTD_compressStream2(zcs, output, &emptyInput, ZSTD_e_flush)."]
pub fn ZSTD_flushStream(zcs: *mut ZSTD_CStream, output: *mut ZSTD_outBuffer) -> usize;
}
extern "C" {
#[doc = " Equivalent to ZSTD_compressStream2(zcs, output, &emptyInput, ZSTD_e_end)."]
pub fn ZSTD_endStream(zcs: *mut ZSTD_CStream, output: *mut ZSTD_outBuffer) -> usize;
}
pub type ZSTD_DStream = ZSTD_DCtx;
extern "C" {
pub fn ZSTD_createDStream() -> *mut ZSTD_DStream;
}
extern "C" {
pub fn ZSTD_freeDStream(zds: *mut ZSTD_DStream) -> usize;
}
extern "C" {
#[doc = " ZSTD_initDStream() :\n Initialize/reset DStream state for new decompression operation.\n Call before new decompression operation using same DStream.\n\n Note : This function is redundant with the advanced API and equivalent to:\n ZSTD_DCtx_reset(zds, ZSTD_reset_session_only);\n ZSTD_DCtx_refDDict(zds, NULL);"]
pub fn ZSTD_initDStream(zds: *mut ZSTD_DStream) -> usize;
}
extern "C" {
#[doc = " ZSTD_decompressStream() :\n Streaming decompression function.\n Call repetitively to consume full input updating it as necessary.\n Function will update both input and output `pos` fields exposing current state via these fields:\n - `input.pos < input.size`, some input remaining and caller should provide remaining input\n on the next call.\n - `output.pos < output.size`, decoder finished and flushed all remaining buffers.\n - `output.pos == output.size`, potentially uncflushed data present in the internal buffers,\n call ZSTD_decompressStream() again to flush remaining data to output.\n Note : with no additional input, amount of data flushed <= ZSTD_BLOCKSIZE_MAX.\n\n @return : 0 when a frame is completely decoded and fully flushed,\n or an error code, which can be tested using ZSTD_isError(),\n or any other value > 0, which means there is some decoding or flushing to do to complete current frame."]
pub fn ZSTD_decompressStream(
zds: *mut ZSTD_DStream,
output: *mut ZSTD_outBuffer,
input: *mut ZSTD_inBuffer,
) -> usize;
}
extern "C" {
pub fn ZSTD_DStreamInSize() -> usize;
}
extern "C" {
pub fn ZSTD_DStreamOutSize() -> usize;
}
extern "C" {
#[doc = " Simple dictionary API\n/\n/*! ZSTD_compress_usingDict() :\n Compression at an explicit compression level using a Dictionary.\n A dictionary can be any arbitrary data segment (also called a prefix),\n or a buffer with specified information (see zdict.h).\n Note : This function loads the dictionary, resulting in significant startup delay.\n It's intended for a dictionary used only once.\n Note 2 : When `dict == NULL || dictSize < 8` no dictionary is used."]
pub fn ZSTD_compress_usingDict(
ctx: *mut ZSTD_CCtx,
dst: *mut ::std::os::raw::c_void,
dstCapacity: usize,
src: *const ::std::os::raw::c_void,
srcSize: usize,
dict: *const ::std::os::raw::c_void,
dictSize: usize,
compressionLevel: ::std::os::raw::c_int,
) -> usize;
}
extern "C" {
#[doc = " ZSTD_decompress_usingDict() :\n Decompression using a known Dictionary.\n Dictionary must be identical to the one used during compression.\n Note : This function loads the dictionary, resulting in significant startup delay.\n It's intended for a dictionary used only once.\n Note : When `dict == NULL || dictSize < 8` no dictionary is used."]
pub fn ZSTD_decompress_usingDict(
dctx: *mut ZSTD_DCtx,
dst: *mut ::std::os::raw::c_void,
dstCapacity: usize,
src: *const ::std::os::raw::c_void,
srcSize: usize,
dict: *const ::std::os::raw::c_void,
dictSize: usize,
) -> usize;
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct ZSTD_CDict_s {
_unused: [u8; 0],
}
#[doc = " Bulk processing dictionary API"]
pub type ZSTD_CDict = ZSTD_CDict_s;
extern "C" {
#[doc = " ZSTD_createCDict() :\n When compressing multiple messages or blocks using the same dictionary,\n it's recommended to digest the dictionary only once, since it's a costly operation.\n ZSTD_createCDict() will create a state from digesting a dictionary.\n The resulting state can be used for future compression operations with very limited startup cost.\n ZSTD_CDict can be created once and shared by multiple threads concurrently, since its usage is read-only.\n @dictBuffer can be released after ZSTD_CDict creation, because its content is copied within CDict.\n Note 1 : Consider experimental function `ZSTD_createCDict_byReference()` if you prefer to not duplicate @dictBuffer content.\n Note 2 : A ZSTD_CDict can be created from an empty @dictBuffer,\n in which case the only thing that it transports is the @compressionLevel.\n This can be useful in a pipeline featuring ZSTD_compress_usingCDict() exclusively,\n expecting a ZSTD_CDict parameter with any data, including those without a known dictionary."]
pub fn ZSTD_createCDict(
dictBuffer: *const ::std::os::raw::c_void,
dictSize: usize,
compressionLevel: ::std::os::raw::c_int,
) -> *mut ZSTD_CDict;
}
extern "C" {
#[doc = " ZSTD_freeCDict() :\n Function frees memory allocated by ZSTD_createCDict().\n If a NULL pointer is passed, no operation is performed."]
pub fn ZSTD_freeCDict(CDict: *mut ZSTD_CDict) -> usize;
}
extern "C" {
#[doc = " ZSTD_compress_usingCDict() :\n Compression using a digested Dictionary.\n Recommended when same dictionary is used multiple times.\n Note : compression level is _decided at dictionary creation time_,\n and frame parameters are hardcoded (dictID=yes, contentSize=yes, checksum=no)"]
pub fn ZSTD_compress_usingCDict(
cctx: *mut ZSTD_CCtx,
dst: *mut ::std::os::raw::c_void,
dstCapacity: usize,
src: *const ::std::os::raw::c_void,
srcSize: usize,
cdict: *const ZSTD_CDict,
) -> usize;
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct ZSTD_DDict_s {
_unused: [u8; 0],
}
pub type ZSTD_DDict = ZSTD_DDict_s;
extern "C" {
#[doc = " ZSTD_createDDict() :\n Create a digested dictionary, ready to start decompression operation without startup delay.\n dictBuffer can be released after DDict creation, as its content is copied inside DDict."]
pub fn ZSTD_createDDict(
dictBuffer: *const ::std::os::raw::c_void,
dictSize: usize,
) -> *mut ZSTD_DDict;
}
extern "C" {
#[doc = " ZSTD_freeDDict() :\n Function frees memory allocated with ZSTD_createDDict()\n If a NULL pointer is passed, no operation is performed."]
pub fn ZSTD_freeDDict(ddict: *mut ZSTD_DDict) -> usize;
}
extern "C" {
#[doc = " ZSTD_decompress_usingDDict() :\n Decompression using a digested Dictionary.\n Recommended when same dictionary is used multiple times."]
pub fn ZSTD_decompress_usingDDict(
dctx: *mut ZSTD_DCtx,
dst: *mut ::std::os::raw::c_void,
dstCapacity: usize,
src: *const ::std::os::raw::c_void,
srcSize: usize,
ddict: *const ZSTD_DDict,
) -> usize;
}
extern "C" {
#[doc = " ZSTD_getDictID_fromDict() : Requires v1.4.0+\n Provides the dictID stored within dictionary.\n if @return == 0, the dictionary is not conformant with Zstandard specification.\n It can still be loaded, but as a content-only dictionary."]
pub fn ZSTD_getDictID_fromDict(
dict: *const ::std::os::raw::c_void,
dictSize: usize,
) -> ::std::os::raw::c_uint;
}
extern "C" {
#[doc = " ZSTD_getDictID_fromCDict() : Requires v1.5.0+\n Provides the dictID of the dictionary loaded into `cdict`.\n If @return == 0, the dictionary is not conformant to Zstandard specification, or empty.\n Non-conformant dictionaries can still be loaded, but as content-only dictionaries."]
pub fn ZSTD_getDictID_fromCDict(cdict: *const ZSTD_CDict) -> ::std::os::raw::c_uint;
}
extern "C" {
#[doc = " ZSTD_getDictID_fromDDict() : Requires v1.4.0+\n Provides the dictID of the dictionary loaded into `ddict`.\n If @return == 0, the dictionary is not conformant to Zstandard specification, or empty.\n Non-conformant dictionaries can still be loaded, but as content-only dictionaries."]
pub fn ZSTD_getDictID_fromDDict(ddict: *const ZSTD_DDict) -> ::std::os::raw::c_uint;
}
extern "C" {
#[doc = " ZSTD_getDictID_fromFrame() : Requires v1.4.0+\n Provides the dictID required to decompressed the frame stored within `src`.\n If @return == 0, the dictID could not be decoded.\n This could for one of the following reasons :\n - The frame does not require a dictionary to be decoded (most common case).\n - The frame was built with dictID intentionally removed. Whatever dictionary is necessary is a hidden piece of information.\n Note : this use case also happens when using a non-conformant dictionary.\n - `srcSize` is too small, and as a result, the frame header could not be decoded (only possible if `srcSize < ZSTD_FRAMEHEADERSIZE_MAX`).\n - This is not a Zstandard frame.\n When identifying the exact failure cause, it's possible to use ZSTD_getFrameHeader(), which will provide a more precise error code."]
pub fn ZSTD_getDictID_fromFrame(
src: *const ::std::os::raw::c_void,
srcSize: usize,
) -> ::std::os::raw::c_uint;
}
extern "C" {
#[doc = " ZSTD_CCtx_loadDictionary() : Requires v1.4.0+\n Create an internal CDict from `dict` buffer.\n Decompression will have to use same dictionary.\n @result : 0, or an error code (which can be tested with ZSTD_isError()).\n Special: Loading a NULL (or 0-size) dictionary invalidates previous dictionary,\n meaning \"return to no-dictionary mode\".\n Note 1 : Dictionary is sticky, it will be used for all future compressed frames,\n until parameters are reset, a new dictionary is loaded, or the dictionary\n is explicitly invalidated by loading a NULL dictionary.\n Note 2 : Loading a dictionary involves building tables.\n It's also a CPU consuming operation, with non-negligible impact on latency.\n Tables are dependent on compression parameters, and for this reason,\n compression parameters can no longer be changed after loading a dictionary.\n Note 3 :`dict` content will be copied internally.\n Use experimental ZSTD_CCtx_loadDictionary_byReference() to reference content instead.\n In such a case, dictionary buffer must outlive its users.\n Note 4 : Use ZSTD_CCtx_loadDictionary_advanced()\n to precisely select how dictionary content must be interpreted."]
pub fn ZSTD_CCtx_loadDictionary(
cctx: *mut ZSTD_CCtx,
dict: *const ::std::os::raw::c_void,
dictSize: usize,
) -> usize;
}
extern "C" {
#[doc = " ZSTD_CCtx_refCDict() : Requires v1.4.0+\n Reference a prepared dictionary, to be used for all future compressed frames.\n Note that compression parameters are enforced from within CDict,\n and supersede any compression parameter previously set within CCtx.\n The parameters ignored are labelled as \"superseded-by-cdict\" in the ZSTD_cParameter enum docs.\n The ignored parameters will be used again if the CCtx is returned to no-dictionary mode.\n The dictionary will remain valid for future compressed frames using same CCtx.\n @result : 0, or an error code (which can be tested with ZSTD_isError()).\n Special : Referencing a NULL CDict means \"return to no-dictionary mode\".\n Note 1 : Currently, only one dictionary can be managed.\n Referencing a new dictionary effectively \"discards\" any previous one.\n Note 2 : CDict is just referenced, its lifetime must outlive its usage within CCtx."]
pub fn ZSTD_CCtx_refCDict(cctx: *mut ZSTD_CCtx, cdict: *const ZSTD_CDict) -> usize;
}
extern "C" {
#[doc = " ZSTD_CCtx_refPrefix() : Requires v1.4.0+\n Reference a prefix (single-usage dictionary) for next compressed frame.\n A prefix is **only used once**. Tables are discarded at end of frame (ZSTD_e_end).\n Decompression will need same prefix to properly regenerate data.\n Compressing with a prefix is similar in outcome as performing a diff and compressing it,\n but performs much faster, especially during decompression (compression speed is tunable with compression level).\n @result : 0, or an error code (which can be tested with ZSTD_isError()).\n Special: Adding any prefix (including NULL) invalidates any previous prefix or dictionary\n Note 1 : Prefix buffer is referenced. It **must** outlive compression.\n Its content must remain unmodified during compression.\n Note 2 : If the intention is to diff some large src data blob with some prior version of itself,\n ensure that the window size is large enough to contain the entire source.\n See ZSTD_c_windowLog.\n Note 3 : Referencing a prefix involves building tables, which are dependent on compression parameters.\n It's a CPU consuming operation, with non-negligible impact on latency.\n If there is a need to use the same prefix multiple times, consider loadDictionary instead.\n Note 4 : By default, the prefix is interpreted as raw content (ZSTD_dct_rawContent).\n Use experimental ZSTD_CCtx_refPrefix_advanced() to alter dictionary interpretation."]
pub fn ZSTD_CCtx_refPrefix(
cctx: *mut ZSTD_CCtx,
prefix: *const ::std::os::raw::c_void,
prefixSize: usize,
) -> usize;
}
extern "C" {
#[doc = " ZSTD_DCtx_loadDictionary() : Requires v1.4.0+\n Create an internal DDict from dict buffer, to be used to decompress all future frames.\n The dictionary remains valid for all future frames, until explicitly invalidated, or\n a new dictionary is loaded.\n @result : 0, or an error code (which can be tested with ZSTD_isError()).\n Special : Adding a NULL (or 0-size) dictionary invalidates any previous dictionary,\n meaning \"return to no-dictionary mode\".\n Note 1 : Loading a dictionary involves building tables,\n which has a non-negligible impact on CPU usage and latency.\n It's recommended to \"load once, use many times\", to amortize the cost\n Note 2 :`dict` content will be copied internally, so `dict` can be released after loading.\n Use ZSTD_DCtx_loadDictionary_byReference() to reference dictionary content instead.\n Note 3 : Use ZSTD_DCtx_loadDictionary_advanced() to take control of\n how dictionary content is loaded and interpreted."]
pub fn ZSTD_DCtx_loadDictionary(
dctx: *mut ZSTD_DCtx,
dict: *const ::std::os::raw::c_void,
dictSize: usize,
) -> usize;
}
extern "C" {
#[doc = " ZSTD_DCtx_refDDict() : Requires v1.4.0+\n Reference a prepared dictionary, to be used to decompress next frames.\n The dictionary remains active for decompression of future frames using same DCtx.\n\n If called with ZSTD_d_refMultipleDDicts enabled, repeated calls of this function\n will store the DDict references in a table, and the DDict used for decompression\n will be determined at decompression time, as per the dict ID in the frame.\n The memory for the table is allocated on the first call to refDDict, and can be\n freed with ZSTD_freeDCtx().\n\n If called with ZSTD_d_refMultipleDDicts disabled (the default), only one dictionary\n will be managed, and referencing a dictionary effectively \"discards\" any previous one.\n\n @result : 0, or an error code (which can be tested with ZSTD_isError()).\n Special: referencing a NULL DDict means \"return to no-dictionary mode\".\n Note 2 : DDict is just referenced, its lifetime must outlive its usage from DCtx."]
pub fn ZSTD_DCtx_refDDict(dctx: *mut ZSTD_DCtx, ddict: *const ZSTD_DDict) -> usize;
}
extern "C" {
#[doc = " ZSTD_DCtx_refPrefix() : Requires v1.4.0+\n Reference a prefix (single-usage dictionary) to decompress next frame.\n This is the reverse operation of ZSTD_CCtx_refPrefix(),\n and must use the same prefix as the one used during compression.\n Prefix is **only used once**. Reference is discarded at end of frame.\n End of frame is reached when ZSTD_decompressStream() returns 0.\n @result : 0, or an error code (which can be tested with ZSTD_isError()).\n Note 1 : Adding any prefix (including NULL) invalidates any previously set prefix or dictionary\n Note 2 : Prefix buffer is referenced. It **must** outlive decompression.\n Prefix buffer must remain unmodified up to the end of frame,\n reached when ZSTD_decompressStream() returns 0.\n Note 3 : By default, the prefix is treated as raw content (ZSTD_dct_rawContent).\n Use ZSTD_CCtx_refPrefix_advanced() to alter dictMode (Experimental section)\n Note 4 : Referencing a raw content prefix has almost no cpu nor memory cost.\n A full dictionary is more costly, as it requires building tables."]
pub fn ZSTD_DCtx_refPrefix(
dctx: *mut ZSTD_DCtx,
prefix: *const ::std::os::raw::c_void,
prefixSize: usize,
) -> usize;
}
extern "C" {
#[doc = " ZSTD_sizeof_*() : Requires v1.4.0+\n These functions give the _current_ memory usage of selected object.\n Note that object memory usage can evolve (increase or decrease) over time."]
pub fn ZSTD_sizeof_CCtx(cctx: *const ZSTD_CCtx) -> usize;
}
extern "C" {
pub fn ZSTD_sizeof_DCtx(dctx: *const ZSTD_DCtx) -> usize;
}
extern "C" {
pub fn ZSTD_sizeof_CStream(zcs: *const ZSTD_CStream) -> usize;
}
extern "C" {
pub fn ZSTD_sizeof_DStream(zds: *const ZSTD_DStream) -> usize;
}
extern "C" {
pub fn ZSTD_sizeof_CDict(cdict: *const ZSTD_CDict) -> usize;
}
extern "C" {
pub fn ZSTD_sizeof_DDict(ddict: *const ZSTD_DDict) -> usize;
}

View File

@ -1,993 +0,0 @@
// auto-generated via csbindgen
#[allow(unused)]
use ::std::os::raw::*;
#[no_mangle]
pub extern "C" fn csbindgen_zstd___va_start(
arg1: *mut *mut c_char
)
{
unsafe {
return __va_start(
arg1
)
}
}
#[no_mangle]
pub extern "C" fn csbindgen_zstd___security_init_cookie(
)
{
unsafe {
return __security_init_cookie(
)
}
}
#[no_mangle]
pub extern "C" fn csbindgen_zstd___security_check_cookie(
_StackCookie: usize
)
{
unsafe {
return __security_check_cookie(
_StackCookie
)
}
}
#[no_mangle]
pub extern "C" fn csbindgen_zstd_ZSTD_versionNumber(
) -> c_uint
{
unsafe {
return ZSTD_versionNumber(
)
}
}
#[no_mangle]
pub extern "C" fn csbindgen_zstd_ZSTD_versionString(
) -> *const c_char
{
unsafe {
return ZSTD_versionString(
)
}
}
#[no_mangle]
pub extern "C" fn csbindgen_zstd_ZSTD_compress(
dst: *mut c_void,
dstCapacity: usize,
src: *const c_void,
srcSize: usize,
compressionLevel: c_int
) -> usize
{
unsafe {
return ZSTD_compress(
dst,
dstCapacity,
src,
srcSize,
compressionLevel
)
}
}
#[no_mangle]
pub extern "C" fn csbindgen_zstd_ZSTD_decompress(
dst: *mut c_void,
dstCapacity: usize,
src: *const c_void,
compressedSize: usize
) -> usize
{
unsafe {
return ZSTD_decompress(
dst,
dstCapacity,
src,
compressedSize
)
}
}
#[no_mangle]
pub extern "C" fn csbindgen_zstd_ZSTD_getFrameContentSize(
src: *const c_void,
srcSize: usize
) -> c_ulonglong
{
unsafe {
return ZSTD_getFrameContentSize(
src,
srcSize
)
}
}
#[no_mangle]
pub extern "C" fn csbindgen_zstd_ZSTD_getDecompressedSize(
src: *const c_void,
srcSize: usize
) -> c_ulonglong
{
unsafe {
return ZSTD_getDecompressedSize(
src,
srcSize
)
}
}
#[no_mangle]
pub extern "C" fn csbindgen_zstd_ZSTD_findFrameCompressedSize(
src: *const c_void,
srcSize: usize
) -> usize
{
unsafe {
return ZSTD_findFrameCompressedSize(
src,
srcSize
)
}
}
#[no_mangle]
pub extern "C" fn csbindgen_zstd_ZSTD_compressBound(
srcSize: usize
) -> usize
{
unsafe {
return ZSTD_compressBound(
srcSize
)
}
}
#[no_mangle]
pub extern "C" fn csbindgen_zstd_ZSTD_isError(
code: usize
) -> c_uint
{
unsafe {
return ZSTD_isError(
code
)
}
}
#[no_mangle]
pub extern "C" fn csbindgen_zstd_ZSTD_getErrorName(
code: usize
) -> *const c_char
{
unsafe {
return ZSTD_getErrorName(
code
)
}
}
#[no_mangle]
pub extern "C" fn csbindgen_zstd_ZSTD_minCLevel(
) -> c_int
{
unsafe {
return ZSTD_minCLevel(
)
}
}
#[no_mangle]
pub extern "C" fn csbindgen_zstd_ZSTD_maxCLevel(
) -> c_int
{
unsafe {
return ZSTD_maxCLevel(
)
}
}
#[no_mangle]
pub extern "C" fn csbindgen_zstd_ZSTD_defaultCLevel(
) -> c_int
{
unsafe {
return ZSTD_defaultCLevel(
)
}
}
#[no_mangle]
pub extern "C" fn csbindgen_zstd_ZSTD_createCCtx(
) -> *mut ZSTD_CCtx
{
unsafe {
return ZSTD_createCCtx(
)
}
}
#[no_mangle]
pub extern "C" fn csbindgen_zstd_ZSTD_freeCCtx(
cctx: *mut ZSTD_CCtx
) -> usize
{
unsafe {
return ZSTD_freeCCtx(
cctx
)
}
}
#[no_mangle]
pub extern "C" fn csbindgen_zstd_ZSTD_compressCCtx(
cctx: *mut ZSTD_CCtx,
dst: *mut c_void,
dstCapacity: usize,
src: *const c_void,
srcSize: usize,
compressionLevel: c_int
) -> usize
{
unsafe {
return ZSTD_compressCCtx(
cctx,
dst,
dstCapacity,
src,
srcSize,
compressionLevel
)
}
}
#[no_mangle]
pub extern "C" fn csbindgen_zstd_ZSTD_createDCtx(
) -> *mut ZSTD_DCtx
{
unsafe {
return ZSTD_createDCtx(
)
}
}
#[no_mangle]
pub extern "C" fn csbindgen_zstd_ZSTD_freeDCtx(
dctx: *mut ZSTD_DCtx
) -> usize
{
unsafe {
return ZSTD_freeDCtx(
dctx
)
}
}
#[no_mangle]
pub extern "C" fn csbindgen_zstd_ZSTD_decompressDCtx(
dctx: *mut ZSTD_DCtx,
dst: *mut c_void,
dstCapacity: usize,
src: *const c_void,
srcSize: usize
) -> usize
{
unsafe {
return ZSTD_decompressDCtx(
dctx,
dst,
dstCapacity,
src,
srcSize
)
}
}
#[no_mangle]
pub extern "C" fn csbindgen_zstd_ZSTD_cParam_getBounds(
cParam: ZSTD_cParameter
) -> ZSTD_bounds
{
unsafe {
return ZSTD_cParam_getBounds(
cParam
)
}
}
#[no_mangle]
pub extern "C" fn csbindgen_zstd_ZSTD_CCtx_setParameter(
cctx: *mut ZSTD_CCtx,
param: ZSTD_cParameter,
value: c_int
) -> usize
{
unsafe {
return ZSTD_CCtx_setParameter(
cctx,
param,
value
)
}
}
#[no_mangle]
pub extern "C" fn csbindgen_zstd_ZSTD_CCtx_setPledgedSrcSize(
cctx: *mut ZSTD_CCtx,
pledgedSrcSize: c_ulonglong
) -> usize
{
unsafe {
return ZSTD_CCtx_setPledgedSrcSize(
cctx,
pledgedSrcSize
)
}
}
#[no_mangle]
pub extern "C" fn csbindgen_zstd_ZSTD_CCtx_reset(
cctx: *mut ZSTD_CCtx,
reset: ZSTD_ResetDirective
) -> usize
{
unsafe {
return ZSTD_CCtx_reset(
cctx,
reset
)
}
}
#[no_mangle]
pub extern "C" fn csbindgen_zstd_ZSTD_compress2(
cctx: *mut ZSTD_CCtx,
dst: *mut c_void,
dstCapacity: usize,
src: *const c_void,
srcSize: usize
) -> usize
{
unsafe {
return ZSTD_compress2(
cctx,
dst,
dstCapacity,
src,
srcSize
)
}
}
#[no_mangle]
pub extern "C" fn csbindgen_zstd_ZSTD_dParam_getBounds(
dParam: ZSTD_dParameter
) -> ZSTD_bounds
{
unsafe {
return ZSTD_dParam_getBounds(
dParam
)
}
}
#[no_mangle]
pub extern "C" fn csbindgen_zstd_ZSTD_DCtx_setParameter(
dctx: *mut ZSTD_DCtx,
param: ZSTD_dParameter,
value: c_int
) -> usize
{
unsafe {
return ZSTD_DCtx_setParameter(
dctx,
param,
value
)
}
}
#[no_mangle]
pub extern "C" fn csbindgen_zstd_ZSTD_DCtx_reset(
dctx: *mut ZSTD_DCtx,
reset: ZSTD_ResetDirective
) -> usize
{
unsafe {
return ZSTD_DCtx_reset(
dctx,
reset
)
}
}
#[no_mangle]
pub extern "C" fn csbindgen_zstd_ZSTD_createCStream(
) -> *mut ZSTD_CStream
{
unsafe {
return ZSTD_createCStream(
)
}
}
#[no_mangle]
pub extern "C" fn csbindgen_zstd_ZSTD_freeCStream(
zcs: *mut ZSTD_CStream
) -> usize
{
unsafe {
return ZSTD_freeCStream(
zcs
)
}
}
#[no_mangle]
pub extern "C" fn csbindgen_zstd_ZSTD_compressStream2(
cctx: *mut ZSTD_CCtx,
output: *mut ZSTD_outBuffer,
input: *mut ZSTD_inBuffer,
endOp: ZSTD_EndDirective
) -> usize
{
unsafe {
return ZSTD_compressStream2(
cctx,
output,
input,
endOp
)
}
}
#[no_mangle]
pub extern "C" fn csbindgen_zstd_ZSTD_CStreamInSize(
) -> usize
{
unsafe {
return ZSTD_CStreamInSize(
)
}
}
#[no_mangle]
pub extern "C" fn csbindgen_zstd_ZSTD_CStreamOutSize(
) -> usize
{
unsafe {
return ZSTD_CStreamOutSize(
)
}
}
#[no_mangle]
pub extern "C" fn csbindgen_zstd_ZSTD_initCStream(
zcs: *mut ZSTD_CStream,
compressionLevel: c_int
) -> usize
{
unsafe {
return ZSTD_initCStream(
zcs,
compressionLevel
)
}
}
#[no_mangle]
pub extern "C" fn csbindgen_zstd_ZSTD_compressStream(
zcs: *mut ZSTD_CStream,
output: *mut ZSTD_outBuffer,
input: *mut ZSTD_inBuffer
) -> usize
{
unsafe {
return ZSTD_compressStream(
zcs,
output,
input
)
}
}
#[no_mangle]
pub extern "C" fn csbindgen_zstd_ZSTD_flushStream(
zcs: *mut ZSTD_CStream,
output: *mut ZSTD_outBuffer
) -> usize
{
unsafe {
return ZSTD_flushStream(
zcs,
output
)
}
}
#[no_mangle]
pub extern "C" fn csbindgen_zstd_ZSTD_endStream(
zcs: *mut ZSTD_CStream,
output: *mut ZSTD_outBuffer
) -> usize
{
unsafe {
return ZSTD_endStream(
zcs,
output
)
}
}
#[no_mangle]
pub extern "C" fn csbindgen_zstd_ZSTD_createDStream(
) -> *mut ZSTD_DStream
{
unsafe {
return ZSTD_createDStream(
)
}
}
#[no_mangle]
pub extern "C" fn csbindgen_zstd_ZSTD_freeDStream(
zds: *mut ZSTD_DStream
) -> usize
{
unsafe {
return ZSTD_freeDStream(
zds
)
}
}
#[no_mangle]
pub extern "C" fn csbindgen_zstd_ZSTD_initDStream(
zds: *mut ZSTD_DStream
) -> usize
{
unsafe {
return ZSTD_initDStream(
zds
)
}
}
#[no_mangle]
pub extern "C" fn csbindgen_zstd_ZSTD_decompressStream(
zds: *mut ZSTD_DStream,
output: *mut ZSTD_outBuffer,
input: *mut ZSTD_inBuffer
) -> usize
{
unsafe {
return ZSTD_decompressStream(
zds,
output,
input
)
}
}
#[no_mangle]
pub extern "C" fn csbindgen_zstd_ZSTD_DStreamInSize(
) -> usize
{
unsafe {
return ZSTD_DStreamInSize(
)
}
}
#[no_mangle]
pub extern "C" fn csbindgen_zstd_ZSTD_DStreamOutSize(
) -> usize
{
unsafe {
return ZSTD_DStreamOutSize(
)
}
}
#[no_mangle]
pub extern "C" fn csbindgen_zstd_ZSTD_compress_usingDict(
ctx: *mut ZSTD_CCtx,
dst: *mut c_void,
dstCapacity: usize,
src: *const c_void,
srcSize: usize,
dict: *const c_void,
dictSize: usize,
compressionLevel: c_int
) -> usize
{
unsafe {
return ZSTD_compress_usingDict(
ctx,
dst,
dstCapacity,
src,
srcSize,
dict,
dictSize,
compressionLevel
)
}
}
#[no_mangle]
pub extern "C" fn csbindgen_zstd_ZSTD_decompress_usingDict(
dctx: *mut ZSTD_DCtx,
dst: *mut c_void,
dstCapacity: usize,
src: *const c_void,
srcSize: usize,
dict: *const c_void,
dictSize: usize
) -> usize
{
unsafe {
return ZSTD_decompress_usingDict(
dctx,
dst,
dstCapacity,
src,
srcSize,
dict,
dictSize
)
}
}
#[no_mangle]
pub extern "C" fn csbindgen_zstd_ZSTD_createCDict(
dictBuffer: *const c_void,
dictSize: usize,
compressionLevel: c_int
) -> *mut ZSTD_CDict
{
unsafe {
return ZSTD_createCDict(
dictBuffer,
dictSize,
compressionLevel
)
}
}
#[no_mangle]
pub extern "C" fn csbindgen_zstd_ZSTD_freeCDict(
CDict: *mut ZSTD_CDict
) -> usize
{
unsafe {
return ZSTD_freeCDict(
CDict
)
}
}
#[no_mangle]
pub extern "C" fn csbindgen_zstd_ZSTD_compress_usingCDict(
cctx: *mut ZSTD_CCtx,
dst: *mut c_void,
dstCapacity: usize,
src: *const c_void,
srcSize: usize,
cdict: *const ZSTD_CDict
) -> usize
{
unsafe {
return ZSTD_compress_usingCDict(
cctx,
dst,
dstCapacity,
src,
srcSize,
cdict
)
}
}
#[no_mangle]
pub extern "C" fn csbindgen_zstd_ZSTD_createDDict(
dictBuffer: *const c_void,
dictSize: usize
) -> *mut ZSTD_DDict
{
unsafe {
return ZSTD_createDDict(
dictBuffer,
dictSize
)
}
}
#[no_mangle]
pub extern "C" fn csbindgen_zstd_ZSTD_freeDDict(
ddict: *mut ZSTD_DDict
) -> usize
{
unsafe {
return ZSTD_freeDDict(
ddict
)
}
}
#[no_mangle]
pub extern "C" fn csbindgen_zstd_ZSTD_decompress_usingDDict(
dctx: *mut ZSTD_DCtx,
dst: *mut c_void,
dstCapacity: usize,
src: *const c_void,
srcSize: usize,
ddict: *const ZSTD_DDict
) -> usize
{
unsafe {
return ZSTD_decompress_usingDDict(
dctx,
dst,
dstCapacity,
src,
srcSize,
ddict
)
}
}
#[no_mangle]
pub extern "C" fn csbindgen_zstd_ZSTD_getDictID_fromDict(
dict: *const c_void,
dictSize: usize
) -> c_uint
{
unsafe {
return ZSTD_getDictID_fromDict(
dict,
dictSize
)
}
}
#[no_mangle]
pub extern "C" fn csbindgen_zstd_ZSTD_getDictID_fromCDict(
cdict: *const ZSTD_CDict
) -> c_uint
{
unsafe {
return ZSTD_getDictID_fromCDict(
cdict
)
}
}
#[no_mangle]
pub extern "C" fn csbindgen_zstd_ZSTD_getDictID_fromDDict(
ddict: *const ZSTD_DDict
) -> c_uint
{
unsafe {
return ZSTD_getDictID_fromDDict(
ddict
)
}
}
#[no_mangle]
pub extern "C" fn csbindgen_zstd_ZSTD_getDictID_fromFrame(
src: *const c_void,
srcSize: usize
) -> c_uint
{
unsafe {
return ZSTD_getDictID_fromFrame(
src,
srcSize
)
}
}
#[no_mangle]
pub extern "C" fn csbindgen_zstd_ZSTD_CCtx_loadDictionary(
cctx: *mut ZSTD_CCtx,
dict: *const c_void,
dictSize: usize
) -> usize
{
unsafe {
return ZSTD_CCtx_loadDictionary(
cctx,
dict,
dictSize
)
}
}
#[no_mangle]
pub extern "C" fn csbindgen_zstd_ZSTD_CCtx_refCDict(
cctx: *mut ZSTD_CCtx,
cdict: *const ZSTD_CDict
) -> usize
{
unsafe {
return ZSTD_CCtx_refCDict(
cctx,
cdict
)
}
}
#[no_mangle]
pub extern "C" fn csbindgen_zstd_ZSTD_CCtx_refPrefix(
cctx: *mut ZSTD_CCtx,
prefix: *const c_void,
prefixSize: usize
) -> usize
{
unsafe {
return ZSTD_CCtx_refPrefix(
cctx,
prefix,
prefixSize
)
}
}
#[no_mangle]
pub extern "C" fn csbindgen_zstd_ZSTD_DCtx_loadDictionary(
dctx: *mut ZSTD_DCtx,
dict: *const c_void,
dictSize: usize
) -> usize
{
unsafe {
return ZSTD_DCtx_loadDictionary(
dctx,
dict,
dictSize
)
}
}
#[no_mangle]
pub extern "C" fn csbindgen_zstd_ZSTD_DCtx_refDDict(
dctx: *mut ZSTD_DCtx,
ddict: *const ZSTD_DDict
) -> usize
{
unsafe {
return ZSTD_DCtx_refDDict(
dctx,
ddict
)
}
}
#[no_mangle]
pub extern "C" fn csbindgen_zstd_ZSTD_DCtx_refPrefix(
dctx: *mut ZSTD_DCtx,
prefix: *const c_void,
prefixSize: usize
) -> usize
{
unsafe {
return ZSTD_DCtx_refPrefix(
dctx,
prefix,
prefixSize
)
}
}
#[no_mangle]
pub extern "C" fn csbindgen_zstd_ZSTD_sizeof_CCtx(
cctx: *const ZSTD_CCtx
) -> usize
{
unsafe {
return ZSTD_sizeof_CCtx(
cctx
)
}
}
#[no_mangle]
pub extern "C" fn csbindgen_zstd_ZSTD_sizeof_DCtx(
dctx: *const ZSTD_DCtx
) -> usize
{
unsafe {
return ZSTD_sizeof_DCtx(
dctx
)
}
}
#[no_mangle]
pub extern "C" fn csbindgen_zstd_ZSTD_sizeof_CStream(
zcs: *const ZSTD_CStream
) -> usize
{
unsafe {
return ZSTD_sizeof_CStream(
zcs
)
}
}
#[no_mangle]
pub extern "C" fn csbindgen_zstd_ZSTD_sizeof_DStream(
zds: *const ZSTD_DStream
) -> usize
{
unsafe {
return ZSTD_sizeof_DStream(
zds
)
}
}
#[no_mangle]
pub extern "C" fn csbindgen_zstd_ZSTD_sizeof_CDict(
cdict: *const ZSTD_CDict
) -> usize
{
unsafe {
return ZSTD_sizeof_CDict(
cdict
)
}
}
#[no_mangle]
pub extern "C" fn csbindgen_zstd_ZSTD_sizeof_DDict(
ddict: *const ZSTD_DDict
) -> usize
{
unsafe {
return ZSTD_sizeof_DDict(
ddict
)
}
}

View File

@ -63,8 +63,8 @@ impl Builder {
csharp_class_name: "NativeMethods".to_string(), csharp_class_name: "NativeMethods".to_string(),
csharp_dll_name: "".to_string(), csharp_dll_name: "".to_string(),
csharp_method_prefix: "".to_string(), csharp_method_prefix: "".to_string(),
csharp_c_long_convert: "Int32".to_string(), csharp_c_long_convert: "int".to_string(),
csharp_c_ulong_convert: "UInt32".to_string(), csharp_c_ulong_convert: "uint".to_string(),
}, },
} }
} }
@ -75,14 +75,32 @@ impl Builder {
self self
} }
// TODO:method chain methods... /// add original extern call type prefix to rust wrapper,
/// `return {rust_method_type_path}::foo()`
pub fn rust_method_type_path<T: Into<String>>(mut self, rust_method_type_path: T) -> Builder {
self.options.rust_method_type_path = rust_method_type_path.into();
self
}
/// add method prefix to rust wrapper, /// add method prefix to rust wrapper,
/// `pub extern "C" fn {rust_method_prefix}foo()` /// `pub extern "C" fn {rust_method_prefix}foo()`
pub fn rust_method_prefix<T: Into<String>>(mut self, rust_method_prefix: T) -> Builder { pub fn rust_method_prefix<T: Into<String>>(mut self, rust_method_prefix: T) -> Builder {
self.options.rust_method_prefix = rust_method_prefix.into(); self.options.rust_method_prefix = rust_method_prefix.into();
self self
}
/// add file header string to rust wrapper,
/// `mod lz4;`, `use super::lz4;`
pub fn rust_file_header<T: Into<String>>(mut self, rust_file_header: T) -> Builder {
self.options.rust_file_header = rust_file_header.into();
self
}
/// configure C# file namespace(default is `CsBindgen`),
/// "namespace {csharp_namespace}"
pub fn csharp_namespace<T: Into<String>>(mut self, csharp_namespace: T) -> Builder {
self.options.csharp_namespace = csharp_namespace.into();
self
} }
/// configure C# class name(default is `NativeMethods`), /// configure C# class name(default is `NativeMethods`),
@ -99,6 +117,27 @@ impl Builder {
self self
} }
/// configure C# calling method name prefix,
/// `public static extern void {csharp_method_prefix}foo()`
pub fn csharp_method_prefix<T: Into<String>>(mut self, csharp_method_prefix: T) -> Builder {
self.options.csharp_method_prefix = csharp_method_prefix.into();
self
}
/// configure c_long to {csharp_c_long_convert} type,
/// default is `int`.
pub fn csharp_c_long_convert<T: Into<String>>(mut self, csharp_c_long_convert: T) -> Builder {
self.options.csharp_c_long_convert = csharp_c_long_convert.into();
self
}
/// configure c_long to {csharp_c_long_convert} type,
/// default is `uint`.
pub fn csharp_c_ulong_convert<T: Into<String>>(mut self, csharp_c_ulong_convert: T) -> Builder {
self.options.csharp_c_ulong_convert = csharp_c_ulong_convert.into();
self
}
// pub fn generate_csharp_file<T: AsRef<Path>>(&self, csharp_output_path: T) -> io::Result<()> { // pub fn generate_csharp_file<T: AsRef<Path>>(&self, csharp_output_path: T) -> io::Result<()> {
// let mut file = OpenOptions::new() // let mut file = OpenOptions::new()
// .write(true) // .write(true)

View File

@ -6,7 +6,11 @@ use crate::util::*;
pub fn emit_rust_method(list: &Vec<ExternMethod>, options: &BindgenOptions) -> String { pub fn emit_rust_method(list: &Vec<ExternMethod>, options: &BindgenOptions) -> String {
// configure // configure
let method_type_path = &options.rust_method_type_path; let method_type_path = options.rust_method_type_path.as_str();
let method_type_path2 = match options.rust_method_type_path.as_str() {
"" => "".to_string(),
x => x.to_string() + "::"
};
let method_prefix = &options.rust_method_prefix; let method_prefix = &options.rust_method_prefix;
let file_header = &options.rust_file_header; let file_header = &options.rust_file_header;
@ -47,7 +51,7 @@ pub extern \"C\" fn {method_prefix}{method_name}(
){return_line} ){return_line}
{{ {{
unsafe {{ unsafe {{
return {method_type_path}{method_name}( return {method_type_path2}{method_name}(
{parameter_only_names} {parameter_only_names}
) )
}} }}
@ -59,7 +63,7 @@ pub extern \"C\" fn {method_prefix}{method_name}(
} }
let result = format!( let result = format!(
"// auto-generated via csbindgen "/* automatically generated by csbindgen */
#[allow(unused)] #[allow(unused)]
use ::std::os::raw::*; use ::std::os::raw::*;
@ -151,7 +155,7 @@ pub fn emit_csharp(
// TODO: for Unity, `__Intern`. // TODO: for Unity, `__Intern`.
let result = format!( let result = format!(
"// <auto-generated> "// <auto-generated>
// This code is generated via csbindgen. // This code is generated by csbindgen.
// DON'T CHANGE THIS DIRECTLY. // DON'T CHANGE THIS DIRECTLY.
// </auto-generated> // </auto-generated>
using System; using System;

View File

@ -42,9 +42,6 @@ pub(crate) fn generate(options: &BindgenOptions) -> Result<(String, String), Box
let structs = reduce_struct(&structs, &using_types); let structs = reduce_struct(&structs, &using_types);
// TODO: filter methods
//if !(t.method_name.starts_with("_") || t.method_name == "") {
let rust = emit_rust_method(&methods, &options); let rust = emit_rust_method(&methods, &options);
let csharp = emit_csharp(&methods, &aliases, &structs, &options); let csharp = emit_csharp(&methods, &aliases, &structs, &options);

View File

@ -48,7 +48,10 @@ pub fn collect_method(ast: &syn::File) -> Vec<ExternMethod> {
return_type: retrun_type, return_type: retrun_type,
}; };
list.push(t.clone()); // TODO:filter
if !(t.method_name.starts_with("_") || t.method_name == "") {
list.push(t.clone());
}
} }
} }
} }
@ -77,7 +80,7 @@ pub fn collect_type_alias(ast: &syn::File) -> Vec<(String, RustType)> {
is_mut: false, is_mut: false,
is_pointer: false, is_pointer: false,
is_pointer_pointer: false, is_pointer_pointer: false,
fixed_array_digits : "".to_string(), fixed_array_digits: "".to_string(),
type_name: alias.to_string(), type_name: alias.to_string(),
}, },
)); ));

View File

@ -1,5 +1,5 @@
// <auto-generated> // <auto-generated>
// This code is generated via csbindgen. // This code is generated by csbindgen.
// DON'T CHANGE THIS DIRECTLY. // DON'T CHANGE THIS DIRECTLY.
// </auto-generated> // </auto-generated>
using System; using System;
@ -80,15 +80,6 @@ namespace CsBindgen
[DllImport(__DllName, CallingConvention = CallingConvention.Cdecl)] [DllImport(__DllName, CallingConvention = CallingConvention.Cdecl)]
public static extern int LZ4_decompress_safe_partial_usingDict(byte* src, byte* dst, int compressedSize, int targetOutputSize, int maxOutputSize, byte* dictStart, int dictSize); public static extern int LZ4_decompress_safe_partial_usingDict(byte* src, byte* dst, int compressedSize, int targetOutputSize, int maxOutputSize, byte* dictStart, int dictSize);
[DllImport(__DllName, CallingConvention = CallingConvention.Cdecl)]
public static extern void __va_start(byte** arg1);
[DllImport(__DllName, CallingConvention = CallingConvention.Cdecl)]
public static extern void __security_init_cookie();
[DllImport(__DllName, CallingConvention = CallingConvention.Cdecl)]
public static extern void __security_check_cookie(UIntPtr _StackCookie);
[DllImport(__DllName, CallingConvention = CallingConvention.Cdecl)] [DllImport(__DllName, CallingConvention = CallingConvention.Cdecl)]
public static extern LZ4_stream_u* LZ4_initStream(void* buffer, UIntPtr size); public static extern LZ4_stream_u* LZ4_initStream(void* buffer, UIntPtr size);

File diff suppressed because it is too large Load Diff

View File

@ -1,274 +0,0 @@
// <auto-generated>
// This code is generated via csbindgen.
// DON'T CHANGE THIS DIRECTLY.
// </auto-generated>
using System;
using System.Runtime.InteropServices;
namespace CsBindgen
{
public static unsafe partial class LibZstd
{
const string __DllName = "libzsd";
[DllImport(__DllName, CallingConvention = CallingConvention.Cdecl)]
public static extern void __va_start(byte** arg1);
[DllImport(__DllName, CallingConvention = CallingConvention.Cdecl)]
public static extern void __security_init_cookie();
[DllImport(__DllName, CallingConvention = CallingConvention.Cdecl)]
public static extern void __security_check_cookie(UIntPtr _StackCookie);
[DllImport(__DllName, CallingConvention = CallingConvention.Cdecl)]
public static extern uint ZSTD_versionNumber();
[DllImport(__DllName, CallingConvention = CallingConvention.Cdecl)]
public static extern byte* ZSTD_versionString();
[DllImport(__DllName, CallingConvention = CallingConvention.Cdecl)]
public static extern UIntPtr ZSTD_compress(void* dst, UIntPtr dstCapacity, void* src, UIntPtr srcSize, int compressionLevel);
[DllImport(__DllName, CallingConvention = CallingConvention.Cdecl)]
public static extern UIntPtr ZSTD_decompress(void* dst, UIntPtr dstCapacity, void* src, UIntPtr compressedSize);
[DllImport(__DllName, CallingConvention = CallingConvention.Cdecl)]
public static extern ulong ZSTD_getFrameContentSize(void* src, UIntPtr srcSize);
[DllImport(__DllName, CallingConvention = CallingConvention.Cdecl)]
public static extern ulong ZSTD_getDecompressedSize(void* src, UIntPtr srcSize);
[DllImport(__DllName, CallingConvention = CallingConvention.Cdecl)]
public static extern UIntPtr ZSTD_findFrameCompressedSize(void* src, UIntPtr srcSize);
[DllImport(__DllName, CallingConvention = CallingConvention.Cdecl)]
public static extern UIntPtr ZSTD_compressBound(UIntPtr srcSize);
[DllImport(__DllName, CallingConvention = CallingConvention.Cdecl)]
public static extern uint ZSTD_isError(UIntPtr code);
[DllImport(__DllName, CallingConvention = CallingConvention.Cdecl)]
public static extern byte* ZSTD_getErrorName(UIntPtr code);
[DllImport(__DllName, CallingConvention = CallingConvention.Cdecl)]
public static extern int ZSTD_minCLevel();
[DllImport(__DllName, CallingConvention = CallingConvention.Cdecl)]
public static extern int ZSTD_maxCLevel();
[DllImport(__DllName, CallingConvention = CallingConvention.Cdecl)]
public static extern int ZSTD_defaultCLevel();
[DllImport(__DllName, CallingConvention = CallingConvention.Cdecl)]
public static extern ZSTD_CCtx_s* ZSTD_createCCtx();
[DllImport(__DllName, CallingConvention = CallingConvention.Cdecl)]
public static extern UIntPtr ZSTD_freeCCtx(ZSTD_CCtx_s* cctx);
[DllImport(__DllName, CallingConvention = CallingConvention.Cdecl)]
public static extern UIntPtr ZSTD_compressCCtx(ZSTD_CCtx_s* cctx, void* dst, UIntPtr dstCapacity, void* src, UIntPtr srcSize, int compressionLevel);
[DllImport(__DllName, CallingConvention = CallingConvention.Cdecl)]
public static extern ZSTD_DCtx_s* ZSTD_createDCtx();
[DllImport(__DllName, CallingConvention = CallingConvention.Cdecl)]
public static extern UIntPtr ZSTD_freeDCtx(ZSTD_DCtx_s* dctx);
[DllImport(__DllName, CallingConvention = CallingConvention.Cdecl)]
public static extern UIntPtr ZSTD_decompressDCtx(ZSTD_DCtx_s* dctx, void* dst, UIntPtr dstCapacity, void* src, UIntPtr srcSize);
[DllImport(__DllName, CallingConvention = CallingConvention.Cdecl)]
public static extern ZSTD_bounds ZSTD_cParam_getBounds(int cParam);
[DllImport(__DllName, CallingConvention = CallingConvention.Cdecl)]
public static extern UIntPtr ZSTD_CCtx_setParameter(ZSTD_CCtx_s* cctx, int param, int value);
[DllImport(__DllName, CallingConvention = CallingConvention.Cdecl)]
public static extern UIntPtr ZSTD_CCtx_setPledgedSrcSize(ZSTD_CCtx_s* cctx, ulong pledgedSrcSize);
[DllImport(__DllName, CallingConvention = CallingConvention.Cdecl)]
public static extern UIntPtr ZSTD_CCtx_reset(ZSTD_CCtx_s* cctx, int reset);
[DllImport(__DllName, CallingConvention = CallingConvention.Cdecl)]
public static extern UIntPtr ZSTD_compress2(ZSTD_CCtx_s* cctx, void* dst, UIntPtr dstCapacity, void* src, UIntPtr srcSize);
[DllImport(__DllName, CallingConvention = CallingConvention.Cdecl)]
public static extern ZSTD_bounds ZSTD_dParam_getBounds(int dParam);
[DllImport(__DllName, CallingConvention = CallingConvention.Cdecl)]
public static extern UIntPtr ZSTD_DCtx_setParameter(ZSTD_DCtx_s* dctx, int param, int value);
[DllImport(__DllName, CallingConvention = CallingConvention.Cdecl)]
public static extern UIntPtr ZSTD_DCtx_reset(ZSTD_DCtx_s* dctx, int reset);
[DllImport(__DllName, CallingConvention = CallingConvention.Cdecl)]
public static extern ZSTD_CCtx_s* ZSTD_createCStream();
[DllImport(__DllName, CallingConvention = CallingConvention.Cdecl)]
public static extern UIntPtr ZSTD_freeCStream(ZSTD_CCtx_s* zcs);
[DllImport(__DllName, CallingConvention = CallingConvention.Cdecl)]
public static extern UIntPtr ZSTD_compressStream2(ZSTD_CCtx_s* cctx, ZSTD_outBuffer_s* output, ZSTD_inBuffer_s* input, int endOp);
[DllImport(__DllName, CallingConvention = CallingConvention.Cdecl)]
public static extern UIntPtr ZSTD_CStreamInSize();
[DllImport(__DllName, CallingConvention = CallingConvention.Cdecl)]
public static extern UIntPtr ZSTD_CStreamOutSize();
[DllImport(__DllName, CallingConvention = CallingConvention.Cdecl)]
public static extern UIntPtr ZSTD_initCStream(ZSTD_CCtx_s* zcs, int compressionLevel);
[DllImport(__DllName, CallingConvention = CallingConvention.Cdecl)]
public static extern UIntPtr ZSTD_compressStream(ZSTD_CCtx_s* zcs, ZSTD_outBuffer_s* output, ZSTD_inBuffer_s* input);
[DllImport(__DllName, CallingConvention = CallingConvention.Cdecl)]
public static extern UIntPtr ZSTD_flushStream(ZSTD_CCtx_s* zcs, ZSTD_outBuffer_s* output);
[DllImport(__DllName, CallingConvention = CallingConvention.Cdecl)]
public static extern UIntPtr ZSTD_endStream(ZSTD_CCtx_s* zcs, ZSTD_outBuffer_s* output);
[DllImport(__DllName, CallingConvention = CallingConvention.Cdecl)]
public static extern ZSTD_DCtx_s* ZSTD_createDStream();
[DllImport(__DllName, CallingConvention = CallingConvention.Cdecl)]
public static extern UIntPtr ZSTD_freeDStream(ZSTD_DCtx_s* zds);
[DllImport(__DllName, CallingConvention = CallingConvention.Cdecl)]
public static extern UIntPtr ZSTD_initDStream(ZSTD_DCtx_s* zds);
[DllImport(__DllName, CallingConvention = CallingConvention.Cdecl)]
public static extern UIntPtr ZSTD_decompressStream(ZSTD_DCtx_s* zds, ZSTD_outBuffer_s* output, ZSTD_inBuffer_s* input);
[DllImport(__DllName, CallingConvention = CallingConvention.Cdecl)]
public static extern UIntPtr ZSTD_DStreamInSize();
[DllImport(__DllName, CallingConvention = CallingConvention.Cdecl)]
public static extern UIntPtr ZSTD_DStreamOutSize();
[DllImport(__DllName, CallingConvention = CallingConvention.Cdecl)]
public static extern UIntPtr ZSTD_compress_usingDict(ZSTD_CCtx_s* ctx, void* dst, UIntPtr dstCapacity, void* src, UIntPtr srcSize, void* dict, UIntPtr dictSize, int compressionLevel);
[DllImport(__DllName, CallingConvention = CallingConvention.Cdecl)]
public static extern UIntPtr ZSTD_decompress_usingDict(ZSTD_DCtx_s* dctx, void* dst, UIntPtr dstCapacity, void* src, UIntPtr srcSize, void* dict, UIntPtr dictSize);
[DllImport(__DllName, CallingConvention = CallingConvention.Cdecl)]
public static extern ZSTD_CDict_s* ZSTD_createCDict(void* dictBuffer, UIntPtr dictSize, int compressionLevel);
[DllImport(__DllName, CallingConvention = CallingConvention.Cdecl)]
public static extern UIntPtr ZSTD_freeCDict(ZSTD_CDict_s* CDict);
[DllImport(__DllName, CallingConvention = CallingConvention.Cdecl)]
public static extern UIntPtr ZSTD_compress_usingCDict(ZSTD_CCtx_s* cctx, void* dst, UIntPtr dstCapacity, void* src, UIntPtr srcSize, ZSTD_CDict_s* cdict);
[DllImport(__DllName, CallingConvention = CallingConvention.Cdecl)]
public static extern ZSTD_DDict_s* ZSTD_createDDict(void* dictBuffer, UIntPtr dictSize);
[DllImport(__DllName, CallingConvention = CallingConvention.Cdecl)]
public static extern UIntPtr ZSTD_freeDDict(ZSTD_DDict_s* ddict);
[DllImport(__DllName, CallingConvention = CallingConvention.Cdecl)]
public static extern UIntPtr ZSTD_decompress_usingDDict(ZSTD_DCtx_s* dctx, void* dst, UIntPtr dstCapacity, void* src, UIntPtr srcSize, ZSTD_DDict_s* ddict);
[DllImport(__DllName, CallingConvention = CallingConvention.Cdecl)]
public static extern uint ZSTD_getDictID_fromDict(void* dict, UIntPtr dictSize);
[DllImport(__DllName, CallingConvention = CallingConvention.Cdecl)]
public static extern uint ZSTD_getDictID_fromCDict(ZSTD_CDict_s* cdict);
[DllImport(__DllName, CallingConvention = CallingConvention.Cdecl)]
public static extern uint ZSTD_getDictID_fromDDict(ZSTD_DDict_s* ddict);
[DllImport(__DllName, CallingConvention = CallingConvention.Cdecl)]
public static extern uint ZSTD_getDictID_fromFrame(void* src, UIntPtr srcSize);
[DllImport(__DllName, CallingConvention = CallingConvention.Cdecl)]
public static extern UIntPtr ZSTD_CCtx_loadDictionary(ZSTD_CCtx_s* cctx, void* dict, UIntPtr dictSize);
[DllImport(__DllName, CallingConvention = CallingConvention.Cdecl)]
public static extern UIntPtr ZSTD_CCtx_refCDict(ZSTD_CCtx_s* cctx, ZSTD_CDict_s* cdict);
[DllImport(__DllName, CallingConvention = CallingConvention.Cdecl)]
public static extern UIntPtr ZSTD_CCtx_refPrefix(ZSTD_CCtx_s* cctx, void* prefix, UIntPtr prefixSize);
[DllImport(__DllName, CallingConvention = CallingConvention.Cdecl)]
public static extern UIntPtr ZSTD_DCtx_loadDictionary(ZSTD_DCtx_s* dctx, void* dict, UIntPtr dictSize);
[DllImport(__DllName, CallingConvention = CallingConvention.Cdecl)]
public static extern UIntPtr ZSTD_DCtx_refDDict(ZSTD_DCtx_s* dctx, ZSTD_DDict_s* ddict);
[DllImport(__DllName, CallingConvention = CallingConvention.Cdecl)]
public static extern UIntPtr ZSTD_DCtx_refPrefix(ZSTD_DCtx_s* dctx, void* prefix, UIntPtr prefixSize);
[DllImport(__DllName, CallingConvention = CallingConvention.Cdecl)]
public static extern UIntPtr ZSTD_sizeof_CCtx(ZSTD_CCtx_s* cctx);
[DllImport(__DllName, CallingConvention = CallingConvention.Cdecl)]
public static extern UIntPtr ZSTD_sizeof_DCtx(ZSTD_DCtx_s* dctx);
[DllImport(__DllName, CallingConvention = CallingConvention.Cdecl)]
public static extern UIntPtr ZSTD_sizeof_CStream(ZSTD_CCtx_s* zcs);
[DllImport(__DllName, CallingConvention = CallingConvention.Cdecl)]
public static extern UIntPtr ZSTD_sizeof_DStream(ZSTD_DCtx_s* zds);
[DllImport(__DllName, CallingConvention = CallingConvention.Cdecl)]
public static extern UIntPtr ZSTD_sizeof_CDict(ZSTD_CDict_s* cdict);
[DllImport(__DllName, CallingConvention = CallingConvention.Cdecl)]
public static extern UIntPtr ZSTD_sizeof_DDict(ZSTD_DDict_s* ddict);
}
[StructLayout(LayoutKind.Sequential)]
public unsafe struct ZSTD_CCtx_s
{
public fixed byte _unused[1];
}
[StructLayout(LayoutKind.Sequential)]
public unsafe struct ZSTD_DCtx_s
{
public fixed byte _unused[1];
}
[StructLayout(LayoutKind.Sequential)]
public unsafe struct ZSTD_bounds
{
public UIntPtr error;
public int lowerBound;
public int upperBound;
}
[StructLayout(LayoutKind.Sequential)]
public unsafe struct ZSTD_inBuffer_s
{
public void* src;
public UIntPtr size;
public UIntPtr pos;
}
[StructLayout(LayoutKind.Sequential)]
public unsafe struct ZSTD_outBuffer_s
{
public void* dst;
public UIntPtr size;
public UIntPtr pos;
}
[StructLayout(LayoutKind.Sequential)]
public unsafe struct ZSTD_CDict_s
{
public fixed byte _unused[1];
}
[StructLayout(LayoutKind.Sequential)]
public unsafe struct ZSTD_DDict_s
{
public fixed byte _unused[1];
}
}