fix(cli): initialize the patch-from fileio preference
Set the C file-I/O patch-from flag explicitly when the Rust frontend creates preferences. The parser still rejects the unported option, but this keeps the backend in ordinary dictionary mode instead of reading an unspecified field. Test Plan: - cargo test --manifest-path rust/cli/Cargo.toml --all-features - cargo clippy --manifest-path rust/cli/Cargo.toml --all-targets -- -D warnings - git diff --check Refs: rust/src/zstd_cli.rs, programs/fileio.c
This commit is contained in:
@@ -157,6 +157,7 @@ unsafe extern "C" {
|
||||
fn FIO_setContentSize(prefs: *mut FIO_prefs_t, value: c_int);
|
||||
fn FIO_setAsyncIOFlag(prefs: *mut FIO_prefs_t, value: c_int);
|
||||
fn FIO_setPassThroughFlag(prefs: *mut FIO_prefs_t, value: c_int);
|
||||
fn FIO_setPatchFromMode(prefs: *mut FIO_prefs_t, value: c_int);
|
||||
fn FIO_setMMapDict(prefs: *mut FIO_prefs_t, value: c_int);
|
||||
fn FIO_setNbFilesTotal(ctx: *mut FIO_ctx_t, value: c_int);
|
||||
fn FIO_setHasStdinInput(ctx: *mut FIO_ctx_t, value: c_int);
|
||||
@@ -1240,6 +1241,10 @@ unsafe fn apply_preferences(cli: &Cli, prefs: *mut FIO_prefs_t, ctx: *mut FIO_ct
|
||||
if let Some(value) = cli.pass_through {
|
||||
FIO_setPassThroughFlag(prefs, value);
|
||||
}
|
||||
/* `FIO_createPreferences()` leaves this field unspecified. The Rust
|
||||
* frontend does not yet parse --patch-from, so explicitly keep the
|
||||
* C file-I/O backend in ordinary dictionary mode. */
|
||||
FIO_setPatchFromMode(prefs, 0);
|
||||
FIO_setContentSize(prefs, cli.content_size);
|
||||
if let Some(value) = cli.dict_id {
|
||||
FIO_setDictIDFlag(prefs, value);
|
||||
|
||||
Reference in New Issue
Block a user