This commit is contained in:
Hongze Cheng 2022-03-16 02:42:57 +00:00
parent 07f6afe73e
commit ec3cb6fd9c
2 changed files with 3 additions and 3 deletions

View File

@ -794,8 +794,8 @@ static int tdbBtreeDecodePayload(SPage *pPage, const u8 *pPayload, SCellDecoder
if (nPayload <= pPage->maxLocal) { if (nPayload <= pPage->maxLocal) {
// General case without overflow // General case without overflow
pDecoder->pKey = (void *)pPayload; pDecoder->pKey = (void *)pPayload;
if (pDecoder->pVal) { if (!pDecoder->pVal) {
pDecoder->pVal = (void *)(pPayload + pDecoder->vLen); pDecoder->pVal = (void *)(pPayload + pDecoder->kLen);
} }
} }

View File

@ -137,7 +137,7 @@ int tdbPageInsertCell(SPage *pPage, int idx, SCell *pCell, int szCell) {
} }
memcpy(pTarget, pCell, szCell); memcpy(pTarget, pCell, szCell);
pTmp = pPage->pCellIdx + idx + pPage->szOffset; pTmp = pPage->pCellIdx + idx * pPage->szOffset;
memmove(pTmp, pTmp + pPage->szOffset, pPage->pFreeStart - pTmp - pPage->szOffset); memmove(pTmp, pTmp + pPage->szOffset, pPage->pFreeStart - pTmp - pPage->szOffset);
TDB_PAGE_CELL_OFFSET_AT_SET(pPage, idx, pTarget - pPage->pData); TDB_PAGE_CELL_OFFSET_AT_SET(pPage, idx, pTarget - pPage->pData);
TDB_PAGE_NCELLS_SET(pPage, TDB_PAGE_NCELLS(pPage) + 1); TDB_PAGE_NCELLS_SET(pPage, TDB_PAGE_NCELLS(pPage) + 1);