This commit is contained in:
Hongze Cheng 2022-03-11 09:00:05 +00:00
parent b2106710a9
commit 0bf8d78c2a
2 changed files with 7 additions and 7 deletions

View File

@ -357,8 +357,8 @@ static int tdbBtreeZeroPage(SPage *pPage, void *arg) {
// Init the page header // Init the page header
pPage->pPageHdr->flags = flags; pPage->pPageHdr->flags = flags;
pPage->pPageHdr->nCells = 0; pPage->pPageHdr->nCells = 0;
pPage->pPageHdr->cellCont = pBt->pageSize; pPage->pPageHdr->cCells = pBt->pageSize;
pPage->pPageHdr->freeCell = 0; pPage->pPageHdr->fCell = 0;
pPage->pPageHdr->nFree = 0; pPage->pPageHdr->nFree = 0;
TDB_BTREE_ASSERT_FLAG(flags); TDB_BTREE_ASSERT_FLAG(flags);

View File

@ -26,8 +26,8 @@ typedef u8 SCell;
typedef struct __attribute__((__packed__)) { typedef struct __attribute__((__packed__)) {
u16 flags; u16 flags;
u16 nCells; u16 nCells;
u16 cellCont; u16 cCells;
u16 freeCell; u16 fCell;
u16 nFree; u16 nFree;
} SPageHdr; } SPageHdr;
@ -35,8 +35,8 @@ typedef struct __attribute__((__packed__)) {
typedef struct __attribute__((__packed__)) { typedef struct __attribute__((__packed__)) {
u16 flags; u16 flags;
u8 nCells[3]; u8 nCells[3];
u8 cellCont[3]; u8 cCells[3];
u8 freeCell[3]; u8 fCell[3];
u8 nFree[3]; u8 nFree[3];
} SLPageHdr; } SLPageHdr;
@ -85,7 +85,7 @@ struct SPage {
}) })
/* For page */ /* For page */
#define TDB_PAGE_FLAGS(pPage) (TDB_IS_LARGE_PAGE(pPage) ? TDB_LPAGE_FLAGS(pPage)) : TDB_SPAGE_FLAGS(pPage)) #define TDB_PAGE_FLAGS(pPage) (TDB_IS_LARGE_PAGE(pPage) ? TDB_LPAGE_FLAGS(pPage)) : TDB_SPAGE_FLAGS(pPage))
#define TDB_PAGE_CELL_OFFSET_AT(pPage, idx) \ #define TDB_PAGE_CELL_OFFSET_AT(pPage, idx) \
(((pPage)->szOffset == 2) ? ((u16 *)((pPage)->aCellIdx))[idx] \ (((pPage)->szOffset == 2) ? ((u16 *)((pPage)->aCellIdx))[idx] \
: ((pPage)->aCellIdx[idx * 3] * 65536 + *(u16 *)((pPage)->aCellIdx + idx * 3 + 1))) : ((pPage)->aCellIdx[idx * 3] * 65536 + *(u16 *)((pPage)->aCellIdx + idx * 3 + 1)))