From fb8a3fac5d448451794804a7470be45fa14da453 Mon Sep 17 00:00:00 2001 From: Stephan Bergmann Date: Thu, 10 Dec 2015 08:06:06 +0100 Subject: loplugin:nullptr: More NULL -> nullptr automatic rewrite Change-Id: Ie83819e2bcdc5fa160b39296b005ca9a5ff74b1d --- extensions/source/plugin/unx/npnapi.cxx | 42 ++++++++++++++-------------- extensions/source/plugin/unx/nppapi.cxx | 48 ++++++++++++++++---------------- extensions/source/plugin/unx/npwrap.cxx | 2 +- extensions/source/plugin/unx/sysplug.cxx | 2 +- 4 files changed, 47 insertions(+), 47 deletions(-) (limited to 'extensions') diff --git a/extensions/source/plugin/unx/npnapi.cxx b/extensions/source/plugin/unx/npnapi.cxx index 7f70a5e39ea7..80a201f27b7f 100644 --- a/extensions/source/plugin/unx/npnapi.cxx +++ b/extensions/source/plugin/unx/npnapi.cxx @@ -88,7 +88,7 @@ static NPError l_NPN_DestroyStream( NPP instance, NPStream* stream, NPError reas &nFileID, sizeof( nFileID ), POST_STRING( stream->url ), &reason, sizeof( reason ), - NULL ); + nullptr ); if( ! pMes ) return NPERR_GENERIC_ERROR; @@ -137,7 +137,7 @@ static NPError l_NPN_GetURL( NPP instance, const char* url, const char* window ) &nInstance, sizeof( nInstance ), POST_STRING(url), POST_STRING(window), - NULL ); + nullptr ); SAL_WARN_IF(!pMes, "extensions.plugin", "geturl: message unanswered"); if( ! pMes ) return NPERR_GENERIC_ERROR; @@ -165,7 +165,7 @@ static NPError l_NPN_GetURLNotify( NPP instance, const char* url, const char* ta ¬ifyData, sizeof( void* ), // transmit the actual pointer // since it is a pointer to private data fed back // by NPP_URLNotify; this can be thought of as an ID - NULL ); + nullptr ); if( ! pMes ) return NPERR_GENERIC_ERROR; @@ -189,7 +189,7 @@ static NPError l_NPN_NewStream( NPP instance, NPMIMEType type, const char* targe &nInstance, sizeof( nInstance ), POST_STRING(type), POST_STRING(target), - NULL ); + nullptr ); if( ! pMes ) return NPERR_GENERIC_ERROR; @@ -226,7 +226,7 @@ static NPError l_NPN_PostURLNotify( NPP instance, const char* url, const char* t buf, len, &file, sizeof( NPBool ), ¬ifyData, sizeof( void* ), // send the real pointer - NULL ); + nullptr ); if( ! pMes ) return NPERR_GENERIC_ERROR; @@ -250,7 +250,7 @@ static NPError l_NPN_PostURL( NPP instance, const char* url, const char* window, &len, sizeof( len ), buf, len, &file, sizeof( NPBool ), - NULL ); + nullptr ); if( ! pMes ) return NPERR_GENERIC_ERROR; @@ -287,7 +287,7 @@ static NPError l_NPN_RequestRead( NPStream* stream, NPByteRange* rangeList ) &nFileID, sizeof( nFileID ), &nRanges, sizeof( nRanges ), pArray.get(), sizeof( sal_uInt32 ) * 2 * nRanges, - NULL ); + nullptr ); if( ! pMes ) { @@ -308,7 +308,7 @@ static void l_NPN_Status( NPP instance, const char* message ) pConnector->Send( eNPN_Status, &nInstance, sizeof( nInstance ), POST_STRING( message ), - NULL ); + nullptr ); } static const char* l_NPN_UserAgent( NPP instance ) @@ -327,7 +327,7 @@ static const char* l_NPN_UserAgent( NPP instance ) MediatorMessage* pMes = pConnector-> Transact( eNPN_UserAgent, &nInstance, sizeof( nInstance ), - NULL ); + nullptr ); if( ! pMes ) return pAgent; @@ -358,7 +358,7 @@ static int32_t l_NPN_Write( NPP instance, NPStream* stream, int32_t len, void* b &nFileID, sizeof( nFileID ), &len, sizeof( len ), buffer, len, - NULL ); + nullptr ); if( ! pMes ) return 0; @@ -542,7 +542,7 @@ IMPL_LINK_NOARG_TYPED( PluginConnector, WorkOnNewMessageHdl, void*, void ) aReason = aPluginFuncs.destroystream( instance, pStream, aReason ); Respond( pMessage->m_nID, reinterpret_cast(&aReason), sizeof( aReason ), - NULL ); + nullptr ); delete [] pStream->url; delete pStream; @@ -563,7 +563,7 @@ IMPL_LINK_NOARG_TYPED( PluginConnector, WorkOnNewMessageHdl, void*, void ) // the other side will call eNPP_DestroyPhase2 after this NPError aReason = NPERR_NO_ERROR; - Respond( pMessage->m_nID, reinterpret_cast(&aReason), sizeof( aReason ), NULL ); + Respond( pMessage->m_nID, reinterpret_cast(&aReason), sizeof( aReason ), nullptr ); } break; case eNPP_DestroyPhase2: @@ -580,14 +580,14 @@ IMPL_LINK_NOARG_TYPED( PluginConnector, WorkOnNewMessageHdl, void*, void ) Respond( pMessage->m_nID, reinterpret_cast(&aRet), sizeof( aRet ), pSave->buf, pSave->len, - NULL ); + nullptr ); delete [] static_cast(pSave->buf); } else Respond( pMessage->m_nID, reinterpret_cast(&aRet), sizeof( aRet ), "0000", 4, - NULL ); + nullptr ); #if ENABLE_GTK if( pInst->pGtkWindow ) @@ -633,7 +633,7 @@ IMPL_LINK_NOARG_TYPED( PluginConnector, WorkOnNewMessageHdl, void*, void ) Respond( pMessage->m_nID, reinterpret_cast(&aRet), sizeof( aRet ), &nStype, sizeof( nStype ), - NULL ); + nullptr ); delete [] pType; delete [] pSeekable; } @@ -695,7 +695,7 @@ IMPL_LINK_NOARG_TYPED( PluginConnector, WorkOnNewMessageHdl, void*, void ) Respond( pMessage->m_nID, reinterpret_cast(&aRet), sizeof( aRet ), - NULL ); + nullptr ); delete [] pMode; delete [] pArgc; delete [] pType; @@ -801,7 +801,7 @@ IMPL_LINK_NOARG_TYPED( PluginConnector, WorkOnNewMessageHdl, void*, void ) "pluginapp: NPP_SetWindow returns " << aRet); Respond( pMessage->m_nID, reinterpret_cast(&aRet), sizeof( aRet ), - NULL ); + nullptr ); delete [] reinterpret_cast(pWindow); } break; @@ -848,7 +848,7 @@ IMPL_LINK_NOARG_TYPED( PluginConnector, WorkOnNewMessageHdl, void*, void ) Respond( pMessage->m_nID, reinterpret_cast(&nRet), sizeof( nRet ), - NULL ); + nullptr ); } break; case eNPP_Write: @@ -875,7 +875,7 @@ IMPL_LINK_NOARG_TYPED( PluginConnector, WorkOnNewMessageHdl, void*, void ) Respond( pMessage->m_nID, reinterpret_cast(&nRet), sizeof( nRet ), - NULL ); + nullptr ); delete [] buffer; } break; @@ -887,7 +887,7 @@ IMPL_LINK_NOARG_TYPED( PluginConnector, WorkOnNewMessageHdl, void*, void ) char* pMIME = pNPP_GetMIMEDescription(); Respond( pMessage->m_nID, POST_NONCONST_STRING( pMIME ), - NULL ); + nullptr ); } break; case eNPP_Initialize: @@ -910,7 +910,7 @@ IMPL_LINK_NOARG_TYPED( PluginConnector, WorkOnNewMessageHdl, void*, void ) SAL_INFO( "extensions.plugin", "pluginapp: NP_Initialize returns " << aRet); - Respond( pMessage->m_nID, reinterpret_cast(&aRet), sizeof( aRet ), NULL ); + Respond( pMessage->m_nID, reinterpret_cast(&aRet), sizeof( aRet ), nullptr ); } break; case eNPP_Shutdown: diff --git a/extensions/source/plugin/unx/nppapi.cxx b/extensions/source/plugin/unx/nppapi.cxx index eb073e383f51..ec842dc87eef 100644 --- a/extensions/source/plugin/unx/nppapi.cxx +++ b/extensions/source/plugin/unx/nppapi.cxx @@ -107,7 +107,7 @@ IMPL_LINK_NOARG_TYPED( PluginConnector, WorkOnNewMessageHdl, void*, void ) char* pWindow = pMessage->GetString(); NPError aRet = NPN_GetURL( instance, pUrl, pWindow ); Respond( pMessage->m_nID, - reinterpret_cast(&aRet), sizeof( NPError ), NULL ); + reinterpret_cast(&aRet), sizeof( NPError ), nullptr ); delete [] pUrl; delete [] pWindow; } @@ -122,7 +122,7 @@ IMPL_LINK_NOARG_TYPED( PluginConnector, WorkOnNewMessageHdl, void*, void ) NPError aRet = NPN_GetURLNotify( instance, pUrl, pWindow, *pNotifyData ); Respond( pMessage->m_nID, - reinterpret_cast(&aRet), sizeof( NPError ), NULL ); + reinterpret_cast(&aRet), sizeof( NPError ), nullptr ); delete [] pUrl; delete [] pWindow; delete [] pNotifyData; @@ -158,7 +158,7 @@ IMPL_LINK_NOARG_TYPED( PluginConnector, WorkOnNewMessageHdl, void*, void ) "nonexistent StreamID " << nFileID); Respond( pMessage->m_nID, - reinterpret_cast(&aRet), sizeof( NPError ), NULL ); + reinterpret_cast(&aRet), sizeof( NPError ), nullptr ); delete [] pUrl; delete [] pReason; @@ -183,7 +183,7 @@ IMPL_LINK_NOARG_TYPED( PluginConnector, WorkOnNewMessageHdl, void*, void ) "", 0, &nDummy, sizeof(sal_uInt32), &nDummy, sizeof(sal_uInt32), - NULL ); + nullptr ); } else { @@ -195,7 +195,7 @@ IMPL_LINK_NOARG_TYPED( PluginConnector, WorkOnNewMessageHdl, void*, void ) pStream->url, nLen, &pStream->end, sizeof(sal_uInt32), &pStream->lastmodified, sizeof(sal_uInt32), - NULL ); + nullptr ); } delete [] pTarget; @@ -214,7 +214,7 @@ IMPL_LINK_NOARG_TYPED( PluginConnector, WorkOnNewMessageHdl, void*, void ) void** pNData = static_cast(pMessage->GetBytes()); NPError aRet = NPN_PostURLNotify( instance, pUrl, pTarget, nLen, pBuf, *pFile, *pNData ); - Respond( pMessage->m_nID, reinterpret_cast(&aRet), sizeof( aRet ), NULL ); + Respond( pMessage->m_nID, reinterpret_cast(&aRet), sizeof( aRet ), nullptr ); delete [] pUrl; delete [] pTarget; delete [] pBuf; @@ -233,7 +233,7 @@ IMPL_LINK_NOARG_TYPED( PluginConnector, WorkOnNewMessageHdl, void*, void ) NPBool* pFile = static_cast(pMessage->GetBytes()); NPError aRet = NPN_PostURL( instance, pUrl, pWindow, nLen, pBuf, *pFile ); - Respond( pMessage->m_nID, reinterpret_cast(&aRet), sizeof( aRet ), NULL ); + Respond( pMessage->m_nID, reinterpret_cast(&aRet), sizeof( aRet ), nullptr ); delete [] pUrl; delete [] pWindow; delete [] pBuf; @@ -257,7 +257,7 @@ IMPL_LINK_NOARG_TYPED( PluginConnector, WorkOnNewMessageHdl, void*, void ) pRun = pRun->next; } NPError aRet = NPN_RequestRead( pStream, pFirst ); - Respond( pMessage->m_nID, reinterpret_cast(&aRet), sizeof( aRet ), NULL ); + Respond( pMessage->m_nID, reinterpret_cast(&aRet), sizeof( aRet ), nullptr ); while( pFirst ) { pRun = pFirst->next; @@ -285,7 +285,7 @@ IMPL_LINK_NOARG_TYPED( PluginConnector, WorkOnNewMessageHdl, void*, void ) &minor, sizeof( int ), &net_major, sizeof( int ), &net_minor, sizeof( int ), - NULL ); + nullptr ); } break; case eNPN_Write: @@ -299,7 +299,7 @@ IMPL_LINK_NOARG_TYPED( PluginConnector, WorkOnNewMessageHdl, void*, void ) sal_Int32 nRet = NPN_Write( instance, pStream, nLen, pBuffer ); Respond( pMessage->m_nID, reinterpret_cast(&nRet), sizeof( nRet ), - NULL ); + nullptr ); delete [] static_cast(pBuffer); delete instance; } @@ -311,7 +311,7 @@ IMPL_LINK_NOARG_TYPED( PluginConnector, WorkOnNewMessageHdl, void*, void ) const char* pAnswer = NPN_UserAgent( instance ); Respond( pMessage->m_nID, const_cast(pAnswer), strlen( pAnswer ), - NULL ); + nullptr ); } break; default: @@ -343,14 +343,14 @@ NPError UnxPluginComm::NPP_Destroy( NPP instance, NPSavedData** save ) MediatorMessage* pMes = Transact( eNPP_Destroy, POST_INSTANCE(), - NULL ); + nullptr ); if( ! pMes ) return NPERR_GENERIC_ERROR; delete pMes; pMes = Transact( eNPP_DestroyPhase2, POST_INSTANCE(), - NULL ); + nullptr ); if( ! pMes ) return NPERR_GENERIC_ERROR; @@ -383,7 +383,7 @@ NPError UnxPluginComm::NPP_DestroyStream( NPP instance, NPStream* stream, NPErro POST_INSTANCE(), &nFileID, sizeof( nFileID ), &reason, sizeof( reason ), - NULL ); + nullptr ); m_aNPWrapStreams.erase( m_aNPWrapStreams.begin() + nFileID ); if( ! pMes ) return NPERR_GENERIC_ERROR; @@ -397,7 +397,7 @@ NPError UnxPluginComm::NPP_Initialize() { MediatorMessage* pMes = Transact( eNPP_Initialize, - NULL ); + nullptr ); if( ! pMes ) return NPERR_GENERIC_ERROR; @@ -445,7 +445,7 @@ NPError UnxPluginComm::NPP_New( NPMIMEType pluginType, NPP instance, uint16_t mo pArgnBuf, nArgnLen, pArgvBuf, nArgvLen, saved->buf, static_cast(saved->len), - NULL ); + nullptr ); else pMes = Transact( eNPP_New, @@ -455,7 +455,7 @@ NPError UnxPluginComm::NPP_New( NPMIMEType pluginType, NPP instance, uint16_t mo pArgnBuf, nArgnLen, pArgvBuf, nArgvLen, "0000", size_t(4), - NULL ); + nullptr ); delete [] pArgnBuf; delete [] pArgvBuf; if( ! pMes ) @@ -482,7 +482,7 @@ NPError UnxPluginComm::NPP_NewStream( NPP instance, NPMIMEType type, NPStream* s &stream->end, sizeof( stream->end ), &stream->lastmodified, sizeof( stream->lastmodified ), &seekable, sizeof( seekable ), - NULL ); + nullptr ); if( ! pMes ) return NPERR_GENERIC_ERROR; @@ -505,7 +505,7 @@ NPError UnxPluginComm::NPP_SetWindow( NPP instance, NPWindow* window ) Transact( eNPP_SetWindow, POST_INSTANCE(), window, sizeof( NPWindow ), - NULL ); + nullptr ); if( ! pMes ) return NPERR_GENERIC_ERROR; @@ -516,7 +516,7 @@ NPError UnxPluginComm::NPP_SetWindow( NPP instance, NPWindow* window ) void UnxPluginComm::NPP_Shutdown() { - Send( eNPP_Shutdown, NULL ); + Send( eNPP_Shutdown, nullptr ); } void UnxPluginComm::NPP_StreamAsFile( NPP instance, NPStream* stream, const char* fname ) @@ -530,7 +530,7 @@ void UnxPluginComm::NPP_StreamAsFile( NPP instance, NPStream* stream, const char POST_INSTANCE(), &nFileID, sizeof( nFileID ), fname, strlen( fname ), - NULL ); + nullptr ); } void UnxPluginComm::NPP_URLNotify( NPP instance, const char* url, NPReason reason, void* notifyData ) @@ -542,7 +542,7 @@ void UnxPluginComm::NPP_URLNotify( NPP instance, const char* url, NPReason reaso url, strlen( url ), &reason, sizeof( reason ), ¬ifyData, sizeof( void* ), - NULL ); + nullptr ); } int32_t UnxPluginComm::NPP_Write( NPP instance, NPStream* stream, int32_t offset, int32_t len, void* buffer ) @@ -558,7 +558,7 @@ int32_t UnxPluginComm::NPP_Write( NPP instance, NPStream* stream, int32_t offset &nFileID, sizeof( nFileID ), &offset, sizeof( offset ), buffer, static_cast(len), - NULL ); + nullptr ); if( ! pMes ) return 0; @@ -579,7 +579,7 @@ int32_t UnxPluginComm::NPP_WriteReady( NPP instance, NPStream* stream ) Transact( eNPP_WriteReady, POST_INSTANCE(), &nFileID, sizeof( nFileID ), - NULL ); + nullptr ); if( ! pMes ) return 0; diff --git a/extensions/source/plugin/unx/npwrap.cxx b/extensions/source/plugin/unx/npwrap.cxx index c0a0649f5665..e58c0f28de5e 100644 --- a/extensions/source/plugin/unx/npwrap.cxx +++ b/extensions/source/plugin/unx/npwrap.cxx @@ -438,7 +438,7 @@ int main( int argc, char **argv) // send that we are ready to go MediatorMessage* pMessage = pConnector->Transact( "init req", 8, - NULL ); + nullptr ); delete pMessage; #if OSL_DEBUG_LEVEL > 3 diff --git a/extensions/source/plugin/unx/sysplug.cxx b/extensions/source/plugin/unx/sysplug.cxx index b7a1d8162f6a..0693033c81f7 100644 --- a/extensions/source/plugin/unx/sysplug.cxx +++ b/extensions/source/plugin/unx/sysplug.cxx @@ -116,7 +116,7 @@ UnxPluginComm::UnxPluginComm( MediatorMessage* pMessage = GetNextMessage( true ); Respond( pMessage->m_nID, const_cast("init ack"),8, - NULL ); + nullptr ); delete pMessage; NPP_Initialize(); } -- cgit