From 09d5b31ebe187a4cd9f3efca5a7cb7f87e1e19f6 Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Tue, 24 Mar 2015 09:49:29 +0200 Subject: loplugin:constantfunction: store Change-Id: I13284409404ef77eb16164b7ce2074259d2cad12 --- store/source/storbase.hxx | 6 ++---- store/source/stordata.cxx | 16 ++++++++-------- store/source/stordata.hxx | 47 ++++++++++++++++------------------------------- 3 files changed, 26 insertions(+), 43 deletions(-) (limited to 'store') diff --git a/store/source/storbase.hxx b/store/source/storbase.hxx index eb980a16320c..83b3ab68c4b9 100644 --- a/store/source/storbase.hxx +++ b/store/source/storbase.hxx @@ -751,9 +751,7 @@ public: return store_E_InvalidAccess; pHead->guard(nAddr); - T * pImpl = dynamic_page_cast(pHead); - OSL_PRECOND(pImpl != 0, "store::PageHolder::guard(): Null pointer"); - pImpl->guard(); + OSL_PRECOND(dynamic_page_cast(pHead) != 0, "store::PageHolder::guard(): Null pointer"); return store_E_None; } @@ -771,7 +769,7 @@ public: if (!pImpl) return store_E_WrongVersion; - return pImpl->verify(); + return store_E_None; } }; diff --git a/store/source/stordata.cxx b/store/source/stordata.cxx index 3b84a1c0607b..75562aa14dea 100644 --- a/store/source/stordata.cxx +++ b/store/source/stordata.cxx @@ -594,7 +594,7 @@ OStoreDirectoryPageObject::scope ( sal_uInt32 index0, index1, index2, index3; // direct. - sal_uInt32 nCount = OStoreDirectoryDataBlock::directCount(); + sal_uInt32 nCount = OStoreDirectoryDataBlock::directCount; sal_uInt32 nLimit = nCount; if (nPage < nLimit) { @@ -611,7 +611,7 @@ OStoreDirectoryPageObject::scope ( // single indirect. sal_uInt32 const nCapacity = indirect::capacityCount(rPage.m_aDescr); - nCount = OStoreDirectoryDataBlock::singleCount(); + nCount = OStoreDirectoryDataBlock::singleCount; nLimit = nCount * nCapacity; if (nPage < nLimit) { @@ -640,7 +640,7 @@ OStoreDirectoryPageObject::scope ( nPage -= nLimit; // double indirect. - nCount = OStoreDirectoryDataBlock::doubleCount(); + nCount = OStoreDirectoryDataBlock::doubleCount; nLimit = nCount * nCapacity * nCapacity; if (nPage < nLimit) { @@ -675,7 +675,7 @@ OStoreDirectoryPageObject::scope ( nPage -= nLimit; // triple indirect. - nCount = OStoreDirectoryDataBlock::tripleCount(); + nCount = OStoreDirectoryDataBlock::tripleCount; nLimit = nCount * nCapacity * nCapacity * nCapacity; if (nPage < nLimit) { @@ -1016,7 +1016,7 @@ storeError OStoreDirectoryPageObject::truncate ( if (eScope == page::SCOPE_DIRECT) { // Truncate direct data pages. - sal_uInt16 i, n = OStoreDirectoryDataBlock::directCount(); + sal_uInt16 i, n = OStoreDirectoryDataBlock::directCount; for (i = n; i > nRemain; i--) { // Obtain data page location. @@ -1039,7 +1039,7 @@ storeError OStoreDirectoryPageObject::truncate ( if (eScope == page::SCOPE_SINGLE) { // Truncate single indirect pages. - sal_uInt16 i, n = OStoreDirectoryDataBlock::singleCount(); + sal_uInt16 i, n = OStoreDirectoryDataBlock::singleCount; for (i = n; i > nRemain; i--) { // Truncate single indirect page to zero data pages. @@ -1058,7 +1058,7 @@ storeError OStoreDirectoryPageObject::truncate ( if (eScope == page::SCOPE_DOUBLE) { // Truncate double indirect pages. - sal_uInt16 i, n = OStoreDirectoryDataBlock::doubleCount(); + sal_uInt16 i, n = OStoreDirectoryDataBlock::doubleCount; for (i = n; i > nRemain; i--) { // Truncate double indirect page to zero single indirect pages. @@ -1077,7 +1077,7 @@ storeError OStoreDirectoryPageObject::truncate ( if (eScope == page::SCOPE_TRIPLE) { // Truncate triple indirect pages. - sal_uInt16 i, n = OStoreDirectoryDataBlock::tripleCount(); + sal_uInt16 i, n = OStoreDirectoryDataBlock::tripleCount; for (i = n; i > nRemain; i--) { // Truncate to zero double indirect pages. diff --git a/store/source/stordata.hxx b/store/source/stordata.hxx index ae9e916c4bd8..52bfb8ac63e7 100644 --- a/store/source/stordata.hxx +++ b/store/source/stordata.hxx @@ -87,13 +87,6 @@ struct OStoreDataPageData : public store::OStorePageData if (capacity()) memset (m_pData, 0, capacity()); } - /** guard (external representation). - */ - void guard() {} - - /** verify (external representation). - */ - storeError verify() const { return store_E_None; } }; /*======================================================================== @@ -467,77 +460,69 @@ struct OStoreDirectoryDataBlock /** direct. */ - static sal_uInt16 directCount (void) - { - return ((sal_uInt16)(STORE_LIMIT_DATAPAGE_DIRECT)); - } + static const sal_uInt16 directCount = ((sal_uInt16)(STORE_LIMIT_DATAPAGE_DIRECT)); + sal_uInt32 directLink (sal_uInt16 nIndex) const { - if (nIndex < directCount()) + if (nIndex < directCount) return store::ntohl(m_aTable.m_pDirect[nIndex]); else return STORE_PAGE_NULL; } void directLink (sal_uInt16 nIndex, sal_uInt32 nAddr) { - if (nIndex < directCount()) + if (nIndex < directCount) m_aTable.m_pDirect[nIndex] = store::htonl(nAddr); } /** single. */ - static sal_uInt16 singleCount (void) - { - return ((sal_uInt16)(STORE_LIMIT_DATAPAGE_SINGLE)); - } + static const sal_uInt16 singleCount = ((sal_uInt16)(STORE_LIMIT_DATAPAGE_SINGLE)); + sal_uInt32 singleLink (sal_uInt16 nIndex) const { - if (nIndex < singleCount()) + if (nIndex < singleCount) return store::ntohl(m_aTable.m_pSingle[nIndex]); else return STORE_PAGE_NULL; } void singleLink (sal_uInt16 nIndex, sal_uInt32 nAddr) { - if (nIndex < singleCount()) + if (nIndex < singleCount) m_aTable.m_pSingle[nIndex] = store::htonl(nAddr); } /** double. */ - static sal_uInt16 doubleCount (void) - { - return ((sal_uInt16)(STORE_LIMIT_DATAPAGE_DOUBLE)); - } + static const sal_uInt16 doubleCount = ((sal_uInt16)(STORE_LIMIT_DATAPAGE_DOUBLE)); + sal_uInt32 doubleLink (sal_uInt16 nIndex) const { - if (nIndex < doubleCount()) + if (nIndex < doubleCount) return store::ntohl(m_aTable.m_pDouble[nIndex]); else return STORE_PAGE_NULL; } void doubleLink (sal_uInt16 nIndex, sal_uInt32 nAddr) { - if (nIndex < doubleCount()) + if (nIndex < doubleCount) m_aTable.m_pDouble[nIndex] = store::htonl(nAddr); } /** triple. */ - static sal_uInt16 tripleCount (void) - { - return ((sal_uInt16)(STORE_LIMIT_DATAPAGE_TRIPLE)); - } + static const sal_uInt16 tripleCount = ((sal_uInt16)(STORE_LIMIT_DATAPAGE_TRIPLE)); + sal_uInt32 tripleLink (sal_uInt16 nIndex) const { - if (nIndex < tripleCount()) + if (nIndex < tripleCount) return store::ntohl(m_aTable.m_pTriple[nIndex]); else return STORE_PAGE_NULL; } void tripleLink (sal_uInt16 nIndex, sal_uInt32 nAddr) { - if (nIndex < tripleCount()) + if (nIndex < tripleCount) m_aTable.m_pTriple[nIndex] = store::htonl(nAddr); } }; -- cgit