summaryrefslogtreecommitdiff
path: root/sax
diff options
context:
space:
mode:
authordante <dante19031999@gmail.com>2020-12-02 00:12:05 +0100
committerNoel Grandin <noel.grandin@collabora.co.uk>2020-12-09 15:21:09 +0100
commit6e0f18d7d523c62236a1968c36b4e0cc8586ac34 (patch)
tree1c66fcd04921df2fd71765401641ceacf1f8bd2b /sax
parente04bf67bba3a6410f49fd311fe499456c2f9dc7d (diff)
Begining of support for &entityname for mathml.
Change-Id: I03ce79ed74088db3c1f6c1f87d7a75160ff19a30 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/107038 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sax')
-rw-r--r--sax/source/fastparser/fastparser.cxx11
1 files changed, 8 insertions, 3 deletions
diff --git a/sax/source/fastparser/fastparser.cxx b/sax/source/fastparser/fastparser.cxx
index 9b2d9bd97458..04bf69a1705b 100644
--- a/sax/source/fastparser/fastparser.cxx
+++ b/sax/source/fastparser/fastparser.cxx
@@ -933,6 +933,7 @@ 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;
@@ -1368,6 +1369,11 @@ xmlEntityPtr FastSaxParserImpl::callbackGetEntity( const xmlChar *name )
if( !name )
return xmlGetPredefinedEntity(name);
const char* dname = XML_CAST(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[i].compareToAscii(dname) == 0 )
@@ -1378,12 +1384,11 @@ xmlEntityPtr FastSaxParserImpl::callbackGetEntity( const xmlChar *name )
BAD_CAST(OUStringToOString(mEntityReplacements[i],RTL_TEXTENCODING_UTF8).getStr()));
}
}
+ if( lname < 2 )
+ return xmlGetPredefinedEntity(name);
if ( dname[0] == '#' )
{
sal_uInt32 cval = 0;
- int_fast16_t lname = strlen(dname);
- if( lname < 2 )
- return xmlGetPredefinedEntity(name);
if( dname[1] == 'x' || dname[1] == 'X' )
{
if( lname < 3 )