diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2014-02-07 09:32:07 +0100 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2014-02-07 09:32:07 +0100 |
commit | f1a09e08f2c4e19d0294737d7ff5c38147d1063c (patch) | |
tree | 21820b819c936104570eb02d589ce6bd0ef3b87f /sax/source | |
parent | 922f44344e832d6b4ffaa8a4d8b3d3dfb2c892aa (diff) |
Use rtl::Reference
Change-Id: Ia14ad80f13bffe4c1d0078da0198a3ae6eae581e
Diffstat (limited to 'sax/source')
-rw-r--r-- | sax/source/expatwrap/sax_expat.cxx | 17 |
1 files changed, 7 insertions, 10 deletions
diff --git a/sax/source/expatwrap/sax_expat.cxx b/sax/source/expatwrap/sax_expat.cxx index 994dc863c026..da115859953a 100644 --- a/sax/source/expatwrap/sax_expat.cxx +++ b/sax/source/expatwrap/sax_expat.cxx @@ -201,8 +201,7 @@ public: // module scope css::uno::Reference < XLocator > rDocumentLocator; - css::uno::Reference < XAttributeList > rAttrList; - sax_expatwrap::AttributeList *pAttrList; + rtl::Reference < sax_expatwrap::AttributeList > rAttrList; // External entity stack vector<struct Entity> vecEntity; @@ -227,7 +226,6 @@ public: SaxExpatParser_Impl() : sCDATA("CDATA") , m_bEnableDoS(false) - , pAttrList(NULL) , bExceptionWasThrown(false) , bRTExceptionWasThrown(false) { @@ -411,10 +409,9 @@ SaxExpatParser::SaxExpatParser( ) LocatorImpl *pLoc = new LocatorImpl( m_pImpl ); m_pImpl->rDocumentLocator = css::uno::Reference< XLocator > ( pLoc ); - // performance-improvement. Reference is needed when calling the startTag callback. - // Handing out the same object with every call is allowed (see sax-specification) - m_pImpl->pAttrList = new sax_expatwrap::AttributeList; - m_pImpl->rAttrList = css::uno::Reference< XAttributeList > ( m_pImpl->pAttrList ); + // Performance-improvement; handing out the same object with every call of + // the startElement callback is allowed (see sax-specification): + m_pImpl->rAttrList = new sax_expatwrap::AttributeList; m_pImpl->bExceptionWasThrown = false; m_pImpl->bRTExceptionWasThrown = false; @@ -775,11 +772,11 @@ void SaxExpatParser_Impl::callbackStartElement( void *pvThis , if( pImpl->rDocumentHandler.is() ) { int i = 0; - pImpl->pAttrList->clear(); + pImpl->rAttrList->clear(); while( awAttributes[i] ) { assert(awAttributes[i+1]); - pImpl->pAttrList->addAttribute( + pImpl->rAttrList->addAttribute( XML_CHAR_TO_OUSTRING( awAttributes[i] ) , pImpl->sCDATA, // expat doesn't know types XML_CHAR_TO_OUSTRING( awAttributes[i+1] ) ); @@ -789,7 +786,7 @@ void SaxExpatParser_Impl::callbackStartElement( void *pvThis , CALL_ELEMENT_HANDLER_AND_CARE_FOR_EXCEPTIONS( pImpl , rDocumentHandler->startElement( XML_CHAR_TO_OUSTRING( pwName ) , - pImpl->rAttrList ) ); + pImpl->rAttrList.get() ) ); } } |