diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-11-16 10:41:03 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-11-21 12:44:55 +0100 |
commit | 2dbd02b576f28224204ac962f6ce20fde6687093 (patch) | |
tree | 28b3f8807d5909e7bcc3c5a629dadd6f475ad9d3 /sw/source | |
parent | 48314f25241e014a634dd5371543b90137ffd2bc (diff) |
loplugin:redundantfcast improvements
check for calls to constructors, and extend the list of types we check
for unnecessary temporary creation
Change-Id: Ia2c1f202b41ed6866779fff5343c821128033eec
Reviewed-on: https://gerrit.libreoffice.org/63472
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sw/source')
-rw-r--r-- | sw/source/core/access/accfrmobj.cxx | 2 | ||||
-rw-r--r-- | sw/source/core/bastyp/calc.cxx | 2 | ||||
-rw-r--r-- | sw/source/core/crsr/swcrsr.cxx | 4 | ||||
-rw-r--r-- | sw/source/core/doc/docbm.cxx | 4 | ||||
-rw-r--r-- | sw/source/core/doc/doctxm.cxx | 5 | ||||
-rw-r--r-- | sw/source/core/layout/paintfrm.cxx | 6 | ||||
-rw-r--r-- | sw/source/ui/chrdlg/tblnumfm.cxx | 2 | ||||
-rw-r--r-- | sw/source/ui/config/optload.cxx | 2 | ||||
-rw-r--r-- | sw/source/uibase/shells/grfsh.cxx | 2 | ||||
-rw-r--r-- | sw/source/uibase/uiview/srcview.cxx | 2 | ||||
-rw-r--r-- | sw/source/uibase/utlui/uitool.cxx | 4 |
11 files changed, 17 insertions, 18 deletions
diff --git a/sw/source/core/access/accfrmobj.cxx b/sw/source/core/access/accfrmobj.cxx index c617a62a4e22..3057d226957f 100644 --- a/sw/source/core/access/accfrmobj.cxx +++ b/sw/source/core/access/accfrmobj.cxx @@ -234,7 +234,7 @@ SwRect SwAccessibleChild::GetBox( const SwAccessibleMap& rAccMap ) const } else if ( mpFrame->IsTabFrame() ) { - aBox = SwRect( mpFrame->getFrameArea() ); + aBox = mpFrame->getFrameArea(); aBox.Intersection( mpFrame->GetUpper()->getFrameArea() ); } else diff --git a/sw/source/core/bastyp/calc.cxx b/sw/source/core/bastyp/calc.cxx index 4d80b9a2302e..f9665474a1a7 100644 --- a/sw/source/core/bastyp/calc.cxx +++ b/sw/source/core/bastyp/calc.cxx @@ -585,7 +585,7 @@ void SwCalc::VarChange( const OUString& rStr, const SwSbxValue& rValue ) if( !pFnd ) { - pFnd = new SwCalcExp( aStr, SwSbxValue( rValue ), nullptr ); + pFnd = new SwCalcExp( aStr, rValue, nullptr ); pFnd->pNext = std::move( m_aVarTable[ nPos ] ); m_aVarTable[ nPos ].reset( pFnd ); } diff --git a/sw/source/core/crsr/swcrsr.cxx b/sw/source/core/crsr/swcrsr.cxx index 798ca463b69e..ad453fc2b8de 100644 --- a/sw/source/core/crsr/swcrsr.cxx +++ b/sw/source/core/crsr/swcrsr.cxx @@ -1442,11 +1442,11 @@ bool SwCursor::SelectWordWT( SwViewShell const * pViewShell, sal_Int16 nWordType --w.m_nPtIndex; w.AssignBack(pTextNd, nPtPos); - aBndry = Boundary( g_pBreakIt->GetBreakIter()->getWordBoundary( + aBndry = g_pBreakIt->GetBreakIter()->getWordBoundary( *w.m_pText, w.m_nPtIndex, g_pBreakIt->GetLocale( pTextNd->GetLang( nPtPos ) ), nWordType, - bForward )); + bForward ); } diff --git a/sw/source/core/doc/docbm.cxx b/sw/source/core/doc/docbm.cxx index aaa9731bba31..7710f4a2b8a7 100644 --- a/sw/source/core/doc/docbm.cxx +++ b/sw/source/core/doc/docbm.cxx @@ -141,13 +141,13 @@ namespace bool bPosAtEndOfNode = false; if ( pNode == nullptr) { - SwNodeIndex aEnd = SwNodeIndex(rEnd); + SwNodeIndex aEnd = rEnd; pNode = rEnd.GetNodes().GoNext( &aEnd ); bPosAtEndOfNode = false; } if ( pNode == nullptr ) { - SwNodeIndex aStt = SwNodeIndex(rStt); + SwNodeIndex aStt = rStt; pNode = SwNodes::GoPrevious(&aStt); bPosAtEndOfNode = true; } diff --git a/sw/source/core/doc/doctxm.cxx b/sw/source/core/doc/doctxm.cxx index 3d04e1eaff69..d39c33c2f5a5 100644 --- a/sw/source/core/doc/doctxm.cxx +++ b/sw/source/core/doc/doctxm.cxx @@ -1664,8 +1664,7 @@ void SwTOXBaseSection::UpdatePageNum_( SwTextNode* pNd, sal_uInt16 nOld = rNums[0], nBeg = nOld, nCount = 0; - OUString aNumStr( SvxNumberType( rDescs[0]->GetNumType() ). - GetNumStr( nBeg ) ); + OUString aNumStr( rDescs[0]->GetNumType().GetNumStr( nBeg ) ); if( xCharStyleIdx && lcl_HasMainEntry( pMainEntryNums, nBeg )) { xCharStyleIdx->push_back( 0 ); @@ -1759,7 +1758,7 @@ void SwTOXBaseSection::UpdatePageNum_( SwTextNode* pNd, aNumStr += S_PAGE_DELI; //#58127# If nCount == 0, then the only PageNumber is already in aNumStr! if(nCount) - aNumStr += SvxNumberType( rDescs[i-1]->GetNumType() ).GetNumStr( nBeg+nCount ); + aNumStr += rDescs[i-1]->GetNumType().GetNumStr( nBeg+nCount ); } } pNd->InsertText( aNumStr, aPos, SwInsertFlags::EMPTYEXPAND | SwInsertFlags::FORCEHINTEXPAND ); diff --git a/sw/source/core/layout/paintfrm.cxx b/sw/source/core/layout/paintfrm.cxx index de8d04311d64..dfa37544339e 100644 --- a/sw/source/core/layout/paintfrm.cxx +++ b/sw/source/core/layout/paintfrm.cxx @@ -734,7 +734,7 @@ void SwSubsRects::RemoveSuperfluousSubsidiaryLines( const SwLineRects &rRects, S { // get a copy instead of a reference, because an <insert> may destroy // the object due to a necessary array resize. - const SwLineRect aSubsLineRect = SwLineRect(aLineRects[i]); + const SwLineRect aSubsLineRect(aLineRects[i]); // add condition <aSubsLineRect.IsLocked()> in order to consider only // border lines, which are *not* locked. @@ -3576,9 +3576,9 @@ void SwColumnFrame::PaintBreak( ) const aRect.Left() + nTextOff, aRect.Top() ) ); if ( IsVertical() ) { - aTextMatrix = basegfx::B2DHomMatrix( basegfx::utils::createScaleShearXRotateTranslateB2DHomMatrix ( + aTextMatrix = basegfx::utils::createScaleShearXRotateTranslateB2DHomMatrix ( aFontSize.getX(), aFontSize.getY(), 0.0, M_PI_2, - aRect.Right(), aRect.Top() + nTextOff ) ); + aRect.Right(), aRect.Top() + nTextOff ); } drawinglayer::primitive2d::TextSimplePortionPrimitive2D * pText = diff --git a/sw/source/ui/chrdlg/tblnumfm.cxx b/sw/source/ui/chrdlg/tblnumfm.cxx index 46fe5c8455e4..d790a7e7d03d 100644 --- a/sw/source/ui/chrdlg/tblnumfm.cxx +++ b/sw/source/ui/chrdlg/tblnumfm.cxx @@ -38,7 +38,7 @@ SwNumFormatDlg::SwNumFormatDlg(weld::Window* pParent, const SfxItemSet& rSet) TabPageParent pPageParent(get_content_area(), this); VclPtr<SfxTabPage> xNewPage = (*fnCreatePage)(pPageParent, &rSet); SfxAllItemSet aSet(*(rSet.GetPool())); - aSet.Put(SvxNumberInfoItem(xNewPage->GetItemSet().Get( SID_ATTR_NUMBERFORMAT_INFO))); + aSet.Put(xNewPage->GetItemSet().Get( SID_ATTR_NUMBERFORMAT_INFO)); xNewPage->PageCreated(aSet); SetTabPage(xNewPage); } diff --git a/sw/source/ui/config/optload.cxx b/sw/source/ui/config/optload.cxx index 43ab57535bec..1b630df9b71f 100644 --- a/sw/source/ui/config/optload.cxx +++ b/sw/source/ui/config/optload.cxx @@ -418,7 +418,7 @@ void SwCaptionPreview::ApplySettings(vcl::RenderContext& rRenderContext) if (!mbFontInitialized) { - maFont = vcl::Font(rRenderContext.GetFont()); + maFont = rRenderContext.GetFont(); maFont.SetFontHeight(maFont.GetFontHeight() * 120 / 100); mbFontInitialized = true; } diff --git a/sw/source/uibase/shells/grfsh.cxx b/sw/source/uibase/shells/grfsh.cxx index f8fd3b7739a0..211b36959e83 100644 --- a/sw/source/uibase/shells/grfsh.cxx +++ b/sw/source/uibase/shells/grfsh.cxx @@ -213,7 +213,7 @@ void SwGrfShell::Execute(SfxRequest &rReq) convertTwipToMm100(aCrop.GetRight()), convertTwipToMm100(aCrop.GetBottom()) ); - Graphic aGraphic = Graphic( *pGraphic ); + Graphic aGraphic = *pGraphic; CompressGraphicsDialog aDialog(GetView().GetFrameWeld(), aGraphic, aSize, aCropRectangle, GetView().GetViewFrame()->GetBindings()); if (aDialog.run() == RET_OK) diff --git a/sw/source/uibase/uiview/srcview.cxx b/sw/source/uibase/uiview/srcview.cxx index 80d11e67ec02..a66e6f165bdf 100644 --- a/sw/source/uibase/uiview/srcview.cxx +++ b/sw/source/uibase/uiview/srcview.cxx @@ -829,7 +829,7 @@ void SwSrcView::Load(SwDocShell* pDocShell) ErrCode nRes = aWriter.Write(xWriter, &sWriteName); if(nRes) { - ErrorHandler::HandleError(ErrCode(nRes)); + ErrorHandler::HandleError(nRes); aEditWin->SetReadonly(true); } aMedium.Commit(); diff --git a/sw/source/uibase/utlui/uitool.cxx b/sw/source/uibase/utlui/uitool.cxx index aa679eb392e9..c3d2c69780f7 100644 --- a/sw/source/uibase/utlui/uitool.cxx +++ b/sw/source/uibase/utlui/uitool.cxx @@ -453,7 +453,7 @@ void PageDescToItemSet( const SwPageDesc& rPageDesc, SfxItemSet& rSet) aHeaderSet.Put(aFirstShared); // Size - SvxSizeItem aSize(SID_ATTR_PAGE_SIZE, Size(rFrameSize.GetSize())); + SvxSizeItem aSize(SID_ATTR_PAGE_SIZE, rFrameSize.GetSize()); aHeaderSet.Put(aSize); // Shifting frame attributes @@ -503,7 +503,7 @@ void PageDescToItemSet( const SwPageDesc& rPageDesc, SfxItemSet& rSet) aFooterSet.Put(aFirstShared); // Size - SvxSizeItem aSize(SID_ATTR_PAGE_SIZE, Size(rFrameSize.GetSize())); + SvxSizeItem aSize(SID_ATTR_PAGE_SIZE, rFrameSize.GetSize()); aFooterSet.Put(aSize); // Shifting Frame attributes |