diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2020-03-26 08:34:37 +0100 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2020-03-26 09:13:55 +0100 |
commit | 1ebeacb20ad0165e399629fcfd7795ad0da3edf8 (patch) | |
tree | 480a481dd1ae32a1b75ee881f8ed19ed2dbb1201 /sw | |
parent | 9936f3ed49e2aaf06e30b733b26d9d7f427746ed (diff) |
Extend loplugin:cstylecast to certain function-style casts
...that are equivalent to const_cast or reinterpret_cast, and should arguably
better be written that way for clarity. Drawing inspiration from
<https://reviews.llvm.org/D76572> "Replace `T(x)` with `reinterpret_cast<T>(x)`
everywhere it means reinterpret_cast. No functional change".
Change-Id: I27b8f70d324d32ecba658db4d1c2db03e10d5d3e
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/91086
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
Diffstat (limited to 'sw')
-rw-r--r-- | sw/qa/extras/globalfilter/globalfilter.cxx | 2 | ||||
-rw-r--r-- | sw/source/core/doc/doctxm.cxx | 12 | ||||
-rw-r--r-- | sw/source/core/doc/notxtfrm.cxx | 4 | ||||
-rw-r--r-- | sw/source/core/layout/paintfrm.cxx | 2 | ||||
-rw-r--r-- | sw/source/core/text/porfld.cxx | 2 |
5 files changed, 11 insertions, 11 deletions
diff --git a/sw/qa/extras/globalfilter/globalfilter.cxx b/sw/qa/extras/globalfilter/globalfilter.cxx index 4ec7563ff324..e69a7ef4634d 100644 --- a/sw/qa/extras/globalfilter/globalfilter.cxx +++ b/sw/qa/extras/globalfilter/globalfilter.cxx @@ -899,7 +899,7 @@ static auto verifyNestedFieldmark(OUString const& rTestName, + u"baz" + OUStringChar(CH_TXT_ATR_FIELDEND)), outerString); // must return innermost mark - CPPUNIT_ASSERT_EQUAL(sal_uIntPtr(pInner), sal_uIntPtr(rIDMA.getFieldmarkFor(innerPos))); + CPPUNIT_ASSERT_EQUAL(reinterpret_cast<sal_uIntPtr>(pInner), reinterpret_cast<sal_uIntPtr>(rIDMA.getFieldmarkFor(innerPos))); } void Test::testNestedFieldmark() diff --git a/sw/source/core/doc/doctxm.cxx b/sw/source/core/doc/doctxm.cxx index eb8b7dcd95d7..524ceeb810c8 100644 --- a/sw/source/core/doc/doctxm.cxx +++ b/sw/source/core/doc/doctxm.cxx @@ -282,10 +282,10 @@ const SwTOXMark& SwDoc::GotoTOXMark( const SwTOXMark& rCurTOXMark, case TOX_PRV: if ( (aAbsNew < aAbsIdx && aAbsNew > aPrevPos) || (aAbsIdx == aAbsNew && - (sal_uLong(&rCurTOXMark) > sal_uLong(pTOXMark) && - (!pNew || aPrevPos < aAbsIdx || sal_uLong(pNew) < sal_uLong(pTOXMark) ) )) || + (reinterpret_cast<sal_uLong>(&rCurTOXMark) > reinterpret_cast<sal_uLong>(pTOXMark) && + (!pNew || aPrevPos < aAbsIdx || reinterpret_cast<sal_uLong>(pNew) < reinterpret_cast<sal_uLong>(pTOXMark) ) )) || (aPrevPos == aAbsNew && aAbsIdx != aAbsNew && - sal_uLong(pTOXMark) > sal_uLong(pNew)) ) + reinterpret_cast<sal_uLong>(pTOXMark) > reinterpret_cast<sal_uLong>(pNew)) ) { pNew = pTOXMark; aPrevPos = aAbsNew; @@ -304,10 +304,10 @@ const SwTOXMark& SwDoc::GotoTOXMark( const SwTOXMark& rCurTOXMark, case TOX_NXT: if ( (aAbsNew > aAbsIdx && aAbsNew < aNextPos) || (aAbsIdx == aAbsNew && - (sal_uLong(&rCurTOXMark) < sal_uLong(pTOXMark) && - (!pNew || aNextPos > aAbsIdx || sal_uLong(pNew) > sal_uLong(pTOXMark)) )) || + (reinterpret_cast<sal_uLong>(&rCurTOXMark) < reinterpret_cast<sal_uLong>(pTOXMark) && + (!pNew || aNextPos > aAbsIdx || reinterpret_cast<sal_uLong>(pNew) > reinterpret_cast<sal_uLong>(pTOXMark)) )) || (aNextPos == aAbsNew && aAbsIdx != aAbsNew && - sal_uLong(pTOXMark) < sal_uLong(pNew)) ) + reinterpret_cast<sal_uLong>(pTOXMark) < reinterpret_cast<sal_uLong>(pNew)) ) { pNew = pTOXMark; aNextPos = aAbsNew; diff --git a/sw/source/core/doc/notxtfrm.cxx b/sw/source/core/doc/notxtfrm.cxx index 19b11315c1b8..8c77fd28c93f 100644 --- a/sw/source/core/doc/notxtfrm.cxx +++ b/sw/source/core/doc/notxtfrm.cxx @@ -1285,7 +1285,7 @@ void SwNoTextFrame::PaintPicture( vcl::RenderContext* pOut, const SwRect &rGrfAr "pOut should not be a virtual device" ); pGrfNd->StartGraphicAnimation(pOut, aAlignedGrfArea.Pos(), - aAlignedGrfArea.SSize(), sal_IntPtr(this), + aAlignedGrfArea.SSize(), reinterpret_cast<sal_IntPtr>(this), pVout ); } else @@ -1536,7 +1536,7 @@ void SwNoTextFrame::StopAnimation( OutputDevice* pOut ) const if( pGrfNd && pGrfNd->IsAnimated() ) { - const_cast< SwGrfNode* >(pGrfNd)->StopGraphicAnimation( pOut, sal_IntPtr(this) ); + const_cast< SwGrfNode* >(pGrfNd)->StopGraphicAnimation( pOut, reinterpret_cast<sal_IntPtr>(this) ); } } diff --git a/sw/source/core/layout/paintfrm.cxx b/sw/source/core/layout/paintfrm.cxx index f0e20a164c27..93c28c6503f3 100644 --- a/sw/source/core/layout/paintfrm.cxx +++ b/sw/source/core/layout/paintfrm.cxx @@ -3841,7 +3841,7 @@ bool SwFlyFrame::IsPaint( SdrObject *pObj, const SwViewShell *pSh ) { if ( !pAnch->isFrameAreaPositionValid() ) pAnch = nullptr; - else if ( sal_IntPtr(pSh->GetOut()) == sal_IntPtr(pSh->getIDocumentDeviceAccess().getPrinter( false ))) + else if ( reinterpret_cast<sal_IntPtr>(pSh->GetOut()) == reinterpret_cast<sal_IntPtr>(pSh->getIDocumentDeviceAccess().getPrinter( false ))) { //HACK: we have to omit some of the objects for printing, //otherwise they would be printed twice. diff --git a/sw/source/core/text/porfld.cxx b/sw/source/core/text/porfld.cxx index 41700584368c..5c60bed70425 100644 --- a/sw/source/core/text/porfld.cxx +++ b/sw/source/core/text/porfld.cxx @@ -932,7 +932,7 @@ void SwGrfNumPortion::Paint( const SwTextPaintInfo &rInf ) const bDraw = !rInf.GetOpt().IsGraphic(); if( !nId ) { - SetId( sal_IntPtr( rInf.GetTextFrame() ) ); + SetId( reinterpret_cast<sal_IntPtr>( rInf.GetTextFrame() ) ); rInf.GetTextFrame()->SetAnimation(); } if( aTmp.IsOver( rInf.GetPaintRect() ) && !bDraw ) |