From 4a69849e2fb50cbe3632209c28b9d638bbf878a9 Mon Sep 17 00:00:00 2001 From: Stephan Bergmann Date: Tue, 31 Mar 2015 13:17:08 +0200 Subject: Reduce to static_cast any reinterpret_cast from void pointers Change-Id: I83594c8b6cb1f317b55fe048111edd23f622e1ed --- sw/source/core/bastyp/calc.cxx | 22 +++++++++++----------- sw/source/core/doc/docfmt.cxx | 2 +- sw/source/core/txtnode/swfntcch.cxx | 4 ++-- sw/source/filter/html/htmlforw.cxx | 24 ++++++++++++------------ sw/source/filter/html/htmlplug.cxx | 2 +- sw/source/filter/html/svxcss1.cxx | 22 +++++++++++----------- sw/source/ui/envelp/mailmrge.cxx | 2 +- sw/source/ui/misc/glossary.cxx | 12 ++++++------ sw/source/ui/misc/srtdlg.cxx | 2 +- sw/source/uibase/uno/unofreg.cxx | 2 +- 10 files changed, 47 insertions(+), 47 deletions(-) (limited to 'sw/source') diff --git a/sw/source/core/bastyp/calc.cxx b/sw/source/core/bastyp/calc.cxx index 0801e37bf13e..635fa1857355 100644 --- a/sw/source/core/bastyp/calc.cxx +++ b/sw/source/core/bastyp/calc.cxx @@ -150,23 +150,23 @@ extern "C" { static int SAL_CALL OperatorCompare( const void *pFirst, const void *pSecond) { int nRet = 0; - if( CALC_NAME == reinterpret_cast(pFirst)->eOp ) + if( CALC_NAME == static_cast(pFirst)->eOp ) { - if( CALC_NAME == reinterpret_cast(pSecond)->eOp ) - nRet = reinterpret_cast(pFirst)->pUName->compareTo( - *reinterpret_cast(pSecond)->pUName ); + if( CALC_NAME == static_cast(pSecond)->eOp ) + nRet = static_cast(pFirst)->pUName->compareTo( + *static_cast(pSecond)->pUName ); else - nRet = reinterpret_cast(pFirst)->pUName->compareToAscii( - reinterpret_cast(pSecond)->pName ); + nRet = static_cast(pFirst)->pUName->compareToAscii( + static_cast(pSecond)->pName ); } else { - if( CALC_NAME == reinterpret_cast(pSecond)->eOp ) - nRet = -1 * reinterpret_cast(pSecond)->pUName->compareToAscii( - reinterpret_cast(pFirst)->pName ); + if( CALC_NAME == static_cast(pSecond)->eOp ) + nRet = -1 * static_cast(pSecond)->pUName->compareToAscii( + static_cast(pFirst)->pName ); else - nRet = strcmp( reinterpret_cast(pFirst)->pName, - reinterpret_cast(pSecond)->pName ); + nRet = strcmp( static_cast(pFirst)->pName, + static_cast(pSecond)->pName ); } return nRet; } diff --git a/sw/source/core/doc/docfmt.cxx b/sw/source/core/doc/docfmt.cxx index 367e3867be36..a253811a3655 100644 --- a/sw/source/core/doc/docfmt.cxx +++ b/sw/source/core/doc/docfmt.cxx @@ -1003,7 +1003,7 @@ static bool lcl_SetTxtFmtColl( const SwNodePtr& rpNode, void* pArgs ) if( pCNd == NULL) return true; - sw::DocumentContentOperationsManager::ParaRstFmt* pPara = reinterpret_cast(pArgs); + sw::DocumentContentOperationsManager::ParaRstFmt* pPara = static_cast(pArgs); SwTxtFmtColl* pFmt = static_cast(pPara->pFmtColl); if ( pPara->bReset ) diff --git a/sw/source/core/txtnode/swfntcch.cxx b/sw/source/core/txtnode/swfntcch.cxx index 109ce7af8872..b705bbfc0951 100644 --- a/sw/source/core/txtnode/swfntcch.cxx +++ b/sw/source/core/txtnode/swfntcch.cxx @@ -45,7 +45,7 @@ SwFontObj::~SwFontObj() SwFontAccess::SwFontAccess( const void *pOwn, SwViewShell *pSh ) : SwCacheAccess( *pSwFontCache, pOwn, - reinterpret_cast(pOwn)->IsInSwFntCache() ), + static_cast(pOwn)->IsInSwFntCache() ), pShell( pSh ) { } @@ -57,7 +57,7 @@ SwFontObj *SwFontAccess::Get( ) SwCacheObj *SwFontAccess::NewObj( ) { - const_cast(reinterpret_cast(pOwner))->SetInSwFntCache( true ); + const_cast(static_cast(pOwner))->SetInSwFntCache( true ); return new SwFontObj( pOwner, pShell ); } diff --git a/sw/source/filter/html/htmlforw.cxx b/sw/source/filter/html/htmlforw.cxx index 0de130123d88..f2df878e90cf 100644 --- a/sw/source/filter/html/htmlforw.cxx +++ b/sw/source/filter/html/htmlforw.cxx @@ -465,7 +465,7 @@ void SwHTMLWriter::OutForm( bool bOn, uno::Any aTmp = xFormPropSet->getPropertyValue( "Name" ); if( aTmp.getValueType() == ::cppu::UnoType::get() && - !reinterpret_cast(aTmp.getValue())->isEmpty() ) + !static_cast(aTmp.getValue())->isEmpty() ) { sOut += " " + OString(OOO_STRING_SVTOOLS_HTML_O_name) + "=\""; Strm().WriteOString( sOut ); @@ -476,7 +476,7 @@ void SwHTMLWriter::OutForm( bool bOn, aTmp = xFormPropSet->getPropertyValue( "TargetURL" ); if( aTmp.getValueType() == ::cppu::UnoType::get() && - !reinterpret_cast(aTmp.getValue())->isEmpty() ) + !static_cast(aTmp.getValue())->isEmpty() ) { sOut += " " + OString(OOO_STRING_SVTOOLS_HTML_O_action) + "=\""; Strm().WriteOString( sOut ); @@ -524,7 +524,7 @@ void SwHTMLWriter::OutForm( bool bOn, aTmp = xFormPropSet->getPropertyValue( "TargetFrame" ); if( aTmp.getValueType() == ::cppu::UnoType::get()&& - !reinterpret_cast(aTmp.getValue())->isEmpty() ) + !static_cast(aTmp.getValue())->isEmpty() ) { sOut += " " + OString(OOO_STRING_SVTOOLS_HTML_O_target) + "=\""; Strm().WriteOString( sOut ); @@ -598,7 +598,7 @@ void SwHTMLWriter::OutHiddenControls( aTmp = xPropSet->getPropertyValue( "Name" ); if( aTmp.getValueType() == ::cppu::UnoType::get() && - !reinterpret_cast(aTmp.getValue())->isEmpty() ) + !static_cast(aTmp.getValue())->isEmpty() ) { sOut += " " + OString(OOO_STRING_SVTOOLS_HTML_O_name) + "=\""; Strm().WriteOString( sOut ); @@ -608,7 +608,7 @@ void SwHTMLWriter::OutHiddenControls( } aTmp = xPropSet->getPropertyValue( "HiddenValue" ); if( aTmp.getValueType() == ::cppu::UnoType::get() && - !reinterpret_cast(aTmp.getValue())->isEmpty() ) + !static_cast(aTmp.getValue())->isEmpty() ) { sOut += " " + OString(OOO_STRING_SVTOOLS_HTML_O_value) + "=\""; Strm().WriteOString( sOut ); @@ -778,7 +778,7 @@ Writer& OutHTML_DrawFrmFmtAsControl( Writer& rWrt, aTmp = xPropSet->getPropertyValue( "Label" ); if( aTmp.getValueType() == ::cppu::UnoType::get() && - !reinterpret_cast(aTmp.getValue())->isEmpty() ) + !static_cast(aTmp.getValue())->isEmpty() ) { sValue = *static_cast(aTmp.getValue()); } @@ -888,7 +888,7 @@ Writer& OutHTML_DrawFrmFmtAsControl( Writer& rWrt, { aTmp = xPropSet->getPropertyValue( "DefaultText" ); if( aTmp.getValueType() == ::cppu::UnoType::get() && - !reinterpret_cast(aTmp.getValue())->isEmpty() ) + !static_cast(aTmp.getValue())->isEmpty() ) { sValue = *static_cast(aTmp.getValue()); } @@ -935,7 +935,7 @@ Writer& OutHTML_DrawFrmFmtAsControl( Writer& rWrt, aTmp = xPropSet->getPropertyValue("Name"); if( aTmp.getValueType() == ::cppu::UnoType::get() && - !reinterpret_cast(aTmp.getValue())->isEmpty() ) + !static_cast(aTmp.getValue())->isEmpty() ) { sOut += " " + OString(OOO_STRING_SVTOOLS_HTML_O_name) + "=\""; rWrt.Strm().WriteOString( sOut ); @@ -965,7 +965,7 @@ Writer& OutHTML_DrawFrmFmtAsControl( Writer& rWrt, { aTmp = xPropSet->getPropertyValue( "ImageURL" ); if( aTmp.getValueType() == ::cppu::UnoType::get() && - !reinterpret_cast(aTmp.getValue())->isEmpty() ) + !static_cast(aTmp.getValue())->isEmpty() ) { sOut += " " + OString(OOO_STRING_SVTOOLS_HTML_O_src) + "=\""; rWrt.Strm().WriteOString( sOut ); @@ -1073,7 +1073,7 @@ Writer& OutHTML_DrawFrmFmtAsControl( Writer& rWrt, { aTmp = xPropSet->getPropertyValue( "FontName" ); if( aTmp.getValueType() == ::cppu::UnoType::get() && - !reinterpret_cast(aTmp.getValue())->isEmpty() ) + !static_cast(aTmp.getValue())->isEmpty() ) { vcl::Font aFixedFont( OutputDevice::GetDefaultFont( DEFAULTFONT_FIXED, LANGUAGE_ENGLISH_US, @@ -1233,7 +1233,7 @@ Writer& OutHTML_DrawFrmFmtAsControl( Writer& rWrt, OUString sVal; aTmp = xPropSet->getPropertyValue( "DefaultText" ); if( aTmp.getValueType() == ::cppu::UnoType::get()&& - !reinterpret_cast(aTmp.getValue())->isEmpty() ) + !static_cast(aTmp.getValue())->isEmpty() ) { sVal = *static_cast(aTmp.getValue()); } @@ -1256,7 +1256,7 @@ Writer& OutHTML_DrawFrmFmtAsControl( Writer& rWrt, { aTmp = xPropSet->getPropertyValue("Label"); if( aTmp.getValueType() == ::cppu::UnoType::get() && - !reinterpret_cast(aTmp.getValue())->isEmpty() ) + !static_cast(aTmp.getValue())->isEmpty() ) { sValue = *static_cast(aTmp.getValue()); HTMLOutFuncs::Out_String( rWrt.Strm(), sValue, diff --git a/sw/source/filter/html/htmlplug.cxx b/sw/source/filter/html/htmlplug.cxx index f6890bf16471..96670fbf770b 100644 --- a/sw/source/filter/html/htmlplug.cxx +++ b/sw/source/filter/html/htmlplug.cxx @@ -1290,7 +1290,7 @@ Writer& OutHTML_FrmFmtOLENodeGrf( Writer& rWrt, const SwFrmFmt& rFrmFmt, aMediaDescriptor["FilterOptions"] <<= OUString("SkipHeaderFooter"); aMediaDescriptor["OutputStream"] <<= xOutputStream; xStorable->storeToURL("private:stream", aMediaDescriptor.getAsConstPropertyValueList()); - OString aData(reinterpret_cast(aStream.GetData()), aStream.GetSize()); + OString aData(static_cast(aStream.GetData()), aStream.GetSize()); // Wrap output in a tag to avoid 'HTML parser error: Unexpected end tag: p' HTMLOutFuncs::Out_AsciiTag(rWrt.Strm(), OOO_STRING_SVTOOLS_HTML_span); rWrt.Strm().WriteCharPtr(aData.getStr()); diff --git a/sw/source/filter/html/svxcss1.cxx b/sw/source/filter/html/svxcss1.cxx index 2bea7b58fc15..2f97dc1d750e 100644 --- a/sw/source/filter/html/svxcss1.cxx +++ b/sw/source/filter/html/svxcss1.cxx @@ -3137,23 +3137,23 @@ extern "C" static int SAL_CALL CSS1PropEntryCompare( const void *pFirst, const void *pSecond) { int nRet; - if( reinterpret_cast(pFirst)->pFunc ) + if( static_cast(pFirst)->pFunc ) { - if( reinterpret_cast(pSecond)->pFunc ) - nRet = strcmp( reinterpret_cast(pFirst)->sName , - reinterpret_cast(pSecond)->sName ); + if( static_cast(pSecond)->pFunc ) + nRet = strcmp( static_cast(pFirst)->sName , + static_cast(pSecond)->sName ); else - nRet = -1 * reinterpret_cast(pSecond)->pName->compareToAscii( - reinterpret_cast(pFirst)->sName ); + nRet = -1 * static_cast(pSecond)->pName->compareToAscii( + static_cast(pFirst)->sName ); } else { - if( reinterpret_cast(pSecond)->pFunc ) - nRet = reinterpret_cast(pFirst)->pName->compareToAscii( - reinterpret_cast(pSecond)->sName ); + if( static_cast(pSecond)->pFunc ) + nRet = static_cast(pFirst)->pName->compareToAscii( + static_cast(pSecond)->sName ); else - nRet = reinterpret_cast(pFirst)->pName->compareTo( - *reinterpret_cast(pSecond)->pName ); + nRet = static_cast(pFirst)->pName->compareTo( + *static_cast(pSecond)->pName ); } return nRet; diff --git a/sw/source/ui/envelp/mailmrge.cxx b/sw/source/ui/envelp/mailmrge.cxx index 8808098a5c16..7316fb8022b3 100644 --- a/sw/source/ui/envelp/mailmrge.cxx +++ b/sw/source/ui/envelp/mailmrge.cxx @@ -397,7 +397,7 @@ SwMailMergeDlg::~SwMailMergeDlg() for( sal_Int32 nFilter = 0; nFilter < m_pFilterLB->GetEntryCount(); ++nFilter ) { - OUString* pData = reinterpret_cast< OUString* >( m_pFilterLB->GetEntryData(nFilter) ); + OUString* pData = static_cast< OUString* >( m_pFilterLB->GetEntryData(nFilter) ); delete pData; } delete pImpl; diff --git a/sw/source/ui/misc/glossary.cxx b/sw/source/ui/misc/glossary.cxx index 4e398a8f83d4..ffecd29ab37a 100644 --- a/sw/source/ui/misc/glossary.cxx +++ b/sw/source/ui/misc/glossary.cxx @@ -257,7 +257,7 @@ IMPL_LINK( SwGlossaryDlg, GrpSelect, SvTreeListBox *, pBox ) { OUString aName(pBox->GetEntryText(pEntry)); m_pNameED->SetText(aName); - m_pShortNameEdit->SetText(*reinterpret_cast(pEntry->GetUserData())); + m_pShortNameEdit->SetText(*static_cast(pEntry->GetUserData())); m_pInsertBtn->Enable( !bIsDocReadOnly); ShowAutoText(::GetCurrGlosGroup(), m_pShortNameEdit->GetText()); } @@ -325,7 +325,7 @@ SvTreeListEntry* SwGlossaryDlg::DoesBlockExist(const OUString& rBlock, SvTreeListEntry* pChild = m_pCategoryBox->GetEntry( pEntry, i ); if (rBlock == m_pCategoryBox->GetEntryText(pChild) && (rShort.isEmpty() || - rShort==*reinterpret_cast(pChild->GetUserData())) + rShort==*static_cast(pChild->GetUserData())) ) { return pChild; @@ -479,7 +479,7 @@ IMPL_LINK( SwGlossaryDlg, MenuHdl, Menu *, pMn ) SvTreeListEntry* pNewEntry = m_pCategoryBox->InsertEntry( pNewNameDlg->GetNewName(), m_pCategoryBox->GetParent(pEntry)); pNewEntry->SetUserData(new OUString(pNewNameDlg->GetNewShort())); - delete reinterpret_cast(pEntry->GetUserData()); + delete static_cast(pEntry->GetUserData()); m_pCategoryBox->GetModel()->Remove(pEntry); m_pCategoryBox->Select(pNewEntry); m_pCategoryBox->MakeVisible(pNewEntry); @@ -830,7 +830,7 @@ void SwGlTreeListBox::Clear() while(pEntry) { if(GetParent(pEntry)) - delete reinterpret_cast(pEntry->GetUserData()); + delete static_cast(pEntry->GetUserData()); else delete static_cast(pEntry->GetUserData()); pEntry = Next(pEntry); @@ -877,7 +877,7 @@ void SwGlTreeListBox::RequestHelp( const HelpEvent& rHEvt ) } } else - sMsg = *reinterpret_cast(pEntry->GetUserData()); + sMsg = *static_cast(pEntry->GetUserData()); Help::ShowQuickHelp( this, aItemRect, sMsg, QUICKHELP_LEFT|QUICKHELP_VCENTER ); } @@ -968,7 +968,7 @@ TriState SwGlTreeListBox::NotifyCopyingOrMoving( pDlg->pGlossaryHdl->SetCurGroup(sSourceGroup); OUString sTitle(GetEntryText(pEntry)); - OUString sShortName(*reinterpret_cast(pEntry->GetUserData())); + OUString sShortName(*static_cast(pEntry->GetUserData())); GroupUserData* pDestData = static_cast(pDestParent->GetUserData()); OUString sDestName = pDestData->sGroupName diff --git a/sw/source/ui/misc/srtdlg.cxx b/sw/source/ui/misc/srtdlg.cxx index dba258bb5d58..3c58114764b1 100644 --- a/sw/source/ui/misc/srtdlg.cxx +++ b/sw/source/ui/misc/srtdlg.cxx @@ -73,7 +73,7 @@ static void lcl_ClearLstBoxAndDelUserData( ListBox& rLstBox ) const sal_Int32 nEnd = rLstBox.GetEntryCount(); for( sal_Int32 n = 0; n < nEnd; ++n ) { - delete reinterpret_cast(rLstBox.GetEntryData( n )); + delete static_cast(rLstBox.GetEntryData( n )); } rLstBox.Clear(); } diff --git a/sw/source/uibase/uno/unofreg.cxx b/sw/source/uibase/uno/unofreg.cxx index 4ad389bc3e09..9b455f335fcf 100644 --- a/sw/source/uibase/uno/unofreg.cxx +++ b/sw/source/uibase/uno/unofreg.cxx @@ -50,7 +50,7 @@ SAL_DLLPUBLIC_EXPORT void * SAL_CALL sw_component_getFactory( if( pServiceManager ) { uno::Reference< XMultiServiceFactory > xMSF( - reinterpret_cast< XMultiServiceFactory * >( pServiceManager ) ); + static_cast< XMultiServiceFactory * >( pServiceManager ) ); uno::Reference< XSingleServiceFactory > xFactory; -- cgit