msodumper/globals.py | 20 ++++++++++---------- msodumper/node.py | 2 +- msodumper/xlsstream.py | 6 +++--- vbadump.py | 4 ++-- xls-dump.py | 2 +- 5 files changed, 17 insertions(+), 17 deletions(-)
New commits: commit 2e059c83c3839447886f683ab57032fceeb1c52f Author: Samuel Mehrbrodt <[email protected]> AuthorDate: Mon Jan 26 16:48:12 2026 +0100 Commit: Samuel Mehrbrodt <[email protected]> CommitDate: Mon Jan 26 16:48:12 2026 +0100 Remove trailing spaces Change-Id: Ie623773cac9f72aab39ca99638eed02b44ead567 diff --git a/msodumper/globals.py b/msodumper/globals.py index 7a0ac1a..5a36c8e 100644 --- a/msodumper/globals.py +++ b/msodumper/globals.py @@ -17,13 +17,13 @@ PY3 = sys.version > '3' # - indexedbytetobyte: convert a value obtained by indexing into a bytes list # (or from 'for x in somebytes') to a bytes list of len 1 # - indexedbytetoint() return the same as an int (uses ord() for python2) -# +# if PY3: def indexbytes(data, i): return data[i] def indexedbytetobyte(i): - return i.to_bytes(1, byteorder='big') + return i.to_bytes(1, byteorder='big') def indexedbytetoint(i): return i nullchar = 0 @@ -66,7 +66,7 @@ class Params(object): self.noRawDump = False self.catchExceptions = False self.utf8 = False - + # Global parameters / run configuration, to be set up by the main # program during initialization params = Params() @@ -211,14 +211,14 @@ def nulltrunc(bytes): return bytes -# This is syntaxically identical for python2 and python3 if the input is str +# This is syntaxically identical for python2 and python3 if the input is str def encodeName (name, lowOnly = False, lowLimit = 0x20): """Encode name that contains unprintable characters.""" n = len(name) if n == 0: return name - + if PY3 and (type(name) == type(b'')): return _encodeNameBytes(name, n, lowOnly, lowLimit) @@ -234,7 +234,7 @@ def encodeName (name, lowOnly = False, lowLimit = 0x20): newname += "\x%2.2X"%ord(name[i]) else: newname += name[i] - + return newname # Python3 only. Same as above but accept bytes as input. @@ -255,7 +255,7 @@ def _encodeNameBytes (name, n, lowOnly = False, lowLimit = 0x20): newname += chr(name[i]) return newname - + # Uncompress "compressed" UTF-16. This compression strips high bytes # from a string when they are all 0. Just restore them. def uncompCompUnicode(bytes): @@ -331,7 +331,7 @@ def getUnicodeRichExtText (bytes, offset = 0, rofflist = []): # Just try to read and let the stream raise an exception strm.readBytes(bytesToRead) return - + bytesToRead = min(bytesToRead, \ rofflist[ibound]- strm.getCurrentPos()) newdata = strm.readBytes(bytesToRead) @@ -341,7 +341,7 @@ def getUnicodeRichExtText (bytes, offset = 0, rofflist = []): ret.baseText += newdata.decode('UTF-16LE', errors='replace') textLen -= bytesToRead // bytesPerChar - + # If there is still data to read, we hit a record boundary. Read # the grbit byte for detecting possible compression switch if textLen > 0: @@ -350,7 +350,7 @@ def getUnicodeRichExtText (bytes, offset = 0, rofflist = []): bytesPerChar = 2 else: bytesPerChar = 1 - + if isRichStr: for i in range(0, numElem): posChar = strm.readUnsignedInt(2) diff --git a/msodumper/node.py b/msodumper/node.py index 63a8de8..bab73b7 100644 --- a/msodumper/node.py +++ b/msodumper/node.py @@ -158,7 +158,7 @@ if globals.PY3: else: def isintegertype(val): return type(val) == type(0) or type(val) == long - + def convertAttrValue (val): if type(val) == type(True): if val: diff --git a/msodumper/xlsstream.py b/msodumper/xlsstream.py index bd09349..761ffdd 100644 --- a/msodumper/xlsstream.py +++ b/msodumper/xlsstream.py @@ -478,7 +478,7 @@ class XLDirStream(object): # Records boundaries/offset list (only useful if there are # CONTINUE records) roflist = [size] - + # Read possible CONTINUE records, and concatenate the data while self.peekNext() == 0x3c: cpos, cheader, csize, cbytes = self.__readRecordBytes() @@ -490,7 +490,7 @@ class XLDirStream(object): def peekNext (self): '''Check type of next record without changing stream state''' - + if self.size - self.pos < 4: raise EndOfStream @@ -500,7 +500,7 @@ class XLDirStream(object): raise EndOfStream self.pos = pos return header - + def __getRecordHandler (self, header, size, bytes, roflist): # record handler that parses the raw bytes and displays more # meaningful information. diff --git a/vbadump.py b/vbadump.py index 10b4e36..d90e9e6 100755 --- a/vbadump.py +++ b/vbadump.py @@ -86,7 +86,7 @@ class StdReader: def __init__ (self, reader ): self.reader = reader # subclass needs to implement this - def parse(self): + def parse(self): pass class ProjectVersionReader( StdReader ): @@ -182,7 +182,7 @@ class ProjectModulesReader(StdReader): size = self.reader.readUnsignedInt( 4 ) count = self.reader.readUnsignedInt( size ) self.reader.CurrentModule = ModuleInfo() - print(" Num Modules: %i"%count) + print(" Num Modules: %i"%count) class ModuleNameReader(StdReader): def parse(self): diff --git a/xls-dump.py b/xls-dump.py index 08b47b1..37aacab 100755 --- a/xls-dump.py +++ b/xls-dump.py @@ -219,7 +219,7 @@ def main (): params.showStreamPos = options.show_stream_pos params.catchExceptions = options.catch_exceptions params.utf8 = options.utf8 - + if len(args) < 1: globals.error("takes at least one argument ") parser.print_help()
