From 7a1c21e53fc4733a4bb52282ce0098fcc085ab0e Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Wed, 22 Nov 2017 09:33:32 +0200 Subject: loplugin:simplifybool for negation of comparison operator Change-Id: Ie56daf560185274754afbc7a09c432b5c2793791 Reviewed-on: https://gerrit.libreoffice.org/45068 Tested-by: Jenkins Reviewed-by: Noel Grandin --- store/source/lockbyte.cxx | 8 ++++---- store/source/stordata.cxx | 6 +++--- store/source/storpage.cxx | 6 +++--- store/source/stortree.cxx | 10 +++++----- store/source/stortree.hxx | 2 +- 5 files changed, 16 insertions(+), 16 deletions(-) (limited to 'store/source') diff --git a/store/source/lockbyte.cxx b/store/source/lockbyte.cxx index 4c8aa0c5f5eb..09240505a7fb 100644 --- a/store/source/lockbyte.cxx +++ b/store/source/lockbyte.cxx @@ -80,11 +80,11 @@ storeError ILockBytes::readAt (sal_uInt32 nOffset, void * pBuffer, sal_uInt32 nB { // [SECURITY:ValInput] sal_uInt8 * dst_lo = static_cast(pBuffer); - if (!(dst_lo != nullptr)) + if (dst_lo == nullptr) return store_E_InvalidParameter; sal_uInt8 * dst_hi = dst_lo + nBytes; - if (!(dst_lo < dst_hi)) + if (dst_lo >= dst_hi) return (dst_lo > dst_hi) ? store_E_InvalidParameter : store_E_None; OSL_PRECOND(!(nOffset == STORE_PAGE_NULL), "store::ILockBytes::readAt(): invalid Offset"); @@ -102,11 +102,11 @@ storeError ILockBytes::writeAt (sal_uInt32 nOffset, void const * pBuffer, sal_uI { // [SECURITY:ValInput] sal_uInt8 const * src_lo = static_cast(pBuffer); - if (!(src_lo != nullptr)) + if (src_lo == nullptr) return store_E_InvalidParameter; sal_uInt8 const * src_hi = src_lo + nBytes; - if (!(src_lo < src_hi)) + if (src_lo >= src_hi) return (src_lo > src_hi) ? store_E_InvalidParameter : store_E_None; OSL_PRECOND(!(nOffset == STORE_PAGE_NULL), "store::ILockBytes::writeAt(): invalid Offset"); diff --git a/store/source/stordata.cxx b/store/source/stordata.cxx index 27942d33ca11..d18592fd2bff 100644 --- a/store/source/stordata.cxx +++ b/store/source/stordata.cxx @@ -218,7 +218,7 @@ storeError OStoreIndirectionPageObject::read ( // Check arguments. sal_uInt16 const nLimit = rPage.capacityCount(); - if (!(nSingle < nLimit)) + if (nSingle >= nLimit) return store_E_InvalidAccess; // Obtain data page location. @@ -308,7 +308,7 @@ storeError OStoreIndirectionPageObject::write ( // Check arguments. sal_uInt16 const nLimit = rPage.capacityCount(); - if (!(nSingle < nLimit)) + if (nSingle >= nLimit) return store_E_InvalidAccess; // Obtain data page location. @@ -416,7 +416,7 @@ storeError OStoreIndirectionPageObject::truncate ( // Check arguments. sal_uInt16 const nLimit = rPage.capacityCount(); - if (!(nSingle < nLimit)) + if (nSingle >= nLimit) return store_E_InvalidAccess; // Truncate. diff --git a/store/source/storpage.cxx b/store/source/storpage.cxx index a4b573219a95..d441121e0ac4 100644 --- a/store/source/storpage.cxx +++ b/store/source/storpage.cxx @@ -160,7 +160,7 @@ storeError OStorePageManager::remove_Impl (entry & rEntry) // Check current page index. PageHolderObject< page > xPage (aNode.get()); sal_uInt16 i = xPage->find (rEntry), n = xPage->usageCount(); - if (!(i < n)) + if (i >= n) { // Path to entry not exists (Must not happen(?)). return store_E_NotExists; @@ -191,7 +191,7 @@ storeError OStorePageManager::remove_Impl (entry & rEntry) // Check index. i = xPage->find (rEntry); n = xPage->usageCount(); - if (!(i < n)) + if (i >= n) { // Path to entry not exists (Must not happen(?)). return store_E_NotExists; @@ -229,7 +229,7 @@ storeError OStorePageManager::namei ( return store_E_InvalidParameter; // Check name length. - if (!(pName->length < STORE_MAXIMUM_NAMESIZE)) + if (pName->length >= STORE_MAXIMUM_NAMESIZE) return store_E_NameTooLong; // Transform pathname into key. diff --git a/store/source/stortree.cxx b/store/source/stortree.cxx index c4afa028c598..8733e9bf12bf 100644 --- a/store/source/stortree.cxx +++ b/store/source/stortree.cxx @@ -232,7 +232,7 @@ storeError OStoreBTreeNodeObject::remove ( { // Check link entry. T const aEntryL (rPage.m_pData[nIndexL]); - if (!(rEntryL.compare (aEntryL) == T::COMPARE_EQUAL)) + if (rEntryL.compare (aEntryL) != T::COMPARE_EQUAL) return store_E_InvalidAccess; // Load link node. @@ -270,7 +270,7 @@ storeError OStoreBTreeNodeObject::remove ( else { // Check leaf entry. - if (!(rEntryL.compare (rPage.m_pData[nIndexL]) == T::COMPARE_EQUAL)) + if (rEntryL.compare (rPage.m_pData[nIndexL]) != T::COMPARE_EQUAL) return store_E_NotExists; // Save leaf entry. @@ -400,7 +400,7 @@ storeError OStoreBTreeRootObject::find_lookup ( page const & rPage = (*xPage); sal_uInt16 const i = rPage.find(entry); sal_uInt16 const n = rPage.usageCount(); - if (!(i < n)) + if (i >= n) { // Path to entry not exists (Must not happen(?)). return store_E_NotExists; @@ -423,7 +423,7 @@ storeError OStoreBTreeRootObject::find_lookup ( // Find index. page const & rPage = (*xPage); rIndex = rPage.find(entry); - if (!(rIndex < rPage.usageCount())) + if (rIndex >= rPage.usageCount()) return store_E_NotExists; // Compare entry. @@ -485,7 +485,7 @@ storeError OStoreBTreeRootObject::find_insert ( page const & rPage = (*xPage); sal_uInt16 const i = rPage.find (entry); sal_uInt16 const n = rPage.usageCount(); - if (!(i < n)) + if (i >= n) { // Path to entry not exists (Must not happen(?)). return store_E_NotExists; diff --git a/store/source/stortree.hxx b/store/source/stortree.hxx index 6c8a9fa70f36..547f548c3a95 100644 --- a/store/source/stortree.hxx +++ b/store/source/stortree.hxx @@ -176,7 +176,7 @@ struct OStoreBTreeNodeData : public store::PageData */ bool querySplit() const { - return (!(usageCount() < capacityCount())); + return usageCount() >= capacityCount(); } /** Operation. -- cgit v1.2.3