1
0
Fork 0
mirror of https://codeberg.org/icewind/vbsp.git synced 2026-06-03 10:44:07 +02:00

entity utf8 fixes?

This commit is contained in:
Robin Appelman 2023-12-27 20:12:26 +01:00
commit d11d90c8e6
4 changed files with 16 additions and 2 deletions

View file

@ -500,6 +500,10 @@ impl Packfile {
};
result
}
pub fn into_zip(self) -> Mutex<ZipArchive<Cursor<Vec<u8>>>> {
self.zip
}
}
fn try_read_enum<Enum, Reader, Error, ErrorFn>(

View file

@ -28,8 +28,9 @@ impl<'a> LumpReader<Cursor<Cow<'a, [u8]>>> {
impl<R: BinReaderExt + Read> LumpReader<R> {
pub fn read_entities(&mut self) -> BspResult<Entities> {
let mut entities = String::with_capacity(self.length);
self.inner.read_to_string(&mut entities)?;
let mut data: Vec<u8> = Vec::with_capacity(self.length);
self.inner.read_exact(&mut data)?;
let entities = String::from_utf8(data).map_err(|e| StringError::from(e.utf8_error()))?;
Ok(Entities { entities })
}