[Libreoffice-commits] .: src/docrecord.py

Miklos Vajna vmiklos at kemper.freedesktop.org
Thu Nov 8 00:30:58 PST 2012


 src/docrecord.py |   21 ++++++++++-----------
 1 file changed, 10 insertions(+), 11 deletions(-)

New commits:
commit c9c82bb99e2e35202bba93dcaeeaaa92c2e3211a
Author: Miklos Vajna <vmiklos at suse.cz>
Date:   Thu Nov 8 09:33:16 2012 +0100

    PlcPcd: clean up and make output a bit more readable

diff --git a/src/docrecord.py b/src/docrecord.py
index df79c24..733c4ca 100755
--- a/src/docrecord.py
+++ b/src/docrecord.py
@@ -57,22 +57,21 @@ class PlcPcd(DOCDirStream):
         print '<plcPcd type="PlcPcd" offset="%d" size="%d bytes">' % (self.pos, self.size)
         elements = (self.size - 4) / (4 + 8) # 8 is defined by 2.8.35, the rest is defined by 2.2.2
         pos = self.pos
-        self.ranges = []
-        self.aPcds = []
         for i in range(elements):
+            # aCp
             start = struct.unpack("<I", self.bytes[pos:pos+4])[0]
             end = struct.unpack("<I", self.bytes[pos+4:pos+8])[0]
-            print '<aCP index="%d" start="%d" end="%d"/>' % (i, start, end)
-            self.ranges.append((start, end))
+            print '<aCP index="%d" start="%d" end="%d">' % (i, start, end)
             pos += 4
-        for i in range(elements):
+
+            # aPcd
             offset = self.pos + ( 4 * ( elements + 1 ) ) + ( 8 * i ) # 8 as defined by 2.8.35
-            self.aPcds.append(Pcd(self.bytes, self.mainStream, offset, 8))
-            self.aPcds[-1].dump()
-        for i, item in enumerate(self.ranges):
-            start, end = item
-            offset = self.aPcds[i].fc.getTransformedAddress()
-            print '<aCPTransformed index="%d" value="%s"/>' % (i, globals.encodeName(self.mainStream.bytes[offset:offset+end-start]))
+            aPcd = Pcd(self.bytes, self.mainStream, offset, 8)
+            aPcd.dump()
+
+            offset = aPcd.fc.getTransformedAddress()
+            print '<transformed value="%s"/>' % globals.encodeName(self.mainStream.bytes[offset:offset+end-start])
+            print '</aCP>'
         print '</plcPcd>'
 
 class Pcdt(DOCDirStream):


More information about the Libreoffice-commits mailing list