summaryrefslogtreecommitdiff
path: root/sax/source/tools/fastserializer.cxx
diff options
context:
space:
mode:
authorMichael Stahl <mstahl@redhat.com>2015-07-17 23:27:20 +0200
committerMichael Stahl <mstahl@redhat.com>2015-07-18 22:51:47 +0200
commit2842c5cfb99d41b36dba52db01ca6cd37d2ef4b0 (patch)
treec74e2e8a37f57d6610684d9abbbf21386bd24194 /sax/source/tools/fastserializer.cxx
parent7352a7c17875e5adcc4226c45f4a03e11c44ff49 (diff)
sax, sw: try to make that maMarkStack easier to understand
In DocxAttributeOutput it's not at all obvious which mark() is supposed to be ended by which mergeTopMarks(), so add an extra parameter to the FastSaxSerializer functions and verify with an assertion that a LIFO order is maintained. Change-Id: I5a421e2fb11f15343147417fe0b9b23642c70721
Diffstat (limited to 'sax/source/tools/fastserializer.cxx')
-rw-r--r--sax/source/tools/fastserializer.cxx14
1 files changed, 9 insertions, 5 deletions
diff --git a/sax/source/tools/fastserializer.cxx b/sax/source/tools/fastserializer.cxx
index 2d4a2e1ff5bc..66466e9b6b90 100644
--- a/sax/source/tools/fastserializer.cxx
+++ b/sax/source/tools/fastserializer.cxx
@@ -330,17 +330,17 @@ namespace sax_fastparser {
}
}
- void FastSaxSerializer::mark( const Int32Sequence& aOrder )
+ void FastSaxSerializer::mark(sal_Int32 const nTag, const Int32Sequence& rOrder)
{
- if ( aOrder.hasElements() )
+ if (rOrder.hasElements())
{
- boost::shared_ptr< ForMerge > pSort( new ForSort( aOrder ) );
+ boost::shared_ptr< ForMerge > pSort( new ForSort(nTag, rOrder) );
maMarkStack.push( pSort );
maCachedOutputStream.setOutput( pSort );
}
else
{
- boost::shared_ptr< ForMerge > pMerge( new ForMerge( ) );
+ boost::shared_ptr< ForMerge > pMerge( new ForMerge(nTag) );
maMarkStack.push( pMerge );
maCachedOutputStream.setOutput( pMerge );
}
@@ -401,12 +401,16 @@ namespace sax_fastparser {
}
#endif
- void FastSaxSerializer::mergeTopMarks( sax_fastparser::MergeMarksEnum eMergeType )
+ void FastSaxSerializer::mergeTopMarks(
+ sal_Int32 const nTag, sax_fastparser::MergeMarksEnum const eMergeType)
{
SAL_WARN_IF(mbMarkStackEmpty, "sax", "Empty mark stack - nothing to merge");
+ assert(!mbMarkStackEmpty); // should never happen
if ( mbMarkStackEmpty )
return;
+ assert(maMarkStack.top()->m_Tag == nTag && "mark/merge tag mismatch!");
+ (void) nTag;
#ifdef DBG_UTIL
if (dynamic_cast<ForSort*>(maMarkStack.top().get()))
{