start implementing field
This commit is contained in:
parent
0ae6ce5e88
commit
c84e3e36cc
5 changed files with 145 additions and 32 deletions
|
|
@ -143,6 +143,27 @@ impl<'a> DexFileReader<'a> {
|
|||
})
|
||||
}
|
||||
|
||||
/// Return a [`&TypeIdItem`] from its idx.
|
||||
pub fn get_type_id(&self, idx: usize) -> Result<&TypeIdItem> {
|
||||
self.type_ids
|
||||
.get(idx)
|
||||
.ok_or(Error::InconsistantStruct(format!(
|
||||
"type idx {} out of bound of type_ids (|type_ids| = {})",
|
||||
idx,
|
||||
self.type_ids.len()
|
||||
)))
|
||||
}
|
||||
|
||||
/// Return a [`&FieldIdItem`] from its idx.
|
||||
pub fn get_field_id(&self, idx: usize) -> Result<&FieldIdItem> {
|
||||
self.field_ids
|
||||
.get(idx)
|
||||
.ok_or(Error::InconsistantStruct(format!(
|
||||
"field idx {idx} is out of bound (|field_ids|={})",
|
||||
self.field_ids.len()
|
||||
)))
|
||||
}
|
||||
|
||||
fn sanity_check(&self) -> Result<()> {
|
||||
if self.header.magic.version != [0x30, 0x33, 0x39] {
|
||||
warn!(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue