Skip to content

Commit 90a0fa9

Browse files
committed
Fix input/output needing more check
1 parent c0f93bc commit 90a0fa9

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/stream.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -95,15 +95,15 @@ impl CompressStream {
9595
&mut nop_callback,
9696
);
9797
if ret != 0 {
98-
if available_out == 0 {
99-
self.result = BrotliStreamResult::NeedsMoreOutput as i32;
100-
self.last_input_offset = input_offset;
101-
Ok(output.into_boxed_slice())
102-
} else if available_in == 0 {
98+
if available_in == 0 {
10399
output.truncate(output_offset);
104100
self.result = BrotliStreamResult::NeedsMoreInput as i32;
105101
self.last_input_offset = input.len();
106102
Ok(output.into_boxed_slice())
103+
} else if available_out == 0 {
104+
self.result = BrotliStreamResult::NeedsMoreOutput as i32;
105+
self.last_input_offset = input_offset;
106+
Ok(output.into_boxed_slice())
107107
} else {
108108
self.result = -1;
109109
self.last_input_offset = 0;

0 commit comments

Comments
 (0)