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

Ioan Radu (via Code Review) gerrit at gerrit.libreoffice.org
Mon Feb 4 14:22:05 PST 2013


Hi,

I have submitted a patch for review:

    https://gerrit.libreoffice.org/1986

To pull it, you can do:

    git pull ssh://gerrit.libreoffice.org:29418/core refs/changes/86/1986/1

fdo#43157 - Clean up OSL_ASSERT, DBG_ASSERT

- changed osl_trace with sal_info

Change-Id: I6504abf50f6193db52d101ec856bcaf1ee2a982c
---
M canvas/source/null/null_usagecounter.hxx
M oox/source/ppt/timenode.cxx
M sd/source/ui/framework/configuration/ConfigurationTracer.cxx
3 files changed, 36 insertions(+), 41 deletions(-)



diff --git a/canvas/source/null/null_usagecounter.hxx b/canvas/source/null/null_usagecounter.hxx
index 5a3260e..482f220 100644
--- a/canvas/source/null/null_usagecounter.hxx
+++ b/canvas/source/null/null_usagecounter.hxx
@@ -22,6 +22,7 @@
 
 #include <osl/interlck.h>
 #include <boost/current_function.hpp>
+#include "sal/log.hxx"
 
 namespace nullcanvas
 {
@@ -36,9 +37,7 @@
     public:
         UsageCounter()
         {
-            OSL_TRACE( "%s, %d objects currently in use.\n",
-                       BOOST_CURRENT_FUNCTION,
-                       osl_atomic_increment( &s_nCount ) );
+            SAL_INFO("canvas.null","" << BOOST_CURRENT_FUNCTION << ", " << osl_atomic_increment( &s_nCount ) << " objects currently in use.\n");
         }
 
         ~UsageCounter()
@@ -47,14 +46,11 @@
 
             if( !nCount )
             {
-                OSL_TRACE( "%s, last instance deleted.\n",
-                           BOOST_CURRENT_FUNCTION );
+                SAL_INFO("canvas.null", "" << BOOST_CURRENT_FUNCTION << ", last instance deleted.\n");
             }
             else
             {
-                OSL_TRACE( "%s, %d instances left.\n",
-                           BOOST_CURRENT_FUNCTION,
-                           nCount );
+                SAL_INFO("canvas.null", "" << BOOST_CURRENT_FUNCTION << ", " << nCount << " instances left.\n");
             }
         }
 
diff --git a/oox/source/ppt/timenode.cxx b/oox/source/ppt/timenode.cxx
index eb0f55b..638bd1d 100644
--- a/oox/source/ppt/timenode.cxx
+++ b/oox/source/ppt/timenode.cxx
@@ -40,6 +40,7 @@
 
 #include "oox/helper/helper.hxx"
 #include "oox/core/xmlfilterbase.hxx"
+#include  "sal/log.hxx"
 
 using namespace ::oox::core;
 using namespace ::com::sun::star::beans;
@@ -88,7 +89,7 @@
                 sServiceName = "com.sun.star.animations.Audio";
                 break;
             default:
-                OSL_TRACE( "OOX: uhandled type %x", nNodeType );
+                SAL_INFO("oox.ppt","OOX: uhandled type " << nNodeType );
                 break;
             }
             return sServiceName;
@@ -170,7 +171,7 @@
         catch( Exception& e )
         {
             (void)e;
-            OSL_TRACE("fixMainSequenceTiming(), exception caught!" );
+            SAL_INFO("oox.ppt","fixMainSequenceTiming(), exception caught!" );
         }
     }
 
@@ -196,7 +197,7 @@
         catch( Exception& e )
         {
             (void)e;
-            OSL_TRACE("fixInteractiveSequenceTiming(), exception caught!" );
+            SAL_INFO("oox.ppt","fixInteractiveSequenceTiming(), exception caught!" );
         }
     }
 
@@ -211,14 +212,14 @@
         }
         catch( const Exception& e )
         {
-            OSL_TRACE( "OOX: exception raised in TimeNode::addNode() - %s",
+            SAL_INFO("oox.ppt","OOX: exception raised in TimeNode::addNode() - " <<
                                  OUStringToOString( e.Message, RTL_TEXTENCODING_ASCII_US ).getStr() );
         }
     }
 
     void TimeNode::setNode( const XmlFilterBase& rFilter, const Reference< XAnimationNode >& xNode, const SlidePersistPtr & pSlide )
     {
-        OSL_ENSURE( xNode.is(), "null node passed" );
+        SAL_WARN_IF( xNode.is() == NULL, "oox.ppt", "null node passed" );
 
         try {
             if( !msId.isEmpty() )
@@ -331,7 +332,7 @@
                                 xAnimate->setSubItem( nInt16 );
                             else
                             {
-                                OSL_TRACE( "any >>= failed %d", __LINE__ );
+                                SAL_INFO("oox.ppt","any >>= failed " << __LINE__ );
                             }
                         }
                         break;
@@ -342,7 +343,7 @@
                                 xAnimate->setAttributeName( sString );
                             else
                             {
-                                OSL_TRACE( "any >>= failed %d", __LINE__ );
+                                SAL_INFO("oox.ppt","any >>= failed " << __LINE__ );
                             }
                         }
                         break;
@@ -353,7 +354,7 @@
                                 xAnimate->setCalcMode( nInt16 );
                             else
                             {
-                                OSL_TRACE( "any >>= failed %d", __LINE__ );
+                                SAL_INFO("oox.ppt","any >>= failed " << __LINE__ );
                             }
                         }
                         break;
@@ -365,7 +366,7 @@
                                 xAnimate->setKeyTimes(aKeyTimes);
                             else
                             {
-                                OSL_TRACE( "any >>= failed %d", __LINE__ );
+                                SAL_INFO("oox.ppt","any >>= failed " << __LINE__ );
                             }
                         }
                         break;
@@ -377,7 +378,7 @@
                                 xAnimate->setValues(aValues);
                             else
                             {
-                                OSL_TRACE( "any >>= failed %d", __LINE__ );
+                                SAL_INFO("oox.ppt","any >>= failed " << __LINE__ );
                             }
                         }
                         break;
@@ -388,7 +389,7 @@
                                 xAnimate->setFormula(sString);
                             else
                             {
-                                OSL_TRACE( "any >>= failed %d", __LINE__ );
+                                SAL_INFO("oox.ppt","any >>= failed " << __LINE__ );
                             }
                         }
                         break;
@@ -399,7 +400,7 @@
                                 xAnimateColor->setColorInterpolation( nInt16 );
                             else
                             {
-                                OSL_TRACE( "any >>= failed %d", __LINE__ );
+                                SAL_INFO("oox.ppt","any >>= failed " << __LINE__ );
                             }
                         }
                         break;
@@ -410,7 +411,7 @@
                                 xAnimateColor->setDirection( bBool );
                             else
                             {
-                                OSL_TRACE( "any >>= failed %d", __LINE__ );
+                                SAL_INFO("oox.ppt","any >>= failed " << __LINE__ );
                             }
                         }
                         break;
@@ -425,7 +426,7 @@
                                 xAnimateTransform->setTransformType( nInt16 );
                             else
                             {
-                                OSL_TRACE( "any >>= failed %d", __LINE__ );
+                                SAL_INFO("oox.ppt","any >>= failed " << __LINE__ );
                             }
                         }
                         break;
@@ -434,7 +435,7 @@
                             xNode->setUserData( aSeq );
                         else
                         {
-                            OSL_TRACE( "any >>= failed %d", __LINE__ );
+                            SAL_INFO("oox.ppt","any >>= failed " << __LINE__ );
                         }
                         break;
                     case NP_ACCELERATION:
@@ -442,7 +443,7 @@
                             xNode->setAcceleration( fDouble );
                         else
                         {
-                            OSL_TRACE( "any >>= failed %d", __LINE__ );
+                            SAL_INFO("oox.ppt","any >>= failed " << __LINE__ );
                         }
                         break;
                     case NP_DECELERATE:
@@ -450,7 +451,7 @@
                             xNode->setDecelerate( fDouble );
                         else
                         {
-                            OSL_TRACE( "any >>= failed %d", __LINE__ );
+                            SAL_INFO("oox.ppt","any >>= failed " << __LINE__ );
                         }
                         break;
                     case NP_AUTOREVERSE:
@@ -458,7 +459,7 @@
                             xNode->setAutoReverse( bBool );
                         else
                         {
-                            OSL_TRACE( "any >>= failed %d", __LINE__ );
+                            SAL_INFO("oox.ppt","any >>= failed " << __LINE__ );
                         }
                         break;
                     case NP_DURATION:
@@ -469,7 +470,7 @@
                             xNode->setFill( nInt16 );
                         else
                         {
-                            OSL_TRACE( "any >>= failed %d", __LINE__ );
+                            SAL_INFO("oox.ppt","any >>= failed " << __LINE__ );
                         }
                         break;
                     case NP_REPEATCOUNT:
@@ -483,7 +484,7 @@
                             xNode->setRestart( nInt16 );
                         else
                         {
-                            OSL_TRACE( "any >>= failed %d", __LINE__ );
+                            SAL_INFO("oox.ppt","any >>= failed " << __LINE__ );
                         }
                         break;
                     case NP_COMMAND:
@@ -493,7 +494,7 @@
                                 xCommand->setCommand( nInt16 );
                             else
                             {
-                                OSL_TRACE( "any >>= failed %d", __LINE__ );
+                                SAL_INFO("oox.ppt","any >>= failed " << __LINE__ );
                             }
                         }
                         break;
@@ -508,7 +509,7 @@
                                 xIterateContainer->setIterateType( nInt16 );
                             else
                             {
-                                OSL_TRACE( "any >>= failed %d", __LINE__ );
+                                SAL_INFO("oox.ppt","any >>= failed " << __LINE__ );
                             }
                         }
                         break;
@@ -519,12 +520,12 @@
                                 xIterateContainer->setIterateInterval( fDouble );
                             else
                             {
-                                OSL_TRACE( "any >>= failed %d", __LINE__ );
+                                SAL_INFO("oox.ppt","any >>= failed " << __LINE__ );
                             }
                         }
                         break;
                     default:
-                        OSL_TRACE( "ERR-OOX: unknown prop index %d", i );
+                        SAL_INFO("oox.ppt","ERR-OOX: unknown prop index " << i );
                         break;
                     }
                 }
@@ -566,8 +567,7 @@
         }
         catch( const Exception& e )
         {
-            OSL_TRACE( "OOX: exception raised in TimeNode::setNode() - %s",
-                                 OUStringToOString( e.Message, RTL_TEXTENCODING_ASCII_US ).getStr() );
+            SAL_INFO("oox.ppt","OOX: exception raised in TimeNode::setNode() - " << OUStringToOString( e.Message, RTL_TEXTENCODING_ASCII_US ).getStr() );
         }
     }
 
@@ -586,9 +586,7 @@
         }
         catch( const Exception& e )
         {
-            OSL_TRACE( "OOX: exception raised in TimeNode::createAndInsert() trying to create a service %s = %s",
-                                 OUStringToOString( rServiceName, RTL_TEXTENCODING_ASCII_US ).getStr(),
-                                 OUStringToOString( e.Message, RTL_TEXTENCODING_ASCII_US ).getStr() );
+            SAL_INFO("oox.ppt","OOX: exception raised in TimeNode::createAndInsert() trying to create a service " <<  OUStringToOString( rServiceName, RTL_TEXTENCODING_ASCII_US).getStr() << " = " << OUStringToOString( e.Message, RTL_TEXTENCODING_ASCII_US ).getStr() );
         }
 
         return Reference< XAnimationNode >();
diff --git a/sd/source/ui/framework/configuration/ConfigurationTracer.cxx b/sd/source/ui/framework/configuration/ConfigurationTracer.cxx
index b591c80..74839b9 100644
--- a/sd/source/ui/framework/configuration/ConfigurationTracer.cxx
+++ b/sd/source/ui/framework/configuration/ConfigurationTracer.cxx
@@ -21,6 +21,7 @@
 #include "ConfigurationTracer.hxx"
 
 #include <cstdio>
+#include "sal/log.hxx"
 
 using namespace ::com::sun::star::uno;
 using namespace ::com::sun::star::drawing::framework;
@@ -32,16 +33,16 @@
     const char* pMessage)
 {
 #ifdef DEBUG
-    OSL_TRACE("%s at %p {", pMessage, rxConfiguration.get());
+    SAL_INFO("sd.ui","" << pMessage << " at " << rxConfiguration.get() << " {");
     if (rxConfiguration.is())
     {
         TraceBoundResources(rxConfiguration, NULL, 0);
     }
     else
     {
-        OSL_TRACE("    empty");
+        SAL_INFO("sd.ui","    empty");
     }
-    OSL_TRACE("}");
+    SAL_INFO("sd.ui","}");
 #else
     (void)rxConfiguration;
     (void)pMessage;
@@ -65,7 +66,7 @@
         ::rtl::OUString sLine (aResourceList[nIndex]->getResourceURL());
         for (int i=0; i<nIndentation; ++i)
             sLine = sIndentation + sLine;
-        OSL_TRACE("%s", OUStringToOString(sLine, RTL_TEXTENCODING_UTF8).getStr());
+        SAL_INFO("sd.ui","" << OUStringToOString(sLine, RTL_TEXTENCODING_UTF8).getStr());
         TraceBoundResources(rxConfiguration, aResourceList[nIndex], nIndentation+1);
     }
 }

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I6504abf50f6193db52d101ec856bcaf1ee2a982c
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