diff options
Diffstat (limited to 'components/gfx')
-rw-r--r-- | components/gfx/font.rs | 14 | ||||
-rw-r--r-- | components/gfx/font_cache_task.rs | 4 |
2 files changed, 6 insertions, 12 deletions
diff --git a/components/gfx/font.rs b/components/gfx/font.rs index 6fffb845106..b1765e8ae2c 100644 --- a/components/gfx/font.rs +++ b/components/gfx/font.rs @@ -6,9 +6,8 @@ use euclid::{Point2D, Rect, Size2D}; use smallvec::SmallVec; use std::borrow::ToOwned; use std::cell::RefCell; -use std::mem; use std::rc::Rc; -use std::slice; +use std::str; use std::sync::Arc; use style::computed_values::{font_stretch, font_variant, font_weight}; use style::properties::style_structs::Font as FontStyle; @@ -56,12 +55,11 @@ pub trait FontTableTagConversions { impl FontTableTagConversions for FontTableTag { fn tag_to_str(&self) -> String { - unsafe { - let pointer = mem::transmute::<&u32, *const u8>(self); - let mut bytes = slice::from_raw_parts(pointer, 4).to_vec(); - bytes.reverse(); - String::from_utf8_unchecked(bytes) - } + let bytes = [(self >> 24) as u8, + (self >> 16) as u8, + (self >> 8) as u8, + (self >> 0) as u8]; + str::from_utf8(&bytes).unwrap().to_owned() } } diff --git a/components/gfx/font_cache_task.rs b/components/gfx/font_cache_task.rs index 100fde2050f..a9ba770058b 100644 --- a/components/gfx/font_cache_task.rs +++ b/components/gfx/font_cache_task.rs @@ -81,15 +81,11 @@ pub enum Command { Exit(Sender<()>), } -unsafe impl Send for Command {} - /// Reply messages sent from the font cache task to the FontContext caller. pub enum Reply { GetFontTemplateReply(Option<Arc<FontTemplateData>>), } -unsafe impl Send for Reply {} - /// The font cache task itself. It maintains a list of reference counted /// font templates that are currently in use. struct FontCache { |