[Libreoffice-commits] core.git: writerfilter/source

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Mon Aug 27 15:47:34 UTC 2018


 writerfilter/source/ooxml/factoryimpl_ns.py |    7 +++++++
 1 file changed, 7 insertions(+)

New commits:
commit cc2f7944c2f058038bb4c54a592681f2413cd865
Author:     Miklos Vajna <vmiklos at collabora.co.uk>
AuthorDate: Mon Aug 27 16:11:18 2018 +0200
Commit:     Miklos Vajna <vmiklos at collabora.co.uk>
CommitDate: Mon Aug 27 17:47:12 2018 +0200

    writerfilter: build-time test for unexpected data types
    
    So next time I write <data type="ST_Foo"> instead of <ref
    name="ST_FOO">, I get an error quickly.
    
    Change-Id: Ida91b8ebe68915e22c62addffafe418ab29b1158
    Reviewed-on: https://gerrit.libreoffice.org/59661
    Tested-by: Jenkins
    Reviewed-by: Miklos Vajna <vmiklos at collabora.co.uk>

diff --git a/writerfilter/source/ooxml/factoryimpl_ns.py b/writerfilter/source/ooxml/factoryimpl_ns.py
index f810f24c86b4..41fa714678c7 100644
--- a/writerfilter/source/ooxml/factoryimpl_ns.py
+++ b/writerfilter/source/ooxml/factoryimpl_ns.py
@@ -94,6 +94,13 @@ def resourceForAttribute(nsNode, attrNode):
             resourceName = "Boolean"
         elif len([i for i in attrNode.getElementsByTagName("data") if i.getAttribute("type") in ("unsignedInt", "integer", "int")]):
             resourceName = "Integer"
+        else:
+            dataNodes = attrNode.getElementsByTagName("data")
+            if len(dataNodes):
+                t = dataNodes[0].getAttribute("type")
+                # Blacklist existing unexpected data types.
+                if t not in ("token", "long", "decimal", "float", "byte", "ST_DecimalNumber", "positiveInteger"):
+                    raise Exception("unexpected data type: " + dataNodes[0].getAttribute("type"))
     return resourceName
 
 


More information about the Libreoffice-commits mailing list