Skip to content

Commit 298569d

Browse files
committed
fix: handle non_exhaustive tinfl return status in c API
1 parent 84a94e8 commit 298569d

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/tinfl.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@ pub const TINFL_DECOMPRESS_MEM_TO_MEM_FAILED: size_t = usize::MAX;
1212
#[allow(bad_style)]
1313
#[repr(C)]
1414
pub enum tinfl_status {
15+
/* This flag is a placeholder to cover return statuses not implemented or handled yet.. */
16+
TINFL_STATUS_UNKNOWN = -32,
17+
1518
/* This flags indicates the inflator needs 1 or more input bytes to make forward progress, but the caller is indicating that no more are available. The compressed data */
1619
/* is probably corrupted. If you call the inflator again with more bytes it'll try to continue processing the input but this is a BAD sign (either the data is corrupted or you called it incorrectly). */
1720
/* If you call it again with no input you'll just get TINFL_STATUS_FAILED_CANNOT_MAKE_PROGRESS again. */
@@ -55,6 +58,7 @@ impl From<TINFLStatus> for tinfl_status {
5558
TINFLStatus::Done => TINFL_STATUS_DONE,
5659
TINFLStatus::NeedsMoreInput => TINFL_STATUS_NEEDS_MORE_INPUT,
5760
TINFLStatus::HasMoreOutput => TINFL_STATUS_HAS_MORE_OUTPUT,
61+
_ => TINFL_STATUS_UNKNOWN,
5862
// TINFLStatus::BlockBoundary => panic!("not supported in C API"),
5963
}
6064
}

0 commit comments

Comments
 (0)