Skip to content

Commit 42e25d0

Browse files
committed
rust-ext: upgrade zstd-safe and zstd-bytes to latest using zstd 1.5.2
There were some API changes in newer versions of the crate that forced minor code changes to get things to compile.
1 parent 344af94 commit 42e25d0

File tree

4 files changed

+27
-14
lines changed

4 files changed

+27
-14
lines changed

Cargo.lock

Lines changed: 11 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,11 @@ num_cpus = "1.15.0"
1818
rayon = "1.6.1"
1919

2020
[dependencies.zstd-safe]
21-
version = "5.0.2+zstd.1.5.2"
21+
version = "=6.0.3+zstd.1.5.2"
2222
features = ["experimental", "legacy", "zstdmt"]
2323

2424
[dependencies.zstd-sys]
25-
version = "2.0.1+zstd.1.5.2"
25+
version = "=2.0.6+zstd.1.5.2"
2626
features = ["experimental", "legacy", "zstdmt"]
2727

2828
[dependencies.pyo3]

rust-ext/src/compression_dict.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,9 @@ impl ZstdCompressionDict {
122122
}
123123

124124
fn dict_id(&self) -> u32 {
125-
zstd_safe::get_dict_id(&self.data).unwrap_or(0)
125+
zstd_safe::get_dict_id(&self.data)
126+
.map(u32::from)
127+
.unwrap_or(0)
126128
}
127129

128130
#[args(level = "None", compression_params = "None")]

rust-ext/src/decompressor_multi.rs

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -190,13 +190,17 @@ fn decompress_from_datasources(
190190
};
191191

192192
let decompressed_size = if source.decompressed_size == 0 {
193-
let frame_size = zstd_safe::get_frame_content_size(source.data);
194-
195-
if frame_size == zstd_safe::CONTENTSIZE_ERROR
196-
|| frame_size == zstd_safe::CONTENTSIZE_UNKNOWN
197-
{
198-
result.error = WorkerError::NoSize;
199-
}
193+
let frame_size = match zstd_safe::get_frame_content_size(source.data) {
194+
Err(zstd_safe::ContentSizeError) => {
195+
result.error = WorkerError::NoSize;
196+
zstd_safe::CONTENTSIZE_ERROR
197+
}
198+
Ok(None) => {
199+
result.error = WorkerError::NoSize;
200+
zstd_safe::CONTENTSIZE_UNKNOWN
201+
}
202+
Ok(Some(frame_size)) => frame_size,
203+
};
200204

201205
frame_size as _
202206
} else {

0 commit comments

Comments
 (0)