diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2015-03-28 19:08:26 +0100 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2015-03-28 19:09:28 +0100 |
commit | 18804c92e10c7f4572b9698b1cf6dc86db8d6f32 (patch) | |
tree | 871d06b7a7430c9b5ef93910ab46eb26ead5ffa6 /vcl/unx | |
parent | 33875d862ad5d870cfd1f67d5ef9ad91b8be740f (diff) |
Clean up C-style casts from pointers to void
Change-Id: Iad602cece6e328c7f5d5f36adb294c97b152ade3
Diffstat (limited to 'vcl/unx')
28 files changed, 149 insertions, 149 deletions
diff --git a/vcl/unx/generic/app/i18n_cb.cxx b/vcl/unx/generic/app/i18n_cb.cxx index e025881f66df..496c5769b902 100644 --- a/vcl/unx/generic/app/i18n_cb.cxx +++ b/vcl/unx/generic/app/i18n_cb.cxx @@ -127,10 +127,10 @@ enlarge_buffer ( preedit_text_t *ptext, int nnewlimit ) nnewsize *= 2; ptext->nSize = nnewsize; - ptext->pUnicodeBuffer = (sal_Unicode*)realloc((void*)ptext->pUnicodeBuffer, - nnewsize * sizeof(sal_Unicode)); - ptext->pCharStyle = (XIMFeedback*)realloc((void*)ptext->pCharStyle, - nnewsize * sizeof(XIMFeedback)); + ptext->pUnicodeBuffer = static_cast<sal_Unicode*>(realloc((void*)ptext->pUnicodeBuffer, + nnewsize * sizeof(sal_Unicode))); + ptext->pCharStyle = static_cast<XIMFeedback*>(realloc((void*)ptext->pCharStyle, + nnewsize * sizeof(XIMFeedback))); } // Handle insertion of text in a preedit_draw_callback @@ -152,7 +152,7 @@ Preedit_InsertText(preedit_text_t *pText, XIMText *pInsertText, int where) { wchar_t *pWCString = pInsertText->string.wide_char; size_t nBytes = wcstombs ( NULL, pWCString, 1024 /* dont care */); - pMBString = (char*)alloca( nBytes + 1 ); + pMBString = static_cast<char*>(alloca( nBytes + 1 )); nMBLength = wcstombs ( pMBString, pWCString, nBytes + 1); } else @@ -173,7 +173,7 @@ Preedit_InsertText(preedit_text_t *pText, XIMText *pInsertText, int where) sal_Size nBufferSize = nInsertTextLength * 2; - pInsertTextString = (sal_Unicode*)alloca(nBufferSize); + pInsertTextString = static_cast<sal_Unicode*>(alloca(nBufferSize)); sal_uInt32 nConversionInfo; sal_Size nConvertedChars; @@ -492,7 +492,7 @@ StatusDrawCallback (XIC, XPointer, XIMStatusDrawCallbackStruct *call_data) { wchar_t* pWString = call_data->data.text->string.wide_char; size_t nBytes = wcstombs( NULL, pWString, 1024 ); - pMBString = (sal_Char*)alloca( nBytes+1 ); + pMBString = static_cast<sal_Char*>(alloca( nBytes+1 )); nLength = wcstombs( pMBString, pWString, nBytes+1 ); } } diff --git a/vcl/unx/generic/app/i18n_ic.cxx b/vcl/unx/generic/app/i18n_ic.cxx index 87e84bbddd21..60cb0f0cdb5d 100644 --- a/vcl/unx/generic/app/i18n_ic.cxx +++ b/vcl/unx/generic/app/i18n_ic.cxx @@ -184,9 +184,9 @@ SalI18N_InputContext::SalI18N_InputContext ( SalFrame *pFrame ) : maClientData.eState = ePreeditStatusStartPending; maClientData.pFrame = pFrame; maClientData.aText.pUnicodeBuffer = - (sal_Unicode*)malloc(PREEDIT_BUFSZ * sizeof(sal_Unicode)); + static_cast<sal_Unicode*>(malloc(PREEDIT_BUFSZ * sizeof(sal_Unicode))); maClientData.aText.pCharStyle = - (XIMFeedback*)malloc(PREEDIT_BUFSZ * sizeof(XIMFeedback)); + static_cast<XIMFeedback*>(malloc(PREEDIT_BUFSZ * sizeof(XIMFeedback))); maClientData.aText.nSize = PREEDIT_BUFSZ; maClientData.aText.nCursorPos = 0; maClientData.aText.nLength = 0; @@ -313,7 +313,7 @@ SalI18N_InputContext::SalI18N_InputContext ( SalFrame *pFrame ) : if ( mpPreeditAttributes != NULL ) #endif mpAttributes = XVaAddToNestedList( mpAttributes, - const_cast<char*>(XNPreeditAttributes), (XPointer)mpPreeditAttributes ); + const_cast<char*>(XNPreeditAttributes), static_cast<XPointer>(mpPreeditAttributes) ); } if ( mnStatusStyle != XIMStatusNone ) { @@ -321,7 +321,7 @@ SalI18N_InputContext::SalI18N_InputContext ( SalFrame *pFrame ) : if ( mpStatusAttributes != NULL ) #endif mpAttributes = XVaAddToNestedList( mpAttributes, - const_cast<char*>(XNStatusAttributes), (XPointer)mpStatusAttributes ); + const_cast<char*>(XNStatusAttributes), static_cast<XPointer>(mpStatusAttributes) ); } maContext = XCreateIC( pInputMethod->GetMethod(), XNVaNestedList, mpAttributes, diff --git a/vcl/unx/generic/app/i18n_status.cxx b/vcl/unx/generic/app/i18n_status.cxx index 838a455b9590..e957671c8ce3 100644 --- a/vcl/unx/generic/app/i18n_status.cxx +++ b/vcl/unx/generic/app/i18n_status.cxx @@ -153,7 +153,7 @@ void XIMStatusWindow::layout() if (m_bAnchoredAtRight && IsVisible()) { - SalFrame* pFrame = (SalFrame*)GetSystemData()->pSalFrame; + SalFrame* pFrame = static_cast<SalFrame*>(GetSystemData()->pSalFrame); long nDelta = pFrame->maGeometry.nWidth - m_aWindowSize.Width(); pFrame->SetPosSize( pFrame->maGeometry.nX + nDelta, pFrame->maGeometry.nY, @@ -196,7 +196,7 @@ Point XIMStatusWindow::updatePosition() m_pLastParent->CallCallback( SALEVENT_EXTTEXTINPUTPOS, (void*)&aPosEvent ); int x, y; ::Window aChild; - XTranslateCoordinates( (Display*)pParentEnvData->pDisplay, + XTranslateCoordinates( static_cast<Display*>(pParentEnvData->pDisplay), (::Window)pParentEnvData->aShellWindow, vcl_sal::getSalDisplay(GetGenericData())->GetRootWindow( vcl_sal::getSalDisplay(GetGenericData())->GetDefaultXScreen() ), 0, 0, @@ -246,7 +246,7 @@ void XIMStatusWindow::setPosition( SalFrame* pParent ) if( IsVisible() ) { const SystemEnvData* pEnvData = GetSystemData(); - SalFrame* pStatusFrame = (SalFrame*)pEnvData->pSalFrame; + SalFrame* pStatusFrame = static_cast<SalFrame*>(pEnvData->pSalFrame); Point aPoint = updatePosition(); pStatusFrame->SetPosSize( aPoint.X(), aPoint.Y(), m_aWindowSize.Width(), m_aWindowSize.Height(), SAL_FRAME_POSSIZE_X | SAL_FRAME_POSSIZE_Y | SAL_FRAME_POSSIZE_WIDTH | SAL_FRAME_POSSIZE_HEIGHT ); } @@ -257,7 +257,7 @@ IMPL_LINK_NOARG(XIMStatusWindow, DelayedShowHdl) { m_nDelayedEvent = 0; const SystemEnvData* pData = GetSystemData(); - SalFrame* pStatusFrame = (SalFrame*)pData->pSalFrame; + SalFrame* pStatusFrame = static_cast<SalFrame*>(pData->pSalFrame); if( m_bDelayedShow ) { Size aControlSize( m_aWindowSize.Width()-4, m_aWindowSize.Height()-4 ); @@ -268,7 +268,7 @@ IMPL_LINK_NOARG(XIMStatusWindow, DelayedShowHdl) Show( m_bDelayedShow && m_bOn, SHOW_NOACTIVATE ); if( m_bDelayedShow ) { - XRaiseWindow( (Display*)pData->pDisplay, + XRaiseWindow( static_cast<Display*>(pData->pDisplay), (::Window)pData->aShellWindow ); } return 0; @@ -350,7 +350,7 @@ IIIMPStatusWindow::IIIMPStatusWindow( SalFrame* pParent, bool bOn ) : int nDistance = rGeom.nTopDecoration; if( nDistance < 20 ) nDistance = 20; - XMoveWindow( (Display*)pEnvData->pDisplay, + XMoveWindow( static_cast<Display*>(pEnvData->pDisplay), (::Window)pEnvData->aShellWindow, rGeom.nX, rGeom.nY + rGeom.nHeight + nDistance @@ -440,12 +440,12 @@ void IIIMPStatusWindow::GetFocus() { const SystemEnvData* pParentEnvData = m_pResetFocus->GetSystemData(); GetGenericData()->ErrorTrapPush(); - XSetInputFocus( (Display*)pParentEnvData->pDisplay, + XSetInputFocus( static_cast<Display*>(pParentEnvData->pDisplay), (::Window)pParentEnvData->aShellWindow, RevertToNone, CurrentTime ); - XSync( (Display*)pParentEnvData->pDisplay, False ); + XSync( static_cast<Display*>(pParentEnvData->pDisplay), False ); GetGenericData()->ErrorTrapPop(); } m_pResetFocus = NULL; @@ -470,12 +470,12 @@ IMPL_LINK( IIIMPStatusWindow, SelectHdl, MenuButton*, pBtn ) { const SystemEnvData* pEnv = pParent->GetSystemData(); GetGenericData()->ErrorTrapPush(); - XSetInputFocus( (Display*)pEnv->pDisplay, + XSetInputFocus( static_cast<Display*>(pEnv->pDisplay), (::Window)pEnv->aShellWindow, RevertToNone, CurrentTime ); - XSync( (Display*)pEnv->pDisplay, False ); + XSync( static_cast<Display*>(pEnv->pDisplay), False ); GetGenericData()->ErrorTrapPop(); } } @@ -554,7 +554,7 @@ void I18NStatus::setStatusText( const OUString& rText ) * #93614# convert fullwidth ASCII forms to ascii */ int nChars = rText.getLength(); - sal_Unicode* pBuffer = (sal_Unicode*)alloca( nChars*sizeof( sal_Unicode ) ); + sal_Unicode* pBuffer = static_cast<sal_Unicode*>(alloca( nChars*sizeof( sal_Unicode ) )); for( int i = 0; i < nChars; i++ ) { if( rText[i] >=0xff00 && rText[i] <= 0xff5f ) @@ -592,7 +592,7 @@ SalFrame* I18NStatus::getStatusFrame() const if( m_pStatusWindow ) { const SystemEnvData* pData = m_pStatusWindow->GetSystemData(); - pRet = (SalFrame*)pData->pSalFrame; + pRet = static_cast<SalFrame*>(pData->pSalFrame); } return pRet; } diff --git a/vcl/unx/generic/app/saldisp.cxx b/vcl/unx/generic/app/saldisp.cxx index 47ecec852431..e984b3e0dd44 100644 --- a/vcl/unx/generic/app/saldisp.cxx +++ b/vcl/unx/generic/app/saldisp.cxx @@ -210,7 +210,7 @@ bool SalDisplay::BestVisual( Display *pDisplay, &aVI, &nVisuals ); // pVInfos should contain at least one visual, otherwise // we're in trouble - int* pWeight = (int*)alloca( sizeof(int)*nVisuals ); + int* pWeight = static_cast<int*>(alloca( sizeof(int)*nVisuals )); int i; for( i = 0; i < nVisuals; i++ ) { diff --git a/vcl/unx/generic/app/sm.cxx b/vcl/unx/generic/app/sm.cxx index 782cc9063b3a..750b8b79f867 100644 --- a/vcl/unx/generic/app/sm.cxx +++ b/vcl/unx/generic/app/sm.cxx @@ -218,14 +218,14 @@ static void BuildSmPropertyList() pSmProps[ 3 ].num_vals = 1; pSmProps[ 3 ].vals = new SmPropValue; pSmProps[ 3 ].vals->value = strdup( aUser.getStr() ); - pSmProps[ 3 ].vals->length = rtl_str_getLength( (char *)pSmProps[ 3 ].vals->value )+1; + pSmProps[ 3 ].vals->length = rtl_str_getLength( static_cast<char *>(pSmProps[ 3 ].vals->value) )+1; pSmProps[ 4 ].name = const_cast<char*>(SmRestartStyleHint); pSmProps[ 4 ].type = const_cast<char*>(SmCARD8); pSmProps[ 4 ].num_vals = 1; pSmProps[ 4 ].vals = new SmPropValue; pSmProps[ 4 ].vals->value = malloc(1); - pSmRestartHint = (unsigned char *)pSmProps[ 4 ].vals->value; + pSmRestartHint = static_cast<unsigned char *>(pSmProps[ 4 ].vals->value); *pSmRestartHint = SmRestartIfRunning; pSmProps[ 4 ].vals->length = 1; @@ -630,7 +630,7 @@ void ICEConnectionWorker(void * data) osl::MutexGuard g(pThis->m_ICEMutex); nConnectionsBefore = pThis->m_nConnections; int nBytes = sizeof( struct pollfd )*(nConnectionsBefore+1); - pLocalFD = (struct pollfd*)rtl_allocateMemory( nBytes ); + pLocalFD = static_cast<struct pollfd*>(rtl_allocateMemory( nBytes )); memcpy( pLocalFD, pThis->m_pFilehandles, nBytes ); } @@ -683,8 +683,8 @@ void ICEWatchProc( { int fd = IceConnectionNumber( ice_conn ); pThis->m_nConnections++; - pThis->m_pConnections = (IceConn*)rtl_reallocateMemory( pThis->m_pConnections, sizeof( IceConn )*pThis->m_nConnections ); - pThis->m_pFilehandles = (struct pollfd*)rtl_reallocateMemory( pThis->m_pFilehandles, sizeof( struct pollfd )*(pThis->m_nConnections+1) ); + pThis->m_pConnections = static_cast<IceConn*>(rtl_reallocateMemory( pThis->m_pConnections, sizeof( IceConn )*pThis->m_nConnections )); + pThis->m_pFilehandles = static_cast<struct pollfd*>(rtl_reallocateMemory( pThis->m_pFilehandles, sizeof( struct pollfd )*(pThis->m_nConnections+1) )); pThis->m_pConnections[ pThis->m_nConnections-1 ] = ice_conn; pThis->m_pFilehandles[ pThis->m_nConnections ].fd = fd; pThis->m_pFilehandles[ pThis->m_nConnections ].events = POLLIN; @@ -734,8 +734,8 @@ void ICEWatchProc( memmove( pThis->m_pFilehandles+i+1, pThis->m_pFilehandles+i+2, sizeof( struct pollfd )*(pThis->m_nConnections-i-1) ); } pThis->m_nConnections--; - pThis->m_pConnections = (IceConn*)rtl_reallocateMemory( pThis->m_pConnections, sizeof( IceConn )*pThis->m_nConnections ); - pThis->m_pFilehandles = (struct pollfd*)rtl_reallocateMemory( pThis->m_pFilehandles, sizeof( struct pollfd )*(pThis->m_nConnections+1) ); + pThis->m_pConnections = static_cast<IceConn*>(rtl_reallocateMemory( pThis->m_pConnections, sizeof( IceConn )*pThis->m_nConnections )); + pThis->m_pFilehandles = static_cast<struct pollfd*>(rtl_reallocateMemory( pThis->m_pFilehandles, sizeof( struct pollfd )*(pThis->m_nConnections+1) )); break; } } diff --git a/vcl/unx/generic/app/wmadaptor.cxx b/vcl/unx/generic/app/wmadaptor.cxx index 58d34fe3928e..e3239fde49df 100644 --- a/vcl/unx/generic/app/wmadaptor.cxx +++ b/vcl/unx/generic/app/wmadaptor.cxx @@ -176,7 +176,7 @@ static const WMAdaptorProtocol aAtomTab[] = extern "C" { static int compareProtocol( const void* pLeft, const void* pRight ) { - return strcmp( ((const WMAdaptorProtocol*)pLeft)->pProtocol, ((const WMAdaptorProtocol*)pRight)->pProtocol ); + return strcmp( static_cast<const WMAdaptorProtocol*>(pLeft)->pProtocol, static_cast<const WMAdaptorProtocol*>(pRight)->pProtocol ); } } @@ -385,7 +385,7 @@ NetWMAdaptor::NetWMAdaptor( SalDisplay* pSalDisplay ) : ) { Atom* pAtoms = reinterpret_cast<Atom*>(pProperty); - char** pAtomNames = (char**)alloca( sizeof(char*)*nItems ); + char** pAtomNames = static_cast<char**>(alloca( sizeof(char*)*nItems )); if( XGetAtomNames( m_pDisplay, pAtoms, nItems, pAtomNames ) ) { #if OSL_DEBUG_LEVEL > 1 @@ -399,12 +399,12 @@ NetWMAdaptor::NetWMAdaptor( SalDisplay* pSalDisplay ) : WMAdaptorProtocol aSearch; aSearch.pProtocol = pAtomNames[i]; - WMAdaptorProtocol* pMatch = (WMAdaptorProtocol*) + WMAdaptorProtocol* pMatch = static_cast<WMAdaptorProtocol*>( bsearch( &aSearch, aProtocolTab, SAL_N_ELEMENTS( aProtocolTab ), sizeof( struct WMAdaptorProtocol ), - compareProtocol ); + compareProtocol )); if( pMatch ) { m_aWMAtoms[ pMatch->nProtocol ] = pAtoms[ i ]; @@ -643,7 +643,7 @@ GnomeWMAdaptor::GnomeWMAdaptor( SalDisplay* pSalDisplay ) : ) { Atom* pAtoms = reinterpret_cast<Atom*>(pProperty); - char** pAtomNames = (char**)alloca( sizeof(char*)*nItems ); + char** pAtomNames = static_cast<char**>(alloca( sizeof(char*)*nItems )); if( XGetAtomNames( m_pDisplay, pAtoms, nItems, pAtomNames ) ) { #if OSL_DEBUG_LEVEL > 1 @@ -657,12 +657,12 @@ GnomeWMAdaptor::GnomeWMAdaptor( SalDisplay* pSalDisplay ) : WMAdaptorProtocol aSearch; aSearch.pProtocol = pAtomNames[i]; - WMAdaptorProtocol* pMatch = (WMAdaptorProtocol*) + WMAdaptorProtocol* pMatch = static_cast<WMAdaptorProtocol*>( bsearch( &aSearch, aProtocolTab, SAL_N_ELEMENTS( aProtocolTab ), sizeof( struct WMAdaptorProtocol ), - compareProtocol ); + compareProtocol )); if( pMatch ) { m_aWMAtoms[ pMatch->nProtocol ] = pAtoms[ i ]; diff --git a/vcl/unx/generic/dtrans/X11_selection.cxx b/vcl/unx/generic/dtrans/X11_selection.cxx index 24480fca9c2e..795930f7dafe 100644 --- a/vcl/unx/generic/dtrans/X11_selection.cxx +++ b/vcl/unx/generic/dtrans/X11_selection.cxx @@ -1604,7 +1604,7 @@ bool SelectionManager::handleSelectionRequest( XSelectionRequestEvent& rRequest getNativeTypeList( aFlavors, aConversions, rRequest.selection ); int i, nTypes = aConversions.size(); - Atom* pTypes = (Atom*)alloca( nTypes * sizeof( Atom ) ); + Atom* pTypes = static_cast<Atom*>(alloca( nTypes * sizeof( Atom ) )); std::list< Atom >::const_iterator it; for( i = 0, it = aConversions.begin(); i < nTypes; i++, ++it ) pTypes[i] = *it; @@ -3291,7 +3291,7 @@ void SelectionManager::startDrag( getNativeTypeList( m_aDragFlavors, aConversions, m_nXdndSelection ); int nTypes = aConversions.size(); - Atom* pTypes = (Atom*)alloca( sizeof(Atom)*nTypes ); + Atom* pTypes = static_cast<Atom*>(alloca( sizeof(Atom)*nTypes )); type_it = aConversions.begin(); for( int n = 0; n < nTypes; n++, ++type_it ) pTypes[n] = *type_it; @@ -3375,7 +3375,7 @@ void SelectionManager::startDrag( void SelectionManager::runDragExecute( void* pThis ) { - SelectionManager* This = (SelectionManager*)pThis; + SelectionManager* This = static_cast<SelectionManager*>(pThis); This->dragDoDispatch(); } @@ -3484,7 +3484,7 @@ void SelectionManager::transferablesFlavorsChanged() getNativeTypeList( m_aDragFlavors, aConversions, m_nXdndSelection ); int nTypes = aConversions.size(); - Atom* pTypes = (Atom*)alloca( sizeof(Atom)*aConversions.size() ); + Atom* pTypes = static_cast<Atom*>(alloca( sizeof(Atom)*aConversions.size() )); for( i = 0, type_it = aConversions.begin(); type_it != aConversions.end(); ++type_it, i++ ) pTypes[i] = *type_it; XChangeProperty( m_pDisplay, m_aWindow, m_nXdndTypeList, XA_ATOM, 32, PropModeReplace, reinterpret_cast<unsigned char*>(pTypes), nTypes ); @@ -3654,7 +3654,7 @@ void SelectionManager::run( void* pThis ) osl::Thread::setName("SelectionManager"); // dispatch until the cows come home - SelectionManager* This = (SelectionManager*)pThis; + SelectionManager* This = static_cast<SelectionManager*>(pThis); timeval aLast; gettimeofday( &aLast, 0 ); diff --git a/vcl/unx/generic/dtrans/bmp.cxx b/vcl/unx/generic/dtrans/bmp.cxx index 0c8e1318e735..621243e5a11f 100644 --- a/vcl/unx/generic/dtrans/bmp.cxx +++ b/vcl/unx/generic/dtrans/bmp.cxx @@ -142,7 +142,7 @@ static sal_uInt8* X11_getPaletteBmpFromImage( // allocate buffer to hold header and scanlines, initialize to zero rOutSize = nHeaderSize + nScanlineSize*pImage->height; - pBuffer = (sal_uInt8*)rtl_allocateZeroMemory( rOutSize ); + pBuffer = static_cast<sal_uInt8*>(rtl_allocateZeroMemory( rOutSize )); for( int y = 0; y < pImage->height; y++ ) { sal_uInt8* pScanline = pBuffer + nHeaderSize + (pImage->height-1-y)*nScanlineSize; @@ -265,7 +265,7 @@ static sal_uInt8* X11_getTCBmpFromImage( // allocate buffer to hold header and scanlines, initialize to zero rOutSize = nHeaderSize + nScanlineSize*pImage->height; - pBuffer = (sal_uInt8*)rtl_allocateZeroMemory( rOutSize ); + pBuffer = static_cast<sal_uInt8*>(rtl_allocateZeroMemory( rOutSize )); for( int y = 0; y < pImage->height; y++ ) { sal_uInt8* pScanline = pBuffer + nHeaderSize + (pImage->height-1-y)*nScanlineSize; @@ -683,7 +683,7 @@ Pixmap PixmapHolder::setBitmapData( const sal_uInt8* pData ) aImage.obdata = NULL; XInitImage( &aImage ); - aImage.data = (char*)rtl_allocateMemory( nHeight*aImage.bytes_per_line ); + aImage.data = static_cast<char*>(rtl_allocateMemory( nHeight*aImage.bytes_per_line )); if( readLE32( pData+14 ) == 24 ) { diff --git a/vcl/unx/generic/dtrans/config.cxx b/vcl/unx/generic/dtrans/config.cxx index b99176473757..00829ce61ad7 100644 --- a/vcl/unx/generic/dtrans/config.cxx +++ b/vcl/unx/generic/dtrans/config.cxx @@ -81,7 +81,7 @@ DtransX11ConfigItem::DtransX11ConfigItem() : { if( pValue->getValueTypeClass() == TypeClass_STRING ) { - const OUString* pLine = (const OUString*)pValue->getValue(); + const OUString* pLine = static_cast<const OUString*>(pValue->getValue()); if( !pLine->isEmpty() ) { m_nSelectionTimeout = pLine->toInt32(); diff --git a/vcl/unx/generic/gdi/cairo_xlib_cairo.cxx b/vcl/unx/generic/gdi/cairo_xlib_cairo.cxx index 3f063b37e8c7..bf58b95bf4bb 100644 --- a/vcl/unx/generic/gdi/cairo_xlib_cairo.cxx +++ b/vcl/unx/generic/gdi/cairo_xlib_cairo.cxx @@ -91,7 +91,7 @@ namespace cairo X11Pixmap::~X11Pixmap() { if( mpDisplay && mhDrawable ) - XFreePixmap( (Display*)mpDisplay, mhDrawable ); + XFreePixmap( static_cast<Display*>(mpDisplay), mhDrawable ); } /** @@ -148,9 +148,9 @@ namespace cairo maSysData(rSysData), mpPixmap(), mpSurface( - cairo_xlib_surface_create( (Display*)rSysData.pDisplay, + cairo_xlib_surface_create( static_cast<Display*>(rSysData.pDisplay), rSysData.hDrawable, - (Visual*)rSysData.pVisual, + static_cast<Visual*>(rSysData.pVisual), width + x, height + y ), &cairo_surface_destroy) { @@ -173,9 +173,9 @@ namespace cairo maSysData( rSysData ), mpPixmap(), mpSurface( - cairo_xlib_surface_create( (Display*)rSysData.pDisplay, + cairo_xlib_surface_create( static_cast<Display*>(rSysData.pDisplay), reinterpret_cast<Drawable>(rData.aPixmap), - (Visual*) rSysData.pVisual, + static_cast<Visual*>(rSysData.pVisual), rData.mnWidth, rData.mnHeight ), &cairo_surface_destroy) { @@ -228,8 +228,8 @@ namespace cairo break; } - pFormat = XRenderFindStandardFormat( (Display*)maSysData.pDisplay, nFormat ); - hPixmap = limitXCreatePixmap( (Display*)maSysData.pDisplay, maSysData.hDrawable, + pFormat = XRenderFindStandardFormat( static_cast<Display*>(maSysData.pDisplay), nFormat ); + hPixmap = limitXCreatePixmap( static_cast<Display*>(maSysData.pDisplay), maSysData.hDrawable, width > 0 ? width : 1, height > 0 ? height : 1, pFormat->depth ); @@ -241,9 +241,9 @@ namespace cairo new X11Pixmap(hPixmap, maSysData.pDisplay)), CairoSurfaceSharedPtr( cairo_xlib_surface_create_with_xrender_format( - (Display*)maSysData.pDisplay, + static_cast<Display*>(maSysData.pDisplay), hPixmap, - ScreenOfDisplay((Display *)maSysData.pDisplay, maSysData.nScreen), + ScreenOfDisplay(static_cast<Display *>(maSysData.pDisplay), maSysData.nScreen), pFormat, width, height ), &cairo_surface_destroy) )); } @@ -291,7 +291,7 @@ namespace cairo void X11Surface::flush() const { - XSync( (Display*)maSysData.pDisplay, false ); + XSync( static_cast<Display*>(maSysData.pDisplay), false ); } /** @@ -302,7 +302,7 @@ namespace cairo int X11Surface::getDepth() const { if( maSysData.pRenderFormat ) - return ((XRenderPictFormat*) maSysData.pRenderFormat)->depth; + return static_cast<XRenderPictFormat*>(maSysData.pRenderFormat)->depth; return -1; } diff --git a/vcl/unx/generic/gdi/cairotextrender.cxx b/vcl/unx/generic/gdi/cairotextrender.cxx index ee14de263707..6d9d74871686 100644 --- a/vcl/unx/generic/gdi/cairotextrender.cxx +++ b/vcl/unx/generic/gdi/cairotextrender.cxx @@ -130,7 +130,7 @@ CairoFontsCache::~CairoFontsCache() { LRUFonts::iterator aEnd = maLRUFonts.end(); for (LRUFonts::iterator aI = maLRUFonts.begin(); aI != aEnd; ++aI) - cairo_font_face_destroy((cairo_font_face_t*)aI->first); + cairo_font_face_destroy(static_cast<cairo_font_face_t*>(aI->first)); } } @@ -139,7 +139,7 @@ void CairoFontsCache::CacheFont(void *pFont, const CairoFontsCache::CacheId &rId maLRUFonts.push_front( std::pair<void*, CairoFontsCache::CacheId>(pFont, rId) ); if (maLRUFonts.size() > 8) { - cairo_font_face_destroy((cairo_font_face_t*)maLRUFonts.back().first); + cairo_font_face_destroy(static_cast<cairo_font_face_t*>(maLRUFonts.back().first)); maLRUFonts.pop_back(); } } @@ -252,7 +252,7 @@ void CairoTextRender::DrawServerFontLayout( const ServerFontLayout& rLayout ) size_t nLen = std::distance(aI, aNext); aId.mbVerticalMetrics = nGlyphRotation != 0.0; - cairo_font_face_t* font_face = (cairo_font_face_t*)CairoFontsCache::FindCachedFont(aId); + cairo_font_face_t* font_face = static_cast<cairo_font_face_t*>(CairoFontsCache::FindCachedFont(aId)); if (!font_face) { const ImplFontOptions *pOptions = rFont.GetFontOptions().get(); diff --git a/vcl/unx/generic/printer/cupsmgr.cxx b/vcl/unx/generic/printer/cupsmgr.cxx index c0ece24fb9e1..8a12fbb42562 100644 --- a/vcl/unx/generic/printer/cupsmgr.cxx +++ b/vcl/unx/generic/printer/cupsmgr.cxx @@ -112,7 +112,7 @@ extern "C" { static void getPPDWorker(void* pData) { osl_setThreadName("CUPSManager getPPDWorker"); - GetPPDAttribs* pAttribs = (GetPPDAttribs*)pData; + GetPPDAttribs* pAttribs = static_cast<GetPPDAttribs*>(pData); pAttribs->executeCall(); } } @@ -200,12 +200,12 @@ CUPSManager::~CUPSManager() } if (m_nDests && m_pDests) - cupsFreeDests( m_nDests, (cups_dest_t*)m_pDests ); + cupsFreeDests( m_nDests, static_cast<cups_dest_t*>(m_pDests) ); } void CUPSManager::runDestThread( void* pThis ) { - ((CUPSManager*)pThis)->runDests(); + static_cast<CUPSManager*>(pThis)->runDests(); } void CUPSManager::runDests() @@ -267,7 +267,7 @@ void CUPSManager::initialize() // this is needed to check for %%IncludeFeature support // (#i65684#, #i65491#) bool bUsePDF = false; - cups_dest_t* pDest = ((cups_dest_t*)m_pDests); + cups_dest_t* pDest = static_cast<cups_dest_t*>(m_pDests); const char* pOpt = cupsGetOption( "printer-info", pDest->num_options, pDest->options ); @@ -295,7 +295,7 @@ void CUPSManager::initialize() // with the same name as a CUPS printer, overwrite it while( nPrinter-- ) { - pDest = ((cups_dest_t*)m_pDests)+nPrinter; + pDest = static_cast<cups_dest_t*>(m_pDests)+nPrinter; OUString aPrinterName = OStringToOUString( pDest->name, aEncoding ); if( pDest->instance && *pDest->instance ) { @@ -431,7 +431,7 @@ const PPDParser* CUPSManager::createCUPSParser( const OUString& rPrinter ) m_aCUPSDestMap.find( aPrinter ); if( dest_it != m_aCUPSDestMap.end() ) { - cups_dest_t* pDest = ((cups_dest_t*)m_pDests) + dest_it->second; + cups_dest_t* pDest = static_cast<cups_dest_t*>(m_pDests) + dest_it->second; OString aPPDFile = threadedCupsGetPPD( pDest->name ); SAL_INFO("vcl.unx.print", "PPD for " << aPrinter << " is " << aPPDFile); @@ -601,7 +601,7 @@ void CUPSManager::getOptionsFromDocumentSetup( const JobData& rJob, bool bBanner { OString aKey = OUStringToOString( pKey->getKey(), RTL_TEXTENCODING_ASCII_US ); OString aValue = OUStringToOString( sPayLoad, RTL_TEXTENCODING_ASCII_US ); - rNumOptions = cupsAddOption( aKey.getStr(), aValue.getStr(), rNumOptions, (cups_option_t**)rOptions ); + rNumOptions = cupsAddOption( aKey.getStr(), aValue.getStr(), rNumOptions, reinterpret_cast<cups_option_t**>(rOptions) ); } } } @@ -609,13 +609,13 @@ void CUPSManager::getOptionsFromDocumentSetup( const JobData& rJob, bool bBanner if( rJob.m_nPDFDevice > 0 && rJob.m_nCopies > 1 ) { OString aVal( OString::number( rJob.m_nCopies ) ); - rNumOptions = cupsAddOption( "copies", aVal.getStr(), rNumOptions, (cups_option_t**)rOptions ); + rNumOptions = cupsAddOption( "copies", aVal.getStr(), rNumOptions, reinterpret_cast<cups_option_t**>(rOptions) ); aVal = OString::boolean(rJob.m_bCollate); - rNumOptions = cupsAddOption( "collate", aVal.getStr(), rNumOptions, (cups_option_t**)rOptions ); + rNumOptions = cupsAddOption( "collate", aVal.getStr(), rNumOptions, reinterpret_cast<cups_option_t**>(rOptions) ); } if( ! bBanner ) { - rNumOptions = cupsAddOption( "job-sheets", "none", rNumOptions, (cups_option_t**)rOptions ); + rNumOptions = cupsAddOption( "job-sheets", "none", rNumOptions, reinterpret_cast<cups_option_t**>(rOptions) ); } } @@ -722,7 +722,7 @@ bool CUPSManager::printJobs( const PendingJob& job, const std::vector< OString > sJobName = OUStringToOString(job.faxNumber, aEnc); } - cups_dest_t* pDest = ((cups_dest_t*)m_pDests) + dest_it->second; + cups_dest_t* pDest = static_cast<cups_dest_t*>(m_pDests) + dest_it->second; std::vector< const char* > fnames; for( std::vector< OString >::const_iterator it = files.begin(); @@ -790,7 +790,7 @@ bool CUPSManager::checkPrintersChanged( bool bWait ) // there is no way to query CUPS whether the printer list has changed // so get the dest list anew if( m_nDests && m_pDests ) - cupsFreeDests( m_nDests, (cups_dest_t*)m_pDests ); + cupsFreeDests( m_nDests, static_cast<cups_dest_t*>(m_pDests) ); m_nDests = 0; m_pDests = NULL; runDests(); @@ -841,11 +841,11 @@ bool CUPSManager::setDefaultPrinter( const OUString& rName ) m_aCUPSDestMap.find( rName ); if( nit != m_aCUPSDestMap.end() && m_aCUPSMutex.tryToAcquire() ) { - cups_dest_t* pDests = (cups_dest_t*)m_pDests; + cups_dest_t* pDests = static_cast<cups_dest_t*>(m_pDests); for( int i = 0; i < m_nDests; i++ ) pDests[i].is_default = 0; pDests[ nit->second ].is_default = 1; - cupsSetDests( m_nDests, (cups_dest_t*)m_pDests ); + cupsSetDests( m_nDests, static_cast<cups_dest_t*>(m_pDests) ); m_aDefaultPrinter = rName; m_aCUPSMutex.release(); bSuccess = true; @@ -875,7 +875,7 @@ bool CUPSManager::writePrinterConfig() if( m_aCUPSMutex.tryToAcquire() ) { bDestModified = true; - cups_dest_t* pDest = ((cups_dest_t*)m_pDests) + nit->second; + cups_dest_t* pDest = static_cast<cups_dest_t*>(m_pDests) + nit->second; PrinterInfo& rInfo = prt->second.m_aInfo; // create new option list @@ -902,7 +902,7 @@ bool CUPSManager::writePrinterConfig() } if( bDestModified && m_aCUPSMutex.tryToAcquire() ) { - cupsSetDests( m_nDests, (cups_dest_t*)m_pDests ); + cupsSetDests( m_nDests, static_cast<cups_dest_t*>(m_pDests) ); m_aCUPSMutex.release(); } diff --git a/vcl/unx/generic/printer/jobdata.cxx b/vcl/unx/generic/printer/jobdata.cxx index dacf2e2c1d7d..778961faa1bb 100644 --- a/vcl/unx/generic/printer/jobdata.cxx +++ b/vcl/unx/generic/printer/jobdata.cxx @@ -293,7 +293,7 @@ bool JobData::constructFromStreamBuffer( void* pData, int bytes, JobData& rJobDa { rJobData.m_aContext.setParser( rJobData.m_pParser ); int nBytes = bytes - aStream.Tell(); - char* pRemain = (char*)alloca( bytes - aStream.Tell() ); + char* pRemain = static_cast<char*>(alloca( bytes - aStream.Tell() )); aStream.Read( pRemain, nBytes ); rJobData.m_aContext.rebuildFromStreamBuffer( pRemain, nBytes ); bContext = true; diff --git a/vcl/unx/generic/window/salframe.cxx b/vcl/unx/generic/window/salframe.cxx index e7a5cf85edc4..413d47c02a70 100644 --- a/vcl/unx/generic/window/salframe.cxx +++ b/vcl/unx/generic/window/salframe.cxx @@ -3176,7 +3176,7 @@ long X11SalFrame::HandleKeyEvent( XKeyEvent *pEvent ) KeySym nKeySym; KeySym nUnmodifiedKeySym; int nLen = 2048; - unsigned char *pPrintable = (unsigned char*)alloca( nLen ); + unsigned char *pPrintable = static_cast<unsigned char*>(alloca( nLen )); // singlebyte code composed by input method, the new default if (mpInputContext != NULL && mpInputContext->UseContext()) @@ -3190,7 +3190,7 @@ long X11SalFrame::HandleKeyEvent( XKeyEvent *pEvent ) if ( nStatus == XBufferOverflow ) { nLen *= 2; - pPrintable = (unsigned char*)alloca( nLen ); + pPrintable = static_cast<unsigned char*>(alloca( nLen )); nKeySym = pDisplay_->GetKeySym( pEvent, pPrintable, &nLen, &nUnmodifiedKeySym, &nStatus, mpInputContext->GetContext() ); @@ -3355,7 +3355,7 @@ long X11SalFrame::HandleKeyEvent( XKeyEvent *pEvent ) sal_Unicode *pString; sal_Size nBufferSize = nLen * 2; sal_Size nSize; - pBuffer = (sal_Unicode*) malloc( nBufferSize + 2 ); + pBuffer = static_cast<sal_Unicode*>(malloc( nBufferSize + 2 )); pBuffer[ 0 ] = 0; if (nKeyString != 0) diff --git a/vcl/unx/generic/window/salobj.cxx b/vcl/unx/generic/window/salobj.cxx index 7a7dbf988eb0..e538ae423e99 100644 --- a/vcl/unx/generic/window/salobj.cxx +++ b/vcl/unx/generic/window/salobj.cxx @@ -51,7 +51,7 @@ X11SalObject* X11SalObject::CreateObject( SalFrame* pParent, SystemWindowData* p X11SalObject* pObject = new X11SalObject(); SystemEnvData* pObjData = const_cast<SystemEnvData*>(pObject->GetSystemData()); - if ( ! XShapeQueryExtension( (Display*)pObjData->pDisplay, + if ( ! XShapeQueryExtension( static_cast<Display*>(pObjData->pDisplay), &event_base, &error_base ) ) { delete pObject; @@ -70,7 +70,7 @@ X11SalObject* X11SalObject::CreateObject( SalFrame* pParent, SystemWindowData* p XGetWindowAttributes( pDisp, aObjectParent, &aParentAttr ); SalX11Screen nXScreen( XScreenNumberOfScreen( aParentAttr.screen ) ); Visual* pVisual = (pWindowData && pWindowData->pVisual) ? - (Visual*)pWindowData->pVisual : + static_cast<Visual*>(pWindowData->pVisual) : pSalDisp->GetVisual( nXScreen ).GetVisual(); // get visual info VisualID aVisID = XVisualIDFromVisual( pVisual ); @@ -251,12 +251,12 @@ X11SalObject::~X11SalObject() GetGenericData()->ErrorTrapPush(); if ( maSecondary ) - XDestroyWindow( (Display*)maSystemChildData.pDisplay, maSecondary ); + XDestroyWindow( static_cast<Display*>(maSystemChildData.pDisplay), maSecondary ); if ( maPrimary ) - XDestroyWindow( (Display*)maSystemChildData.pDisplay, maPrimary ); + XDestroyWindow( static_cast<Display*>(maSystemChildData.pDisplay), maPrimary ); if ( maColormap ) - XFreeColormap((Display*)maSystemChildData.pDisplay, maColormap); - XSync( (Display*)maSystemChildData.pDisplay, False ); + XFreeColormap(static_cast<Display*>(maSystemChildData.pDisplay), maColormap); + XSync( static_cast<Display*>(maSystemChildData.pDisplay), False ); GetGenericData()->ErrorTrapPop(); } @@ -274,7 +274,7 @@ X11SalObject::ResetClipRegion() ::Window aShapeWindow = maPrimary; - XGetWindowAttributes ( (Display*)maSystemChildData.pDisplay, + XGetWindowAttributes ( static_cast<Display*>(maSystemChildData.pDisplay), aShapeWindow, &win_attrib ); @@ -283,7 +283,7 @@ X11SalObject::ResetClipRegion() win_size.width = win_attrib.width; win_size.height = win_attrib.height; - XShapeCombineRectangles ( (Display*)maSystemChildData.pDisplay, + XShapeCombineRectangles ( static_cast<Display*>(maSystemChildData.pDisplay), aShapeWindow, dest_kind, 0, 0, // x_off, y_off @@ -332,7 +332,7 @@ X11SalObject::EndSetClipRegion() ::Window aShapeWindow = maPrimary; - XShapeCombineRectangles ( (Display*)maSystemChildData.pDisplay, + XShapeCombineRectangles ( static_cast<Display*>(maSystemChildData.pDisplay), aShapeWindow, dest_kind, 0, 0, // x_off, y_off @@ -352,10 +352,10 @@ X11SalObject::SetPosSize( long nX, long nY, long nWidth, long nHeight ) { if ( maPrimary && maSecondary && nWidth && nHeight ) { - XMoveResizeWindow( (Display*)maSystemChildData.pDisplay, + XMoveResizeWindow( static_cast<Display*>(maSystemChildData.pDisplay), maPrimary, nX, nY, nWidth, nHeight ); - XMoveResizeWindow( (Display*)maSystemChildData.pDisplay, + XMoveResizeWindow( static_cast<Display*>(maSystemChildData.pDisplay), maSecondary, 0, 0, nWidth, nHeight ); } @@ -368,14 +368,14 @@ X11SalObject::Show( bool bVisible ) return; if ( bVisible ) { - XMapWindow( (Display*)maSystemChildData.pDisplay, + XMapWindow( static_cast<Display*>(maSystemChildData.pDisplay), maSecondary ); - XMapWindow( (Display*)maSystemChildData.pDisplay, + XMapWindow( static_cast<Display*>(maSystemChildData.pDisplay), maPrimary ); } else { - XUnmapWindow( (Display*)maSystemChildData.pDisplay, + XUnmapWindow( static_cast<Display*>(maSystemChildData.pDisplay), maPrimary ); - XUnmapWindow( (Display*)maSystemChildData.pDisplay, + XUnmapWindow( static_cast<Display*>(maSystemChildData.pDisplay), maSecondary ); } mbVisible = bVisible; @@ -384,7 +384,7 @@ X11SalObject::Show( bool bVisible ) void X11SalObject::GrabFocus() { if( mbVisible ) - XSetInputFocus( (Display*)maSystemChildData.pDisplay, + XSetInputFocus( static_cast<Display*>(maSystemChildData.pDisplay), maSystemChildData.aWindow, RevertToNone, CurrentTime ); diff --git a/vcl/unx/gtk/a11y/atkfactory.cxx b/vcl/unx/gtk/a11y/atkfactory.cxx index f960b4e65632..d3cb30ad94c4 100644 --- a/vcl/unx/gtk/a11y/atkfactory.cxx +++ b/vcl/unx/gtk/a11y/atkfactory.cxx @@ -79,7 +79,7 @@ atk_noop_object_wrapper_new() { AtkObject *accessible; - accessible = (AtkObject *) g_object_new (atk_noop_object_wrapper_get_type(), NULL); + accessible = static_cast<AtkObject *>(g_object_new (atk_noop_object_wrapper_get_type(), NULL)); g_return_val_if_fail (accessible != NULL, NULL); accessible->role = ATK_ROLE_INVALID; diff --git a/vcl/unx/gtk/a11y/atkhypertext.cxx b/vcl/unx/gtk/a11y/atkhypertext.cxx index 1074dad8ad8a..6b6b4199d8ae 100644 --- a/vcl/unx/gtk/a11y/atkhypertext.cxx +++ b/vcl/unx/gtk/a11y/atkhypertext.cxx @@ -142,7 +142,7 @@ hyper_link_class_init (AtkHyperlinkClass *klass) gobject_class->finalize = hyper_link_finalize; - hyper_parent_class = (GObjectClass *)g_type_class_peek_parent (klass); + hyper_parent_class = static_cast<GObjectClass *>(g_type_class_peek_parent (klass)); klass->get_uri = hyper_link_get_uri; klass->get_object = hyper_link_get_object; @@ -218,7 +218,7 @@ hypertext_get_link( AtkHypertext *hypertext, accessibility::XAccessibleHypertext* pHypertext = getHypertext( hypertext ); if( pHypertext ) { - HyperLink *pLink = (HyperLink *)g_object_new( hyper_link_get_type(), NULL ); + HyperLink *pLink = static_cast<HyperLink *>(g_object_new( hyper_link_get_type(), NULL )); pLink->xLink = pHypertext->getHyperLink( link_index ); if( !pLink->xLink.is() ) { g_object_unref( G_OBJECT( pLink ) ); diff --git a/vcl/unx/gtk/a11y/atktextattributes.cxx b/vcl/unx/gtk/a11y/atktextattributes.cxx index 4bf7d08ffbfb..afa89e0fcf5d 100644 --- a/vcl/unx/gtk/a11y/atktextattributes.cxx +++ b/vcl/unx/gtk/a11y/atktextattributes.cxx @@ -1016,8 +1016,8 @@ DefaultTabStops2String( const uno::Any& rAny ) extern "C" int attr_compare(const void *p1,const void *p2) { - const rtl_uString * pustr = (const rtl_uString *) p1; - const char * pc = *((const char **) p2); + const rtl_uString * pustr = static_cast<const rtl_uString *>(p1); + const char * pc = *static_cast<const char * const *>(p2); return rtl_ustr_ascii_compare_WithLength(pustr->buffer, pustr->length, pc); } @@ -1028,9 +1028,9 @@ find_exported_attributes( sal_Int32 *pArray, { for( sal_Int32 i = 0; i < rAttributeList.getLength(); i++ ) { - const char ** pAttr = (const char **) bsearch(rAttributeList[i].Name.pData, + const char ** pAttr = static_cast<const char **>(bsearch(rAttributeList[i].Name.pData, ExportedTextAttributes, TEXT_ATTRIBUTE_LAST, sizeof(const char *), - attr_compare); + attr_compare)); if( pAttr ) { @@ -1049,7 +1049,7 @@ attribute_set_prepend( AtkAttributeSet* attribute_set, { if( value ) { - AtkAttribute *at = (AtkAttribute *) g_malloc( sizeof (AtkAttribute) ); + AtkAttribute *at = static_cast<AtkAttribute *>(g_malloc( sizeof (AtkAttribute) )); at->name = g_strdup( atk_text_attribute_get_name( attribute ) ); at->value = value; diff --git a/vcl/unx/gtk/a11y/atkwindow.cxx b/vcl/unx/gtk/a11y/atkwindow.cxx index cd9bf9e49c74..84ef89198fe9 100644 --- a/vcl/unx/gtk/a11y/atkwindow.cxx +++ b/vcl/unx/gtk/a11y/atkwindow.cxx @@ -238,7 +238,7 @@ ooo_window_wrapper_real_initialize(AtkObject *obj, gpointer data) static void ooo_window_wrapper_real_finalize (GObject *obj) { - ooo_wrapper_registry_remove( (XAccessible *) g_object_get_data( obj, "ooo:atk-wrapper-key" )); + ooo_wrapper_registry_remove( static_cast<XAccessible *>(g_object_get_data( obj, "ooo:atk-wrapper-key" ))); window_real_finalize( obj ); } diff --git a/vcl/unx/gtk/a11y/atkwrapper.cxx b/vcl/unx/gtk/a11y/atkwrapper.cxx index 80f347888f68..e2fc450d2918 100644 --- a/vcl/unx/gtk/a11y/atkwrapper.cxx +++ b/vcl/unx/gtk/a11y/atkwrapper.cxx @@ -524,7 +524,7 @@ wrapper_ref_relation_set( AtkObject *atk_obj ) { accessibility::AccessibleRelation aRelation = xRelationSet->getRelation( n ); sal_uInt32 nTargetCount = aRelation.TargetSet.getLength(); - AtkObject **pTargets = (AtkObject **) alloca( nTargetCount * sizeof(AtkObject *) ); + AtkObject **pTargets = static_cast<AtkObject **>(alloca( nTargetCount * sizeof(AtkObject *) )); for( sal_uInt32 i = 0; i < nTargetCount; i++ ) { @@ -622,7 +622,7 @@ atk_object_wrapper_class_init (AtkObjectWrapperClass *klass) GObjectClass *gobject_class = G_OBJECT_CLASS( klass ); AtkObjectClass *atk_class = ATK_OBJECT_CLASS( klass ); - parent_class = (GObjectClass *) g_type_class_peek_parent (klass); + parent_class = static_cast<GObjectClass *>(g_type_class_peek_parent (klass)); // GObject methods gobject_class->finalize = atk_object_wrapper_finalize; diff --git a/vcl/unx/gtk/app/gtkdata.cxx b/vcl/unx/gtk/app/gtkdata.cxx index cdbfd0a1b7c7..93b2be8b92d3 100644 --- a/vcl/unx/gtk/app/gtkdata.cxx +++ b/vcl/unx/gtk/app/gtkdata.cxx @@ -56,7 +56,7 @@ GdkFilterReturn call_filterGdkEvent( GdkXEvent* sys_event, GdkEvent* event, gpointer data ) { - GtkSalDisplay *pDisplay = (GtkSalDisplay *)data; + GtkSalDisplay *pDisplay = static_cast<GtkSalDisplay *>(data); return pDisplay->filterGdkEvent( sys_event, event ); } } @@ -110,13 +110,13 @@ extern "C" { void signalScreenSizeChanged( GdkScreen* pScreen, gpointer data ) { - GtkSalDisplay* pDisp = (GtkSalDisplay*)data; + GtkSalDisplay* pDisp = static_cast<GtkSalDisplay*>(data); pDisp->screenSizeChanged( pScreen ); } void signalMonitorsChanged( GdkScreen* pScreen, gpointer data ) { - GtkSalDisplay* pDisp = (GtkSalDisplay*)data; + GtkSalDisplay* pDisp = static_cast<GtkSalDisplay*>(data); pDisp->monitorsChanged( pScreen ); } @@ -127,7 +127,7 @@ GdkFilterReturn GtkSalDisplay::filterGdkEvent( GdkXEvent* sys_event, { #if !GTK_CHECK_VERSION(3,0,0) GdkFilterReturn aFilterReturn = GDK_FILTER_CONTINUE; - XEvent *pEvent = (XEvent *)sys_event; + XEvent *pEvent = static_cast<XEvent *>(sys_event); // dispatch all XEvents to event callback if( GetSalData()->m_pInstance-> @@ -919,7 +919,7 @@ void GtkSalTimer::Stop() gboolean GtkData::userEventFn( gpointer data ) { gboolean bContinue = FALSE; - GtkData *pThis = (GtkData *) data; + GtkData *pThis = static_cast<GtkData *>(data); SalGenericData *pData = GetGenericData(); osl::Guard< comphelper::SolarMutex > aGuard( pData->m_pInstance->GetYieldMutex() ); const SalGenericDisplay *pDisplay = pData->GetDisplay(); diff --git a/vcl/unx/gtk/fpicker/SalGtkFilePicker.cxx b/vcl/unx/gtk/fpicker/SalGtkFilePicker.cxx index fb14bdbd33a9..4392f5d3924d 100644 --- a/vcl/unx/gtk/fpicker/SalGtkFilePicker.cxx +++ b/vcl/unx/gtk/fpicker/SalGtkFilePicker.cxx @@ -1765,7 +1765,7 @@ static gboolean case_insensitive_filter (const GtkFileFilterInfo *filter_info, gpointer data) { gboolean bRetval = false; - const char *pFilter = (const char *) data; + const char *pFilter = static_cast<const char *>(data); g_return_val_if_fail( data != NULL, false ); g_return_val_if_fail( filter_info != NULL, false ); diff --git a/vcl/unx/gtk/window/gloactiongroup.cxx b/vcl/unx/gtk/window/gloactiongroup.cxx index 11145e3c44c3..69dea4054880 100644 --- a/vcl/unx/gtk/window/gloactiongroup.cxx +++ b/vcl/unx/gtk/window/gloactiongroup.cxx @@ -132,7 +132,7 @@ g_lo_action_group_list_actions (GActionGroup *group) g_hash_table_iter_init (&iter, loGroup->priv->table); while (g_hash_table_iter_next (&iter, &key, NULL)) - keys[i++] = g_strdup ((gchar*) key); + keys[i++] = g_strdup (static_cast<gchar*>(key)); g_assert_cmpint (i, ==, n); keys[n] = NULL; @@ -428,7 +428,7 @@ g_lo_action_group_clear (GLOActionGroup *group) for (GList* element = g_list_first (keys); element != NULL; element = g_list_next (element)) { - g_lo_action_group_remove (group, (gchar*) element->data); + g_lo_action_group_remove (group, static_cast<gchar*>(element->data)); } g_list_free (keys); diff --git a/vcl/unx/gtk/window/gtkobject.cxx b/vcl/unx/gtk/window/gtkobject.cxx index 0299d6826ec5..2690513ce742 100644 --- a/vcl/unx/gtk/window/gtkobject.cxx +++ b/vcl/unx/gtk/window/gtkobject.cxx @@ -173,7 +173,7 @@ const SystemEnvData* GtkSalObject::GetSystemData() const gboolean GtkSalObject::signalButton( GtkWidget*, GdkEventButton* pEvent, gpointer object ) { - GtkSalObject* pThis = (GtkSalObject*)object; + GtkSalObject* pThis = static_cast<GtkSalObject*>(object); if( pEvent->type == GDK_BUTTON_PRESS ) { @@ -185,7 +185,7 @@ gboolean GtkSalObject::signalButton( GtkWidget*, GdkEventButton* pEvent, gpointe gboolean GtkSalObject::signalFocus( GtkWidget*, GdkEventFocus* pEvent, gpointer object ) { - GtkSalObject* pThis = (GtkSalObject*)object; + GtkSalObject* pThis = static_cast<GtkSalObject*>(object); pThis->CallCallback( pEvent->in ? SALOBJ_EVENT_GETFOCUS : SALOBJ_EVENT_LOSEFOCUS, NULL ); @@ -194,7 +194,7 @@ gboolean GtkSalObject::signalFocus( GtkWidget*, GdkEventFocus* pEvent, gpointer void GtkSalObject::signalDestroy( GtkWidget* pObj, gpointer object ) { - GtkSalObject* pThis = (GtkSalObject*)object; + GtkSalObject* pThis = static_cast<GtkSalObject*>(object); if( pObj == pThis->m_pSocket ) { pThis->m_pSocket = NULL; diff --git a/vcl/unx/gtk/window/gtksalframe.cxx b/vcl/unx/gtk/window/gtksalframe.cxx index 1b8bdc52da46..f56bbade1247 100644 --- a/vcl/unx/gtk/window/gtksalframe.cxx +++ b/vcl/unx/gtk/window/gtksalframe.cxx @@ -1253,7 +1253,7 @@ static void lcl_set_user_time( GtkWindow* i_pWindow, guint32 i_nTime ) GtkSalFrame *GtkSalFrame::getFromWindow( GtkWindow *pWindow ) { - return (GtkSalFrame *) g_object_get_data( G_OBJECT( pWindow ), "SalFrame" ); + return static_cast<GtkSalFrame *>(g_object_get_data( G_OBJECT( pWindow ), "SalFrame" )); } void GtkSalFrame::Init( SalFrame* pParent, sal_uLong nStyle ) @@ -1588,7 +1588,7 @@ bitmapToPixbuf( SalBitmap *pSalBitmap, SalBitmap *pSalAlpha ) g_return_val_if_fail( pSalAlpha->GetSize() == aSize, NULL ); 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; for( nY = 0; nY < pBitmap->mnHeight; nY++ ) @@ -3217,7 +3217,7 @@ bool GtkSalFrame::Dispatch( const XEvent* pEvent ) gboolean GtkSalFrame::signalButton( GtkWidget*, GdkEventButton* pEvent, gpointer frame ) { - GtkSalFrame* pThis = (GtkSalFrame*)frame; + GtkSalFrame* pThis = static_cast<GtkSalFrame*>(frame); SalMouseEvent aEvent; sal_uInt16 nEventType = 0; @@ -3308,7 +3308,7 @@ gboolean GtkSalFrame::signalButton( GtkWidget*, GdkEventButton* pEvent, gpointer gboolean GtkSalFrame::signalScroll( GtkWidget*, GdkEvent* pEvent, gpointer frame ) { - GtkSalFrame* pThis = (GtkSalFrame*)frame; + GtkSalFrame* pThis = static_cast<GtkSalFrame*>(frame); GdkEventScroll* pSEvent = reinterpret_cast<GdkEventScroll*>(pEvent); #if GTK_CHECK_VERSION(3,0,0) @@ -3349,7 +3349,7 @@ gboolean GtkSalFrame::signalScroll( GtkWidget*, GdkEvent* pEvent, gpointer frame #if GTK_CHECK_VERSION(3,14,0) void GtkSalFrame::gestureSwipe(GtkGestureSwipe* gesture, gdouble velocity_x, gdouble velocity_y, gpointer frame) { - GtkSalFrame* pThis = (GtkSalFrame*)frame; + GtkSalFrame* pThis = static_cast<GtkSalFrame*>(frame); SalSwipeEvent aEvent; aEvent.mnVelocityX = velocity_x; @@ -3369,7 +3369,7 @@ void GtkSalFrame::gestureSwipe(GtkGestureSwipe* gesture, gdouble velocity_x, gdo void GtkSalFrame::gestureLongPress(GtkGestureLongPress* gesture, gpointer frame) { - GtkSalFrame* pThis = (GtkSalFrame*)frame; + GtkSalFrame* pThis = static_cast<GtkSalFrame*>(frame); SalLongPressEvent aEvent; @@ -3386,7 +3386,7 @@ void GtkSalFrame::gestureLongPress(GtkGestureLongPress* gesture, gpointer frame) gboolean GtkSalFrame::signalMotion( GtkWidget*, GdkEventMotion* pEvent, gpointer frame ) { - GtkSalFrame* pThis = (GtkSalFrame*)frame; + GtkSalFrame* pThis = static_cast<GtkSalFrame*>(frame); SalMouseEvent aEvent; aEvent.mnTime = pEvent->time; @@ -3428,7 +3428,7 @@ gboolean GtkSalFrame::signalMotion( GtkWidget*, GdkEventMotion* pEvent, gpointer gboolean GtkSalFrame::signalCrossing( GtkWidget*, GdkEventCrossing* pEvent, gpointer frame ) { - GtkSalFrame* pThis = (GtkSalFrame*)frame; + GtkSalFrame* pThis = static_cast<GtkSalFrame*>(frame); SalMouseEvent aEvent; aEvent.mnTime = pEvent->time; aEvent.mnX = (long)pEvent->x_root - pThis->maGeometry.nX; @@ -3493,7 +3493,7 @@ void GtkSalFrame::damaged (const basegfx::B2IBox& rDamageRect) // blit our backing basebmp buffer to the target cairo context cr gboolean GtkSalFrame::signalDraw( GtkWidget*, cairo_t *cr, gpointer frame ) { - GtkSalFrame* pThis = (GtkSalFrame*)frame; + GtkSalFrame* pThis = static_cast<GtkSalFrame*>(frame); cairo_save(cr); @@ -3515,7 +3515,7 @@ gboolean GtkSalFrame::signalDraw( GtkWidget*, cairo_t *cr, gpointer frame ) #else gboolean GtkSalFrame::signalExpose( GtkWidget*, GdkEventExpose* pEvent, gpointer frame ) { - GtkSalFrame* pThis = (GtkSalFrame*)frame; + GtkSalFrame* pThis = static_cast<GtkSalFrame*>(frame); struct SalPaintEvent aEvent( pEvent->area.x, pEvent->area.y, pEvent->area.width, pEvent->area.height ); @@ -3550,7 +3550,7 @@ void GtkSalFrame::TriggerPaintEvent() gboolean GtkSalFrame::signalFocus( GtkWidget*, GdkEventFocus* pEvent, gpointer frame ) { - GtkSalFrame* pThis = (GtkSalFrame*)frame; + GtkSalFrame* pThis = static_cast<GtkSalFrame*>(frame); X11SalInstance *pSalInstance = static_cast< X11SalInstance* >(GetSalData()->m_pInstance); @@ -3603,7 +3603,7 @@ static OString getDisplayString() gboolean GtkSalFrame::signalMap( GtkWidget *pWidget, GdkEvent*, gpointer frame ) { - GtkSalFrame* pThis = (GtkSalFrame*)frame; + GtkSalFrame* pThis = static_cast<GtkSalFrame*>(frame); #if !GTK_CHECK_VERSION(3,8,0) //Spawn off a helper program that will attempt to set this fullscreen @@ -3658,7 +3658,7 @@ gboolean GtkSalFrame::signalMap( GtkWidget *pWidget, GdkEvent*, gpointer frame ) gboolean GtkSalFrame::signalUnmap( GtkWidget*, GdkEvent*, gpointer frame ) { - GtkSalFrame* pThis = (GtkSalFrame*)frame; + GtkSalFrame* pThis = static_cast<GtkSalFrame*>(frame); pThis->CallCallback( SALEVENT_RESIZE, NULL ); @@ -3667,7 +3667,7 @@ gboolean GtkSalFrame::signalUnmap( GtkWidget*, GdkEvent*, gpointer frame ) gboolean GtkSalFrame::signalConfigure( GtkWidget*, GdkEventConfigure* pEvent, gpointer frame ) { - GtkSalFrame* pThis = (GtkSalFrame*)frame; + GtkSalFrame* pThis = static_cast<GtkSalFrame*>(frame); bool bMoved = false, bSized = false; int x = pEvent->x, y = pEvent->y; @@ -3753,7 +3753,7 @@ gboolean GtkSalFrame::signalConfigure( GtkWidget*, GdkEventConfigure* pEvent, gp gboolean GtkSalFrame::signalKey( GtkWidget*, GdkEventKey* pEvent, gpointer frame ) { - GtkSalFrame* pThis = (GtkSalFrame*)frame; + GtkSalFrame* pThis = static_cast<GtkSalFrame*>(frame); vcl::DeletionListener aDel( pThis ); @@ -3869,7 +3869,7 @@ gboolean GtkSalFrame::signalKey( GtkWidget*, GdkEventKey* pEvent, gpointer frame gboolean GtkSalFrame::signalDelete( GtkWidget*, GdkEvent*, gpointer frame ) { - GtkSalFrame* pThis = (GtkSalFrame*)frame; + GtkSalFrame* pThis = static_cast<GtkSalFrame*>(frame); pThis->CallCallback( SALEVENT_CLOSE, NULL ); @@ -3878,7 +3878,7 @@ gboolean GtkSalFrame::signalDelete( GtkWidget*, GdkEvent*, gpointer frame ) void GtkSalFrame::signalStyleSet( GtkWidget*, GtkStyle* pPrevious, gpointer frame ) { - GtkSalFrame* pThis = (GtkSalFrame*)frame; + GtkSalFrame* pThis = static_cast<GtkSalFrame*>(frame); // every frame gets an initial style set on creation // do not post these as the whole application tends to @@ -3919,7 +3919,7 @@ void GtkSalFrame::signalStyleSet( GtkWidget*, GtkStyle* pPrevious, gpointer fram gboolean GtkSalFrame::signalState( GtkWidget*, GdkEvent* pEvent, gpointer frame ) { - GtkSalFrame* pThis = (GtkSalFrame*)frame; + GtkSalFrame* pThis = static_cast<GtkSalFrame*>(frame); if( (pThis->m_nState & GDK_WINDOW_STATE_ICONIFIED) != (pEvent->window_state.new_window_state & GDK_WINDOW_STATE_ICONIFIED ) ) { pThis->getDisplay()->SendInternalEvent( pThis, NULL, SALEVENT_RESIZE ); @@ -3949,14 +3949,14 @@ gboolean GtkSalFrame::signalState( GtkWidget*, GdkEvent* pEvent, gpointer frame gboolean GtkSalFrame::signalVisibility( GtkWidget*, GdkEventVisibility* pEvent, gpointer frame ) { - GtkSalFrame* pThis = (GtkSalFrame*)frame; + GtkSalFrame* pThis = static_cast<GtkSalFrame*>(frame); pThis->m_nVisibility = pEvent->state; return true; } void GtkSalFrame::signalDestroy( GtkWidget* pObj, gpointer frame ) { - GtkSalFrame* pThis = (GtkSalFrame*)frame; + GtkSalFrame* pThis = static_cast<GtkSalFrame*>(frame); if( pObj == pThis->m_pWindow ) { pThis->m_pFixedContainer = NULL; @@ -4232,7 +4232,7 @@ static bool checkSingleKeyCommitHack( guint keyval, sal_Unicode cCode ) #endif void GtkSalFrame::IMHandler::signalIMCommit( GtkIMContext* CONTEXT_ARG, gchar* pText, gpointer im_handler ) { - GtkSalFrame::IMHandler* pThis = (GtkSalFrame::IMHandler*)im_handler; + GtkSalFrame::IMHandler* pThis = static_cast<GtkSalFrame::IMHandler*>(im_handler); SolarMutexGuard aGuard; vcl::DeletionListener aDel( pThis->m_pFrame ); @@ -4302,7 +4302,7 @@ void GtkSalFrame::IMHandler::signalIMCommit( GtkIMContext* CONTEXT_ARG, gchar* p void GtkSalFrame::IMHandler::signalIMPreeditChanged( GtkIMContext*, gpointer im_handler ) { - GtkSalFrame::IMHandler* pThis = (GtkSalFrame::IMHandler*)im_handler; + GtkSalFrame::IMHandler* pThis = static_cast<GtkSalFrame::IMHandler*>(im_handler); char* pText = NULL; PangoAttrList* pAttrs = NULL; @@ -4356,7 +4356,7 @@ void GtkSalFrame::IMHandler::signalIMPreeditChanged( GtkIMContext*, gpointer im_ tmp_list = attr_list = pango_attr_iterator_get_attrs (iter); while (tmp_list) { - PangoAttribute *pango_attr = (PangoAttribute *)(tmp_list->data); + PangoAttribute *pango_attr = static_cast<PangoAttribute *>(tmp_list->data); switch (pango_attr->klass->type) { @@ -4414,7 +4414,7 @@ void GtkSalFrame::IMHandler::signalIMPreeditStart( GtkIMContext*, gpointer /*im_ void GtkSalFrame::IMHandler::signalIMPreeditEnd( GtkIMContext*, gpointer im_handler ) { - GtkSalFrame::IMHandler* pThis = (GtkSalFrame::IMHandler*)im_handler; + GtkSalFrame::IMHandler* pThis = static_cast<GtkSalFrame::IMHandler*>(im_handler); pThis->m_bPreeditJustChanged = true; diff --git a/vcl/unx/gtk/window/gtksalmenu.cxx b/vcl/unx/gtk/window/gtksalmenu.cxx index afe9e7a4be1b..3a92b6b45cd7 100644 --- a/vcl/unx/gtk/window/gtksalmenu.cxx +++ b/vcl/unx/gtk/window/gtksalmenu.cxx @@ -209,7 +209,7 @@ void RemoveSpareSectionsFromNativeMenu( GLOMenu* pMenu, GList** pOldCommandList, gint CompareStr( gpointer str1, gpointer str2 ) { - return g_strcmp0( (const gchar*) str1, (const gchar*) str2 ); + return g_strcmp0( static_cast<const gchar*>(str1), static_cast<const gchar*>(str2) ); } void RemoveUnusedCommands( GLOActionGroup* pActionGroup, GList* pOldCommandList, GList* pNewCommandList ) @@ -244,7 +244,7 @@ void RemoveUnusedCommands( GLOActionGroup* pActionGroup, GList* pOldCommandList, GList* pCommand = g_list_first( pOldCommandList ); pOldCommandList = g_list_remove_link( pOldCommandList, pCommand ); - gchar* aCommand = (gchar*) g_list_nth_data( pCommand, 0 ); + gchar* aCommand = static_cast<gchar*>(g_list_nth_data( pCommand, 0 )); g_lo_action_group_remove( pActionGroup, aCommand ); diff --git a/vcl/unx/gtk/window/hudawareness.cxx b/vcl/unx/gtk/window/hudawareness.cxx index 866c1b1f0701..947f404f9d52 100644 --- a/vcl/unx/gtk/window/hudawareness.cxx +++ b/vcl/unx/gtk/window/hudawareness.cxx @@ -33,7 +33,7 @@ hud_awareness_method_call (GDBusConnection * /* connection */, GDBusMethodInvocation *invocation, gpointer user_data) { - HudAwarenessHandle *handle = (HudAwarenessHandle*) user_data; + HudAwarenessHandle *handle = static_cast<HudAwarenessHandle*>(user_data); if (g_str_equal (method_name, "HudActiveChanged")) { @@ -82,7 +82,7 @@ hud_awareness_register (GDBusConnection *connection, g_assert (iface != NULL); } - handle = (HudAwarenessHandle*) g_malloc (sizeof (HudAwarenessHandle)); + handle = static_cast<HudAwarenessHandle*>(g_malloc (sizeof (HudAwarenessHandle))); object_id = g_dbus_connection_register_object (connection, object_path, iface, &vtable, handle, &g_free, error); @@ -92,7 +92,7 @@ hud_awareness_register (GDBusConnection *connection, return 0; } - handle->connection = (GDBusConnection*) g_object_ref (connection); + handle->connection = static_cast<GDBusConnection*>(g_object_ref (connection)); handle->callback = callback; handle->user_data = user_data; handle->notify = notify; diff --git a/vcl/unx/kde/kdedata.cxx b/vcl/unx/kde/kdedata.cxx index 8af9686d1f39..c97882beba37 100644 --- a/vcl/unx/kde/kdedata.cxx +++ b/vcl/unx/kde/kdedata.cxx @@ -94,7 +94,7 @@ KDEXLib::~KDEXLib() // to the gtk plugin #if ! defined USE_RANDR || ! (defined LINUX && defined X86_64) // properly deinitialize KApplication - delete (VCLKDEApplication*)m_pApplication; + delete static_cast<VCLKDEApplication*>(m_pApplication); #endif // free the faked cmdline arguments no longer needed by KApplication for( int i = 0; i < m_nFakeCmdLineArgs; i++ ) |