summaryrefslogtreecommitdiff
path: root/sax/source/fastparser/fastparser.cxx
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2020-04-02 10:52:17 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2020-04-02 20:05:51 +0200
commitd8af42ec5004c8cdb57b6aa60a0f811cf61ad355 (patch)
treeeb3d63bedcc35666dd2625daedfa230c45f747d6 /sax/source/fastparser/fastparser.cxx
parentd9946e6d0ba81071f3e50622e5cae9e2ffc9bfb0 (diff)
loplugin:flatten in sax
Change-Id: I01c1f3328d04cf6ea7c76fab9547970387b968e5 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/91551 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sax/source/fastparser/fastparser.cxx')
-rw-r--r--sax/source/fastparser/fastparser.cxx65
1 files changed, 32 insertions, 33 deletions
diff --git a/sax/source/fastparser/fastparser.cxx b/sax/source/fastparser/fastparser.cxx
index 81591e4a3649..bca3f502defc 100644
--- a/sax/source/fastparser/fastparser.cxx
+++ b/sax/source/fastparser/fastparser.cxx
@@ -943,26 +943,26 @@ void FastSaxParserImpl::deleteUsedEvents()
void FastSaxParserImpl::produce( bool bForceFlush )
{
Entity& rEntity = getEntity();
- if (bForceFlush ||
- rEntity.mnProducedEventsSize >= Entity::mnEventListSize)
- {
- osl::ResettableMutexGuard aGuard(rEntity.maEventProtector);
-
- while (rEntity.maPendingEvents.size() >= Entity::mnEventHighWater)
- { // pause parsing for a bit
- aGuard.clear(); // unlock
- rEntity.maProduceResume.wait();
- rEntity.maProduceResume.reset();
- aGuard.reset(); // lock
- }
+ if (!(bForceFlush ||
+ rEntity.mnProducedEventsSize >= Entity::mnEventListSize))
+ return;
- rEntity.maPendingEvents.push(std::move(rEntity.mxProducedEvents));
- assert(rEntity.mxProducedEvents.get() == nullptr);
+ osl::ResettableMutexGuard aGuard(rEntity.maEventProtector);
+ while (rEntity.maPendingEvents.size() >= Entity::mnEventHighWater)
+ { // pause parsing for a bit
aGuard.clear(); // unlock
-
- rEntity.maConsumeResume.set();
+ rEntity.maProduceResume.wait();
+ rEntity.maProduceResume.reset();
+ aGuard.reset(); // lock
}
+
+ rEntity.maPendingEvents.push(std::move(rEntity.mxProducedEvents));
+ assert(rEntity.mxProducedEvents.get() == nullptr);
+
+ aGuard.clear(); // unlock
+
+ rEntity.maConsumeResume.set();
}
bool FastSaxParserImpl::consume(EventList& rEventList)
@@ -1348,23 +1348,22 @@ FastSaxParser::~FastSaxParser()
void SAL_CALL
FastSaxParser::initialize(css::uno::Sequence< css::uno::Any > const& rArguments)
{
- if (rArguments.hasElements())
- {
- OUString str;
- if ( rArguments[0] >>= str )
- {
- if ( str == "IgnoreMissingNSDecl" )
- mpImpl->m_bIgnoreMissingNSDecl = true;
- else if ( str == "DoSmeplease" )
- ; //just ignore as this is already immune to billion laughs
- else if ( str == "DisableThreadedParser" )
- mpImpl->m_bDisableThreadedParser = true;
- else
- throw IllegalArgumentException();
- }
- else
- throw IllegalArgumentException();
- }
+ if (!rArguments.hasElements())
+ return;
+
+ OUString str;
+ if ( !(rArguments[0] >>= str) )
+ throw IllegalArgumentException();
+
+ if ( str == "IgnoreMissingNSDecl" )
+ mpImpl->m_bIgnoreMissingNSDecl = true;
+ else if ( str == "DoSmeplease" )
+ ; //just ignore as this is already immune to billion laughs
+ else if ( str == "DisableThreadedParser" )
+ mpImpl->m_bDisableThreadedParser = true;
+ else
+ throw IllegalArgumentException();
+
}
void FastSaxParser::parseStream( const xml::sax::InputSource& aInputSource )