diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2020-04-19 11:14:36 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2020-04-19 12:41:48 +0200 |
commit | a759623c3f4bc0265b619ef2bcdff72045a1b5b3 (patch) | |
tree | 42833d8e6e82009fe5bd5ca3cc0e8d06fb109a61 | |
parent | 2ee60f02c456f39a80edb2dbfed48c3e0147a7f7 (diff) |
loplugin:buriedassign in various
Change-Id: Ib79cbc89f2f89ff48ea8b59bd12373a10b9dcd62
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/92495
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
-rw-r--r-- | desktop/source/lib/init.cxx | 3 | ||||
-rw-r--r-- | include/canvas/canvastools.hxx | 6 | ||||
-rw-r--r-- | include/editeng/svxrtf.hxx | 8 | ||||
-rw-r--r-- | include/rtl/strbuf.hxx | 3 | ||||
-rw-r--r-- | include/rtl/ustrbuf.hxx | 3 | ||||
-rw-r--r-- | include/sfx2/objsh.hxx | 3 | ||||
-rw-r--r-- | slideshow/source/engine/animationnodes/generateevent.cxx | 21 | ||||
-rw-r--r-- | testtools/source/bridgetest/bridgetest.cxx | 9 |
8 files changed, 37 insertions, 19 deletions
diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx index 11fa55b9c23d..2fb3e7efdaad 100644 --- a/desktop/source/lib/init.cxx +++ b/desktop/source/lib/init.cxx @@ -1174,7 +1174,8 @@ rtl::Reference<LOKClipboard> forceSetClipboardForCurrentView(LibreOfficeKitDocum LibLODocument_Impl::LibLODocument_Impl(const uno::Reference <css::lang::XComponent> &xComponent) : mxComponent(xComponent) { - if (!(m_pDocumentClass = gDocumentClass.lock())) + m_pDocumentClass = gDocumentClass.lock(); + if (!m_pDocumentClass) { m_pDocumentClass = std::make_shared<LibreOfficeKitDocumentClass>(); diff --git a/include/canvas/canvastools.hxx b/include/canvas/canvastools.hxx index 99b7433d279e..10f734cfebe3 100644 --- a/include/canvas/canvastools.hxx +++ b/include/canvas/canvastools.hxx @@ -511,12 +511,12 @@ namespace canvas ValueType() }; - const MapEntry* pRes; const MapEntry* pEnd = mpMap+mnEntries; - if( (pRes=::std::lower_bound( mpMap, + const MapEntry* pRes = ::std::lower_bound( mpMap, pEnd, aSearchKey, - &mapComparator )) != pEnd ) + &mapComparator ); + if( pRes != pEnd ) { // place to _insert before_ found - is it equal to // the search key? diff --git a/include/editeng/svxrtf.hxx b/include/editeng/svxrtf.hxx index 7102fde8e925..2069abb48877 100644 --- a/include/editeng/svxrtf.hxx +++ b/include/editeng/svxrtf.hxx @@ -348,8 +348,14 @@ inline const Color& SvxRTFParser::GetColor( size_t nId ) const inline SfxItemSet& SvxRTFParser::GetAttrSet() { SvxRTFItemStackType* pTmp; - if( bNewGroup || nullptr == ( pTmp = aAttrStack.empty() ? nullptr : aAttrStack.back().get()) ) + if( bNewGroup || aAttrStack.empty() ) pTmp = GetAttrSet_(); + else + { + pTmp = aAttrStack.back().get(); + if ( pTmp == nullptr ) + pTmp = GetAttrSet_(); + } return pTmp->aAttrSet; } diff --git a/include/rtl/strbuf.hxx b/include/rtl/strbuf.hxx index 780f00dddbb5..2a303ce998e6 100644 --- a/include/rtl/strbuf.hxx +++ b/include/rtl/strbuf.hxx @@ -300,7 +300,8 @@ public: template<typename T> OStringBuffer & operator =(OStringNumber<T> && n) { - return *this = OStringBuffer( std::move ( n )); + *this = OStringBuffer( std::move ( n )); + return *this; } #endif diff --git a/include/rtl/ustrbuf.hxx b/include/rtl/ustrbuf.hxx index a1b477498f6e..dcd228e9eea8 100644 --- a/include/rtl/ustrbuf.hxx +++ b/include/rtl/ustrbuf.hxx @@ -345,7 +345,8 @@ public: template<typename T> OUStringBuffer & operator =(OUStringNumber<T> && n) { - return *this = OUStringBuffer( std::move( n )); + *this = OUStringBuffer( std::move( n ) ); + return *this; } #endif diff --git a/include/sfx2/objsh.hxx b/include/sfx2/objsh.hxx index 6f3f1098a479..22f5995b0291 100644 --- a/include/sfx2/objsh.hxx +++ b/include/sfx2/objsh.hxx @@ -863,7 +863,8 @@ inline SfxObjectShellLock & SfxObjectShellLock::operator=( SfxObjectShellLock && } inline SfxObjectShellLock & SfxObjectShellLock::operator=( SfxObjectShell * pObjP ) { - return *this = SfxObjectShellLock( pObjP ); + *this = SfxObjectShellLock( pObjP ); + return *this; } class SFX2_DLLPUBLIC SfxObjectShellItem final : public SfxPoolItem diff --git a/slideshow/source/engine/animationnodes/generateevent.cxx b/slideshow/source/engine/animationnodes/generateevent.cxx index 475b1c18edc9..b228f041a93e 100644 --- a/slideshow/source/engine/animationnodes/generateevent.cxx +++ b/slideshow/source/engine/animationnodes/generateevent.cxx @@ -79,6 +79,11 @@ EventSharedPtr generateEvent( // TODO(F1): Respect aEvent.Repeat value + auto event2shape = [&] () { + if (aEvent.Source >>= xShape) + pShape = rContext.mpSubsettableShapeManager->lookupShape(xShape); + }; + switch (aEvent.Trigger) { default: ENSURE_OR_THROW( false, "unexpected event trigger!" ); @@ -121,8 +126,8 @@ EventSharedPtr generateEvent( break; case animations::EventTrigger::ON_CLICK: // try to extract XShape event source - if ((aEvent.Source >>= xShape) && - (pShape = rContext.mpSubsettableShapeManager->lookupShape(xShape)).get()) + event2shape(); + if (pShape.get()) { pEvent = makeDelay( rFunctor, nDelay2 + nAdditionalDelay, @@ -137,8 +142,8 @@ EventSharedPtr generateEvent( break; case animations::EventTrigger::ON_DBL_CLICK: // try to extract XShape event source - if ((aEvent.Source >>= xShape) && - (pShape = rContext.mpSubsettableShapeManager->lookupShape(xShape)).get()) + event2shape(); + if (pShape.get()) { pEvent = makeDelay( rFunctor, nDelay2 + nAdditionalDelay, @@ -153,8 +158,8 @@ EventSharedPtr generateEvent( break; case animations::EventTrigger::ON_MOUSE_ENTER: // try to extract XShape event source - if ((aEvent.Source >>= xShape) && - (pShape = rContext.mpSubsettableShapeManager->lookupShape(xShape)).get()) + event2shape(); + if (pShape.get()) { pEvent = makeDelay( rFunctor, nDelay2 + nAdditionalDelay, @@ -169,8 +174,8 @@ EventSharedPtr generateEvent( break; case animations::EventTrigger::ON_MOUSE_LEAVE: // try to extract XShape event source - if ((aEvent.Source >>= xShape) && - (pShape = rContext.mpSubsettableShapeManager->lookupShape(xShape)).get()) + event2shape(); + if (pShape.get()) { pEvent = makeDelay( rFunctor, nDelay2 + nAdditionalDelay, diff --git a/testtools/source/bridgetest/bridgetest.cxx b/testtools/source/bridgetest/bridgetest.cxx index 4abda229d830..3594ff37830d 100644 --- a/testtools/source/bridgetest/bridgetest.cxx +++ b/testtools/source/bridgetest/bridgetest.cxx @@ -158,9 +158,12 @@ static bool equals( const TestData & rData1, const TestData & rData2 ) { sal_Int32 nLen; - if ((rData1.Sequence == rData2.Sequence) && - equals( static_cast<const TestElement &>(rData1), static_cast<const TestElement &>(rData2) ) && - (nLen = rData1.Sequence.getLength()) == rData2.Sequence.getLength()) + if (rData1.Sequence != rData2.Sequence) + return false; + if (!equals( static_cast<const TestElement &>(rData1), static_cast<const TestElement &>(rData2) )) + return false; + nLen = rData1.Sequence.getLength(); + if (nLen == rData2.Sequence.getLength()) { // once again by hand sequence == const TestElement * pElements1 = rData1.Sequence.getConstArray(); |