diff options
author | dante <dante19031999@gmail.com> | 2020-12-09 17:14:17 +0100 |
---|---|---|
committer | Mike Kaganski <mike.kaganski@collabora.com> | 2020-12-11 07:40:00 +0100 |
commit | b9ffc3591189c54885094fefe477241418f67996 (patch) | |
tree | fc0640accc1ec56922c0bc2914c9aa060b2beb45 /sax | |
parent | 61d07657caab5e0fb8ec4446f67a7044e14dae4b (diff) |
FastParser.cxx changes
If custom entity list is empty, custon entities by unicode value have to keep working.
Succefully loaded:
<?xml version="1.0" encoding="UTF-8"?>
<math xmlns="http://www.w3.org/1998/Math/MathML" display="block">
<semantics>
<mi>σ</mi>
<mi>∞</mi>
<mi>σ</mi>
<mi>∞</mi>
</semantics>
</math>
Change-Id: I46cc5b04bd91d1aaadf3f99cb2079325bb0d08cf
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/107498
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Diffstat (limited to 'sax')
-rw-r--r-- | sax/source/fastparser/fastparser.cxx | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/sax/source/fastparser/fastparser.cxx b/sax/source/fastparser/fastparser.cxx index 04bf69a1705b..05288a4ef5f3 100644 --- a/sax/source/fastparser/fastparser.cxx +++ b/sax/source/fastparser/fastparser.cxx @@ -933,7 +933,6 @@ void FastSaxParserImpl::setNamespaceHandler( const Reference< XFastNamespaceHand maData.mxNamespaceHandler = Handler; } -#include <stdio.h> void FastSaxParserImpl::setCustomEntityNames( const ::css::uno::Sequence< ::rtl::OUString >& names, const ::css::uno::Sequence< ::rtl::OUString >& replacements ) { mEntityNames = names; @@ -1372,16 +1371,17 @@ xmlEntityPtr FastSaxParserImpl::callbackGetEntity( const xmlChar *name ) int lname = strlen(dname); if( lname == 0 ) return xmlGetPredefinedEntity(name); - if( !mEntityNames.hasElements() ) - return xmlGetPredefinedEntity(name); - for( size_t i = 0; i < mEntityNames.size(); ++i ) + if (mEntityNames.hasElements()) { - if( mEntityNames[i].compareToAscii(dname) == 0 ) + for (size_t i = 0; i < mEntityNames.size(); ++i) { - return xmlNewEntity( nullptr, - name, - XML_INTERNAL_GENERAL_ENTITY, nullptr, nullptr, - BAD_CAST(OUStringToOString(mEntityReplacements[i],RTL_TEXTENCODING_UTF8).getStr())); + if (mEntityNames[i].compareToAscii(dname) == 0) + { + return xmlNewEntity( + nullptr, name, XML_INTERNAL_GENERAL_ENTITY, nullptr, nullptr, + BAD_CAST( + OUStringToOString(mEntityReplacements[i], RTL_TEXTENCODING_UTF8).getStr())); + } } } if( lname < 2 ) |