Skip to content

Commit

Permalink
fix unsigned overflow
Browse files Browse the repository at this point in the history
  • Loading branch information
Danil Kondratiev authored and toby committed Dec 1, 2020
1 parent d3ec245 commit 4ec4287
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions src/ser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -218,16 +218,19 @@ impl<'a> ser::Serializer for &'a mut Serializer {
Ok(())
}
fn serialize_u8(self, value: u8) -> Result<()> {
self.serialize_i64(value as i64)
self.serialize_u64(value as u64)
}
fn serialize_u16(self, value: u16) -> Result<()> {
self.serialize_i64(value as i64)
self.serialize_u64(value as u64)
}
fn serialize_u32(self, value: u32) -> Result<()> {
self.serialize_i64(value as i64)
self.serialize_u64(value as u64)
}
fn serialize_u64(self, value: u64) -> Result<()> {
self.serialize_i64(value as i64)
self.push("i");
self.push(value.to_string());
self.push("e");
Ok(())
}
fn serialize_f32(self, _value: f32) -> Result<()> {
Err(Error::InvalidValue("Cannot serialize f32".to_string()))
Expand Down

0 comments on commit 4ec4287

Please sign in to comment.