changeset 125:b9688a3badaa

Add compute_size() for DEX types that missed it
author Thinker K.F. Li <thinker@codemud.net>
date Sun, 07 Aug 2011 23:02:08 +0800
parents 8e42b2816893
children ff6f869273b7
files paraspace/dex_deptracker.py paraspace/dexfile.py
diffstat 2 files changed, 11 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/paraspace/dex_deptracker.py	Sun Aug 07 22:07:08 2011 +0800
+++ b/paraspace/dex_deptracker.py	Sun Aug 07 23:02:08 2011 +0800
@@ -816,6 +816,7 @@
         
         obj_clazz, parent_clazz = _resolve_name_path(name_path)
         if isinstance(obj_clazz, dexfile.depend):
+            obj_clazz.compute_size(obj)
             moff(obj_clazz.sizeof(obj))
             continue
         
@@ -848,6 +849,7 @@
                 name = name_path.split('.')[-1]
                 _dex_tree_set_child(parent, name, obj)
                 pass
+            obj_clazz.compute_size(obj)
             moff(obj_clazz.sizeof(obj))
             continue
         
--- a/paraspace/dexfile.py	Sun Aug 07 22:07:08 2011 +0800
+++ b/paraspace/dexfile.py	Sun Aug 07 23:02:08 2011 +0800
@@ -148,6 +148,10 @@
         obj.data = data[off:off + obj.data_size]
         return obj
 
+    def compute_size(self, v):
+        v.data_size = len(v.data)
+        pass
+
     def sizeof(self, v):
         return v.data_size
 
@@ -766,9 +770,13 @@
     def parse(self, parse, data, off):
         return self.value
     
+    @staticmethod
+    def compute_size(v):
+        pass
+
     def sizeof(self, v):
         return 0
-
+    
     @staticmethod
     def to_str(self):
         return ''