Kaydet (Commit) 09d5b31e authored tarafından Noel Grandin's avatar Noel Grandin

loplugin:constantfunction: store

Change-Id: I13284409404ef77eb16164b7ce2074259d2cad12
üst 5eeec136
......@@ -751,9 +751,7 @@ public:
return store_E_InvalidAccess;
pHead->guard(nAddr);
T * pImpl = dynamic_page_cast<T>(pHead);
OSL_PRECOND(pImpl != 0, "store::PageHolder<T>::guard(): Null pointer");
pImpl->guard();
OSL_PRECOND(dynamic_page_cast<T>(pHead) != 0, "store::PageHolder<T>::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;
}
};
......
......@@ -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.
......
......@@ -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);
}
};
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment