diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2015-03-28 19:00:50 +0100 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2015-03-28 19:09:19 +0100 |
commit | 5bd4b3fc5912a81e421902fa81274e4cde86eb15 (patch) | |
tree | 8b2829d6542a27b99856bc39f6d166fdcf7c66f0 /extensions/source/plugin | |
parent | f99a73ab22ac02d8750382bf171a9b18e8f5afdb (diff) |
Clean up C-style casts from pointers to void
Change-Id: Ifd2e057ec440a072a342b307175d34cc6885b2e3
Diffstat (limited to 'extensions/source/plugin')
-rw-r--r-- | extensions/source/plugin/base/nfuncs.cxx | 8 | ||||
-rw-r--r-- | extensions/source/plugin/base/xplugin.cxx | 4 | ||||
-rw-r--r-- | extensions/source/plugin/inc/plugin/unx/plugcon.hxx | 2 | ||||
-rw-r--r-- | extensions/source/plugin/unx/npnapi.cxx | 54 | ||||
-rw-r--r-- | extensions/source/plugin/unx/nppapi.cxx | 24 | ||||
-rw-r--r-- | extensions/source/plugin/unx/plugcon.cxx | 2 |
6 files changed, 47 insertions, 47 deletions
diff --git a/extensions/source/plugin/base/nfuncs.cxx b/extensions/source/plugin/base/nfuncs.cxx index c3a734fc7ba8..dfeff975ff07 100644 --- a/extensions/source/plugin/base/nfuncs.cxx +++ b/extensions/source/plugin/base/nfuncs.cxx @@ -533,7 +533,7 @@ int32_t SAL_CALL NP_LOADDS NPN_Write( NPP instance, NPStream* stream, int32_t l return 0; pImpl->enterPluginCallback(); - ::com::sun::star::uno::Sequence<sal_Int8> Bytes( (sal_Int8*)buffer, len ); + ::com::sun::star::uno::Sequence<sal_Int8> Bytes( static_cast<sal_Int8*>(buffer), len ); static_cast<PluginOutputStream*>(pStream)->getOutputStream()->writeBytes( Bytes ); pImpl->leavePluginCallback(); @@ -570,15 +570,15 @@ NPError SAL_CALL NP_LOADDS NPN_GetValue( NPP instance, NPNVariable variable, vo #endif case NPNVjavascriptEnabledBool: // no javascript - *(NPBool*)value = false; + *static_cast<NPBool*>(value) = false; break; case NPNVasdEnabledBool: // no SmartUpdate - *(NPBool*)value = false; + *static_cast<NPBool*>(value) = false; break; case NPNVisOfflineBool: // no offline browsing - *(NPBool*)value = false; + *static_cast<NPBool*>(value) = false; break; } diff --git a/extensions/source/plugin/base/xplugin.cxx b/extensions/source/plugin/base/xplugin.cxx index 2107b6de5957..cef5e4be347c 100644 --- a/extensions/source/plugin/base/xplugin.cxx +++ b/extensions/source/plugin/base/xplugin.cxx @@ -519,7 +519,7 @@ void XPlugin_Impl::loadPlugin() #if defined( UNX ) && !(defined(MACOSX)) if (pEnvData->pDisplay) // headless? { - XSync( (Display*)pEnvData->pDisplay, False ); + XSync( static_cast<Display*>(pEnvData->pDisplay), False ); } #endif if( ! getPluginComm() ) @@ -573,7 +573,7 @@ void XPlugin_Impl::loadPlugin() #elif defined( UNX ) if (pEnvData->pDisplay) // headless? { - XSync( (Display*)pEnvData->pDisplay, False ); + XSync( static_cast<Display*>(pEnvData->pDisplay), False ); m_aNPWindow.window = reinterpret_cast<void*>(pEnvData->aWindow); } else diff --git a/extensions/source/plugin/inc/plugin/unx/plugcon.hxx b/extensions/source/plugin/inc/plugin/unx/plugcon.hxx index 921486e1f941..55ac2af908ab 100644 --- a/extensions/source/plugin/inc/plugin/unx/plugcon.hxx +++ b/extensions/source/plugin/inc/plugin/unx/plugcon.hxx @@ -157,7 +157,7 @@ public: NPError GetNPError( MediatorMessage* pMes ) { - NPError* pErr = (NPError*)pMes->GetBytes(); + NPError* pErr = static_cast<NPError*>(pMes->GetBytes()); NPError aErr = *pErr; delete [] pErr; return aErr; diff --git a/extensions/source/plugin/unx/npnapi.cxx b/extensions/source/plugin/unx/npnapi.cxx index 7e345300a556..9721a55ffdf8 100644 --- a/extensions/source/plugin/unx/npnapi.cxx +++ b/extensions/source/plugin/unx/npnapi.cxx @@ -64,7 +64,7 @@ static void* l_NPN_MemAlloc( uint32_t nBytes ) static void l_NPN_MemFree( void* pMem ) { - delete [] (char*)pMem; + delete [] static_cast<char*>(pMem); } static uint32_t l_NPN_MemFlush( uint32_t /*nSize*/ ) @@ -382,36 +382,36 @@ static NPError l_NPN_GetValue( NPP, NPNVariable variable, void* value ) switch( (int)variable ) { case NPNVxDisplay: - *((Display**)value) = pXtAppDisplay; + *static_cast<Display**>(value) = pXtAppDisplay; SAL_INFO("extensions.plugin", "Display requested"); break; case NPNVxtAppContext: - *((XtAppContext*)value) = app_context; + *static_cast<XtAppContext*>(value) = app_context; SAL_INFO("extensions.plugin", "AppContext requested"); break; case NPNVjavascriptEnabledBool: // no javascript - *(NPBool*)value = false; + *static_cast<NPBool*>(value) = false; SAL_INFO("extensions.plugin", "javascript enabled requested"); break; case NPNVasdEnabledBool: // no SmartUpdate - *(NPBool*)value = false; + *static_cast<NPBool*>(value) = false; SAL_INFO("extensions.plugin", "smart update enabled requested"); break; case NPNVisOfflineBool: // no offline browsing - *(NPBool*)value = false; + *static_cast<NPBool*>(value) = false; SAL_INFO("extensions.plugin", "offline browsing requested"); break; case NPNVSupportsXEmbedBool: // asking xembed - *(int*)value = int(true); + *static_cast<int*>(value) = int(true); SAL_INFO("extensions.plugin", "xembed requested"); break; case NPNVToolkit: # if ENABLE_GTK - *(int*)value = NPNVGtk2; + *static_cast<int*>(value) = NPNVGtk2; # else *(int*)value = 0; # endif @@ -557,7 +557,7 @@ IMPL_LINK( PluginConnector, WorkOnNewMessageHdl, Mediator*, /*pMediator*/ ) // to first destroy the widget and then destroy // the instance, so mimic that behaviour here if( pInst->pShell ) - XtDestroyWidget( (Widget)pInst->pShell ); + XtDestroyWidget( static_cast<Widget>(pInst->pShell) ); pInst->pWidget = pInst->pShell = NULL; @@ -581,7 +581,7 @@ IMPL_LINK( PluginConnector, WorkOnNewMessageHdl, Mediator*, /*pMediator*/ ) reinterpret_cast<char*>(&aRet), sizeof( aRet ), pSave->buf, pSave->len, NULL ); - delete [] (char*)pSave->buf; + delete [] static_cast<char*>(pSave->buf); } else Respond( pMessage->m_nID, @@ -614,7 +614,7 @@ IMPL_LINK( PluginConnector, WorkOnNewMessageHdl, Mediator*, /*pMediator*/ ) pStream->end = pMessage->GetUINT32(); pStream->lastmodified = pMessage->GetUINT32(); pStream->pdata = pStream->ndata = pStream->notifyData = NULL; - NPBool* pSeekable = (NPBool*)pMessage->GetBytes(); + NPBool* pSeekable = static_cast<NPBool*>(pMessage->GetBytes()); m_aNPWrapStreams.push_back( pStream ); uint16_t nStype = NP_ASFILE; NPError aRet = aPluginFuncs.newstream( instance, pType, pStream, @@ -641,15 +641,15 @@ IMPL_LINK( PluginConnector, WorkOnNewMessageHdl, Mediator*, /*pMediator*/ ) case eNPP_New: { char* pType = pMessage->GetString(); - uint16_t* pMode = (uint16_t*)pMessage->GetBytes(); - int16_t* pArgc = (int16_t*)pMessage->GetBytes(); + uint16_t* pMode = static_cast<uint16_t*>(pMessage->GetBytes()); + int16_t* pArgc = static_cast<int16_t*>(pMessage->GetBytes()); NPP instance = new NPP_t; instance->pdata = instance->ndata = NULL; sal_uLong nArgnBytes, nArgvBytes; - char* pArgn = (char*)pMessage->GetBytes( nArgnBytes ); - char* pArgv = (char*)pMessage->GetBytes( nArgvBytes ); + char* pArgn = static_cast<char*>(pMessage->GetBytes( nArgnBytes )); + char* pArgv = static_cast<char*>(pMessage->GetBytes( nArgvBytes )); sal_uLong nSaveBytes; - char* pSavedData = (char*)pMessage->GetBytes( nSaveBytes ); + char* pSavedData = static_cast<char*>(pMessage->GetBytes( nSaveBytes )); ConnectorInstance* pInst = new ConnectorInstance( instance, pType, *pArgc, @@ -705,7 +705,7 @@ IMPL_LINK( PluginConnector, WorkOnNewMessageHdl, Mediator*, /*pMediator*/ ) { sal_uInt32 nInstance = pMessage->GetUINT32(); ConnectorInstance* pInst= m_aInstances[ nInstance ]; - NPWindow* pWindow = (NPWindow*)pMessage->GetBytes(); + NPWindow* pWindow = static_cast<NPWindow*>(pMessage->GetBytes()); if( pWindow->width < 1 ) pWindow->width = 1; @@ -768,7 +768,7 @@ IMPL_LINK( PluginConnector, WorkOnNewMessageHdl, Mediator*, /*pMediator*/ ) } // fill in NPWindow and NPCallbackStruct - pInst->window.window = reinterpret_cast<void*>(XtWindow( (Widget)pInst->pWidget )); + pInst->window.window = reinterpret_cast<void*>(XtWindow( static_cast<Widget>(pInst->pWidget) )); pInst->window.x = 0; pInst->window.y = 0; pInst->window.width = pWindow->width; @@ -780,16 +780,16 @@ IMPL_LINK( PluginConnector, WorkOnNewMessageHdl, Mediator*, /*pMediator*/ ) pInst->window.ws_info = &pInst->ws_info; pInst->window.type = NPWindowTypeWindow; pInst->ws_info.type = NP_SETWINDOW; - pInst->ws_info.display = XtDisplay( (Widget)pInst->pWidget ); - pInst->ws_info.visual = DefaultVisualOfScreen( XtScreen( (Widget)pInst->pWidget ) ); - pInst->ws_info.colormap = DefaultColormapOfScreen( XtScreen( (Widget)pInst->pWidget ) ); - pInst->ws_info.depth = DefaultDepthOfScreen( XtScreen( (Widget)pInst->pWidget ) ); + pInst->ws_info.display = XtDisplay( static_cast<Widget>(pInst->pWidget) ); + pInst->ws_info.visual = DefaultVisualOfScreen( XtScreen( static_cast<Widget>(pInst->pWidget) ) ); + pInst->ws_info.colormap = DefaultColormapOfScreen( XtScreen( static_cast<Widget>(pInst->pWidget) ) ); + pInst->ws_info.depth = DefaultDepthOfScreen( XtScreen( static_cast<Widget>(pInst->pWidget) ) ); - XtResizeWidget( (Widget)pInst->pShell, + XtResizeWidget( static_cast<Widget>(pInst->pShell), pInst->window.width, pInst->window.height, 0 ); - XtResizeWidget( (Widget)pInst->pWidget, + XtResizeWidget( static_cast<Widget>(pInst->pWidget), pInst->window.width, pInst->window.height, 0 ); @@ -824,8 +824,8 @@ IMPL_LINK( PluginConnector, WorkOnNewMessageHdl, Mediator*, /*pMediator*/ ) sal_uInt32 nInstance = pMessage->GetUINT32(); NPP instance = m_aInstances[ nInstance ]->instance; char* url = pMessage->GetString(); - NPReason* pReason = (NPReason*)pMessage->GetBytes(); - void** notifyData = (void**)pMessage->GetBytes(); + NPReason* pReason = static_cast<NPReason*>(pMessage->GetBytes()); + void** notifyData = static_cast<void**>(pMessage->GetBytes()); aPluginFuncs.urlnotify( instance, url, *pReason, *notifyData ); delete [] url; delete [] pReason; @@ -859,7 +859,7 @@ IMPL_LINK( PluginConnector, WorkOnNewMessageHdl, Mediator*, /*pMediator*/ ) NPStream* pStream = m_aNPWrapStreams[ nFileID ]; int32_t offset = pMessage->GetUINT32(); sal_uLong len; - char* buffer = (char*)pMessage->GetBytes( len ); + char* buffer = static_cast<char*>(pMessage->GetBytes( len )); int32_t nRet = aPluginFuncs.write( instance, pStream, offset, len, buffer ); SAL_INFO( diff --git a/extensions/source/plugin/unx/nppapi.cxx b/extensions/source/plugin/unx/nppapi.cxx index 68802abfd1cf..6197fcf2f62e 100644 --- a/extensions/source/plugin/unx/nppapi.cxx +++ b/extensions/source/plugin/unx/nppapi.cxx @@ -118,7 +118,7 @@ IMPL_LINK( PluginConnector, WorkOnNewMessageHdl, Mediator*, /*pMediator*/ ) NPP instance = m_aInstances[ nInstance ]->instance; char* pUrl = pMessage->GetString(); char* pWindow = pMessage->GetString(); - void** pNotifyData = (void**)pMessage->GetBytes(); + void** pNotifyData = static_cast<void**>(pMessage->GetBytes()); NPError aRet = NPN_GetURLNotify( instance, pUrl, pWindow, *pNotifyData ); Respond( pMessage->m_nID, @@ -134,7 +134,7 @@ IMPL_LINK( PluginConnector, WorkOnNewMessageHdl, Mediator*, /*pMediator*/ ) NPP instance = m_aInstances[ nInstance ]->instance; sal_uInt32 nFileID = pMessage->GetUINT32(); char* pUrl = pMessage->GetString(); - NPError* pReason = (NPError*)pMessage->GetBytes(); + NPError* pReason = static_cast<NPError*>(pMessage->GetBytes()); NPError aRet = NPERR_FILE_NOT_FOUND; if( nFileID < static_cast<sal_uInt32>(m_aNPWrapStreams.size()) ) { @@ -209,9 +209,9 @@ IMPL_LINK( PluginConnector, WorkOnNewMessageHdl, Mediator*, /*pMediator*/ ) char* pUrl = pMessage->GetString(); char* pTarget = pMessage->GetString(); sal_uInt32 nLen = pMessage->GetUINT32(); - char* pBuf = (char*)pMessage->GetBytes(); - NPBool* pFile = (NPBool*)pMessage->GetBytes(); - void** pNData = (void**)pMessage->GetBytes(); + char* pBuf = static_cast<char*>(pMessage->GetBytes()); + NPBool* pFile = static_cast<NPBool*>(pMessage->GetBytes()); + void** pNData = static_cast<void**>(pMessage->GetBytes()); NPError aRet = NPN_PostURLNotify( instance, pUrl, pTarget, nLen, pBuf, *pFile, *pNData ); Respond( pMessage->m_nID, reinterpret_cast<char*>(&aRet), sizeof( aRet ), NULL ); @@ -229,8 +229,8 @@ IMPL_LINK( PluginConnector, WorkOnNewMessageHdl, Mediator*, /*pMediator*/ ) char* pUrl = pMessage->GetString(); char* pWindow = pMessage->GetString(); sal_uInt32 nLen = pMessage->GetUINT32(); - char* pBuf = (char*)pMessage->GetBytes(); - NPBool* pFile = (NPBool*)pMessage->GetBytes(); + char* pBuf = static_cast<char*>(pMessage->GetBytes()); + NPBool* pFile = static_cast<NPBool*>(pMessage->GetBytes()); NPError aRet = NPN_PostURL( instance, pUrl, pWindow, nLen, pBuf, *pFile ); Respond( pMessage->m_nID, reinterpret_cast<char*>(&aRet), sizeof( aRet ), NULL ); @@ -245,7 +245,7 @@ IMPL_LINK( PluginConnector, WorkOnNewMessageHdl, Mediator*, /*pMediator*/ ) sal_uInt32 nFileID = pMessage->GetUINT32(); NPStream* pStream = m_aNPWrapStreams[ nFileID ]; sal_uInt32 nRanges = pMessage->GetUINT32(); - sal_uInt32* pArray = (sal_uInt32*)pMessage->GetBytes(); + sal_uInt32* pArray = static_cast<sal_uInt32*>(pMessage->GetBytes()); // build ranges table NPByteRange* pFirst = new NPByteRange; NPByteRange* pRun = pFirst; @@ -300,7 +300,7 @@ IMPL_LINK( PluginConnector, WorkOnNewMessageHdl, Mediator*, /*pMediator*/ ) Respond( pMessage->m_nID, reinterpret_cast<char*>(&nRet), sizeof( nRet ), NULL ); - delete [] (char*)pBuffer; + delete [] static_cast<char*>(pBuffer); delete instance; } break; @@ -358,7 +358,7 @@ NPError UnxPluginComm::NPP_Destroy( NPP instance, NPSavedData** save ) aRet = GetNPError( pMes ); sal_uLong nSaveBytes; void* pSaveData = pMes->GetBytes( nSaveBytes ); - if( nSaveBytes == 4 && *(sal_uInt32*)pSaveData == 0 ) + if( nSaveBytes == 4 && *static_cast<sal_uInt32*>(pSaveData) == 0 ) *save = NULL; else { @@ -418,7 +418,7 @@ NPError UnxPluginComm::NPP_New( NPMIMEType pluginType, NPP instance, uint16_t mo m_aInstances.push_back( new ConnectorInstance( instance, pluginType, 0, NULL, 0, NULL, 0, - saved ? (char*)saved->buf : NULL, + saved ? static_cast<char*>(saved->buf) : NULL, saved ? saved->len : 0 ) ); char *pArgnBuf, *pArgvBuf; @@ -494,7 +494,7 @@ NPError UnxPluginComm::NPP_NewStream( NPP instance, NPMIMEType type, NPStream* s return NPERR_GENERIC_ERROR; aRet = GetNPError( pMes ); - uint16_t* pSType = (uint16_t*)pMes->GetBytes(); + uint16_t* pSType = static_cast<uint16_t*>(pMes->GetBytes()); *stype = *pSType; delete [] pSType; diff --git a/extensions/source/plugin/unx/plugcon.cxx b/extensions/source/plugin/unx/plugcon.cxx index f1995d7ab8ec..c54f7f2368d2 100644 --- a/extensions/source/plugin/unx/plugcon.cxx +++ b/extensions/source/plugin/unx/plugcon.cxx @@ -238,7 +238,7 @@ ConnectorInstance::~ConnectorInstance() delete [] argv; delete [] pArgnBuf; delete [] pArgvBuf; - delete [] (char*)aData.buf; + delete [] static_cast<char*>(aData.buf); } const char* GetCommandName( CommandAtoms eCommand ) |