summaryrefslogtreecommitdiff
path: root/xmloff
diff options
context:
space:
mode:
authorMohammed Abdul Azeem <azeemmysore@gmail.com>2017-06-29 13:49:18 +0530
committerMichael Meeks <michael.meeks@collabora.com>2017-06-29 17:50:12 +0200
commitb3b6ce3febbf3073dd9e16d908137e41ab473dca (patch)
treebb1bd13c01468ab103e0427a9c51ad8b1b6b60c8 /xmloff
parent8a828ee75d4f5d0fd2abcd7d74130e57e5c3bd71 (diff)
Added find function to FastAttributeList:
It returns a FastAttributeIter, which can be used to obtain value in different formats directly. Also, avoids one unnecessary iteration. Change-Id: Ic28e0177100738bbd71a3a89634cae9f1f7ee996 Reviewed-on: https://gerrit.libreoffice.org/39380 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Michael Meeks <michael.meeks@collabora.com>
Diffstat (limited to 'xmloff')
-rw-r--r--xmloff/source/core/xmlimp.cxx24
1 files changed, 15 insertions, 9 deletions
diff --git a/xmloff/source/core/xmlimp.cxx b/xmloff/source/core/xmlimp.cxx
index 5d9d1de5123e..92836d1af191 100644
--- a/xmloff/source/core/xmlimp.cxx
+++ b/xmloff/source/core/xmlimp.cxx
@@ -788,17 +788,23 @@ void SAL_CALL SvXMLImport::setDocumentLocator( const uno::Reference< xml::sax::X
void SAL_CALL SvXMLImport::startFastElement (sal_Int32 Element,
const uno::Reference< xml::sax::XFastAttributeList > & Attribs)
{
- if ( Attribs.is() && Attribs->hasAttribute( XML_ELEMENT( OFFICE, XML_VERSION ) ) )
+ if ( Attribs.is() )
{
- mpImpl->aODFVersion = Attribs->getValue( XML_ELEMENT( OFFICE, XML_VERSION ) );
-
- // the ODF version in content.xml and manifest.xml must be the same starting from ODF1.2
- if ( mpImpl->mStreamName == "content.xml" && !IsODFVersionConsistent( mpImpl->aODFVersion ) )
+ sax_fastparser::FastAttributeList *pAttribList =
+ static_cast< sax_fastparser::FastAttributeList *>( Attribs.get() );
+ auto &aIter( pAttribList->find( XML_ELEMENT( OFFICE, XML_VERSION ) ) );
+ if( aIter != pAttribList->end() )
{
- throw xml::sax::SAXException("Inconsistent ODF versions in content.xml and manifest.xml!",
- uno::Reference< uno::XInterface >(),
- uno::makeAny(
- packages::zip::ZipIOException("Inconsistent ODF versions in content.xml and manifest.xml!" ) ) );
+ mpImpl->aODFVersion = aIter.toString();
+
+ // the ODF version in content.xml and manifest.xml must be the same starting from ODF1.2
+ if ( mpImpl->mStreamName == "content.xml" && !IsODFVersionConsistent( mpImpl->aODFVersion ) )
+ {
+ throw xml::sax::SAXException("Inconsistent ODF versions in content.xml and manifest.xml!",
+ uno::Reference< uno::XInterface >(),
+ uno::makeAny(
+ packages::zip::ZipIOException("Inconsistent ODF versions in content.xml and manifest.xml!" ) ) );
+ }
}
}