Use rtl::Reference

Change-Id: Ia14ad80f13bffe4c1d0078da0198a3ae6eae581e
This commit is contained in:
Stephan Bergmann
2014-02-07 09:32:07 +01:00
parent 922f44344e
commit f1a09e08f2

View File

@@ -201,8 +201,7 @@ public: // module scope
css::uno::Reference < XLocator > rDocumentLocator; css::uno::Reference < XLocator > rDocumentLocator;
css::uno::Reference < XAttributeList > rAttrList; rtl::Reference < sax_expatwrap::AttributeList > rAttrList;
sax_expatwrap::AttributeList *pAttrList;
// External entity stack // External entity stack
vector<struct Entity> vecEntity; vector<struct Entity> vecEntity;
@@ -227,7 +226,6 @@ public:
SaxExpatParser_Impl() SaxExpatParser_Impl()
: sCDATA("CDATA") : sCDATA("CDATA")
, m_bEnableDoS(false) , m_bEnableDoS(false)
, pAttrList(NULL)
, bExceptionWasThrown(false) , bExceptionWasThrown(false)
, bRTExceptionWasThrown(false) , bRTExceptionWasThrown(false)
{ {
@@ -411,10 +409,9 @@ SaxExpatParser::SaxExpatParser( )
LocatorImpl *pLoc = new LocatorImpl( m_pImpl ); LocatorImpl *pLoc = new LocatorImpl( m_pImpl );
m_pImpl->rDocumentLocator = css::uno::Reference< XLocator > ( pLoc ); m_pImpl->rDocumentLocator = css::uno::Reference< XLocator > ( pLoc );
// performance-improvement. Reference is needed when calling the startTag callback. // Performance-improvement; handing out the same object with every call of
// Handing out the same object with every call is allowed (see sax-specification) // the startElement callback is allowed (see sax-specification):
m_pImpl->pAttrList = new sax_expatwrap::AttributeList; m_pImpl->rAttrList = new sax_expatwrap::AttributeList;
m_pImpl->rAttrList = css::uno::Reference< XAttributeList > ( m_pImpl->pAttrList );
m_pImpl->bExceptionWasThrown = false; m_pImpl->bExceptionWasThrown = false;
m_pImpl->bRTExceptionWasThrown = false; m_pImpl->bRTExceptionWasThrown = false;
@@ -775,11 +772,11 @@ void SaxExpatParser_Impl::callbackStartElement( void *pvThis ,
if( pImpl->rDocumentHandler.is() ) { if( pImpl->rDocumentHandler.is() ) {
int i = 0; int i = 0;
pImpl->pAttrList->clear(); pImpl->rAttrList->clear();
while( awAttributes[i] ) { while( awAttributes[i] ) {
assert(awAttributes[i+1]); assert(awAttributes[i+1]);
pImpl->pAttrList->addAttribute( pImpl->rAttrList->addAttribute(
XML_CHAR_TO_OUSTRING( awAttributes[i] ) , XML_CHAR_TO_OUSTRING( awAttributes[i] ) ,
pImpl->sCDATA, // expat doesn't know types pImpl->sCDATA, // expat doesn't know types
XML_CHAR_TO_OUSTRING( awAttributes[i+1] ) ); XML_CHAR_TO_OUSTRING( awAttributes[i+1] ) );
@@ -789,7 +786,7 @@ void SaxExpatParser_Impl::callbackStartElement( void *pvThis ,
CALL_ELEMENT_HANDLER_AND_CARE_FOR_EXCEPTIONS( CALL_ELEMENT_HANDLER_AND_CARE_FOR_EXCEPTIONS(
pImpl , pImpl ,
rDocumentHandler->startElement( XML_CHAR_TO_OUSTRING( pwName ) , rDocumentHandler->startElement( XML_CHAR_TO_OUSTRING( pwName ) ,
pImpl->rAttrList ) ); pImpl->rAttrList.get() ) );
} }
} }