kbrown / rpms / libreoffice

Forked from rpms/libreoffice 2 years ago
Clone

Blame SOURCES/0039-Adapt-to-sal-log.hxx.patch

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