Skip to content

Commit f83b201

Browse files
committed
Support WebAssembly
1 parent 6e6124a commit f83b201

File tree

4 files changed

+6
-6
lines changed

4 files changed

+6
-6
lines changed

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ binrw = { version = "0.14", features = ["std"], default-features = false }
6060
tracing = { version = "0.1", features = ["std"], default-features = false }
6161

6262
# used for zlib compression in sqpack files
63-
libz-ng-sys = { version = "1.1" }
63+
libz-sys = { version = "1.1" }
6464

6565
# nice to have features rust is lacking at the moment
6666
modular-bitfield = "0.11"

build.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,6 @@
33

44
fn main() {
55
// Windows doesn't ship pkgconfig files, typically. At least in our build system.
6-
#[cfg(not(target_os = "windows"))]
6+
#[cfg(all(not(target_os = "windows"), not(target_family = "wasm")))]
77
system_deps::Config::new().probe().unwrap();
88
}

src/compression.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
use std::ptr::null_mut;
55

6-
use libz_ng_sys::*;
6+
use libz_sys::*;
77

88
// This module's functions are licensed under MIT from https://github.com/rust-lang/flate2-rs
99
mod flate2_zallocation {

src/crc.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// SPDX-FileCopyrightText: 2023 Joshua Goins <josh@redstrate.com>
22
// SPDX-License-Identifier: GPL-3.0-or-later
33

4-
use libz_ng_sys::z_off_t;
4+
use libz_sys::z_off_t;
55
use std::ops::{Add, AddAssign, BitXor, BitXorAssign};
66

77
/// CRC used for filepath hashes in index file
@@ -45,11 +45,11 @@ impl Jamcrc {
4545
}
4646

4747
fn crc32(crc: u32, s: &[u8]) -> u32 {
48-
unsafe { libz_ng_sys::crc32(crc, s.as_ptr(), s.len() as u32) as u32 }
48+
unsafe { libz_sys::crc32(crc.into(), s.as_ptr(), s.len() as u32) as u32 }
4949
}
5050

5151
fn crc32_combine(crc1: u32, crc2: u32, len2: usize) -> u32 {
52-
unsafe { libz_ng_sys::crc32_combine(crc1, crc2, len2 as z_off_t) as u32 }
52+
unsafe { libz_sys::crc32_combine(crc1.into(), crc2.into(), len2 as z_off_t) as u32 }
5353
}
5454

5555
/// CRC used for shader keys

0 commit comments

Comments
 (0)