pub fn do_system_compress(data: &[u8]) -> Vec<(usize, Vec<u8>)> {
            let handle = unsafe {
                let mut handle: COMPRESSOR_HANDLE = mem::uninitialized();
                if CreateCompressor(
                    COMPRESS_ALGORITHM_MSZIP | COMPRESS_RAW,
                    ptr::null_mut(),
                    &mut handle as PCOMPRESSOR_HANDLE,
                ) != TRUE
                {
                    panic!("CreateCompressor failed");
                }
                handle
            };
            let mut blocks = Vec::<(usize, Vec<u8>)>::new();
            for slice in data.chunks(DEFLATE_MAX_DICT_LEN) {
                let mut buffer = vec![0; 0xffff];
                unsafe {
                    let mut compressed_size: SIZE_T = mem::uninitialized();
                    if Compress(
                        handle,
                        slice.as_ptr() as PVOID,
                        slice.len() as SIZE_T,
                        buffer.as_ptr() as PVOID,
                        buffer.len() as SIZE_T,
                        &mut compressed_size as PSIZE_T,
                    ) == FALSE
                    {
                        panic!("Compress failed");
                    }
                    buffer.resize(compressed_size as usize, 0);
                }
                blocks.push((slice.len(), buffer));
            }
            unsafe {
                CloseCompressor(handle);
            }
            blocks
        }
/// Compress `data` with the Microsoft compression API.
Compress `data` with the Microsoft compression API.
Compress ` data ` with the Microsoft compression API .
pub fn do_system_compress(data: &[u8]) -> Vec<(usize, Vec<u8>)> {
            let handle = unsafe {
                let mut handle: COMPRESSOR_HANDLE = mem::uninitialized();
                if CreateCompressor(
                    COMPRESS_ALGORITHM_MSZIP | COMPRESS_RAW,
                    ptr::null_mut(),
                    &mut handle as PCOMPRESSOR_HANDLE,
                ) != TRUE
                {
                    panic!("CreateCompressor failed");
                }
                handle
            };
            let mut blocks = Vec::<(usize, Vec<u8>)>::new();
            for slice in data.chunks(DEFLATE_MAX_DICT_LEN) {
                let mut buffer = vec![0; 0xffff];
                unsafe {
                    let mut compressed_size: SIZE_T = mem::uninitialized();
                    if Compress(
                        handle,
                        slice.as_ptr() as PVOID,
                        slice.len() as SIZE_T,
                        buffer.as_ptr() as PVOID,
                        buffer.len() as SIZE_T,
                        &mut compressed_size as PSIZE_T,
                    ) == FALSE
                    {
                        panic!("Compress failed");
                    }
                    buffer.resize(compressed_size as usize, 0);
                }
                blocks.push((slice.len(), buffer));
            }
            unsafe {
                CloseCompressor(handle);
            }
            blocks
        }
pub fn do_system_compress ( data : & [ u8 ] ) -> Vec < ( usize , Vec < u8 > ) > { let handle = unsafe { let mut handle : COMPRESSOR_HANDLE = mem :: uninitialized ( ) ; if CreateCompressor ( COMPRESS_ALGORITHM_MSZIP | COMPRESS_RAW , ptr :: null_mut ( ) , & mut handle as PCOMPRESSOR_HANDLE , ) != TRUE { panic ! ( " " ) ; } handle } ; let mut blocks = Vec :: < ( usize , Vec < u8 > ) > :: new ( ) ; for slice in data . chunks ( DEFLATE_MAX_DICT_LEN ) { let mut buffer = vec ! [ 0 0xffff ] ; unsafe { let mut compressed_size : SIZE_T = mem :: uninitialized ( ) ; if Compress ( handle , slice . as_ptr ( ) as PVOID , slice . len ( ) as SIZE_T , buffer . as_ptr ( ) as PVOID , buffer . len ( ) as SIZE_T , & mut compressed_size as PSIZE_T , ) == FALSE { panic ! ( " " ) ; } buffer . resize ( compressed_size as usize , 0 ) ; } blocks . push ( ( slice . len ( ) , buffer ) ) ; } unsafe { CloseCompressor ( handle ) ; } blocks }
Compress `data` with the Microsoft compression API.
Compress ` data ` with the Microsoft compression API .
data
&[u8]
data
&[u8]