[Libreoffice-commits] mso-dumper.git: 2 commits - src/docdirstream.py src/docrecord.py

Miklos Vajna vmiklos at kemper.freedesktop.org
Fri May 24 02:23:21 PDT 2013


 src/docdirstream.py |    6 +++++-
 src/docrecord.py    |   23 +++++++++++++----------
 2 files changed, 18 insertions(+), 11 deletions(-)

New commits:
commit 6aa111f33ba2bf6872bc1cd339d43b7d9a22f924
Author: Miklos Vajna <vmiklos at suse.cz>
Date:   Thu May 23 18:19:51 2013 +0200

    SttbfAssoc, SttbSavedBy: tolare if table was cleared, but FIB was not updated
    
    fdo40686-1.doc requires this.

diff --git a/src/docrecord.py b/src/docrecord.py
index 67f9035..8d90b51 100644
--- a/src/docrecord.py
+++ b/src/docrecord.py
@@ -2062,7 +2062,9 @@ class SttbfAssoc(DOCDirStream):
             print '<string value="%s"/>' % globals.encodeName(self.bytes[self.pos:self.pos+2*cchData].decode('utf-16'), lowOnly = True)
             self.pos += 2*cchData
             print '</cchData>'
-        assert self.pos == self.mainStream.fcSttbfAssoc + self.size
+        # Probably this was cleared manually.
+        if self.cData != 0:
+            assert self.pos == self.mainStream.fcSttbfAssoc + self.size
         print '</sttbfAssoc>'
 
 class SttbfRMark(DOCDirStream):
@@ -3049,7 +3051,9 @@ class SttbSavedBy(DOCDirStream):
             print '<string value="%s"/>' % globals.encodeName(self.bytes[self.pos:self.pos+2*cchData].decode('utf-16'), lowOnly = True)
             self.pos += 2*cchData
             print '</cchData>'
-        assert self.pos == self.mainStream.fcSttbSavedBy + self.size
+        # Probably this was cleared manually.
+        if self.cData != 0:
+            assert self.pos == self.mainStream.fcSttbSavedBy + self.size
         print '</sttbSavedBy>'
 
 class SttbfBkmk(DOCDirStream):
commit ef4b0109c17f88cd7ec66704b2dfd0423ddebf21
Author: Miklos Vajna <vmiklos at suse.cz>
Date:   Thu May 23 17:57:10 2013 +0200

    DopTypography: dump rgxchFPunct / rgxchLPunct

diff --git a/src/docdirstream.py b/src/docdirstream.py
index 18c7453..4e29943 100644
--- a/src/docdirstream.py
+++ b/src/docdirstream.py
@@ -114,9 +114,12 @@ class DOCDirStream:
         self.pos += 8
         return ret
 
-    def getString(self):
+    def getString(self, limit = None):
         bytes = []
+        count = 0
         while True:
+            if (not limit is None) and count == limit:
+                break
             i = self.readuInt8()
             j = self.readuInt8()
             if i != 0 or j != 0:
@@ -124,6 +127,7 @@ class DOCDirStream:
                 bytes.append(j)
             else:
                 break
+            count += 1
         return globals.getUTF8FromUTF16("".join(map(lambda x: chr(x), bytes)))
 
     def getBit(self, byte, bitNumber):
diff --git a/src/docrecord.py b/src/docrecord.py
index a14f81e..67f9035 100644
--- a/src/docrecord.py
+++ b/src/docrecord.py
@@ -1517,14 +1517,13 @@ class DopTypography(DOCDirStream):
 
         self.printAndSet("cchFollowingPunct", self.readInt16())
         self.printAndSet("cchLeadingPunct", self.readInt16())
-        if self.cchFollowingPunct != 0:
-            print '<todo what="DopTypography::dump(): cchFollowingPunct != 0 not handled"/>'
-        else:
-            self.pos += 202
-        if self.cchLeadingPunct != 0:
-            print '<todo what="DopTypography::dump(): cchLeadingPunct != 0 not handled"/>'
-        else:
-            self.pos += 102
+
+        self.printAndSet("rgxchFPunct", self.getString(self.cchFollowingPunct), hexdump = False)
+        self.pos += (202 - 2 * self.cchFollowingPunct)
+
+        self.printAndSet("rgxchLPunct", self.getString(self.cchLeadingPunct), hexdump = False)
+        self.pos += (102 - 2 * self.cchLeadingPunct)
+
         print '</dopTypography>'
         assert self.pos == self.dop.pos + DopTypography.size
         self.dop.pos = self.pos


More information about the Libreoffice-commits mailing list