From 2db379e22a7854dc16cc0066af70f16d5662d7e8 Mon Sep 17 00:00:00 2001 From: Caolán McNamara Date: Mon, 11 May 2015 09:18:16 +0100 Subject: cppcheck: cstyleCast Change-Id: Id3ffa264ba7990b53d264745eaf0726f1468577b --- sw/source/core/text/porglue.cxx | 4 ++-- sw/source/core/text/porlay.cxx | 6 +++--- sw/source/core/text/txtfld.cxx | 4 ++-- sw/source/core/text/txtftn.cxx | 2 +- sw/source/filter/ww8/rtfexport.cxx | 2 +- sw/source/filter/ww8/wrtw8num.cxx | 2 +- sw/source/filter/ww8/ww8par.cxx | 2 +- sw/source/filter/ww8/ww8par3.cxx | 4 ++-- sw/source/filter/ww8/ww8par5.cxx | 2 +- sw/source/uibase/docvw/edtwin.cxx | 10 +++++----- sw/source/uibase/uno/unotxdoc.cxx | 2 +- vcl/source/window/accel.cxx | 4 ++-- vcl/source/window/menu.cxx | 12 ++++++------ vcl/source/window/menubarwindow.cxx | 2 +- vcl/source/window/menufloatingwindow.cxx | 2 +- 15 files changed, 30 insertions(+), 30 deletions(-) diff --git a/sw/source/core/text/porglue.cxx b/sw/source/core/text/porglue.cxx index a0e5af1b4513..bcad1ebb2a59 100644 --- a/sw/source/core/text/porglue.cxx +++ b/sw/source/core/text/porglue.cxx @@ -169,7 +169,7 @@ void SwMarginPortion::AdjustRight( const SwLineLayout *pCurr ) { // 1) We search for the left Glue - SwLinePortion *pPos = (SwLinePortion*)this; + SwLinePortion *pPos = this; SwGluePortion *pLeft = 0; while( pPos ) { @@ -254,7 +254,7 @@ void SwMarginPortion::AdjustRight( const SwLineLayout *pCurr ) } } // If no left Glue remaines we set the break condition. - pRight = pLeft ? pLeft : (SwGluePortion*)this; + pRight = pLeft ? pLeft : this; } } diff --git a/sw/source/core/text/porlay.cxx b/sw/source/core/text/porlay.cxx index 0fad655ed38b..a450b2a177db 100644 --- a/sw/source/core/text/porlay.cxx +++ b/sw/source/core/text/porlay.cxx @@ -139,7 +139,7 @@ SwLinePortion *SwLineLayout::Insert( SwLinePortion *pIns ) { if( GetLen() ) { - pPortion = new SwTxtPortion( *(SwLinePortion*)this ); + pPortion = new SwTxtPortion(*this); if( IsBlinking() && pBlink ) { SetBlinking( false ); @@ -161,7 +161,7 @@ SwLinePortion *SwLineLayout::Append( SwLinePortion *pIns ) // First attribute change: copy mass and length from *pIns into the first // text portion if( !pPortion ) - pPortion = new SwTxtPortion( *(SwLinePortion*)this ); + pPortion = new SwTxtPortion(*this); // Call with scope or we'll end up with recursion! return pPortion->SwLinePortion::Append( pIns ); } @@ -184,7 +184,7 @@ SwMarginPortion *SwLineLayout::CalcLeftMargin() SwMarginPortion *pLeft = (GetPortion() && GetPortion()->IsMarginPortion()) ? static_cast(GetPortion()) : 0; if( !GetPortion() ) - SetPortion( new SwTxtPortion( *(SwLinePortion*)this ) ); + SetPortion(new SwTxtPortion(*this)); if( !pLeft ) { pLeft = new SwMarginPortion( 0 ); diff --git a/sw/source/core/text/txtfld.cxx b/sw/source/core/text/txtfld.cxx index 5741651dbed7..39bbdc9c6712 100644 --- a/sw/source/core/text/txtfld.cxx +++ b/sw/source/core/text/txtfld.cxx @@ -72,7 +72,7 @@ SwExpandPortion *SwTxtFormatter::NewFldPortion( SwTxtFormatInfo &rInf, const SwTxtAttr *pHint ) const { SwExpandPortion *pRet = 0; - SwFrm *pFrame = (SwFrm*)pFrm; + SwFrm *pFrame = pFrm; SwField *pFld = const_cast(pHint->GetFmtFld().GetField()); const bool bName = rInf.GetOpt().IsFldName(); @@ -478,7 +478,7 @@ SwNumberPortion *SwTxtFormatter::NewNumberPortion( SwTxtFormatInfo &rInf ) const if( SVX_NUM_BITMAP == rNumFmt.GetNumberingType() ) { - pRet = new SwGrfNumPortion( (SwFrm*)GetTxtFrm(), + pRet = new SwGrfNumPortion( const_cast(GetTxtFrm()), pTxtNd->GetLabelFollowedBy(), rNumFmt.GetBrush(), rNumFmt.GetGraphicOrientation(), diff --git a/sw/source/core/text/txtftn.cxx b/sw/source/core/text/txtftn.cxx index 9505b649538b..f5be1d3288f1 100644 --- a/sw/source/core/text/txtftn.cxx +++ b/sw/source/core/text/txtftn.cxx @@ -812,7 +812,7 @@ SwFtnPortion *SwTxtFormatter::NewFtnPortion( SwTxtFormatInfo &rInf, sal_uInt16 nOldReal = pCurr->GetRealHeight(); sal_uInt16 nOldAscent = pCurr->GetAscent(); sal_uInt16 nOldHeight = pCurr->Height(); - ((SwTxtFormatter*)this)->CalcRealHeight(); + CalcRealHeight(); nReal = pCurr->GetRealHeight(); if( nReal < nOldReal ) nReal = nOldReal; diff --git a/sw/source/filter/ww8/rtfexport.cxx b/sw/source/filter/ww8/rtfexport.cxx index e49d52e9b1be..718d5527fe94 100644 --- a/sw/source/filter/ww8/rtfexport.cxx +++ b/sw/source/filter/ww8/rtfexport.cxx @@ -209,7 +209,7 @@ void RtfExport::BuildNumbering() SwNumRule* pRule; --n; if (n == rListTbl.size()) - pRule = (SwNumRule*)m_pDoc->GetOutlineNumRule(); + pRule = m_pDoc->GetOutlineNumRule(); else { pRule = rListTbl[ n ]; diff --git a/sw/source/filter/ww8/wrtw8num.cxx b/sw/source/filter/ww8/wrtw8num.cxx index 106df4478dad..bc14531c74f7 100644 --- a/sw/source/filter/ww8/wrtw8num.cxx +++ b/sw/source/filter/ww8/wrtw8num.cxx @@ -95,7 +95,7 @@ sal_uInt16 MSWordExportBase::GetId( const SwNumRule& rNumRule ) if ( !bOutlineRuleAdded ) { // still need to paste the OutlineRule - SwNumRule* pR = (SwNumRule*)m_pDoc->GetOutlineNumRule(); + SwNumRule* pR = m_pDoc->GetOutlineNumRule(); m_pUsedNumTbl->push_back( pR ); } } diff --git a/sw/source/filter/ww8/ww8par.cxx b/sw/source/filter/ww8/ww8par.cxx index ebf8095e6e37..95f0f30f7025 100644 --- a/sw/source/filter/ww8/ww8par.cxx +++ b/sw/source/filter/ww8/ww8par.cxx @@ -4046,7 +4046,7 @@ bool SwWW8ImplReader::ReadText(long nStartCp, long nTextLen, ManTypes nType) if(m_pAktItemSet && !pFmt) { OUString sPrefix(OUStringBuffer("WW8Dropcap").append(m_nDropCap++).makeStringAndClear()); - pNewSwCharFmt = m_rDoc.MakeCharFmt(sPrefix, (SwCharFmt*)m_rDoc.GetDfltCharFmt()); + pNewSwCharFmt = m_rDoc.MakeCharFmt(sPrefix, m_rDoc.GetDfltCharFmt()); m_pAktItemSet->ClearItem(RES_CHRATR_ESCAPEMENT); pNewSwCharFmt->SetFmtAttr( *m_pAktItemSet ); } diff --git a/sw/source/filter/ww8/ww8par3.cxx b/sw/source/filter/ww8/ww8par3.cxx index b269eccb5edb..63c84f0046a0 100644 --- a/sw/source/filter/ww8/ww8par3.cxx +++ b/sw/source/filter/ww8/ww8par3.cxx @@ -1053,7 +1053,7 @@ void WW8ListManager::AdjustLVL( sal_uInt8 nLevel, SwNumRule& rNumRule, + "z" + OUString::number( nLevel ) ); // const Wegcasten - pFmt = rDoc.MakeCharFmt(aName, (SwCharFmt*)rDoc.GetDfltCharFmt()); + pFmt = rDoc.MakeCharFmt(aName, rDoc.GetDfltCharFmt()); bNewCharFmtCreated = true; // Attribute reinsetzen pFmt->SetFmtAttr( *pThisLevelItemSet ); @@ -1080,7 +1080,7 @@ void WW8ListManager::AdjustLVL( sal_uInt8 nLevel, SwNumRule& rNumRule, const OUString aName( (!sPrefix.isEmpty() ? sPrefix : rNumRule.GetName()) + "z" + OUString::number( nLevel ) ); - pFmt = rDoc.MakeCharFmt(aName, (SwCharFmt*)rDoc.GetDfltCharFmt()); + pFmt = rDoc.MakeCharFmt(aName, rDoc.GetDfltCharFmt()); bNewCharFmtCreated = true; rCharFmt[ nLevel ] = pFmt; aNumFmt.SetCharFmt( pFmt ); diff --git a/sw/source/filter/ww8/ww8par5.cxx b/sw/source/filter/ww8/ww8par5.cxx index 0d11bd9ff2b6..1192fd434343 100644 --- a/sw/source/filter/ww8/ww8par5.cxx +++ b/sw/source/filter/ww8/ww8par5.cxx @@ -2654,7 +2654,7 @@ void SwWW8ImplReader::Read_SubF_Ruby( WW8ReadFieldParams& rReadParam) //Take this as the base name SwStyleNameMapper::FillUIName(RES_POOLCHR_RUBYTEXT,aNm); aNm+=OUString::number(m_aRubyCharFmts.size()+1); - pFmt = m_rDoc.MakeCharFmt(aNm,(SwCharFmt*)m_rDoc.GetDfltCharFmt()); + pFmt = m_rDoc.MakeCharFmt(aNm, m_rDoc.GetDfltCharFmt()); SvxFontHeightItem aHeightItem(nFontSize*10, 100, RES_CHRATR_FONTSIZE); SvxFontItem aFontItem(FAMILY_DONTKNOW,sFontName, OUString(), PITCH_DONTKNOW, RTL_TEXTENCODING_DONTKNOW, RES_CHRATR_FONT); diff --git a/sw/source/uibase/docvw/edtwin.cxx b/sw/source/uibase/docvw/edtwin.cxx index df4cf18118c7..663395e6c63d 100644 --- a/sw/source/uibase/docvw/edtwin.cxx +++ b/sw/source/uibase/docvw/edtwin.cxx @@ -5394,15 +5394,15 @@ void SwEditWin::Command( const CommandEvent& rCEvt ) case COMMAND_PREPARERECONVERSION: if( rSh.HasSelection() ) { - SwPaM *pCrsr = (SwPaM*)rSh.GetCrsr(); + SwPaM *pCrsr = rSh.GetCrsr(); if( rSh.IsMultiSelection() ) { - if( pCrsr && !pCrsr->HasMark() && - pCrsr->GetPoint() == pCrsr->GetMark() ) + if (pCrsr && !pCrsr->HasMark() && + pCrsr->GetPoint() == pCrsr->GetMark()) { - rSh.GoPrevCrsr(); - pCrsr = (SwPaM*)rSh.GetCrsr(); + rSh.GoPrevCrsr(); + pCrsr = rSh.GetCrsr(); } // Cancel all selections other than the last selected one. diff --git a/sw/source/uibase/uno/unotxdoc.cxx b/sw/source/uibase/uno/unotxdoc.cxx index 59c5230248cd..c86e8d19a228 100644 --- a/sw/source/uibase/uno/unotxdoc.cxx +++ b/sw/source/uibase/uno/unotxdoc.cxx @@ -2189,7 +2189,7 @@ Reference< XNameAccess > SwXTextDocument::getLinks() throw( RuntimeException, s if(!pxLinkTargetSupplier) { pxLinkTargetSupplier = new Reference< XNameAccess > ; - (*pxLinkTargetSupplier) = new SwXLinkTargetSupplier(*(SwXTextDocument*)this); + (*pxLinkTargetSupplier) = new SwXLinkTargetSupplier(*this); } return (*pxLinkTargetSupplier); } diff --git a/vcl/source/window/accel.cxx b/vcl/source/window/accel.cxx index 99fea0983520..5f8dc36fa3d9 100644 --- a/vcl/source/window/accel.cxx +++ b/vcl/source/window/accel.cxx @@ -261,7 +261,7 @@ Accelerator::Accelerator( const Accelerator& rAccel ) : ImplInit(); mpData = new ImplAccelData; - ImplCopyData( *((ImplAccelData*)(rAccel.mpData)) ); + ImplCopyData(*rAccel.mpData); } Accelerator::Accelerator( const ResId& rResId ) @@ -399,7 +399,7 @@ Accelerator& Accelerator::operator=( const Accelerator& rAccel ) // delete and copy tables ImplDeleteData(); mpData->maKeyMap.clear(); - ImplCopyData( *((ImplAccelData*)(rAccel.mpData)) ); + ImplCopyData(*rAccel.mpData); return *this; } diff --git a/vcl/source/window/menu.cxx b/vcl/source/window/menu.cxx index 3560c6c48dd6..8a40d84ce2e4 100644 --- a/vcl/source/window/menu.cxx +++ b/vcl/source/window/menu.cxx @@ -2584,7 +2584,7 @@ bool MenuBar::HandleMenuActivateEvent( Menu *pMenu ) const { ImplMenuDelData aDelData( this ); - pMenu->pStartedFrom = (Menu*)this; + pMenu->pStartedFrom = const_cast(this); pMenu->bInCallback = true; pMenu->Activate(); @@ -2600,7 +2600,7 @@ bool MenuBar::HandleMenuDeActivateEvent( Menu *pMenu ) const { ImplMenuDelData aDelData( this ); - pMenu->pStartedFrom = (Menu*)this; + pMenu->pStartedFrom = const_cast(this); pMenu->bInCallback = true; pMenu->Deactivate(); if( !aDelData.isDeleted() ) @@ -2612,7 +2612,7 @@ bool MenuBar::HandleMenuDeActivateEvent( Menu *pMenu ) const bool MenuBar::HandleMenuHighlightEvent( Menu *pMenu, sal_uInt16 nHighlightEventId ) const { if( !pMenu ) - pMenu = ((Menu*) this)->ImplFindMenu( nHighlightEventId ); + pMenu = const_cast(this)->ImplFindMenu(nHighlightEventId); if( pMenu ) { ImplMenuDelData aDelData( pMenu ); @@ -2624,7 +2624,7 @@ bool MenuBar::HandleMenuHighlightEvent( Menu *pMenu, sal_uInt16 nHighlightEventI { pMenu->mnHighlightedItemPos = pMenu->GetItemPos( nHighlightEventId ); pMenu->nSelectedId = nHighlightEventId; - pMenu->pStartedFrom = (Menu*)this; + pMenu->pStartedFrom = const_cast(this); pMenu->ImplCallHighlight( pMenu->mnHighlightedItemPos ); } return true; @@ -2636,11 +2636,11 @@ bool MenuBar::HandleMenuHighlightEvent( Menu *pMenu, sal_uInt16 nHighlightEventI bool MenuBar::HandleMenuCommandEvent( Menu *pMenu, sal_uInt16 nCommandEventId ) const { if( !pMenu ) - pMenu = ((Menu*) this)->ImplFindMenu( nCommandEventId ); + pMenu = const_cast(this)->ImplFindMenu(nCommandEventId); if( pMenu ) { pMenu->nSelectedId = nCommandEventId; - pMenu->pStartedFrom = (Menu*)this; + pMenu->pStartedFrom = const_cast(this); pMenu->ImplSelect(); return true; } diff --git a/vcl/source/window/menubarwindow.cxx b/vcl/source/window/menubarwindow.cxx index 9acf9f742e7e..6a8de205b0de 100644 --- a/vcl/source/window/menubarwindow.cxx +++ b/vcl/source/window/menubarwindow.cxx @@ -793,7 +793,7 @@ bool MenuBarWindow::HandleKeyEvent( const KeyEvent& rKEvent, bool bFromMenu ) n = 0; } - MenuItemData* pData = (MenuItemData*)pMenu->GetItemList()->GetDataFromPos( n ); + MenuItemData* pData = pMenu->GetItemList()->GetDataFromPos( n ); if ( ( pData->eType != MenuItemType::SEPARATOR ) && pMenu->ImplIsVisible( n ) ) { bool bDoSelect = true; diff --git a/vcl/source/window/menufloatingwindow.cxx b/vcl/source/window/menufloatingwindow.cxx index 247821ce6639..d188bca2b5a9 100644 --- a/vcl/source/window/menufloatingwindow.cxx +++ b/vcl/source/window/menufloatingwindow.cxx @@ -898,7 +898,7 @@ void MenuFloatingWindow::ImplCursorUpDown( bool bUp, bool bHomeEnd ) } } - MenuItemData* pData = (MenuItemData*)pMenu->GetItemList()->GetDataFromPos( n ); + MenuItemData* pData = pMenu->GetItemList()->GetDataFromPos( n ); if ( ( pData->bEnabled || !rSettings.GetSkipDisabledInMenus() ) && ( pData->eType != MenuItemType::SEPARATOR ) && pMenu->ImplIsVisible( n ) && pMenu->ImplIsSelectable( n ) ) { -- cgit