[Libreoffice-commits] core.git: fpicker/source framework/source

Berk Gureken berkgureken at gmail.com
Thu Feb 4 12:54:44 UTC 2016


 fpicker/source/office/asyncfilepicker.cxx                       |    4 -
 fpicker/source/office/commonpicker.cxx                          |    2 
 fpicker/source/office/fpinteraction.cxx                         |    2 
 fpicker/source/office/fpsmartcontent.cxx                        |    2 
 fpicker/source/office/iodlg.cxx                                 |   32 +++++-----
 fpicker/source/office/iodlgimp.cxx                              |    2 
 framework/source/fwi/helper/mischelper.cxx                      |    2 
 framework/source/uiconfiguration/windowstateconfiguration.cxx   |   12 +--
 framework/source/uielement/langselectionstatusbarcontroller.cxx |    8 +-
 framework/source/uielement/menubarmanager.cxx                   |    2 
 10 files changed, 34 insertions(+), 34 deletions(-)

New commits:
commit 9108dc39525fb1d881d5b4a634039a25ef2d2d25
Author: Berk Gureken <berkgureken at gmail.com>
Date:   Mon Feb 1 12:07:06 2016 +0200

    tdf#43157 Cleanup DBG_ASSERT for fpicker and framework
    
    Change-Id: I1b79a39a9d709184cc72a905647f73dbf85eef27
    Signed-off-by: Berk Gureken <berkgureken at gmail.com>
    Reviewed-on: https://gerrit.libreoffice.org/21991
    Reviewed-by: Michael Stahl <mstahl at redhat.com>
    Tested-by: Michael Stahl <mstahl at redhat.com>

diff --git a/fpicker/source/office/asyncfilepicker.cxx b/fpicker/source/office/asyncfilepicker.cxx
index e1dade7..2f390e6 100644
--- a/fpicker/source/office/asyncfilepicker.cxx
+++ b/fpicker/source/office/asyncfilepicker.cxx
@@ -34,8 +34,8 @@ namespace svt
         ,m_pDialog  ( _pDialog )
         ,m_bRunning ( false    )
     {
-        DBG_ASSERT( m_pDialog, "AsyncPickerAction::AsyncPickerAction: invalid dialog!" );
-        DBG_ASSERT( m_pView, "AsyncPickerAction::AsyncPickerAction: invalid view!" );
+        assert( m_pDialog && "AsyncPickerAction::AsyncPickerAction: invalid dialog!" );
+        assert( m_pView && "AsyncPickerAction::AsyncPickerAction: invalid view!" );
     }
 
 
diff --git a/fpicker/source/office/commonpicker.cxx b/fpicker/source/office/commonpicker.cxx
index f47c956..c856bda 100644
--- a/fpicker/source/office/commonpicker.cxx
+++ b/fpicker/source/office/commonpicker.cxx
@@ -201,7 +201,7 @@ namespace svt
         if ( !m_pDlg )
         {
             m_pDlg.reset( implCreateDialog( VCLUnoHelper::GetWindow( m_xDialogParent ) ) );
-            DBG_ASSERT( m_pDlg, "OCommonPicker::createPicker: invalid dialog returned!" );
+            SAL_WARN_IF( !m_pDlg, "fpicker.office", "OCommonPicker::createPicker: invalid dialog returned!" );
 
             if ( m_pDlg )
             {
diff --git a/fpicker/source/office/fpinteraction.cxx b/fpicker/source/office/fpinteraction.cxx
index a991e30..ccf6ede 100644
--- a/fpicker/source/office/fpinteraction.cxx
+++ b/fpicker/source/office/fpinteraction.cxx
@@ -38,7 +38,7 @@ namespace svt
         ,m_bUsed( false )
         ,m_eInterceptions( OFilePickerInteractionHandler::E_NOINTERCEPTION )
     {
-        DBG_ASSERT( m_xMaster.is(), "OFilePickerInteractionHandler::OFilePickerInteractionHandler: invalid master handler!" );
+        SAL_WARN_IF( !m_xMaster.is(), "fpicker.office", "OFilePickerInteractionHandler::OFilePickerInteractionHandler: invalid master handler!" );
     }
 
 
diff --git a/fpicker/source/office/fpsmartcontent.cxx b/fpicker/source/office/fpsmartcontent.cxx
index 719dda1..fc5af8d 100644
--- a/fpicker/source/office/fpsmartcontent.cxx
+++ b/fpicker/source/office/fpsmartcontent.cxx
@@ -193,7 +193,7 @@ namespace svt
         if ( isInvalid() || !isBound() )
             return false;
 
-        DBG_ASSERT( m_pContent, "SmartContent::implIs: inconsistence!" );
+        assert( m_pContent && "SmartContent::implIs: inconsistence!" );
             // if, after an bindTo, we don't have a content, then we should be INVALID, or at least
             // NOT_BOUND (the latter happens, for example, if somebody tries to ask for an empty URL)
 
diff --git a/fpicker/source/office/iodlg.cxx b/fpicker/source/office/iodlg.cxx
index 3365bb2..14bff94 100644
--- a/fpicker/source/office/iodlg.cxx
+++ b/fpicker/source/office/iodlg.cxx
@@ -121,7 +121,7 @@ namespace
 
     OUString getMostCurrentFilter( SvtExpFileDlg_Impl* pImpl )
     {
-        DBG_ASSERT( pImpl, "invalid impl pointer" );
+        assert( pImpl && "invalid impl pointer" );
         const SvtFileDialogFilter_Impl* pFilter = pImpl->_pUserFilter;
 
         if ( !pFilter )
@@ -136,8 +136,8 @@ namespace
 
     bool restoreCurrentFilter( SvtExpFileDlg_Impl* _pImpl )
     {
-        DBG_ASSERT( _pImpl->GetCurFilter(), "restoreCurrentFilter: no current filter!" );
-        DBG_ASSERT( !_pImpl->GetCurFilterDisplayName().isEmpty(), "restoreCurrentFilter: no current filter (no display name)!" );
+        SAL_WARN_IF( !_pImpl->GetCurFilter(), "fpicker.office", "restoreCurrentFilter: no current filter!" );
+        SAL_WARN_IF( _pImpl->GetCurFilterDisplayName().isEmpty(), "fpicker.office", "restoreCurrentFilter: no current filter (no display name)!" );
 
         _pImpl->SelectFilterListEntry( _pImpl->GetCurFilterDisplayName() );
 
@@ -253,7 +253,7 @@ namespace
                     comphelper::getProcessComponentContext() )->
                 queryContentProvider( _rForURL ) );
 
-            DBG_ASSERT( xProvider.is(), "lcl_getHomeDirectory: could not find a (valid) content provider for the current URL!" );
+            SAL_WARN_IF( !xProvider.is(), "fpicker.office", "lcl_getHomeDirectory: could not find a (valid) content provider for the current URL!" );
             Reference< XPropertySet > xProviderProps( xProvider, UNO_QUERY );
             if ( xProviderProps.is() )
             {
@@ -1474,7 +1474,7 @@ void SvtFileDialog::UpdateControls( const OUString& rURL )
 
     {
         OUString sText;
-        DBG_ASSERT( INetProtocol::NotValid != aObj.GetProtocol(), "SvtFileDialog::UpdateControls: Invalid URL!" );
+        SAL_WARN_IF( INetProtocol::NotValid == aObj.GetProtocol(), "fpicker.office", "SvtFileDialog::UpdateControls: Invalid URL!" );
 
         if ( aObj.getSegmentCount() )
         {
@@ -1521,7 +1521,7 @@ void SvtFileDialog::UpdateControls( const OUString& rURL )
 IMPL_LINK_TYPED( SvtFileDialog, SelectHdl_Impl, SvTreeListBox*, pBox, void )
 {
     SvTreeListEntry* pEntry = pBox->FirstSelected();
-    DBG_ASSERT( pEntry, "SelectHandler without selected entry" );
+    assert( pEntry && "SelectHandler without selected entry" );
     SvtContentEntry* pUserData = static_cast<SvtContentEntry*>(pEntry->GetUserData());
 
     if ( pUserData )
@@ -1600,8 +1600,8 @@ IMPL_LINK_TYPED( SvtFileDialog, OpenDoneHdl_Impl, SvtFileView*, pView, void )
     {
         // additional check: the parent folder should not be prohibited
         INetURLObject aCurrentFolder( sCurrentFolder );
-        DBG_ASSERT( INetProtocol::NotValid != aCurrentFolder.GetProtocol(),
-            "SvtFileDialog::OpenDoneHdl_Impl: invalid current URL!" );
+        SAL_WARN_IF( INetProtocol::NotValid == aCurrentFolder.GetProtocol(),
+            "fpicker.office", "SvtFileDialog::OpenDoneHdl_Impl: invalid current URL!" );
 
         aCurrentFolder.removeSegment();
     }
@@ -1779,7 +1779,7 @@ short SvtFileDialog::Execute()
     short nResult = ModalDialog::Execute();
     _bIsInExecute = false;
 
-    DBG_ASSERT( !m_pCurrentAsyncAction.is(), "SvtFilePicker::Execute: still running an async action!" );
+    SAL_WARN_IF( m_pCurrentAsyncAction.is(), "fpicker.office", "SvtFilePicker::Execute: still running an async action!" );
         // the dialog should not be cancellable while an async action is running - first, the action
         // needs to be cancelled
 
@@ -2027,7 +2027,7 @@ short SvtFileDialog::PrepareExecute()
                 }
             }
             SvtFileDialogFilter_Impl* pNewCurFilter = _pImp->m_aFilter[ nPos ].get();
-            DBG_ASSERT( pNewCurFilter, "SvtFileDialog::Execute: invalid filter pos!" );
+            assert( pNewCurFilter && "SvtFileDialog::Execute: invalid filter pos!" );
             _pImp->SetCurFilter( pNewCurFilter, pNewCurFilter->GetName() );
         }
 
@@ -2104,7 +2104,7 @@ short SvtFileDialog::PrepareExecute()
 void SvtFileDialog::executeAsync( ::svt::AsyncPickerAction::Action _eAction,
                                     const OUString& _rURL, const OUString& _rFilter )
 {
-    DBG_ASSERT( !m_pCurrentAsyncAction.is(), "SvtFileDialog::executeAsync: previous async action not yet finished!" );
+    SAL_WARN_IF( m_pCurrentAsyncAction.is(), "fpicker.office", "SvtFileDialog::executeAsync: previous async action not yet finished!" );
 
     m_pCurrentAsyncAction = new AsyncPickerAction( this, _pFileView, _eAction );
 
@@ -2149,7 +2149,7 @@ void SvtFileDialog::SetStandardDir( const OUString& rStdDir )
 
 {
     INetURLObject aObj( rStdDir );
-    DBG_ASSERT( aObj.GetProtocol() != INetProtocol::NotValid, "Invalid protocol!" );
+    SAL_WARN_IF( aObj.GetProtocol() == INetProtocol::NotValid, "fpicker.office", "Invalid protocol!" );
     aObj.setFinalSlash();
     _pImp->SetStandardDir( aObj.GetMainURL( INetURLObject::NO_DECODE ) );
 }
@@ -2213,14 +2213,14 @@ SvtFileDialogFilter_Impl* SvtFileDialog::implAddFilter( const OUString& _rFilter
 
 void SvtFileDialog::AddFilter( const OUString& _rFilter, const OUString& _rType )
 {
-    DBG_ASSERT( !IsInExecute(), "SvtFileDialog::AddFilter: currently executing!" );
+    SAL_WARN_IF( IsInExecute(), "fpicker.office", "SvtFileDialog::AddFilter: currently executing!" );
     implAddFilter ( _rFilter, _rType );
 }
 
 
 void SvtFileDialog::AddFilterGroup( const OUString& _rFilter, const Sequence< StringPair >& _rFilters )
 {
-    DBG_ASSERT( !IsInExecute(), "SvtFileDialog::AddFilter: currently executing!" );
+    SAL_WARN_IF( IsInExecute(), "fpicker.office", "SvtFileDialog::AddFilter: currently executing!" );
 
     implAddFilter( _rFilter, OUString() );
     const StringPair* pSubFilters       =               _rFilters.getConstArray();
@@ -2232,7 +2232,7 @@ void SvtFileDialog::AddFilterGroup( const OUString& _rFilter, const Sequence< St
 
 void SvtFileDialog::SetCurFilter( const OUString& rFilter )
 {
-    DBG_ASSERT( !IsInExecute(), "SvtFileDialog::SetCurFilter: currently executing!" );
+    SAL_WARN_IF( IsInExecute(), "fpicker.office", "SvtFileDialog::SetCurFilter: currently executing!" );
 
     // look for corresponding filter
     sal_uInt16 nPos = _pImp->m_aFilter.size();
@@ -2277,7 +2277,7 @@ sal_uInt16 SvtFileDialog::GetFilterCount() const
 
 const OUString& SvtFileDialog::GetFilterName( sal_uInt16 nPos ) const
 {
-    DBG_ASSERT( nPos < GetFilterCount(), "invalid index" );
+    assert( nPos < GetFilterCount() && "invalid index" );
     return _pImp->m_aFilter[ nPos ]->GetName();
 }
 
diff --git a/fpicker/source/office/iodlgimp.cxx b/fpicker/source/office/iodlgimp.cxx
index ae511ec..3a3b305 100644
--- a/fpicker/source/office/iodlgimp.cxx
+++ b/fpicker/source/office/iodlgimp.cxx
@@ -190,7 +190,7 @@ void SvtUpButton_Impl::Select()
     if ( nId )
     {
         --nId;
-        DBG_ASSERT( nId <= _aURLs.size(), "SvtUpButton_Impl:falscher Index" );
+        assert( nId <= _aURLs.size() &&  "SvtUpButton_Impl:falscher Index" );
 
         GetDialogParent()->OpenURL_Impl(_aURLs[nId]);
     }
diff --git a/framework/source/fwi/helper/mischelper.cxx b/framework/source/fwi/helper/mischelper.cxx
index f8a1f75..665b742 100644
--- a/framework/source/fwi/helper/mischelper.cxx
+++ b/framework/source/fwi/helper/mischelper.cxx
@@ -53,7 +53,7 @@ uno::Reference< linguistic2::XLanguageGuessing > LanguageGuessingHelper::GetGues
         }
         catch (const uno::Exception &)
         {
-            DBG_ASSERT( false, "failed to get language guessing component" );
+            SAL_WARN( "framework.fwi", "failed to get language guessing component" );
         }
     }
     return m_xLanguageGuesser;
diff --git a/framework/source/uiconfiguration/windowstateconfiguration.cxx b/framework/source/uiconfiguration/windowstateconfiguration.cxx
index 71ddcfa..9412302 100644
--- a/framework/source/uiconfiguration/windowstateconfiguration.cxx
+++ b/framework/source/uiconfiguration/windowstateconfiguration.cxx
@@ -592,7 +592,7 @@ Any ConfigurationAccess_WindowState::impl_getSequenceFromStruct( const WindowSta
                 case PROPERTY_DOCKSIZE:
                     aPropSeq[nIndex].Value = makeAny( rWinStateInfo.aDockSize ); break;
                 default:
-                    DBG_ASSERT( false, "Wrong value for ConfigurationAccess_WindowState. Who has forgotten to add this new property!" );
+                    assert( false && "Wrong value for ConfigurationAccess_WindowState. Who has forgotten to add this new property!" );
             }
         }
     }
@@ -772,7 +772,7 @@ Any ConfigurationAccess_WindowState::impl_insertCacheAndReturnSequence( const OU
                 break;
 
                 default:
-                    DBG_ASSERT( false, "Wrong value for ConfigurationAccess_WindowState. Who has forgotten to add this new property!" );
+                   assert( false && "Wrong value for ConfigurationAccess_WindowState. Who has forgotten to add this new property!" );
             }
 
             if ( bAddToSeq )
@@ -844,7 +844,7 @@ ConfigurationAccess_WindowState::WindowStateInfo& ConfigurationAccess_WindowStat
                             case PROPERTY_CONTEXTACTIVE:
                                 aWindowStateInfo.bContextActive = bValue; break;
                             default:
-                                DBG_ASSERT( false, "Unknown boolean property in WindowState found!" );
+                                SAL_WARN( "framework.uiconfiguration", "Unknown boolean property in WindowState found!" );
                         }
                     }
                 }
@@ -956,7 +956,7 @@ ConfigurationAccess_WindowState::WindowStateInfo& ConfigurationAccess_WindowStat
                 break;
 
                 default:
-                    DBG_ASSERT( false, "Wrong value for ConfigurationAccess_WindowState. Who has forgotten to add this new property!" );
+                   assert( false && "Wrong value for ConfigurationAccess_WindowState. Who has forgotten to add this new property!" );
             }
         }
         catch( const css::container::NoSuchElementException& )
@@ -1145,7 +1145,7 @@ void ConfigurationAccess_WindowState::impl_fillStructFromSequence( WindowStateIn
                     break;
 
                     default:
-                        DBG_ASSERT( false, "Wrong value for ConfigurationAccess_WindowState. Who has forgotten to add this new property!" );
+                       assert( false && "Wrong value for ConfigurationAccess_WindowState. Who has forgotten to add this new property!" );
                 }
 
                 break;
@@ -1226,7 +1226,7 @@ void ConfigurationAccess_WindowState::impl_putPropertiesFromStruct( const Window
                     case PROPERTY_STYLE:
                         xPropSet->setPropertyValue( m_aPropArray[i], makeAny( sal_Int32( rWinStateInfo.nStyle )) ); break;
                     default:
-                        DBG_ASSERT( false, "Wrong value for ConfigurationAccess_WindowState. Who has forgotten to add this new property!" );
+                       assert( false && "Wrong value for ConfigurationAccess_WindowState. Who has forgotten to add this new property!" );
                 }
             }
             catch( const Exception& )
diff --git a/framework/source/uielement/langselectionstatusbarcontroller.cxx b/framework/source/uielement/langselectionstatusbarcontroller.cxx
index 723aee1..5133e44 100644
--- a/framework/source/uielement/langselectionstatusbarcontroller.cxx
+++ b/framework/source/uielement/langselectionstatusbarcontroller.cxx
@@ -158,8 +158,8 @@ throw (css::uno::RuntimeException, std::exception)
              rStr != sAsterisk &&
              !rStr.isEmpty()) // 'no language found' from language guessing
         {
-            DBG_ASSERT( MID_LANG_SEL_1 <= nItemId && nItemId <= MID_LANG_SEL_9,
-                    "nItemId outside of expected range!" );
+            SAL_WARN_IF( MID_LANG_SEL_1 > nItemId || nItemId > MID_LANG_SEL_9,
+                    "framework.uielement", "nItemId outside of expected range!" );
             xPopupMenu->insertItem( nItemId, rStr, 0, nItemId );
             if ( rStr == m_aCurLang )
             {
@@ -186,8 +186,8 @@ throw (css::uno::RuntimeException, std::exception)
             rStr != sAsterisk &&
             !rStr.isEmpty()) // 'no language found' from language guessing
         {
-            DBG_ASSERT( MID_LANG_PARA_1 <= nItemId && nItemId <= MID_LANG_PARA_9,
-                    "nItemId outside of expected range!" );
+            SAL_WARN_IF( MID_LANG_PARA_1 > nItemId || nItemId > MID_LANG_PARA_9,
+                    "framework.uielement", "nItemId outside of expected range!" );
             subPopupMenu->insertItem( nItemId, rStr, 0, nItemId );
             aLangMap[nItemId] = rStr;
             ++nItemId;
diff --git a/framework/source/uielement/menubarmanager.cxx b/framework/source/uielement/menubarmanager.cxx
index a1ac05c..cd4492f 100644
--- a/framework/source/uielement/menubarmanager.cxx
+++ b/framework/source/uielement/menubarmanager.cxx
@@ -226,7 +226,7 @@ MenuBarManager::~MenuBarManager()
     m_xDeferedItemContainer.clear();
     m_aAsyncSettingsTimer.Stop();
 
-    DBG_ASSERT( OWeakObject::m_refCount == 0, "Who wants to delete an object with refcount > 0!" );
+    SAL_WARN_IF( OWeakObject::m_refCount != 0, "framework.uielement", "Who wants to delete an object with refcount > 0!" );
 }
 
 void MenuBarManager::Destroy()


More information about the Libreoffice-commits mailing list