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:
parent
e5e54de65d
commit
8f754d3f44
4 changed files with 8 additions and 5 deletions
6
Cargo.lock
generated
6
Cargo.lock
generated
|
|
@ -69,7 +69,9 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "bitbuffer"
|
name = "bitbuffer"
|
||||||
version = "0.8.0"
|
version = "0.8.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "3ec331c3602bf9f2fde16a85cb3ddf13219f9653ee55c18948ff4418c85cfbb0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"bitbuffer_derive",
|
"bitbuffer_derive",
|
||||||
"err-derive",
|
"err-derive",
|
||||||
|
|
@ -80,6 +82,8 @@ dependencies = [
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "bitbuffer_derive"
|
name = "bitbuffer_derive"
|
||||||
version = "0.8.0"
|
version = "0.8.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "7f51dcbe693d21078994abd2afac5adc9bcc80fbdf80206ebdb33fec4a145693"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote",
|
"quote",
|
||||||
|
|
|
||||||
|
|
@ -21,8 +21,7 @@ name = "loop"
|
||||||
path = "src/bin/loop.rs"
|
path = "src/bin/loop.rs"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
#bitbuffer = "0.8"
|
bitbuffer = "0.8.1"
|
||||||
bitbuffer = { version = "0.8", path = "../../bitbuffer"}
|
|
||||||
num_enum = "0.5"
|
num_enum = "0.5"
|
||||||
num-traits = "0.2"
|
num-traits = "0.2"
|
||||||
enumflags2 = "0.6"
|
enumflags2 = "0.6"
|
||||||
|
|
|
||||||
|
|
@ -32,7 +32,7 @@ impl<'a> Demo<'a> {
|
||||||
|
|
||||||
pub(crate) fn handle_utf8_error(error: BitError) -> ReadResult<String> {
|
pub(crate) fn handle_utf8_error(error: BitError) -> ReadResult<String> {
|
||||||
match error {
|
match error {
|
||||||
BitError::Utf8Error(_) => Ok("-- Malformed utf8 --".into()),
|
BitError::Utf8Error(_, _) => Ok("-- Malformed utf8 --".into()),
|
||||||
_ => Err(error),
|
_ => Err(error),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -105,7 +105,7 @@ pub enum GameEventError {
|
||||||
impl From<BitError> for ParseError {
|
impl From<BitError> for ParseError {
|
||||||
fn from(err: BitError) -> ParseError {
|
fn from(err: BitError) -> ParseError {
|
||||||
match err {
|
match err {
|
||||||
BitError::Utf8Error(utf8_error) => ParseError::MalformedUTF8(utf8_error),
|
BitError::Utf8Error(utf8_error, _) => ParseError::MalformedUTF8(utf8_error),
|
||||||
_ => ParseError::ReadError(err),
|
_ => ParseError::ReadError(err),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue