File tree Expand file tree Collapse file tree 1 file changed +6
-5
lines changed Expand file tree Collapse file tree 1 file changed +6
-5
lines changed Original file line number Diff line number Diff line change @@ -45,7 +45,7 @@ impl fmt::Display for Iort {
45
45
impl Iort {
46
46
pub fn nodes ( & self ) -> IortNodeIter {
47
47
let pointer = unsafe { ( self as * const Iort ) . add ( 1 ) as * const u8 } ;
48
- let remaining_length = self . header . length as u32 - size_of :: < Iort > ( ) as u32 ;
48
+ let remaining_length = self . header . length as u32 - core :: mem :: size_of :: < Iort > ( ) as u32 ;
49
49
50
50
IortNodeIter {
51
51
pointer,
@@ -79,10 +79,11 @@ pub enum IortNode<'a> {
79
79
MemoryRange ( & ' a MemoryRangeNode ) ,
80
80
}
81
81
82
- impl IortNode {
82
+ impl IortNode < ' _ > {
83
83
pub fn id_mapping_array ( & self ) -> Option < & [ IortIdMapping ] > {
84
- let id_mapping_num = unsafe { * ( self as * const IortNode as * const IortNodeHeader ) . id_mapping_num } ;
85
- let id_mapping_array_offset = unsafe { * ( self as * const IortNode as * const IortNodeHeader ) . id_mapping_array_offset } ;
84
+ let node_header = unsafe { * ( self as * const IortNode as * const IortNodeHeader ) } ;
85
+ let id_mapping_num = node_header. id_mapping_num ;
86
+ let id_mapping_array_offset = node_header. id_mapping_array_offset ;
86
87
87
88
if id_mapping_num == 0 {
88
89
return None ;
@@ -123,7 +124,7 @@ impl<'a> Iterator for IortNodeIter<'a> {
123
124
_ => return None ,
124
125
} ;
125
126
126
- self . pointer = unsafe { self . pointer . add ( node_length) } ;
127
+ self . pointer = unsafe { self . pointer . add ( node_length as usize ) } ;
127
128
self . remaining_length -= node_length as u32 ;
128
129
129
130
Some ( node)
You can’t perform that action at this time.
0 commit comments