--- a/src/filters/ppt-dump.py
+++ b/src/filters/ppt-dump.py
@@ -4,10 +4,6 @@
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
#
-
-# mso-dumper is not compatible with python3
-
-from __future__ import print_function
import sys, os.path, getopt
sys.path.append(sys.path[0]+"/msodump.zip")
@@ -51,25 +47,26 @@
dirnames = strm.getDirectoryNames()
result = True
for dirname in dirnames:
- if len(dirname) == 0 or dirname == 'Root Entry':
+ sdirname = globals.nulltrunc(dirname)
+ if len(sdirname) == 0 or sdirname == b"Root Entry":
continue
try:
dirstrm = strm.getDirectoryStreamByName(dirname)
except Exception as err:
- error("getDirectoryStreamByName(%s): %s - %s\n" % (dirname,str(err),self.filepath))
+ error("getDirectoryStreamByName(%s): %s\n" % (dirname,str(err)))
# The previous version was killed by the exception
# here, so the equivalent is to break, but maybe there
# is no reason to do so.
break
self.__printDirHeader(dirname, len(dirstrm.bytes))
- if dirname == "PowerPoint Document":
+ if sdirname == b"PowerPoint Document":
if not self.__readSubStream(dirstrm):
result = False
- elif dirname == "Current User":
+ elif sdirname == b"Current User":
if not self.__readSubStream(dirstrm):
result = False
- elif dirname == "\x05DocumentSummaryInformation":
+ elif sdirname == b"\x05DocumentSummaryInformation":
strm = olestream.PropertySetStream(dirstrm.bytes)
strm.read()
else:
@@ -118,26 +115,15 @@
except getopt.GetoptError:
error("error parsing input options\n")
usage(exname)
- return false
+ return
- status = True
- try:
- dumper = PPTDumper(args[0], globals.params)
- if not dumper.dump():
- error("ppt-dump: dump error " + args[0] + "\n")
- status = False
- except:
- error("ppt-dump: FAILURE (bad format?) " + args[0] + "\n")
- status = False
+ dumper = PPTDumper(args[0], globals.params)
+ if not dumper.dump():
+ error("FAILURE\n")
+ if globals.params.dumpText:
+ globals.dumptext()
- if globals.params.dumpText:
- print(globals.textdump.replace("\r", "\n"))
- return(status)
-
if __name__ == '__main__':
- if main(sys.argv):
- sys.exit(0)
- else:
- sys.exit(1)
+ main(sys.argv)
# vim:set filetype=python shiftwidth=4 softtabstop=4 expandtab: