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

Miklos Vajna vmiklos at kemper.freedesktop.org
Wed Nov 21 02:02:33 PST 2012


 src/docdirstream.py |    7 +++++++
 src/docrecord.py    |   25 +++++++++++++++++++++++++
 2 files changed, 32 insertions(+)

New commits:
commit 915193c77b2c897be5b8ffbdb500131a1f2f0df2
Author: Miklos Vajna <vmiklos at suse.cz>
Date:   Wed Nov 21 10:40:47 2012 +0100

    finish dumping ATRDPre10

diff --git a/src/docdirstream.py b/src/docdirstream.py
index cbb7d21..c488904 100755
--- a/src/docdirstream.py
+++ b/src/docdirstream.py
@@ -52,6 +52,13 @@ class DOCDirStream:
             pos = self.pos
         return struct.unpack("<I", bytes[pos:pos+4])[0]
 
+    def getInt32(self, bytes = None, pos = None):
+        if not bytes:
+            bytes = self.bytes
+        if not pos:
+            pos = self.pos
+        return struct.unpack("<i", bytes[pos:pos+4])[0]
+
     def getuInt64(self, bytes = None, pos = None):
         if not bytes:
             bytes = self.bytes
diff --git a/src/docrecord.py b/src/docrecord.py
index a3c6fe6..e9e0f3a 100755
--- a/src/docrecord.py
+++ b/src/docrecord.py
@@ -318,6 +318,20 @@ class PnFkpChpx(DOCDirStream):
         chpxFkp.dump()
         print '</%s>' % self.name
 
+class LPXCharBuffer9(DOCDirStream):
+    """The LPXCharBuffer9 structure is a length-prefixed buffer for up to 9 Unicode characters."""
+    def __init__(self, parent, name):
+        DOCDirStream.__init__(self, parent.bytes)
+        self.pos = parent.pos
+        self.name = name
+
+    def dump(self):
+        print '<%s type="LPXCharBuffer9" offset="%d" size="20 bytes">' % (self.name, self.pos)
+        self.printAndSet("cch", self.getuInt16())
+        self.pos += 2
+        self.printAndSet("xcharArray", self.bytes[self.pos:self.pos+(self.cch*2)].decode('utf-16'), hexdump = False)
+        print '</%s>' % self.name
+
 class ATRDPre10(DOCDirStream):
     """The ATRDPre10 structure contains information about a comment in the document."""
     def __init__(self, aPlcfandRef, offset):
@@ -326,6 +340,17 @@ class ATRDPre10(DOCDirStream):
 
     def dump(self):
         print '<aATRDPre10 type="ATRDPre10" offset="%d" size="30 bytes">' % self.pos
+        xstUsrInitl = LPXCharBuffer9(self, "xstUsrInitl")
+        xstUsrInitl.dump()
+        self.pos += 20
+        self.printAndSet("ibst", self.getuInt16())
+        self.pos += 2
+        self.printAndSet("bitsNotUsed", self.getuInt16())
+        self.pos += 2
+        self.printAndSet("grfNotUsed", self.getuInt16())
+        self.pos += 2
+        self.printAndSet("ITagBkmk", self.getInt32())
+        self.pos += 4
         print '</aATRDPre10>'
 
 class PnFkpPapx(DOCDirStream):


More information about the Libreoffice-commits mailing list