[Libreoffice-commits] core.git: 14 commits - binaryurp/source compilerplugins/clang connectivity/source dbaccess/source extensions/source forms/source sal/rtl sc/source sd/source sfx2/source svtools/source svx/source sw/inc sw/source vcl/generic vcl/source vcl/unx
Stephan Bergmann
sbergman at redhat.com
Fri May 29 03:05:45 PDT 2015
binaryurp/source/unmarshal.cxx | 5 +---
compilerplugins/clang/redundantcast.cxx | 19 +++++++++++++++++
connectivity/source/sdbcx/VGroup.cxx | 2 -
connectivity/source/sdbcx/VIndex.cxx | 2 -
connectivity/source/sdbcx/VKey.cxx | 2 -
connectivity/source/sdbcx/VUser.cxx | 2 -
dbaccess/source/core/dataaccess/ModelImpl.cxx | 2 -
dbaccess/source/core/dataaccess/databasedocument.cxx | 2 -
extensions/source/dbpilots/unoautopilot.hxx | 2 -
extensions/source/propctrlr/commoncontrol.cxx | 2 -
extensions/source/propctrlr/eformspropertyhandler.cxx | 2 -
extensions/source/propctrlr/eventhandler.cxx | 4 +--
extensions/source/propctrlr/genericpropertyhandler.cxx | 8 +++----
forms/source/component/DatabaseForm.cxx | 2 -
forms/source/component/FormComponent.cxx | 4 +--
forms/source/runtime/formoperations.cxx | 2 -
forms/source/xforms/datatypes_impl.hxx | 4 +--
sal/rtl/strtmpl.cxx | 4 +--
sc/source/core/data/conditio.cxx | 2 -
sc/source/core/data/drwlayer.cxx | 2 -
sc/source/filter/excel/excimp8.cxx | 2 -
sd/source/core/stlsheet.cxx | 2 -
sd/source/ui/unoidl/SdUnoDrawView.cxx | 4 +--
sfx2/source/appl/appopen.cxx | 2 -
svtools/source/graphic/provider.cxx | 2 -
svx/source/gallery2/galbrws2.cxx | 2 -
svx/source/svdraw/svdmrkv1.cxx | 2 -
svx/source/svdraw/svdoole2.cxx | 2 -
sw/inc/calbck.hxx | 8 +++----
sw/source/core/access/accmap.cxx | 2 -
sw/source/core/access/accnotextframe.cxx | 2 -
sw/source/core/attr/calbck.cxx | 2 -
sw/source/core/doc/docdesc.cxx | 4 +--
sw/source/core/doc/docftn.cxx | 4 +--
sw/source/core/inc/pagedeschint.hxx | 2 -
sw/source/core/layout/atrfrm.cxx | 2 -
sw/source/core/layout/paintfrm.cxx | 2 -
sw/source/core/layout/tabfrm.cxx | 4 +--
sw/source/core/swg/swblocks.cxx | 2 -
sw/source/core/text/itrform2.cxx | 2 -
sw/source/core/text/portxt.cxx | 2 -
sw/source/core/text/txtftn.cxx | 4 +--
sw/source/core/text/widorp.cxx | 10 ++++----
sw/source/core/undo/rolbck.cxx | 6 ++---
sw/source/core/undo/unattr.cxx | 2 -
sw/source/core/unocore/unodraw.cxx | 2 -
sw/source/core/unocore/unofield.cxx | 8 +++----
sw/source/core/unocore/unoftn.cxx | 2 -
sw/source/core/unocore/unoidx.cxx | 6 ++---
sw/source/core/unocore/unoobj2.cxx | 14 ++++++------
sw/source/core/unocore/unorefmk.cxx | 2 -
sw/source/core/unocore/unotbl.cxx | 2 -
sw/source/filter/ww8/writerwordglue.cxx | 2 -
sw/source/filter/ww8/ww8par.cxx | 2 -
sw/source/uibase/uiview/view.cxx | 2 -
vcl/generic/glyphs/glyphcache.cxx | 8 +------
vcl/source/app/svapp.cxx | 2 -
vcl/source/gdi/impgraph.cxx | 2 -
vcl/unx/gtk/fpicker/SalGtkPicker.cxx | 2 -
59 files changed, 111 insertions(+), 97 deletions(-)
New commits:
commit 0571f3c5033e1db38484632aca64376dd0b09cf5
Author: Stephan Bergmann <sbergman at redhat.com>
Date: Fri May 29 12:05:09 2015 +0200
loplugin:redundantcast: const_cast to same type
Change-Id: I1abdc2ab0b145e12f7fb00db529f52c11e4d7cfd
diff --git a/compilerplugins/clang/redundantcast.cxx b/compilerplugins/clang/redundantcast.cxx
index 474dafa..976e80e 100644
--- a/compilerplugins/clang/redundantcast.cxx
+++ b/compilerplugins/clang/redundantcast.cxx
@@ -52,6 +52,8 @@ public:
bool VisitCXXReinterpretCastExpr(CXXReinterpretCastExpr const * expr);
+ bool VisitCXXConstCastExpr(CXXConstCastExpr const * expr);
+
bool VisitCallExpr(CallExpr const * expr);
bool VisitCXXDeleteExpr(CXXDeleteExpr const * expr);
@@ -263,6 +265,23 @@ bool RedundantCast::VisitCXXReinterpretCastExpr(
return true;
}
+bool RedundantCast::VisitCXXConstCastExpr(CXXConstCastExpr const * expr) {
+ if (ignoreLocation(expr)) {
+ return true;
+ }
+ if (expr->getTypeAsWritten().getCanonicalType().getTypePtr()
+ == (expr->getSubExprAsWritten()->getType().getCanonicalType()
+ .getTypePtr()))
+ {
+ report(
+ DiagnosticsEngine::Warning, "redundant const_cast from %0 to %1",
+ expr->getExprLoc())
+ << expr->getSubExprAsWritten()->getType()
+ << expr->getTypeAsWritten() << expr->getSourceRange();
+ }
+ return true;
+}
+
bool RedundantCast::VisitCallExpr(CallExpr const * expr) {
if (ignoreLocation(expr)) {
return true;
commit 696f96f34b9e4cc384ecb3481b018301f493fc23
Author: Stephan Bergmann <sbergman at redhat.com>
Date: Fri May 29 12:05:03 2015 +0200
loplugin:redundantcast: const_cast to same type
Change-Id: I610fd4cf9339fd5c18eb77e7c94ffd0f99e9b125
diff --git a/vcl/generic/glyphs/glyphcache.cxx b/vcl/generic/glyphs/glyphcache.cxx
index 50042c2..c15e548 100644
--- a/vcl/generic/glyphs/glyphcache.cxx
+++ b/vcl/generic/glyphs/glyphcache.cxx
@@ -218,13 +218,9 @@ ServerFont* GlyphCache::CacheFont( const FontSelectPattern& rFontSelData )
void GlyphCache::UncacheFont( ServerFont& rServerFont )
{
- // the interface for rServerFont must be const because a
- // user who wants to release it only got const ServerFonts.
- // The caching algorithm needs a non-const object
- ServerFont* pFont = const_cast<ServerFont*>( &rServerFont );
- if( (pFont->Release() <= 0) && (mnMaxSize <= mnBytesUsed) )
+ if( (rServerFont.Release() <= 0) && (mnMaxSize <= mnBytesUsed) )
{
- mpCurrentGCFont = pFont;
+ mpCurrentGCFont = &rServerFont;
GarbageCollect();
}
}
diff --git a/vcl/source/app/svapp.cxx b/vcl/source/app/svapp.cxx
index 4edae11..34bc5505 100644
--- a/vcl/source/app/svapp.cxx
+++ b/vcl/source/app/svapp.cxx
@@ -1668,7 +1668,7 @@ ImplDelData::~ImplDelData()
if( !mbDel && mpWindow )
{
// the window still exists but we were not removed
- const_cast<vcl::Window*>(mpWindow.get())->ImplRemoveDel( this );
+ mpWindow.get()->ImplRemoveDel( this );
mpWindow = NULL;
}
}
diff --git a/vcl/source/gdi/impgraph.cxx b/vcl/source/gdi/impgraph.cxx
index c19acc0..e7626e3 100644
--- a/vcl/source/gdi/impgraph.cxx
+++ b/vcl/source/gdi/impgraph.cxx
@@ -697,7 +697,7 @@ void ImpGraphic::ImplSetPrefSize( const Size& rPrefSize )
if(maSvgData.get() && maEx.IsEmpty())
{
// use maEx as local buffer for rendered svg
- const_cast< ImpGraphic* >(this)->maEx = maSvgData->getReplacement();
+ maEx = maSvgData->getReplacement();
}
// #108077# Push through pref size to animation object,
diff --git a/vcl/unx/gtk/fpicker/SalGtkPicker.cxx b/vcl/unx/gtk/fpicker/SalGtkPicker.cxx
index 4aaa69f..c7a30e9 100644
--- a/vcl/unx/gtk/fpicker/SalGtkPicker.cxx
+++ b/vcl/unx/gtk/fpicker/SalGtkPicker.cxx
@@ -47,7 +47,7 @@ OUString SalGtkPicker::uritounicode(const gchar* pIn)
if (!pIn)
return OUString();
- OUString sURL( const_cast<const sal_Char *>(pIn), strlen(pIn),
+ OUString sURL( pIn, strlen(pIn),
RTL_TEXTENCODING_UTF8 );
INetURLObject aURL(sURL);
commit 148953244fc8d741ef84ef777ad566ae80edd28a
Author: Stephan Bergmann <sbergman at redhat.com>
Date: Fri May 29 12:05:00 2015 +0200
loplugin:redundantcast: const_cast to same type
Change-Id: I7cb919140539d0d573b5fbf786a6041843c2388a
diff --git a/sw/inc/calbck.hxx b/sw/inc/calbck.hxx
index a27b7e9..ce8bd7a 100644
--- a/sw/inc/calbck.hxx
+++ b/sw/inc/calbck.hxx
@@ -258,13 +258,13 @@ namespace sw
{
MoveTo(our_pClientIters);
our_pClientIters = this;
- m_pCurrent = m_pPosition = const_cast<WriterListener*>(m_rRoot.m_pWriterListeners);
+ m_pCurrent = m_pPosition = m_rRoot.m_pWriterListeners;
}
WriterListener* GetLeftOfPos() { return m_pPosition->m_pLeft; }
WriterListener* GetRightOfPos() { return m_pPosition->m_pRight; }
WriterListener* GoStart()
{
- if((m_pPosition = const_cast<WriterListener*>(m_rRoot.m_pWriterListeners)))
+ if((m_pPosition = m_rRoot.m_pWriterListeners))
while( m_pPosition->m_pLeft )
m_pPosition = m_pPosition->m_pLeft;
return m_pCurrent = m_pPosition;
@@ -302,7 +302,7 @@ public:
TElementType* Last()
{
if(!m_pPosition)
- m_pPosition = const_cast<sw::WriterListener*>(m_rRoot.m_pWriterListeners);
+ m_pPosition = m_rRoot.m_pWriterListeners;
if(!m_pPosition)
return static_cast<TElementType*>(Sync());
while(GetRightOfPos())
@@ -339,7 +339,7 @@ public:
SwClient* Last()
{
if(!m_pPosition)
- m_pPosition = const_cast<sw::WriterListener*>(m_rRoot.m_pWriterListeners);
+ m_pPosition = m_rRoot.m_pWriterListeners;
if(!m_pPosition)
return m_pCurrent = nullptr;
while(GetRightOfPos())
diff --git a/sw/source/core/access/accmap.cxx b/sw/source/core/access/accmap.cxx
index 0428b3f..c92cb80 100644
--- a/sw/source/core/access/accmap.cxx
+++ b/sw/source/core/access/accmap.cxx
@@ -1343,7 +1343,7 @@ void SwAccessibleMap::InvalidateShapeInParaSelection()
else if( nStartIndex.GetNode().IsTableNode() )
{
SwTableNode * pTable = static_cast<SwTableNode *>(&(nStartIndex.GetNode()));
- SwTableFormat* pFormat = const_cast<SwTableFormat*>(pTable->GetTable().GetFrameFormat());
+ SwTableFormat* pFormat = pTable->GetTable().GetFrameFormat();
pFrm = SwIterator<SwFrm, SwTableFormat>(*pFormat).First();
}
diff --git a/sw/source/core/access/accnotextframe.cxx b/sw/source/core/access/accnotextframe.cxx
index cee5edb..7647b35 100644
--- a/sw/source/core/access/accnotextframe.cxx
+++ b/sw/source/core/access/accnotextframe.cxx
@@ -166,7 +166,7 @@ void SwAccessibleNoTextFrame::Dispose( bool bRecursive )
SolarMutexGuard aGuard;
if( aDepend.GetRegisteredIn() )
- const_cast < SwModify *>( aDepend.GetRegisteredIn() )->Remove( &aDepend );
+ aDepend.GetRegisteredIn()->Remove( &aDepend );
SwAccessibleFrameBase::Dispose( bRecursive );
}
diff --git a/sw/source/core/attr/calbck.cxx b/sw/source/core/attr/calbck.cxx
index 3d64f3a..e09c04e 100644
--- a/sw/source/core/attr/calbck.cxx
+++ b/sw/source/core/attr/calbck.cxx
@@ -43,7 +43,7 @@ void SwClient::CheckRegistration( const SfxPoolItem* pOld, const SfxPoolItem* )
if(pDead && pDead->pObject == pRegisteredIn)
{
// I've got a notification from the object I know
- SwModify* pAbove = const_cast<SwModify*>(pRegisteredIn->GetRegisteredIn());
+ SwModify* pAbove = pRegisteredIn->GetRegisteredIn();
if(pAbove)
{
// if the dying object itself was listening at an SwModify, I take over
diff --git a/sw/source/core/doc/docdesc.cxx b/sw/source/core/doc/docdesc.cxx
index 6a00e2e..1583090 100644
--- a/sw/source/core/doc/docdesc.cxx
+++ b/sw/source/core/doc/docdesc.cxx
@@ -823,7 +823,7 @@ static SwPageDesc* lcl_FindPageDesc( SwPageDescs *pPageDescs,
SwPageDesc* res = NULL;
if( it != pPageDescs->end() )
{
- res = const_cast <SwPageDesc *>( &( *it ) );;
+ res = &( *it ) ;;
if( pPos )
*pPos = std::distance( pPageDescs->begin(), it );
}
@@ -856,7 +856,7 @@ bool SwDoc::ContainsPageDesc( const SwPageDesc *pDesc, size_t* pPos )
if (pDesc == NULL)
return false;
SwPageDesc *res = lcl_FindPageDesc<CompareSwPageDescToPtr>(
- const_cast <SwPageDescs *>( &maPageDescs ), pPos,
+ &maPageDescs, pPos,
CompareSwPageDescToPtr(pDesc) );
return res != NULL;
}
diff --git a/sw/source/core/doc/docftn.cxx b/sw/source/core/doc/docftn.cxx
index b89ae65..5d6c51c 100644
--- a/sw/source/core/doc/docftn.cxx
+++ b/sw/source/core/doc/docftn.cxx
@@ -47,12 +47,12 @@ SwEndNoteInfo& SwEndNoteInfo::operator=(const SwEndNoteInfo& rInfo)
if ( rInfo.aPageDescDep.GetRegisteredIn() )
const_cast<SwModify*>(rInfo.aPageDescDep.GetRegisteredIn())->Add( &aPageDescDep );
else if ( aPageDescDep.GetRegisteredIn() )
- const_cast<SwModify*>(aPageDescDep.GetRegisteredIn())->Remove( &aPageDescDep );
+ aPageDescDep.GetRegisteredIn()->Remove( &aPageDescDep );
if ( rInfo.aCharFormatDep.GetRegisteredIn() )
const_cast<SwModify*>(rInfo.aCharFormatDep.GetRegisteredIn())->Add( &aCharFormatDep );
else if ( aCharFormatDep.GetRegisteredIn() )
- const_cast<SwModify*>(aCharFormatDep.GetRegisteredIn())->Remove( &aCharFormatDep );
+ aCharFormatDep.GetRegisteredIn()->Remove( &aCharFormatDep );
if ( rInfo.aAnchorCharFormatDep.GetRegisteredIn() )
const_cast<SwModify*>(rInfo.aAnchorCharFormatDep.GetRegisteredIn())->Add(
diff --git a/sw/source/core/inc/pagedeschint.hxx b/sw/source/core/inc/pagedeschint.hxx
index 715caee..d76aa95 100644
--- a/sw/source/core/inc/pagedeschint.hxx
+++ b/sw/source/core/inc/pagedeschint.hxx
@@ -32,7 +32,7 @@ public:
: pPageDesc(p)
{}
- SwPageDesc* GetPageDesc() const { return const_cast<SwPageDesc*>(pPageDesc); }
+ SwPageDesc* GetPageDesc() const { return pPageDesc; }
};
#endif
diff --git a/sw/source/core/layout/atrfrm.cxx b/sw/source/core/layout/atrfrm.cxx
index d000571..93d139c 100644
--- a/sw/source/core/layout/atrfrm.cxx
+++ b/sw/source/core/layout/atrfrm.cxx
@@ -3468,7 +3468,7 @@ bool IsFlyFrameFormatInHeader(const SwFrameFormat& rFormat)
const SwFlyFrameFormat* pFlyFrameFormat = dynamic_cast<const SwFlyFrameFormat*>(&rFormat);
if (!pFlyFrameFormat)
return false;
- SwFlyFrm* pFlyFrm = const_cast<SwFlyFrm*>(pFlyFrameFormat->GetFrm());
+ SwFlyFrm* pFlyFrm = pFlyFrameFormat->GetFrm();
if (!pFlyFrm) // fdo#54648: "hidden" drawing object has no layout frame
{
return false;
diff --git a/sw/source/core/layout/paintfrm.cxx b/sw/source/core/layout/paintfrm.cxx
index 36ba345..eb77017 100644
--- a/sw/source/core/layout/paintfrm.cxx
+++ b/sw/source/core/layout/paintfrm.cxx
@@ -5366,7 +5366,7 @@ static const SwFrm* lcl_GetCellFrmForBorderAttrs( const SwFrm* _pCellFrm
// determine last row of complete table.
SwFrm* pLastRow = pLastTabFrm->GetLastLower();
// return first bottom border cell in last row
- SwFrm* pLowerCell = const_cast<SwFrm*>(pLastRow->GetLower());
+ SwFrm* pLowerCell = pLastRow->GetLower();
while ( !pLowerCell->IsCellFrm() ||
( pLowerCell->GetLower() && pLowerCell->GetLower()->IsRowFrm() )
)
diff --git a/sw/source/core/layout/tabfrm.cxx b/sw/source/core/layout/tabfrm.cxx
index 879bdff..477053a 100644
--- a/sw/source/core/layout/tabfrm.cxx
+++ b/sw/source/core/layout/tabfrm.cxx
@@ -2033,7 +2033,7 @@ void SwTabFrm::MakeAll()
// First, we remove an existing follow flow line.
if ( HasFollowFlowLine() )
{
- SwFrm* pLastLine = const_cast<SwFrm*>(GetLastLower());
+ SwFrm* pLastLine = GetLastLower();
RemoveFollowFlowLine();
// invalidate and rebuild last row
if ( pLastLine )
@@ -4347,7 +4347,7 @@ SwTwips SwRowFrm::ShrinkFrm( SwTwips nDist, bool bTst, bool bInfo )
&& this == pTab->GetFirstNonHeadlineRow()
&& !pTab->IsInRecalcLowerRow() )
{
- SwTabFrm* pMasterTab = const_cast< SwTabFrm* >( pTab->FindMaster() );
+ SwTabFrm* pMasterTab = pTab->FindMaster();
pMasterTab->InvalidatePos();
}
}
diff --git a/sw/source/core/swg/swblocks.cxx b/sw/source/core/swg/swblocks.cxx
index 333cc1e..15dd6d3 100644
--- a/sw/source/core/swg/swblocks.cxx
+++ b/sw/source/core/swg/swblocks.cxx
@@ -544,7 +544,7 @@ bool SwTextBlocks::IsOnlyTextBlock( sal_uInt16 nIdx ) const
bool bRet = false;
if( pImp && !pImp->bInPutMuchBlocks )
{
- SwBlockName* pBlkNm = const_cast<SwBlockName*>( pImp->aNames[ nIdx ] );
+ SwBlockName* pBlkNm = pImp->aNames[ nIdx ];
if( !pBlkNm->bIsOnlyTextFlagInit &&
!pImp->IsFileChanged() && !pImp->OpenFile( true ) )
{
diff --git a/sw/source/core/text/itrform2.cxx b/sw/source/core/text/itrform2.cxx
index a8f5ff2..3e64674 100644
--- a/sw/source/core/text/itrform2.cxx
+++ b/sw/source/core/text/itrform2.cxx
@@ -878,7 +878,7 @@ SwTextPortion *SwTextFormatter::WhichTextPor( SwTextFormatInfo &rInf ) const
pPor = new SwFieldMarkPortion();
else if (rInf.GetText()[rInf.GetIdx()]==CH_TXT_ATR_FORMELEMENT)
{
- SwTextNode *pNd = const_cast<SwTextNode *>(rInf.GetTextFrm()->GetTextNode());
+ SwTextNode *pNd = rInf.GetTextFrm()->GetTextNode();
const SwDoc *doc = pNd->GetDoc();
SwIndex aIndex(pNd, rInf.GetIdx());
SwPosition aPosition(*pNd, aIndex);
diff --git a/sw/source/core/text/portxt.cxx b/sw/source/core/text/portxt.cxx
index 5220493..760a5a7 100644
--- a/sw/source/core/text/portxt.cxx
+++ b/sw/source/core/text/portxt.cxx
@@ -856,7 +856,7 @@ void SwFieldFormCheckboxPortion::Paint( const SwTextPaintInfo& rInf ) const
bool SwFieldFormCheckboxPortion::Format( SwTextFormatInfo & rInf )
{
- SwTextNode *pNd = const_cast < SwTextNode * >( rInf.GetTextFrm( )->GetTextNode( ) );
+ SwTextNode *pNd = rInf.GetTextFrm( )->GetTextNode( );
const SwDoc *doc = pNd->GetDoc( );
SwIndex aIndex( pNd, rInf.GetIdx( ) );
SwPosition aPosition( *pNd, aIndex );
diff --git a/sw/source/core/text/txtftn.cxx b/sw/source/core/text/txtftn.cxx
index f5ed654..3421c32 100644
--- a/sw/source/core/text/txtftn.cxx
+++ b/sw/source/core/text/txtftn.cxx
@@ -804,7 +804,7 @@ SwFootnotePortion *SwTextFormatter::NewFootnotePortion( SwTextFormatInfo &rInf,
if( rInf.IsTest() )
return new SwFootnotePortion( rFootnote.GetViewNumStr( *pDoc ), pFootnote );
- SWAP_IF_SWAPPED swap(const_cast<SwTextFrm *>(pFrm));
+ SWAP_IF_SWAPPED swap(pFrm);
sal_uInt16 nReal;
{
@@ -1105,7 +1105,7 @@ sal_Int32 SwTextFormatter::FormatQuoVadis( const sal_Int32 nOffset )
sal_Int32 nRet;
{
- SWAP_IF_NOT_SWAPPED swap(const_cast<SwTextFrm *>(pFrm));
+ SWAP_IF_NOT_SWAPPED swap(pFrm);
nRet = FormatLine( nStart );
}
diff --git a/sw/source/core/text/widorp.cxx b/sw/source/core/text/widorp.cxx
index dff0acf..d954926 100644
--- a/sw/source/core/text/widorp.cxx
+++ b/sw/source/core/text/widorp.cxx
@@ -57,7 +57,7 @@ inline bool IsNastyFollow( const SwTextFrm *pFrm )
SwTextFrmBreak::SwTextFrmBreak( SwTextFrm *pNewFrm, const SwTwips nRst )
: nRstHeight(nRst), pFrm(pNewFrm)
{
- SWAP_IF_SWAPPED swap(const_cast<SwTextFrm *>(pFrm));
+ SWAP_IF_SWAPPED swap(pFrm);
SWRECTFN( pFrm )
nOrigin = (pFrm->*fnRect->fnGetPrtTop)();
bKeep = !pFrm->IsMoveable() || IsNastyFollow( pFrm );
@@ -104,7 +104,7 @@ bool SwTextFrmBreak::IsInside( SwTextMargin &rLine ) const
{
bool bFit = false;
- SWAP_IF_SWAPPED swap(const_cast<SwTextFrm *>(pFrm));
+ SWAP_IF_SWAPPED swap(pFrm);
SWRECTFN( pFrm )
// nOrigin is an absolut value, rLine referes to the swapped situation.
@@ -161,7 +161,7 @@ bool SwTextFrmBreak::IsInside( SwTextMargin &rLine ) const
bool SwTextFrmBreak::IsBreakNow( SwTextMargin &rLine )
{
- SWAP_IF_SWAPPED swap(const_cast<SwTextFrm *>(pFrm));
+ SWAP_IF_SWAPPED swap(pFrm);
// bKeep is stronger than IsBreakNow()
// Is there enough space ?
@@ -220,7 +220,7 @@ WidowsAndOrphans::WidowsAndOrphans( SwTextFrm *pNewFrm, const SwTwips nRst,
bool bChkKeep )
: SwTextFrmBreak( pNewFrm, nRst ), nWidLines( 0 ), nOrphLines( 0 )
{
- SWAP_IF_SWAPPED swap(const_cast<SwTextFrm *>(pFrm));
+ SWAP_IF_SWAPPED swap(pFrm);
if( bKeep )
{
@@ -302,7 +302,7 @@ bool WidowsAndOrphans::FindBreak( SwTextFrm *pFrame, SwTextMargin &rLine,
// Thus, assertion on situation, that these are different to figure out why.
OSL_ENSURE( pFrm == pFrame, "<WidowsAndOrphans::FindBreak> - pFrm != pFrame" );
- SWAP_IF_SWAPPED swap(const_cast<SwTextFrm *>(pFrm));
+ SWAP_IF_SWAPPED swap(pFrm);
bool bRet = true;
sal_uInt16 nOldOrphans = nOrphLines;
diff --git a/sw/source/core/undo/rolbck.cxx b/sw/source/core/undo/rolbck.cxx
index 9a40d8c..2d2bced 100644
--- a/sw/source/core/undo/rolbck.cxx
+++ b/sw/source/core/undo/rolbck.cxx
@@ -1371,7 +1371,7 @@ bool SwRegHistory::InsertItems( const SfxItemSet& rSet,
return false;
SwTextNode * const pTextNode =
- dynamic_cast<SwTextNode *>(const_cast<SwModify *>(GetRegisteredIn()));
+ dynamic_cast<SwTextNode *>(GetRegisteredIn());
OSL_ENSURE(pTextNode, "SwRegHistory not registered at text node?");
if (!pTextNode)
@@ -1432,12 +1432,12 @@ void SwRegHistory::_MakeSetWhichIds()
if( GetRegisteredIn()->ISA( SwContentNode ) )
{
pSet = static_cast<SwContentNode*>(
- const_cast<SwModify*>(GetRegisteredIn()))->GetpSwAttrSet();
+ GetRegisteredIn())->GetpSwAttrSet();
}
else if ( GetRegisteredIn()->ISA( SwFormat ) )
{
pSet = &static_cast<SwFormat*>(
- const_cast<SwModify*>(GetRegisteredIn()))->GetAttrSet();
+ GetRegisteredIn())->GetAttrSet();
}
if( pSet && pSet->Count() )
{
diff --git a/sw/source/core/undo/unattr.cxx b/sw/source/core/undo/unattr.cxx
index 8eec8e2..ec5770d 100644
--- a/sw/source/core/undo/unattr.cxx
+++ b/sw/source/core/undo/unattr.cxx
@@ -868,7 +868,7 @@ void SwUndoDefaultAttr::UndoImpl(::sw::UndoRedoContext & rContext)
SwDoc & rDoc = rContext.GetDoc();
if ( m_pOldSet.get() ) {
SwUndoFormatAttrHelper aTmp(
- *const_cast<SwTextFormatColl*>(rDoc.GetDfltTextFormatColl()) );
+ *rDoc.GetDfltTextFormatColl() );
rDoc.SetDefault( *m_pOldSet );
m_pOldSet.reset( 0 );
if ( aTmp.GetUndo() ) {
diff --git a/sw/source/core/unocore/unodraw.cxx b/sw/source/core/unocore/unodraw.cxx
index 828bb20..42a8013 100644
--- a/sw/source/core/unocore/unodraw.cxx
+++ b/sw/source/core/unocore/unodraw.cxx
@@ -990,7 +990,7 @@ void SwXShape::AddExistingShapeToFormat( SdrObject& _rObj )
{
if ( pSwShape->m_bDescriptor )
{
- SwFrameFormat* pFormat = ::FindFrameFormat( const_cast< SdrObject* >( pCurrent ) );
+ SwFrameFormat* pFormat = ::FindFrameFormat( pCurrent );
if ( pFormat )
pFormat->Add( pSwShape );
pSwShape->m_bDescriptor = false;
diff --git a/sw/source/core/unocore/unofield.cxx b/sw/source/core/unocore/unofield.cxx
index 8523624..4d175fb 100644
--- a/sw/source/core/unocore/unofield.cxx
+++ b/sw/source/core/unocore/unofield.cxx
@@ -811,7 +811,7 @@ SwFieldType* SwXFieldMaster::GetFieldType(bool const bDontCreate) const
if (m_pImpl->m_bIsDescriptor)
return 0;
else
- return static_cast<SwFieldType*>(const_cast<SwModify*>(m_pImpl->GetRegisteredIn()));
+ return static_cast<SwFieldType*>(m_pImpl->GetRegisteredIn());
}
typedef std::vector<SwFormatField*> SwDependentFields;
@@ -1297,8 +1297,8 @@ SwXTextField::getTextFieldMaster() throw (uno::RuntimeException, std::exception)
SwFieldType* pType = 0;
if (m_pImpl->m_bIsDescriptor && m_pImpl->m_FieldTypeClient.GetRegisteredIn())
{
- pType = static_cast<SwFieldType*>(const_cast<SwModify*>(
- m_pImpl->m_FieldTypeClient.GetRegisteredIn()));
+ pType = static_cast<SwFieldType*>(
+ m_pImpl->m_FieldTypeClient.GetRegisteredIn());
}
else
{
@@ -1995,7 +1995,7 @@ throw (lang::IllegalArgumentException, uno::RuntimeException, std::exception)
m_pImpl->m_bIsDescriptor = false;
if (m_pImpl->m_FieldTypeClient.GetRegisteredIn())
{
- const_cast<SwModify*>(m_pImpl->m_FieldTypeClient.GetRegisteredIn())
+ m_pImpl->m_FieldTypeClient.GetRegisteredIn()
->Remove(&m_pImpl->m_FieldTypeClient);
}
m_pImpl->m_pProps.reset();
diff --git a/sw/source/core/unocore/unoftn.cxx b/sw/source/core/unocore/unoftn.cxx
index 12b4c4f..827d4fb 100644
--- a/sw/source/core/unocore/unoftn.cxx
+++ b/sw/source/core/unocore/unoftn.cxx
@@ -97,7 +97,7 @@ void SwXFootnote::Impl::Invalidate()
{
if (GetRegisteredIn())
{
- const_cast<SwModify*>(GetRegisteredIn())->Remove(this);
+ GetRegisteredIn()->Remove(this);
}
m_pFormatFootnote = 0;
m_rThis.SetDoc(0);
diff --git a/sw/source/core/unocore/unoidx.cxx b/sw/source/core/unocore/unoidx.cxx
index a476a4b..2523077 100644
--- a/sw/source/core/unocore/unoidx.cxx
+++ b/sw/source/core/unocore/unoidx.cxx
@@ -1383,7 +1383,7 @@ throw (lang::IllegalArgumentException, uno::RuntimeException, std::exception)
// update page numbers
pTOX->GetFormat()->Add(m_pImpl.get());
pTOX->GetFormat()->SetXObject(static_cast< ::cppu::OWeakObject*>(this));
- const_cast<SwTOXBaseSection*>(pTOX)->UpdatePageNum();
+ pTOX->UpdatePageNum();
m_pImpl->m_pProps.reset();
m_pImpl->m_pDoc = pDoc;
@@ -1624,10 +1624,10 @@ void SwXDocumentIndexMark::Impl::Invalidate()
{
if (GetRegisteredIn())
{
- const_cast<SwModify*>(GetRegisteredIn())->Remove(this);
+ GetRegisteredIn()->Remove(this);
if (m_TypeDepend.GetRegisteredIn())
{
- const_cast<SwModify*>(m_TypeDepend.GetRegisteredIn())->Remove(
+ m_TypeDepend.GetRegisteredIn()->Remove(
&m_TypeDepend);
}
}
diff --git a/sw/source/core/unocore/unoobj2.cxx b/sw/source/core/unocore/unoobj2.cxx
index 4172415..89e716c 100644
--- a/sw/source/core/unocore/unoobj2.cxx
+++ b/sw/source/core/unocore/unoobj2.cxx
@@ -472,7 +472,7 @@ public:
SwUnoCrsr * GetCursor() {
return static_cast<SwUnoCrsr*>(
- const_cast<SwModify*>(GetRegisteredIn()));
+ GetRegisteredIn());
}
uno::Reference< text::XTextContent > NextElement_Impl()
@@ -763,14 +763,14 @@ void SwXTextRange::Impl::Modify(const SfxPoolItem *pOld, const SfxPoolItem *pNew
// if the depend was removed then the range must be removed too
if (!m_ObjectDepend.GetRegisteredIn() && GetRegisteredIn())
{
- const_cast<SwModify*>(GetRegisteredIn())->Remove(this);
+ GetRegisteredIn()->Remove(this);
}
// or if the range has been removed but the depend is still
// connected then the depend must be removed
else if (bAlreadyRegistered && !GetRegisteredIn() &&
m_ObjectDepend.GetRegisteredIn())
{
- const_cast<SwModify*>(m_ObjectDepend.GetRegisteredIn())
+ m_ObjectDepend.GetRegisteredIn()
->Remove(& m_ObjectDepend);
}
}
@@ -1527,7 +1527,7 @@ public:
SwUnoCrsr * GetCursor() {
return static_cast<SwUnoCrsr*>(
- const_cast<SwModify*>(GetRegisteredIn()));
+ GetRegisteredIn());
}
void MakeRanges();
@@ -1719,7 +1719,7 @@ public:
SwUnoCrsr * GetCursor() {
return static_cast<SwUnoCrsr*>(
- const_cast<SwModify*>(GetRegisteredIn()));
+ GetRegisteredIn());
}
protected:
@@ -1769,8 +1769,8 @@ lcl_CreateNextObject(SwUnoCrsr& i_rUnoCrsr,
if (!i_rFrames.size())
return false;
- SwFrameFormat *const pFormat = static_cast<SwFrameFormat*>(const_cast<SwModify*>(
- i_rFrames.front()->GetRegisteredIn()));
+ SwFrameFormat *const pFormat = static_cast<SwFrameFormat*>(
+ i_rFrames.front()->GetRegisteredIn());
i_rFrames.pop_front();
// the format should be valid here, otherwise the client
// would have been removed in ::Modify
diff --git a/sw/source/core/unocore/unorefmk.cxx b/sw/source/core/unocore/unorefmk.cxx
index d322d7e..c0ce574 100644
--- a/sw/source/core/unocore/unorefmk.cxx
+++ b/sw/source/core/unocore/unorefmk.cxx
@@ -82,7 +82,7 @@ void SwXReferenceMark::Impl::Invalidate()
{
if (IsValid())
{
- const_cast<SwModify*>(GetRegisteredIn())->Remove(this);
+ GetRegisteredIn()->Remove(this);
}
m_pDoc = 0;
m_pMarkFormat = 0;
diff --git a/sw/source/core/unocore/unotbl.cxx b/sw/source/core/unocore/unotbl.cxx
index cbd5bc6..4662759 100644
--- a/sw/source/core/unocore/unotbl.cxx
+++ b/sw/source/core/unocore/unotbl.cxx
@@ -2075,7 +2075,7 @@ void SwXTextTable::attachToRange(const uno::Reference< text::XTextRange > & xTex
pCursor = reinterpret_cast<OTextCursorHelper*>(
sal::static_int_cast<sal_IntPtr>(xRangeTunnel->getSomething(OTextCursorHelper::getUnoTunnelId())));
}
- SwDoc* pDoc = pRange ? const_cast<SwDoc*>(pRange->GetDoc()) : pCursor ? const_cast<SwDoc*>(pCursor->GetDoc()) : nullptr;
+ SwDoc* pDoc = pRange ? pRange->GetDoc() : pCursor ? pCursor->GetDoc() : nullptr;
if(!pDoc || !nRows || !nColumns)
throw lang::IllegalArgumentException();
SwUnoInternalPaM aPam(*pDoc);
diff --git a/sw/source/filter/ww8/writerwordglue.cxx b/sw/source/filter/ww8/writerwordglue.cxx
index c82f6f9..50892e4 100644
--- a/sw/source/filter/ww8/writerwordglue.cxx
+++ b/sw/source/filter/ww8/writerwordglue.cxx
@@ -173,7 +173,7 @@ namespace myImplHelpers
SwTextFormatColl* MapperImpl<SwTextFormatColl>::MakeStyle(const OUString &rName)
{
return mrDoc.MakeTextFormatColl(rName,
- const_cast<SwTextFormatColl *>(mrDoc.GetDfltTextFormatColl()));
+ mrDoc.GetDfltTextFormatColl());
}
template<> class MapperImpl<SwCharFormat>
diff --git a/sw/source/filter/ww8/ww8par.cxx b/sw/source/filter/ww8/ww8par.cxx
index 318e5af..2b8065f 100644
--- a/sw/source/filter/ww8/ww8par.cxx
+++ b/sw/source/filter/ww8/ww8par.cxx
@@ -4006,7 +4006,7 @@ bool SwWW8ImplReader::ReadText(long nStartCp, long nTextLen, ManTypes nType)
if (pFormat)
aDrop.SetCharFormat(const_cast<SwCharFormat*>(pFormat));
else if(pNewSwCharFormat)
- aDrop.SetCharFormat(const_cast<SwCharFormat*>(pNewSwCharFormat));
+ aDrop.SetCharFormat(pNewSwCharFormat);
SwPosition aStart(*pEndNd);
m_pCtrlStck->NewAttr(aStart, aDrop);
diff --git a/sw/source/uibase/uiview/view.cxx b/sw/source/uibase/uiview/view.cxx
index 590774a..97044dc 100644
--- a/sw/source/uibase/uiview/view.cxx
+++ b/sw/source/uibase/uiview/view.cxx
@@ -218,7 +218,7 @@ IMPL_LINK_NOARG(SwView, FormControlActivated)
if ( pSdrView && pSdrView->IsTextEdit() )
pSdrView->SdrEndTextEdit( true );
- const_cast< SwView* >( this )->AttrChangedNotify( m_pWrtShell );
+ AttrChangedNotify( m_pWrtShell );
}
return 0L;
commit 5dc811daf9ea03dfccabec3a80a44bd12fa62d66
Author: Stephan Bergmann <sbergman at redhat.com>
Date: Fri May 29 12:04:55 2015 +0200
loplugin:redundantcast: const_cast to same type
Change-Id: I226413abb1e87fcb9de21a496b359dd7ef33761d
diff --git a/svx/source/gallery2/galbrws2.cxx b/svx/source/gallery2/galbrws2.cxx
index b97bc9d..e0328b4 100644
--- a/svx/source/gallery2/galbrws2.cxx
+++ b/svx/source/gallery2/galbrws2.cxx
@@ -670,7 +670,7 @@ bool GalleryBrowser2::KeyInput( const KeyEvent& rKEvt, vcl::Window* pWindow )
sal_uInt16 nExecuteId = 0;
INetURLObject aURL;
- const_cast< GalleryTheme* >( mpCurTheme )->GetURL( nItemId - 1, aURL );
+ mpCurTheme->GetURL( nItemId - 1, aURL );
const bool bValidURL = ( aURL.GetProtocol() != INetProtocol::NotValid );
bool bPreview = bValidURL;
diff --git a/svx/source/svdraw/svdmrkv1.cxx b/svx/source/svdraw/svdmrkv1.cxx
index 080a8fc..7935072 100644
--- a/svx/source/svdraw/svdmrkv1.cxx
+++ b/svx/source/svdraw/svdmrkv1.cxx
@@ -475,7 +475,7 @@ bool SdrMarkView::PickGluePoint(const Point& rPnt, SdrObject*& rpObj, sal_uInt16
if (!IsGluePointEditMode()) return false;
bool bBack(nOptions & SdrSearchOptions::BACKWARD);
bool bNext(nOptions & SdrSearchOptions::NEXT);
- OutputDevice* pOut=const_cast<OutputDevice*>(pActualOutDev.get());
+ OutputDevice* pOut=pActualOutDev.get();
if (pOut==NULL) pOut=GetFirstOutputDevice();
if (pOut==NULL) return false;
SortMarkedObjects();
diff --git a/svx/source/svdraw/svdoole2.cxx b/svx/source/svdraw/svdoole2.cxx
index e567960..3dff9dd 100644
--- a/svx/source/svdraw/svdoole2.cxx
+++ b/svx/source/svdraw/svdoole2.cxx
@@ -933,7 +933,7 @@ bool SdrOle2Obj::UpdateLinkURL_Impl()
sfx2::LinkManager::GetDisplayNames( mpImpl->mpObjectLink, 0, &aNewLinkURL, 0, 0 );
if ( !aNewLinkURL.equalsIgnoreAsciiCase( mpImpl->maLinkURL ) )
{
- const_cast<SdrOle2Obj*>(this)->GetObjRef_Impl();
+ GetObjRef_Impl();
uno::Reference<embed::XCommonEmbedPersist> xPersObj( mpImpl->mxObjRef.GetObject(), uno::UNO_QUERY );
OSL_ENSURE( xPersObj.is(), "The object must exist!\n" );
if ( xPersObj.is() )
commit 58389480b74ccb181d2c14a3e74bc173ff30f997
Author: Stephan Bergmann <sbergman at redhat.com>
Date: Fri May 29 12:04:51 2015 +0200
loplugin:redundantcast: const_cast to same type
Change-Id: Ifced01f17de220d430bb9d51d1fdc67242efcff8
diff --git a/svtools/source/graphic/provider.cxx b/svtools/source/graphic/provider.cxx
index 7a5bda7..afca9bc 100644
--- a/svtools/source/graphic/provider.cxx
+++ b/svtools/source/graphic/provider.cxx
@@ -653,7 +653,7 @@ void ImplApplyFilterData( ::Graphic& rGraphic, uno::Sequence< beans::PropertyVal
// only optimizing common bitmap actions:
case( MetaActionType::MAPMODE ):
{
- const_cast< MetaAction* >( pAction )->Execute( aDummyVDev.get() );
+ pAction->Execute( aDummyVDev.get() );
break;
}
case( MetaActionType::PUSH ):
commit 8332862a3669b40b00a6bd53f6ba489bfd9f510b
Author: Stephan Bergmann <sbergman at redhat.com>
Date: Fri May 29 12:04:46 2015 +0200
loplugin:redundantcast: const_cast to same type
Change-Id: I305f476e85b4e0bef4ef91fb5eaa75313b0e490f
diff --git a/sfx2/source/appl/appopen.cxx b/sfx2/source/appl/appopen.cxx
index 4793874..e27754e 100644
--- a/sfx2/source/appl/appopen.cxx
+++ b/sfx2/source/appl/appopen.cxx
@@ -326,7 +326,7 @@ sal_uIntPtr SfxApplication::LoadTemplate( SfxObjectShellLock& xDoc, const OUStri
const SfxPoolItem *pRet = GetDispatcher_Impl()->Execute( SID_OPENDOC, SfxCallMode::SYNCHRON, &aName, &aHidden, &aReferer, &aFlags, 0L );
const SfxObjectItem *pObj = PTR_CAST( SfxObjectItem, pRet );
if ( pObj )
- xDoc = const_cast<SfxObjectShell*>(PTR_CAST( SfxObjectShell, pObj->GetShell() ));
+ xDoc = PTR_CAST( SfxObjectShell, pObj->GetShell() );
else
{
const SfxViewFrameItem *pView = PTR_CAST( SfxViewFrameItem, pRet );
commit c718f637a6db3fc7c1a548bfc7a1d15d83ffdc81
Author: Stephan Bergmann <sbergman at redhat.com>
Date: Fri May 29 12:04:41 2015 +0200
loplugin:redundantcast: const_cast to same type
Change-Id: I3da21ec39ea4802e2f95943dee4e02e1490a513f
diff --git a/sd/source/core/stlsheet.cxx b/sd/source/core/stlsheet.cxx
index a3b018c..4774edd 100644
--- a/sd/source/core/stlsheet.cxx
+++ b/sd/source/core/stlsheet.cxx
@@ -132,7 +132,7 @@ SdStyleSheet::SdStyleSheet(const OUString& rDisplayName, SfxStyleSheetBasePool&
: SdStyleSheetBase( OUString( rDisplayName ), _rPool, eFamily, _nMask)
, ::cppu::BaseMutex()
, msApiName( rDisplayName )
-, mxPool( const_cast< SfxStyleSheetBasePool* >(&_rPool) )
+, mxPool( &_rPool )
, mrBHelper( m_aMutex )
{
}
diff --git a/sd/source/ui/unoidl/SdUnoDrawView.cxx b/sd/source/ui/unoidl/SdUnoDrawView.cxx
index 88b4787..486c86f 100644
--- a/sd/source/ui/unoidl/SdUnoDrawView.cxx
+++ b/sd/source/ui/unoidl/SdUnoDrawView.cxx
@@ -385,7 +385,7 @@ Any SAL_CALL SdUnoDrawView::getFastPropertyValue (
switch( nHandle )
{
case DrawController::PROPERTY_CURRENTPAGE:
- aValue <<= (const_cast<SdUnoDrawView*>(this))->getCurrentPage();
+ aValue <<= getCurrentPage();
break;
case DrawController::PROPERTY_MASTERPAGEMODE:
@@ -397,7 +397,7 @@ Any SAL_CALL SdUnoDrawView::getFastPropertyValue (
break;
case DrawController::PROPERTY_ACTIVE_LAYER:
- aValue <<= (const_cast<SdUnoDrawView*>(this))->getActiveLayer();
+ aValue <<= getActiveLayer();
break;
case DrawController::PROPERTY_ZOOMVALUE:
commit 882150905bbb091d90cc3bd3061a80db689446d9
Author: Stephan Bergmann <sbergman at redhat.com>
Date: Fri May 29 12:04:37 2015 +0200
loplugin:redundantcast: const_cast to same type
Change-Id: Ifa5d960a9dbeb9e770beafd4f0cbeccb5a1b1c0d
diff --git a/sc/source/core/data/conditio.cxx b/sc/source/core/data/conditio.cxx
index 3036999..889feb9 100644
--- a/sc/source/core/data/conditio.cxx
+++ b/sc/source/core/data/conditio.cxx
@@ -974,7 +974,7 @@ bool ScConditionEntry::IsError( const ScAddress& rPos ) const
return false;
case CELLTYPE_FORMULA:
{
- ScFormulaCell* pFormulaCell = const_cast<ScFormulaCell*>(mpDoc->GetFormulaCell(rPos));
+ ScFormulaCell* pFormulaCell = mpDoc->GetFormulaCell(rPos);
if (pFormulaCell && pFormulaCell->GetErrCode())
return true;
}
diff --git a/sc/source/core/data/drwlayer.cxx b/sc/source/core/data/drwlayer.cxx
index 27e47c8..051cad9 100644
--- a/sc/source/core/data/drwlayer.cxx
+++ b/sc/source/core/data/drwlayer.cxx
@@ -2114,7 +2114,7 @@ ScMacroInfo* ScDrawLayer::GetMacroInfo( SdrObject* pObj, bool bCreate )
ImageMap* ScDrawLayer::GetImageMapForObject(SdrObject* pObj)
{
- ScIMapInfo* pIMapInfo = const_cast<ScIMapInfo*>( GetIMapInfo( pObj ) );
+ ScIMapInfo* pIMapInfo = GetIMapInfo( pObj );
if ( pIMapInfo )
{
return const_cast<ImageMap*>( &(pIMapInfo->GetImageMap()) );
diff --git a/sc/source/filter/excel/excimp8.cxx b/sc/source/filter/excel/excimp8.cxx
index 3b91332..cbcd43c 100644
--- a/sc/source/filter/excel/excimp8.cxx
+++ b/sc/source/filter/excel/excimp8.cxx
@@ -878,7 +878,7 @@ XclImpAutoFilterData* XclImpAutoFilterBuffer::GetByTab( SCTAB nTab )
for( it = maFilters.begin(); it != maFilters.end(); ++it )
{
if( it->Tab() == nTab )
- return const_cast<XclImpAutoFilterData*>(&(*it));
+ return &(*it);
}
return NULL;
}
commit 3a05a08ba79a99b5c070d14eceefe7b0b6ca03c6
Author: Stephan Bergmann <sbergman at redhat.com>
Date: Fri May 29 12:04:32 2015 +0200
loplugin:redundantcast: const_cast to same type
Change-Id: I5fe081bc2edfe14c81372ae0fd407e493d80d689
diff --git a/forms/source/component/DatabaseForm.cxx b/forms/source/component/DatabaseForm.cxx
index 2e32540..da50462 100644
--- a/forms/source/component/DatabaseForm.cxx
+++ b/forms/source/component/DatabaseForm.cxx
@@ -4052,7 +4052,7 @@ OUString SAL_CALL ODatabaseForm::getName() throw( RuntimeException, std::excepti
{
throw WrappedTargetRuntimeException(
"ODatabaseForm::getName",
- *const_cast< ODatabaseForm* >( this ),
+ *this,
::cppu::getCaughtException()
);
}
diff --git a/forms/source/component/FormComponent.cxx b/forms/source/component/FormComponent.cxx
index 0e3a00b..61b7542 100644
--- a/forms/source/component/FormComponent.cxx
+++ b/forms/source/component/FormComponent.cxx
@@ -646,7 +646,7 @@ OUString SAL_CALL OControlModel::getName() throw(RuntimeException, std::exceptio
css::uno::Any a(cppu::getCaughtException());
throw WrappedTargetRuntimeException(
"OControlModel::getName",
- *const_cast< OControlModel* >( this ),
+ *this,
a
);
}
@@ -664,7 +664,7 @@ void SAL_CALL OControlModel::setName(const OUString& _rName) throw(RuntimeExcept
css::uno::Any a(cppu::getCaughtException());
throw WrappedTargetRuntimeException(
"OControlModel::setName",
- *const_cast< OControlModel* >( this ),
+ *this,
a
);
}
diff --git a/forms/source/runtime/formoperations.cxx b/forms/source/runtime/formoperations.cxx
index 2ccb2df..b770a5f 100644
--- a/forms/source/runtime/formoperations.cxx
+++ b/forms/source/runtime/formoperations.cxx
@@ -803,7 +803,7 @@ namespace frm
catch( const SQLException& ) { throw; }
catch( const Exception& )
{
- throw WrappedTargetException( OUString(), *const_cast< FormOperations* >( this ), ::cppu::getCaughtException() );
+ throw WrappedTargetException( OUString(), *this, ::cppu::getCaughtException() );
}
impl_invalidateAllSupportedFeatures_nothrow( aGuard );
diff --git a/forms/source/xforms/datatypes_impl.hxx b/forms/source/xforms/datatypes_impl.hxx
index 8f1a54f..4bd194c 100644
--- a/forms/source/xforms/datatypes_impl.hxx
+++ b/forms/source/xforms/datatypes_impl.hxx
@@ -51,8 +51,8 @@ template< typename CONCRETE_DATA_TYPE_IMPL, typename SUPERCLASS >
{
if ( !m_bPropertiesRegistered )
{
- const_cast< ODerivedDataType* >( this )->registerProperties();
- const_cast< ODerivedDataType* >( this )->m_bPropertiesRegistered = true;
+ this->registerProperties();
+ m_bPropertiesRegistered = true;
}
return *ODerivedDataType< CONCRETE_DATA_TYPE_IMPL, SUPERCLASS >::getArrayHelper();
commit f9a8dd3bbb6b60b8f25ae4108868dc778cd51dfb
Author: Stephan Bergmann <sbergman at redhat.com>
Date: Fri May 29 12:04:25 2015 +0200
loplugin:redundantcast: const_cast to same type
Change-Id: Ifdb1c4174b89b273dd240d3d0f542ec4a871c7e0
diff --git a/extensions/source/dbpilots/unoautopilot.hxx b/extensions/source/dbpilots/unoautopilot.hxx
index d4b7be4..83a58ee 100644
--- a/extensions/source/dbpilots/unoautopilot.hxx
+++ b/extensions/source/dbpilots/unoautopilot.hxx
@@ -92,7 +92,7 @@ namespace dbp
virtual ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper() SAL_OVERRIDE
{
- return *const_cast<OUnoAutoPilot*>(this)->getArrayHelper();
+ return *this->getArrayHelper();
}
// OPropertyArrayUsageHelper
diff --git a/extensions/source/propctrlr/commoncontrol.cxx b/extensions/source/propctrlr/commoncontrol.cxx
index 48ed7f3..1bfeed3 100644
--- a/extensions/source/propctrlr/commoncontrol.cxx
+++ b/extensions/source/propctrlr/commoncontrol.cxx
@@ -108,7 +108,7 @@ namespace pcr
try
{
if ( m_xContext.is() )
- m_xContext->activateNextControl( const_cast< XPropertyControl* >( &m_rAntiImpl ) );
+ m_xContext->activateNextControl( &m_rAntiImpl );
}
catch( const Exception& )
{
diff --git a/extensions/source/propctrlr/eformspropertyhandler.cxx b/extensions/source/propctrlr/eformspropertyhandler.cxx
index 47e5e30..32ca408 100644
--- a/extensions/source/propctrlr/eformspropertyhandler.cxx
+++ b/extensions/source/propctrlr/eformspropertyhandler.cxx
@@ -423,7 +423,7 @@ namespace pcr
{
case PROPERTY_ID_LIST_BINDING:
nControlType = PropertyControlType::ListBox;
- const_cast< EFormsHelper* >( m_pHelper.get() )->getAllElementUINames( EFormsHelper::Binding, aListEntries, true );
+ m_pHelper.get()->getAllElementUINames( EFormsHelper::Binding, aListEntries, true );
break;
case PROPERTY_ID_XML_DATA_MODEL:
diff --git a/extensions/source/propctrlr/eventhandler.cxx b/extensions/source/propctrlr/eventhandler.cxx
index f275230..cf2ad16 100644
--- a/extensions/source/propctrlr/eventhandler.cxx
+++ b/extensions/source/propctrlr/eventhandler.cxx
@@ -712,7 +712,7 @@ namespace pcr
::osl::MutexGuard aGuard( m_aMutex );
if ( !m_bEventsMapInitialized )
{
- const_cast< EventHandler* >( this )->m_bEventsMapInitialized = true;
+ m_bEventsMapInitialized = true;
try
{
Sequence< Type > aListeners;
@@ -749,7 +749,7 @@ namespace pcr
if ( !impl_filterMethod_nothrow( aEvent ) )
continue;
- const_cast< EventHandler* >( this )->m_aEvents.insert( EventMap::value_type(
+ m_aEvents.insert( EventMap::value_type(
lcl_getEventPropertyName( sListenerClassName, *pMethods ), aEvent ) );
}
}
diff --git a/extensions/source/propctrlr/genericpropertyhandler.cxx b/extensions/source/propctrlr/genericpropertyhandler.cxx
index 0aaa2cc..b561efa 100644
--- a/extensions/source/propctrlr/genericpropertyhandler.cxx
+++ b/extensions/source/propctrlr/genericpropertyhandler.cxx
@@ -363,7 +363,7 @@ namespace pcr
Any SAL_CALL GenericPropertyHandler::convertToPropertyValue( const OUString& _rPropertyName, const Any& _rControlValue ) throw (UnknownPropertyException, RuntimeException, std::exception)
{
::osl::MutexGuard aGuard( m_aMutex );
- const_cast< GenericPropertyHandler* >( this )->impl_ensurePropertyMap();
+ impl_ensurePropertyMap();
PropertyMap::const_iterator pos = m_aProperties.find( _rPropertyName );
if ( pos == m_aProperties.end() )
@@ -389,7 +389,7 @@ namespace pcr
Any SAL_CALL GenericPropertyHandler::convertToControlValue( const OUString& _rPropertyName, const Any& _rPropertyValue, const Type& _rControlValueType ) throw (UnknownPropertyException, RuntimeException, std::exception)
{
::osl::MutexGuard aGuard( m_aMutex );
- const_cast< GenericPropertyHandler* >( this )->impl_ensurePropertyMap();
+ impl_ensurePropertyMap();
PropertyMap::const_iterator pos = m_aProperties.find( _rPropertyName );
if ( pos == m_aProperties.end() )
@@ -526,7 +526,7 @@ namespace pcr
Sequence< Property > SAL_CALL GenericPropertyHandler::getSupportedProperties() throw (RuntimeException, std::exception)
{
::osl::MutexGuard aGuard( m_aMutex );
- const_cast< GenericPropertyHandler* >( this )->impl_ensurePropertyMap();
+ impl_ensurePropertyMap();
Sequence< Property > aReturn( m_aProperties.size() );
::std::transform( m_aProperties.begin(), m_aProperties.end(),
@@ -557,7 +557,7 @@ namespace pcr
throw NullPointerException();
::osl::MutexGuard aGuard( m_aMutex );
- const_cast< GenericPropertyHandler* >( this )->impl_ensurePropertyMap();
+ impl_ensurePropertyMap();
PropertyMap::const_iterator pos = m_aProperties.find( _rPropertyName );
if ( pos == m_aProperties.end() )
commit 1166efc5f94c9596226f5700bb08994d75f609d6
Author: Stephan Bergmann <sbergman at redhat.com>
Date: Fri May 29 12:04:19 2015 +0200
loplugin:redundantcast: const_cast to same type
Change-Id: Ib80d28bf3680fc7ff1f11f3d143a103075b7ef75
diff --git a/dbaccess/source/core/dataaccess/ModelImpl.cxx b/dbaccess/source/core/dataaccess/ModelImpl.cxx
index 4788df6..40575e5 100644
--- a/dbaccess/source/core/dataaccess/ModelImpl.cxx
+++ b/dbaccess/source/core/dataaccess/ModelImpl.cxx
@@ -1322,7 +1322,7 @@ ODatabaseModelImpl::EmbeddedMacros ODatabaseModelImpl::determineEmbeddedMacros()
{
if ( !m_aEmbeddedMacros )
{
- if ( ::sfx2::DocumentMacroMode::storageHasMacros( const_cast< ODatabaseModelImpl* >( this )->getOrCreateRootStorage() ) )
+ if ( ::sfx2::DocumentMacroMode::storageHasMacros( getOrCreateRootStorage() ) )
{
m_aEmbeddedMacros.reset( eDocumentWideMacros );
}
diff --git a/dbaccess/source/core/dataaccess/databasedocument.cxx b/dbaccess/source/core/dataaccess/databasedocument.cxx
index 926b1b2..1f801b7 100644
--- a/dbaccess/source/core/dataaccess/databasedocument.cxx
+++ b/dbaccess/source/core/dataaccess/databasedocument.cxx
@@ -1766,7 +1766,7 @@ Sequence< OUString > SAL_CALL ODatabaseDocument::getDocumentSubStoragesNames( )
void ODatabaseDocument::impl_notifyStorageChange_nolck_nothrow( const Reference< XStorage >& _rxNewRootStorage )
{
- Reference< XInterface > xMe( *const_cast< ODatabaseDocument* >( this ) );
+ Reference< XInterface > xMe( *this );
m_aStorageListeners.forEach< XStorageChangeListener >(
boost::bind( &XStorageChangeListener::notifyStorageChange, _1, boost::cref( xMe ), boost::cref( _rxNewRootStorage ) ) );
commit 123dd1869d988f5efe1ce896cb6db0963a53bd09
Author: Stephan Bergmann <sbergman at redhat.com>
Date: Fri May 29 12:04:12 2015 +0200
loplugin:redundantcast: const_cast to same type
Change-Id: Ic4e5afab0e948392a0f2e4bdeab84afffa3e647f
diff --git a/connectivity/source/sdbcx/VGroup.cxx b/connectivity/source/sdbcx/VGroup.cxx
index c5e27d8..196cbc3 100644
--- a/connectivity/source/sdbcx/VGroup.cxx
+++ b/connectivity/source/sdbcx/VGroup.cxx
@@ -108,7 +108,7 @@ Reference< XNameAccess > SAL_CALL OGroup::getUsers( ) throw(RuntimeException, s
// allowed
}
- return const_cast<OGroup*>(this)->m_pUsers;
+ return m_pUsers;
}
diff --git a/connectivity/source/sdbcx/VIndex.cxx b/connectivity/source/sdbcx/VIndex.cxx
index e7dee03..cebffa3 100644
--- a/connectivity/source/sdbcx/VIndex.cxx
+++ b/connectivity/source/sdbcx/VIndex.cxx
@@ -163,7 +163,7 @@ Reference< ::com::sun::star::container::XNameAccess > SAL_CALL OIndex::getColumn
OSL_FAIL( "OIndex::getColumns: caught an exception!" );
}
- return const_cast<OIndex*>(this)->m_pColumns;
+ return m_pColumns;
}
Reference< XPropertySet > SAL_CALL OIndex::createDataDescriptor( ) throw(RuntimeException, std::exception)
diff --git a/connectivity/source/sdbcx/VKey.cxx b/connectivity/source/sdbcx/VKey.cxx
index 59d8206..537d4c2 100644
--- a/connectivity/source/sdbcx/VKey.cxx
+++ b/connectivity/source/sdbcx/VKey.cxx
@@ -171,7 +171,7 @@ Reference< ::com::sun::star::container::XNameAccess > SAL_CALL OKey::getColumns(
// allowed
}
- return const_cast<OKey*>(this)->m_pColumns;
+ return m_pColumns;
}
Reference< XPropertySet > SAL_CALL OKey::createDataDescriptor( ) throw(RuntimeException, std::exception)
diff --git a/connectivity/source/sdbcx/VUser.cxx b/connectivity/source/sdbcx/VUser.cxx
index 4104c25..c80934d 100644
--- a/connectivity/source/sdbcx/VUser.cxx
+++ b/connectivity/source/sdbcx/VUser.cxx
@@ -117,7 +117,7 @@ Reference< XNameAccess > SAL_CALL OUser::getGroups( ) throw(RuntimeException, s
// allowed
}
- return const_cast<OUser*>(this)->m_pGroups;
+ return m_pGroups;
}
commit d9727f1b78cd8f1bec0d6a9cc4bed693e9715328
Author: Stephan Bergmann <sbergman at redhat.com>
Date: Fri May 29 12:04:06 2015 +0200
loplugin:redundantcast: const_cast to same type
Change-Id: Id14155fb1ec81d918490a904e4d0f6d2d67f7885
diff --git a/binaryurp/source/unmarshal.cxx b/binaryurp/source/unmarshal.cxx
index ee996e1..eaeb54b 100644
--- a/binaryurp/source/unmarshal.cxx
+++ b/binaryurp/source/unmarshal.cxx
@@ -83,8 +83,7 @@ std::vector< BinaryAny >::iterator copyMemberValues(
for (sal_Int32 j = 0; j != ctd->nMembers; ++j) {
uno_type_copyData(
static_cast< char * >(buffer) + ctd->pMemberOffsets[j],
- const_cast< void * >(
- i++->getValue(css::uno::TypeDescription(ctd->ppTypeRefs[j]))),
+ i++->getValue(css::uno::TypeDescription(ctd->ppTypeRefs[j])),
ctd->ppTypeRefs[j], 0);
}
return i;
@@ -462,7 +461,7 @@ BinaryAny Unmarshal::readSequence(css::uno::TypeDescription const & type) {
for (sal_uInt32 i = 0; i != n; ++i) {
uno_copyData(
static_cast< sal_Sequence * >(buf)->elements + i * ctd.get()->nSize,
- const_cast< void * >(as[i].getValue(ctd)), ctd.get(), 0);
+ as[i].getValue(ctd), ctd.get(), 0);
}
return BinaryAny(type, &buf);
}
commit f5585675581043d63141c6e33c2518f3ddae21ba
Author: Stephan Bergmann <sbergman at redhat.com>
Date: Fri May 29 12:02:05 2015 +0200
loplugin:redundantcast: Work around OS X memchr bug
...where in C++ memchr does not have exactly the two overloads
void const * memchr(void const *, int, size_t)
void * memchr(void *, int, size_t)
but rather the C
void * memchr(void const *, int, size_t)
shining through (see bugreport.apple.com issue 21128245 "non-conforming memchr
in C++"), which gets in the way of the upcoming improved redundant const_cast
check in loplugin:redundantcast.
Change-Id: I7001e74e03429ef23682d52da28fca435130d775
diff --git a/sal/rtl/strtmpl.cxx b/sal/rtl/strtmpl.cxx
index 1dba94b..58e0758 100644
--- a/sal/rtl/strtmpl.cxx
+++ b/sal/rtl/strtmpl.cxx
@@ -26,7 +26,7 @@
#include <cassert>
#include <limits>
-#include <string.h>
+#include <cstring>
#include <wchar.h>
#include <sal/log.hxx>
#include <rtl/character.hxx>
@@ -387,7 +387,7 @@ sal_Int32 SAL_CALL IMPL_RTL_STRNAME( indexOfChar_WithLength )( const IMPL_RTL_ST
// assert(nLen >= 0);
#if !IMPL_RTL_IS_USTRING
// take advantage of builtin optimisations
- IMPL_RTL_STRCODE* p = static_cast<IMPL_RTL_STRCODE*>(const_cast<void *>(memchr(pStr, c, nLen)));
+ IMPL_RTL_STRCODE* p = static_cast<IMPL_RTL_STRCODE*>(std::memchr(const_cast<IMPL_RTL_STRCODE *>(pStr), c, nLen));
return p ? p - pStr : -1;
#else
const IMPL_RTL_STRCODE* pTempStr = pStr;
More information about the Libreoffice-commits
mailing list