Skip to content

Commit 764b423

Browse files
committed
fix the issue
1 parent 51d11d1 commit 764b423

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

src/block/decompress.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -131,9 +131,9 @@ unsafe fn copy_from_dict(
131131
pub(super) fn read_integer_ptr(
132132
input_ptr: &mut *const u8,
133133
_input_ptr_end: *const u8,
134-
) -> Result<u32, DecompressError> {
134+
) -> Result<usize, DecompressError> {
135135
// We start at zero and count upwards.
136-
let mut n: u32 = 0;
136+
let mut n: usize = 0;
137137
// If this byte takes value 255 (the maximum value it can take), another byte is read
138138
// and added to the sum. This repeats until a byte lower than 255 is read.
139139
loop {
@@ -147,7 +147,7 @@ pub(super) fn read_integer_ptr(
147147
}
148148
let extra = unsafe { input_ptr.read() };
149149
*input_ptr = unsafe { input_ptr.add(1) };
150-
n += extra as u32;
150+
n += extra as usize;
151151

152152
// We continue if we got 255, break otherwise.
153153
if extra != 0xFF {

src/block/decompress_safe.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,9 @@ use alloc::vec::Vec;
2525
/// is encoded to _255 + 255 + 255 + 4 = 769_. The bytes after the first 4 is ignored, because
2626
/// 4 is the first non-0xFF byte.
2727
#[inline]
28-
pub(super) fn read_integer(input: &[u8], input_pos: &mut usize) -> Result<u32, DecompressError> {
28+
pub(super) fn read_integer(input: &[u8], input_pos: &mut usize) -> Result<usize, DecompressError> {
2929
// We start at zero and count upwards.
30-
let mut n: u32 = 0;
30+
let mut n: usize = 0;
3131
// If this byte takes value 255 (the maximum value it can take), another byte is read
3232
// and added to the sum. This repeats until a byte lower than 255 is read.
3333
loop {
@@ -36,7 +36,7 @@ pub(super) fn read_integer(input: &[u8], input_pos: &mut usize) -> Result<u32, D
3636
.get(*input_pos)
3737
.ok_or(DecompressError::ExpectedAnotherByte)?;
3838
*input_pos += 1;
39-
n += extra as u32;
39+
n += extra as usize;
4040

4141
// We continue if we got 255, break otherwise.
4242
if extra != 0xFF {

0 commit comments

Comments
 (0)