aboutsummaryrefslogtreecommitdiff
path: root/src/primitive/string.rs
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/primitive/string.rs7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/primitive/string.rs b/src/primitive/string.rs
index 86bcdec..dcd4f7c 100644
--- a/src/primitive/string.rs
+++ b/src/primitive/string.rs
@@ -7,8 +7,8 @@ use failure::Error;
use log::trace;
-use crate::{Deserialize, DeserializeUTF8, Serialize, SerializeUTF8};
use crate::util;
+use crate::{Deserialize, DeserializeUTF8, Serialize, SerializeUTF8};
/// We Shadow the String type here as we can only use impl on types in our own scope.
///
@@ -33,7 +33,6 @@ impl SerializeUTF8 for String {
fn serialize_utf8(&self) -> Result<Vec<u8>, Error> {
let mut res: Vec<u8> = Vec::new();
res.extend(self.clone().into_bytes());
- res.extend(vec![0x00]);
util::prepend_byte_len(&mut res);
return Ok(res);
}
@@ -64,6 +63,7 @@ impl Deserialize for String {
}
let res: String = String::from_utf16(&chars).unwrap();
+ trace!("parsed string: {}", res);
return Ok((pos, res));
}
}
@@ -81,6 +81,7 @@ impl DeserializeUTF8 for String {
let ulen = len as usize;
let mut res: String = String::from_utf8(b[4..(ulen + 4)].to_vec())?;
+ trace!("parsed string: {}", res);
// If the last byte is zero remove it
// Receiving a string as bytearray will sometimes have
@@ -89,6 +90,8 @@ impl DeserializeUTF8 for String {
let _ = res.pop();
}
+ trace!("parsed string after trunc: {}", res);
+
return Ok((ulen + 4, res));
}
}