Mercurial > paraspace
comparison paraspace/dexfile.py @ 107:4b3573d039af
Fix bug of DEXFile_linked.find_method_name_proto().
- It miss understood structure of _DEX_Method to get associated
_DEX_ProtoId.
author | Thinker K.F. Li <thinker@codemud.net> |
---|---|
date | Sat, 30 Jul 2011 22:59:09 +0800 |
parents | 7821c6e89622 |
children | 18be67af7f1e |
comparison
equal
deleted
inserted
replaced
106:7821c6e89622 | 107:4b3573d039af |
---|---|
1806 if method_name == wmethod_name: | 1806 if method_name == wmethod_name: |
1807 return wmethod | 1807 return wmethod |
1808 pass | 1808 pass |
1809 pass | 1809 pass |
1810 | 1810 |
1811 ## \brief Return index of given method. | |
1812 def get_idx_method(self, method): | |
1813 methodid = method.methodIdx | |
1814 idx = self.methodIds.items.index(methodid) | |
1815 return idx | |
1816 | |
1811 ## \brief Get name of given method ID. | 1817 ## \brief Get name of given method ID. |
1812 @staticmethod | 1818 @staticmethod |
1813 def get_methodid_name(methoid): | 1819 def get_methodid_name(methoid): |
1814 return methoid.nameIdx.stringDataOff.data.data | 1820 return methoid.nameIdx.stringDataOff.data.data |
1815 | 1821 |
1856 for wmethod in classdata.directMethods.items + \ | 1862 for wmethod in classdata.directMethods.items + \ |
1857 classdata.virtualMethods.items: | 1863 classdata.virtualMethods.items: |
1858 wmethod_name = DEXFile_linked.get_method_name(wmethod) | 1864 wmethod_name = DEXFile_linked.get_method_name(wmethod) |
1859 if method_name != wmethod_name: | 1865 if method_name != wmethod_name: |
1860 continue | 1866 continue |
1861 if DEXFile_linked._proto_is_compatible(wmethod.protoIdx, proto): | 1867 wmethodid = wmethod.methodIdx |
1868 if DEXFile_linked._proto_is_compatible(wmethodid.protoIdx, proto): | |
1862 return wmethod | 1869 return wmethod |
1863 pass | 1870 pass |
1864 raise ValueError, 'can not find a method for given name and prototype' | 1871 raise ValueError, 'can not find a method for given name and prototype' |
1865 | 1872 |
1866 @staticmethod | 1873 @staticmethod |