[PATCH] fdo#43157 - Clean up OSL_ASSERT, DBG_ASSERT

Ioan Radu (via Code Review) gerrit at gerrit.libreoffice.org
Tue Feb 5 14:13:19 PST 2013


Hi,

I have submitted a patch for review:

    https://gerrit.libreoffice.org/2010

To pull it, you can do:

    git pull ssh://gerrit.libreoffice.org:29418/core refs/changes/10/2010/1

fdo#43157 - Clean up OSL_ASSERT, DBG_ASSERT

 - replaced osl_trace with sal_info
 - added new log areas to log-area.dox

Change-Id: Ib47c4b4c9604bca1f8a635dd01bb89702b47b591
---
M sal/inc/sal/log-areas.dox
M sal/osl/all/loadmodulerelative.cxx
M sdext/source/pdfimport/pdfiadaptor.cxx
M stoc/source/corereflection/lrucache.hxx
M stoc/source/tdmanager/lrucache.hxx
M tools/source/memtools/mempool.cxx
M xmlsecurity/source/helper/xsecverify.cxx
7 files changed, 63 insertions(+), 55 deletions(-)



diff --git a/sal/inc/sal/log-areas.dox b/sal/inc/sal/log-areas.dox
index 7f3f4a4..60dab99 100644
--- a/sal/inc/sal/log-areas.dox
+++ b/sal/inc/sal/log-areas.dox
@@ -33,6 +33,7 @@
 
 @li @c canvas
 @li @c canvas.cairo
+ at li @c canvas.null
 
 @section connectivity
 
@@ -65,6 +66,7 @@
 @li @c sd.fwk
 @li @c sd.sls
 @li @c sd.tools
+ at li @c sd.ui
 @li @c sd.view
 @li @c sd.slideshow
 @li @c sdremote
@@ -155,6 +157,7 @@
 @section tools
 
 @li @c tools.debug
+ at li @c tools.memtools
 @li @c tools.rc - resource manager
 @li @c tools.stream - SvStream class
 
@@ -173,6 +176,10 @@
 @li @c rtl.string - ::rtl::OString, ::rtl::OUString, and related functionality
 @li @c salhelper.thread - ::salhelper::Thread class
 
+ at section stoc
+
+ at li @c stoc.corerefl
+ at li @c stoc.tdmanager
 
 @section VCL
 
@@ -210,6 +217,7 @@
 @section xmlsecurity
 
 @li @c xmlsecurity.dialogs - xml security dialogs
+ at li @c xmlsecurity.helper
 @li @c xmlsecurity.xmlsec - xmlsec wrapper
 
 @section other
diff --git a/sal/osl/all/loadmodulerelative.cxx b/sal/osl/all/loadmodulerelative.cxx
index 0a91169..3ad8f86 100644
--- a/sal/osl/all/loadmodulerelative.cxx
+++ b/sal/osl/all/loadmodulerelative.cxx
@@ -22,7 +22,7 @@
 
 #include <cstddef>
 
-#include "osl/diagnose.h"
+#include "sal/log.hxx"
 #include "osl/module.h"
 #include "osl/module.hxx"
 #include "osl/thread.h"
@@ -42,7 +42,7 @@
 {
     ::rtl::OUString base;
     if (!::osl::Module::getUrlFromAddress(baseModule, base)) {
-        OSL_TRACE("osl::Module::getUrlFromAddress failed");
+        SAL_INFO("sal.osl","osl::Module::getUrlFromAddress failed");
         return NULL;
     }
     ::rtl::OUString abs;
@@ -50,10 +50,8 @@
         abs = ::rtl::Uri::convertRelToAbs(base, relativePath);
     } catch (const ::rtl::MalformedUriException & e) {
         (void) e; // avoid warnings
-        OSL_TRACE(
-            "rtl::MalformedUriException <%s>",
-            rtl::OUStringToOString(e.getMessage(), osl_getThreadTextEncoding()).
-                getStr());
+        SAL_INFO("sal.osl",
+            "rtl::MalformedUriException <" << rtl::OUStringToOString(e.getMessage(), osl_getThreadTextEncoding()).getStr() << ">");
             //TODO: let some OSL_TRACE variant take care of text conversion?
         return NULL;
     }
diff --git a/sdext/source/pdfimport/pdfiadaptor.cxx b/sdext/source/pdfimport/pdfiadaptor.cxx
index ac222f8..f9157b1 100644
--- a/sdext/source/pdfimport/pdfiadaptor.cxx
+++ b/sdext/source/pdfimport/pdfiadaptor.cxx
@@ -28,7 +28,8 @@
 
 #include <osl/file.h>
 #include <osl/thread.h>
-#include <osl/diagnose.h>
+#include "sal/log.hxx"
+
 #include <cppuhelper/factory.hxx>
 #include <cppuhelper/implementationentry.hxx>
 #include <com/sun/star/lang/XMultiComponentFactory.hpp>
@@ -70,9 +71,7 @@
             #if OSL_DEBUG_LEVEL > 1
             rtl::OUString aVal( RTL_CONSTASCII_USTRINGPARAM( "<no string>" ) );
             pAttribs[i].Value >>= aVal;
-            OSL_TRACE( "filter: Attrib: %s = %s\n",
-                       rtl::OUStringToOString( pAttribs[i].Name, RTL_TEXTENCODING_UTF8 ).getStr(),
-                       rtl::OUStringToOString( aVal, RTL_TEXTENCODING_UTF8 ).getStr() );
+            SAL_INFO("sdext.pdfimport", "filter: Attrib: " << rtl::OUStringToOString( pAttribs[i].Name, RTL_TEXTENCODING_UTF8 ).getStr() << " = " << rtl::OUStringToOString( aVal, RTL_TEXTENCODING_UTF8 ).getStr() << "\n");
             #endif
             if ( pAttribs[i].Name == "EmbeddedSubstream" )
                 pAttribs[i].Value >>= xSubStream;
@@ -105,7 +104,7 @@
                 rtl::OUString aURL;
                 if( osl_createTempFile( NULL, &aFile, &aURL.pData ) == osl_File_E_None )
                 {
-                    OSL_TRACE( "created temp file %s", rtl::OUStringToOString( aURL, RTL_TEXTENCODING_UTF8 ).getStr() );
+                    SAL_INFO("sdext.pdfimport", "created temp file " << rtl::OUStringToOString( aURL, RTL_TEXTENCODING_UTF8 ).getStr() );
                     const sal_Int32 nBufSize = 4096;
                     uno::Sequence<sal_Int8> aBuf(nBufSize);
                     // copy the bytes
@@ -144,7 +143,7 @@
             aArgs[0] <<= m_xModel;
             aArgs[1] <<= xSubStream;
 
-            OSL_TRACE( "try to instantiate subfilter" );
+            SAL_INFO("sdext.pdfimport", "try to instantiate subfilter" );
             uno::Reference< document::XFilter > xSubFilter;
             try {
                 xSubFilter = uno::Reference<document::XFilter>(
@@ -157,11 +156,11 @@
             catch(const uno::Exception& e)
             {
                 (void)e;
-                OSL_TRACE( "subfilter exception: %s\n",
-                           OUStringToOString( e.Message, RTL_TEXTENCODING_UTF8 ).getStr() );
+                SAL_INFO("sdext.pdfimport", "subfilter exception: " <<
+                           OUStringToOString( e.Message, RTL_TEXTENCODING_UTF8 ).getStr() << "\n");
             }
 
-            OSL_TRACE( "subfilter: %p", xSubFilter.get() );
+            SAL_INFO("sdext.pdfimport", "subfilter: " << xSubFilter.get() );
             if( xSubFilter.is() )
             {
                 if( bAddPwdProp )
@@ -183,12 +182,12 @@
         }
         #if OSL_DEBUG_LEVEL > 1
         else
-            OSL_TRACE( "PDFIAdaptor::filter: no embedded substream set" );
+            SAL_INFO("sdext.pdfimport", "PDFIAdaptor::filter: no embedded substream set" );
         #endif
     }
     #if OSL_DEBUG_LEVEL > 1
     else
-        OSL_TRACE( "PDFIAdaptor::filter: no model set" );
+        SAL_INFO("sdext.pdfimport", "PDFIAdaptor::filter: no model set" );
     #endif
 
     return bRet;
@@ -201,7 +200,7 @@
 //XImporter
 void SAL_CALL PDFIHybridAdaptor::setTargetDocument( const uno::Reference< lang::XComponent >& xDocument ) throw( lang::IllegalArgumentException )
 {
-    OSL_TRACE( "PDFIAdaptor::setTargetDocument" );
+    SAL_INFO("sdext.pdfimport", "PDFIAdaptor::setTargetDocument" );
     m_xModel = uno::Reference< frame::XModel >( xDocument, uno::UNO_QUERY );
     if( xDocument.is() && ! m_xModel.is() )
         throw lang::IllegalArgumentException();
@@ -282,7 +281,7 @@
     sal_Int32 nAttribs = rSourceData.getLength();
     for( sal_Int32 i = 0; i < nAttribs; i++, pAttribs++ )
     {
-        OSL_TRACE("importer Attrib: %s", OUStringToOString( pAttribs->Name, RTL_TEXTENCODING_UTF8 ).getStr() );
+        SAL_INFO("sdext.pdfimport","importer Attrib: " << OUStringToOString( pAttribs->Name, RTL_TEXTENCODING_UTF8 ).getStr() );
         if ( pAttribs->Name == "InputStream" )
             pAttribs->Value >>= xInput;
         else if ( pAttribs->Name == "URL" )
@@ -310,7 +309,7 @@
 //XImporter
 void SAL_CALL PDFIRawAdaptor::setTargetDocument( const uno::Reference< lang::XComponent >& xDocument ) throw( lang::IllegalArgumentException )
 {
-    OSL_TRACE( "PDFIAdaptor::setTargetDocument" );
+    SAL_INFO("sdext.pdfimport", "PDFIAdaptor::setTargetDocument" );
     m_xModel = uno::Reference< frame::XModel >( xDocument, uno::UNO_QUERY );
     if( xDocument.is() && ! m_xModel.is() )
         throw lang::IllegalArgumentException();
diff --git a/stoc/source/corereflection/lrucache.hxx b/stoc/source/corereflection/lrucache.hxx
index dbd2573..08096d5 100644
--- a/stoc/source/corereflection/lrucache.hxx
+++ b/stoc/source/corereflection/lrucache.hxx
@@ -24,6 +24,7 @@
 
 #include <osl/mutex.hxx>
 #include "rtl/ustring.hxx"
+#include "sal/log.hxx"
 
 #include <boost/unordered_map.hpp>
 
@@ -156,9 +157,9 @@
         CacheEntry * pEntry = (*iFind).second;
         toFront( pEntry );
 #ifdef __CACHE_DIAGNOSE
-        OSL_TRACE( "> retrieved element \"" );
-        OSL_TRACE( "%s", ::rtl::OUStringToOString( pEntry->aKey, RTL_TEXTENCODING_ASCII_US ).getStr() );
-        OSL_TRACE( "\" from cache <" );
+        SAL_INFO("stoc.corerefl", "> retrieved element \"" );
+        SAL_INFO("stoc.corerefl", "" << ::rtl::OUStringToOString( pEntry->aKey, RTL_TEXTENCODING_ASCII_US ).getStr() );
+        SAL_INFO("stoc.corerefl", "\" from cache <" );
 #endif
         return pEntry->aVal;
     }
@@ -181,9 +182,9 @@
 #ifdef __CACHE_DIAGNOSE
             if (pEntry->aKey.getLength())
             {
-                OSL_TRACE( "> kicking element \"" );
-                OSL_TRACE( "%s", ::rtl::OUStringToOString( pEntry->aKey, RTL_TEXTENCODING_ASCII_US ).getStr() );
-                OSL_TRACE( "\" from cache <" );
+                SAL_INFO("stoc.corerefl", "> kicking element \"" );
+                SAL_INFO("stoc.corerefl", "" << ::rtl::OUStringToOString( pEntry->aKey, RTL_TEXTENCODING_ASCII_US ).getStr() );
+                SAL_INFO("stoc.corerefl", "\" from cache <" );
             }
 #endif
             _aKey2Element.erase( pEntry->aKey );
@@ -193,9 +194,9 @@
         {
             pEntry = (*iFind).second;
 #ifdef __CACHE_DIAGNOSE
-            OSL_TRACE( "> replacing element \"" );
-            OSL_TRACE( "%s", ::rtl::OUStringToOString( pEntry->aKey, RTL_TEXTENCODING_ASCII_US ).getStr() );
-            OSL_TRACE( "\" in cache <" );
+            SAL_INFO("stoc.corerefl", "> replacing element \"" );
+            SAL_INFO("stoc.corerefl", "" << ::rtl::OUStringToOString( pEntry->aKey, RTL_TEXTENCODING_ASCII_US ).getStr() );
+            SAL_INFO("stoc.corerefl", "\" in cache <" );
 #endif
         }
         pEntry->aVal = rValue;
@@ -215,7 +216,7 @@
     }
     _nCachedElements = 0;
 #ifdef __CACHE_DIAGNOSE
-    OSL_TRACE( "> cleared cache <" );
+    SAL_INFO("stoc.corerefl", "> cleared cache <" );
 #endif
 }
 
diff --git a/stoc/source/tdmanager/lrucache.hxx b/stoc/source/tdmanager/lrucache.hxx
index 4a9cdf6..5cb97e1 100644
--- a/stoc/source/tdmanager/lrucache.hxx
+++ b/stoc/source/tdmanager/lrucache.hxx
@@ -24,6 +24,7 @@
 
 #include <osl/mutex.hxx>
 #include "rtl/ustring.hxx"
+#include "sal/log.hxx"
 
 #include <boost/unordered_map.hpp>
 
@@ -160,9 +161,9 @@
         CacheEntry * pEntry = (*iFind).second;
         toFront( pEntry );
 #ifdef __CACHE_DIAGNOSE
-        OSL_TRACE( "> retrieved element \"" );
-        OSL_TRACE( "%s", ::rtl::OUStringToOString( pEntry->aKey, RTL_TEXTENCODING_ASCII_US ).getStr() );
-        OSL_TRACE( "\" from cache <" );
+        SAL_INFO("stoc.tdmanager", "> retrieved element \"" );
+        SAL_INFO("stoc.tdmanager", "" << ::rtl::OUStringToOString( pEntry->aKey, RTL_TEXTENCODING_ASCII_US ).getStr() );
+        SAL_INFO("stoc.tdmanager", "\" from cache <" );
 #endif
         return pEntry->aVal;
     }
@@ -185,9 +186,9 @@
 #ifdef __CACHE_DIAGNOSE
             if (pEntry->aKey.getLength())
             {
-                OSL_TRACE( "> kicking element \"" );
-                OSL_TRACE( "%s", ::rtl::OUStringToOString( pEntry->aKey, RTL_TEXTENCODING_ASCII_US ).getStr() );
-                OSL_TRACE( "\" from cache <" );
+                SAL_INFO("stoc.tdmanager", "> kicking element \"" );
+                SAL_INFO("stoc.tdmanager", "" << ::rtl::OUStringToOString( pEntry->aKey, RTL_TEXTENCODING_ASCII_US ).getStr() );
+                SAL_INFO("stoc.tdmanager", "\" from cache <" );
             }
 #endif
             _aKey2Element.erase( pEntry->aKey );
@@ -197,9 +198,9 @@
         {
             pEntry = (*iFind).second;
 #ifdef __CACHE_DIAGNOSE
-            OSL_TRACE( "> replacing element \"" );
-            OSL_TRACE( "%s", ::rtl::OUStringToOString( pEntry->aKey, RTL_TEXTENCODING_ASCII_US ).getStr() );
-            OSL_TRACE( "\" in cache <" );
+            SAL_INFO("stoc.tdmanager", "> replacing element \"" );
+            SAL_INFO("stoc.tdmanager", "" << ::rtl::OUStringToOString( pEntry->aKey, RTL_TEXTENCODING_ASCII_US ).getStr() );
+            SAL_INFO("stoc.tdmanager", "\" in cache <" );
 #endif
         }
         pEntry->aVal = rValue;
@@ -218,7 +219,7 @@
         _pBlock[nPos].aVal = t_Val();
     }
 #ifdef __CACHE_DIAGNOSE
-    OSL_TRACE( "> cleared cache <" );
+    SAL_INFO("stoc.tdmanager", "> cleared cache <" );
 #endif
 }
 
diff --git a/tools/source/memtools/mempool.cxx b/tools/source/memtools/mempool.cxx
index 4fee6a5..fe79b47 100644
--- a/tools/source/memtools/mempool.cxx
+++ b/tools/source/memtools/mempool.cxx
@@ -18,7 +18,7 @@
  */
 
 #include "tools/mempool.hxx"
-#include "osl/diagnose.h"
+#include "sal/log.hxx"
 #include "rtl/alloc.h"
 
 #include <stdio.h>
@@ -29,12 +29,12 @@
     char name[RTL_CACHE_NAME_LENGTH + 1];
     snprintf (name, sizeof(name), "FixedMemPool_%d", (int)nTypeSize);
     m_pImpl = (FixedMemPool_Impl*)rtl_cache_create (name, nTypeSize, 0, NULL, NULL, NULL, 0, NULL, 0);
-    OSL_TRACE("FixedMemPool::ctor(\"%s\"): %p", m_pTypeName, m_pImpl);
+    SAL_INFO("tools.memtools","FixedMemPool::ctor(\"" << m_pTypeName << "\"): " << m_pImpl);
 }
 
 FixedMemPool::~FixedMemPool()
 {
-    OSL_TRACE("FixedMemPool::dtor(\"%s\"): %p", m_pTypeName, m_pImpl);
+    SAL_INFO("tools.memtools","FixedMemPool::dtor(\"" << m_pTypeName << "\"): " << m_pImpl);
     rtl_cache_destroy ((rtl_cache_type*)(m_pImpl)), m_pImpl = 0;
 }
 
diff --git a/xmlsecurity/source/helper/xsecverify.cxx b/xmlsecurity/source/helper/xsecverify.cxx
index 35e1b6c..1b06ec8 100644
--- a/xmlsecurity/source/helper/xsecverify.cxx
+++ b/xmlsecurity/source/helper/xsecverify.cxx
@@ -28,6 +28,7 @@
 #include <com/sun/star/xml/crypto/sax/XReferenceCollector.hpp>
 #include <com/sun/star/xml/crypto/sax/XSignatureVerifyResultBroadcaster.hpp>
 #include <com/sun/star/xml/sax/SAXParseException.hpp>
+#include <sal/log.hxx>
 
 namespace cssu = com::sun::star::uno;
 namespace cssl = com::sun::star::lang;
@@ -114,7 +115,7 @@
 {
     if (m_vInternalSignatureInformations.empty())
     {
-        OSL_TRACE("XSecController::addReference: no signature");
+        SAL_INFO("xmlsecurity.helper","XSecController::addReference: no signature");
         return;
     }
     InternalSignatureInformation &isi = m_vInternalSignatureInformations.back();
@@ -129,7 +130,7 @@
 
     if (m_vInternalSignatureInformations.empty())
     {
-        OSL_TRACE("XSecController::addStreamReference: no signature");
+        SAL_INFO("xmlsecurity.helper","XSecController::addStreamReference: no signature");
         return;
     }
     InternalSignatureInformation &isi = m_vInternalSignatureInformations.back();
@@ -157,7 +158,7 @@
 {
     if (m_vInternalSignatureInformations.empty())
     {
-        OSL_TRACE("XSecController::setReferenceCount: no signature");
+        SAL_INFO("xmlsecurity.helper","XSecController::setReferenceCount: no signature");
         return;
     }
     const InternalSignatureInformation &isi =
@@ -191,7 +192,7 @@
 {
     if (m_vInternalSignatureInformations.empty())
     {
-        OSL_TRACE("XSecController::setX509IssuerName: no signature");
+        SAL_INFO("xmlsecurity.helper","XSecController::setX509IssuerName: no signature");
         return;
     }
     InternalSignatureInformation &isi = m_vInternalSignatureInformations.back();
@@ -202,7 +203,7 @@
 {
     if (m_vInternalSignatureInformations.empty())
     {
-        OSL_TRACE("XSecController::setX509SerialNumber: no signature");
+        SAL_INFO("xmlsecurity.helper","XSecController::setX509SerialNumber: no signature");
         return;
     }
     InternalSignatureInformation &isi = m_vInternalSignatureInformations.back();
@@ -213,7 +214,7 @@
 {
     if (m_vInternalSignatureInformations.empty())
     {
-        OSL_TRACE("XSecController::setX509Certificate: no signature");
+        SAL_INFO("xmlsecurity.helper","XSecController::setX509Certificate: no signature");
         return;
     }
     InternalSignatureInformation &isi = m_vInternalSignatureInformations.back();
@@ -224,7 +225,7 @@
 {
     if (m_vInternalSignatureInformations.empty())
     {
-        OSL_TRACE("XSecController::setSignatureValue: no signature");
+        SAL_INFO("xmlsecurity.helper","XSecController::setSignatureValue: no signature");
         return;
     }
     InternalSignatureInformation &isi = m_vInternalSignatureInformations.back();
@@ -235,13 +236,13 @@
 {
     if (m_vInternalSignatureInformations.empty())
     {
-        OSL_TRACE("XSecController::setDigestValue: no signature");
+        SAL_INFO("xmlsecurity.helper","XSecController::setDigestValue: no signature");
         return;
     }
     InternalSignatureInformation &isi = m_vInternalSignatureInformations.back();
     if (isi.signatureInfor.vSignatureReferenceInfors.empty())
     {
-        OSL_TRACE("XSecController::setDigestValue: no signature reference");
+        SAL_INFO("xmlsecurity.helper","XSecController::setDigestValue: no signature reference");
         return;
     }
     SignatureReferenceInformation &reference =
@@ -253,7 +254,7 @@
 {
     if (m_vInternalSignatureInformations.empty())
     {
-        OSL_TRACE("XSecController::setDate: no signature");
+        SAL_INFO("xmlsecurity.helper","XSecController::setDate: no signature");
         return;
     }
     InternalSignatureInformation &isi = m_vInternalSignatureInformations.back();
@@ -265,7 +266,7 @@
 {
     if (m_vInternalSignatureInformations.empty())
     {
-        OSL_TRACE("XSecController::setId: no signature");
+        SAL_INFO("xmlsecurity.helper","XSecController::setId: no signature");
         return;
     }
     InternalSignatureInformation &isi = m_vInternalSignatureInformations.back();
@@ -276,7 +277,7 @@
 {
     if (m_vInternalSignatureInformations.empty())
     {
-        OSL_TRACE("XSecController::setPropertyId: no signature");
+        SAL_INFO("xmlsecurity.helper","XSecController::setPropertyId: no signature");
         return;
     }
     InternalSignatureInformation &isi = m_vInternalSignatureInformations.back();

-- 
To view, visit https://gerrit.libreoffice.org/2010
To unsubscribe, visit https://gerrit.libreoffice.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ib47c4b4c9604bca1f8a635dd01bb89702b47b591
Gerrit-PatchSet: 1
Gerrit-Project: core
Gerrit-Branch: master
Gerrit-Owner: Ioan Radu <ioan.radu.g at gmail.com>


More information about the LibreOffice mailing list