Fix unsound transmute
This commit is contained in:
parent
533a7b6c52
commit
682aa9d2d0
1 changed files with 3 additions and 2 deletions
|
@ -32,6 +32,7 @@ pub struct RawPCScreenFont {
|
|||
}
|
||||
|
||||
/// The glyph type for [PCScreenFont].
|
||||
#[derive(Clone, Copy)]
|
||||
pub struct Glyph {
|
||||
/// The size of this glyph.
|
||||
pub len: u32,
|
||||
|
@ -113,7 +114,7 @@ pub fn parse_pc_screen_font(data: RawPCScreenFont) -> Result<PCScreenFont, crate
|
|||
flags: data.flags,
|
||||
height: data.height,
|
||||
width: data.width,
|
||||
glyphs: core::mem::transmute(data.glyphs),
|
||||
glyphs: Vec::from(core::mem::transmute::<&[u8], &[Glyph]>(data.glyphs.as_slice())),
|
||||
unitable: Some(unitable),
|
||||
};
|
||||
return Ok(out);
|
||||
|
@ -124,7 +125,7 @@ pub fn parse_pc_screen_font(data: RawPCScreenFont) -> Result<PCScreenFont, crate
|
|||
flags: data.flags,
|
||||
height: data.height,
|
||||
width: data.width,
|
||||
glyphs: core::mem::transmute(data.glyphs),
|
||||
glyphs: Vec::from(core::mem::transmute::<&[u8], &[Glyph]>(data.glyphs.as_slice())),
|
||||
unitable: None,
|
||||
};
|
||||
Ok(out)
|
||||
|
|
Loading…
Add table
Reference in a new issue