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