Fixing warnings

pmeunier
Aug 4, 2021, 5:43 PM
ZA3236E56J2OSKXR4AWHFBTQTA64RCWMTXVZH65AIC5TK4E3DALQC

Dependencies

  • [2] 6XB4RDRQ Adding changes from original impl
  • [3] UPRY2FEL Remove bindgen dependency
  • [4] K6L5F26W Fixing sequential test.
  • [5] HELRYMZK Manual bindings (Windows and Clang aren't very good friends), and getting rid of anyhow
  • [6] IB4L4N5M Fixing the lifetimes for `Seekable`
  • [7] IH334Q5A Reboot
  • [8] HEFGMMUM Start oxidizing 1/N
  • [9] L7S3YSSM Clippy + rustfmt

Change contents

  • replacement in src/lib.rs at line 14
    [3.114][3.0:52]()
    use std::{cmp, fmt, fs, io, mem, ptr, slice, sync};
    [3.114]
    [3.174]
    use std::{cmp, fmt, fs, io, ptr, slice, sync};
  • edit in src/lib.rs at line 169
    [3.243859][3.243859:243862](),[3.243862][3.2247:2312](),[3.2312][3.244170:244220](),[3.244170][3.244170:244220](),[3.244220][3.163:178](),[3.127][3.244235:244305](),[3.178][3.244235:244305](),[3.244235][3.244235:244305](),[3.244305][3.2313:2383](),[3.2383][3.244380:244442](),[3.244380][3.244380:244442](),[3.244442][3.2384:2404](),[3.2404][3.244467:244478](),[3.244467][3.244467:244478]()
    }
    unsafe extern "C" fn zstd_seekable_read<R: io::Read + io::Seek>(
    opaque: *mut c_void,
    buffer: *mut c_void,
    n: size_t,
    ) -> c_int {
    let mut b: Box<R> = Box::from_raw(opaque as *mut R);
    let s = slice::from_raw_parts_mut(buffer as *mut u8, n as usize);
    let result = if b.read_exact(s).is_ok() { 0 } else { 1 };
    mem::forget(b);
    result
  • edit in src/lib.rs at line 170
    [3.244480][3.244480:244481](),[3.244481][3.2405:2470](),[3.2470][3.244556:244694](),[3.244556][3.244556:244694](),[3.244694][3.2471:2534](),[3.2534][3.244768:244807](),[3.244768][3.244768:244807](),[3.244807][3.2535:2570](),[3.2570][3.244848:245007](),[3.244848][3.244848:245007](),[3.245007][3.2571:2591](),[3.2591][3.245032:245043](),[3.245032][3.245032:245043](),[3.245043][3.2592:2594]()
    unsafe extern "C" fn zstd_seekable_seek<R: io::Read + io::Seek>(
    opaque: *mut c_void,
    offset: c_longlong,
    origin: c_int,
    ) -> c_int {
    let mut b: Box<R> = Box::from_raw(opaque as *mut R);
    use io::SeekFrom;
    let origin = if origin == SEEK_SET {
    SeekFrom::Start(offset as u64)
    } else if origin == SEEK_CUR {
    SeekFrom::Current(offset as i64)
    } else {
    SeekFrom::End(offset as i64)
    };
    let result = if b.seek(origin).is_ok() { 0 } else { 1 };
    mem::forget(b);
    result
    }
  • replacement in src/lib.rs at line 558
    [3.11099][3.11099:11150]()
    let (mut idx, mut pos) = (0usize, 8usize);
    [3.11099]
    [3.11150]
    let mut pos = 0usize;
  • edit in src/bindings.rs at line 43
    [3.2532][3.2532:2576]()
    pub fn ZSTD_DStreamOutSize() -> size_t;
  • edit in src/bindings.rs at line 52
    [2.5104][3.3576:3619](),[3.26552][3.3576:3619](),[3.3576][3.3576:3619]()
    pub fn ZSTD_CStreamInSize() -> size_t;
  • edit in src/bindings.rs at line 71
    [3.4572][3.12360:12362](),[3.26706][3.12360:12362](),[3.12360][3.12360:12362](),[3.12362][3.4573:4879]()
    }
    /*
    #[doc = " Explicit context"]
    pub type ZSTD_CCtx = ZSTD_CCtx_s;
    #[repr(C)]
    #[derive(Debug, Copy, Clone)]
    pub struct ZSTD_DCtx_s {
    _unused: [u8; 0],
    }
    pub type ZSTD_DCtx = ZSTD_DCtx_s;
    #[doc = " Streaming"]
    pub type ZSTD_outBuffer = ZSTD_outBuffer_s;
    pub type ZSTD_CStream = ZSTD_CCtx;
    extern "C" {
  • edit in src/bindings.rs at line 72
    [3.4881][3.4881:4946](),[3.4946][3.12827:12868](),[3.12827][3.12827:12868](),[3.12868][3.4947:5002](),[3.5002][3.13019:13034](),[3.13019][3.13019:13034](),[3.13034][3.5003:5018](),[3.5018][3.13161:13163](),[3.13161][3.13161:13163](),[3.13163][3.5019:5022]()
    pub type ZSTD_DStream = ZSTD_DCtx;
    extern "C" {
    }
    extern "C" {
    }
    #[repr(C)]
    #[derive(Debug, Copy, Clone)]
    pub type ZSTD_seekable = ZSTD_seekable_s;
    extern "C" {
    }
    extern "C" {
    }
    extern "C" {
    }
    */