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

Avoid sign-extending unsigned VarInts

This commit is contained in:
Nocrex 2025-09-15 21:05:32 +02:00
commit 363821a545

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, .. } => {