mirror of
https://codeberg.org/demostf/parser.git
synced 2026-06-03 10:14:06 +02:00
Merge pull request 'Avoid sign-extending unsigned VarInts' (#5) from nocrex/parser:unsigned-varint-fix into master
Reviewed-on: https://codeberg.org/demostf/parser/pulls/5
This commit is contained in:
commit
6143e0289b
1 changed files with 7 additions and 1 deletions
|
|
@ -654,7 +654,13 @@ impl SendPropValue {
|
||||||
SendPropParseDefinition::NormalVarInt { unsigned, .. } => {
|
SendPropParseDefinition::NormalVarInt { unsigned, .. } => {
|
||||||
read_var_int(stream, !*unsigned)
|
read_var_int(stream, !*unsigned)
|
||||||
.map_err(ParseError::from)
|
.map_err(ParseError::from)
|
||||||
.map(|int| int as i64)
|
.map(|int| {
|
||||||
|
if *unsigned {
|
||||||
|
int as u32 as i64
|
||||||
|
} else {
|
||||||
|
int as i64
|
||||||
|
}
|
||||||
|
})
|
||||||
.map(SendPropValue::from)
|
.map(SendPropValue::from)
|
||||||
}
|
}
|
||||||
SendPropParseDefinition::UnsignedInt { bit_count, .. } => {
|
SendPropParseDefinition::UnsignedInt { bit_count, .. } => {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue