Mercurial > touhou
comparison formats/src/th06/pbg3.rs @ 767:ccb04468c5fa
formats: Use Read::read_exact() and Write::write_all()
Thanks clippy!
author | Emmanuel Gil Peyrot <linkmauve@linkmauve.fr> |
---|---|
date | Tue, 30 Aug 2022 17:07:21 +0200 |
parents | f506ad5c9b17 |
children | cae5f15ca5ed |
comparison
equal
deleted
inserted
replaced
766:8a3b8e2ffa24 | 767:ccb04468c5fa |
---|---|
98 } | 98 } |
99 | 99 |
100 /// Open a PBG3 archive. | 100 /// Open a PBG3 archive. |
101 pub fn from_file(mut file: R) -> io::Result<PBG3<R>> { | 101 pub fn from_file(mut file: R) -> io::Result<PBG3<R>> { |
102 let mut magic = [0; 4]; | 102 let mut magic = [0; 4]; |
103 file.read(&mut magic)?; | 103 file.read_exact(&mut magic)?; |
104 if &magic != b"PBG3" { | 104 if &magic != b"PBG3" { |
105 return Err(io::Error::new(io::ErrorKind::Other, "Wrong magic!")); | 105 return Err(io::Error::new(io::ErrorKind::Other, "Wrong magic!")); |
106 } | 106 } |
107 | 107 |
108 let bitstream = BitStream::new(file); | 108 let bitstream = BitStream::new(file); |