summaryrefslogtreecommitdiff
path: root/store
diff options
context:
space:
mode:
authorMichaël Lefèvre <lefevre00@yahoo.fr>2014-04-07 11:44:43 +0200
committerStephan Bergmann <sbergman@redhat.com>2014-05-12 11:32:38 +0200
commit70e744b2157ebe48f3a5c839560fedf6521d0464 (patch)
tree4e29618cc5a36f25557bd130226abdfe96e46848 /store
parentd1516d488c081ec3a5d730d2b1626a0c8dc39a73 (diff)
fdo#43157 Remove OSL_POSTCOND, prefer SAL_WARN_IF
Change-Id: Ia89a2dce799c7ba90bcd19919195bfd2c7a4a180 Signed-off-by: Stephan Bergmann <sbergman@redhat.com>
Diffstat (limited to 'store')
-rw-r--r--store/source/lockbyte.cxx2
-rw-r--r--store/source/storbios.cxx4
-rw-r--r--store/source/stordata.cxx13
-rw-r--r--store/source/storpage.cxx8
-rw-r--r--store/source/stortree.cxx28
-rw-r--r--store/source/stortree.hxx2
-rw-r--r--store/workben/t_store.cxx25
7 files changed, 47 insertions, 35 deletions
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.