From 16275caa8d05c5a8d74a5690677d7907e793fa93 Mon Sep 17 00:00:00 2001 From: Minglei Jin Date: Thu, 20 Oct 2022 15:39:37 +0800 Subject: [PATCH] fix(tdb): typo casues large page crash --- source/libs/tdb/src/db/tdbBtree.c | 4 ++-- source/libs/tdb/src/db/tdbPage.c | 2 +- source/libs/tdb/src/db/tdbPager.c | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/source/libs/tdb/src/db/tdbBtree.c b/source/libs/tdb/src/db/tdbBtree.c index ba0b3dbcf8..3f36a058e5 100644 --- a/source/libs/tdb/src/db/tdbBtree.c +++ b/source/libs/tdb/src/db/tdbBtree.c @@ -371,7 +371,7 @@ static int tdbDefaultKeyCmprFn(const void *pKey1, int keyLen1, const void *pKey2 } return cret; } - +/* static int tdbBtreeOpenImpl(SBTree *pBt) { // Try to get the root page of the an existing btree SPgno pgno; @@ -400,7 +400,7 @@ static int tdbBtreeOpenImpl(SBTree *pBt) { pBt->root = pgno; return 0; } - +*/ int tdbBtreeInitPage(SPage *pPage, void *arg, int init) { SBTree *pBt; u8 flags; diff --git a/source/libs/tdb/src/db/tdbPage.c b/source/libs/tdb/src/db/tdbPage.c index f4878ea861..016ad65cf3 100644 --- a/source/libs/tdb/src/db/tdbPage.c +++ b/source/libs/tdb/src/db/tdbPage.c @@ -586,7 +586,7 @@ static inline void setLPageNFree(SPage *pPage, int nFree) { // cell offset static inline int getLPageCellOffset(SPage *pPage, int idx) { - ASSERT(idx >= 0 && idx < getPageCellNum(pPage)); + ASSERT(idx >= 0 && idx < getLPageCellNum(pPage)); return TDB_GET_U24(pPage->pCellIdx + 3 * idx); } diff --git a/source/libs/tdb/src/db/tdbPager.c b/source/libs/tdb/src/db/tdbPager.c index 88729f0b69..cee54c1a73 100644 --- a/source/libs/tdb/src/db/tdbPager.c +++ b/source/libs/tdb/src/db/tdbPager.c @@ -116,7 +116,7 @@ int tdbPagerClose(SPager *pPager) { } return 0; } - +/* int tdbPagerOpenDB(SPager *pPager, SPgno *ppgno, bool toCreate, SBTree *pBt) { SPgno pgno; SPage *pPage; @@ -167,7 +167,7 @@ int tdbPagerOpenDB(SPager *pPager, SPgno *ppgno, bool toCreate, SBTree *pBt) { *ppgno = pgno; return 0; } - +*/ int tdbPagerWrite(SPager *pPager, SPage *pPage) { int ret; SPage **ppPage;