From c8907b19dc04a57b74cfc14dc641ac41177e2142 Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Fri, 16 Nov 2018 14:06:06 +0200 Subject: loplugin:buriedassign in sw Change-Id: If2adf22a0ac3e030fca1b4ecd0173cac58f0f21e Reviewed-on: https://gerrit.libreoffice.org/63470 Tested-by: Jenkins Reviewed-by: Noel Grandin --- sw/source/core/bastyp/bparr.cxx | 13 ++++++-- sw/source/core/bastyp/breakit.cxx | 3 +- sw/source/core/bastyp/calc.cxx | 3 +- sw/source/core/bastyp/init.cxx | 5 +++- sw/source/core/doc/DocumentFieldsManager.cxx | 8 +++-- sw/source/core/doc/DocumentRedlineManager.cxx | 10 +++++-- sw/source/core/doc/DocumentStylePoolManager.cxx | 6 ++-- sw/source/core/doc/doccomp.cxx | 24 +++++++++++---- sw/source/core/doc/docfmt.cxx | 5 +++- sw/source/core/doc/docredln.cxx | 3 +- sw/source/core/docnode/ndtbl1.cxx | 5 +++- sw/source/core/docnode/nodes.cxx | 5 +++- sw/source/core/edit/autofmt.cxx | 12 ++++++-- sw/source/core/fields/cellfml.cxx | 3 +- sw/source/core/fields/dbfld.cxx | 7 +++-- sw/source/core/fields/docufld.cxx | 11 ++++--- sw/source/core/frmedt/fecopy.cxx | 9 ++++-- sw/source/core/frmedt/fefly1.cxx | 12 +++++--- sw/source/core/layout/findfrm.cxx | 40 ++++++++++++++++++------- sw/source/core/layout/paintfrm.cxx | 3 +- sw/source/core/layout/sectfrm.cxx | 17 +++++++---- sw/source/core/table/swtable.cxx | 6 ++-- sw/source/core/text/frmform.cxx | 4 +-- sw/source/core/undo/undobj1.cxx | 6 ++-- sw/source/core/unocore/unoobj.cxx | 12 +++++--- sw/source/filter/basflt/fltini.cxx | 9 ++++-- sw/source/filter/html/swhtml.cxx | 12 ++++---- sw/source/filter/ww8/rtfexport.cxx | 15 ++++++++-- sw/source/filter/ww8/wrtw8sty.cxx | 4 +-- sw/source/filter/ww8/ww8par5.cxx | 7 +++-- sw/source/ui/dbui/mmdocselectpage.cxx | 24 ++++++++++++--- sw/source/ui/misc/srtdlg.cxx | 5 +++- sw/source/uibase/app/docsh2.cxx | 12 +++++--- sw/source/uibase/app/docstyle.cxx | 6 ++-- sw/source/uibase/config/viewopt.cxx | 5 +++- sw/source/uibase/dochdl/swdtflvr.cxx | 10 ++++++- sw/source/uibase/wrtsh/move.cxx | 3 +- 37 files changed, 248 insertions(+), 96 deletions(-) (limited to 'sw/source') diff --git a/sw/source/core/bastyp/bparr.cxx b/sw/source/core/bastyp/bparr.cxx index da67b8b1a617..f466f204a643 100644 --- a/sw/source/core/bastyp/bparr.cxx +++ b/sw/source/core/bastyp/bparr.cxx @@ -207,7 +207,8 @@ void BigPtrArray::Insert( BigPtrEntry* pElem, sal_uLong pos ) if( !m_nSize ) { // special case: insert first element - p = InsBlock( cur = 0 ); + cur = 0; + p = InsBlock( cur ); } else if( pos == m_nSize ) { @@ -238,7 +239,10 @@ void BigPtrArray::Insert( BigPtrEntry* pElem, sal_uLong pos ) auto pFrom = q->mvData.begin() + nCount; auto pTo = pFrom + 1; while( nCount-- ) - ++( *--pTo = *--pFrom )->m_nOffset; + { + *--pTo = *--pFrom; + ++((*pTo)->m_nOffset); + } } q->nStart--; q->nEnd--; @@ -281,7 +285,10 @@ void BigPtrArray::Insert( BigPtrEntry* pElem, sal_uLong pos ) auto pFrom = p->mvData.begin() + p->nElem; auto pTo = pFrom + 1; while( nCount-- ) - ++( *--pTo = *--pFrom )->m_nOffset; + { + *--pTo = *--pFrom; + ++( *pTo )->m_nOffset; + } } // insert element and update indices pElem->m_nOffset = sal_uInt16(pos); diff --git a/sw/source/core/bastyp/breakit.cxx b/sw/source/core/bastyp/breakit.cxx index 9fb1f98348fc..3427c483a04b 100644 --- a/sw/source/core/bastyp/breakit.cxx +++ b/sw/source/core/bastyp/breakit.cxx @@ -137,7 +137,8 @@ SvtScriptType SwBreakIt::GetAllScriptsOfText( const OUString& rText ) const for( sal_Int32 n = 0, nEnd = rText.getLength(); n < nEnd; n = m_xBreak->endOfScript(rText, n, nScript) ) { - switch( nScript = m_xBreak->getScriptType(rText, n) ) + nScript = m_xBreak->getScriptType(rText, n); + switch( nScript ) { case i18n::ScriptType::LATIN: nRet |= SvtScriptType::LATIN; break; case i18n::ScriptType::ASIAN: nRet |= SvtScriptType::ASIAN; break; diff --git a/sw/source/core/bastyp/calc.cxx b/sw/source/core/bastyp/calc.cxx index b61be8fe83aa..4d80b9a2302e 100644 --- a/sw/source/core/bastyp/calc.cxx +++ b/sw/source/core/bastyp/calc.cxx @@ -655,7 +655,8 @@ SwCalcOper SwCalc::GetToken() CalcOp* pFnd = ::FindOperator( sLowerCaseName ); if( pFnd ) { - switch( ( m_eCurrOper = pFnd->eOp ) ) + m_eCurrOper = pFnd->eOp; + switch( m_eCurrOper ) { case CALC_SUM: case CALC_MEAN: diff --git a/sw/source/core/bastyp/init.cxx b/sw/source/core/bastyp/init.cxx index 657c7b1fb795..780d11595ef8 100644 --- a/sw/source/core/bastyp/init.cxx +++ b/sw/source/core/bastyp/init.cxx @@ -753,7 +753,10 @@ CharClass& GetAppCharClass() void SwCalendarWrapper::LoadDefaultCalendar( LanguageType eLang ) { if( eLang != nLang ) - loadDefaultCalendar( LanguageTag::convertToLocale( nLang = eLang )); + { + nLang = eLang; + loadDefaultCalendar( LanguageTag::convertToLocale( nLang )); + } } LanguageType GetAppLanguage() diff --git a/sw/source/core/doc/DocumentFieldsManager.cxx b/sw/source/core/doc/DocumentFieldsManager.cxx index ae1d7fcab7f5..15b89a5bdc71 100644 --- a/sw/source/core/doc/DocumentFieldsManager.cxx +++ b/sw/source/core/doc/DocumentFieldsManager.cxx @@ -952,7 +952,9 @@ void DocumentFieldsManager::UpdateExpFieldsImpl( const SwFieldType* pFieldType; // process separately: for( auto n = mpFieldTypes->size(); n; ) - switch( ( pFieldType = (*mpFieldTypes)[ --n ] )->Which() ) + { + pFieldType = (*mpFieldTypes)[ --n ]; + switch( pFieldType->Which() ) { case SwFieldIds::User: { @@ -972,6 +974,7 @@ void DocumentFieldsManager::UpdateExpFieldsImpl( break; default: break; } + } } // The array is filled with all fields; start calculation. @@ -1057,7 +1060,8 @@ void DocumentFieldsManager::UpdateExpFieldsImpl( SwFormatField* pFormatField = const_cast(&pTextField->GetFormatField()); const SwField* pField = pFormatField->GetField(); - switch( nWhich = pField->GetTyp()->Which() ) + nWhich = pField->GetTyp()->Which(); + switch( nWhich ) { case SwFieldIds::HiddenText: { diff --git a/sw/source/core/doc/DocumentRedlineManager.cxx b/sw/source/core/doc/DocumentRedlineManager.cxx index a5b60561abdf..036e33e43853 100644 --- a/sw/source/core/doc/DocumentRedlineManager.cxx +++ b/sw/source/core/doc/DocumentRedlineManager.cxx @@ -2342,7 +2342,10 @@ bool DocumentRedlineManager::AcceptRedline( SwRedlineTable::size_type nPos, bool if( SwRedlineTable::npos != nFndPos || ( 0 != ( --nLoopCnt ) && SwRedlineTable::npos != ( nFndPos = mpRedlineTable->FindPrevSeqNo( nSeqNo, nPos ))) ) - pTmp = (*mpRedlineTable)[ nPos = nFndPos ]; + { + nPos = nFndPos; + pTmp = (*mpRedlineTable)[ nPos ]; + } else nLoopCnt = 0; } @@ -2481,7 +2484,10 @@ bool DocumentRedlineManager::RejectRedline( SwRedlineTable::size_type nPos, bool if( SwRedlineTable::npos != nFndPos || ( 0 != ( --nLoopCnt ) && SwRedlineTable::npos != ( nFndPos = mpRedlineTable->FindPrevSeqNo( nSeqNo, nPos ))) ) - pTmp = (*mpRedlineTable)[ nPos = nFndPos ]; + { + nPos = nFndPos; + pTmp = (*mpRedlineTable)[ nPos ]; + } else nLoopCnt = 0; } diff --git a/sw/source/core/doc/DocumentStylePoolManager.cxx b/sw/source/core/doc/DocumentStylePoolManager.cxx index e0b44789c499..09d457056a05 100644 --- a/sw/source/core/doc/DocumentStylePoolManager.cxx +++ b/sw/source/core/doc/DocumentStylePoolManager.cxx @@ -1967,12 +1967,14 @@ SwNumRule* DocumentStylePoolManager::GetNumRuleFromPool( sal_uInt16 nId ) { if ( eNumberFormatPositionAndSpaceMode == SvxNumberFormat::LABEL_WIDTH_AND_POSITION ) { - aFormat.SetAbsLSpace( nSpace = nSpace + pArr[ n ] ); + nSpace += pArr[ n ]; + aFormat.SetAbsLSpace( nSpace ); aFormat.SetFirstLineOffset( - pArr[ n ] ); } else if ( eNumberFormatPositionAndSpaceMode == SvxNumberFormat::LABEL_ALIGNMENT ) { - aFormat.SetListtabPos( nSpace = nSpace + pArr[ n ] ); + nSpace += pArr[ n ]; + aFormat.SetListtabPos( nSpace ); aFormat.SetIndentAt( nSpace ); aFormat.SetFirstLineIndent( - pArr[ n ] ); } diff --git a/sw/source/core/doc/doccomp.cxx b/sw/source/core/doc/doccomp.cxx index fead8dd1ec45..7d6e880c605a 100644 --- a/sw/source/core/doc/doccomp.cxx +++ b/sw/source/core/doc/doccomp.cxx @@ -858,8 +858,14 @@ sal_uLong Compare::CompareSequence::CheckDiag( sal_uLong nStt1, sal_uLong nEnd1, long d; /* Active diagonal. */ /* Extend the top-down search by an edit step in each diagonal. */ - fmin > dmin ? pFDiag[--fmin - 1] = -1 : ++fmin; - fmax < dmax ? pFDiag[++fmax + 1] = -1 : --fmax; + if (fmin > dmin) + pFDiag[--fmin - 1] = -1; + else + ++fmin; + if (fmax < dmax) + pFDiag[++fmax + 1] = -1; + else + --fmax; for (d = fmax; d >= fmin; d -= 2) { long x, y, tlo = pFDiag[d - 1], thi = pFDiag[d + 1]; @@ -884,8 +890,14 @@ sal_uLong Compare::CompareSequence::CheckDiag( sal_uLong nStt1, sal_uLong nEnd1, } /* Similar extend the bottom-up search. */ - bmin > dmin ? pBDiag[--bmin - 1] = INT_MAX : ++bmin; - bmax < dmax ? pBDiag[++bmax + 1] = INT_MAX : --bmax; + if (bmin > dmin) + pBDiag[--bmin - 1] = INT_MAX; + else + ++bmin; + if (bmax < dmax) + pBDiag[++bmax + 1] = INT_MAX; + else + --bmax; for (d = bmax; d >= bmin; d -= 2) { long x, y, tlo = pBDiag[d - 1], thi = pBDiag[d + 1]; @@ -1013,7 +1025,7 @@ sal_uLong SwCompareLine::GetHashValue() const { OUString sStr( GetText() ); for( sal_Int32 n = 0; n < sStr.getLength(); ++n ) - ( nRet <<= 1 ) += sStr[ n ]; + nRet = (nRet << 1) + sStr[ n ]; } break; @@ -1233,7 +1245,7 @@ sal_uLong SwCompareLine::GetTextNodeHashValue( const SwTextNode& rNd, sal_uLong { OUString sStr( rNd.GetExpandText(nullptr) ); for( sal_Int32 n = 0; n < sStr.getLength(); ++n ) - ( nVal <<= 1 ) += sStr[ n ]; + nVal = (nVal << 1 ) + sStr[ n ]; return nVal; } diff --git a/sw/source/core/doc/docfmt.cxx b/sw/source/core/doc/docfmt.cxx index ccebf3bfac0b..9f16c4131334 100644 --- a/sw/source/core/doc/docfmt.cxx +++ b/sw/source/core/doc/docfmt.cxx @@ -1722,7 +1722,10 @@ SwTableNumFormatMerge::SwTableNumFormatMerge( const SwDoc& rSrc, SwDoc& rDest ) // a different Doc -> Number formatter needs to be merged SvNumberFormatter* pN; if( &rSrc != &rDest && nullptr != ( pN = const_cast(rSrc).GetNumberFormatter( false ) )) - ( pNFormat = rDest.GetNumberFormatter())->MergeFormatter( *pN ); + { + pNFormat = rDest.GetNumberFormatter(); + pNFormat->MergeFormatter( *pN ); + } if( &rSrc != &rDest ) static_cast(rSrc.getIDocumentFieldsAccess().GetSysFieldType( SwFieldIds::GetRef ))-> diff --git a/sw/source/core/doc/docredln.cxx b/sw/source/core/doc/docredln.cxx index e26e02b53848..a323b595f0fc 100644 --- a/sw/source/core/doc/docredln.cxx +++ b/sw/source/core/doc/docredln.cxx @@ -1671,7 +1671,8 @@ void SwRangeRedline::MoveFromSection(size_t nMyPos) if( m_bDelLastPara ) { ++GetPoint()->nNode; - GetPoint()->nContent.Assign( pCNd = GetContentNode(), 0 ); + pCNd = GetContentNode(); + GetPoint()->nContent.Assign( pCNd, 0 ); m_bDelLastPara = false; } else if( pColl ) diff --git a/sw/source/core/docnode/ndtbl1.cxx b/sw/source/core/docnode/ndtbl1.cxx index fc9d328335f8..582cb226dc55 100644 --- a/sw/source/core/docnode/ndtbl1.cxx +++ b/sw/source/core/docnode/ndtbl1.cxx @@ -716,7 +716,10 @@ void SwDoc::SetTabBorders( const SwCursor& rCursor, const SfxItemSet& rSet ) if ( bLeftValid ) { aBox.SetLine( bRightOver ? pLeft : nullptr, SvxBoxItemLine::RIGHT ); - bVertValid ? nType |= 0x0020 : nType |= 0x0010; + if (bVertValid) + nType |= 0x0020; + else + nType |= 0x0010; } if ( bLeftOver ) { diff --git a/sw/source/core/docnode/nodes.cxx b/sw/source/core/docnode/nodes.cxx index 83e43c6d0d2a..57f44eb15483 100644 --- a/sw/source/core/docnode/nodes.cxx +++ b/sw/source/core/docnode/nodes.cxx @@ -452,7 +452,9 @@ bool SwNodes::MoveNodes( const SwNodeRange& aRange, SwNodes & rNodes, // continue until everything has been moved while( aRg.aStart < aRg.aEnd ) - switch( (pCurrentNode = &aRg.aEnd.GetNode())->GetNodeType() ) + { + pCurrentNode = &aRg.aEnd.GetNode(); + switch( pCurrentNode->GetNodeType() ) { case SwNodeType::End: { @@ -841,6 +843,7 @@ bool SwNodes::MoveNodes( const SwNodeRange& aRange, SwNodes & rNodes, OSL_FAIL( "Unknown node type" ); break; } + } if( nInsPos ) // copy remaining rest { diff --git a/sw/source/core/edit/autofmt.cxx b/sw/source/core/edit/autofmt.cxx index 37865d7c9a98..0b435c3a5f02 100644 --- a/sw/source/core/edit/autofmt.cxx +++ b/sw/source/core/edit/autofmt.cxx @@ -821,7 +821,7 @@ sal_uInt16 SwAutoFormat::GetDigitLevel( const SwTextNode& rNd, sal_Int32& rPos, c += SVX_NUM_ROMAN_LOWER; } - ( eScan &= ~(UPPER_ALPHA|LOWER_ALPHA)) |= eTmpScan; + eScan = (eScan & ~(UPPER_ALPHA|LOWER_ALPHA)) | eTmpScan; if( pNumTypes ) (*pNumTypes) = pNumTypes->replaceAt( pNumTypes->getLength() - 1, 1, OUString(c) ); } @@ -1877,7 +1877,9 @@ void SwAutoFormat::AutoCorrect( sal_Int32 nPos ) if (nPos && IsSpace((*pText)[nPos-1])) nLastBlank = nPos; for (nSttPos = nPos; !bBreak && nPos < pText->getLength(); ++nPos) - switch (cChar = (*pText)[nPos]) + { + cChar = (*pText)[nPos]; + switch (cChar) { case '\"': case '\'': @@ -1991,6 +1993,7 @@ void SwAutoFormat::AutoCorrect( sal_Int32 nPos ) } break; } + } if( nPos == nSttPos ) { @@ -2122,9 +2125,12 @@ SwAutoFormat::SwAutoFormat( SwEditShell* pEdShell, SvxSwAutoFormatFlags const & m_nEndNdIdx = m_aEndNdIdx.GetIndex(); if( !m_aFlags.bAFormatByInput ) + { + m_nEndNdIdx = m_aEndNdIdx.GetIndex(); ::StartProgress( STR_STATSTR_AUTOFORMAT, m_aNdIdx.GetIndex(), - m_nEndNdIdx = m_aEndNdIdx.GetIndex(), + m_nEndNdIdx, m_pDoc->GetDocShell() ); + } RedlineFlags eRedlMode = m_pDoc->getIDocumentRedlineAccess().GetRedlineFlags(), eOldMode = eRedlMode; if( m_aFlags.bWithRedlining ) diff --git a/sw/source/core/fields/cellfml.cxx b/sw/source/core/fields/cellfml.cxx index d99d39c81dc9..e5971f552bfb 100644 --- a/sw/source/core/fields/cellfml.cxx +++ b/sw/source/core/fields/cellfml.cxx @@ -930,7 +930,8 @@ void SwTableFormula::GetBoxes( const SwTableBox& rSttBox, const SwLayoutFrame *pStt, *pEnd; const SwFrame* pFrame = lcl_GetBoxFrame( rSttBox ); pStt = pFrame ? pFrame->GetUpper() : nullptr; - pEnd = ( nullptr != (pFrame = lcl_GetBoxFrame( rEndBox ))) ? pFrame->GetUpper() : nullptr; + pFrame = lcl_GetBoxFrame( rEndBox ); + pEnd = pFrame ? pFrame->GetUpper() : nullptr; if( !pStt || !pEnd ) return ; // no valid selection diff --git a/sw/source/core/fields/dbfld.cxx b/sw/source/core/fields/dbfld.cxx index f85e61eafd5d..6518f9f7b5b5 100644 --- a/sw/source/core/fields/dbfld.cxx +++ b/sw/source/core/fields/dbfld.cxx @@ -329,8 +329,11 @@ void SwDBField::Evaluate() SvNumberFormatter* pDocFormatter = GetDoc()->GetNumberFormatter(); pMgr->GetMergeColumnCnt(aColNm, GetLanguage(), aContent, &nValue); if( !( nSubType & nsSwExtendedSubType::SUB_OWN_FMT ) ) - SetFormat( nFormat = pMgr->GetColumnFormat( aTmpData.sDataSource, aTmpData.sCommand, - aColNm, pDocFormatter, GetLanguage() )); + { + nFormat = pMgr->GetColumnFormat( aTmpData.sDataSource, aTmpData.sCommand, + aColNm, pDocFormatter, GetLanguage() ); + SetFormat( nFormat ); + } sal_Int32 nColumnType = nValue == DBL_MAX ? 0 diff --git a/sw/source/core/fields/docufld.cxx b/sw/source/core/fields/docufld.cxx index 859c5d4ddc02..e2044622aa1d 100644 --- a/sw/source/core/fields/docufld.cxx +++ b/sw/source/core/fields/docufld.cxx @@ -2285,10 +2285,13 @@ void SwRefPageGetFieldType::UpdateField( SwTextField const * pTextField, const SwContentFrame *const pRefFrame = pRefTextField->GetTextNode().getLayoutFrame( pLayout, nullptr, &tmp); const SwPageFrame* pPgFrame = nullptr; - const short nDiff = ( pFrame && pRefFrame ) - ? (pPgFrame = pFrame->FindPageFrame())->GetPhyPageNum() - - pRefFrame->FindPageFrame()->GetPhyPageNum() + 1 - : 1; + short nDiff = 1; + if ( pFrame && pRefFrame ) + { + pPgFrame = pFrame->FindPageFrame(); + nDiff = pPgFrame->GetPhyPageNum() - + pRefFrame->FindPageFrame()->GetPhyPageNum() + 1; + } SvxNumType nTmpFormat = SVX_NUM_PAGEDESC == static_cast(pGetField->GetFormat()) ? ( !pPgFrame diff --git a/sw/source/core/frmedt/fecopy.cxx b/sw/source/core/frmedt/fecopy.cxx index abecc671a750..9eb869de51ec 100644 --- a/sw/source/core/frmedt/fecopy.cxx +++ b/sw/source/core/frmedt/fecopy.cxx @@ -1532,9 +1532,12 @@ bool SwFEShell::Paste(const Graphic &rGrf, const OUString& rURL) SdrObject* pObj = nullptr; SdrView *pView = Imp()->GetDrawView(); - bool bRet = 1 == pView->GetMarkedObjectList().GetMarkCount() && - (pObj = pView->GetMarkedObjectList().GetMark( 0 )->GetMarkedSdrObj())->IsClosedObj() && - dynamic_cast( pObj) == nullptr; + bool bRet = 1 == pView->GetMarkedObjectList().GetMarkCount(); + if (bRet) + { + pObj = pView->GetMarkedObjectList().GetMark( 0 )->GetMarkedSdrObj(); + bRet = pObj->IsClosedObj() && dynamic_cast( pObj) == nullptr; + } if( bRet && pObj ) { diff --git a/sw/source/core/frmedt/fefly1.cxx b/sw/source/core/frmedt/fefly1.cxx index 8a1c36b28f48..d94ee5c8e6ad 100644 --- a/sw/source/core/frmedt/fefly1.cxx +++ b/sw/source/core/frmedt/fefly1.cxx @@ -193,7 +193,8 @@ static bool lcl_FindAnchorPos( } } - aNewAnch.SetType( nNew = RndStdIds::FLY_AT_PAGE ); + nNew = RndStdIds::FLY_AT_PAGE; + aNewAnch.SetType( nNew ); SAL_FALLTHROUGH; case RndStdIds::FLY_AT_PAGE: @@ -1526,8 +1527,8 @@ const SwFrameFormat* SwFEShell::IsURLGrfAtPos( const Point& rPt, OUString* pURL, // without MapMode-Offset, without Offset, o ... !!!!! aPt = GetOut()->LogicToPixel( aPt, MapMode( MapUnit::MapTwip ) ); - ((( *pURL += "?" ) += OUString::number( aPt.getX() )) - += "," ) += OUString::number(aPt.getY() ); + *pURL = *pURL + "?" + OUString::number( aPt.getX() ) + + "," + OUString::number(aPt.getY() ); } } pRet = pFly->GetFormat(); @@ -1719,7 +1720,10 @@ ObjCntType SwFEShell::GetObjCntType( const Point &rPt, SdrObject *&rpObj ) const SdrObject* pObj = pDView->PickObj(rPt, pDView->getHitTolLog(), pPView, SdrSearchOptions::PICKMARKABLE); if (pObj) - eType = GetObjCntType( *(rpObj = pObj) ); + { + rpObj = pObj; + eType = GetObjCntType( *rpObj ); + } pDView->SetHitTolerancePixel( nOld ); } diff --git a/sw/source/core/layout/findfrm.cxx b/sw/source/core/layout/findfrm.cxx index 90d5fedfac70..a38f9f989529 100644 --- a/sw/source/core/layout/findfrm.cxx +++ b/sw/source/core/layout/findfrm.cxx @@ -313,18 +313,25 @@ const SwLayoutFrame *SwFrame::ImplGetNextLayoutLeaf( bool bFwd ) const bool bGoingFwdOrBwd = false; - bool bGoingDown = ( !bGoingUp && ( nullptr != (p = lcl_GetLower( pFrame, bFwd ) ) ) ); + bool bGoingDown = !bGoingUp; + if (bGoingDown) + { + p = lcl_GetLower( pFrame, bFwd ); + bGoingDown = nullptr != p; + } if ( !bGoingDown ) { // I cannot go down, because either I'm currently going up or // because the is no lower. // I'll try to go forward: - bGoingFwdOrBwd = (nullptr != (p = lcl_FindLayoutFrame( pFrame, bFwd ) ) ); + p = lcl_FindLayoutFrame( pFrame, bFwd ); + bGoingFwdOrBwd = nullptr != p; if ( !bGoingFwdOrBwd ) { // I cannot go forward, because there is no next frame. // I'll try to go up: - bGoingUp = (nullptr != (p = pFrame->GetUpper() ) ); + p = pFrame->GetUpper(); + bGoingUp = nullptr != p; if ( !bGoingUp ) { // I cannot go up, because there is no upper frame. @@ -366,13 +373,20 @@ const SwContentFrame* SwContentFrame::ImplGetNextContentFrame( bool bFwd ) const const SwFrame *p = nullptr; bool bGoingFwdOrBwd = false; - bool bGoingDown = ( !bGoingUp && ( nullptr != ( p = lcl_GetLower( pFrame, true ) ) ) ); + bool bGoingDown = !bGoingUp; + if (bGoingDown) + { + p = lcl_GetLower( pFrame, true ) ; + bGoingDown = nullptr != p; + } if ( !bGoingDown ) { - bGoingFwdOrBwd = ( nullptr != ( p = lcl_FindLayoutFrame( pFrame, bFwd ) ) ); + p = lcl_FindLayoutFrame( pFrame, bFwd ); + bGoingFwdOrBwd = nullptr != p; if ( !bGoingFwdOrBwd ) { - bGoingUp = ( nullptr != ( p = pFrame->GetUpper() ) ); + p = pFrame->GetUpper(); + bGoingUp = nullptr != p; if ( !bGoingUp ) { return nullptr; @@ -713,14 +727,20 @@ static SwFrame* lcl_NextFrame( SwFrame* pFrame ) SwFrame *p = nullptr; bool bGoingFwd = false; - bool bGoingDown = (!bGoingUp && ( nullptr != (p = pFrame->IsLayoutFrame() ? static_cast(pFrame)->Lower() : nullptr))); - + bool bGoingDown = !bGoingUp && pFrame->IsLayoutFrame(); + if (bGoingDown) + { + p = static_cast(pFrame)->Lower(); + bGoingDown = nullptr != p; + } if( !bGoingDown ) { - bGoingFwd = (nullptr != (p = ( pFrame->IsFlyFrame() ? static_cast(pFrame)->GetNextLink() : pFrame->GetNext()))); + p = pFrame->IsFlyFrame() ? static_cast(pFrame)->GetNextLink() : pFrame->GetNext(); + bGoingFwd = nullptr != p; if ( !bGoingFwd ) { - bGoingUp = (nullptr != (p = pFrame->GetUpper())); + p = pFrame->GetUpper(); + bGoingUp = nullptr != p; if ( !bGoingUp ) { return nullptr; diff --git a/sw/source/core/layout/paintfrm.cxx b/sw/source/core/layout/paintfrm.cxx index b7abc1e3453b..de8d04311d64 100644 --- a/sw/source/core/layout/paintfrm.cxx +++ b/sw/source/core/layout/paintfrm.cxx @@ -5168,7 +5168,8 @@ void SwFootnoteContFrame::PaintLine( const SwRect& rRect, SwRectFnSet aRectFnSet(this); SwTwips nPrtWidth = aRectFnSet.GetWidth(getFramePrintArea()); Fraction aFract( nPrtWidth, 1 ); - const SwTwips nWidth = static_cast(aFract *= rInf.GetWidth()); + aFract *= rInf.GetWidth(); + const SwTwips nWidth = static_cast(aFract); SwTwips nX = aRectFnSet.GetPrtLeft(*this); switch ( rInf.GetAdj() ) diff --git a/sw/source/core/layout/sectfrm.cxx b/sw/source/core/layout/sectfrm.cxx index 500eaa6b15d1..093d84d04f4e 100644 --- a/sw/source/core/layout/sectfrm.cxx +++ b/sw/source/core/layout/sectfrm.cxx @@ -591,15 +591,22 @@ static SwContentFrame* lcl_GetNextContentFrame( const SwLayoutFrame* pLay, bool const SwFrame *p = nullptr; bool bGoingFwdOrBwd = false; - bool bGoingDown = !bGoingUp && ( nullptr != ( p = pFrame->IsLayoutFrame() ? static_cast(pFrame)->Lower() : nullptr ) ); + bool bGoingDown = !bGoingUp && pFrame->IsLayoutFrame(); + if (bGoingDown) + { + p = static_cast(pFrame)->Lower(); + bGoingDown = nullptr != p; + } if ( !bGoingDown ) { - bGoingFwdOrBwd = ( nullptr != ( p = pFrame->IsFlyFrame() ? - ( bFwd ? static_cast(pFrame)->GetNextLink() : static_cast(pFrame)->GetPrevLink() ) : - ( bFwd ? pFrame->GetNext() :pFrame->GetPrev() ) ) ); + p = pFrame->IsFlyFrame() ? + ( bFwd ? static_cast(pFrame)->GetNextLink() : static_cast(pFrame)->GetPrevLink() ) : + ( bFwd ? pFrame->GetNext() :pFrame->GetPrev() ); + bGoingFwdOrBwd = nullptr != p; if ( !bGoingFwdOrBwd ) { - bGoingUp = (nullptr != (p = pFrame->GetUpper() ) ); + p = pFrame->GetUpper(); + bGoingUp = nullptr != p; if ( !bGoingUp ) return nullptr; } diff --git a/sw/source/core/table/swtable.cxx b/sw/source/core/table/swtable.cxx index 4054520e1f0f..93f53065a7ca 100644 --- a/sw/source/core/table/swtable.cxx +++ b/sw/source/core/table/swtable.cxx @@ -1834,13 +1834,15 @@ OUString SwTableBox::GetName() const const SwTableLines* pLines = pLine->GetUpper() ? &pLine->GetUpper()->GetTabLines() : &rTable.GetTabLines(); - sTmp = OUString::number( nPos = pLines->GetPos( pLine ) + 1 ); + nPos = pLines->GetPos( pLine ) + 1; + sTmp = OUString::number( nPos ); if( !sNm.isEmpty() ) sNm = sTmp + "." + sNm; else sNm = sTmp; - sTmp = OUString::number(( nPos = pBox->GetUpper()->GetBoxPos( pBox )) + 1 ); + nPos = pBox->GetUpper()->GetBoxPos( pBox ); + sTmp = OUString::number(nPos + 1); if( nullptr != ( pBox = pLine->GetUpper()) ) sNm = sTmp + "." + sNm; else diff --git a/sw/source/core/text/frmform.cxx b/sw/source/core/text/frmform.cxx index 1712aa8475b7..157a338bda34 100644 --- a/sw/source/core/text/frmform.cxx +++ b/sw/source/core/text/frmform.cxx @@ -1445,8 +1445,8 @@ void SwTextFrame::Format_( SwTextFormatter &rLine, SwTextFormatInfo &rInf, bool bWatchMidHyph = false; const SwAttrSet& rAttrSet = GetTextNodeForParaProps()->GetSwAttrSet(); - bool bMaxHyph = ( 0 != - ( rInf.MaxHyph() = rAttrSet.GetHyphenZone().GetMaxHyphens() ) ); + rInf.MaxHyph() = rAttrSet.GetHyphenZone().GetMaxHyphens(); + bool bMaxHyph = 0 != rInf.MaxHyph(); if ( bMaxHyph ) rLine.InitCntHyph(); diff --git a/sw/source/core/undo/undobj1.cxx b/sw/source/core/undo/undobj1.cxx index 27063a251aab..763b2ed5b221 100644 --- a/sw/source/core/undo/undobj1.cxx +++ b/sw/source/core/undo/undobj1.cxx @@ -636,7 +636,8 @@ void SwUndoSetFlyFormat::PutAttr( sal_uInt16 nWhich, const SfxPoolItem* pItem ) bAnchorChgd = true; const SwFormatAnchor* pAnchor = static_cast(pItem); - switch( nOldAnchorTyp = pAnchor->GetAnchorId() ) + nOldAnchorTyp = pAnchor->GetAnchorId(); + switch( nOldAnchorTyp ) { case RndStdIds::FLY_AS_CHAR: case RndStdIds::FLY_AT_CHAR: @@ -652,7 +653,8 @@ void SwUndoSetFlyFormat::PutAttr( sal_uInt16 nWhich, const SfxPoolItem* pItem ) } pAnchor = &pFrameFormat->GetAnchor(); - switch( nNewAnchorTyp = pAnchor->GetAnchorId() ) + nNewAnchorTyp = pAnchor->GetAnchorId(); + switch( nNewAnchorTyp ) { case RndStdIds::FLY_AS_CHAR: case RndStdIds::FLY_AT_CHAR: diff --git a/sw/source/core/unocore/unoobj.cxx b/sw/source/core/unocore/unoobj.cxx index 1f8613046c36..da9601045cca 100644 --- a/sw/source/core/unocore/unoobj.cxx +++ b/sw/source/core/unocore/unoobj.cxx @@ -1165,11 +1165,15 @@ SwXTextCursor::gotoRange( // now there are four SwPositions, // two of them are going to be used, but which ones? - *rOwnCursor.GetPoint() = (aOwnRight > rParamRight) - ? aOwnRight : *rOwnCursor.GetPoint() = rParamRight; + if (aOwnRight > rParamRight) + *rOwnCursor.GetPoint() = aOwnRight; + else + *rOwnCursor.GetPoint() = rParamRight; rOwnCursor.SetMark(); - *rOwnCursor.GetMark() = (aOwnLeft < rParamLeft) - ? aOwnLeft : *rOwnCursor.GetMark() = rParamLeft; + if (aOwnLeft < rParamLeft) + *rOwnCursor.GetMark() = aOwnLeft; + else + *rOwnCursor.GetMark() = rParamLeft; } else { diff --git a/sw/source/filter/basflt/fltini.cxx b/sw/source/filter/basflt/fltini.cxx index da64fa262012..ac001af12e29 100644 --- a/sw/source/filter/basflt/fltini.cxx +++ b/sw/source/filter/basflt/fltini.cxx @@ -118,9 +118,12 @@ namespace sw { Filters::Filters() { - SetFltPtr( READER_WRITER_BAS, (ReadAscii = new AsciiReader) ); - SetFltPtr( READER_WRITER_HTML, (ReadHTML = new HTMLReader) ); - SetFltPtr( READER_WRITER_XML, (ReadXML = new XMLReader) ); + ReadAscii = new AsciiReader; + ReadHTML = new HTMLReader; + ReadXML = new XMLReader; + SetFltPtr( READER_WRITER_BAS, ReadAscii ); + SetFltPtr( READER_WRITER_HTML, ReadHTML ); + SetFltPtr( READER_WRITER_XML, ReadXML ); SetFltPtr( READER_WRITER_TEXT_DLG, ReadAscii ); SetFltPtr( READER_WRITER_TEXT, ReadAscii ); } diff --git a/sw/source/filter/html/swhtml.cxx b/sw/source/filter/html/swhtml.cxx index 6e4f3b9993a6..ce6a79f8e0dd 100644 --- a/sw/source/filter/html/swhtml.cxx +++ b/sw/source/filter/html/swhtml.cxx @@ -2081,17 +2081,17 @@ void SwHTMLParser::NextToken( HtmlTokenId nToken ) if( bInsertUnknown ) { - OUString aComment("HTML: <"); + OUStringBuffer aComment("HTML: <"); if( (nToken >= HtmlTokenId::ONOFF_START) && isOffToken(nToken) ) - aComment += "/"; - aComment += sSaveToken; + aComment.append("/"); + aComment.append(sSaveToken); if( !aToken.isEmpty() ) { UnescapeToken(); - (aComment += " ") += aToken; + aComment.append(" ").append(aToken); } - aComment += ">"; - InsertComment( aComment ); + aComment.append(">"); + InsertComment( aComment.makeStringAndClear() ); } // if there are temporary paragraph attributes and the diff --git a/sw/source/filter/ww8/rtfexport.cxx b/sw/source/filter/ww8/rtfexport.cxx index c8ef6be2e265..89a80960da6f 100644 --- a/sw/source/filter/ww8/rtfexport.cxx +++ b/sw/source/filter/ww8/rtfexport.cxx @@ -1153,11 +1153,20 @@ void RtfExport::InsColorLine(const SvxBoxItem& rBox) const editeng::SvxBorderLine* pLine = nullptr; if (rBox.GetTop()) - InsColor((pLine = rBox.GetTop())->GetColor()); + { + pLine = rBox.GetTop(); + InsColor(pLine->GetColor()); + } if (rBox.GetBottom() && pLine != rBox.GetBottom()) - InsColor((pLine = rBox.GetBottom())->GetColor()); + { + pLine = rBox.GetBottom(); + InsColor(pLine->GetColor()); + } if (rBox.GetLeft() && pLine != rBox.GetLeft()) - InsColor((pLine = rBox.GetLeft())->GetColor()); + { + pLine = rBox.GetLeft(); + InsColor(pLine->GetColor()); + } if (rBox.GetRight() && pLine != rBox.GetRight()) InsColor(rBox.GetRight()->GetColor()); } diff --git a/sw/source/filter/ww8/wrtw8sty.cxx b/sw/source/filter/ww8/wrtw8sty.cxx index e674c23e6041..fa0aa300710c 100644 --- a/sw/source/filter/ww8/wrtw8sty.cxx +++ b/sw/source/filter/ww8/wrtw8sty.cxx @@ -179,8 +179,8 @@ sal_uInt16 MSWordStyles::GetSlot( const SwFormat* pFormat ) const sal_uInt16 MSWordStyles::BuildGetSlot( const SwFormat& rFormat ) { - sal_uInt16 nRet; - switch ( nRet = rFormat.GetPoolFormatId() ) + sal_uInt16 nRet = rFormat.GetPoolFormatId(); + switch ( nRet ) { case RES_POOLCOLL_STANDARD: nRet = 0; diff --git a/sw/source/filter/ww8/ww8par5.cxx b/sw/source/filter/ww8/ww8par5.cxx index 49c506b3d5d6..c77292333300 100644 --- a/sw/source/filter/ww8/ww8par5.cxx +++ b/sw/source/filter/ww8/ww8par5.cxx @@ -1047,7 +1047,8 @@ void SwWW8ImplReader::MakeTagString( OUString& rStr, const OUString& rOrg ) nI < rStr.getLength() && rStr.getLength() < (MAX_FIELDLEN - 4); ++nI ) { bool bSetAsHex = false; - switch( cChar = rStr[ nI ] ) + cChar = rStr[ nI ]; + switch( cChar ) { case 132: // Exchange typographical quotation marks for normal ones case 148: @@ -1467,7 +1468,7 @@ eF_ResT SwWW8ImplReader::Read_F_Seq( WW8FieldDesc*, OUString& rStr ) aField.SetSubType(aField.GetSubType() | nsSwExtendedSubType::SUB_INVISIBLE); if (!sStart.isEmpty()) - aField.SetFormula( ( aSequenceName += "=" ) += sStart ); + aField.SetFormula( aSequenceName + "=" + sStart ); else if (!bCountOn) aField.SetFormula(aSequenceName); @@ -3513,7 +3514,7 @@ eF_ResT SwWW8ImplReader::Read_F_Hyperlink( WW8FieldDesc* /*pF*/, OUString& rStr OSL_ENSURE(!sURL.isEmpty() || !sMark.isEmpty(), "WW8: Empty URL"); if( !sMark.isEmpty() ) - ( sURL += "#" ) += sMark; + sURL = sURL + "#" + sMark; SwFormatINetFormat aURL(sURL, sTarget); // If on loading TOC field, change the default style into the "index link" diff --git a/sw/source/ui/dbui/mmdocselectpage.cxx b/sw/source/ui/dbui/mmdocselectpage.cxx index af68496086d0..cf3fc454829b 100644 --- a/sw/source/ui/dbui/mmdocselectpage.cxx +++ b/sw/source/ui/dbui/mmdocselectpage.cxx @@ -167,10 +167,26 @@ bool SwMailMergeDocSelectPage::commitPage( ::svt::WizardTypes::CommitPageReason { OUString sReloadDocument; bReturn = m_xCurrentDocRB->get_active() || - m_xNewDocRB->get_active() || - (!(sReloadDocument = m_sLoadFileName).isEmpty() && m_xLoadDocRB->get_active() )|| - (!(sReloadDocument = m_sLoadTemplateName).isEmpty() && m_xLoadTemplateRB->get_active())|| - (m_xRecentDocRB->get_active() && !(sReloadDocument = m_xRecentDocLB->get_active_text()).isEmpty()); + m_xNewDocRB->get_active(); + if (!bReturn) + { + sReloadDocument = m_sLoadFileName; + bReturn = !sReloadDocument.isEmpty() && m_xLoadDocRB->get_active(); + } + if (!bReturn) + { + sReloadDocument = m_sLoadTemplateName; + bReturn = !sReloadDocument.isEmpty() && m_xLoadTemplateRB->get_active(); + } + if (!bReturn) + { + bReturn = m_xRecentDocRB->get_active(); + if (bReturn) + { + sReloadDocument = m_xRecentDocLB->get_active_text(); + bReturn = !sReloadDocument.isEmpty(); + } + } if( _eReason == ::svt::WizardTypes::eValidate ) m_pWizard->SetDocumentLoad(!m_xCurrentDocRB->get_active()); diff --git a/sw/source/ui/misc/srtdlg.cxx b/sw/source/ui/misc/srtdlg.cxx index f9736984fb5f..1f0f66fadb3c 100644 --- a/sw/source/ui/misc/srtdlg.cxx +++ b/sw/source/ui/misc/srtdlg.cxx @@ -408,7 +408,10 @@ void SwSortDlg::LanguageHdl(weld::ComboBox const* pLBox) for( sal_Int32 nCnt = 0; nCnt <= nEnd; ++nCnt ) { if( nCnt < nEnd ) - sUINm = m_xColRes->GetTranslation( sAlg = aSeq[ nCnt ] ); + { + sAlg = aSeq[ nCnt ]; + sUINm = m_xColRes->GetTranslation( sAlg ); + } else sUINm = sAlg = aNumericText; diff --git a/sw/source/uibase/app/docsh2.cxx b/sw/source/uibase/app/docsh2.cxx index 45c287eab510..68fe77ff8a9f 100644 --- a/sw/source/uibase/app/docsh2.cxx +++ b/sw/source/uibase/app/docsh2.cxx @@ -637,10 +637,14 @@ void SwDocShell::Execute(SfxRequest& rReq) if( !aFileName.isEmpty() ) { SwgReaderOption aOpt; - aOpt.SetTextFormats( bText = bool(nFlags & SfxTemplateFlags::LOAD_TEXT_STYLES )); - aOpt.SetFrameFormats( bFrame = bool(nFlags & SfxTemplateFlags::LOAD_FRAME_STYLES)); - aOpt.SetPageDescs( bPage = bool(nFlags & SfxTemplateFlags::LOAD_PAGE_STYLES )); - aOpt.SetNumRules( bNum = bool(nFlags & SfxTemplateFlags::LOAD_NUM_STYLES )); + bText = bool(nFlags & SfxTemplateFlags::LOAD_TEXT_STYLES ); + aOpt.SetTextFormats(bText); + bFrame = bool(nFlags & SfxTemplateFlags::LOAD_FRAME_STYLES); + aOpt.SetFrameFormats(bFrame); + bPage = bool(nFlags & SfxTemplateFlags::LOAD_PAGE_STYLES ); + aOpt.SetPageDescs(bPage); + bNum = bool(nFlags & SfxTemplateFlags::LOAD_NUM_STYLES ); + aOpt.SetNumRules(bNum); //different meaning between SFX_MERGE_STYLES and aOpt.SetMerge! bMerge = bool(nFlags & SfxTemplateFlags::MERGE_STYLES); aOpt.SetMerge( !bMerge ); diff --git a/sw/source/uibase/app/docstyle.cxx b/sw/source/uibase/app/docstyle.cxx index 7bd4c97ac1cf..9a094d2068ed 100644 --- a/sw/source/uibase/app/docstyle.cxx +++ b/sw/source/uibase/app/docstyle.cxx @@ -2923,8 +2923,10 @@ SfxStyleSheetBase* SwStyleSheetIterator::First() while( *pPoolIds ) { if( !bIsSearchUsed || rDoc.getIDocumentStylePoolAccess().IsPoolTextCollUsed( *pPoolIds ) ) - aLst.Append( cPARA, - s = SwStyleNameMapper::GetUIName( *pPoolIds, s )); + { + s = SwStyleNameMapper::GetUIName( *pPoolIds, s ); + aLst.Append( cPARA, s); + } ++pPoolIds; } } diff --git a/sw/source/uibase/config/viewopt.cxx b/sw/source/uibase/config/viewopt.cxx index 9db2f39a0134..970816c3e3ce 100644 --- a/sw/source/uibase/config/viewopt.cxx +++ b/sw/source/uibase/config/viewopt.cxx @@ -326,7 +326,10 @@ bool SwViewOption::IsAutoCompleteWords() void SwViewOption::SetOnlineSpell(bool b) { - b ? (m_nCoreOptions |= ViewOptFlags1::OnlineSpell ) : ( m_nCoreOptions &= ~ViewOptFlags1::OnlineSpell); + if (b) + m_nCoreOptions |= ViewOptFlags1::OnlineSpell; + else + m_nCoreOptions &= ~ViewOptFlags1::OnlineSpell; } AuthorCharAttr::AuthorCharAttr() : diff --git a/sw/source/uibase/dochdl/swdtflvr.cxx b/sw/source/uibase/dochdl/swdtflvr.cxx index 4d03ac063bf4..33497fafbef4 100644 --- a/sw/source/uibase/dochdl/swdtflvr.cxx +++ b/sw/source/uibase/dochdl/swdtflvr.cxx @@ -1278,7 +1278,15 @@ bool SwTransferable::PasteData( TransferableDataHelper& rData, SwTransferable *pTrans=nullptr, *pTunneledTrans=GetSwTransferable( rData ); // check for private drop - bool bPrivateDrop(pPt && (bPasteSelection ? nullptr != (pTrans = pMod->m_pXSelection) : nullptr != (pTrans = pMod->m_pDragDrop))); + bool bPrivateDrop(pPt); + if (bPrivateDrop) + { + if (bPasteSelection) + pTrans = pMod->m_pXSelection; + else + pTrans = pMod->m_pDragDrop; + bPrivateDrop = nullptr != pTrans; + } bool bNeedToSelectBeforePaste(false); if(bPrivateDrop && DND_ACTION_LINK == nDropAction) diff --git a/sw/source/uibase/wrtsh/move.cxx b/sw/source/uibase/wrtsh/move.cxx index d28554afd64e..d9cf0a00b73f 100644 --- a/sw/source/uibase/wrtsh/move.cxx +++ b/sw/source/uibase/wrtsh/move.cxx @@ -46,7 +46,8 @@ public: ShellMoveCursor( SwWrtShell* pWrtSh, bool bSel ) { bAct = !pWrtSh->ActionPend() && (pWrtSh->GetFrameType(nullptr,false) & FrameTypeFlags::FLY_ANY); - ( pSh = pWrtSh )->MoveCursor( bSel ); + pSh = pWrtSh; + pSh->MoveCursor( bSel ); pWrtSh->GetView().GetViewFrame()->GetBindings().Invalidate(SID_HYPERLINK_GETLINK); } ~ShellMoveCursor() COVERITY_NOEXCEPT_FALSE -- cgit v1.2.3