summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCaolán McNamara <caolan.mcnamara@collabora.com>2024-09-26 08:56:35 +0100
committerCaolán McNamara <caolan.mcnamara@collabora.com>2024-09-28 20:22:30 +0200
commit645ae19dfc1645cd49df620cc62857f399974e99 (patch)
treed84505ac1bd1caa7c002edf0355ec517174e335e
parent8536bb07ac92ecf5a4046d5bacd968c4f8ed5763 (diff)
cid#1606705 Overflowed constant
and cid#1607841 Overflowed constant Change-Id: Ia84d2c0d29e485379fe6338a784306bc8ff5343b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/174105 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
-rw-r--r--connectivity/source/drivers/dbase/dindexnode.cxx22
1 files changed, 11 insertions, 11 deletions
diff --git a/connectivity/source/drivers/dbase/dindexnode.cxx b/connectivity/source/drivers/dbase/dindexnode.cxx
index 6857679c98f1..ba439d77bef4 100644
--- a/connectivity/source/drivers/dbase/dindexnode.cxx
+++ b/connectivity/source/drivers/dbase/dindexnode.cxx
@@ -969,28 +969,28 @@ bool ONDXPage::IsFull() const
return Count() == rIndex.getHeader().db_maxkeys;
}
-
sal_uInt16 ONDXPage::Search(const ONDXKey& rSearch)
{
// binary search later
- sal_uInt16 i = NODE_NOTFOUND;
- while (++i < Count())
- if ((*this)[i].GetKey() == rSearch)
- break;
+ for (sal_uInt16 i = 0, nSize = Count(); i < nSize; ++i)
+ {
+ if (((*this)[i]).GetKey() == rSearch)
+ return i;
+ }
- return (i < Count()) ? i : NODE_NOTFOUND;
+ return NODE_NOTFOUND;
}
-
sal_uInt16 ONDXPage::Search(const ONDXPage* pPage)
{
- sal_uInt16 i = NODE_NOTFOUND;
- while (++i < Count())
+ for (sal_uInt16 i = 0, nSize = Count(); i < nSize; ++i)
+ {
if (((*this)[i]).GetChild() == pPage)
- break;
+ return i;
+ }
// if not found, then we assume, that the page itself points to the page
- return (i < Count()) ? i : NODE_NOTFOUND;
+ return NODE_NOTFOUND;
}
// runs recursively