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

Caolán McNamara caolanm at redhat.com
Tue Oct 4 09:36:13 UTC 2016


 xmloff/source/core/xmlimp.cxx |   26 +++++++++-----------------
 1 file changed, 9 insertions(+), 17 deletions(-)

New commits:
commit be014c218d81b228784764e280baa25750e7adb7
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Tue Oct 4 10:29:54 2016 +0100

    we just care about empty vs nonempty here
    
    Change-Id: Ie7888f611f804ed1bd235e32e21560981f116c9a

diff --git a/xmloff/source/core/xmlimp.cxx b/xmloff/source/core/xmlimp.cxx
index 66e6075..d528a17 100644
--- a/xmloff/source/core/xmlimp.cxx
+++ b/xmloff/source/core/xmlimp.cxx
@@ -734,12 +734,9 @@ void SAL_CALL SvXMLImport::startElement( const OUString& rName,
     // If there are contexts already, call a CreateChildContext at the topmost
     // context. Otherwise, create a default context.
     SvXMLImportContextRef xContext;
-    sal_uInt16 nCount = maContexts.size();
-    if( nCount > 0 )
+    if(!maContexts.empty())
     {
-        xContext.set(maContexts[nCount - 1]->CreateChildContext( nPrefix,
-                                                                 aLocalName,
-                                                                 xAttrList ));
+        xContext.set(maContexts.back()->CreateChildContext(nPrefix, aLocalName, xAttrList));
         SAL_WARN_IF( !xContext.is() || (xContext->GetPrefix() != nPrefix), "xmloff.core",
                 "SvXMLImport::startElement: created context has wrong prefix" );
     }
@@ -780,8 +777,7 @@ rName
 )
     throw(xml::sax::SAXException, uno::RuntimeException, std::exception)
 {
-    auto const nCount = maContexts.size();
-    if (nCount == 0)
+    if (maContexts.empty())
     {
         SAL_WARN("xmloff.core", "SvXMLImport::endElement: no context left");
         return;
@@ -863,10 +859,9 @@ void SAL_CALL SvXMLImport::startFastElement (sal_Int32 Element,
 {
     //Namespace handling is unnecessary. It is done by the fastparser itself.
     uno::Reference<XFastContextHandler> xContext;
-    sal_uInt16 nCount = maFastContexts.size();
-    if( nCount > 0 )
+    if (!maFastContexts.empty())
     {
-        uno::Reference< XFastContextHandler > pHandler = maFastContexts[nCount - 1];
+        uno::Reference< XFastContextHandler > pHandler = maFastContexts.back();
         xContext = pHandler->createFastChildContext( Element, Attribs );
     }
     else
@@ -901,10 +896,9 @@ void SAL_CALL SvXMLImport::startUnknownElement (const OUString & rPrefix, const
     throw (uno::RuntimeException, xml::sax::SAXException, std::exception)
 {
     uno::Reference<XFastContextHandler> xContext;
-    sal_uInt16 nCount = maFastContexts.size();
-    if( nCount > 0 )
+    if (!maFastContexts.empty())
     {
-        uno::Reference< XFastContextHandler > pHandler = maFastContexts[nCount - 1];
+        uno::Reference< XFastContextHandler > pHandler = maFastContexts.back();
         xContext = pHandler->createUnknownChildContext( rPrefix, rLocalName, Attribs );
     }
     else
@@ -920,8 +914,7 @@ void SAL_CALL SvXMLImport::startUnknownElement (const OUString & rPrefix, const
 void SAL_CALL SvXMLImport::endFastElement (sal_Int32 Element)
     throw (uno::RuntimeException, xml::sax::SAXException, std::exception)
 {
-    sal_uInt16 nCount = maFastContexts.size();
-    if( nCount > 0 )
+    if (!maFastContexts.empty())
     {
         uno::Reference< XFastContextHandler > xContext = maFastContexts.back();
         maFastContexts.pop_back();
@@ -937,8 +930,7 @@ void SAL_CALL SvXMLImport::endFastElement (sal_Int32 Element)
 void SAL_CALL SvXMLImport::endUnknownElement (const OUString & rPrefix, const OUString & rLocalName)
     throw (uno::RuntimeException, xml::sax::SAXException, std::exception)
 {
-    sal_uInt16 nCount = maFastContexts.size();
-    if( nCount > 0 )
+    if (!maFastContexts.empty())
     {
         uno::Reference< XFastContextHandler > xContext = maFastContexts.back();
         maFastContexts.pop_back();


More information about the Libreoffice-commits mailing list