diff options
author | Michaël Lefèvre <lefevre00@yahoo.fr> | 2014-04-07 11:44:43 +0200 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2014-05-12 11:32:38 +0200 |
commit | 70e744b2157ebe48f3a5c839560fedf6521d0464 (patch) | |
tree | 4e29618cc5a36f25557bd130226abdfe96e46848 | |
parent | d1516d488c081ec3a5d730d2b1626a0c8dc39a73 (diff) |
fdo#43157 Remove OSL_POSTCOND, prefer SAL_WARN_IF
Change-Id: Ia89a2dce799c7ba90bcd19919195bfd2c7a4a180
Signed-off-by: Stephan Bergmann <sbergman@redhat.com>
29 files changed, 96 insertions, 76 deletions
diff --git a/basic/source/runtime/runtime.cxx b/basic/source/runtime/runtime.cxx index 8bfdb5295940..43da65808b8a 100644 --- a/basic/source/runtime/runtime.cxx +++ b/basic/source/runtime/runtime.cxx @@ -924,11 +924,11 @@ void SbiRuntime::Error( SbError _errCode, const OUString& _details ) if ( _errCode ) { // Not correct for class module usage, remove for now - //OSL_ENSURE( pInst->pRun == this, "SbiRuntime::Error: can't propagate the error message details!" ); + //OSL_WARN_IF( pInst->pRun != this, "basic", "SbiRuntime::Error: can't propagate the error message details!" ); if ( pInst->pRun == this ) { pInst->Error( _errCode, _details ); - //OSL_POSTCOND( nError == _errCode, "SbiRuntime::Error: the instance is expecte to propagate the error code back to me!" ); + //OSL_WARN_IF( nError != _errCode, "basic", "SbiRuntime::Error: the instance is expecte to propagate the error code back to me!" ); } else { diff --git a/dbaccess/source/core/api/resultset.cxx b/dbaccess/source/core/api/resultset.cxx index 8f9e48a88fe9..ed356f915079 100644 --- a/dbaccess/source/core/api/resultset.cxx +++ b/dbaccess/source/core/api/resultset.cxx @@ -382,7 +382,7 @@ Reference< ::com::sun::star::container::XNameAccess > OResultSet::getColumns(voi { const Reference< XNameAccess > xColNames( static_cast< XNameAccess* >( m_pColumns ), UNO_SET_THROW ); const Sequence< OUString > aNames( xColNames->getElementNames() ); - OSL_POSTCOND( aNames.getLength() == nColCount, + SAL_WARN_IF( aNames.getLength() != nColCount, "dbaccess", "OResultSet::getColumns: invalid column count!" ); for ( const OUString* pName = aNames.getConstArray(); pName != aNames.getConstArray() + aNames.getLength(); @@ -392,7 +392,7 @@ Reference< ::com::sun::star::container::XNameAccess > OResultSet::getColumns(voi Reference< XPropertySet > xColProps( xColNames->getByName( *pName ), UNO_QUERY_THROW ); OUString sName; OSL_VERIFY( xColProps->getPropertyValue( PROPERTY_NAME ) >>= sName ); - OSL_POSTCOND( sName == *pName, "OResultSet::getColumns: invalid column name!" ); + SAL_WARN_IF( sName != *pName, "dbaccess", "OResultSet::getColumns: invalid column name!" ); } } diff --git a/dbaccess/source/core/recovery/subcomponentrecovery.cxx b/dbaccess/source/core/recovery/subcomponentrecovery.cxx index 7055ec1be0cc..c5b977e66d75 100644 --- a/dbaccess/source/core/recovery/subcomponentrecovery.cxx +++ b/dbaccess/source/core/recovery/subcomponentrecovery.cxx @@ -481,7 +481,7 @@ namespace dbaccess break; } - OSL_POSTCOND( m_eType != UNKNOWN, + SAL_WARN_IF( m_eType == UNKNOWN, "dbaccess", "SubComponentRecovery::impl_identifyComponent_throw: couldn't classify the component!" ); } diff --git a/dbaccess/source/filter/xml/xmlExport.cxx b/dbaccess/source/filter/xml/xmlExport.cxx index 7d8030f5adac..2169f9b2db4f 100644 --- a/dbaccess/source/filter/xml/xmlExport.cxx +++ b/dbaccess/source/filter/xml/xmlExport.cxx @@ -979,7 +979,7 @@ void ODBExport::exportFilter(XPropertySet* _xProp AddAttribute(XML_NAMESPACE_DB, XML_COMMAND,sCommand); SvXMLElementExport aComponents(*this,XML_NAMESPACE_DB, _eStatementType, true, true); } - OSL_POSTCOND(!GetAttrList().getLength(),"Invalid attribute length!"); + SAL_WARN_IF(GetAttrList().getLength(), "dbaccess", "Invalid attribute length!"); } void ODBExport::exportColumns(const Reference<XColumnsSupplier>& _xColSup) diff --git a/dbaccess/source/ui/dlg/dsselect.cxx b/dbaccess/source/ui/dlg/dsselect.cxx index 6342466c4320..5583bfc5abb1 100644 --- a/dbaccess/source/ui/dlg/dsselect.cxx +++ b/dbaccess/source/ui/dlg/dsselect.cxx @@ -110,7 +110,7 @@ IMPL_LINK_NOARG(ODatasourceSelectDialog, ManageClickHdl) m_pCancel->Disable(); m_pManageDatasources->Disable(); - OSL_POSTCOND( m_pODBCManagement->isRunning(), "ODatasourceSelectDialog::ManageClickHdl: success, but not running - you were *fast*!" ); + SAL_WARN_IF( !m_pODBCManagement->isRunning(), "dbaccess.ui", "ODatasourceSelectDialog::ManageClickHdl: success, but not running - you were *fast*!" ); return 0L; } diff --git a/dbaccess/source/ui/misc/dbsubcomponentcontroller.cxx b/dbaccess/source/ui/misc/dbsubcomponentcontroller.cxx index 8d59cd076a75..e7608d57f4de 100644 --- a/dbaccess/source/ui/misc/dbsubcomponentcontroller.cxx +++ b/dbaccess/source/ui/misc/dbsubcomponentcontroller.cxx @@ -263,7 +263,7 @@ namespace dbaui // (take the indirection through XDataSource to ensure we have a correct object ....) m_pImpl->m_aDataSource = xDS; } - OSL_POSTCOND( m_pImpl->m_aDataSource.is(), "DBSubComponentController::initializeConnection: unable to obtain the data source object!" ); + SAL_WARN_IF( !m_pImpl->m_aDataSource.is(), "dbaccess.ui", "DBSubComponentController::initializeConnection: unable to obtain the data source object!" ); if ( m_pImpl->m_bNotAttached ) { diff --git a/dbaccess/source/ui/uno/copytablewizard.cxx b/dbaccess/source/ui/uno/copytablewizard.cxx index e11ba9580613..073f4e43f34e 100644 --- a/dbaccess/source/ui/uno/copytablewizard.cxx +++ b/dbaccess/source/ui/uno/copytablewizard.cxx @@ -847,7 +847,7 @@ SharedConnection CopyTableWizard::impl_extractConnection_throw( const Reference< if ( xConnection.is() ) { xInteractionHandler = lcl_getInteractionHandler_throw( xConnection.getTyped(), m_xInteractionHandler ); - OSL_POSTCOND( xInteractionHandler.is(), "CopyTableWizard::impl_extractConnection_throw: lcl_getInteractionHandler_throw returned nonsense!" ); + SAL_WARN_IF( !xInteractionHandler.is(), "dbaccess.ui", "CopyTableWizard::impl_extractConnection_throw: lcl_getInteractionHandler_throw returned nonsense!" ); break; } @@ -870,7 +870,7 @@ SharedConnection CopyTableWizard::impl_extractConnection_throw( const Reference< { // first, try connecting with completion xInteractionHandler = lcl_getInteractionHandler_throw( xDataSource, m_xInteractionHandler ); - OSL_POSTCOND( xInteractionHandler.is(), "CopyTableWizard::impl_extractConnection_throw: lcl_getInteractionHandler_throw returned nonsense!" ); + SAL_WARN_IF( !xInteractionHandler.is(), "dbaccess.ui", "CopyTableWizard::impl_extractConnection_throw: lcl_getInteractionHandler_throw returned nonsense!" ); if ( xInteractionHandler.is() ) { Reference< XCompletedConnection > xInteractiveConnection( xDataSource, UNO_QUERY ); diff --git a/fpicker/source/win32/filepicker/FilePicker.cxx b/fpicker/source/win32/filepicker/FilePicker.cxx index a8bb989091cf..bfc75fcda7fe 100644 --- a/fpicker/source/win32/filepicker/FilePicker.cxx +++ b/fpicker/source/win32/filepicker/FilePicker.cxx @@ -73,7 +73,7 @@ CFilePicker::CFilePicker( const uno::Reference<lang::XMultiServiceFactory>& xSer m_aAsyncEventNotifier(rBHelper) { HINSTANCE hInstance = GetModuleHandle(FILE_PICKER_DLL_NAME); - OSL_POSTCOND( hInstance, "The name of the service dll must have changed" ); + SAL_WARN_IF( !hInstance, "fpicker", "The name of the service dll must have changed" ); // create a default FileOpen dialog without any additional ui elements m_pImpl = std::auto_ptr< CWinFileOpenImpl >( @@ -677,7 +677,7 @@ void SAL_CALL CFilePicker::initialize(const uno::Sequence<uno::Any>& aArguments) } HINSTANCE hInstance = GetModuleHandle( FILE_PICKER_DLL_NAME ); - OSL_POSTCOND( hInstance, "The name of the service dll must have changed" ); + SAL_WARN_IF( !hInstance, "fpicker", The name of the service dll must have changed" ); // create a new impl-class here based on the // given string, if the given string is empty diff --git a/fpicker/source/win32/filepicker/PreviewCtrl.cxx b/fpicker/source/win32/filepicker/PreviewCtrl.cxx index e843182575de..e761e7714139 100644 --- a/fpicker/source/win32/filepicker/PreviewCtrl.cxx +++ b/fpicker/source/win32/filepicker/PreviewCtrl.cxx @@ -282,7 +282,7 @@ CFilePreview::~CFilePreview( ) sal_Bool bRet = UnregisterClass( (LPCTSTR)(DWORD_PTR)MAKELONG( m_atomPrevWndClass, 0 ), m_hInstance ); - OSL_POSTCOND( bRet, "Unregister preview window class failed" ); + SAL_WARN_IF( !bRet, "fpicker", "Unregister preview window class failed" ); } diff --git a/fpicker/source/win32/filepicker/asynceventnotifier.cxx b/fpicker/source/win32/filepicker/asynceventnotifier.cxx index b6a61b4da77f..6f0873461fc8 100644 --- a/fpicker/source/win32/filepicker/asynceventnotifier.cxx +++ b/fpicker/source/win32/filepicker/asynceventnotifier.cxx @@ -132,7 +132,7 @@ bool SAL_CALL CAsyncEventNotifier::startup(bool bCreateSuspended) m_bRun = true; } - OSL_POSTCOND(m_bRun,"Could not start event notifier!"); + SAL_WARN_IF( !m_bRun, "fpicker", "Could not start event notifier!"); return m_bRun; } diff --git a/fpicker/source/win32/filepicker/dibpreview.cxx b/fpicker/source/win32/filepicker/dibpreview.cxx index b8023a8a1dd5..8f9d1dc25ffa 100644 --- a/fpicker/source/win32/filepicker/dibpreview.cxx +++ b/fpicker/source/win32/filepicker/dibpreview.cxx @@ -84,12 +84,9 @@ CDIBPreview::CDIBPreview(HINSTANCE instance,HWND parent,sal_Bool bShowWindow) : // instance of this class ); - bool bSuccess = IsWindow(m_Hwnd); - - OSL_POSTCOND(bSuccess,"Coud not create preview window"); - - if (!bSuccess) + if (!IsWindow(m_Hwnd)) { + SAL_WARN("fpicker","Coud not create preview window"); UnregisterDibPreviewWindowClass(); throw std::runtime_error("Could not create preview window"); } @@ -401,12 +398,11 @@ ATOM SAL_CALL CDIBPreview::RegisterDibPreviewWindowClass() // Win2000 - the window class must be unregistered manually // if the dll is unloaded s_ClassAtom = RegisterClassEx(&wndClsEx); - - OSL_POSTCOND(s_ClassAtom,"Could not register preview window class"); - if (0 == s_ClassAtom) + { + SAL_WARN("fpicker", "Could not register preview window class"); throw std::runtime_error("Preview window class could not be registered"); - } + } // increment the register class counter // so that we keep track of the number diff --git a/fpicker/source/win32/filepicker/filepickerstate.cxx b/fpicker/source/win32/filepicker/filepickerstate.cxx index 2e0967aec361..5403b814a4ed 100644 --- a/fpicker/source/win32/filepicker/filepickerstate.cxx +++ b/fpicker/source/win32/filepicker/filepickerstate.cxx @@ -509,7 +509,7 @@ OUString SAL_CALL CExecuteFilePickerState::getLabel( sal_Int16 aControlId ) Sequence< OUString > SAL_CALL CExecuteFilePickerState::getFiles( CFileOpenDialog* aFileOpenDialog ) { - OSL_POSTCOND( aFileOpenDialog, "invalid parameter" ); + SAL_WARN_IF( !aFileOpenDialog, "fpicker", "invalid parameter" ); Sequence< OUString > aFilePathList; OUString aFilePathURL; @@ -545,7 +545,7 @@ Sequence< OUString > SAL_CALL CExecuteFilePickerState::getFiles( CFileOpenDialog OUString SAL_CALL CExecuteFilePickerState::getDisplayDirectory( CFileOpenDialog* aFileOpenDialog ) { - OSL_POSTCOND( aFileOpenDialog, "invalid parameter" ); + SAL_WARN_IF( !aFileOpenDialog, "fpicker", "invalid parameter" ); OUString pathURL; OUString displayDir; diff --git a/fpicker/source/win32/filepicker/getfilenamewrapper.cxx b/fpicker/source/win32/filepicker/getfilenamewrapper.cxx index 84c0b6f5f275..181ae5fa4626 100644 --- a/fpicker/source/win32/filepicker/getfilenamewrapper.cxx +++ b/fpicker/source/win32/filepicker/getfilenamewrapper.cxx @@ -164,7 +164,7 @@ namespace /* private */ HANDLE hThread = reinterpret_cast<HANDLE>( _beginthreadex(0, 0, ThreadProc, &gfnp, 0, &id)); - OSL_POSTCOND(hThread, "could not create STA thread"); + SAL_WARN_IF( !hThread, "fpicker", "could not create STA thread"); WaitForSingleObject(hThread, INFINITE); CloseHandle(hThread); diff --git a/fpicker/source/win32/folderpicker/MtaFop.hxx b/fpicker/source/win32/folderpicker/MtaFop.hxx index 35076bda8388..6469d93441b0 100644 --- a/fpicker/source/win32/folderpicker/MtaFop.hxx +++ b/fpicker/source/win32/folderpicker/MtaFop.hxx @@ -54,7 +54,7 @@ public: pBuff = new sal_Unicode[size]; - OSL_POSTCOND(pBuff,"Could not allocate path buffer"); + SAL_WARN_IF(!pBuff, "fpicker", "Could not allocate path buffer"); } ~CAutoPathBuff( ) diff --git a/include/sal/log-areas.dox b/include/sal/log-areas.dox index d70a8c1e5f86..617cec8a881a 100644 --- a/include/sal/log-areas.dox +++ b/include/sal/log-areas.dox @@ -193,6 +193,7 @@ certain functionality. @section fpicker +@li @c fpicker @li @c fpicker.aqua @li @c fpicker.office @@ -478,6 +479,7 @@ certain functionality. @li @c sax @li @c shell @li @c stoc +@li @c store @li @c svg @li @c test @li @c ucbhelper diff --git a/sal/osl/unx/file_path_helper.cxx b/sal/osl/unx/file_path_helper.cxx index 6c8dab15c5b0..ae3781e11eaf 100644 --- a/sal/osl/unx/file_path_helper.cxx +++ b/sal/osl/unx/file_path_helper.cxx @@ -51,8 +51,9 @@ void SAL_CALL osl_systemPathRemoveSeparator(rtl_uString* pustrPath) pustrPath->buffer[pustrPath->length] = (sal_Unicode)'\0'; } - OSL_POSTCOND((0 == pustrPath->length) || (1 == pustrPath->length) || \ - (pustrPath->length > 1 && pustrPath->buffer[pustrPath->length - 1] != FPH_CHAR_PATH_SEPARATOR), \ + SAL_WARN_IF( !((0 == pustrPath->length) || (1 == pustrPath->length) || + (pustrPath->length > 1 && pustrPath->buffer[pustrPath->length - 1] != FPH_CHAR_PATH_SEPARATOR)), + "sal.osl", "osl_systemPathRemoveSeparator: Post condition failed"); } } @@ -72,7 +73,8 @@ void SAL_CALL osl_systemPathEnsureSeparator(rtl_uString** ppustrPath) rtl_uString_assign(ppustrPath, path.pData); } - OSL_POSTCOND(path.endsWith(FPH_PATH_SEPARATOR()), \ + SAL_WARN_IF( !path.endsWith(FPH_PATH_SEPARATOR()), + "sal.osl", "osl_systemPathEnsureSeparator: Post condition failed"); } } diff --git a/sal/osl/w32/file.cxx b/sal/osl/w32/file.cxx index cca336797ae0..d51c243b5a38 100644 --- a/sal/osl/w32/file.cxx +++ b/sal/osl/w32/file.cxx @@ -684,8 +684,9 @@ SAL_CALL osl_createFileHandleFromOSHandle ( if (!(uFlags & osl_File_OpenFlag_Write)) pImpl->m_state &= ~FileHandle_Impl::STATE_WRITEABLE; - OSL_POSTCOND( - (uFlags & osl_File_OpenFlag_Read) || (uFlags & osl_File_OpenFlag_Write), + SAL_WARN_IF( + !((uFlags & osl_File_OpenFlag_Read) || (uFlags & osl_File_OpenFlag_Write)), + "sal.osl", "osl_createFileHandleFromOSHandle(): missing read/write access flags"); return (oslFileHandle)(pImpl); } diff --git a/sal/osl/w32/file_dirvol.cxx b/sal/osl/w32/file_dirvol.cxx index 6fb10091333d..2d2c9f6aab58 100644 --- a/sal/osl/w32/file_dirvol.cxx +++ b/sal/osl/w32/file_dirvol.cxx @@ -166,8 +166,9 @@ namespace /* private */ } } - OSL_POSTCOND(puncc->server_.isPresent() && puncc->share_.isPresent(), \ - "Postcondition violated: Invalid UNC path detected"); + SAL_WARN_IF(!puncc->server_.isPresent() || !puncc->share_.isPresent(), + "sal.osl", + "Postcondition violated: Invalid UNC path detected"); } void parse_UNC_path(const rtl::OUString& path, UNCComponents* puncc) diff --git a/sal/osl/w32/path_helper.cxx b/sal/osl/w32/path_helper.cxx index 14ee0efed5bc..2887860f753a 100644 --- a/sal/osl/w32/path_helper.cxx +++ b/sal/osl/w32/path_helper.cxx @@ -53,7 +53,8 @@ void osl_systemPathEnsureSeparator(/*inout*/ rtl_uString** ppustrPath) rtl_uString_assign(ppustrPath, path.pData); } - OSL_POSTCOND(path.endsWith(BACKSLASH), \ + SAL_WARN_IF( !path.endsWith(BACKSLASH), + "sal.osl", "osl_systemPathEnsureSeparator: Post condition failed"); } diff --git a/sal/osl/w32/socket.cxx b/sal/osl/w32/socket.cxx index 881c4677151c..d215ff878c0e 100644 --- a/sal/osl/w32/socket.cxx +++ b/sal/osl/w32/socket.cxx @@ -1314,8 +1314,9 @@ oslSocketResult SAL_CALL osl_connectSocketTo ( if (error > 0) /* connected */ { - OSL_POSTCOND( - FD_ISSET(pSocket->m_Socket, &fds), + SAL_WARN_IF( + !FD_ISSET(pSocket->m_Socket, &fds), + "sal.osl", "osl_connectSocketTo(): select returned but socket not set\n"); Result= osl_Socket_Ok; diff --git a/shell/source/win32/shlxthandler/classfactory.cxx b/shell/source/win32/shlxthandler/classfactory.cxx index 2c223113be37..d5a394f2904f 100644 --- a/shell/source/win32/shlxthandler/classfactory.cxx +++ b/shell/source/win32/shlxthandler/classfactory.cxx @@ -21,6 +21,7 @@ #include <osl/diagnose.h> +#include <sal/log.hxx> #include "internal/global.hxx" #include "classfactory.hxx" @@ -119,10 +120,11 @@ HRESULT STDMETHODCALLTYPE CClassFactory::CreateInstance( else if (CLSID_THUMBVIEWER_HANDLER == m_Clsid) pUnk = static_cast<IExtractImage*>(new CThumbviewer()); - OSL_POSTCOND(pUnk != 0, "Could not create COM object"); - if (0 == pUnk) + { + SAL_WARN("shell", "Could not create COM object"); return E_OUTOFMEMORY; + } HRESULT hr = pUnk->QueryInterface(riid, ppvObject); diff --git a/shell/source/win32/shlxthandler/prophdl/propertyhdl.cxx b/shell/source/win32/shlxthandler/prophdl/propertyhdl.cxx index 8d25aef23749..10deb738cb44 100644 --- a/shell/source/win32/shlxthandler/prophdl/propertyhdl.cxx +++ b/shell/source/win32/shlxthandler/prophdl/propertyhdl.cxx @@ -32,6 +32,7 @@ #include <propkey.h> #include <propvarutil.h> #include <sal/macros.h> +#include <sal/log.hxx> #include <malloc.h> #include <strsafe.h> @@ -380,10 +381,11 @@ HRESULT STDMETHODCALLTYPE CClassFactory::CreateInstance( if ( CLSID_PROPERTY_HANDLER == m_Clsid ) pUnk = static_cast<IPropertyStore*>( new CPropertyHdl() ); - OSL_POSTCOND(pUnk != 0, "Could not create COM object"); - if (0 == pUnk) + { + SAL_WARN("shell", "Could not create COM object"); return E_OUTOFMEMORY; + } HRESULT hr = pUnk->QueryInterface( riid, ppvObject ); diff --git a/store/source/lockbyte.cxx b/store/source/lockbyte.cxx index e875d1bdfa76..59bd50fc0397 100644 --- a/store/source/lockbyte.cxx +++ b/store/source/lockbyte.cxx @@ -787,7 +787,7 @@ storeError MemoryLockBytes::writeAt_Impl (sal_uInt32 nOffset, const void * pBuff if (eErrCode != store_E_None) return eErrCode; } - OSL_POSTCOND(dst_size <= m_nSize, "store::MemoryLockBytes::setSize_Impl() contract violation"); + SAL_WARN_IF(dst_size > m_nSize, "store", "store::MemoryLockBytes::setSize_Impl() contract violation"); sal_uInt8 * dst_lo = m_pData + nOffset; if (dst_lo >= m_pData + m_nSize) diff --git a/store/source/storbios.cxx b/store/source/storbios.cxx index 3a4e37f24982..dab00785c285 100644 --- a/store/source/storbios.cxx +++ b/store/source/storbios.cxx @@ -25,6 +25,7 @@ #include "sal/types.h" #include "sal/macros.h" +#include "sal/log.hxx" #include "rtl/alloc.h" #include "rtl/ref.hxx" @@ -258,9 +259,10 @@ storeError SuperBlockPage::unusedHead (OStorePageBIOS & rBIOS, PageData & rPageH // Verify page is unused. sal_uInt32 const nAddr = rPageHead.m_aUnused.location(); - OSL_POSTCOND(nAddr != STORE_PAGE_NULL, "store::SuperBlock::unusedHead(): page not free"); if (nAddr == STORE_PAGE_NULL) { + SAL_WARN("store", "store::SuperBlock::unusedHead(): page not free"); + // Page in use. rPageHead.location (STORE_PAGE_NULL); diff --git a/store/source/stordata.cxx b/store/source/stordata.cxx index f16c4226a52e..2b8d723290ab 100644 --- a/store/source/stordata.cxx +++ b/store/source/stordata.cxx @@ -20,6 +20,7 @@ #include "stordata.hxx" #include "sal/types.h" +#include "sal/log.hxx" #include "osl/diagnose.h" #include "store/types.h" @@ -624,9 +625,11 @@ OStoreDirectoryPageObject::scope ( // Verify reduction. n = index1 * nCapacity + index0; - OSL_POSTCOND(n == nPage, "wrong math on indirect indices"); if (n != nPage) + { + SAL_WARN("store", "wrong math on indirect indices"); return page::SCOPE_UNKNOWN; + } // Setup LinkDescriptor indices. rDescr.m_nIndex0 = (sal_uInt16)(index0 & 0xffff); @@ -656,9 +659,11 @@ OStoreDirectoryPageObject::scope ( // Verify reduction. n = index2 * nCapacity * nCapacity + index1 * nCapacity + index0; - OSL_POSTCOND(n == nPage, "wrong math on double indirect indices"); if (n != nPage) + { + SAL_WARN("store", "wrong math on double indirect indices"); return page::SCOPE_UNKNOWN; + } // Setup LinkDescriptor indices. rDescr.m_nIndex0 = (sal_uInt16)(index0 & 0xffff); @@ -694,9 +699,11 @@ OStoreDirectoryPageObject::scope ( n = index3 * nCapacity * nCapacity * nCapacity + index2 * nCapacity * nCapacity + index1 * nCapacity + index0; - OSL_POSTCOND(n == nPage, "wrong math on triple indirect indices"); if (n != nPage) + { + SAL_WARN("store", "wrong math on triple indirect indices"); return page::SCOPE_UNKNOWN; + } // Setup LinkDescriptor indices. rDescr.m_nIndex0 = (sal_uInt16)(index0 & 0xffff); diff --git a/store/source/storpage.cxx b/store/source/storpage.cxx index 2d222fd9dba7..28fd2191501e 100644 --- a/store/source/storpage.cxx +++ b/store/source/storpage.cxx @@ -20,6 +20,7 @@ #include "storpage.hxx" #include "sal/types.h" +#include "sal/log.hxx" #include "rtl/string.h" #include "rtl/ref.hxx" #include "osl/diagnose.h" @@ -128,7 +129,7 @@ storeError OStorePageManager::find_lookup ( // Greater or Equal. PageHolderObject< page > xPage (rNode.get()); - OSL_POSTCOND(rIndex < xPage->usageCount(), "store::PageManager::find_lookup(): logic error"); + SAL_WARN_IF(rIndex >= xPage->usageCount(), "store", "store::PageManager::find_lookup(): logic error"); entry e (xPage->m_pData[rIndex]); // Check for exact match. @@ -200,8 +201,9 @@ storeError OStorePageManager::remove_Impl (entry & rEntry) result = rEntry.compare (xPage->m_pData[i]); } - OSL_POSTCOND( - result != entry::COMPARE_LESS, + SAL_WARN_IF( + result == entry::COMPARE_LESS, + "store", "OStorePageManager::remove(): find failed"); // Check entry comparison. diff --git a/store/source/stortree.cxx b/store/source/stortree.cxx index 3a5dbe57eb29..8e91cf03dfa6 100644 --- a/store/source/stortree.cxx +++ b/store/source/stortree.cxx @@ -20,6 +20,7 @@ #include "stortree.hxx" #include "sal/types.h" +#include "sal/log.hxx" #include "osl/diagnose.h" #include "store/types.h" @@ -293,12 +294,11 @@ storeError OStoreBTreeNodeObject::remove ( * testInvariant. * Precond: root node page loaded. */ -bool OStoreBTreeRootObject::testInvariant (char const * message) +void OStoreBTreeRootObject::testInvariant (char const * message) { OSL_PRECOND(m_xPage.get() != 0, "OStoreBTreeRootObject::testInvariant(): Null pointer"); bool result = ((m_xPage->location() - m_xPage->size()) == 0); - OSL_POSTCOND(result, message); (void) message; - return result; + SAL_WARN_IF( !result, "store", message); } /* @@ -321,7 +321,7 @@ storeError OStoreBTreeRootObject::loadOrCreate ( return eErrCode; // Notify caller of the creation. - (void) testInvariant("OStoreBTreeRootObject::loadOrCreate(): leave"); + testInvariant("OStoreBTreeRootObject::loadOrCreate(): leave"); return store_E_Pending; } @@ -333,7 +333,7 @@ storeError OStoreBTreeRootObject::change ( OStorePageBIOS & rBIOS) { PageHolderObject< page > xPage (m_xPage); - (void) testInvariant("OStoreBTreeRootObject::change(): enter"); + testInvariant("OStoreBTreeRootObject::change(): enter"); // Save root location. sal_uInt32 const nRootAddr = xPage->location(); @@ -362,7 +362,7 @@ storeError OStoreBTreeRootObject::change ( // Save this as new root and finish. eErrCode = rBIOS.saveObjectAt (*this, nRootAddr); - (void) testInvariant("OStoreBTreeRootObject::change(): leave"); + testInvariant("OStoreBTreeRootObject::change(): leave"); return eErrCode; } @@ -377,7 +377,7 @@ storeError OStoreBTreeRootObject::find_lookup ( OStorePageBIOS & rBIOS) { // Init node w/ root page. - (void) testInvariant("OStoreBTreeRootObject::find_lookup(): enter"); + testInvariant("OStoreBTreeRootObject::find_lookup(): enter"); { PageHolder tmp (m_xPage); tmp.swap (rNode.get()); @@ -422,12 +422,14 @@ storeError OStoreBTreeRootObject::find_lookup ( // Compare entry. T::CompareResult eResult = entry.compare(rPage.m_pData[rIndex]); - OSL_POSTCOND(eResult != T::COMPARE_LESS, "store::BTreeRoot::find_lookup(): sort error"); if (eResult == T::COMPARE_LESS) + { + SAL_WARN("store", "store::BTreeRoot::find_lookup(): sort error"); return store_E_Unknown; + } // Greater or Equal. - (void) testInvariant("OStoreBTreeRootObject::find_lookup(): leave"); + testInvariant("OStoreBTreeRootObject::find_lookup(): leave"); return store_E_None; } @@ -441,7 +443,7 @@ storeError OStoreBTreeRootObject::find_insert ( OStorePageKey const & rKey, OStorePageBIOS & rBIOS) { - (void) testInvariant("OStoreBTreeRootObject::find_insert(): enter"); + testInvariant("OStoreBTreeRootObject::find_insert(): enter"); // Check for RootNode split. PageHolderObject< page > xRoot (m_xPage); @@ -522,16 +524,18 @@ storeError OStoreBTreeRootObject::find_insert ( { // Compare entry. T::CompareResult result = entry.compare (rPage.m_pData[rIndex]); - OSL_POSTCOND(result != T::COMPARE_LESS, "store::BTreeRoot::find_insert(): sort error"); if (result == T::COMPARE_LESS) + { + SAL_WARN("store", "store::BTreeRoot::find_insert(): sort error"); return store_E_Unknown; + } if (result == T::COMPARE_EQUAL) return store_E_AlreadyExists; } // Greater or not (yet) existing. - (void) testInvariant("OStoreBTreeRootObject::find_insert(): leave"); + testInvariant("OStoreBTreeRootObject::find_insert(): leave"); return store_E_None; } diff --git a/store/source/stortree.hxx b/store/source/stortree.hxx index 240ccf6f6e69..eca43bae5877 100644 --- a/store/source/stortree.hxx +++ b/store/source/stortree.hxx @@ -312,7 +312,7 @@ private: /** testInvariant. * Precond: root node page loaded. */ - bool testInvariant (char const * message); + void testInvariant (char const * message); /** change (Root). * diff --git a/store/workben/t_store.cxx b/store/workben/t_store.cxx index 25ce3f7be9a6..455f053a72ec 100644 --- a/store/workben/t_store.cxx +++ b/store/workben/t_store.cxx @@ -426,9 +426,9 @@ int SAL_CALL main (int argc, char **argv) eErrCode = aFile.symlink ( aPath, OUString("000000/"), OUString(), aPath); - OSL_POSTCOND( - ((eErrCode == store_E_None ) || - (eErrCode == store_E_AlreadyExists) ), + SAL_WARN_IF( + eErrCode != store_E_None && eErrCode != store_E_AlreadyExists, + "store", "t_store::main(): store_symlink() failed"); // Create symlink to file. @@ -437,9 +437,9 @@ int SAL_CALL main (int argc, char **argv) eErrCode = aFile.symlink ( aPath, aLinkName, aPath, OUString("demostor-1.dat")); - OSL_POSTCOND( - ((eErrCode == store_E_None ) || - (eErrCode == store_E_AlreadyExists) ), + SAL_WARN_IF( + eErrCode != store_E_None && eErrCode != store_E_AlreadyExists, + "store", "t_store::main(): store_symlink() failed"); if ((eErrCode == store_E_None ) || (eErrCode == store_E_AlreadyExists) ) @@ -449,9 +449,9 @@ int SAL_CALL main (int argc, char **argv) eErrCode = aFile.rename ( aPath, aLinkName, aPath, aShortcut); - OSL_POSTCOND( - ((eErrCode == store_E_None ) || - (eErrCode == store_E_AlreadyExists) ), + SAL_WARN_IF( + eErrCode != store_E_None && eErrCode != store_E_AlreadyExists, + "store", "t_store::main(): store_rename() failed"); } @@ -461,12 +461,9 @@ int SAL_CALL main (int argc, char **argv) eErrCode = aDir.create ( aFile, aPath, aDirName, store_AccessReadCreate); - OSL_POSTCOND( - (eErrCode == store_E_None), + SAL_WARN_IF( + eErrCode != store_E_None, "t_store::main(): store_createDirectory() failed"); - if (eErrCode == store_E_None) - { - } } // Directory iteration. |