data = self.ReadData(decomp)
self.ProcessContentsUpdate(data)
self.Detail('Loaded data size %x' % len(data))
+
+ def GetImage(self):
+ """Get the image containing this entry
+
+ Returns:
+ Image object containing this entry
+ """
+ return self.section.GetImage()
areas.append(fmap_util.FmapArea(pos or 0, entry.size or 0,
tools.FromUnicode(entry.name), 0))
- entries = self.section.image.GetEntries()
+ entries = self.GetImage().GetEntries()
areas = []
for entry in entries.values():
_AddEntries(areas, entry)
def __init__(self, section, etype, node, test=False):
if not test:
Entry.__init__(self, section, etype, node)
- if section:
- self.image = section.image
self._entries = OrderedDict()
self._pad_byte = 0
self._sort = False
Image size as an integer number of bytes, which may be None if the
image size is dynamic and its sections have not yet been packed
"""
- return self.image.size
+ return self.GetImage().size
def FindEntryType(self, etype):
"""Find an entry type in the section
for entry in self._entries.values():
entry.LoadData(decomp)
self.Detail('Loaded data')
+
+ def GetImage(self):
+ """Get the image containing this section
+
+ Note that a top-level section is actually an Image, so this function may
+ return self.
+
+ Returns:
+ Image object containing this section
+ """
+ if not self.section:
+ return self
+ return self.section.GetImage()
we create a section manually.
"""
def __init__(self, name, node, test=False):
- self.image = self
section.Entry_section.__init__(self, None, 'section', node, test)
self.name = 'main-section'
self.image_name = name