File tree Expand file tree Collapse file tree 1 file changed +6
-4
lines changed Expand file tree Collapse file tree 1 file changed +6
-4
lines changed Original file line number Diff line number Diff line change @@ -115,10 +115,13 @@ impl Lz4Encoder {
115
115
return Ok ( drained_before) ;
116
116
}
117
117
118
+ let mut src_size = 0 ;
119
+
118
120
let min_dst_size = match & lz4_fn {
119
121
Lz4Fn :: Begin => LZ4F_HEADER_SIZE_MAX ,
120
122
Lz4Fn :: Update { input } => {
121
- min_dst_size ( input. unwritten ( ) . len ( ) . min ( self . limit ) , & self . preferences )
123
+ src_size = input. unwritten ( ) . len ( ) . min ( self . limit ) ;
124
+ min_dst_size ( src_size, & self . preferences )
122
125
}
123
126
Lz4Fn :: Flush | Lz4Fn :: End => self . flush_buffer_size ,
124
127
} ;
@@ -148,18 +151,17 @@ impl Lz4Encoder {
148
151
len
149
152
}
150
153
Lz4Fn :: Update { input } => {
151
- let size = input. unwritten ( ) . len ( ) . min ( self . limit ) ;
152
154
let len = check_error ( unsafe {
153
155
LZ4F_compressUpdate (
154
156
self . ctx . get_mut ( ) . ctx ,
155
157
dst_buffer,
156
158
min_dst_size,
157
159
input. unwritten ( ) . as_ptr ( ) ,
158
- size ,
160
+ src_size ,
159
161
core:: ptr:: null ( ) ,
160
162
)
161
163
} ) ?;
162
- input. advance ( size ) ;
164
+ input. advance ( src_size ) ;
163
165
len
164
166
}
165
167
Lz4Fn :: Flush => check_error ( unsafe {
You can’t perform that action at this time.
0 commit comments