File tree Expand file tree Collapse file tree 1 file changed +3
-3
lines changed Expand file tree Collapse file tree 1 file changed +3
-3
lines changed Original file line number Diff line number Diff line change @@ -163,7 +163,7 @@ impl GzHeaderParser {
163
163
if let Some ( crc) = crc {
164
164
crc. update ( buffer) ;
165
165
}
166
- let xlen = parse_le_u16 ( & buffer) ;
166
+ let xlen = parse_le_u16 ( buffer) ;
167
167
self . header . extra = Some ( vec ! [ 0 ; xlen as usize ] ) ;
168
168
self . state = GzHeaderState :: Extra ( crc. take ( ) , 0 ) ;
169
169
} else {
@@ -209,7 +209,7 @@ impl GzHeaderParser {
209
209
while ( * count as usize ) < buffer. len ( ) {
210
210
* count += read_into ( r, & mut buffer[ * count as usize ..] ) ? as u8 ;
211
211
}
212
- let stored_crc = parse_le_u16 ( & buffer) ;
212
+ let stored_crc = parse_le_u16 ( buffer) ;
213
213
let calced_crc = crc. sum ( ) as u16 ;
214
214
if stored_crc != calced_crc {
215
215
return Err ( corrupt ( ) ) ;
@@ -277,7 +277,7 @@ fn read_to_nul<R: Read>(r: &mut R, buffer: &mut Vec<u8>) -> Result<()> {
277
277
}
278
278
279
279
fn parse_le_u16 ( buffer : & [ u8 ; 2 ] ) -> u16 {
280
- ( buffer [ 0 ] as u16 ) | ( ( buffer[ 1 ] as u16 ) << 8 )
280
+ u16:: from_le_bytes ( * buffer)
281
281
}
282
282
283
283
fn bad_header ( ) -> Error {
You can’t perform that action at this time.
0 commit comments