From 453ee351f32494b1f30b477069cc7a1834352377 Mon Sep 17 00:00:00 2001 From: Michaël Lefèvre Date: Fri, 4 Apr 2014 00:13:31 +0200 Subject: fdo#43157 : clean up more OSL_POSTCOND MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: Iaca31b4e12c258b762b3d88fbad0fb08b4f1fc16 Reviewed-on: https://gerrit.libreoffice.org/8832 Reviewed-by: Caolán McNamara Tested-by: Caolán McNamara --- accessibility/source/extended/textwindowaccessibility.cxx | 7 ++++--- canvas/source/tools/spriteredrawmanager.cxx | 6 ++++-- connectivity/source/commontools/parameters.cxx | 7 +++++-- connectivity/source/drivers/hsqldb/HConnection.cxx | 2 +- connectivity/source/drivers/kab/KDriver.cxx | 2 +- connectivity/source/drivers/macab/MacabDriver.cxx | 2 +- desktop/source/deployment/registry/component/dp_component.cxx | 2 +- extensions/source/propctrlr/formlinkdialog.cxx | 4 +++- forms/source/richtext/richtextimplcontrol.cxx | 2 +- include/sal/log-areas.dox | 6 ++++++ mysqlc/source/mysqlc_driver.cxx | 2 +- registry/source/keyimpl.cxx | 2 +- sc/source/core/data/documen2.cxx | 2 +- sdext/source/pdfimport/wrapper/wrapper.cxx | 2 +- svtools/source/toolpanel/paneltabbar.cxx | 4 ++-- svx/source/form/formcontroller.cxx | 2 +- unotools/source/config/bootstrap.cxx | 5 +++-- 17 files changed, 37 insertions(+), 22 deletions(-) diff --git a/accessibility/source/extended/textwindowaccessibility.cxx b/accessibility/source/extended/textwindowaccessibility.cxx index e2891043bac2..fe777806ceaa 100644 --- a/accessibility/source/extended/textwindowaccessibility.cxx +++ b/accessibility/source/extended/textwindowaccessibility.cxx @@ -1856,9 +1856,10 @@ void Document::determineVisibleRange() } } - OSL_POSTCOND( - (m_aVisibleBegin == m_xParagraphs->end() && m_aVisibleEnd == m_xParagraphs->end() && m_nVisibleBeginOffset == 0) - || (m_aVisibleBegin < m_aVisibleEnd && m_nVisibleBeginOffset >= 0), + SAL_WARN_IF( + !((m_aVisibleBegin == m_xParagraphs->end() && m_aVisibleEnd == m_xParagraphs->end() && m_nVisibleBeginOffset == 0) + || (m_aVisibleBegin < m_aVisibleEnd && m_nVisibleBeginOffset >= 0)), + "accessibility", "invalid visible range"); } diff --git a/canvas/source/tools/spriteredrawmanager.cxx b/canvas/source/tools/spriteredrawmanager.cxx index ee97967068cb..7873883c276a 100644 --- a/canvas/source/tools/spriteredrawmanager.cxx +++ b/canvas/source/tools/spriteredrawmanager.cxx @@ -366,9 +366,11 @@ namespace canvas ::basegfx::B2DRectangle aTotalBounds( o_rMoveStart ); aTotalBounds.expand( o_rMoveEnd ); - OSL_POSTCOND(impIsEqualB2DRange(rUpdateArea.maTotalBounds, basegfx::unotools::b2DSurroundingIntegerRangeFromB2DRange(aTotalBounds), 0.5), + SAL_WARN_IF(!impIsEqualB2DRange(rUpdateArea.maTotalBounds, basegfx::unotools::b2DSurroundingIntegerRangeFromB2DRange(aTotalBounds), 0.5), + "canvas", "SpriteRedrawManager::isAreaUpdateScroll(): sprite area and total area mismatch"); - OSL_POSTCOND(impIsEqualB2DVector(o_rMoveStart.getRange(), o_rMoveEnd.getRange(), 0.5), + SAL_WARN_IF(!impIsEqualB2DVector(o_rMoveStart.getRange(), o_rMoveEnd.getRange(), 0.5), + "canvas", "SpriteRedrawManager::isAreaUpdateScroll(): scroll start and end area have mismatching size"); #endif diff --git a/connectivity/source/commontools/parameters.cxx b/connectivity/source/commontools/parameters.cxx index 77599d86afa3..09f5dca4c4d2 100644 --- a/connectivity/source/commontools/parameters.cxx +++ b/connectivity/source/commontools/parameters.cxx @@ -322,7 +322,8 @@ namespace dbtools if ( bValidLink ) aStrippedMasterFields.push_back( *pMasterFields ); } - OSL_POSTCOND( aStrippedMasterFields.size() == aStrippedDetailFields.size(), + SAL_WARN_IF( aStrippedMasterFields.size() != aStrippedDetailFields.size(), + "connectivity.commontools", "ParameterManager::classifyLinks: inconsistency in new link pairs!" ); if ( bNeedExchangeLinks ) @@ -502,7 +503,9 @@ namespace dbtools return; } // if ( !initializeComposerByComponent( m_xComponent ) ) } - OSL_POSTCOND( m_xInnerParamColumns.is(), "ParameterManager::updateParameterInfo: initializeComposerByComponent did nonsense (1)!" ); + SAL_WARN_IF( !m_xInnerParamColumns.is(), + "connectivity.commontools", + "ParameterManager::updateParameterInfo: initializeComposerByComponent did nonsense (1)!" ); // collect all parameters which are defined by the "inner parameters" collectInnerParameters( false ); diff --git a/connectivity/source/drivers/hsqldb/HConnection.cxx b/connectivity/source/drivers/hsqldb/HConnection.cxx index 407931cfeabe..aa2bc4af0643 100644 --- a/connectivity/source/drivers/hsqldb/HConnection.cxx +++ b/connectivity/source/drivers/hsqldb/HConnection.cxx @@ -265,7 +265,7 @@ namespace connectivity { namespace hsqldb throw WrappedTargetException( sError ,*this, ::cppu::getCaughtException() ); } - OSL_POSTCOND( xTables.is(), "OHsqlConnection::impl_getTableContainer_throw: post condition not met!" ); + SAL_WARN_IF( !xTables.is(), "connectivity.hsqldb", "OHsqlConnection::impl_getTableContainer_throw: post condition not met!" ); return xTables; } diff --git a/connectivity/source/drivers/kab/KDriver.cxx b/connectivity/source/drivers/kab/KDriver.cxx index a4ef7cae3363..b023eaa1136f 100644 --- a/connectivity/source/drivers/kab/KDriver.cxx +++ b/connectivity/source/drivers/kab/KDriver.cxx @@ -379,7 +379,7 @@ Reference< XConnection > SAL_CALL KabDriver::connect( const OUString& url, const // create a new connection with the given properties and append it to our vector KabConnection* pConnection = m_aImplModule.createConnection( this ); - OSL_POSTCOND( pConnection, "KabDriver::connect: no connection has been created by the factory!" ); + SAL_WARN_IF( !pConnection, "connectivity.kab", "KabDriver::connect: no connection has been created by the factory!" ); // by definition, the factory function returned an object which was acquired once Reference< XConnection > xConnection = pConnection; diff --git a/connectivity/source/drivers/macab/MacabDriver.cxx b/connectivity/source/drivers/macab/MacabDriver.cxx index 08f4b51ff08e..2567a57fde19 100644 --- a/connectivity/source/drivers/macab/MacabDriver.cxx +++ b/connectivity/source/drivers/macab/MacabDriver.cxx @@ -247,7 +247,7 @@ Reference< XConnection > SAL_CALL MacabDriver::connect( const OUString& url, con // create a new connection with the given properties and append it to our vector MacabConnection* pConnection = m_aImplModule.createConnection( this ); - OSL_POSTCOND( pConnection, "MacabDriver::connect: no connection has been created by the factory!" ); + SAL_WARN_IF( !pConnection, "connectivity.macab", "MacabDriver::connect: no connection has been created by the factory!" ); // by definition, the factory function returned an object which was acquired once Reference< XConnection > xConnection = pConnection; diff --git a/desktop/source/deployment/registry/component/dp_component.cxx b/desktop/source/deployment/registry/component/dp_component.cxx index 5de1c6e89754..1f48229c43a2 100644 --- a/desktop/source/deployment/registry/component/dp_component.cxx +++ b/desktop/source/deployment/registry/component/dp_component.cxx @@ -1606,7 +1606,7 @@ BackendImpl::OtherPlatformPackageImpl::impl_openRDB() const xRegistry.set(0); } - OSL_POSTCOND(xRegistry.is(), "could not create registry for the package's platform"); + SAL_WARN_IF( !xRegistry.is(), "desktop.deployment", "could not create registry for the package's platform"); return xRegistry; } diff --git a/extensions/source/propctrlr/formlinkdialog.cxx b/extensions/source/propctrlr/formlinkdialog.cxx index dc608dfa30d0..5a1fb98f54e4 100644 --- a/extensions/source/propctrlr/formlinkdialog.cxx +++ b/extensions/source/propctrlr/formlinkdialog.cxx @@ -609,7 +609,9 @@ namespace pcr if ( bEnable ) { bEnable = getExistingRelation( xDetailTable, xMasterTable, m_aRelationDetailColumns, m_aRelationMasterColumns ); - OSL_POSTCOND( m_aRelationMasterColumns.getLength() == m_aRelationDetailColumns.getLength(), "FormLinkDialog::initializeSuggest: nonsense!" ); + SAL_WARN_IF( m_aRelationMasterColumns.getLength() != m_aRelationDetailColumns.getLength(), + "extensions.propctrlr", + "FormLinkDialog::initializeSuggest: nonsense!" ); if ( m_aRelationMasterColumns.getLength() == 0 ) { // okay, there is no relation "pointing" (via a foreign key) from the detail table to the master table // but perhaps the other way round (would make less sense, but who knows ...) diff --git a/forms/source/richtext/richtextimplcontrol.cxx b/forms/source/richtext/richtextimplcontrol.cxx index cc61a35e3097..f670701a1d58 100644 --- a/forms/source/richtext/richtextimplcontrol.cxx +++ b/forms/source/richtext/richtextimplcontrol.cxx @@ -193,7 +193,7 @@ namespace frm OSL_ENSURE( aHandler.is(), "RichTextControlImpl::enableAttributeNotification: no handler available for this attribute!" ); if ( !aHandler.is() ) return; - OSL_POSTCOND( _nAttributeId == aHandler->getAttributeId(), "RichTextControlImpl::enableAttributeNotification: suspicious handler!" ); + SAL_WARN_IF( _nAttributeId != aHandler->getAttributeId(), "forms.richtext", "RichTextControlImpl::enableAttributeNotification: suspicious handler!" ); aHandlerPos = m_aAttributeHandlers.insert( AttributeHandlerPool::value_type( _nAttributeId , aHandler ) ).first; } diff --git a/include/sal/log-areas.dox b/include/sal/log-areas.dox index 0508fb43cb7a..39209afd0235 100644 --- a/include/sal/log-areas.dox +++ b/include/sal/log-areas.dox @@ -72,6 +72,8 @@ certain functionality. @li @c connectivity.flat @li @c connectivity.hsqldb @li @c connectivity.jdbc +@li @c connectivity.kab +@li @c connectivity.macab @li @c connectivity.mork @li @c connectivity.parse @li @c connectivity.postgresql @@ -156,6 +158,7 @@ certain functionality. @li @c extensions.biblio @li @c extensions.dbpilots @li @c extensions.plugin +@li @c extensions.propctrlr @li @c extensions.scanner @li @c extensions.update @li @c extensions.olebridge - OLE automation bridge @@ -178,6 +181,7 @@ certain functionality. @li @c forms.component @li @c forms.misc +@li @c forms.richtext @li @c forms.runtime @section formula @@ -461,8 +465,10 @@ certain functionality. @li @c drawinglayer @li @c helpcompiler @li @c linguistic +@li @c mysqlc @li @c oox @li @c postprocess.cppunit +@li @c registry @li @c reportdesign @li @c rsc @li @c sax diff --git a/mysqlc/source/mysqlc_driver.cxx b/mysqlc/source/mysqlc_driver.cxx index 850d47fd6be8..21befa07f0a9 100644 --- a/mysqlc/source/mysqlc_driver.cxx +++ b/mysqlc/source/mysqlc_driver.cxx @@ -217,7 +217,7 @@ Reference< XConnection > SAL_CALL MysqlCDriver::connect(const OUString& url, con if ( !cppDriver ) { impl_initCppConn_lck_throw(); - OSL_POSTCOND( cppDriver, "MySQLCDriver::connect: internal error." ); + SAL_WARN_IF( !cppDriver, "mysqlc", "MySQLCDriver::connect: internal error." ); if ( !cppDriver ) throw RuntimeException("MySQLCDriver::connect: internal error.", *this ); } diff --git a/registry/source/keyimpl.cxx b/registry/source/keyimpl.cxx index c8a3ddd92beb..38fa3bbd81d2 100644 --- a/registry/source/keyimpl.cxx +++ b/registry/source/keyimpl.cxx @@ -47,7 +47,7 @@ ORegKey::ORegKey(const OUString& keyName, ORegistry* pReg) ORegKey::~ORegKey() { - OSL_POSTCOND(m_refCount == 0, "registry::ORegKey::dtor(): refcount not zero."); + SAL_WARN_IF(m_refCount != 0, "registry", "registry::ORegKey::dtor(): refcount not zero."); } diff --git a/sc/source/core/data/documen2.cxx b/sc/source/core/data/documen2.cxx index 745bc24aa9a4..03e616013043 100644 --- a/sc/source/core/data/documen2.cxx +++ b/sc/source/core/data/documen2.cxx @@ -444,7 +444,7 @@ ScDocument::~ScDocument() delete pRecursionHelper; delete pPreviewFont; - OSL_POSTCOND( !pAutoNameCache, "AutoNameCache still set in dtor" ); + SAL_WARN_IF( pAutoNameCache, "sc.core", "AutoNameCache still set in dtor" ); mpFormulaGroupCxt.reset(); mpCellStringPool.reset(); diff --git a/sdext/source/pdfimport/wrapper/wrapper.cxx b/sdext/source/pdfimport/wrapper/wrapper.cxx index bfa11ee95c80..189b29ced8b7 100644 --- a/sdext/source/pdfimport/wrapper/wrapper.cxx +++ b/sdext/source/pdfimport/wrapper/wrapper.cxx @@ -878,7 +878,7 @@ void Parser::parseLine( const OString& rLine ) } // all consumed? - OSL_POSTCOND(m_nCharIndex==-1,"leftover scanner input"); + SAL_WARN_IF(m_nCharIndex!=-1, "sdext.pdfimport", "leftover scanner input"); } oslFileError readLine( oslFileHandle pFile, OStringBuffer& line ) diff --git a/svtools/source/toolpanel/paneltabbar.cxx b/svtools/source/toolpanel/paneltabbar.cxx index a7d51f9b1c3d..05902d707c7e 100644 --- a/svtools/source/toolpanel/paneltabbar.cxx +++ b/svtools/source/toolpanel/paneltabbar.cxx @@ -818,7 +818,7 @@ namespace svt return; } impl_calcItemRects(); - OSL_POSTCOND( m_bItemsDirty == false, "PanelTabBar_Impl::EnsureItemsCache: cache still dirty!" ); + SAL_WARN_IF( m_bItemsDirty , "svtools", "PanelTabBar_Impl::EnsureItemsCache: cache still dirty!" ); DBG_CHECK( *this ); } @@ -1331,7 +1331,7 @@ namespace svt GrabFocus(); m_pImpl->FocusItem( i_nItemPos ); - OSL_POSTCOND( !!m_pImpl->m_aFocusedItem, "PanelTabBar::FocusPanelItem: have the focus, but no focused item?" ); + SAL_WARN_IF( !m_pImpl->m_aFocusedItem, "svtools", "PanelTabBar::FocusPanelItem: have the focus, but no focused item?" ); if ( !!m_pImpl->m_aFocusedItem ) m_pImpl->InvalidateItem( *m_pImpl->m_aFocusedItem ); m_pImpl->m_aFocusedItem.reset( i_nItemPos ); diff --git a/svx/source/form/formcontroller.cxx b/svx/source/form/formcontroller.cxx index 4910d26e890e..ceefb3e4465b 100644 --- a/svx/source/form/formcontroller.cxx +++ b/svx/source/form/formcontroller.cxx @@ -1747,7 +1747,7 @@ void FormController::focusGained(const FocusEvent& e) throw( RuntimeException, s m_xActiveControl = xControl; implSetCurrentControl( xControl ); - OSL_POSTCOND( m_xCurrentControl.is(), "implSetCurrentControl did nonsense!" ); + SAL_WARN_IF( !m_xCurrentControl.is(), "svx.form", "implSetCurrentControl did nonsense!" ); if ( bActivated ) { diff --git a/unotools/source/config/bootstrap.cxx b/unotools/source/config/bootstrap.cxx index c956caeec8fb..4c4548fe3e92 100644 --- a/unotools/source/config/bootstrap.cxx +++ b/unotools/source/config/bootstrap.cxx @@ -340,8 +340,9 @@ PathStatus getDerivedPath( _rData.getFrom(_sBootstrapParameter, _rURL, sDerivedURL); OSL_ENSURE(sDerivedURL == _rURL,"Could not set derived URL via Bootstrap default parameter"); - OSL_POSTCOND(RTL_BOOTSTRAP_DEFAULTS_BROKEN || - (_rData.getFrom(_sBootstrapParameter,sDerivedURL) && sDerivedURL==_rURL),"Use of default did not affect bootstrap value"); + SAL_WARN_IF( !(RTL_BOOTSTRAP_DEFAULTS_BROKEN || (_rData.getFrom(_sBootstrapParameter,sDerivedURL) && sDerivedURL==_rURL)), + "unotools.config", + "Use of default did not affect bootstrap value"); } else { -- cgit