mirror of
https://github.com/servo/servo.git
synced 2025-07-24 15:50:21 +01:00
Don't use transmute in nsStyleCoord sugar
This commit is contained in:
parent
a0c502261d
commit
232a0ffc6d
1 changed files with 2 additions and 3 deletions
|
@ -3,7 +3,6 @@
|
|||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
use bindings::{Gecko_ResetStyleCoord, Gecko_SetStyleCoordCalcValue, Gecko_AddRefCalcArbitraryThread};
|
||||
use std::mem::transmute;
|
||||
use structs::{nsStyleCoord_Calc, nsStyleUnit, nsStyleUnion, nsStyleCoord, nsStyleSides, nsStyleCorners};
|
||||
use structs::{nsStyleCoord_CalcValue, nscoord};
|
||||
|
||||
|
@ -254,7 +253,7 @@ pub trait CoordDataMut : CoordData {
|
|||
#[inline]
|
||||
unsafe fn as_calc_mut(&mut self) -> &mut nsStyleCoord_Calc {
|
||||
debug_assert!(self.unit() == nsStyleUnit::eStyleUnit_Calc);
|
||||
transmute(*self.union().mPointer.as_mut() as *mut nsStyleCoord_Calc)
|
||||
&mut *(*self.union().mPointer.as_mut() as *mut nsStyleCoord_Calc)
|
||||
}
|
||||
|
||||
#[inline]
|
||||
|
@ -328,6 +327,6 @@ pub trait CoordData {
|
|||
#[inline]
|
||||
unsafe fn as_calc(&self) -> &nsStyleCoord_Calc {
|
||||
debug_assert!(self.unit() == nsStyleUnit::eStyleUnit_Calc);
|
||||
transmute(*self.union().mPointer.as_ref() as *const nsStyleCoord_Calc)
|
||||
&*(*self.union().mPointer.as_ref() as *const nsStyleCoord_Calc)
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue