fix(decompress): keep legacy dispatcher builds warning-clean
The Rust legacy streaming dispatcher has version-specific match arms. In legacy-disabled builds those arms disappear, leaving the projected context, dictionary sentinel, and decoder context parameters unused even though the same parameters are required by enabled legacy formats. Prefix the shared names with underscores while retaining their use in enabled branches, so the no-legacy feature matrix remains warning-clean without changing the ABI or runtime behavior. Test Plan: - cargo check --manifest-path rust/Cargo.toml --no-default-features --features compression,decompression,dict-builder -- passed. - cargo check --manifest-path rust/Cargo.toml --no-default-features --features decompression,legacy-v04,legacy-v05,legacy-v06,legacy-v07 -- passed. - cargo +nightly fmt --manifest-path rust/Cargo.toml -- --check -- passed. - cargo clippy --manifest-path rust/Cargo.toml --no-default-features --features compression,decompression,dict-builder --lib -- -D warnings -- passed. - Same clippy command with decompression and legacy-v04 through legacy-v07 features -- passed. - git diff --cached --check -- passed.
This commit is contained in:
+15
-15
@@ -391,30 +391,30 @@ fn legacy_empty_mut_ptr() -> *mut c_void {
|
||||
* ignored error result. The caller owns the projected pointer slot and the
|
||||
* C helper's historical behavior is to leave that slot untouched while an
|
||||
* initialization attempt replaces it only after successful creation. */
|
||||
unsafe fn free_legacy_stream_context(legacy_context: *mut c_void, version: u32) {
|
||||
unsafe fn free_legacy_stream_context(_legacy_context: *mut c_void, version: u32) {
|
||||
match version {
|
||||
#[cfg(feature = "legacy-v04")]
|
||||
4 => {
|
||||
let _ = crate::legacy::zstd_v04::ZBUFFv04_freeDCtx(
|
||||
legacy_context.cast::<crate::legacy::zstd_v04::ZBUFFv04_DCtx>(),
|
||||
_legacy_context.cast::<crate::legacy::zstd_v04::ZBUFFv04_DCtx>(),
|
||||
);
|
||||
}
|
||||
#[cfg(feature = "legacy-v05")]
|
||||
5 => {
|
||||
let _ = crate::legacy::zstd_v05::ZBUFFv05_freeDCtx(
|
||||
legacy_context.cast::<crate::legacy::zstd_v05::ZBUFFv05_DCtx>(),
|
||||
_legacy_context.cast::<crate::legacy::zstd_v05::ZBUFFv05_DCtx>(),
|
||||
);
|
||||
}
|
||||
#[cfg(feature = "legacy-v06")]
|
||||
6 => {
|
||||
let _ = crate::legacy::zstd_v06::ZBUFFv06_freeDCtx(
|
||||
legacy_context.cast::<crate::legacy::zstd_v06::ZBUFFv06_DCtx>(),
|
||||
_legacy_context.cast::<crate::legacy::zstd_v06::ZBUFFv06_DCtx>(),
|
||||
);
|
||||
}
|
||||
#[cfg(feature = "legacy-v07")]
|
||||
7 => {
|
||||
let _ = crate::legacy::zstd_v07::ZBUFFv07_freeDCtx(
|
||||
legacy_context.cast::<crate::legacy::zstd_v07::ZBUFFv07_DCtx>(),
|
||||
_legacy_context.cast::<crate::legacy::zstd_v07::ZBUFFv07_DCtx>(),
|
||||
);
|
||||
}
|
||||
_ => {}
|
||||
@@ -432,7 +432,7 @@ unsafe fn init_legacy_stream(
|
||||
dict: *const c_void,
|
||||
dict_size: usize,
|
||||
) -> usize {
|
||||
let dict = if dict.is_null() {
|
||||
let _dict = if dict.is_null() {
|
||||
debug_assert_eq!(dict_size, 0);
|
||||
legacy_empty_const_ptr()
|
||||
} else {
|
||||
@@ -461,7 +461,7 @@ unsafe fn init_legacy_stream(
|
||||
}
|
||||
let _ = crate::legacy::zstd_v04::ZBUFFv04_decompressInit(context);
|
||||
let _ = crate::legacy::zstd_v04::ZBUFFv04_decompressWithDictionary(
|
||||
context, dict, dict_size,
|
||||
context, _dict, dict_size,
|
||||
);
|
||||
set_field(legacy_context_slot, context.cast::<c_void>());
|
||||
0
|
||||
@@ -478,7 +478,7 @@ unsafe fn init_legacy_stream(
|
||||
return ERROR(ZstdErrorCode::MemoryAllocation);
|
||||
}
|
||||
let _ = crate::legacy::zstd_v05::ZBUFFv05_decompressInitDictionary(
|
||||
context, dict, dict_size,
|
||||
context, _dict, dict_size,
|
||||
);
|
||||
set_field(legacy_context_slot, context.cast::<c_void>());
|
||||
0
|
||||
@@ -495,7 +495,7 @@ unsafe fn init_legacy_stream(
|
||||
return ERROR(ZstdErrorCode::MemoryAllocation);
|
||||
}
|
||||
let _ = crate::legacy::zstd_v06::ZBUFFv06_decompressInitDictionary(
|
||||
context, dict, dict_size,
|
||||
context, _dict, dict_size,
|
||||
);
|
||||
set_field(legacy_context_slot, context.cast::<c_void>());
|
||||
0
|
||||
@@ -512,7 +512,7 @@ unsafe fn init_legacy_stream(
|
||||
return ERROR(ZstdErrorCode::MemoryAllocation);
|
||||
}
|
||||
let _ = crate::legacy::zstd_v07::ZBUFFv07_decompressInitDictionary(
|
||||
context, dict, dict_size,
|
||||
context, _dict, dict_size,
|
||||
);
|
||||
set_field(legacy_context_slot, context.cast::<c_void>());
|
||||
0
|
||||
@@ -529,7 +529,7 @@ unsafe fn init_legacy_stream(
|
||||
* return the amount they consumed/produced through the public buffer
|
||||
* positions. */
|
||||
unsafe fn decompress_legacy_stream(
|
||||
legacy_context: *mut c_void,
|
||||
_legacy_context: *mut c_void,
|
||||
version: u32,
|
||||
output: *mut ZSTD_outBuffer,
|
||||
input: *mut ZSTD_inBuffer,
|
||||
@@ -551,7 +551,7 @@ unsafe fn decompress_legacy_stream(
|
||||
let dst = (*output).dst.cast::<u8>().wrapping_add((*output).pos);
|
||||
let mut decoded_size = (*output).size.wrapping_sub((*output).pos);
|
||||
let hint = crate::legacy::zstd_v04::ZBUFFv04_decompressContinue(
|
||||
legacy_context.cast(),
|
||||
_legacy_context.cast(),
|
||||
dst.cast(),
|
||||
&mut decoded_size,
|
||||
src.cast(),
|
||||
@@ -568,7 +568,7 @@ unsafe fn decompress_legacy_stream(
|
||||
let dst = (*output).dst.cast::<u8>().wrapping_add((*output).pos);
|
||||
let mut decoded_size = (*output).size.wrapping_sub((*output).pos);
|
||||
let hint = crate::legacy::zstd_v05::ZBUFFv05_decompressContinue(
|
||||
legacy_context.cast(),
|
||||
_legacy_context.cast(),
|
||||
dst.cast(),
|
||||
&mut decoded_size,
|
||||
src.cast(),
|
||||
@@ -585,7 +585,7 @@ unsafe fn decompress_legacy_stream(
|
||||
let dst = (*output).dst.cast::<u8>().wrapping_add((*output).pos);
|
||||
let mut decoded_size = (*output).size.wrapping_sub((*output).pos);
|
||||
let hint = crate::legacy::zstd_v06::ZBUFFv06_decompressContinue(
|
||||
legacy_context.cast(),
|
||||
_legacy_context.cast(),
|
||||
dst.cast(),
|
||||
&mut decoded_size,
|
||||
src.cast(),
|
||||
@@ -602,7 +602,7 @@ unsafe fn decompress_legacy_stream(
|
||||
let dst = (*output).dst.cast::<u8>().wrapping_add((*output).pos);
|
||||
let mut decoded_size = (*output).size.wrapping_sub((*output).pos);
|
||||
let hint = crate::legacy::zstd_v07::ZBUFFv07_decompressContinue(
|
||||
legacy_context.cast(),
|
||||
_legacy_context.cast(),
|
||||
dst.cast(),
|
||||
&mut decoded_size,
|
||||
src.cast(),
|
||||
|
||||
Reference in New Issue
Block a user