From 70a6b9ffbd676a1384433a86205d2cd4f2d4f4b1 Mon Sep 17 00:00:00 2001 From: Stephan Bergmann Date: Tue, 22 Nov 2011 09:34:46 +0100 Subject: New sal/log.h obsoletes osl/diagnose.h and tools/debug.hxx. * New SAL_INFO..., SAL_WARN... macros. * New SAL_STREAM supersedes OSL_FORMAT. * oustringostreaminserter.hxx moved from unotest to rtl (and always UTF-8 now). * TODO to enable GCC __attribute__((format)) in sal/log.h (requires call-site cleanup). * Further functionality in tools/debug.hxx (DBG_MEMTEST, DBG_CTOR, etc.) not yet addressed. * Some replacements tools String -> rtl::OUString. --- svl/source/inc/poolio.hxx | 9 --------- svl/source/items/itempool.cxx | 2 -- svl/source/items/poolio.cxx | 9 ++++----- svl/source/items/whassert.hxx | 25 ++++--------------------- 4 files changed, 8 insertions(+), 37 deletions(-) (limited to 'svl') diff --git a/svl/source/inc/poolio.hxx b/svl/source/inc/poolio.hxx index 1515779d33ed..15f55eebdb72 100644 --- a/svl/source/inc/poolio.hxx +++ b/svl/source/inc/poolio.hxx @@ -154,17 +154,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/svl/source/items/itempool.cxx b/svl/source/items/itempool.cxx index 2bcef79a1bfc..cdcf217b1467 100644 --- a/svl/source/items/itempool.cxx +++ b/svl/source/items/itempool.cxx @@ -836,7 +836,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: ", p ); } // ggf. kleinstmoegliche freie Position merken @@ -854,7 +853,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/svl/source/items/poolio.cxx b/svl/source/items/poolio.cxx index eb84af50e9d1..ce5bb32b7db4 100644 --- a/svl/source/items/poolio.cxx +++ b/svl/source/items/poolio.cxx @@ -32,6 +32,7 @@ #include #include +#include #include #include #include "whassert.hxx" @@ -955,14 +956,12 @@ SvStream &SfxItemPool::Load1_Impl(SvStream &rStream) delete rpNewItem; rpNewItem = pOldItem; bFound = true; - SFX_TRACE( "reusing item", pOldItem ); + SAL_INFO_S("svl", "reusing item" << pOldItem); break; } } - if ( !bFound ) - { - SFX_TRACE( "item not found: ", pOldItem ); - } + SAL_INFO_IF_S( + !bFound, "svl", "item not found: " << pOldItem); } } } diff --git a/svl/source/items/whassert.hxx b/svl/source/items/whassert.hxx index 379d4794458d..d994f0d33f66 100644 --- a/svl/source/items/whassert.hxx +++ b/svl/source/items/whassert.hxx @@ -28,29 +28,12 @@ #ifndef _SFX_WHASSERT_HXX #define _SFX_WHASSERT_HXX -#include -#include +#include "sal/config.h" -//------------------------------------------------------------------------ - -#ifdef DBG_UTIL -#define SFX_ASSERT( bCondition, nId, sMessage ) \ -{ \ - if ( DbgIsAssert() ) \ - { \ - if ( !(bCondition) ) \ - { \ - rtl::OStringBuffer aMsg(sMessage); \ - aMsg.append(RTL_CONSTASCII_STRINGPARAM("\nwith Id/Pos: ")); \ - aMsg.append(static_cast(nId)); \ - DbgError(aMsg.getStr(), __FILE__, __LINE__); \ - } \ - } \ -} -#else -#define SFX_ASSERT( bCondition, nId, sMessage ) -#endif +#include "sal/log.h" +#define SFX_ASSERT( bCondition, nId, sMessage ) SAL_WARN_IF_S( \ + !(bCondition), "svl", (sMessage) << ", with ID/pos " << (nId)); #endif -- cgit