mirror of
https://github.com/redstrate/Physis.git
synced 2025-04-21 20:27:46 +00:00
Patch fixing redux: Trim trailing null characters
This fixes broken file operations
This commit is contained in:
parent
4d23bf9f08
commit
66034b6e8d
1 changed files with 2 additions and 1 deletions
|
@ -19,7 +19,8 @@ pub(crate) fn write_bool_as<T: std::convert::From<u8>>(x: &bool) -> T {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub(crate) fn read_string(byte_stream: Vec<u8>) -> String {
|
pub(crate) fn read_string(byte_stream: Vec<u8>) -> String {
|
||||||
String::from_utf8(byte_stream).unwrap()
|
let str = String::from_utf8(byte_stream).unwrap();
|
||||||
|
str.trim_matches(char::from(0)).to_string() // trim \0 from the end of strings
|
||||||
}
|
}
|
||||||
|
|
||||||
pub(crate) fn write_string(str: &String) -> Vec<u8> {
|
pub(crate) fn write_string(str: &String) -> Vec<u8> {
|
||||||
|
|
Loading…
Add table
Reference in a new issue