summaryrefslogtreecommitdiff
path: root/sax/source
diff options
context:
space:
mode:
authorSascha Ballach <sab@openoffice.org>2001-07-19 08:36:12 +0000
committerSascha Ballach <sab@openoffice.org>2001-07-19 08:36:12 +0000
commit98890d53957dee66e66b78d38adffad76615366f (patch)
tree6573c014ec3247d1ee0bc4b9b63cf941d0476fa6 /sax/source
parent4adf7e4d6352acd3d38d3827d2f051ad04d9d277 (diff)
#89926#; don't create and copy the sequence so often
Diffstat (limited to 'sax/source')
-rw-r--r--sax/source/expatwrap/saxwriter.cxx20
1 files changed, 12 insertions, 8 deletions
diff --git a/sax/source/expatwrap/saxwriter.cxx b/sax/source/expatwrap/saxwriter.cxx
index 626c3e22674c..4141fda30b72 100644
--- a/sax/source/expatwrap/saxwriter.cxx
+++ b/sax/source/expatwrap/saxwriter.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: saxwriter.cxx,v $
*
- * $Revision: 1.6 $
+ * $Revision: 1.7 $
*
- * last change: $Author: dvo $ $Date: 2001-06-22 16:32:24 $
+ * last change: $Author: sab $ $Date: 2001-07-19 09:36:12 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -385,7 +385,9 @@ public:
SAXWriter( ) :
m_nMaxColumn(72),
m_bForceLineBreak(sal_False),
- m_bAllowLineBreak(sal_False)
+ m_bAllowLineBreak(sal_False),
+ m_seqStartElement(),
+ m_bIsSeqFilled(sal_False)
{}
public: // XActiveDataSource
@@ -450,10 +452,10 @@ private:
inline void pushStartElement()
{
- if( m_seqStartElement.getLength() )
+ if( m_bIsSeqFilled && m_seqStartElement.getLength() )
{
writeSequence( m_seqStartElement );
- m_seqStartElement = Sequence < sal_Int8 > ();
+ m_bIsSeqFilled = sal_False;
}
}
@@ -463,6 +465,7 @@ private:
Sequence < sal_Int8 > m_seqStartElement;
// Status information
+ sal_Bool m_bIsSeqFilled;
sal_Bool m_bDocStarted;
sal_Bool m_bIsCDATA;
sal_Bool m_bForceLineBreak;
@@ -683,7 +686,8 @@ void SAXWriter::startElement(const OUString& aName, const Reference< XAttributeL
nLength += nPrefix;
// now create the sequence, store it ( maybe later an empty tag ? )
- m_seqStartElement = Sequence< sal_Int8 > ( nLength );
+ m_seqStartElement.realloc( nLength );
+ m_bIsSeqFilled = sal_True;
sal_Int8 *pTarget = (sal_Int8*) m_seqStartElement.getConstArray(); // we OWN the sequence
sal_Int32 nPos =0;
@@ -737,7 +741,7 @@ void SAXWriter::endElement(const OUString& aName) throw (SAXException, Runtime
throw SAXException();
}
- if( m_seqStartElement.getLength() )
+ if( m_bIsSeqFilled && m_seqStartElement.getLength() )
{
m_seqStartElement.realloc( m_seqStartElement.getLength() + 1 );
@@ -745,7 +749,7 @@ void SAXWriter::endElement(const OUString& aName) throw (SAXException, Runtime
p[m_seqStartElement.getLength()-2] = '/';
p[m_seqStartElement.getLength()-1] = '>';
writeSequence( m_seqStartElement );
- m_seqStartElement = Sequence< sal_Int8 > ();
+ m_bIsSeqFilled = sal_False;
m_bForceLineBreak = sal_False;
}
else {