sal/osl/all/debugbase.cxx            |   30 +++++++-----------------------
 sal/qa/osl/file/osl_File.cxx         |    4 ++--
 sal/qa/osl/module/osl_Module.cxx     |    8 ++++----
 sal/qa/osl/mutex/osl_Mutex.cxx       |    2 +-
 sal/qa/osl/process/osl_Thread.cxx    |    2 +-
 sal/qa/osl/security/osl_Security.cxx |    2 +-
 sal/rtl/alloc_global.cxx             |    6 +++---
 sal/rtl/hash.cxx                     |    4 ++--
 sal/rtl/uri.cxx                      |    2 +-
 9 files changed, 22 insertions(+), 38 deletions(-)

New commits:
commit e5285e0186a1e45e3c12f6775f8ef24bccb9a871
Author: Stephan Bergmann <sberg...@redhat.com>
Date:   Tue Mar 25 12:18:05 2014 +0100

    Adapt to sal/log.hxx
    
    (cherry picked from commit 3c5d30c03b4b2d2c4d38d602afc839e7a922bca3)
    Signed-off-by: Michael Stahl <mst...@redhat.com>
    
    Note: this avoids an abort() in smoketest due to leaking
    SvxUnoTextRangeBase
    
    Change-Id: I9c59495977e111d94077470f07591c91fa3c1665

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);
commit eb758877fb799111673b909e73065cb6d966881a
Author: Stephan Bergmann <sberg...@redhat.com>
Date:   Tue Jan 28 20:00:40 2014 +0100

    bool improvements
    
    Change-Id: I7ae2b02e435d21390843c6c56877a8ce3a73f9f2
    (cherry picked from commit bd4053f895167978978023309925c85c3826b31a)
    Signed-off-by: Michael Stahl <mst...@redhat.com>

diff --git a/sal/osl/all/debugbase.cxx b/sal/osl/all/debugbase.cxx
index 8bc0c46..57238ce 100644
--- a/sal/osl/all/debugbase.cxx
+++ b/sal/osl/all/debugbase.cxx
@@ -32,7 +32,7 @@
     {  \
         if (!(c) && _OSL_GLOBAL osl_assertFailedLine(f, l, m)) \
             _OSL_GLOBAL osl_breakDebug(); \
-    } while (0)
+    } while (false)
 #define DEBUGBASE_ENSURE(c, m) DEBUGBASE_ENSURE_(c, OSL_THIS_FILE, __LINE__, m)
 
 namespace {
diff --git a/sal/qa/osl/file/osl_File.cxx b/sal/qa/osl/file/osl_File.cxx
index 43f255c..54055fe 100644
--- a/sal/qa/osl/file/osl_File.cxx
+++ b/sal/qa/osl/file/osl_File.cxx
@@ -2587,7 +2587,7 @@ namespace osl_FileStatus
                 ::osl::FileBase::RC nError1 = testDirectory.open();
             ::rtl::OUString aFileName ("link.file");
             sal_Bool bOk = sal_False;
-            while (1) {
+            while (true) {
                 nError1 = testDirectory.getNextItem( rItem_link, 4 );
                 if (::osl::FileBase::E_None == nError1) {
                     sal_uInt32 mask_link = osl_FileStatus_Mask_FileName | 
osl_FileStatus_Mask_LinkTargetURL;
@@ -5639,7 +5639,7 @@ namespace osl_Directory
             CPPUNIT_ASSERT( ::osl::FileBase::E_None == nError1 );
             ::rtl::OUString aFileName ("link.file");
 
-            while (1) {
+            while (true) {
                 nError1 = testDirectory.getNextItem( rItem, 4 );
                 if (::osl::FileBase::E_None == nError1) {
                     ::osl::FileStatus   rFileStatus( 
osl_FileStatus_Mask_FileName | osl_FileStatus_Mask_Type );
diff --git a/sal/qa/osl/module/osl_Module.cxx b/sal/qa/osl/module/osl_Module.cxx
index d6358d4..ee547fb 100644
--- a/sal/qa/osl/module/osl_Module.cxx
+++ b/sal/qa/osl/module/osl_Module.cxx
@@ -189,7 +189,7 @@ namespace osl_Module
 
             if ( !( bRes ) )
             {
-                CPPUNIT_ASSERT_MESSAGE("Cannot locate current module.",  
sal_False  );
+                CPPUNIT_ASSERT_MESSAGE("Cannot locate current module.", false 
);
             }
 
             ::osl::Module aMod( aFileURL );
@@ -221,7 +221,7 @@ namespace osl_Module
             bRes = osl::Module::getUrlFromAddress( ( void* ) 
&::osl_Module::testClass::myFunc, aFileURL ) ;
             if ( !( bRes ) )
             {
-                CPPUNIT_ASSERT_MESSAGE("Cannot locate current module.",  
sal_False  );
+                CPPUNIT_ASSERT_MESSAGE("Cannot locate current module.", false 
);
             }
 
             CPPUNIT_ASSERT_MESSAGE( "#test comment#: test get Module URL from 
address.",
@@ -239,7 +239,7 @@ namespace osl_Module
             bRes = osl::Module::getUrlFromAddress( ( void* )pFunc, aFileURL );
             if ( !( bRes  ) )
             {
-                CPPUNIT_ASSERT_MESSAGE("Cannot locate current module.",  
sal_False  );
+                CPPUNIT_ASSERT_MESSAGE("Cannot locate current module.", false 
);
             }
             aMod.unload( );
 
@@ -325,7 +325,7 @@ namespace osl_Module
             bRes = osl::Module::getUrlFromAddress( ( void* ) 
&::osl_Module::testClass::myFunc, aFileURL );
             if ( !( bRes  ) )
             {
-                CPPUNIT_ASSERT_MESSAGE("Cannot locate current module - using 
executable instead",  sal_False  );
+                CPPUNIT_ASSERT_MESSAGE("Cannot locate current module - using 
executable instead", false );
             }
 
             ::osl::Module aMod;
diff --git a/sal/qa/osl/mutex/osl_Mutex.cxx b/sal/qa/osl/mutex/osl_Mutex.cxx
index 0e9ce85..3f86f9c 100644
--- a/sal/qa/osl/mutex/osl_Mutex.cxx
+++ b/sal/qa/osl/mutex/osl_Mutex.cxx
@@ -732,7 +732,7 @@ namespace osl_ClearableGuard
             // wait 1 second to assure the child thread has begun
             ThreadHelper::thread_sleep(1);
 
-            while (1)
+            while (true)
             {
                 if (aMutex.tryToAcquire() == sal_True)
                 {
diff --git a/sal/qa/osl/process/osl_Thread.cxx 
b/sal/qa/osl/process/osl_Thread.cxx
index 3e394aa..aeab4e9 100644
--- a/sal/qa/osl/process/osl_Thread.cxx
+++ b/sal/qa/osl/process/osl_Thread.cxx
@@ -626,7 +626,7 @@ namespace osl_Thread
     void suspendCountThread(OCountThread* _pCountThread)
     {
         sal_Int32 nValue = 0;
-        while (1)
+        while (true)
         {
             nValue = _pCountThread->getValue();
             if (nValue >= 3)
diff --git a/sal/qa/osl/security/osl_Security.cxx 
b/sal/qa/osl/security/osl_Security.cxx
index e9ad1a7..3ad78b0 100644
--- a/sal/qa/osl/security/osl_Security.cxx
+++ b/sal/qa/osl/security/osl_Security.cxx
@@ -280,7 +280,7 @@ namespace osl_Security
             {
                 ::osl::Security aSec;
                 osl_unloadUserProfile(aSec.getHandle());
-                CPPUNIT_ASSERT_MESSAGE( "empty function.", sal_True );
+                CPPUNIT_ASSERT_MESSAGE( "empty function.", true );
             }
 
         CPPUNIT_TEST_SUITE( UserProfile );
diff --git a/sal/rtl/alloc_global.cxx b/sal/rtl/alloc_global.cxx
index 8194b13..07cded3 100644
--- a/sal/rtl/alloc_global.cxx
+++ b/sal/rtl/alloc_global.cxx
@@ -291,7 +291,7 @@ void* SAL_CALL rtl_allocateMemory (sal_Size n) 
SAL_THROW_EXTERN_C()
         n >= SAL_MAX_INT32, "sal.rtl",
         "suspicious massive alloc " << n);
 #if !defined(FORCE_SYSALLOC)
-    while (1)
+    while (true)
     {
         if (alloc_mode == AMode_CUSTOM)
         {
@@ -314,7 +314,7 @@ void* SAL_CALL rtl_reallocateMemory (void * p, sal_Size n) 
SAL_THROW_EXTERN_C()
         n >= SAL_MAX_INT32, "sal.rtl",
         "suspicious massive alloc " << n);
 #if !defined(FORCE_SYSALLOC)
-    while (1)
+    while (true)
     {
         if (alloc_mode == AMode_CUSTOM)
         {
@@ -334,7 +334,7 @@ void* SAL_CALL rtl_reallocateMemory (void * p, sal_Size n) 
SAL_THROW_EXTERN_C()
 void SAL_CALL rtl_freeMemory (void * p) SAL_THROW_EXTERN_C()
 {
 #if !defined(FORCE_SYSALLOC)
-    while (1)
+    while (true)
     {
         if (alloc_mode == AMode_CUSTOM)
         {
diff --git a/sal/rtl/hash.cxx b/sal/rtl/hash.cxx
index 823e56a..47e8681 100644
--- a/sal/rtl/hash.cxx
+++ b/sal/rtl/hash.cxx
@@ -139,9 +139,9 @@ static int
 compareEqual (rtl_uString *pStringA, rtl_uString *pStringB)
 {
     if (pStringA == pStringB)
-        return 1;
+        return true;
     if (pStringA->length != pStringB->length)
-        return 0;
+        return false;
     return !rtl_ustr_compare_WithLength( pStringA->buffer, pStringA->length,
                                          pStringB->buffer, pStringB->length);
 }
diff --git a/sal/rtl/uri.cxx b/sal/rtl/uri.cxx
index 7e4402f..513fb51 100644
--- a/sal/rtl/uri.cxx
+++ b/sal/rtl/uri.cxx
@@ -142,7 +142,7 @@ sal_uInt32 readUcs4(sal_Unicode const ** pBegin, 
sal_Unicode const * pEnd,
                         || nWeight1 > 11
                         || (nWeight2 = getHexWeight(p[2])) < 0)
                     {
-                        bUTF8 = sal_False;
+                        bUTF8 = false;
                         break;
                     }
                     p += 3;
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to