Skip to content

Commit

Permalink
make sure we use BigEndian when reading numbers via StreamingReader (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
antiochp authored and ignopeverell committed May 13, 2019
1 parent 59db5e3 commit 4ba7b0a
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions core/src/ser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -393,32 +393,32 @@ impl<'a> StreamingReader<'a> {
impl<'a> Reader for StreamingReader<'a> {
fn read_u8(&mut self) -> Result<u8, Error> {
let buf = self.read_fixed_bytes(1)?;
deserialize(&mut &buf[..])
Ok(buf[0])
}

fn read_u16(&mut self) -> Result<u16, Error> {
let buf = self.read_fixed_bytes(2)?;
deserialize(&mut &buf[..])
Ok(BigEndian::read_u16(&buf[..]))
}

fn read_u32(&mut self) -> Result<u32, Error> {
let buf = self.read_fixed_bytes(4)?;
deserialize(&mut &buf[..])
Ok(BigEndian::read_u32(&buf[..]))
}

fn read_i32(&mut self) -> Result<i32, Error> {
let buf = self.read_fixed_bytes(4)?;
deserialize(&mut &buf[..])
Ok(BigEndian::read_i32(&buf[..]))
}

fn read_u64(&mut self) -> Result<u64, Error> {
let buf = self.read_fixed_bytes(8)?;
deserialize(&mut &buf[..])
Ok(BigEndian::read_u64(&buf[..]))
}

fn read_i64(&mut self) -> Result<i64, Error> {
let buf = self.read_fixed_bytes(8)?;
deserialize(&mut &buf[..])
Ok(BigEndian::read_i64(&buf[..]))
}

/// Read a variable size vector from the underlying stream. Expects a usize
Expand Down

0 comments on commit 4ba7b0a

Please sign in to comment.