Lines Matching refs:pPg

1629 static u8 *pageFindSlot(MemPage *pPg, int nByte, int *pRc){  in pageFindSlot()  argument
1630 const int hdr = pPg->hdrOffset; /* Offset to page header */ in pageFindSlot()
1631 u8 * const aData = pPg->aData; /* Page data */ in pageFindSlot()
1636 int maxPC = pPg->pBt->usableSize - nByte; /* Max address for a usable slot */ in pageFindSlot()
1661 *pRc = SQLITE_CORRUPT_PAGE(pPg); in pageFindSlot()
1676 *pRc = SQLITE_CORRUPT_PAGE(pPg); in pageFindSlot()
1683 *pRc = SQLITE_CORRUPT_PAGE(pPg); in pageFindSlot()
6512 MemPage *pPg = 0; in allocateBtreePage() local
6515 rc = btreeGetUnusedPage(pBt, pBt->nPage, &pPg, bNoContent); in allocateBtreePage()
6517 rc = sqlite3PagerWrite(pPg->pDbPage); in allocateBtreePage()
6518 releasePage(pPg); in allocateBtreePage()
7283 MemPage *pPg /* The page to be reconstructed */ in rebuildPage() argument
7285 const int hdr = pPg->hdrOffset; /* Offset of header on pPg */ in rebuildPage()
7286 u8 * const aData = pPg->aData; /* Pointer to data for pPg */ in rebuildPage()
7287 const int usableSize = pPg->pBt->usableSize; in rebuildPage()
7292 u8 *pCellptr = pPg->aCellIdx; in rebuildPage()
7293 u8 *pTmp = sqlite3PagerTempSpace(pPg->pBt->pPager); in rebuildPage()
7325 assert( sz==pPg->xCellSize(pPg, pCell) || CORRUPT_DB ); in rebuildPage()
7335 pPg->nCell = nCell; in rebuildPage()
7336 pPg->nOverflow = 0; in rebuildPage()
7339 put2byte(&aData[hdr+3], pPg->nCell); in rebuildPage()
7370 MemPage *pPg, /* Page to add cells to */ in pageInsertArray() argument
7379 u8 *aData = pPg->aData; /* Complete page */ in pageInsertArray()
7384 assert( CORRUPT_DB || pPg->hdrOffset==0 ); /* Never called on page 1 */ in pageInsertArray()
7393 if( (aData[1]==0 && aData[2]==0) || (pSlot = pageFindSlot(pPg,sz,&rc))==0 ){ in pageInsertArray()
7435 MemPage *pPg, /* Page to edit */ in pageFreeArray() argument
7440 u8 * const aData = pPg->aData; in pageFreeArray()
7441 u8 * const pEnd = &aData[pPg->pBt->usableSize]; in pageFreeArray()
7442 u8 * const pStart = &aData[pPg->hdrOffset + 8 + pPg->childPtrSize]; in pageFreeArray()
7460 freeSpace(pPg, (u16)(pFree - aData), szFree); in pageFreeArray()
7476 freeSpace(pPg, (u16)(pFree - aData), szFree); in pageFreeArray()
7494 MemPage *pPg, /* Edit this page */ in editPage() argument
7500 u8 * const aData = pPg->aData; in editPage()
7501 const int hdr = pPg->hdrOffset; in editPage()
7502 u8 *pBegin = &pPg->aCellIdx[nNew * 2]; in editPage()
7503 int nCell = pPg->nCell; /* Cells stored on pPg */ in editPage()
7507 int iOldEnd = iOld + pPg->nCell + pPg->nOverflow; in editPage()
7511 u8 *pTmp = sqlite3PagerTempSpace(pPg->pBt->pPager); in editPage()
7512 memcpy(pTmp, aData, pPg->pBt->usableSize); in editPage()
7518 int nShift = pageFreeArray(pPg, iOld, iNew-iOld, pCArray); in editPage()
7520 memmove(pPg->aCellIdx, &pPg->aCellIdx[nShift*2], nCell*2); in editPage()
7524 int nTail = pageFreeArray(pPg, iNewEnd, iOldEnd - iNewEnd, pCArray); in editPage()
7531 if( pData>pPg->aDataEnd ) goto editpage_fail; in editPage()
7538 pCellptr = pPg->aCellIdx; in editPage()
7541 pPg, pBegin, &pData, pCellptr, in editPage()
7548 for(i=0; i<pPg->nOverflow; i++){ in editPage()
7549 int iCell = (iOld + pPg->aiOvfl[i]) - iNew; in editPage()
7551 pCellptr = &pPg->aCellIdx[iCell * 2]; in editPage()
7558 pPg, pBegin, &pData, pCellptr, in editPage()
7566 pCellptr = &pPg->aCellIdx[nCell*2]; in editPage()
7568 pPg, pBegin, &pData, pCellptr, in editPage()
7572 pPg->nCell = nNew; in editPage()
7573 pPg->nOverflow = 0; in editPage()
7575 put2byte(&aData[hdr+3], pPg->nCell); in editPage()
7581 int iOff = get2byteAligned(&pPg->aCellIdx[i*2]); in editPage()
7582 if( SQLITE_WITHIN(pCell, aData, &aData[pPg->pBt->usableSize]) ){ in editPage()
7594 return rebuildPage(pCArray, iNew, nNew, pPg); in editPage()