Mercurial > paraspace
diff paraspace/dexfile.py @ 98:c0c127c7b37e
Check and fix issues of map sizes
author | Thinker K.F. Li <thinker@codemud.net> |
---|---|
date | Mon, 25 Jul 2011 20:37:32 +0800 |
parents | 00cd331f8aa8 |
children | b2db11aed6b8 |
line wrap: on
line diff
--- a/paraspace/dexfile.py Mon Jul 25 17:46:20 2011 +0800 +++ b/paraspace/dexfile.py Mon Jul 25 20:37:32 2011 +0800 @@ -979,7 +979,8 @@ child_names = \ 'classIdx accessFlags superclassIdx interfacesOff interfacesOffRef ' \ 'sourceFileIdx annotationsOff annotationsOffRef ' \ - 'classDataOff staticValuesOff staticValuesOffRef'.split() + 'classDataOff classDataOffRef staticValuesOff ' \ + 'staticValuesOffRef'.split() pass @@ -1702,10 +1703,28 @@ pass raise ValueError, 'can not find class definition for \'%s\'' % (name) + ## \brief Update size of map items. + # + # Corresponding data lists of maps may be changed, it should be updated + # before restore dependencies and keep it consistent. + # + def _update_map_sizes(self): + for mapitem in self.maps.items.items: + attr = DEXFile.block_defs[mapitem.type] + datalist = getattr(self, attr) + if isinstance(datalist, array): + mapitem.size = len(datalist.items) + pass + pass + pass + + ## \brief Return an unlinked version. def get_unlinked(self): from paraspace.dex_deptracker import restore_dependencies + + self._update_map_sizes() + unlinked = DEXFile() - for attr, value in self.__dict__.items(): setattr(unlinked, attr, value) pass