Concat NUL terminator to dynamic strings before format

This commit is contained in:
Joonas Javanainen 2017-10-25 20:08:24 +03:00
parent 3c88d70a74
commit 0061a209b6
No known key found for this signature in database
GPG Key ID: D39CCA5CB19B9179

View File

@ -76,7 +76,10 @@ macro_rules! im_str {
}
});
($e:tt, $($arg:tt)*) => ({
&::imgui::ImString::new(format!($e, $($arg)*))
unsafe {
&::imgui::ImString::from_utf8_with_nul_unchecked(
format!(concat!($e, "\0"), $($arg)*).into_bytes())
}
})
}