Kaydet (Commit) 65e9940d authored tarafından Stephan Bergmann's avatar Stephan Bergmann

Clean up C-style casts from pointers to void

Change-Id: I717c260ecdc378a9fd33494f2b98eccec0417d66
üst 8d6c8d7f
...@@ -117,7 +117,7 @@ struct SfxType ...@@ -117,7 +117,7 @@ struct SfxType
const TypeId& Type() const const TypeId& Type() const
{ return aTypeId; } { return aTypeId; }
SfxPoolItem* CreateItem() const SfxPoolItem* CreateItem() const
{ return (SfxPoolItem*) aTypeId(); } { return static_cast<SfxPoolItem*>(aTypeId()); }
}; };
struct SfxType0 struct SfxType0
...@@ -128,7 +128,7 @@ struct SfxType0 ...@@ -128,7 +128,7 @@ struct SfxType0
const TypeId& Type() const const TypeId& Type() const
{ return aTypeId; } { return aTypeId; }
SfxPoolItem* CreateItem() const SfxPoolItem* CreateItem() const
{ return (SfxPoolItem*) aTypeId(); } { return static_cast<SfxPoolItem*>(aTypeId()); }
}; };
#define SFX_DECL_TYPE(n) struct SfxType##n \ #define SFX_DECL_TYPE(n) struct SfxType##n \
...@@ -211,7 +211,7 @@ struct SfxFormalArgument ...@@ -211,7 +211,7 @@ struct SfxFormalArgument
const TypeId& Type() const const TypeId& Type() const
{ return pType->aTypeId; } { return pType->aTypeId; }
SfxPoolItem* CreateItem() const SfxPoolItem* CreateItem() const
{ return (SfxPoolItem*) pType->aTypeId(); } { return static_cast<SfxPoolItem*>(pType->aTypeId()); }
}; };
......
...@@ -173,7 +173,7 @@ bool SvFileObject::GetData( ::com::sun::star::uno::Any & rData, ...@@ -173,7 +173,7 @@ bool SvFileObject::GetData( ::com::sun::star::uno::Any & rData,
aMeta.Write( aMemStm ); aMeta.Write( aMemStm );
} }
} }
rData <<= css::uno::Sequence< sal_Int8 >( (sal_Int8*) aMemStm.GetData(), rData <<= css::uno::Sequence< sal_Int8 >( static_cast<sal_Int8 const *>(aMemStm.GetData()),
aMemStm.Seek( STREAM_SEEK_TO_END ) ); aMemStm.Seek( STREAM_SEEK_TO_END ) );
bNativFormat = bOldNativFormat; bNativFormat = bOldNativFormat;
......
...@@ -325,7 +325,7 @@ IMPL_LINK( SvDDEObject, ImplGetDDEData, DdeData*, pData ) ...@@ -325,7 +325,7 @@ IMPL_LINK( SvDDEObject, ImplGetDDEData, DdeData*, pData )
default: default:
{ {
const sal_Char* p = (sal_Char*)( pData->operator const void*() ); const sal_Char* p = static_cast<sal_Char const *>(pData->operator const void*());
long nLen = SotClipboardFormatId::STRING == nFmt ? (p ? strlen( p ) : 0) : (long)*pData; long nLen = SotClipboardFormatId::STRING == nFmt ? (p ? strlen( p ) : 0) : (long)*pData;
Sequence< sal_Int8 > aSeq( reinterpret_cast<const sal_Int8*>(p), nLen ); Sequence< sal_Int8 > aSeq( reinterpret_cast<const sal_Int8*>(p), nLen );
......
...@@ -308,7 +308,7 @@ ContentListBox_Impl::~ContentListBox_Impl() ...@@ -308,7 +308,7 @@ ContentListBox_Impl::~ContentListBox_Impl()
while ( pEntry ) while ( pEntry )
{ {
ClearChildren( pEntry ); ClearChildren( pEntry );
delete (ContentEntry_Impl*)pEntry->GetUserData(); delete static_cast<ContentEntry_Impl*>(pEntry->GetUserData());
pEntry = GetEntry( nPos++ ); pEntry = GetEntry( nPos++ );
} }
} }
...@@ -341,7 +341,7 @@ void ContentListBox_Impl::ClearChildren( SvTreeListEntry* pParent ) ...@@ -341,7 +341,7 @@ void ContentListBox_Impl::ClearChildren( SvTreeListEntry* pParent )
while ( pEntry ) while ( pEntry )
{ {
ClearChildren( pEntry ); ClearChildren( pEntry );
delete (ContentEntry_Impl*)pEntry->GetUserData(); delete static_cast<ContentEntry_Impl*>(pEntry->GetUserData());
pEntry = NextSibling( pEntry ); pEntry = NextSibling( pEntry );
} }
} }
...@@ -356,7 +356,7 @@ void ContentListBox_Impl::RequestingChildren( SvTreeListEntry* pParent ) ...@@ -356,7 +356,7 @@ void ContentListBox_Impl::RequestingChildren( SvTreeListEntry* pParent )
{ {
if ( pParent->GetUserData() ) if ( pParent->GetUserData() )
{ {
OUString aTmpURL( ( (ContentEntry_Impl*)pParent->GetUserData() )->aURL ); OUString aTmpURL( static_cast<ContentEntry_Impl*>(pParent->GetUserData())->aURL );
std::vector<OUString > aList = std::vector<OUString > aList =
SfxContentHelper::GetHelpTreeViewContents( aTmpURL ); SfxContentHelper::GetHelpTreeViewContents( aTmpURL );
...@@ -413,8 +413,8 @@ OUString ContentListBox_Impl::GetSelectEntry() const ...@@ -413,8 +413,8 @@ OUString ContentListBox_Impl::GetSelectEntry() const
{ {
OUString aRet; OUString aRet;
SvTreeListEntry* pEntry = FirstSelected(); SvTreeListEntry* pEntry = FirstSelected();
if ( pEntry && !( (ContentEntry_Impl*)pEntry->GetUserData() )->bIsFolder ) if ( pEntry && !static_cast<ContentEntry_Impl*>(pEntry->GetUserData())->bIsFolder )
aRet = ( (ContentEntry_Impl*)pEntry->GetUserData() )->aURL; aRet = static_cast<ContentEntry_Impl*>(pEntry->GetUserData())->aURL;
return aRet; return aRet;
} }
......
...@@ -237,7 +237,7 @@ bool SvxOpenGraphicDialog::IsAsLink() const ...@@ -237,7 +237,7 @@ bool SvxOpenGraphicDialog::IsAsLink() const
{ {
Any aVal = mpImpl->xCtrlAcc->getValue( ExtendedFilePickerElementIds::CHECKBOX_LINK, 0 ); Any aVal = mpImpl->xCtrlAcc->getValue( ExtendedFilePickerElementIds::CHECKBOX_LINK, 0 );
DBG_ASSERT(aVal.hasValue(), "Value CBX_INSERT_AS_LINK not found"); DBG_ASSERT(aVal.hasValue(), "Value CBX_INSERT_AS_LINK not found");
return aVal.hasValue() && ( *(sal_Bool*) aVal.getValue() ); return aVal.hasValue() && ( *static_cast<sal_Bool const *>(aVal.getValue()) );
} }
} }
catch(const IllegalArgumentException&) catch(const IllegalArgumentException&)
......
...@@ -73,7 +73,7 @@ GFileMonitor* pMonitor = NULL; ...@@ -73,7 +73,7 @@ GFileMonitor* pMonitor = NULL;
static void open_url_cb( GtkWidget *, gpointer data ) static void open_url_cb( GtkWidget *, gpointer data )
{ {
ShutdownIcon::OpenURL( *(OUString *)data, ShutdownIcon::OpenURL( *static_cast<OUString *>(data),
OUString( "_default" ) ); OUString( "_default" ) );
} }
...@@ -128,7 +128,7 @@ static GdkPixbuf * ResIdToPixbuf( sal_uInt16 nResId ) ...@@ -128,7 +128,7 @@ static GdkPixbuf * ResIdToPixbuf( sal_uInt16 nResId )
g_return_val_if_fail( Size( pSalAlpha->Width(), pSalAlpha->Height() ) == aSize, NULL ); g_return_val_if_fail( Size( pSalAlpha->Width(), pSalAlpha->Height() ) == aSize, NULL );
int nX, nY; int nX, nY;
guchar *pPixbufData = ( guchar * )g_malloc( 4 * aSize.Width() * aSize.Height() ); guchar *pPixbufData = static_cast<guchar *>(g_malloc( 4 * aSize.Width() * aSize.Height() ));
guchar *pDestData = pPixbufData; guchar *pDestData = pPixbufData;
for( nY = 0; nY < pSalBitmap->Height(); nY++ ) for( nY = 0; nY < pSalBitmap->Height(); nY++ )
...@@ -163,7 +163,7 @@ extern "C" { ...@@ -163,7 +163,7 @@ extern "C" {
static void oustring_delete (gpointer data, static void oustring_delete (gpointer data,
GClosure * /* closure */) GClosure * /* closure */)
{ {
OUString *pURL = (OUString *) data; OUString *pURL = static_cast<OUString *>(data);
delete pURL; delete pURL;
} }
} }
......
...@@ -1610,7 +1610,7 @@ void SfxDispatcher::SetSlotFilter(SfxSlotFilterState nEnable, ...@@ -1610,7 +1610,7 @@ void SfxDispatcher::SetSlotFilter(SfxSlotFilterState nEnable,
extern "C" int SAL_CALL SfxCompareSIDs_Impl(const void* pSmaller, const void* pBigger) extern "C" int SAL_CALL SfxCompareSIDs_Impl(const void* pSmaller, const void* pBigger)
{ {
return ( (long) *((sal_uInt16*)pSmaller) ) - ( (long) *((sal_uInt16*)pBigger) ); return ( (long) *static_cast<sal_uInt16 const *>(pSmaller) ) - ( (long) *static_cast<sal_uInt16 const *>(pBigger) );
} }
/** Searches for 'nSID' in the Filter set by <SetSlotFilter()> and /** Searches for 'nSID' in the Filter set by <SetSlotFilter()> and
......
...@@ -40,15 +40,15 @@ extern "C" { ...@@ -40,15 +40,15 @@ extern "C" {
static int SAL_CALL static int SAL_CALL
SfxCompareSlots_qsort( const void* pSmaller, const void* pBigger ) SfxCompareSlots_qsort( const void* pSmaller, const void* pBigger )
{ {
return ( (int) ((SfxSlot*)pSmaller)->GetSlotId() ) - return ( (int) static_cast<SfxSlot const *>(pSmaller)->GetSlotId() ) -
( (int) ((SfxSlot*)pBigger)->GetSlotId() ); ( (int) static_cast<SfxSlot const *>(pBigger)->GetSlotId() );
} }
static int SAL_CALL static int SAL_CALL
SfxCompareSlots_bsearch( const void* pSmaller, const void* pBigger ) SfxCompareSlots_bsearch( const void* pSmaller, const void* pBigger )
{ {
return ( (int) *((sal_uInt16*)pSmaller) ) - return ( (int) *static_cast<sal_uInt16 const *>(pSmaller) ) -
( (int) ((SfxSlot*)pBigger)->GetSlotId() ); ( (int) static_cast<SfxSlot const *>(pBigger)->GetSlotId() );
} }
} }
...@@ -306,7 +306,7 @@ const SfxSlot* SfxInterface::GetSlot( sal_uInt16 nFuncId ) const ...@@ -306,7 +306,7 @@ const SfxSlot* SfxInterface::GetSlot( sal_uInt16 nFuncId ) const
if ( !p && pGenoType ) if ( !p && pGenoType )
return pGenoType->GetSlot( nFuncId ); return pGenoType->GetSlot( nFuncId );
return p ? (const SfxSlot*)p : 0; return p ? static_cast<const SfxSlot*>(p) : 0;
} }
const SfxSlot* SfxInterface::GetSlot( const OUString& rCommand ) const const SfxSlot* SfxInterface::GetSlot( const OUString& rCommand ) const
......
...@@ -408,7 +408,7 @@ bool SfxShell::CanExecuteSlot_Impl( const SfxSlot &rSlot ) ...@@ -408,7 +408,7 @@ bool SfxShell::CanExecuteSlot_Impl( const SfxSlot &rSlot )
sal_IntPtr ShellCall_Impl( void* pObj, void* pArg ) sal_IntPtr ShellCall_Impl( void* pObj, void* pArg )
{ {
((SfxShell* )pObj)->ExecuteSlot( *(SfxRequest*)pArg, (SfxInterface*)0L ); static_cast<SfxShell*>(pObj)->ExecuteSlot( *static_cast<SfxRequest*>(pArg), (SfxInterface*)0L );
return 0; return 0;
} }
...@@ -669,8 +669,8 @@ bool SfxShell::HasUIFeature( sal_uInt32 ) ...@@ -669,8 +669,8 @@ bool SfxShell::HasUIFeature( sal_uInt32 )
sal_IntPtr DispatcherUpdate_Impl( void*, void* pArg ) sal_IntPtr DispatcherUpdate_Impl( void*, void* pArg )
{ {
((SfxDispatcher*) pArg)->Update_Impl( true ); static_cast<SfxDispatcher*>(pArg)->Update_Impl( true );
((SfxDispatcher*) pArg)->GetBindings()->InvalidateAll(false); static_cast<SfxDispatcher*>(pArg)->GetBindings()->InvalidateAll(false);
return 0; return 0;
} }
......
...@@ -54,8 +54,8 @@ SfxStyleFamilyItem::SfxStyleFamilyItem( const ResId &rResId ) : ...@@ -54,8 +54,8 @@ SfxStyleFamilyItem::SfxStyleFamilyItem( const ResId &rResId ) :
} }
if(nMask & RSC_SFX_STYLE_ITEM_BITMAP) if(nMask & RSC_SFX_STYLE_ITEM_BITMAP)
{ {
aBitmap = Bitmap(ResId((RSHEADER_TYPE *)GetClassRes(),*rResId.GetResMgr())); aBitmap = Bitmap(ResId(static_cast<RSHEADER_TYPE *>(GetClassRes()),*rResId.GetResMgr()));
IncrementRes( GetObjSizeRes( (RSHEADER_TYPE *)GetClassRes() ) ); IncrementRes( GetObjSizeRes( static_cast<RSHEADER_TYPE *>(GetClassRes()) ) );
} }
if(nMask & RSC_SFX_STYLE_ITEM_TEXT) if(nMask & RSC_SFX_STYLE_ITEM_TEXT)
{ {
...@@ -73,8 +73,8 @@ SfxStyleFamilyItem::SfxStyleFamilyItem( const ResId &rResId ) : ...@@ -73,8 +73,8 @@ SfxStyleFamilyItem::SfxStyleFamilyItem( const ResId &rResId ) :
nFamily = SFX_STYLE_FAMILY_PARA; nFamily = SFX_STYLE_FAMILY_PARA;
if(nMask & RSC_SFX_STYLE_ITEM_IMAGE) if(nMask & RSC_SFX_STYLE_ITEM_IMAGE)
{ {
aImage = Image(ResId((RSHEADER_TYPE *)GetClassRes(),*rResId.GetResMgr())); aImage = Image(ResId(static_cast<RSHEADER_TYPE *>(GetClassRes()),*rResId.GetResMgr()));
IncrementRes( GetObjSizeRes( (RSHEADER_TYPE *)GetClassRes() ) ); IncrementRes( GetObjSizeRes( static_cast<RSHEADER_TYPE *>(GetClassRes()) ) );
} }
else else
aImage = Image(aBitmap); aImage = Image(aBitmap);
...@@ -101,9 +101,9 @@ SfxStyleFamilies::SfxStyleFamilies( const ResId& rResId ) : ...@@ -101,9 +101,9 @@ SfxStyleFamilies::SfxStyleFamilies( const ResId& rResId ) :
sal_uIntPtr nCount = ReadLongRes(); sal_uIntPtr nCount = ReadLongRes();
for( sal_uIntPtr i = 0; i < nCount; i++ ) for( sal_uIntPtr i = 0; i < nCount; i++ )
{ {
const ResId aResId((RSHEADER_TYPE *)GetClassRes(), *rResId.GetResMgr()); const ResId aResId(static_cast<RSHEADER_TYPE *>(GetClassRes()), *rResId.GetResMgr());
SfxStyleFamilyItem *pItem = new SfxStyleFamilyItem(aResId); SfxStyleFamilyItem *pItem = new SfxStyleFamilyItem(aResId);
IncrementRes( GetObjSizeRes( (RSHEADER_TYPE *)GetClassRes() ) ); IncrementRes( GetObjSizeRes( static_cast<RSHEADER_TYPE *>(GetClassRes()) ) );
aEntryList.push_back( pItem ); aEntryList.push_back( pItem );
} }
......
...@@ -173,7 +173,7 @@ void SfxVersionsTabListBox_Impl::setColSizes() ...@@ -173,7 +173,7 @@ void SfxVersionsTabListBox_Impl::setColSizes()
for (SvTreeListEntry* pEntry = First(); pEntry; pEntry = Next(pEntry)) for (SvTreeListEntry* pEntry = First(); pEntry; pEntry = Next(pEntry))
{ {
aAuthors.insert(((SfxVersionInfo*)pEntry->GetUserData())->aAuthor); aAuthors.insert(static_cast<SfxVersionInfo*>(pEntry->GetUserData())->aAuthor);
} }
long nMaxAuthorWidth = nRest/4; long nMaxAuthorWidth = nRest/4;
...@@ -412,7 +412,7 @@ IMPL_LINK( SfxVersionDialog, ButtonHdl_Impl, Button*, pButton ) ...@@ -412,7 +412,7 @@ IMPL_LINK( SfxVersionDialog, ButtonHdl_Impl, Button*, pButton )
} }
if (pButton == m_pDeleteButton && pEntry) if (pButton == m_pDeleteButton && pEntry)
{ {
pObjShell->GetMedium()->RemoveVersion_Impl( ((SfxVersionInfo*) pEntry->GetUserData())->aName ); pObjShell->GetMedium()->RemoveVersion_Impl( static_cast<SfxVersionInfo*>(pEntry->GetUserData())->aName );
pObjShell->SetModified( true ); pObjShell->SetModified( true );
m_pVersionBox->SetUpdateMode( false ); m_pVersionBox->SetUpdateMode( false );
m_pVersionBox->Clear(); m_pVersionBox->Clear();
...@@ -425,7 +425,7 @@ IMPL_LINK( SfxVersionDialog, ButtonHdl_Impl, Button*, pButton ) ...@@ -425,7 +425,7 @@ IMPL_LINK( SfxVersionDialog, ButtonHdl_Impl, Button*, pButton )
} }
else if (pButton == m_pViewButton && pEntry) else if (pButton == m_pViewButton && pEntry)
{ {
SfxVersionInfo* pInfo = (SfxVersionInfo*) pEntry->GetUserData(); SfxVersionInfo* pInfo = static_cast<SfxVersionInfo*>(pEntry->GetUserData());
boost::scoped_ptr<SfxViewVersionDialog_Impl> pDlg(new SfxViewVersionDialog_Impl(this, *pInfo, false)); boost::scoped_ptr<SfxViewVersionDialog_Impl> pDlg(new SfxViewVersionDialog_Impl(this, *pInfo, false));
pDlg->Execute(); pDlg->Execute();
} }
......
...@@ -418,7 +418,7 @@ SfxUnoMenuControl::~SfxUnoMenuControl() ...@@ -418,7 +418,7 @@ SfxUnoMenuControl::~SfxUnoMenuControl()
sal_IntPtr Select_Impl( void* /*pHdl*/, void* pVoid ) sal_IntPtr Select_Impl( void* /*pHdl*/, void* pVoid )
{ {
Menu* pMenu = (Menu*)pVoid; Menu* pMenu = static_cast<Menu*>(pVoid);
OUString aURL( pMenu->GetItemCommand( pMenu->GetCurItemId() ) ); OUString aURL( pMenu->GetItemCommand( pMenu->GetCurItemId() ) );
if( aURL.isEmpty() ) if( aURL.isEmpty() )
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment