summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.com>2020-09-16 15:25:18 +0200
committerMiklos Vajna <vmiklos@collabora.com>2020-09-16 15:25:18 +0200
commit483938f60e083577c713a026f5eafc33951c1fd7 (patch)
tree477b350816567f1517e15e6f17bbf71144b6a074
parent8849621e3af4a137651d7483f9cf2b8203fe47cb (diff)
emf-dump: CommentIdentifier is optional, don't fail if it's missing
Change-Id: Ic73a21642155dac89096dcb2d263d9f50e695306
-rw-r--r--msodumper/binarystream.py2
-rw-r--r--msodumper/emfrecord.py4
2 files changed, 3 insertions, 3 deletions
diff --git a/msodumper/binarystream.py b/msodumper/binarystream.py
index 9ab829d..bdd8f37 100644
--- a/msodumper/binarystream.py
+++ b/msodumper/binarystream.py
@@ -28,7 +28,7 @@ class BinaryStream:
return
attrs = ""
if dict:
- if value in dict or not default:
+ if value in dict or default is None:
attrs += ' name="%s"' % dict[value]
else:
attrs += ' name="%s"' % default
diff --git a/msodumper/emfrecord.py b/msodumper/emfrecord.py
index be66124..f0e38c0 100644
--- a/msodumper/emfrecord.py
+++ b/msodumper/emfrecord.py
@@ -297,7 +297,7 @@ class EmrComment(EMFRecord):
self.printAndSet("Type", self.readuInt32())
self.printAndSet("Size", self.readuInt32(), hexdump=False)
self.printAndSet("DataSize", self.readuInt32(), hexdump=False)
- self.printAndSet("CommentIdentifier", self.readuInt32(), dict=CommentIdentifier)
+ self.printAndSet("CommentIdentifier", self.readuInt32(), dict=CommentIdentifier, default="")
if self.CommentIdentifier == 0x00000000: # EMR_COMMENT_EMFSPOOL
print('<todo what="EmrComment::dump(): handle EMR_COMMENT_EMFSPOOL"/>')
elif self.CommentIdentifier == 0x2B464D45: # EMR_COMMENT_EMFPLUS
@@ -305,7 +305,7 @@ class EmrComment(EMFRecord):
elif self.CommentIdentifier == 0x43494447: # EMR_COMMENT_PUBLIC
EmrCommentPublic(self).dump()
else:
- print('<todo what="EmrComment::dump(): handle EMR_COMMENT: %s"/>' % hex(commentIdentifier))
+ print('<todo what="EmrComment::dump(): handle EMR_COMMENT: %s"/>' % hex(self.CommentIdentifier))
class EmrSetviewportorgex(EMFRecord):