Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 7 additions & 5 deletions .github/workflows/checks.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ jobs:
CARGO_TARGET_WASM32_WASIP1_RUNNER: "wasmtime --dir /home/runner/work/zlib-rs/zlib-rs/test-libz-rs-sys --dir /tmp/"
CARGO_TARGET_WASM32_WASIP1_RUSTFLAGS: "-Ctarget-feature=+simd128"
BINDGEN_EXTRA_CLANG_ARGS_wasm32_wasip1: "--sysroot=/tmp/wasi-sdk-24.0-x86_64-linux/share/wasi-sysroot"
RUSTFLAGS: ${{ matrix.rust == 'nightly' && matrix.target == 'x86_64-unknown-linux-gnu' && '-Zsanitizer=address' || '' }}
RUSTDOCFLAGS: ${{ matrix.rust == 'nightly' && matrix.target == 'x86_64-unknown-linux-gnu' && '-Zsanitizer=address' || '' }}
strategy:
matrix:
include:
Expand Down Expand Up @@ -113,9 +115,6 @@ jobs:
os: windows-11-arm
codecov: false

env:
RUSTFLAGS: ${{ matrix.rust == 'nightly' && matrix.target == 'x86_64-unknown-linux-gnu' && '-Zsanitizer=address' || '' }}

steps:
- name: Checkout sources
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11
Expand Down Expand Up @@ -463,15 +462,18 @@ jobs:
run: |
rustup toolchain install nightly
cargo +nightly build --release --target ${{matrix.target}} --no-default-features --features=gz,gzprintf,c-allocator
cc -o example example.c target/${{matrix.target}}/release/deps/libz_rs.so
cc -o example example.c target/${{matrix.target}}/release/libz_rs.so
./example
valgrind --track-origins=yes --error-exitcode=1 ./example
- name: "cdylib: example.c with our .h files"
env:
LD_LIBRARY_PATH: "target/${{matrix.target}}/release/deps"
working-directory: libz-rs-sys-cdylib
run: |
cc -o example example.c target/${{matrix.target}}/release/deps/libz_rs.so -I../libz-rs-sys/include/
ls target/${{matrix.target}}/release
echo "----"
ls target/${{matrix.target}}/release/deps
cc -o example example.c target/${{matrix.target}}/release/libz_rs.so -I../libz-rs-sys/include/
./example
valgrind --track-origins=yes --error-exitcode=1 ./example

Expand Down
8 changes: 6 additions & 2 deletions libz-rs-sys/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1892,7 +1892,7 @@ pub unsafe extern "C" fn deflateCopy(dest: z_streamp, source: z_streamp) -> c_in
///
/// ```
/// use core::mem::MaybeUninit;
/// use libz_rs_sys::{z_stream, deflateInit_, zlibVersion, Z_OK};
/// use libz_rs_sys::{z_stream, deflateInit_, deflateEnd, zlibVersion, Z_OK};
///
/// // the zalloc and zfree fields are initialized as zero/NULL.
/// // `deflateInit_` will set a default allocation and deallocation function.
Expand All @@ -1911,6 +1911,8 @@ pub unsafe extern "C" fn deflateCopy(dest: z_streamp, source: z_streamp) -> c_in
/// // the stream is now fully initialized. Prefer `assume_init_mut` over
/// // `assume_init` so the stream does not get moved.
/// let strm = unsafe { strm.assume_init_mut() };
///
/// assert_eq!(unsafe { deflateEnd(strm) }, Z_OK);
/// ```
#[cfg_attr(feature = "export-symbols", export_name = prefix!(deflateInit_))]
pub unsafe extern "C" fn deflateInit_(
Expand Down Expand Up @@ -1974,7 +1976,7 @@ pub unsafe extern "C" fn deflateInit_(
///
/// ```
/// use core::mem::MaybeUninit;
/// use libz_rs_sys::{z_stream, deflateInit2_, zlibVersion, Z_OK};
/// use libz_rs_sys::{z_stream, deflateInit2_, deflateEnd, zlibVersion, Z_OK};
///
/// // the zalloc and zfree fields are initialized as zero/NULL.
/// // `deflateInit_` will set a default allocation and deallocation function.
Expand All @@ -1997,6 +1999,8 @@ pub unsafe extern "C" fn deflateInit_(
/// // the stream is now fully initialized. Prefer `assume_init_mut` over
/// // `assume_init` so the stream does not get moved.
/// let strm = unsafe { strm.assume_init_mut() };
///
/// assert_eq!(unsafe { deflateEnd(strm) }, Z_OK);
/// ```
#[cfg_attr(feature = "export-symbols", export_name = prefix!(deflateInit2_))]
pub unsafe extern "C" fn deflateInit2_(
Expand Down
15 changes: 7 additions & 8 deletions zlib-rs/src/inflate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -733,7 +733,7 @@ impl State<'_> {
self.back += extra;
}

traceln!("inflate: length {}", state.length);
traceln!("inflate: length {}", self.length);

self.was = self.length;

Expand Down Expand Up @@ -818,7 +818,7 @@ impl State<'_> {
);
}

traceln!("inflate: distance {}", state.offset);
traceln!("inflate: distance {}", self.offset);

break 'top Mode::Match;
}
Expand Down Expand Up @@ -1291,9 +1291,8 @@ impl State<'_> {
}

need_bits!(self, 3);
// self.last = self.bit_reader.bits(1) != 0;
self.flags
.update(Flags::IS_LAST_BLOCK, self.bit_reader.bits(1) != 0);
let last = self.bit_reader.bits(1) != 0;
self.flags.update(Flags::IS_LAST_BLOCK, last);
self.bit_reader.drop_bits(1);

match self.bit_reader.bits(2) {
Expand Down Expand Up @@ -1363,7 +1362,7 @@ impl State<'_> {
}

self.length = hold as usize & 0xFFFF;
traceln!("inflate: stored length {}", state.length);
traceln!("inflate: stored length {}", self.length);

self.bit_reader.init_bits();

Expand Down Expand Up @@ -1453,7 +1452,7 @@ impl State<'_> {
self.back += extra;
}

traceln!("inflate: length {}", state.length);
traceln!("inflate: length {}", self.length);

self.was = self.length;

Expand Down Expand Up @@ -1534,7 +1533,7 @@ impl State<'_> {
break 'label self.bad("invalid distance code too far back\0");
}

traceln!("inflate: distance {}", state.offset);
traceln!("inflate: distance {}", self.offset);

break 'blk Mode::Match;
}
Expand Down
Loading