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

Kohei Yoshida kohei at kemper.freedesktop.org
Thu Apr 7 20:58:04 PDT 2011


 src/ole.py |   29 +++++++++++++++--------------
 1 file changed, 15 insertions(+), 14 deletions(-)

New commits:
commit 2dd2a6724c2dd62d9b3142986666dbb95734ff33
Author: Kohei Yoshida <kyoshida at novell.com>
Date:   Thu Apr 7 23:55:26 2011 -0400

    Don't print bogus stream info when the stream size is zero.
    
    Especially user storages don't have data streams, so it's mis-leading
    to print stream sector ID and the size that is incorrectly calculated
    to be non-zero.

diff --git a/src/ole.py b/src/ole.py
index 744cda7..edab59f 100644
--- a/src/ole.py
+++ b/src/ole.py
@@ -654,20 +654,21 @@ entire file stream.
             print("(first sector ID: %d; size: %d; location: %s)"%
                   (entry.StreamSectorID, entry.StreamSize, strmLoc))
     
-            satObj = None
-            secSize = 0
-            if entry.StreamLocation == StreamLocation.SAT:
-                satObj = self.SAT
-                secSize = self.header.getSectorSize()
-            elif entry.StreamLocation == StreamLocation.SSAT:
-                satObj = self.SSAT
-                secSize = self.header.getShortSectorSize()
-            if satObj != None:
-                chain = satObj.getSectorIDChain(entry.StreamSectorID)
-                print("sector count: %d"%len(chain))
-                print("total sector size: %d"%(len(chain)*secSize))
-                if self.params.showSectorChain:
-                    self.__outputSectorChain(chain)
+            if entry.StreamSize > 0:
+                satObj = None
+                secSize = 0
+                if entry.StreamLocation == StreamLocation.SAT:
+                    satObj = self.SAT
+                    secSize = self.header.getSectorSize()
+                elif entry.StreamLocation == StreamLocation.SSAT:
+                    satObj = self.SSAT
+                    secSize = self.header.getShortSectorSize()
+                if satObj != None:
+                    chain = satObj.getSectorIDChain(entry.StreamSectorID)
+                    print("sector count: %d"%len(chain))
+                    print("total sector size: %d"%(len(chain)*secSize))
+                    if self.params.showSectorChain:
+                        self.__outputSectorChain(chain)
 
 
     def __outputSectorChain (self, chain):


More information about the Libreoffice-commits mailing list