Bug fix in f_string
This commit is contained in:
parent
efe6f6173b
commit
ac8ba74a3e
1 changed files with 2 additions and 2 deletions
|
@ -38,12 +38,12 @@ impl Printf<str> for FString {
|
||||||
#[inline(always)]
|
#[inline(always)]
|
||||||
fn printf_unsafe<A: AsRef<str>>(&mut self, fmt: A) {
|
fn printf_unsafe<A: AsRef<str>>(&mut self, fmt: A) {
|
||||||
let tmp = U16CString::from_str(fmt).unwrap();
|
let tmp = U16CString::from_str(fmt).unwrap();
|
||||||
let new_len = tmp.len();
|
let mut tmp_bytes = tmp.into_vec_with_nul();
|
||||||
|
let new_len = tmp_bytes.len();
|
||||||
if new_len > self.0.cap as usize {
|
if new_len > self.0.cap as usize {
|
||||||
// TODO: use Result instead
|
// TODO: use Result instead
|
||||||
panic!("New string is too long and no printf ffi binding has been provided");
|
panic!("New string is too long and no printf ffi binding has been provided");
|
||||||
}
|
}
|
||||||
let mut tmp_bytes = tmp.into_vec_with_nul();
|
|
||||||
tmp_bytes.resize(self.0.cap as usize, 0);
|
tmp_bytes.resize(self.0.cap as usize, 0);
|
||||||
unsafe {
|
unsafe {
|
||||||
std::ptr::copy_nonoverlapping(
|
std::ptr::copy_nonoverlapping(
|
||||||
|
|
Loading…
Reference in a new issue