Mercurial > public > mercurial-scm > hg
diff rust/hg-core/src/revlog/index.rs @ 48543:0a4ac916673e
rhg: RevlogEntry::uncompressed_len is signed
The corresponding Python code appears to explicitly check for non-negative values.
Differential Revision: https://phab.mercurial-scm.org/D11962
author | Simon Sapin <simon.sapin@octobus.net> |
---|---|
date | Tue, 21 Dec 2021 21:23:46 +0100 |
parents | 96ea4db4741b |
children | e91aa800ae5b |
line wrap: on
line diff
--- a/rust/hg-core/src/revlog/index.rs Tue Dec 21 18:50:44 2021 +0100 +++ b/rust/hg-core/src/revlog/index.rs Tue Dec 21 21:23:46 2021 +0100 @@ -118,7 +118,7 @@ offset_override: None, }; - offset += INDEX_ENTRY_SIZE + entry.compressed_len(); + offset += INDEX_ENTRY_SIZE + entry.compressed_len() as usize; } if offset == bytes.len() { @@ -261,13 +261,13 @@ } /// Return the compressed length of the data. - pub fn compressed_len(&self) -> usize { - BigEndian::read_u32(&self.bytes[8..=11]) as usize + pub fn compressed_len(&self) -> u32 { + BigEndian::read_u32(&self.bytes[8..=11]) } /// Return the uncompressed length of the data. - pub fn uncompressed_len(&self) -> usize { - BigEndian::read_u32(&self.bytes[12..=15]) as usize + pub fn uncompressed_len(&self) -> i32 { + BigEndian::read_i32(&self.bytes[12..=15]) } /// Return the revision upon which the data has been derived.