1
0
Fork 0
mirror of https://codeberg.org/demostf/parser.git synced 2026-06-03 18:24:05 +02:00

fix handling of mallformed utf8

This commit is contained in:
Robin Appelman 2020-12-06 21:22:53 +01:00
commit 8f754d3f44
4 changed files with 8 additions and 5 deletions

6
Cargo.lock generated
View file

@ -69,7 +69,9 @@ dependencies = [
[[package]]
name = "bitbuffer"
version = "0.8.0"
version = "0.8.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3ec331c3602bf9f2fde16a85cb3ddf13219f9653ee55c18948ff4418c85cfbb0"
dependencies = [
"bitbuffer_derive",
"err-derive",
@ -80,6 +82,8 @@ dependencies = [
[[package]]
name = "bitbuffer_derive"
version = "0.8.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7f51dcbe693d21078994abd2afac5adc9bcc80fbdf80206ebdb33fec4a145693"
dependencies = [
"proc-macro2",
"quote",

View file

@ -21,8 +21,7 @@ name = "loop"
path = "src/bin/loop.rs"
[dependencies]
#bitbuffer = "0.8"
bitbuffer = { version = "0.8", path = "../../bitbuffer"}
bitbuffer = "0.8.1"
num_enum = "0.5"
num-traits = "0.2"
enumflags2 = "0.6"

View file

@ -32,7 +32,7 @@ impl<'a> Demo<'a> {
pub(crate) fn handle_utf8_error(error: BitError) -> ReadResult<String> {
match error {
BitError::Utf8Error(_) => Ok("-- Malformed utf8 --".into()),
BitError::Utf8Error(_, _) => Ok("-- Malformed utf8 --".into()),
_ => Err(error),
}
}

View file

@ -105,7 +105,7 @@ pub enum GameEventError {
impl From<BitError> for ParseError {
fn from(err: BitError) -> ParseError {
match err {
BitError::Utf8Error(utf8_error) => ParseError::MalformedUTF8(utf8_error),
BitError::Utf8Error(utf8_error, _) => ParseError::MalformedUTF8(utf8_error),
_ => ParseError::ReadError(err),
}
}