ooo-build r11475 - in trunk: . scratch/sc-xlsutil scratch/sc-xlsutil/src



Author: kyoshida
Date: Thu Jan 31 03:11:29 2008
New Revision: 11475
URL: http://svn.gnome.org/viewvc/ooo-build?rev=11475&view=rev

Log:
2008-01-30  Kohei Yoshida  <kyoshida novell com>

	* scratch/sc-xlsutil/src/globals.py:
	* scratch/sc-xlsutil/src/stream.py:
	* scratch/sc-xlsutil/xls_dump.py: minor fix on parsing Workbook stream.


Modified:
   trunk/ChangeLog
   trunk/scratch/sc-xlsutil/src/globals.py
   trunk/scratch/sc-xlsutil/src/stream.py
   trunk/scratch/sc-xlsutil/xls_dump.py

Modified: trunk/scratch/sc-xlsutil/src/globals.py
==============================================================================
--- trunk/scratch/sc-xlsutil/src/globals.py	(original)
+++ trunk/scratch/sc-xlsutil/src/globals.py	Thu Jan 31 03:11:29 2008
@@ -68,9 +68,13 @@
     if subDivide != None:
         subDivideLine = subDivide/16
 
-    flushBytes = True
     charLen = len(chars)
+    if charLen == 0:
+        # no bytes to dump.
+        return
+
     labelWidth = int(math.ceil(math.log(charLen, 10)))
+    flushBytes = False
     for i in xrange(0, charLen):
         if (i+1)%16 == 1:
             # print line header with seek position

Modified: trunk/scratch/sc-xlsutil/src/stream.py
==============================================================================
--- trunk/scratch/sc-xlsutil/src/stream.py	(original)
+++ trunk/scratch/sc-xlsutil/src/stream.py	Thu Jan 31 03:11:29 2008
@@ -340,14 +340,6 @@
 
         self.params = params
 
-    def seekBOF (self):
-        while self.pos < self.size-1:
-            b1, b2 = ord(self.bytes[self.pos]), ord(self.bytes[self.pos+1])
-            word = b1 + b2*256
-            if word == 0x0809:
-                self.version = 'BIFF5/BIFF8'
-                return
-            self.pos += 2
 
     def readRaw (self, size=1):
         # assume little endian

Modified: trunk/scratch/sc-xlsutil/xls_dump.py
==============================================================================
--- trunk/scratch/sc-xlsutil/xls_dump.py	(original)
+++ trunk/scratch/sc-xlsutil/xls_dump.py	Thu Jan 31 03:11:29 2008
@@ -50,6 +50,7 @@
                 success = True
                 while success: 
                     success = self.__readSheetSubStream(dirstrm)
+
             elif dirname == "Revision Log":
                 dirstrm.type = stream.DirType.RevisionLog
                 try:
@@ -63,16 +64,15 @@
 
 
     def __readSheetSubStream (self, strm):
-        # read bytes from BOF to EOF.
-        strm.seekBOF()
-        try:
-            header = 0x0000
-            while header != 0x000A:
-                header = strm.readRecord()
-            return True
-
-        except stream.EndOfStream:
-            return False
+       try:
+           # read bytes from BOF to EOF.
+           header = 0x0000
+           while header != 0x000A:
+               header = strm.readRecord()
+           return True
+    
+       except stream.EndOfStream:
+           return False
 
 
 def main (args):



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]