diff --git a/binfilter/bf_basic/source/sbx/sbxbase.cxx b/binfilter/bf_basic/source/sbx/sbxbase.cxx index 7ffbdd5..691030b 100644 --- a/binfilter/bf_basic/source/sbx/sbxbase.cxx +++ b/binfilter/bf_basic/source/sbx/sbxbase.cxx @@ -26,6 +26,8 @@ * ************************************************************************/ +#include +#include #include #include "sbx.hxx" @@ -202,7 +204,7 @@ SbxBase* SbxBase::Create( UINT16 nSbxId, UINT32 nCreator ) return pNew; } -SbxObject* SbxBase::CreateObject( const XubString& rClass ) +SbxObject* SbxBase::CreateObject( const rtl::OUString& rClass ) { SbxAppData* p = GetSbxData_Impl(); SbxObject* pNew = NULL; @@ -212,15 +214,7 @@ SbxObject* SbxBase::CreateObject( const XubString& rClass ) if( pNew ) break; } -#ifdef DBG_UTIL - if( !pNew ) - { - ByteString aMsg( "SBX: Keine Factory fuer Objektklasse " ); - ByteString aClassStr( (const UniString&)rClass, RTL_TEXTENCODING_ASCII_US ); - aMsg += aClassStr; - DbgError( (const char*)aMsg.GetBuffer() ); - } -#endif + SAL_WARN_IF_S(!pNew, "binfilter", "No factory for object class " << rClass); return pNew; } diff --git a/binfilter/bf_basic/source/sbx/sbxobj.cxx b/binfilter/bf_basic/source/sbx/sbxobj.cxx index 4b515d0..7bef1ac 100644 --- a/binfilter/bf_basic/source/sbx/sbxobj.cxx +++ b/binfilter/bf_basic/source/sbx/sbxobj.cxx @@ -375,20 +375,6 @@ SbxVariable* SbxObject::Make( const XubString& rName, SbxClassType ct, SbxDataTy SbxVariable* pRes = pArray->Find( rName, ct ); if( pRes ) { -/* Wegen haeufiger Probleme (z.B. #67000) erstmal ganz raus -#ifdef DBG_UTIL - if( pRes->GetHashCode() != nNameHash - && pRes->GetHashCode() != nParentHash ) - { - XubString aMsg( "SBX-Element \"" ); - aMsg += pRes->GetName(); - aMsg += "\"\n in Objekt \""; - aMsg += GetName(); - aMsg += "\" bereits vorhanden"; - DbgError( (const char*)aMsg.GetStr() ); - } -#endif -*/ return pRes; } } diff --git a/binfilter/bf_svtools/source/inc/poolio.hxx b/binfilter/bf_svtools/source/inc/poolio.hxx index 6b2088b..6b515ce 100644 --- a/binfilter/bf_svtools/source/inc/poolio.hxx +++ b/binfilter/bf_svtools/source/inc/poolio.hxx @@ -122,17 +122,8 @@ struct SfxItemPool_Impl #endif #if defined(DBG_UTIL) && defined(MSC) -#define SFX_TRACE(s,p) \ - { \ - ByteString aPtr(RTL_CONSTASCII_STRINGPARAM("0x0000:0x0000")); \ - _snprintf(const_cast< sal_Char *>(aPtr.GetBuffer()), aPtr.Len(), \ - "%lp", p ); \ - aPtr.Insert(s, 0); \ - DbgTrace( aPtr.GetBuffer() ); \ - } #define DBG(x) x #else -#define SFX_TRACE(s,p) #define DBG(x) #endif diff --git a/binfilter/bf_svtools/source/items1/svt_itempool.cxx b/binfilter/bf_svtools/source/items1/svt_itempool.cxx index 06610ad..2b691ca 100644 --- a/binfilter/bf_svtools/source/items1/svt_itempool.cxx +++ b/binfilter/bf_svtools/source/items1/svt_itempool.cxx @@ -832,7 +832,6 @@ void SfxItemPool::Remove( const SfxPoolItem& rItem ) else { SFX_ASSERT( 0, rItem.Which(), "removing Item without ref" ); - SFX_TRACE( "to be removed, but not no refs: ", *ppHtArr ); } // ggf. kleinstmoegliche freie Position merken @@ -849,7 +848,6 @@ void SfxItemPool::Remove( const SfxPoolItem& rItem ) // nicht vorhanden SFX_ASSERT( 0, rItem.Which(), "removing Item not in Pool" ); - SFX_TRACE( "to be removed, but not in pool: ", &rItem ); } // ----------------------------------------------------------------------- diff --git a/binfilter/bf_svtools/source/items1/svt_poolio.cxx b/binfilter/bf_svtools/source/items1/svt_poolio.cxx index 0d453dc..cd2426e 100644 --- a/binfilter/bf_svtools/source/items1/svt_poolio.cxx +++ b/binfilter/bf_svtools/source/items1/svt_poolio.cxx @@ -31,6 +31,7 @@ #include #include +#include #include #include #include "whassert.hxx" @@ -668,13 +669,13 @@ SvStream &SfxItemPool::Load1_Impl(SvStream &rStream) delete rpNewItem; rpNewItem = pOldItem; bFound = TRUE; - SFX_TRACE( "reusing item", pOldItem ); + SAL_INFO_S( + "binfilter", "reusing item" << pOldItem); } } - if ( !bFound ) - { - SFX_TRACE( "item not found: ", pOldItem ); - } + SAL_INFO_IF_S( + !bFound, "binfilter", + "item not found: " << pOldItem); } } } diff --git a/binfilter/inc/bf_basic/sbxcore.hxx b/binfilter/inc/bf_basic/sbxcore.hxx index 582e46f..1f6fca9 100644 --- a/binfilter/inc/bf_basic/sbxcore.hxx +++ b/binfilter/inc/bf_basic/sbxcore.hxx @@ -41,6 +41,7 @@ class SvStream; class String; class UniString; +namespace rtl { class OUString; } // Das nachfolgende Makro definiert die vier (fuenf) notwendigen Methoden // innerhalb eines SBX-Objekts. LoadPrivateData() und StorePrivateData() @@ -138,7 +139,7 @@ public: static void RemoveFactory( SbxFactory* ); static SbxBase* Create( UINT16, UINT32=SBXCR_SBX ); - static SbxObject* CreateObject( const String& ); + static SbxObject* CreateObject( const rtl::OUString& ); // Sbx-Loesung als Ersatz fuer SfxBroadcaster::Enable() static BOOL StaticIsEnabledBroadcasting( void ); }; diff --git a/binfilter/legacysmgr/source/legacy/legacy_binfilters_smgr.cxx b/binfilter/legacysmgr/source/legacy/legacy_binfilters_smgr.cxx index 952e278..dc1a1af 100644 --- a/binfilter/legacysmgr/source/legacy/legacy_binfilters_smgr.cxx +++ b/binfilter/legacysmgr/source/legacy/legacy_binfilters_smgr.cxx @@ -25,16 +25,22 @@ * for a copy of the LGPLv3 License. * ************************************************************************/ + +#include "sal/config.h" + +#include + #include #include #include -#include "osl/diagnose.h" #include "osl/file.hxx" #include "osl/process.h" #include "rtl/bootstrap.hxx" +#include "rtl/oustringostreaminserter.hxx" #include "rtl/ustrbuf.hxx" #include "rtl/unload.h" +#include "sal/log.h" #include "uno/dispatcher.h" @@ -483,13 +489,17 @@ void OServiceManager_Listener::disposing(const EventObject & rEvt ) { x->remove( Any( &rEvt.Source, ::getCppuType( (const Reference *)0 ) ) ); } - catch( const IllegalArgumentException & ) + catch( const IllegalArgumentException & e ) { - OSL_FAIL( "IllegalArgumentException catched" ); + (void) e; // avoid warnings + SAL_WARN_S( + "binfilter", "IllegalArgumentException caught: " << e.Message); } - catch( const NoSuchElementException & ) + catch( const NoSuchElementException & e ) { - OSL_FAIL( "NoSuchElementException catched" ); + (void) e; // avoid warnings + SAL_WARN_S( + "binfilter", "NoSuchElementException caught: " << e.Message); } } } @@ -794,14 +804,13 @@ void OServiceManager::disposing() if( xComp.is() ) xComp->dispose(); } - catch (const RuntimeException & exc) + catch (const RuntimeException & e) { -#ifdef DEBUG - OString str( OUStringToOString( exc.Message, RTL_TEXTENCODING_ASCII_US ) ); - OSL_TRACE( "### RuntimeException occurred upon disposing factory: %s", str.getStr() ); -#else - (void)exc; -#endif + (void) e; // avoid warnings + SAL_WARN_S( + "binfilter", + "RuntimeException occurred upon disposing factory: " + << e.Message); } } @@ -820,7 +829,7 @@ void OServiceManager::disposing() m_xContext.clear(); // not only the Event should hold the object - OSL_ASSERT( m_refCount != 1 ); + SAL_WARN_IF(m_refCount == 1, "binfilter", "only Event holds object"); // Revoke this service manager as unloading listener rtl_removeUnloadingListener( m_nUnloadingListenerId); @@ -997,23 +1006,20 @@ Reference< XInterface > OServiceManager::createInstanceWithContext( Reference< XSingleServiceFactory > xFac2( xFactory, UNO_QUERY ); if (xFac2.is()) { -#ifdef DEBUG - OString aStr( OUStringToOString( rServiceSpecifier, RTL_TEXTENCODING_ASCII_US ) ); - OSL_TRACE( "### ignoring given context raising service %s !!!\n", aStr.getStr() ); -#endif + SAL_INFO_S( + "binfilter", + "ignoring given context raising service " + << rServiceSpecifier); return xFac2->createInstance(); } } } } - catch (const lang::DisposedException & exc) + catch (const lang::DisposedException & e) { -#ifdef DEBUG - OString str( OUStringToOString( exc.Message, RTL_TEXTENCODING_ASCII_US ) ); - OSL_TRACE( "### DisposedException occurred: %s", str.getStr() ); -#else - (void)exc; -#endif + (void) e; // avoid warnings + SAL_WARN_S( + "binfilter", "DisposedException occurred: " << e.Message); } } @@ -1048,23 +1054,20 @@ Reference< XInterface > OServiceManager::createInstanceWithArgumentsAndContext( Reference< XSingleServiceFactory > xFac2( xFactory, UNO_QUERY ); if (xFac2.is()) { -#ifdef DEBUG - OString aStr( OUStringToOString( rServiceSpecifier, RTL_TEXTENCODING_ASCII_US ) ); - OSL_TRACE( "### ignoring given context raising service %s !!!\n", aStr.getStr() ); -#endif + SAL_INFO_S( + "binfilter", + "ignoring given context raising service " + << rServiceSpecifier); return xFac2->createInstanceWithArguments( rArguments ); } } } } - catch (const lang::DisposedException & exc) + catch (const lang::DisposedException & e) { -#ifdef DEBUG - OString str( OUStringToOString( exc.Message, RTL_TEXTENCODING_ASCII_US ) ); - OSL_TRACE( "### DisposedException occurred: %s", str.getStr() ); -#else - (void)exc; -#endif + (void) e; // avoid warnings + SAL_WARN_S( + "binfilter", "DisposedException occurred: " << e.Message); } } @@ -1105,7 +1108,7 @@ void OServiceManager::initialize( Sequence< Any > const & ) throw (Exception) { check_undisposed(); - OSL_FAIL( "not impl!" ); + SAL_WARN("binfilter", "not impl!"); } // XServiceInfo @@ -1502,7 +1505,8 @@ Reference ORegistryServiceManager::loadWithImplementationName( if( xImpKey.is() ) { - OSL_ASSERT( s_xLegacyMgr.is() ); + SAL_WARN_IF( + !s_xLegacyMgr.is(), "binfilter", "no legacy service manager"); ret = createSingleRegistryFactory( s_xLegacyMgr.is() ? s_xLegacyMgr @@ -1593,7 +1597,7 @@ void ORegistryServiceManager::initialize(const Sequence< Any >& Arguments) } #if defined _DEBUG // to find all bootstrapping processes to be fixed... - OSL_ENSURE( !m_init, "### second init of service manager instance!" ); + SAL_WARN_IF(m_init, "binfilter", "second init of service manager instance"); m_init = true; #endif } @@ -1762,12 +1766,16 @@ public: } virtual sal_Bool SAL_CALL supportsService(const OUString& ServiceName) throw (RuntimeException) { - OSL_FAIL( "### unexpected call LegacyServiceManager::supportsService()!" ); + SAL_WARN( + "binfilter", + "unexpected call LegacyServiceManager::supportsService()"); return m_xOfficeMgr_si->supportsService( ServiceName ); } virtual Sequence< OUString > SAL_CALL getSupportedServiceNames() throw (RuntimeException) { - OSL_FAIL( "### unexpected call LegacyServiceManager::getSupportedServiceNames()!" ); + SAL_WARN( + "binfilter", + "unexpected call LegacyServiceManager::getSupportedServiceNames()"); return m_xOfficeMgr_si->getSupportedServiceNames(); } @@ -2000,13 +2008,13 @@ void * SAL_CALL legacysmgr_component_getFactory( lang::XMultiServiceFactory * smgr, registry::XRegistryKey * key ) { + assert(smgr != 0); try { if (! s_xLegacyMgr.is()) { // * office mgr * Reference< lang::XMultiServiceFactory > xMgr( smgr ); - OSL_ASSERT( xMgr.is() ); Reference< beans::XPropertySet > xProps( xMgr, UNO_QUERY_THROW ); Reference< XComponentContext > xOfficeContext( xProps->getPropertyValue( OUSTR("DefaultContext") ), @@ -2083,15 +2091,13 @@ void * SAL_CALL legacysmgr_component_getFactory( return component_getFactoryHelper( implName, s_xLegacyMgr.get(), key, s_entries ); } - catch (const Exception & exc) + catch (const Exception & e) { - (void) exc; // avoid warnings - OSL_FAIL( - OSL_FORMAT( - ("unexpected exception in legacysmgr_component_getFactory:" - " \"%s\""), - (rtl::OUStringToOString(exc.Message, RTL_TEXTENCODING_UTF8). - getStr()))); + (void) e; // avoid warnings + SAL_WARN_S( + "binfilter", + "unexpected exception in legacysmgr_component_getFactory: \"" + << e.Message << '"'); } return 0; }