Skip to content

Commit 2d8b337

Browse files
committed
Add debug assertions
1 parent fd69de7 commit 2d8b337

File tree

2 files changed

+4
-0
lines changed

2 files changed

+4
-0
lines changed

src/version1/mod.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ pub fn compress(data: &[u8]) -> Option<Vec<u8>> {
2121
&mut status,
2222
)
2323
};
24+
debug_assert_eq!(status, 0);
2425
finalize(data, size, status)
2526
}
2627

@@ -30,6 +31,7 @@ pub fn decompress(data: &[u8]) -> Option<Vec<u8>> {
3031
let mut status = 0;
3132
let data =
3233
unsafe { ffi::woffDecode(data.as_ptr() as _, data.len() as _, &mut size, &mut status) };
34+
debug_assert_eq!(status, 0);
3335
finalize(data, size, status)
3436
}
3537

src/version2/mod.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ pub fn compress(data: &[u8], metadata: String, quality: usize, transform: bool)
3636
transform as core::ffi::c_int,
3737
)
3838
};
39+
debug_assert_ne!(status, 0);
3940
if status == 0 {
4041
return None;
4142
}
@@ -55,6 +56,7 @@ pub fn decompress(data: &[u8]) -> Option<Vec<u8>> {
5556
data.len(),
5657
)
5758
};
59+
debug_assert_ne!(status, 0);
5860
if status == 0 {
5961
return None;
6062
}

0 commit comments

Comments
 (0)