[Libreoffice-commits] core.git: basic/source dbaccess/source fpicker/source include/sal sal/osl shell/source store/source store/workben
Michaël Lefèvre
lefevre00 at yahoo.fr
Mon May 12 02:33:16 PDT 2014
basic/source/runtime/runtime.cxx | 4 +-
dbaccess/source/core/api/resultset.cxx | 4 +-
dbaccess/source/core/recovery/subcomponentrecovery.cxx | 2 -
dbaccess/source/filter/xml/xmlExport.cxx | 2 -
dbaccess/source/ui/dlg/dsselect.cxx | 2 -
dbaccess/source/ui/misc/dbsubcomponentcontroller.cxx | 2 -
dbaccess/source/ui/uno/copytablewizard.cxx | 4 +-
fpicker/source/win32/filepicker/FilePicker.cxx | 4 +-
fpicker/source/win32/filepicker/PreviewCtrl.cxx | 2 -
fpicker/source/win32/filepicker/asynceventnotifier.cxx | 2 -
fpicker/source/win32/filepicker/dibpreview.cxx | 14 ++------
fpicker/source/win32/filepicker/filepickerstate.cxx | 4 +-
fpicker/source/win32/filepicker/getfilenamewrapper.cxx | 2 -
fpicker/source/win32/folderpicker/MtaFop.hxx | 2 -
include/sal/log-areas.dox | 2 +
sal/osl/unx/file_path_helper.cxx | 8 ++--
sal/osl/w32/file.cxx | 5 +-
sal/osl/w32/file_dirvol.cxx | 5 +-
sal/osl/w32/path_helper.cxx | 3 +
sal/osl/w32/socket.cxx | 5 +-
shell/source/win32/shlxthandler/classfactory.cxx | 6 ++-
shell/source/win32/shlxthandler/prophdl/propertyhdl.cxx | 6 ++-
store/source/lockbyte.cxx | 2 -
store/source/storbios.cxx | 4 +-
store/source/stordata.cxx | 13 +++++--
store/source/storpage.cxx | 8 ++--
store/source/stortree.cxx | 28 +++++++++-------
store/source/stortree.hxx | 2 -
store/workben/t_store.cxx | 25 ++++++--------
29 files changed, 96 insertions(+), 76 deletions(-)
New commits:
commit 70e744b2157ebe48f3a5c839560fedf6521d0464
Author: Michaël Lefèvre <lefevre00 at yahoo.fr>
Date: Mon Apr 7 11:44:43 2014 +0200
fdo#43157 Remove OSL_POSTCOND, prefer SAL_WARN_IF
Change-Id: Ia89a2dce799c7ba90bcd19919195bfd2c7a4a180
Signed-off-by: Stephan Bergmann <sbergman at redhat.com>
diff --git a/basic/source/runtime/runtime.cxx b/basic/source/runtime/runtime.cxx
index 8bfdb52..43da658 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 8f9e48a..ed356f9 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 7055ec1..c5b977e 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 7d8030f..2169f9b 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 6342466..5583bfc 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 8d59cd0..e7608d5 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 e11ba95..073f4e4 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 a8bb989..bfc75fc 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 e843182..e761e77 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 b6a61b4..6f08734 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 b8023a8..8f9d1dc 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 2e0967a..5403b81 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 84c0b6f..181ae5f 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 35076bd..6469d93 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 d70a8c1..617cec8 100644
--- a/include/sal/log-areas.dox
+++ b/include/sal/log-areas.dox
@@ -193,6 +193,7 @@ certain functionality.
@section fpicker
+ at 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
+ at 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 6c8dab1..ae3781e 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 cca3367..d51c243 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 6fb1009..2d2c9f6 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 14ee0ef..2887860 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 881c467..d215ff8 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 2c22311..d5a394f 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 8d25aef..10deb73 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 e875d1b..59bd50f 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 3a4e37f..dab0078 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 f16c422..2b8d723 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 2d222fd..28fd219 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 3a5dbe5..8e91cf0 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 240ccf6..eca43ba 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 25ce3f7..455f053 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.
More information about the Libreoffice-commits
mailing list