[PATCH] Removal of VERBOSE define

Rob Snelders programming at ertai.nl
Mon Apr 2 13:54:08 PDT 2012


---
 sd/source/ui/slidesorter/cache/SlsBitmapCache.cxx  |   21 ++-------
 .../ui/slidesorter/cache/SlsCacheCompactor.cxx     |   14 +-----
 sd/source/ui/view/ToolBarManager.cxx               |   46 +++++---------------
 sd/source/ui/view/ViewShellManager.cxx             |   44 ++++++++-----------
 4 files changed, 35 insertions(+), 90 deletions(-)

diff --git a/sd/source/ui/slidesorter/cache/SlsBitmapCache.cxx b/sd/source/ui/slidesorter/cache/SlsBitmapCache.cxx
index f369079..d556c5c 100644
--- a/sd/source/ui/slidesorter/cache/SlsBitmapCache.cxx
+++ b/sd/source/ui/slidesorter/cache/SlsBitmapCache.cxx
@@ -35,11 +35,6 @@
 #include "sdpage.hxx"
 #include "drawdoc.hxx"
 
-// Uncomment the following define for some more OSL_TRACE messages.
-#ifdef DEBUG
-//#define VERBOSE
-#endif
-
 // Define the default value for the maximal cache size that is used for
 // previews that are currently not visible.  The visible previews are all
 // held in memory at all times.  This default is used only when the
@@ -421,9 +416,7 @@ void BitmapCache::ReCalculateTotalCacheSize (void)
     }
     mbIsFull = (mnNormalCacheSize  >= mnMaximalNormalCacheSize);
 
-#ifdef VERBOSE
-    OSL_TRACE("cache size is %d/%d", mnNormalCacheSize, mnPreciousCacheSize);
-#endif
+    SAL_INFO("sd.sls", OSL_THIS_FUNC << ": cache size is " << mnNormalCacheSize << "/" << mnPreciousCacheSize);
 }
 
 
@@ -527,9 +520,7 @@ void BitmapCache::UpdateCacheSize (const CacheEntry& rEntry, CacheOperation eOpe
             if ( ! rEntry.IsPrecious() && mnNormalCacheSize>mnMaximalNormalCacheSize)
             {
                 mbIsFull = true;
-#ifdef VERBOSE
-                OSL_TRACE("cache size is %d > %d", mnNormalCacheSize,mnMaximalNormalCacheSize);
-#endif
+                SAL_INFO("sd.sls", OSL_THIS_FUNC << ": cache size is " << mnNormalCacheSize << " > " << mnMaximalNormalCacheSize);
                 mpCacheCompactor->RequestCompaction();
             }
             break;
@@ -618,17 +609,13 @@ void BitmapCache::CacheEntry::Compress (const ::boost::shared_ptr<BitmapCompress
         {
             mpReplacement = rpCompressor->Compress(maPreview);
 
-#ifdef VERBOSE
+#if OSL_DEBUG_LEVEL > 2
             sal_uInt32 nOldSize (maPreview.GetSizeBytes());
             sal_uInt32 nNewSize (mpReplacement.get()!=NULL ? mpReplacement->GetMemorySize() : 0);
             if (nOldSize == 0)
                 nOldSize = 1;
             sal_Int32 nRatio (100L * nNewSize / nOldSize);
-            OSL_TRACE("compressing bitmap for %x from %d to %d bytes (%d%%)",
-                this,
-                nOldSize,
-                nNewSize,
-                nRatio);
+            SAL_INFO("sd.sls", OSL_THIS_FUNC << ": compressing bitmap for " << %x << " from " << nOldSize << " to " << nNewSize << " bytes (" << nRatio << "%)");
 #endif
 
             mpCompressor = rpCompressor;
diff --git a/sd/source/ui/slidesorter/cache/SlsCacheCompactor.cxx b/sd/source/ui/slidesorter/cache/SlsCacheCompactor.cxx
index 3f8b2b4..3a59eca 100644
--- a/sd/source/ui/slidesorter/cache/SlsCacheCompactor.cxx
+++ b/sd/source/ui/slidesorter/cache/SlsCacheCompactor.cxx
@@ -39,11 +39,6 @@
 
 using namespace ::com::sun::star::uno;
 
-// Uncomment the definition of VERBOSE to get some more OSL_TRACE messages.
-#ifdef DEBUG
-//#define VERBOSE
-#endif
-
 namespace {
 
 /** This is a trivial implementation of the CacheCompactor interface class.
@@ -211,10 +206,7 @@ void CacheCompactionByCompression::Run (void)
 {
     if (mrCache.GetSize() > mnMaximalCacheSize)
     {
-#ifdef VERBOSE
-        OSL_TRACE ("bitmap cache uses to much space: %d > %d",
-            mrCache.GetSize(), mnMaximalCacheSize);
-#endif
+        SAL_INFO("sd.sls", OSL_THIS_FUNC << ": bitmap cache uses to much space: " << mrCache.GetSize() << " > " << mnMaximalCacheSize);
 
         SAL_WNODEPRECATED_DECLARATIONS_PUSH
         ::std::auto_ptr< ::sd::slidesorter::cache::BitmapCache::CacheIndex> pIndex (
@@ -231,9 +223,7 @@ void CacheCompactionByCompression::Run (void)
                 break;
         }
         mrCache.ReCalculateTotalCacheSize();
-#ifdef VERBOSE
-        OSL_TRACE ("    there are now %d bytes occupied", mrCache.GetSize());
-#endif
+        SAL_INFO("sd.sls", OSL_THIS_FUNC << ":    there are now " << mrCache.GetSize() << " bytes occupied");
     }
 }
 
diff --git a/sd/source/ui/view/ToolBarManager.cxx b/sd/source/ui/view/ToolBarManager.cxx
index 5980f73..d3aff93 100644
--- a/sd/source/ui/view/ToolBarManager.cxx
+++ b/sd/source/ui/view/ToolBarManager.cxx
@@ -58,8 +58,6 @@
 using namespace ::com::sun::star;
 using namespace ::com::sun::star::uno;
 
-#undef VERBOSE
-
 #undef OUSTRING // Remove definition made in the SFX
 #define OUSTRING(s) (::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(s)))
 
@@ -710,9 +708,7 @@ void ToolBarManager::Implementation::ResetToolBars (ToolBarGroup eGroup)
 
 void ToolBarManager::Implementation::ResetAllToolBars (void)
 {
-#ifdef VERBOSE
-    OSL_TRACE("resetting all tool bars");
-#endif
+    SAL_INFO("sd.view", OSL_THIS_FUNC << ": resetting all tool bars");
     for (int i=TBG__FIRST; i<=TBG__LAST; ++i)
         ResetToolBars((ToolBarGroup)i);
 }
@@ -802,9 +798,7 @@ void ToolBarManager::Implementation::PreUpdate (void)
     {
         mbPreUpdatePending = false;
 
-#ifdef VERBOSE
-        OSL_TRACE("ToolBarManager::PreUpdate [");
-#endif
+        SAL_INFO("sd.view", OSL_THIS_FUNC << ": ToolBarManager::PreUpdate [");
 
         // Get the list of tool bars that are not used anymore and are to be
         // deactivated.
@@ -816,17 +810,13 @@ void ToolBarManager::Implementation::PreUpdate (void)
         for (iToolBar=aToolBars.begin(); iToolBar!=aToolBars.end(); ++iToolBar)
         {
             ::rtl::OUString sFullName (GetToolBarResourceName(*iToolBar));
-#ifdef VERBOSE
-            OSL_TRACE("    turning off tool bar %s",
+            SAL_INFO("sd.view", OSL_THIS_FUNC << ":    turning off tool bar " <<
                 ::rtl::OUStringToOString(sFullName, RTL_TEXTENCODING_UTF8).getStr());
-#endif
             mxLayouter->destroyElement(sFullName);
             maToolBarList.MarkToolBarAsNotActive(*iToolBar);
         }
 
-#ifdef VERBOSE
-        OSL_TRACE("ToolBarManager::PreUpdate ]");
-#endif
+        SAL_INFO("sd.view", OSL_THIS_FUNC << ": ToolBarManager::PreUpdate ]");
     }
 }
 
@@ -847,26 +837,20 @@ void ToolBarManager::Implementation::PostUpdate (void)
         NameList aToolBars;
         maToolBarList.GetToolBarsToActivate(aToolBars);
 
-#ifdef VERBOSE
-        OSL_TRACE("ToolBarManager::PostUpdate [");
-#endif
+        SAL_INFO("sd.view", OSL_THIS_FUNC << ": ToolBarManager::PostUpdate [");
 
         // Turn on the tool bars that are visible in the new context.
         NameList::const_iterator iToolBar;
         for (iToolBar=aToolBars.begin(); iToolBar!=aToolBars.end(); ++iToolBar)
         {
             ::rtl::OUString sFullName (GetToolBarResourceName(*iToolBar));
-#ifdef VERBOSE
-            OSL_TRACE("    turning on tool bar %s",
+            SAL_INFO("sd.view", OSL_THIS_FUNC << ":    turning on tool bar " <<
                 ::rtl::OUStringToOString(sFullName, RTL_TEXTENCODING_UTF8).getStr());
-#endif
             mxLayouter->requestElement(sFullName);
             maToolBarList.MarkToolBarAsActive(*iToolBar);
         }
 
-#ifdef VERBOSE
-        OSL_TRACE("ToolBarManager::PostUpdate ]");
-#endif
+        SAL_INFO("sd.view", OSL_THIS_FUNC << ": ToolBarManager::PostUpdate ]");
     }
 }
 
@@ -885,9 +869,7 @@ void ToolBarManager::Implementation::LockViewShellManager (void)
 
 void ToolBarManager::Implementation::LockUpdate (void)
 {
-#ifdef VERBOSE
-    OSL_TRACE("LockUpdate %d", mnLockCount);
-#endif
+    SAL_INFO("sd.view", OSL_THIS_FUNC << ": LockUpdate " << mnLockCount);
     ::osl::MutexGuard aGuard(maMutex);
 
     DBG_ASSERT(mnLockCount<100, "ToolBarManager lock count unusually high");
@@ -905,9 +887,7 @@ void ToolBarManager::Implementation::LockUpdate (void)
 
 void ToolBarManager::Implementation::UnlockUpdate (void)
 {
-#ifdef VERBOSE
-    OSL_TRACE("UnlockUpdate %d", mnLockCount);
-#endif
+    SAL_INFO("sd.view", OSL_THIS_FUNC << ": UnlockUpdate " << mnLockCount);
     ::osl::MutexGuard aGuard(maMutex);
 
     OSL_ASSERT(mnLockCount>0);
@@ -1122,9 +1102,7 @@ using namespace ::sd;
 LayouterLock::LayouterLock (const Reference<frame::XLayoutManager>& rxLayouter)
     : mxLayouter(rxLayouter)
 {
-#ifdef VERBOSE
-    OSL_TRACE("LayouterLock %d", mxLayouter.is() ? 1 :0);
-#endif
+    SAL_INFO("sd.view", OSL_THIS_FUNC << ": LayouterLock " << (mxLayouter.is() ? 1 :0));
     if (mxLayouter.is())
         mxLayouter->lock();
 }
@@ -1134,9 +1112,7 @@ LayouterLock::LayouterLock (const Reference<frame::XLayoutManager>& rxLayouter)
 
 LayouterLock::~LayouterLock (void)
 {
-#ifdef VERBOSE
-    OSL_TRACE("~LayouterLock %d", mxLayouter.is() ? 1 :0);
-#endif
+    SAL_INFO("sd.view", OSL_THIS_FUNC << ": ~LayouterLock " << (mxLayouter.is() ? 1 :0));
     if (mxLayouter.is())
         mxLayouter->unlock();
 }
diff --git a/sd/source/ui/view/ViewShellManager.cxx b/sd/source/ui/view/ViewShellManager.cxx
index 9f1002b..071ed49 100644
--- a/sd/source/ui/view/ViewShellManager.cxx
+++ b/sd/source/ui/view/ViewShellManager.cxx
@@ -41,9 +41,6 @@
 #include <boost/unordered_map.hpp>
 #include <iterator>
 
-#undef VERBOSE
-//#define VERBOSE 2
-
 namespace sd {
 
 namespace {
@@ -228,7 +225,7 @@ private:
 
     DECL_LINK(WindowEventHandler, VclWindowEvent*);
 
-#ifdef VERBOSE
+#if OSL_DEBUG_LEVEL >= 2
     void DumpShellStack (const ShellStack& rStack);
     void DumpSfxShellStack (void);
 #endif
@@ -930,10 +927,10 @@ void ViewShellManager::Implementation::UpdateShellStack (void)
         aSfxShellStack.push_back(mrBase.GetSubShell(nIndex));
 
 
-#ifdef VERBOSE
-    OSL_TRACE("Current SFX Stack\r");
+#if OSL_DEBUG_LEVEL >= 2
+    SAL_INFO("sd.view", OSL_THIS_FUNC << ": Current SFX Stack");
     DumpShellStack(aSfxShellStack);
-    OSL_TRACE("Target Stack\r");
+    SAL_INFO("sd.view", OSL_THIS_FUNC << ": Target Stack");
     DumpShellStack(aTargetStack);
 #endif
 
@@ -956,9 +953,7 @@ void ViewShellManager::Implementation::UpdateShellStack (void)
             i != iLast; ++i)
     {
         SfxShell* const pShell = *i;
-#ifdef VERBOSE
-        OSL_TRACE("removing shell %p from stack\r", pShell);
-#endif
+        SAL_INFO("sd.view", OSL_THIS_FUNC << ": removing shell " << pShell << " from stack");
         mrBase.RemoveSubShell(pShell);
     }
     aSfxShellStack.erase(iSfxShell, aSfxShellStack.end());
@@ -968,9 +963,7 @@ void ViewShellManager::Implementation::UpdateShellStack (void)
     mbShellStackIsUpToDate = false;
     while (iTargetShell != aTargetStack.end())
     {
-#ifdef VERBOSE
-        OSL_TRACE("pushing shell %p on stack\r", *iTargetShell);
-#endif
+        SAL_INFO("sd.view", OSL_THIS_FUNC << ": pushing shell " << *iTargetShell << " on stack");
         mrBase.AddSubShell(**iTargetShell);
         ++iTargetShell;
 
@@ -993,8 +986,8 @@ void ViewShellManager::Implementation::UpdateShellStack (void)
     // to) abort and return immediately.
     mbShellStackIsUpToDate = true;
 
-#ifdef VERBOSE
-    OSL_TRACE("New current stack\r");
+#if OSL_DEBUG_LEVEL >= 2
+    SAL_INFO("sd.view", OSL_THIS_FUNC << ": New current stack");
     DumpSfxShellStack();
 #endif
 }
@@ -1012,8 +1005,8 @@ void ViewShellManager::Implementation::TakeShellsFromStack (const SfxShell* pShe
         ? pTopMostShell->GetUndoManager()
         : NULL;
 
-#ifdef VERBOSE
-    OSL_TRACE("TakeShellsFromStack(%p)\r", pShell);
+#if OSL_DEBUG_LEVEL >= 2
+    SAL_INFO("sd.view", OSL_THIS_FUNC << "TakeShellsFromStack( " << pShell << ")");
     DumpSfxShellStack();
 #endif
 
@@ -1049,9 +1042,7 @@ void ViewShellManager::Implementation::TakeShellsFromStack (const SfxShell* pShe
         while (true)
         {
             SfxShell* pShellOnStack = mrBase.GetSubShell(0);
-#ifdef VERBOSE
-            OSL_TRACE("removing shell %p from stack\r", pShellOnStack);
-#endif
+            SAL_INFO("sd.view", OSL_THIS_FUNC << "removing shell " << pShellOnStack << " from stack");
             mrBase.RemoveSubShell(pShellOnStack);
             if (pShellOnStack == pShell)
                 break;
@@ -1068,8 +1059,9 @@ void ViewShellManager::Implementation::TakeShellsFromStack (const SfxShell* pShe
             mpTopShell->SetUndoManager(pUndoManager);
     }
 
-#ifdef VERBOSE
-    OSL_TRACE("Sfx shell stack is:\r");
+
+#if OSL_DEBUG_LEVEL >= 2
+    SAL_INFO("sd.view", OSL_THIS_FUNC << "Sfx shell stack is:");
     DumpSfxShellStack();
 #endif
 }
@@ -1314,17 +1306,17 @@ void ViewShellManager::Implementation::Shutdown (void)
 
 
 
-#ifdef VERBOSE
+#if OSL_DEBUG_LEVEL >= 2
 void ViewShellManager::Implementation::DumpShellStack (const ShellStack& rStack)
 {
     ShellStack::const_reverse_iterator iEntry;
     for (iEntry=rStack.rbegin(); iEntry!=rStack.rend(); ++iEntry)
         if (*iEntry != NULL)
-            OSL_TRACE ("    %p : %s\r",
-                *iEntry,
+            SAL_INFO("sd.view", OSL_THIS_FUNC << ":    " <<
+                *iEntry << " : " <<
                 ::rtl::OUStringToOString((*iEntry)->GetName(),RTL_TEXTENCODING_UTF8).getStr());
         else
-            OSL_TRACE("     null\r");
+            SAL_INFO("sd.view", OSL_THIS_FUNC << "     null");
 }
 
 
-- 
1.7.5.4


--------------050506080506060105030009
Content-Type: text/x-patch;
 name="0001-SlsRequestQueue-updated.patch"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
 filename="0001-SlsRequestQueue-updated.patch"



More information about the LibreOffice mailing list