1
0
Fork 0
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:
Robin Appelman 2025-09-16 22:59:08 +02:00
commit 6143e0289b

View file

@ -654,7 +654,13 @@ impl SendPropValue {
SendPropParseDefinition::NormalVarInt { unsigned, .. } => {
read_var_int(stream, !*unsigned)
.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)
}
SendPropParseDefinition::UnsignedInt { bit_count, .. } => {