From e5285e0186a1e45e3c12f6775f8ef24bccb9a871 Mon Sep 17 00:00:00 2001
From: Stephan Bergmann <sbergman@redhat.com>
Date: Tue, 25 Mar 2014 12:18:05 +0100
Subject: [PATCH 039/137] Adapt to sal/log.hxx
(cherry picked from commit 3c5d30c03b4b2d2c4d38d602afc839e7a922bca3)
Signed-off-by: Michael Stahl <mstahl@redhat.com>
Note: this avoids an abort() in smoketest due to leaking
SvxUnoTextRangeBase
Change-Id: I9c59495977e111d94077470f07591c91fa3c1665
---
sal/osl/all/debugbase.cxx | 30 +++++++-----------------------
1 file changed, 7 insertions(+), 23 deletions(-)
diff --git a/sal/osl/all/debugbase.cxx b/sal/osl/all/debugbase.cxx
index 57238ce..75cd846 100644
--- a/sal/osl/all/debugbase.cxx
+++ b/sal/osl/all/debugbase.cxx
@@ -23,18 +23,10 @@
#include "rtl/ustring.hxx"
#include "osl/process.h"
#include "osl/diagnose.hxx"
+#include "sal/log.hxx"
#include "boost/bind.hpp"
#include <vector>
-// define own ones, independent of OSL_DEBUG_LEVEL:
-#define DEBUGBASE_ENSURE_(c, f, l, m) \
- do \
- { \
- if (!(c) && _OSL_GLOBAL osl_assertFailedLine(f, l, m)) \
- _OSL_GLOBAL osl_breakDebug(); \
- } while (false)
-#define DEBUGBASE_ENSURE(c, m) DEBUGBASE_ENSURE_(c, OSL_THIS_FILE, __LINE__, m)
-
namespace {
typedef std::vector<rtl::OString, rtl::Allocator<rtl::OString> > OStringVec;
@@ -118,16 +110,10 @@ bool SAL_CALL osl_detail_ObjectRegistry_checkObjectCount(
nSize = static_cast<std::size_t>(rData.m_nCount);
bool const bRet = (nSize == nExpected);
- if (! bRet) {
- rtl::OStringBuffer buf;
- buf.append( "unexpected number of " );
- buf.append( rData.m_pName );
- buf.append( ": " );
- buf.append( static_cast<sal_Int64>(nSize) );
- buf.append("; Expected: ");
- buf.append( static_cast<sal_Int64>(nExpected) );
- DEBUGBASE_ENSURE( false, buf.makeStringAndClear().getStr() );
- }
+ SAL_WARN_IF(
+ !bRet, "sal.osl",
+ "unexpected number of " << rData.m_pName << ": " << nSize
+ << "; Expected: " << nExpected);
return bRet;
}
@@ -139,8 +125,7 @@ void SAL_CALL osl_detail_ObjectRegistry_registerObject(
osl::MutexGuard const guard( osl_detail_ObjectRegistry_getMutex() );
std::pair<osl::detail::VoidPointerSet::iterator, bool> const insertion(
rData.m_addresses.insert(pObj) );
- DEBUGBASE_ENSURE( insertion.second, "### insertion failed!?" );
- static_cast<void>(insertion);
+ SAL_WARN_IF(!insertion.second, "sal.osl", "insertion failed!?");
}
else {
osl_atomic_increment(&rData.m_nCount);
@@ -154,8 +139,7 @@ void SAL_CALL osl_detail_ObjectRegistry_revokeObject(
if (rData.m_bStoreAddresses) {
osl::MutexGuard const guard( osl_detail_ObjectRegistry_getMutex() );
std::size_t const n = rData.m_addresses.erase(pObj);
- DEBUGBASE_ENSURE( n == 1, "erased more than 1 entry!?" );
- static_cast<void>(n);
+ SAL_WARN_IF(n != 1, "sal.osl", "erased more than 1 entry!?");
}
else {
osl_atomic_decrement(&rData.m_nCount);
--
1.9.3