diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2015-01-17 18:45:03 +0100 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2015-01-20 09:06:47 +0100 |
commit | 7889f9e5a3b43d7edb6c6fdb3432d5a88fc804ac (patch) | |
tree | aaca5caaaffebdc2969ece04e0c5bab3e2ab240b /extensions/source | |
parent | 924048531186f344b74ce663648b075c5d3d89a5 (diff) |
Some more loplugin:cstylecast: extensions
Change-Id: I3b1a00f12b75e3b115e08289b7f486a6a9c3c863
Diffstat (limited to 'extensions/source')
-rw-r--r-- | extensions/source/plugin/base/context.cxx | 4 | ||||
-rw-r--r-- | extensions/source/plugin/base/nfuncs.cxx | 4 | ||||
-rw-r--r-- | extensions/source/plugin/unx/npnapi.cxx | 36 | ||||
-rw-r--r-- | extensions/source/plugin/unx/nppapi.cxx | 22 | ||||
-rw-r--r-- | extensions/source/plugin/unx/npwrap.cxx | 4 | ||||
-rw-r--r-- | extensions/source/plugin/unx/plugcon.cxx | 4 | ||||
-rw-r--r-- | extensions/source/scanner/sane.cxx | 64 |
7 files changed, 69 insertions, 69 deletions
diff --git a/extensions/source/plugin/base/context.cxx b/extensions/source/plugin/base/context.cxx index d62d1fa91d49..31250b59996b 100644 --- a/extensions/source/plugin/base/context.cxx +++ b/extensions/source/plugin/base/context.cxx @@ -200,7 +200,7 @@ void XPluginContext_Impl::postURL(const Reference< ::com::sun::star::plugin::XPl if( file ) { - OUString aFileName( (char*)buf.getConstArray(), strlen((char*)buf.getConstArray()), m_aEncoding ); + OUString aFileName( reinterpret_cast<char const *>(buf.getConstArray()), strlen(reinterpret_cast<char const *>(buf.getConstArray())), m_aEncoding ); INetURLObject aFilePath( aFileName ); aFileName = aFilePath.PathToFileName(); SvFileStream aStream( aFileName, StreamMode::READ ); @@ -227,7 +227,7 @@ void XPluginContext_Impl::postURL(const Reference< ::com::sun::star::plugin::XPl aValues[0].Value <<= pPlugin->getRefererURL(); aValues[1].Name = "PostString"; - aValues[1].Value <<= OStringToOUString( (char*)( file ? aBuf : buf ).getConstArray(), m_aEncoding ); + aValues[1].Value <<= OStringToOUString( reinterpret_cast<char const *>(( file ? aBuf : buf ).getConstArray()), m_aEncoding ); Sequence< ::com::sun::star::beans::PropertyValue > aArgs( aValues, 2 ); Reference< ::com::sun::star::lang::XComponent > xComp = xDesktop->loadComponentFromURL( diff --git a/extensions/source/plugin/base/nfuncs.cxx b/extensions/source/plugin/base/nfuncs.cxx index 9adcf37e16fb..c3a734fc7ba8 100644 --- a/extensions/source/plugin/base/nfuncs.cxx +++ b/extensions/source/plugin/base/nfuncs.cxx @@ -336,7 +336,7 @@ extern "C" { if( ! pImpl ) return NPERR_INVALID_INSTANCE_ERROR; - ::com::sun::star::uno::Sequence<sal_Int8> Bytes( (sal_Int8*)buf, len ); + ::com::sun::star::uno::Sequence<sal_Int8> Bytes( reinterpret_cast<sal_Int8 const *>(buf), len ); OString aPostURL = normalizeURL( pImpl, url ); PluginEventListener* pListener = @@ -378,7 +378,7 @@ extern "C" { if( ! pImpl ) return NPERR_INVALID_INSTANCE_ERROR; - ::com::sun::star::uno::Sequence<sal_Int8> Bytes( (sal_Int8*)buf, len ); + ::com::sun::star::uno::Sequence<sal_Int8> Bytes( reinterpret_cast<sal_Int8 const *>(buf), len ); OString aPostURL = normalizeURL( pImpl, url ); try { diff --git a/extensions/source/plugin/unx/npnapi.cxx b/extensions/source/plugin/unx/npnapi.cxx index 3bdcd7a50ec6..e33892172bc9 100644 --- a/extensions/source/plugin/unx/npnapi.cxx +++ b/extensions/source/plugin/unx/npnapi.cxx @@ -541,7 +541,7 @@ IMPL_LINK( PluginConnector, WorkOnNewMessageHdl, Mediator*, /*pMediator*/ ) aReason = aPluginFuncs.destroystream( instance, pStream, aReason ); Respond( pMessage->m_nID, - (char*)&aReason, sizeof( aReason ), + reinterpret_cast<char*>(&aReason), sizeof( aReason ), NULL ); delete [] pStream->url; @@ -563,7 +563,7 @@ IMPL_LINK( PluginConnector, WorkOnNewMessageHdl, Mediator*, /*pMediator*/ ) // the other side will call eNPP_DestroyPhase2 after this NPError aReason = NPERR_NO_ERROR; - Respond( pMessage->m_nID, (char*)&aReason, sizeof( aReason ), NULL ); + Respond( pMessage->m_nID, reinterpret_cast<char*>(&aReason), sizeof( aReason ), NULL ); } break; case eNPP_DestroyPhase2: @@ -578,14 +578,14 @@ IMPL_LINK( PluginConnector, WorkOnNewMessageHdl, Mediator*, /*pMediator*/ ) if( pSave ) { Respond( pMessage->m_nID, - (char*)&aRet, sizeof( aRet ), + reinterpret_cast<char*>(&aRet), sizeof( aRet ), pSave->buf, pSave->len, NULL ); delete [] (char*)pSave->buf; } else Respond( pMessage->m_nID, - (char*)&aRet, sizeof( aRet ), + reinterpret_cast<char*>(&aRet), sizeof( aRet ), "0000", 4, NULL ); @@ -631,7 +631,7 @@ IMPL_LINK( PluginConnector, WorkOnNewMessageHdl, Mediator*, /*pMediator*/ ) << ", lastmodified = " << pStream->lastmodified << ", notifyData = " << pStream->notifyData << " }"); Respond( pMessage->m_nID, - (char*)&aRet, sizeof( aRet ), + reinterpret_cast<char*>(&aRet), sizeof( aRet ), &nStype, sizeof( nStype ), NULL ); delete [] pType; @@ -661,7 +661,7 @@ IMPL_LINK( PluginConnector, WorkOnNewMessageHdl, Mediator*, /*pMediator*/ ) aRet = aPluginFuncs.newp( pInst->pMimeType, instance, *pMode, *pArgc, pInst->nArg ? pInst->argn : NULL, pInst->nArg ? pInst->argv : NULL, - ( nSaveBytes == 4 && *(sal_uInt32*)pSavedData == 0 ) ? + ( nSaveBytes == 4 && *reinterpret_cast<sal_uInt32*>(pSavedData) == 0 ) ? &(pInst->aData) : NULL ); SAL_INFO( "extensions.plugin", @@ -694,7 +694,7 @@ IMPL_LINK( PluginConnector, WorkOnNewMessageHdl, Mediator*, /*pMediator*/ ) #endif Respond( pMessage->m_nID, - (char*)&aRet, sizeof( aRet ), + reinterpret_cast<char*>(&aRet), sizeof( aRet ), NULL ); delete [] pMode; delete [] pArgc; @@ -800,9 +800,9 @@ IMPL_LINK( PluginConnector, WorkOnNewMessageHdl, Mediator*, /*pMediator*/ ) "extensions.plugin", "pluginapp: NPP_SetWindow returns " << aRet); Respond( pMessage->m_nID, - (char*)&aRet, sizeof( aRet ), + reinterpret_cast<char*>(&aRet), sizeof( aRet ), NULL ); - delete [] (char*)pWindow; + delete [] reinterpret_cast<char*>(pWindow); } break; case eNPP_StreamAsFile: @@ -847,7 +847,7 @@ IMPL_LINK( PluginConnector, WorkOnNewMessageHdl, Mediator*, /*pMediator*/ ) << nRet); Respond( pMessage->m_nID, - (char*)&nRet, sizeof( nRet ), + reinterpret_cast<char*>(&nRet), sizeof( nRet ), NULL ); } break; @@ -874,7 +874,7 @@ IMPL_LINK( PluginConnector, WorkOnNewMessageHdl, Mediator*, /*pMediator*/ ) << pStream->notifyData << " }"); Respond( pMessage->m_nID, - (char*)&nRet, sizeof( nRet ), + reinterpret_cast<char*>(&nRet), sizeof( nRet ), NULL ); delete [] buffer; } @@ -882,8 +882,8 @@ IMPL_LINK( PluginConnector, WorkOnNewMessageHdl, Mediator*, /*pMediator*/ ) case eNPP_GetMIMEDescription: { if( ! pNPP_GetMIMEDescription ) - pNPP_GetMIMEDescription = (char*(*)()) - osl_getAsciiFunctionSymbol( pPluginLib, "NPP_GetMIMEDescription" ); + pNPP_GetMIMEDescription = reinterpret_cast<char*(*)()>( + osl_getAsciiFunctionSymbol( pPluginLib, "NPP_GetMIMEDescription" )); char* pMIME = pNPP_GetMIMEDescription(); Respond( pMessage->m_nID, POST_STRING( pMIME ), @@ -894,13 +894,13 @@ IMPL_LINK( PluginConnector, WorkOnNewMessageHdl, Mediator*, /*pMediator*/ ) { pNP_Initialize = - (NPError(*)(NPNetscapeFuncs*, NPPluginFuncs*)) - osl_getAsciiFunctionSymbol( pPluginLib, "NP_Initialize" ); + reinterpret_cast<NPError(*)(NPNetscapeFuncs*, NPPluginFuncs*)>( + osl_getAsciiFunctionSymbol( pPluginLib, "NP_Initialize" )); SAL_WARN_IF( !pNP_Initialize, "extensions.plugin", "no NP_Initialize, " << dlerror()); - pNP_Shutdown = (NPError(*)()) - osl_getAsciiFunctionSymbol( pPluginLib, "NP_Shutdown" ); + pNP_Shutdown = reinterpret_cast<NPError(*)()>( + osl_getAsciiFunctionSymbol( pPluginLib, "NP_Shutdown" )); SAL_WARN_IF( !pNP_Initialize, "extensions.plugin", "no NP_Shutdown, " << dlerror()); @@ -910,7 +910,7 @@ IMPL_LINK( PluginConnector, WorkOnNewMessageHdl, Mediator*, /*pMediator*/ ) SAL_INFO( "extensions.plugin", "pluginapp: NP_Initialize returns " << aRet); - Respond( pMessage->m_nID, (char*)&aRet, sizeof( aRet ), NULL ); + Respond( pMessage->m_nID, reinterpret_cast<char*>(&aRet), sizeof( aRet ), NULL ); } break; case eNPP_Shutdown: diff --git a/extensions/source/plugin/unx/nppapi.cxx b/extensions/source/plugin/unx/nppapi.cxx index 4fc245be9fef..fe82daaa2450 100644 --- a/extensions/source/plugin/unx/nppapi.cxx +++ b/extensions/source/plugin/unx/nppapi.cxx @@ -107,7 +107,7 @@ IMPL_LINK( PluginConnector, WorkOnNewMessageHdl, Mediator*, /*pMediator*/ ) char* pWindow = pMessage->GetString(); NPError aRet = NPN_GetURL( instance, pUrl, pWindow ); Respond( pMessage->m_nID, - (char*)(&aRet), sizeof( NPError ), NULL ); + reinterpret_cast<char*>(&aRet), sizeof( NPError ), NULL ); delete [] pUrl; delete [] pWindow; } @@ -122,7 +122,7 @@ IMPL_LINK( PluginConnector, WorkOnNewMessageHdl, Mediator*, /*pMediator*/ ) NPError aRet = NPN_GetURLNotify( instance, pUrl, pWindow, *pNotifyData ); Respond( pMessage->m_nID, - (char*)(&aRet), sizeof( NPError ), NULL ); + reinterpret_cast<char*>(&aRet), sizeof( NPError ), NULL ); delete [] pUrl; delete [] pWindow; delete [] pNotifyData; @@ -158,7 +158,7 @@ IMPL_LINK( PluginConnector, WorkOnNewMessageHdl, Mediator*, /*pMediator*/ ) "nonexistent StreamID " << nFileID); Respond( pMessage->m_nID, - (char*)(&aRet), sizeof( NPError ), NULL ); + reinterpret_cast<char*>(&aRet), sizeof( NPError ), NULL ); delete [] pUrl; delete [] pReason; @@ -179,7 +179,7 @@ IMPL_LINK( PluginConnector, WorkOnNewMessageHdl, Mediator*, /*pMediator*/ ) { sal_uInt32 nDummy = 0; Respond( pMessage->m_nID, - (char*)&aRet, sizeof( aRet ), + reinterpret_cast<char*>(&aRet), sizeof( aRet ), "", 0, &nDummy, sizeof(sal_uInt32), &nDummy, sizeof(sal_uInt32), @@ -191,7 +191,7 @@ IMPL_LINK( PluginConnector, WorkOnNewMessageHdl, Mediator*, /*pMediator*/ ) sal_uLong nLen = strlen( pStream->url ); Respond( pMessage->m_nID, - (char*)&aRet, sizeof( aRet ), + reinterpret_cast<char*>(&aRet), sizeof( aRet ), pStream->url, nLen, &pStream->end, sizeof(sal_uInt32), &pStream->lastmodified, sizeof(sal_uInt32), @@ -214,7 +214,7 @@ IMPL_LINK( PluginConnector, WorkOnNewMessageHdl, Mediator*, /*pMediator*/ ) void** pNData = (void**)pMessage->GetBytes(); NPError aRet = NPN_PostURLNotify( instance, pUrl, pTarget, nLen, pBuf, *pFile, *pNData ); - Respond( pMessage->m_nID, (char*)&aRet, sizeof( aRet ), NULL ); + Respond( pMessage->m_nID, reinterpret_cast<char*>(&aRet), sizeof( aRet ), NULL ); delete [] pUrl; delete [] pTarget; delete [] pBuf; @@ -233,7 +233,7 @@ IMPL_LINK( PluginConnector, WorkOnNewMessageHdl, Mediator*, /*pMediator*/ ) NPBool* pFile = (NPBool*)pMessage->GetBytes(); NPError aRet = NPN_PostURL( instance, pUrl, pWindow, nLen, pBuf, *pFile ); - Respond( pMessage->m_nID, (char*)&aRet, sizeof( aRet ), NULL ); + Respond( pMessage->m_nID, reinterpret_cast<char*>(&aRet), sizeof( aRet ), NULL ); delete [] pUrl; delete [] pWindow; delete [] pBuf; @@ -257,7 +257,7 @@ IMPL_LINK( PluginConnector, WorkOnNewMessageHdl, Mediator*, /*pMediator*/ ) pRun = pRun->next; } NPError aRet = NPN_RequestRead( pStream, pFirst ); - Respond( pMessage->m_nID, (char*)&aRet, sizeof( aRet ), NULL ); + Respond( pMessage->m_nID, reinterpret_cast<char*>(&aRet), sizeof( aRet ), NULL ); while( pFirst ) { pRun = pFirst->next; @@ -281,7 +281,7 @@ IMPL_LINK( PluginConnector, WorkOnNewMessageHdl, Mediator*, /*pMediator*/ ) int major, minor, net_major, net_minor; NPN_Version( &major, &minor, &net_major, &net_minor ); Respond( pMessage->m_nID, - (char*)&major, sizeof( int ), + reinterpret_cast<char*>(&major), sizeof( int ), &minor, sizeof( int ), &net_major, sizeof( int ), &net_minor, sizeof( int ), @@ -298,7 +298,7 @@ IMPL_LINK( PluginConnector, WorkOnNewMessageHdl, Mediator*, /*pMediator*/ ) void* pBuffer = pMessage->GetBytes(); sal_Int32 nRet = NPN_Write( instance, pStream, nLen, pBuffer ); Respond( pMessage->m_nID, - (char*)&nRet, sizeof( nRet ), + reinterpret_cast<char*>(&nRet), sizeof( nRet ), NULL ); delete [] (char*)pBuffer; delete instance; @@ -335,7 +335,7 @@ IMPL_LINK( PluginConnector, WorkOnNewMessageHdl, Mediator*, /*pMediator*/ ) return err -#define POST_INSTANCE() (char*)&nInstance, sizeof( nInstance ) +#define POST_INSTANCE() reinterpret_cast<char*>(&nInstance), sizeof( nInstance ) NPError UnxPluginComm::NPP_Destroy( NPP instance, NPSavedData** save ) { diff --git a/extensions/source/plugin/unx/npwrap.cxx b/extensions/source/plugin/unx/npwrap.cxx index 0cb0af7d5dc6..6f4b58b63ae4 100644 --- a/extensions/source/plugin/unx/npwrap.cxx +++ b/extensions/source/plugin/unx/npwrap.cxx @@ -192,8 +192,8 @@ static void CheckPlugin( const char* pPath ) oslModule pLib = LoadModule( pPath ); if (pLib != 0) { - char*(*pNP_GetMIMEDescription)() = (char*(*)()) - osl_getAsciiFunctionSymbol( pLib, "NP_GetMIMEDescription" ); + char*(*pNP_GetMIMEDescription)() = reinterpret_cast<char*(*)()>( + osl_getAsciiFunctionSymbol( pLib, "NP_GetMIMEDescription" )); if( pNP_GetMIMEDescription ) printf( "%s\n", pNP_GetMIMEDescription() ); else diff --git a/extensions/source/plugin/unx/plugcon.cxx b/extensions/source/plugin/unx/plugcon.cxx index 7683825eabad..f1995d7ab8ec 100644 --- a/extensions/source/plugin/unx/plugcon.cxx +++ b/extensions/source/plugin/unx/plugcon.cxx @@ -125,7 +125,7 @@ MediatorMessage* PluginConnector::Transact( sal_uInt32 nFunction, ... ) char* pBuffer; va_start( ap, nFunction ); - sal_uLong nSize = FillBuffer( pBuffer, (char*)&nFunction, sizeof( nFunction ), ap ); + sal_uLong nSize = FillBuffer( pBuffer, reinterpret_cast<char*>(&nFunction), sizeof( nFunction ), ap ); va_end( ap ); MediatorMessage* pRet = TransactMessage( nSize, pBuffer ); delete[] pBuffer; @@ -138,7 +138,7 @@ sal_uLong PluginConnector::Send( sal_uInt32 nFunction, ... ) char* pBuffer; va_start( ap, nFunction ); - sal_uLong nSize = FillBuffer( pBuffer, (char*)&nFunction, sizeof( nFunction ), ap ); + sal_uLong nSize = FillBuffer( pBuffer, reinterpret_cast<char*>(&nFunction), sizeof( nFunction ), ap ); va_end( ap ); sal_uLong nRet = SendMessage( nSize, pBuffer ); delete[] pBuffer; diff --git a/extensions/source/scanner/sane.cxx b/extensions/source/scanner/sane.cxx index cb6d5f70e1e4..d1f27ff9b8c6 100644 --- a/extensions/source/scanner/sane.cxx +++ b/extensions/source/scanner/sane.cxx @@ -187,38 +187,38 @@ void Sane::Init() if( pSaneLib ) { bSaneSymbolLoadFailed = false; - p_init = (SANE_Status(*)(SANE_Int*, SANE_Auth_Callback )) - LoadSymbol( "sane_init" ); - p_exit = (void(*)()) - LoadSymbol( "sane_exit" ); - p_get_devices = (SANE_Status(*)(const SANE_Device***, - SANE_Bool )) - LoadSymbol( "sane_get_devices" ); - p_open = (SANE_Status(*)(SANE_String_Const, SANE_Handle )) - LoadSymbol( "sane_open" ); - p_close = (void(*)(SANE_Handle)) - LoadSymbol( "sane_close" ); - p_get_option_descriptor = (const SANE_Option_Descriptor*(*)(SANE_Handle, - SANE_Int)) - LoadSymbol( "sane_get_option_descriptor" ); - p_control_option = (SANE_Status(*)(SANE_Handle, SANE_Int, - SANE_Action, void*, SANE_Int*)) - LoadSymbol( "sane_control_option" ); - p_get_parameters = (SANE_Status(*)(SANE_Handle,SANE_Parameters*)) - LoadSymbol( "sane_get_parameters" ); - p_start = (SANE_Status(*)(SANE_Handle)) - LoadSymbol( "sane_start" ); - p_read = (SANE_Status(*)(SANE_Handle, SANE_Byte*, - SANE_Int, SANE_Int* )) - LoadSymbol( "sane_read" ); - p_cancel = (void(*)(SANE_Handle)) - LoadSymbol( "sane_cancel" ); - p_set_io_mode = (SANE_Status(*)(SANE_Handle, SANE_Bool)) - LoadSymbol( "sane_set_io_mode" ); - p_get_select_fd = (SANE_Status(*)(SANE_Handle, SANE_Int*)) - LoadSymbol( "sane_get_select_fd" ); - p_strstatus = (SANE_String_Const(*)(SANE_Status)) - LoadSymbol( "sane_strstatus" ); + p_init = reinterpret_cast<SANE_Status(*)(SANE_Int*, SANE_Auth_Callback )>( + LoadSymbol( "sane_init" )); + p_exit = reinterpret_cast<void(*)()>( + LoadSymbol( "sane_exit" )); + p_get_devices = reinterpret_cast<SANE_Status(*)(const SANE_Device***, + SANE_Bool )>( + LoadSymbol( "sane_get_devices" )); + p_open = reinterpret_cast<SANE_Status(*)(SANE_String_Const, SANE_Handle )>( + LoadSymbol( "sane_open" )); + p_close = reinterpret_cast<void(*)(SANE_Handle)>( + LoadSymbol( "sane_close" )); + p_get_option_descriptor = reinterpret_cast<const SANE_Option_Descriptor*(*)(SANE_Handle, + SANE_Int)>( + LoadSymbol( "sane_get_option_descriptor" )); + p_control_option = reinterpret_cast<SANE_Status(*)(SANE_Handle, SANE_Int, + SANE_Action, void*, SANE_Int*)>( + LoadSymbol( "sane_control_option" )); + p_get_parameters = reinterpret_cast<SANE_Status(*)(SANE_Handle,SANE_Parameters*)>( + LoadSymbol( "sane_get_parameters" )); + p_start = reinterpret_cast<SANE_Status(*)(SANE_Handle)>( + LoadSymbol( "sane_start" )); + p_read = reinterpret_cast<SANE_Status(*)(SANE_Handle, SANE_Byte*, + SANE_Int, SANE_Int* )>( + LoadSymbol( "sane_read" )); + p_cancel = reinterpret_cast<void(*)(SANE_Handle)>( + LoadSymbol( "sane_cancel" )); + p_set_io_mode = reinterpret_cast<SANE_Status(*)(SANE_Handle, SANE_Bool)>( + LoadSymbol( "sane_set_io_mode" )); + p_get_select_fd = reinterpret_cast<SANE_Status(*)(SANE_Handle, SANE_Int*)>( + LoadSymbol( "sane_get_select_fd" )); + p_strstatus = reinterpret_cast<SANE_String_Const(*)(SANE_Status)>( + LoadSymbol( "sane_strstatus" )); if( bSaneSymbolLoadFailed ) DeInit(); else |