From 8a75dafbe19b19fe8b39e4e85f5ffa47da23f41e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lubo=C5=A1=20Lu=C5=88=C3=A1k?= Date: Wed, 12 Nov 2014 16:09:42 +0100 Subject: [PATCH] make FastAttributeList's unknown attribute value be passed as OString Since that's how it's internally stored anyway, and I have a use case where it's useful to limit the length by passing it to OString ctor. Change-Id: I5903ea4f1b2cdb48c1bbceac6b8e21eb5882d377 --- include/sax/fastattribs.hxx | 9 ++++----- sax/source/tools/fastattribs.cxx | 16 ++++++++-------- 2 files changed, 12 insertions(+), 13 deletions(-) diff --git a/include/sax/fastattribs.hxx b/include/sax/fastattribs.hxx index 39f5a5f814a2..a2fe1b9c77ba 100644 --- a/include/sax/fastattribs.hxx +++ b/include/sax/fastattribs.hxx @@ -40,9 +40,8 @@ struct UnknownAttribute OString maName; OString maValue; - UnknownAttribute( const OUString& rNamespaceURL, const OString& rName, const sal_Char* pValue ); - - UnknownAttribute( const OString& rName, const sal_Char* pValue ); + UnknownAttribute( const OUString& rNamespaceURL, const OString& rName, const OString& value ); + UnknownAttribute( const OString& rName, const OString& value ); void FillAttribute( ::com::sun::star::xml::Attribute* pAttrib ) const; }; @@ -84,8 +83,8 @@ public: void add( sal_Int32 nToken, const sal_Char* pValue, size_t nValueLength ); void add( sal_Int32 nToken, const OString& rValue ); void addNS( sal_Int32 nNamespaceToken, sal_Int32 nToken, const OString& rValue ); - void addUnknown( const OUString& rNamespaceURL, const OString& rName, const sal_Char* pValue ); - void addUnknown( const OString& rName, const sal_Char* pValue ); + void addUnknown( const OUString& rNamespaceURL, const OString& rName, const OString& value ); + void addUnknown( const OString& rName, const OString& value ); const std::vector< sal_Int32 >& getFastAttributeTokens() const { return maAttributeTokens; } const char* getFastAttributeValue(size_t nIndex) const { return mpChunk + maAttributeValues[nIndex]; } sal_Int32 AttributeValueLength(size_t i) const { return maAttributeValues[i + 1] - maAttributeValues[i] - 1; } diff --git a/sax/source/tools/fastattribs.cxx b/sax/source/tools/fastattribs.cxx index 36277cf3a236..d32f484632aa 100644 --- a/sax/source/tools/fastattribs.cxx +++ b/sax/source/tools/fastattribs.cxx @@ -32,13 +32,13 @@ FastTokenHandlerBase::~FastTokenHandlerBase() { } -UnknownAttribute::UnknownAttribute( const OUString& rNamespaceURL, const OString& rName, const sal_Char* pValue ) - : maNamespaceURL( rNamespaceURL ), maName( rName ), maValue( pValue ) +UnknownAttribute::UnknownAttribute( const OUString& rNamespaceURL, const OString& rName, const OString& value ) + : maNamespaceURL( rNamespaceURL ), maName( rName ), maValue( value ) { } -UnknownAttribute::UnknownAttribute( const OString& rName, const sal_Char* pValue ) - : maName( rName ), maValue( pValue ) +UnknownAttribute::UnknownAttribute( const OString& rName, const OString& value ) + : maName( rName ), maValue( value ) { } @@ -106,14 +106,14 @@ void FastAttributeList::addNS( sal_Int32 nNamespaceToken, sal_Int32 nToken, cons add( nCombinedToken, rValue ); } -void FastAttributeList::addUnknown( const OUString& rNamespaceURL, const OString& rName, const sal_Char* pValue ) +void FastAttributeList::addUnknown( const OUString& rNamespaceURL, const OString& rName, const OString& value ) { - maUnknownAttributes.push_back( UnknownAttribute( rNamespaceURL, rName, pValue ) ); + maUnknownAttributes.push_back( UnknownAttribute( rNamespaceURL, rName, value ) ); } -void FastAttributeList::addUnknown( const OString& rName, const sal_Char* pValue ) +void FastAttributeList::addUnknown( const OString& rName, const OString& value ) { - maUnknownAttributes.push_back( UnknownAttribute( rName, pValue ) ); + maUnknownAttributes.push_back( UnknownAttribute( rName, value ) ); } // XFastAttributeList