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

Ioan Radu (via Code Review) gerrit at gerrit.libreoffice.org
Tue Apr 2 14:05:53 PDT 2013


Hi,

I have submitted a patch for review:

    https://gerrit.libreoffice.org/3179

To pull it, you can do:

    git pull ssh://gerrit.libreoffice.org:29418/core refs/changes/79/3179/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: I20f539bd9fa62bef2e9a2a82b59e0b15f4efdd48
---
M sal/inc/sal/log-areas.dox
M vbahelper/source/msforms/service.cxx
M vbahelper/source/msforms/vbacombobox.cxx
M vbahelper/source/msforms/vbatogglebutton.cxx
M vbahelper/source/msforms/vbauserform.cxx
M vbahelper/source/vbahelper/vbacommandbar.cxx
M vbahelper/source/vbahelper/vbacommandbarcontrol.cxx
M vbahelper/source/vbahelper/vbacommandbarhelper.cxx
M vbahelper/source/vbahelper/vbadocumentbase.cxx
M vbahelper/source/vbahelper/vbaeventshelperbase.cxx
M vbahelper/source/vbahelper/vbahelper.cxx
M vbahelper/source/vbahelper/vbashape.cxx
12 files changed, 25 insertions(+), 26 deletions(-)



diff --git a/sal/inc/sal/log-areas.dox b/sal/inc/sal/log-areas.dox
index c36c742..b14cb46 100644
--- a/sal/inc/sal/log-areas.dox
+++ b/sal/inc/sal/log-areas.dox
@@ -334,6 +334,7 @@
 @li @c ucbhelper
 @li @c unoidl
 @li @c uui
+ at li @c vbahelper
 @li @c xmlhelp
 @li @c xmloff
 @li @c xmlreader
diff --git a/vbahelper/source/msforms/service.cxx b/vbahelper/source/msforms/service.cxx
index 9bc7953..7361bd9 100644
--- a/vbahelper/source/msforms/service.cxx
+++ b/vbahelper/source/msforms/service.cxx
@@ -46,10 +46,10 @@
         const sal_Char * pImplName, lang::XMultiServiceFactory * pServiceManager,
         registry::XRegistryKey * pRegistryKey )
     {
-        OSL_TRACE("In component_getFactory for %s", pImplName );
+        SAL_INFO("vbahelper","In component_getFactory for " << pImplName );
     void* pRet =  component_getFactoryHelper(
             pImplName, pServiceManager, pRegistryKey, controlprovider::serviceDecl, userform::serviceDecl );
-    OSL_TRACE("Ret is 0x%x", pRet);
+    SAL_INFO("vbahelper","Ret is 0x" <<std::hex << pRet);
     return pRet;
     }
 }
diff --git a/vbahelper/source/msforms/vbacombobox.cxx b/vbahelper/source/msforms/vbacombobox.cxx
index b78dea3..7ac5644 100644
--- a/vbahelper/source/msforms/vbacombobox.cxx
+++ b/vbahelper/source/msforms/vbacombobox.cxx
@@ -104,13 +104,13 @@
         {
             if ( sItems[ index ].equals( sText ) )
             {
-                OSL_TRACE("getListIndex returning %d", index );
+                SAL_INFO("vbahelper","getListIndex returning " << index );
                 return uno::makeAny( index );
             }
 
         }
      }
-    OSL_TRACE("getListIndex returning %d", -1 );
+    SAL_INFO("vbahelper","getListIndex returning " << -1 );
     return uno::makeAny( sal_Int32( -1 ) );
 }
 
diff --git a/vbahelper/source/msforms/vbatogglebutton.cxx b/vbahelper/source/msforms/vbatogglebutton.cxx
index 6bf65c1..93cc947 100644
--- a/vbahelper/source/msforms/vbatogglebutton.cxx
+++ b/vbahelper/source/msforms/vbatogglebutton.cxx
@@ -29,13 +29,13 @@
 const static OUString STATE( "State" );
 ScVbaToggleButton::ScVbaToggleButton( const css::uno::Reference< ov::XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< uno::XInterface >& xControl, const uno::Reference< frame::XModel >& xModel, ov::AbstractGeometryAttributes* pGeomHelper ) : ToggleButtonImpl_BASE( xParent, xContext, xControl, xModel, pGeomHelper )
 {
-    OSL_TRACE("ScVbaToggleButton(ctor)");
+    SAL_INFO("vbahelper","ScVbaToggleButton(ctor)");
     m_xProps->setPropertyValue( TOGGLE, uno::makeAny( sal_True ) );
 }
 
 ScVbaToggleButton::~ScVbaToggleButton()
 {
-    OSL_TRACE("~ScVbaToggleButton(dtor)");
+    SAL_INFO("vbahelper","~ScVbaToggleButton(dtor)");
 }
 
 // Attributes
@@ -67,9 +67,9 @@
 {
     sal_Int16 nState = 0;
     _value >>= nState;
-    OSL_TRACE( "nState - %d", nState );
+    SAL_INFO("vbahelper", "nState - " << nState );
     nState = ( nState == -1 ) ?  1 : 0;
-    OSL_TRACE( "nState - %d", nState );
+    SAL_INFO("vbahelper", "nState - " << nState );
     m_xProps->setPropertyValue( STATE, uno::makeAny(  nState ) );
 }
 
diff --git a/vbahelper/source/msforms/vbauserform.cxx b/vbahelper/source/msforms/vbauserform.cxx
index 988e837..32aa2ed 100644
--- a/vbahelper/source/msforms/vbauserform.cxx
+++ b/vbahelper/source/msforms/vbauserform.cxx
@@ -59,7 +59,7 @@
 void SAL_CALL
 ScVbaUserForm::Show(  ) throw (uno::RuntimeException)
 {
-    OSL_TRACE("ScVbaUserForm::Show(  )");
+    SAL_INFO("vbahelper","ScVbaUserForm::Show(  )");
     short aRet = 0;
     mbDispose = true;
 
@@ -83,7 +83,7 @@
 
         aRet = m_xDialog->execute();
     }
-    OSL_TRACE("ScVbaUserForm::Show() execute returned %d", aRet);
+    SAL_INFO("vbahelper","ScVbaUserForm::Show() execute returned " << aRet);
     if ( mbDispose )
     {
         try
@@ -276,7 +276,7 @@
 {
     uno::Reference< awt::XControl > xControl( m_xDialog, uno::UNO_QUERY );
 
-    OSL_TRACE("ScVbaUserForm::hasProperty(%s) %d", OUStringToOString( aName, RTL_TEXTENCODING_UTF8 ).getStr(), xControl.is() );
+    SAL_INFO("vbahelper","ScVbaUserForm::hasProperty(" << aName << ") " << xControl.is() );
     if ( xControl.is() )
     {
         uno::Reference< beans::XPropertySet > xDlgProps( xControl->getModel(), uno::UNO_QUERY );
@@ -284,7 +284,7 @@
         {
             uno::Reference< container::XNameContainer > xAllChildren( xDlgProps->getPropertyValue( "AllDialogChildren" ), uno::UNO_QUERY_THROW );
             sal_Bool bRes =  xAllChildren->hasByName( aName );
-            OSL_TRACE("ScVbaUserForm::hasProperty(%s) %d ---> %d", OUStringToOString( aName, RTL_TEXTENCODING_UTF8 ).getStr(), xAllChildren.is(), bRes );
+            SAL_INFO("vbahelper","ScVbaUserForm::hasProperty(" << aName << ") " << xAllChildren.is() << " ---> " << bRes );
             return bRes;
         }
     }
diff --git a/vbahelper/source/vbahelper/vbacommandbar.cxx b/vbahelper/source/vbahelper/vbacommandbar.cxx
index 9c13872..a9a85cc 100644
--- a/vbahelper/source/vbahelper/vbacommandbar.cxx
+++ b/vbahelper/source/vbahelper/vbacommandbar.cxx
@@ -115,7 +115,7 @@
     }
     catch(const uno::Exception&)
     {
-        OSL_TRACE( "SetVisible get an exception" );
+        SAL_INFO("vbahelper", "SetVisible get an exception" );
     }
 }
 
diff --git a/vbahelper/source/vbahelper/vbacommandbarcontrol.cxx b/vbahelper/source/vbahelper/vbacommandbarcontrol.cxx
index 4be6c82..d8d94cf 100644
--- a/vbahelper/source/vbahelper/vbacommandbarcontrol.cxx
+++ b/vbahelper/source/vbahelper/vbacommandbarcontrol.cxx
@@ -69,7 +69,7 @@
     if ( aResolvedMacro.mbFound )
     {
         OUString aCommandURL = ooo::vba::makeMacroURL( aResolvedMacro.msResolvedMacro );
-        OSL_TRACE(" ScVbaCommandBarControl::setOnAction: %s", OUStringToOString( aCommandURL, RTL_TEXTENCODING_UTF8 ).getStr() );
+        SAL_INFO("vbahelper"," ScVbaCommandBarControl::setOnAction: " << aCommandURL);
         setPropertyValue( m_aPropertyValues, "CommandURL" , uno::makeAny( aCommandURL ) );
         ApplyChange();
     }
diff --git a/vbahelper/source/vbahelper/vbacommandbarhelper.cxx b/vbahelper/source/vbahelper/vbacommandbarhelper.cxx
index 5bfd4d2..d311f83 100644
--- a/vbahelper/source/vbahelper/vbacommandbarhelper.cxx
+++ b/vbahelper/source/vbahelper/vbacommandbarhelper.cxx
@@ -247,7 +247,7 @@
             aBuffer.append( sLabel.copy( index + 1 ) );
         }
         OUString sNewLabel = aBuffer.makeStringAndClear();
-        OSL_TRACE("VbaCommandBarHelper::findControlByName, control name: %s", OUStringToOString( sNewLabel, RTL_TEXTENCODING_UTF8 ).getStr() );
+        SAL_INFO("vbahelper","VbaCommandBarHelper::findControlByName, control name: " << sNewLabel);
         if( sName.equalsIgnoreAsciiCase( sNewLabel ) )
             return i;
     }
diff --git a/vbahelper/source/vbahelper/vbadocumentbase.cxx b/vbahelper/source/vbahelper/vbadocumentbase.cxx
index 27ddd5e..14d3295 100644
--- a/vbahelper/source/vbahelper/vbadocumentbase.cxx
+++ b/vbahelper/source/vbahelper/vbadocumentbase.cxx
@@ -188,7 +188,7 @@
 {
     OUString rPassword;
     uno::Reference< util::XProtectable > xProt( getModel(), uno::UNO_QUERY_THROW );
-    OSL_TRACE("Workbook::Protect stub");
+    SAL_INFO("vbahelper","Workbook::Protect stub");
     if(  aPassword >>= rPassword )
         xProt->protect( rPassword );
     else
diff --git a/vbahelper/source/vbahelper/vbaeventshelperbase.cxx b/vbahelper/source/vbahelper/vbaeventshelperbase.cxx
index 7938b70..f369a3a 100644
--- a/vbahelper/source/vbahelper/vbaeventshelperbase.cxx
+++ b/vbahelper/source/vbahelper/vbaeventshelperbase.cxx
@@ -48,7 +48,7 @@
 
 VbaEventsHelperBase::~VbaEventsHelperBase()
 {
-    OSL_ENSURE( mbDisposed, "VbaEventsHelperBase::~VbaEventsHelperBase - missing disposing notification" );
+    SAL_WARN_IF( !mbDisposed,"vbahelper","VbaEventsHelperBase::~VbaEventsHelperBase - missing disposing notification" );
 }
 
 sal_Bool SAL_CALL VbaEventsHelperBase::hasVbaEventHandler( sal_Int32 nEventId, const uno::Sequence< uno::Any >& rArgs )
@@ -93,7 +93,7 @@
         const EventHandlerInfo& rInfo = getEventHandlerInfo( aEventQueue.front().mnEventId );
         uno::Sequence< uno::Any > aEventArgs = aEventQueue.front().maArgs;
         aEventQueue.pop_front();
-        OSL_TRACE( "VbaEventsHelperBase::processVbaEvent( \"%s\" )", OUStringToOString( rInfo.maMacroName, RTL_TEXTENCODING_UTF8 ).getStr() );
+        SAL_INFO("vbahelper", "VbaEventsHelperBase::processVbaEvent( \"" << rInfo.maMacroName << "\" )");
 
         /*  Let derived classes prepare the event, they may add new events for
             next iteration. If false is returned, the event handler must not be
@@ -140,7 +140,7 @@
 
 void SAL_CALL VbaEventsHelperBase::notifyEvent( const document::EventObject& rEvent ) throw (uno::RuntimeException)
 {
-    OSL_TRACE( "VbaEventsHelperBase::notifyEvent( \"%s\" )", OUStringToOString( rEvent.EventName, RTL_TEXTENCODING_UTF8 ).getStr() );
+    SAL_INFO("vbahelper", "VbaEventsHelperBase::notifyEvent( \"" << rEvent.EventName << "\" )");
     if( rEvent.EventName == GlobalEventConfig::GetEventName( STR_EVENT_CLOSEDOC ) )
         stopListening();
 }
diff --git a/vbahelper/source/vbahelper/vbahelper.cxx b/vbahelper/source/vbahelper/vbahelper.cxx
index 8712428..81a676b 100644
--- a/vbahelper/source/vbahelper/vbahelper.cxx
+++ b/vbahelper/source/vbahelper/vbahelper.cxx
@@ -193,7 +193,7 @@
     SbxObject* basicChosen =  pBasic ;
     if ( basicChosen == NULL)
     {
-        OSL_TRACE("getModelFromBasic() StarBASIC* is NULL" );
+        SAL_INFO("vbahelper","getModelFromBasic() StarBASIC* is NULL" );
         return xModel;
     }
     SbxObject* p = pBasic;
@@ -224,14 +224,12 @@
         }
         else
         {
-            OSL_TRACE("Have model points to url %s",
-                OUStringToOString( xModel->getURL(),
-                RTL_TEXTENCODING_ASCII_US ).pData->buffer );
+            SAL_INFO("vbahelper","Have model points to url " << OUStringToOString( xModel->getURL(),RTL_TEXTENCODING_ASCII_US ).pData->buffer );
         }
     }
     else
     {
-        OSL_TRACE("Failed to get %s", OUStringToOString( sKey, RTL_TEXTENCODING_UTF8 ).getStr() );
+        SAL_INFO("vbahelper","Failed to get " << sKey);
         throw uno::RuntimeException(
             "Can't determine the currently selected document" ,
             uno::Reference< uno::XInterface >() );
@@ -740,7 +738,7 @@
         const uno::Reference< awt::XWindow >       xWindow    ( xFrame->getContainerWindow(),    uno::UNO_SET_THROW   );
 
         Window* pWindow = VCLUnoHelper::GetWindow( xWindow );
-        OSL_ENSURE( pWindow, "ScVbaApplication::setCursor: no window!" );
+        SAL_WARN_IF( !pWindow,"vbahelper","ScVbaApplication::setCursor: no window!" );
         if ( !pWindow )
             continue;
 
diff --git a/vbahelper/source/vbahelper/vbashape.cxx b/vbahelper/source/vbahelper/vbashape.cxx
index 98a697d..adeafac 100644
--- a/vbahelper/source/vbahelper/vbashape.cxx
+++ b/vbahelper/source/vbahelper/vbashape.cxx
@@ -116,7 +116,7 @@
     OUString sShapeType;
     uno::Reference< drawing::XShapeDescriptor > xShapeDescriptor( xShape, uno::UNO_QUERY_THROW );
     sShapeType = xShapeDescriptor->getShapeType();
-    OSL_TRACE("ScVbaShape::getType: %s", OUStringToOString( sShapeType, RTL_TEXTENCODING_UTF8 ).getStr() );
+    SAL_INFO("vbahelper","ScVbaShape::getType: " << sShapeType);
     // office::MsoShapeType::msoDiagram to "com.sun.star.drawing.GroupShape"
     if( sShapeType == "com.sun.star.drawing.GroupShape" )
         return office::MsoShapeType::msoGroup;

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

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