diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-01-24 10:51:30 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-01-25 07:24:09 +0100 |
commit | 6a579702b1128372aa30c86156996e57ba73b2c8 (patch) | |
tree | 4b6fe3f9bc45c9776415199d3b32eec768c615ac /svl/source/misc | |
parent | fe4de616a4a7cc1d5a2ab701e84477f73a47c61a (diff) |
loplugin:flatten in svl
Change-Id: Id5c62c00aa8349468c0d547616424b2637533e7f
Reviewed-on: https://gerrit.libreoffice.org/48485
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'svl/source/misc')
-rw-r--r-- | svl/source/misc/inethist.cxx | 26 | ||||
-rw-r--r-- | svl/source/misc/sharecontrolfile.cxx | 34 | ||||
-rw-r--r-- | svl/source/misc/strmadpt.cxx | 68 |
3 files changed, 65 insertions, 63 deletions
diff --git a/svl/source/misc/inethist.cxx b/svl/source/misc/inethist.cxx index 46d298acf310..c4d5daeea374 100644 --- a/svl/source/misc/inethist.cxx +++ b/svl/source/misc/inethist.cxx @@ -355,22 +355,22 @@ void INetURLHistory::NormalizeUrl_Impl (INetURLObject &rUrl) void INetURLHistory::PutUrl_Impl (const INetURLObject &rUrl) { DBG_ASSERT (m_pImpl, "PutUrl_Impl(): no Implementation"); - if (m_pImpl) - { - INetURLObject aHistUrl (rUrl); - NormalizeUrl_Impl (aHistUrl); + if (!m_pImpl) + return; - m_pImpl->putUrl (aHistUrl.GetMainURL(INetURLObject::DecodeMechanism::NONE)); - Broadcast (INetURLHistoryHint (&rUrl)); + INetURLObject aHistUrl (rUrl); + NormalizeUrl_Impl (aHistUrl); - if (aHistUrl.HasMark()) - { - aHistUrl.SetURL (aHistUrl.GetURLNoMark(INetURLObject::DecodeMechanism::NONE), - INetURLObject::EncodeMechanism::NotCanonical); + m_pImpl->putUrl (aHistUrl.GetMainURL(INetURLObject::DecodeMechanism::NONE)); + Broadcast (INetURLHistoryHint (&rUrl)); - m_pImpl->putUrl (aHistUrl.GetMainURL(INetURLObject::DecodeMechanism::NONE)); - Broadcast (INetURLHistoryHint (&aHistUrl)); - } + if (aHistUrl.HasMark()) + { + aHistUrl.SetURL (aHistUrl.GetURLNoMark(INetURLObject::DecodeMechanism::NONE), + INetURLObject::EncodeMechanism::NotCanonical); + + m_pImpl->putUrl (aHistUrl.GetMainURL(INetURLObject::DecodeMechanism::NONE)); + Broadcast (INetURLHistoryHint (&aHistUrl)); } } diff --git a/svl/source/misc/sharecontrolfile.cxx b/svl/source/misc/sharecontrolfile.cxx index fbae7224497a..d9ef69f9844e 100644 --- a/svl/source/misc/sharecontrolfile.cxx +++ b/svl/source/misc/sharecontrolfile.cxx @@ -123,25 +123,25 @@ void ShareControlFile::Close() { // if it is called outside of destructor the mutex must be locked - if ( m_xStream.is() ) + if ( !m_xStream.is() ) + return; + + try { - try - { - if ( m_xInputStream.is() ) - m_xInputStream->closeInput(); - if ( m_xOutputStream.is() ) - m_xOutputStream->closeOutput(); - } - catch( uno::Exception& ) - {} - - m_xStream.clear(); - m_xInputStream.clear(); - m_xOutputStream.clear(); - m_xSeekable.clear(); - m_xTruncate.clear(); - m_aUsersData.clear(); + if ( m_xInputStream.is() ) + m_xInputStream->closeInput(); + if ( m_xOutputStream.is() ) + m_xOutputStream->closeOutput(); } + catch( uno::Exception& ) + {} + + m_xStream.clear(); + m_xInputStream.clear(); + m_xOutputStream.clear(); + m_xSeekable.clear(); + m_xTruncate.clear(); + m_aUsersData.clear(); } diff --git a/svl/source/misc/strmadpt.cxx b/svl/source/misc/strmadpt.cxx index cb5852865c88..07e9b62fe310 100644 --- a/svl/source/misc/strmadpt.cxx +++ b/svl/source/misc/strmadpt.cxx @@ -570,45 +570,47 @@ void SvDataPipe_Impl::write(sal_Int8 const * pBuffer, sal_uInt32 nSize) } } - if (nRemain > 0) - for (;;) - { - sal_uInt32 nBlock - = std::min(sal_uInt32(m_pWritePage->m_aBuffer + m_nPageSize - - m_pWritePage->m_pEnd), - nRemain); - memcpy(m_pWritePage->m_pEnd, pBuffer, nBlock); - m_pWritePage->m_pEnd += nBlock; - pBuffer += nBlock; - nRemain -= nBlock; + if (nRemain <= 0) + return; - if (nRemain == 0) - break; + for (;;) + { + sal_uInt32 nBlock + = std::min(sal_uInt32(m_pWritePage->m_aBuffer + m_nPageSize + - m_pWritePage->m_pEnd), + nRemain); + memcpy(m_pWritePage->m_pEnd, pBuffer, nBlock); + m_pWritePage->m_pEnd += nBlock; + pBuffer += nBlock; + nRemain -= nBlock; - if (m_pWritePage->m_pNext == m_pFirstPage) - { - if (m_nPages == std::numeric_limits< sal_uInt32 >::max()) - break; + if (nRemain == 0) + break; - Page * pNew - = static_cast< Page * >(rtl_allocateMemory( - sizeof (Page) + m_nPageSize - - 1)); - pNew->m_pPrev = m_pWritePage; - pNew->m_pNext = m_pWritePage->m_pNext; + if (m_pWritePage->m_pNext == m_pFirstPage) + { + if (m_nPages == std::numeric_limits< sal_uInt32 >::max()) + break; - m_pWritePage->m_pNext->m_pPrev = pNew; - m_pWritePage->m_pNext = pNew; - ++m_nPages; - } + Page * pNew + = static_cast< Page * >(rtl_allocateMemory( + sizeof (Page) + m_nPageSize + - 1)); + pNew->m_pPrev = m_pWritePage; + pNew->m_pNext = m_pWritePage->m_pNext; - m_pWritePage->m_pNext->m_nOffset = m_pWritePage->m_nOffset - + m_nPageSize; - m_pWritePage = m_pWritePage->m_pNext; - m_pWritePage->m_pStart = m_pWritePage->m_aBuffer; - m_pWritePage->m_pRead = m_pWritePage->m_aBuffer; - m_pWritePage->m_pEnd = m_pWritePage->m_aBuffer; + m_pWritePage->m_pNext->m_pPrev = pNew; + m_pWritePage->m_pNext = pNew; + ++m_nPages; } + + m_pWritePage->m_pNext->m_nOffset = m_pWritePage->m_nOffset + + m_nPageSize; + m_pWritePage = m_pWritePage->m_pNext; + m_pWritePage->m_pStart = m_pWritePage->m_aBuffer; + m_pWritePage->m_pRead = m_pWritePage->m_aBuffer; + m_pWritePage->m_pEnd = m_pWritePage->m_aBuffer; + } } SvDataPipe_Impl::SeekResult SvDataPipe_Impl::setReadPosition(sal_uInt32 |