From fc45189c7af475635cd7a6a51d5c7409e10deb27 Mon Sep 17 00:00:00 2001 From: Stephan Bergmann Date: Thu, 15 Nov 2012 16:10:48 +0100 Subject: Replace medDebug with sal/log.hxx functionality Change-Id: I30bf94043b5b638260704629356d010c8ea6b4e0 --- .../source/plugin/inc/plugin/unx/mediator.hxx | 20 --- extensions/source/plugin/unx/mediator.cxx | 49 +++++--- extensions/source/plugin/unx/npnapi.cxx | 139 +++++++++++++-------- extensions/source/plugin/unx/nppapi.cxx | 17 ++- extensions/source/plugin/unx/npwrap.cxx | 53 ++++---- extensions/source/plugin/unx/plugcon.cxx | 4 +- 6 files changed, 167 insertions(+), 115 deletions(-) (limited to 'extensions') diff --git a/extensions/source/plugin/inc/plugin/unx/mediator.hxx b/extensions/source/plugin/inc/plugin/unx/mediator.hxx index 9094d92de46f..ac901f3573b8 100644 --- a/extensions/source/plugin/inc/plugin/unx/mediator.hxx +++ b/extensions/source/plugin/inc/plugin/unx/mediator.hxx @@ -29,15 +29,11 @@ #define _MEDIATOR_HXX #include -#include #include #include #include #include #include -#if OSL_DEBUG_LEVEL > 1 -#include -#endif #include @@ -164,22 +160,6 @@ class MediatorListener : public osl::Thread virtual void onTerminated(); }; -inline void medDebug( int condition, const char* pFormat, ... ) -{ -#if OSL_DEBUG_LEVEL > 1 - if( condition ) - { - va_list ap; - va_start( ap, pFormat ); - vfprintf( stderr, pFormat, ap ); - va_end( ap ); - } -#else - (void)condition; - (void)pFormat; -#endif -} - #endif // _MEDIATOR_HXX /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/plugin/unx/mediator.cxx b/extensions/source/plugin/unx/mediator.cxx index 4edefaaab440..9cb11fcd576d 100644 --- a/extensions/source/plugin/unx/mediator.cxx +++ b/extensions/source/plugin/unx/mediator.cxx @@ -62,7 +62,7 @@ Mediator::~Mediator() aHeader[2] = MEDIATOR_MAGIC; ssize_t nToWrite = sizeof(aHeader); bool bSuccess = (nToWrite == write(m_nSocket, aHeader, nToWrite)); - SAL_WARN_IF( !bSuccess, "extensions", "short write"); + SAL_WARN_IF(!bSuccess, "extensions.plugin", "short write"); } // kick the thread out of its run method; it deletes itself close( m_nSocket ); @@ -100,7 +100,7 @@ sal_uLong Mediator::SendMessage( sal_uLong nBytes, const char* pBytes, sal_uLong memcpy( &pBuffer[3], pBytes, (size_t)nBytes ); ssize_t nToWrite = nBytes + 3*sizeof( sal_uLong ); bool bSuccess = (nToWrite == write( m_nSocket, pBuffer, nToWrite )); - SAL_WARN_IF( !bSuccess, "extensions", "short write"); + SAL_WARN_IF(!bSuccess, "extensions.plugin", "short write"); delete [] pBuffer; return nMessageID; @@ -222,16 +222,21 @@ void MediatorListener::run() } else { - medDebug( 1, "got incomplete MediatorMessage: { %d, %d, %*s }\n", - nHeader[0], nHeader[1], nHeader[1], pBuffer ); + SAL_WARN( + "extensions.plugin", + "got incomplete MediatorMessage: { " << nHeader[0] << ", " + << nHeader[1] << ", ... }"); bRun = false; } delete [] pBuffer; } else { - medDebug( 1, "got incomplete message header of %d bytes ( nHeader = [ %u, %u ] ), errno is %d\n", - nBytes, nHeader[ 0 ], nHeader[ 1 ], (int)errno ); + SAL_WARN( + "extensions.plugin", + "got incomplete message header of " << nBytes + << " bytes (nHeader = [" << nHeader[0] << ", " << nHeader[1] + << "]), errno is " << errno); bRun = false; } } @@ -252,7 +257,9 @@ sal_uLong MediatorMessage::ExtractULONG() if( ! m_pRun ) m_pRun = m_pBytes; - medDebug( (sal_uLong)(m_pRun - m_pBytes) >= m_nBytes, "Overflow in MediatorMessage::ExtractULONG\n" ); + SAL_WARN_IF( + (sal_uLong)(m_pRun - m_pBytes) >= m_nBytes, "extensions.plugin", + "overflow in MediatorMessage::ExtractULONG"); sal_uLong nCount; memcpy( &nCount, m_pRun, sizeof( sal_uLong ) ); m_pRun += sizeof( sal_uLong ); @@ -264,13 +271,17 @@ void* MediatorMessage::GetBytes( sal_uLong& rBytes ) if( ! m_pRun ) m_pRun = m_pBytes; - medDebug( (sal_uLong)(m_pRun - m_pBytes) >= m_nBytes, "Overflow in MediatorMessage::GetBytes\n" ); + SAL_WARN_IF( + (sal_uLong)(m_pRun - m_pBytes) >= m_nBytes, "extensions.plugin", + "overflow in MediatorMessage::GetBytes"); sal_uLong nBytes = ExtractULONG(); if( nBytes == 0 ) return NULL; - medDebug( (sal_uLong)(m_pRun - m_pBytes) >= m_nBytes, "Overflow in MediatorMessage::GetBytes\n" ); + SAL_WARN_IF( + (sal_uLong)(m_pRun - m_pBytes) >= m_nBytes, "extensions.plugin", + "overflow in MediatorMessage::GetBytes"); char* pBuffer = new char[ nBytes ]; memcpy( pBuffer, m_pRun, nBytes ); m_pRun += nBytes; @@ -283,13 +294,17 @@ char* MediatorMessage::GetString() if( ! m_pRun ) m_pRun = m_pBytes; - medDebug( (sal_uLong)(m_pRun - m_pBytes) >= m_nBytes, "Overflow in MediatorMessage::GetString\n" ); + SAL_WARN_IF( + (sal_uLong)(m_pRun - m_pBytes) >= m_nBytes, "extensions.plugin", + "overflow in MediatorMessage::GetString"); sal_uLong nBytes = ExtractULONG(); if( nBytes == 0 ) return NULL; - medDebug( (sal_uLong)(m_pRun - m_pBytes) >= m_nBytes, "Overflow in MediatorMessage::GetString\n" ); + SAL_WARN_IF( + (sal_uLong)(m_pRun - m_pBytes) >= m_nBytes, "extensions.plugin", + "overflow in MediatorMessage::GetString"); char* pBuffer = new char[ nBytes+1 ]; memcpy( pBuffer, m_pRun, nBytes ); pBuffer[ nBytes ] = 0; @@ -302,10 +317,16 @@ sal_uInt32 MediatorMessage::GetUINT32() if( ! m_pRun ) m_pRun = m_pBytes; - medDebug( (sal_uLong)(m_pRun - m_pBytes) >= m_nBytes, "Overflow in MediatorMessage::GetUINT32\n" ); + SAL_WARN_IF( + (sal_uLong)(m_pRun - m_pBytes) >= m_nBytes, "extensions.plugin", + "overflow in MediatorMessage::GetUINT32"); sal_uLong nBytes = ExtractULONG(); - medDebug( nBytes != sizeof( sal_uInt32 ), "No sal_uInt32 in MediatorMessage::GetUINT32\n" ); - medDebug( (sal_uLong)(m_pRun - m_pBytes) >= m_nBytes, "Overflow in MediatorMessage::GetUINT32\n" ); + SAL_WARN_IF( + nBytes != sizeof( sal_uInt32 ), "extensions.plugin", + "no sal_uInt32 in MediatorMessage::GetUINT32"); + SAL_WARN_IF( + (sal_uLong)(m_pRun - m_pBytes) >= m_nBytes, "extensions.plugin", + "overflow in MediatorMessage::GetUINT32"); sal_uInt32 nRet; memcpy( &nRet, m_pRun, sizeof( nRet ) ); m_pRun += sizeof( sal_uInt32 ); diff --git a/extensions/source/plugin/unx/npnapi.cxx b/extensions/source/plugin/unx/npnapi.cxx index 8a9ce451d5e8..21591923f293 100644 --- a/extensions/source/plugin/unx/npnapi.cxx +++ b/extensions/source/plugin/unx/npnapi.cxx @@ -110,13 +110,13 @@ static NPError l_NPN_DestroyStream( NPP instance, NPStream* stream, NPError reas static JRIEnv* l_NPN_GetJavaEnv() { // no java in this program - medDebug( 1, "SNI: NPN_GetJavaEnv\n" ); + SAL_INFO("extensions.plugin", "SNI: NPN_GetJavaEnv"); return NULL; } static jref l_NPN_GetJavaPeer( NPP /*instance*/ ) { - medDebug( 1, "SNI: NPN_GetJavaPeer\n" ); + SAL_INFO("extensions.plugin", "SNI: NPN_GetJavaPeer"); return NULL; } #endif @@ -134,13 +134,13 @@ static NPError l_NPN_GetURL( NPP instance, const char* url, const char* window ) POST_STRING(url), POST_STRING(window), NULL ); - medDebug( !pMes, "geturl: message unaswered\n" ); + SAL_WARN_IF(!pMes, "extensions.plugin", "geturl: message unanswered"); if( ! pMes ) return NPERR_GENERIC_ERROR; // returns NPError NPError aRet = pConnector->GetNPError( pMes ); - medDebug( aRet, "geturl returns %d\n", (int)aRet ); + SAL_WARN_IF(aRet, "extensions.plugin", "geturl returns " << aRet); delete pMes; return aRet; } @@ -257,7 +257,7 @@ static NPError l_NPN_PostURL( NPP instance, const char* url, const char* window, static NPError l_NPN_RequestRead( NPStream* stream, NPByteRange* rangeList ) { - medDebug( 1, "pluginapp: NPN_RequestRead\n" ); + SAL_INFO("extensions.plugin", "pluginapp: NPN_RequestRead"); NPByteRange* pRange = rangeList; sal_uInt32 nRanges = 0; @@ -333,7 +333,7 @@ static const char* l_NPN_UserAgent( NPP instance ) delete pMes; - medDebug( 1, "NPN_UserAgent returns %s\n", pAgent ); + SAL_INFO("extensions.plugin", "NPN_UserAgent returns " << pAgent); return pAgent; } @@ -364,7 +364,7 @@ static int32_t l_NPN_Write( NPP instance, NPStream* stream, int32_t len, void* b static void l_NPN_ReloadPlugins( NPBool /*reloadPages*/ ) { - medDebug( 1, "NPN_ReloadPlugins: SNI\n" ); + SAL_INFO("extensions.plugin", "NPN_ReloadPlugins: SNI"); } static NPError l_NPN_GetValue( NPP, NPNVariable variable, void* value ) @@ -378,31 +378,31 @@ static NPError l_NPN_GetValue( NPP, NPNVariable variable, void* value ) { case NPNVxDisplay: *((Display**)value) = pXtAppDisplay; - medDebug( 1, "Display requested\n" ); + SAL_INFO("extensions.plugin", "Display requested"); break; case NPNVxtAppContext: *((XtAppContext*)value) = app_context; - medDebug( 1, "AppContext requested\n" ); + SAL_INFO("extensions.plugin", "AppContext requested"); break; case NPNVjavascriptEnabledBool: // no javascript *(NPBool*)value = false; - medDebug( 1, "javascript enabled requested\n" ); + SAL_INFO("extensions.plugin", "javascript enabled requested"); break; case NPNVasdEnabledBool: // no SmartUpdate *(NPBool*)value = false; - medDebug( 1, "smart update enabled requested\n" ); + SAL_INFO("extensions.plugin", "smart update enabled requested"); break; case NPNVisOfflineBool: // no offline browsing *(NPBool*)value = false; - medDebug( 1, "offline browsing requested\n" ); + SAL_INFO("extensions.plugin", "offline browsing requested"); break; case NPNVSupportsXEmbedBool: // asking xembed *(int*)value = true; - medDebug( 1, "xembed requested\n" ); + SAL_INFO("extensions.plugin", "xembed requested"); break; case NPNVToolkit: # ifdef ENABLE_GTK @@ -410,10 +410,12 @@ static NPError l_NPN_GetValue( NPP, NPNVariable variable, void* value ) # else *(int*)value = 0; # endif - medDebug( 1, "toolkit requested\n" ); + SAL_INFO("extensions.plugin", "toolkit requested"); break; default: - medDebug( 1, "unknown NPNVariable %x requested\n", variable ); + SAL_WARN( + "extensions.plugin", + "unknown NPNVariable " << +variable << " requested"); return NPERR_INVALID_PARAM; } return NPERR_NO_ERROR; @@ -421,23 +423,23 @@ static NPError l_NPN_GetValue( NPP, NPNVariable variable, void* value ) static NPError l_NPN_SetValue(NPP /*instance*/, NPPVariable variable, void *value) { - medDebug( 1, "NPN_SetValue %d=%p\n", variable, value ); + SAL_INFO("extensions.plugin", "NPN_SetValue " << +variable << "=" << value); return 0; } static void l_NPN_InvalidateRect(NPP /*instance*/, NPRect* /*invalidRect*/) { - medDebug( 1, "NPN_InvalidateRect\n" ); + SAL_INFO("extensions.plugin", "NPN_InvalidateRect"); } static void l_NPN_InvalidateRegion(NPP /*instance*/, NPRegion /*invalidRegion*/) { - medDebug( 1, "NPN_InvalidateRegion\n" ); + SAL_INFO("extensions.plugin", "NPN_InvalidateRegion"); } static void l_NPN_ForceRedraw(NPP /*instance*/) { - medDebug( 1, "NPN_ForceRedraw\n" ); + SAL_INFO("extensions.plugin", "NPN_ForceRedraw"); } } @@ -519,7 +521,8 @@ IMPL_LINK( PluginConnector, WorkOnNewMessageHdl, Mediator*, /*pMediator*/ ) while( (pMessage = GetNextMessage( sal_False )) ) { nCommand = (CommandAtoms)pMessage->GetUINT32(); - medDebug( 1, "pluginapp: %s\n", GetCommandName( nCommand ) ); + SAL_INFO( + "extensions.plugin", "pluginapp: " << GetCommandName(nCommand)); switch( nCommand ) { case eNPP_DestroyStream: @@ -591,7 +594,9 @@ IMPL_LINK( PluginConnector, WorkOnNewMessageHdl, Mediator*, /*pMediator*/ ) m_aInstances.erase( m_aInstances.begin() + nInstance ); delete pInst; delete instance; - medDebug( 1, "destroyed instance (returning %d)\n", aRet ); + SAL_INFO( + "extensions.plugin", + "destroyed instance (returning " << aRet << ")"); } break; case eNPP_NewStream: @@ -609,10 +614,17 @@ IMPL_LINK( PluginConnector, WorkOnNewMessageHdl, Mediator*, /*pMediator*/ ) uint16_t nStype = NP_ASFILE; NPError aRet = aPluginFuncs.newstream( instance, pType, pStream, *pSeekable, &nStype ); - medDebug( 1, "pluginapp: NPP_NewStream( %p, %s, %p, %s, %p ) returns %d\n" - "stream = { pdata = %p, ndata = %p, url = %s, end = %d, lastmodified = %d, notifyData = %p }\n", - instance, pType, pStream, *pSeekable ? "seekable" : "not seekable", &nStype, (int)aRet, - pStream->pdata, pStream->ndata, pStream->url, pStream->end, pStream->lastmodified, pStream->notifyData ); + SAL_INFO( + "extensions.plugin", + "pluginapp: NPP_NewStream(" << instance << ", " << pType + << ", " << pStream << ", " + << (*pSeekable ? "seekable" : "not seekable") << ", " + << &nStype << ") returns " << aRet + << "; stream = { pdata = " << pStream->pdata + << ", ndata = " << pStream->ndata << ", url = " + << pStream->url << ", end = " << pStream->end + << ", lastmodified = " << pStream->lastmodified + << ", notifyData = " << pStream->notifyData << " }"); Respond( pMessage->m_nID, (char*)&aRet, sizeof( aRet ), &nStype, sizeof( nStype ), @@ -646,14 +658,17 @@ IMPL_LINK( PluginConnector, WorkOnNewMessageHdl, Mediator*, /*pMediator*/ ) pInst->nArg ? pInst->argv : NULL, ( nSaveBytes == 4 && *(sal_uInt32*)pSavedData == 0 ) ? &(pInst->aData) : NULL ); - medDebug( 1, "pluginapp: NPP_New( %s, %p, %d, %d, %p, %p, %p ) returns %d\n", - pInst->pMimeType, - instance, *pMode, pInst->nArg, pInst->argn, pInst->argv, &pInst->aData, - (int) aRet ); -#if OSL_DEBUG_LEVEL > 1 + SAL_INFO( + "extensions.plugin", + "pluginapp: NPP_New( " << pInst->pMimeType << ", " + << instance << ", " << *pMode << ", " << pInst->nArg + << ", " << pInst->argn << ", " << pInst->argv << ", " + << &pInst->aData << ") returns" << aRet); for( int i = 0; i < pInst->nArg; i++ ) - medDebug( 1, " \"%s\"=\"%s\"\n", pInst->argn[i], pInst->argv[i] ); -#endif + SAL_INFO( + "extensions.plugin", + " \"" << pInst->argn[i] << "\"=\"" << pInst->argv[i] + << "\""); #ifdef ENABLE_GTK // check if XEMBED is to be used @@ -666,7 +681,10 @@ IMPL_LINK( PluginConnector, WorkOnNewMessageHdl, Mediator*, /*pMediator*/ ) NPError error = aPluginFuncs.getvalue( instance, NPPVpluginNeedsXEmbed, (void *)&bNeedsXEmbed ); if( error == NPERR_NO_ERROR ) pInst->bShouldUseXEmbed = (bNeedsXEmbed != 0); - medDebug( 1, "should use xembed = %s\n", pInst->bShouldUseXEmbed ? "true" : "false" ); + SAL_INFO( + "extensions.plugin", + "should use xembed = " + << (pInst->bShouldUseXEmbed ? "true" : "false")); } #endif @@ -694,7 +712,9 @@ IMPL_LINK( PluginConnector, WorkOnNewMessageHdl, Mediator*, /*pMediator*/ ) { if( ! pInst->pGtkWidget ) { - medDebug( 1, "creating gtk plug and socket\n" ); + SAL_INFO( + "extensions.plugin", + "creating gtk plug and socket"); pInst->pGtkWindow = gtk_plug_new((GdkNativeWindow)reinterpret_cast(pWindow->window)); gtk_widget_show( pInst->pGtkWindow ); @@ -771,7 +791,9 @@ IMPL_LINK( PluginConnector, WorkOnNewMessageHdl, Mediator*, /*pMediator*/ ) } NPError aRet = aPluginFuncs.setwindow( pInst->instance, &pInst->window ); - medDebug( 1, "pluginapp: NPP_SetWindow returns %d\n", (int) aRet ); + SAL_INFO( + "extensions.plugin", + "pluginapp: NPP_SetWindow returns " << aRet); Respond( pMessage->m_nID, (char*)&aRet, sizeof( aRet ), NULL ); @@ -785,7 +807,9 @@ IMPL_LINK( PluginConnector, WorkOnNewMessageHdl, Mediator*, /*pMediator*/ ) sal_uInt32 nFileID = pMessage->GetUINT32(); NPStream* pStream = m_aNPWrapStreams[ nFileID ]; char* fname = pMessage->GetString(); - medDebug( 1, "pluginapp: NPP_StreamAsFile %s\n", fname ); + SAL_INFO( + "extensions.plugin", + "pluginapp: NPP_StreamAsFile " << fname); aPluginFuncs.asfile( instance, pStream, fname ); delete [] fname; } @@ -811,8 +835,11 @@ IMPL_LINK( PluginConnector, WorkOnNewMessageHdl, Mediator*, /*pMediator*/ ) NPStream* pStream = m_aNPWrapStreams[ nFileID ]; int32_t nRet = aPluginFuncs.writeready( instance, pStream ); - medDebug( 1, "pluginapp: NPP_WriteReady( %p, %p ) (stream id = %d) returns %d\n", - instance, pStream, nFileID, nRet ); + SAL_INFO( + "extensions.plugin", + "pluginapp: NPP_WriteReady(" << instance << ", " << pStream + << ") (stream id = " << nFileID << ") returns " + << nRet); Respond( pMessage->m_nID, (char*)&nRet, sizeof( nRet ), @@ -830,10 +857,16 @@ IMPL_LINK( PluginConnector, WorkOnNewMessageHdl, Mediator*, /*pMediator*/ ) char* buffer = (char*)pMessage->GetBytes( len ); int32_t nRet = aPluginFuncs.write( instance, pStream, offset, len, buffer ); - medDebug( 1,"pluginapp: NPP_Write( %p, %p, %d, %d, %p ) returns %d\n" - "stream = { pdata = %p, ndata = %p, url = %s, end = %d, lastmodified = %d, notifyData = %p }\n", - instance, pStream, offset, len, buffer, nRet, - pStream->pdata, pStream->ndata, pStream->url, pStream->end, pStream->lastmodified, pStream->notifyData ); + SAL_INFO( + "extensions.plugin", + "pluginapp: NPP_Write(" << instance << ", " << pStream + << ", " << offset << ", " << len << ", " << buffer + << ") returns " << nRet << "; stream = { pdata = " + << pStream->pdata << ", ndata = " << pStream->ndata + << ", url = " << pStream->url << ", end = " + << pStream->end << ", lastmodified = " + << pStream->lastmodified << ", notifyData = " + << pStream->notifyData << " }"); Respond( pMessage->m_nID, (char*)&nRet, sizeof( nRet ), @@ -858,25 +891,33 @@ IMPL_LINK( PluginConnector, WorkOnNewMessageHdl, Mediator*, /*pMediator*/ ) pNP_Initialize = (NPError(*)(NPNetscapeFuncs*, NPPluginFuncs*)) osl_getAsciiFunctionSymbol( pPluginLib, "NP_Initialize" ); - medDebug( !pNP_Initialize, "no NP_Initialize, %s\n", dlerror() ); + SAL_WARN_IF( + !pNP_Initialize, "extensions.plugin", + "no NP_Initialize, " << dlerror()); pNP_Shutdown = (NPError(*)()) osl_getAsciiFunctionSymbol( pPluginLib, "NP_Shutdown" ); - medDebug( !pNP_Initialize, "no NP_Shutdown, %s\n", dlerror() ); + SAL_WARN_IF( + !pNP_Initialize, "extensions.plugin", + "no NP_Shutdown, " << dlerror()); - medDebug( 1, "entering NP_Initialize\n" ); + SAL_INFO("extensions.plugin", "entering NP_Initialize"); NPError aRet = pNP_Initialize( &aNetscapeFuncs, &aPluginFuncs ); - medDebug( 1, "pluginapp: NP_Initialize returns %d\n", (int) aRet ); + SAL_INFO( + "extensions.plugin", + "pluginapp: NP_Initialize returns " << aRet); Respond( pMessage->m_nID, (char*)&aRet, sizeof( aRet ), NULL ); } break; case eNPP_Shutdown: { bool bSuccess = (4 == write(wakeup_fd[1], "xxxx", 4)); - SAL_WARN_IF( !bSuccess, "extensions", "short write"); + SAL_WARN_IF(!bSuccess, "extensions.plugin", "short write"); } break; default: - medDebug( 1, "caught unknown NPP request %d\n", nCommand ); + SAL_WARN( + "extensions.plugin", + "caught unknown NPP request " << +nCommand); break; } delete pMessage; @@ -886,7 +927,7 @@ IMPL_LINK( PluginConnector, WorkOnNewMessageHdl, Mediator*, /*pMediator*/ ) void LoadAdditionalLibs( const char* _pPluginLib ) { - medDebug( 1, "LoadAdditionalLibs %s\n", _pPluginLib ); + SAL_INFO("extensions.plugin", "LoadAdditionalLibs " << _pPluginLib); if( ! strncmp( _pPluginLib, "libflashplayer.so", 17 ) ) { diff --git a/extensions/source/plugin/unx/nppapi.cxx b/extensions/source/plugin/unx/nppapi.cxx index 0be0f468ce7a..ff4733f12a15 100644 --- a/extensions/source/plugin/unx/nppapi.cxx +++ b/extensions/source/plugin/unx/nppapi.cxx @@ -96,7 +96,7 @@ IMPL_LINK( PluginConnector, WorkOnNewMessageHdl, Mediator*, /*pMediator*/ ) while( (pMessage = GetNextMessage( sal_False )) ) { nCommand = (CommandAtoms)pMessage->GetUINT32(); - medDebug( 1, "%s\n", GetCommandName( nCommand ) ); + SAL_INFO("extensions.plugin", GetCommandName(nCommand)); switch( nCommand ) { case eNPN_GetURL: @@ -146,11 +146,16 @@ IMPL_LINK( PluginConnector, WorkOnNewMessageHdl, Mediator*, /*pMediator*/ ) m_aNPWrapStreams.erase( m_aNPWrapStreams.begin() + nFileID ); } else - medDebug( 1, "StreamID %d has incoherent urls %s and %s\n", - nFileID, pUrl, m_aNPWrapStreams[ nFileID ]->url ); + SAL_WARN( + "extensions.plugin", + "StreamID " << nFileID << " has incoherent urls " + << pUrl << " and " + << m_aNPWrapStreams[nFileID]->url); } else - medDebug( 1, "Nonexistent StreamID %d\n", nFileID ); + SAL_WARN( + "extensions.plugin", + "nonexistent StreamID " << nFileID); Respond( pMessage->m_nID, (char*)(&aRet), sizeof( NPError ), NULL ); @@ -310,7 +315,9 @@ IMPL_LINK( PluginConnector, WorkOnNewMessageHdl, Mediator*, /*pMediator*/ ) } break; default: - medDebug( 1, "caught unknown NPN request %d\n", nCommand ); + SAL_WARN( + "extensions.plugin", + "caught unknown NPN request " << +nCommand); } delete pMessage; diff --git a/extensions/source/plugin/unx/npwrap.cxx b/extensions/source/plugin/unx/npwrap.cxx index 514c92abb08b..b2cd5324c19a 100644 --- a/extensions/source/plugin/unx/npwrap.cxx +++ b/extensions/source/plugin/unx/npwrap.cxx @@ -63,10 +63,10 @@ static bool bPluginAppQuit = false; static long GlobalConnectionLostHdl( void* /*pInst*/, void* /*pArg*/ ) { - medDebug( 1, "pluginapp exiting due to connection lost\n" ); + SAL_WARN("extensions.plugin", "pluginapp exiting due to connection lost"); bool bSuccess = (4 == write(wakeup_fd[1], "xxxx", 4 )); - SAL_WARN_IF( !bSuccess, "extensions", "short write"); + SAL_WARN_IF(!bSuccess, "extensions.plugin", "short write"); return 0; } @@ -95,7 +95,7 @@ extern "C" // it seems you can use XtRemoveInput only // safely from within the callback // why is that ? - medDebug( 1, "removing wakeup pipe\n" ); + SAL_INFO("extensions.plugin", "removing wakeup pipe"); XtRemoveInput( *id ); XtAppSetExitFlag( app_context ); bPluginAppQuit = true; @@ -111,9 +111,9 @@ extern "C" IMPL_LINK( PluginConnector, NewMessageHdl, Mediator*, /*pMediator*/ ) { - medDebug( 1, "new message handler\n" ); + SAL_INFO("extensions.plugin", "new message handler"); bool bSuccess = (4 == write(wakeup_fd[1], "cccc", 4)); - SAL_WARN_IF( !bSuccess, "extensions", "short write"); + SAL_WARN_IF(!bSuccess, "extensions.plugin", "short write"); return 0; } @@ -135,7 +135,10 @@ Widget createSubWidget( char* /*pPluginText*/, Widget shell, XLIB_Window aParent XtRealizeWidget( shell ); XtRealizeWidget( newWidget ); - medDebug( 1, "Reparenting new widget %x to %x\n", XtWindow( newWidget ), aParentWindow ); + SAL_INFO( + "extensions.plugin", + "reparenting new widget " << XtWindow( newWidget ) << " to " + << aParentWindow); XReparentWindow( pXtAppDisplay, XtWindow( shell ), aParentWindow, @@ -178,10 +181,7 @@ static oslModule LoadModule( const char* pPath ) osl_getFileURLFromSystemPath( sSystemPath.pData, &sFileURL.pData ); oslModule pLib = osl_loadModule( sFileURL.pData, SAL_LOADMODULE_LAZY ); - if( ! pLib ) - { - medDebug( 1, "could not open %s: %s\n", pPath, dlerror() ); - } + SAL_INFO_IF(!pLib, "extensions.plugin", "could not open " << pPath); return pLib; } @@ -189,15 +189,18 @@ static oslModule LoadModule( const char* pPath ) static void CheckPlugin( const char* pPath ) { oslModule pLib = LoadModule( pPath ); - - char*(*pNP_GetMIMEDescription)() = (char*(*)()) - osl_getAsciiFunctionSymbol( pLib, "NP_GetMIMEDescription" ); - if( pNP_GetMIMEDescription ) - printf( "%s\n", pNP_GetMIMEDescription() ); - else - medDebug( 1, "could not get symbol NP_GetMIMEDescription %s\n", dlerror() ); - - osl_unloadModule( pLib ); + if (pLib != 0) + { + char*(*pNP_GetMIMEDescription)() = (char*(*)()) + osl_getAsciiFunctionSymbol( pLib, "NP_GetMIMEDescription" ); + if( pNP_GetMIMEDescription ) + printf( "%s\n", pNP_GetMIMEDescription() ); + else + SAL_WARN( + "extensions.plugin", + "could not get symbol NP_GetMIMEDescription " << dlerror()); + osl_unloadModule( pLib ); + } } #if OSL_DEBUG_LEVEL > 1 && defined LINUX @@ -351,7 +354,7 @@ int main( int argc, char **argv) if( pipe( wakeup_fd ) ) { - medDebug( 1, "could not pipe()\n" ); + SAL_WARN("extensions.plugin", "could not pipe()"); return 1; } // initialize 'wakeup' pipe. @@ -410,7 +413,7 @@ int main( int argc, char **argv) GSource* pXTSource = g_source_new( &aXtEventFuncs, sizeof(GSource) ); if( !pXTSource ) { - medDebug( 1, "could not get Xt GSource" ); + SAL_WARN("extensions.plugin", "could not get Xt GSource"); return 1; } @@ -427,7 +430,7 @@ int main( int argc, char **argv) GSource *pWakeupSource = g_source_new( &aWakeupEventFuncs, sizeof(GSource) ); if ( pWakeupSource == NULL ) { - medDebug( 1, "could not get wakeup source" ); + SAL_WARN("extensions.plugin", "could not get wakeup source"); return 1; } g_source_set_priority( pWakeupSource, GDK_PRIORITY_EVENTS); @@ -483,16 +486,16 @@ int main( int argc, char **argv) #endif } while( ! XtAppGetExitFlag( app_context ) && ! bPluginAppQuit ); - medDebug( 1, "left plugin app main loop\n" ); + SAL_INFO("extensions.plugin", "left plugin app main loop"); #ifdef ENABLE_GTK g_source_remove(xt_polling_timer_id); #endif pNP_Shutdown(); - medDebug( 1, "NP_Shutdown done\n" ); + SAL_INFO("extensions.plugin", "NP_Shutdown done"); osl_unloadModule( pPluginLib ); - medDebug( 1, "plugin close\n" ); + SAL_INFO("extensions.plugin", "plugin close"); close( wakeup_fd[0] ); close( wakeup_fd[1] ); diff --git a/extensions/source/plugin/unx/plugcon.cxx b/extensions/source/plugin/unx/plugcon.cxx index 1a4462425fc4..cc0d3b53b089 100644 --- a/extensions/source/plugin/unx/plugcon.cxx +++ b/extensions/source/plugin/unx/plugcon.cxx @@ -44,7 +44,7 @@ sal_uInt32 PluginConnector::GetStreamID( NPStream* pStream ) for( size_t i = 0; i < nLen; i++ ) if( m_aNPWrapStreams[ i ] == pStream ) return static_cast(i); - medDebug( 1, "Error: NPStream has no ID\n" ); + SAL_WARN("extensions.plugin", "NPStream has no ID"); return UnknownStreamID; } @@ -54,7 +54,7 @@ sal_uInt32 PluginConnector::GetNPPID( NPP instance ) for( size_t i=0; i instance == instance ) return static_cast(i); - medDebug( 1, "Error: NPP has no ID\n" ); + SAL_WARN("extensions.plugin", "NPP has no ID"); return UnknownNPPID; } -- cgit