Lines Matching refs:idx
370 int idx; /* Index of the entry in pPage->apCell[] */ member
521 u16 *pIdx, idx; in freeSpace() local
532 idx = SWAB16(pBt, *pIdx); in freeSpace()
533 while( idx!=0 && idx<start ){ in freeSpace()
534 pFBlk = (FreeBlk*)&pPage->u.aDisk[idx]; in freeSpace()
536 if( idx + iSize == start ){ in freeSpace()
538 if( idx + iSize + size == SWAB16(pBt, pFBlk->iNext) ){ in freeSpace()
539 pNext = (FreeBlk*)&pPage->u.aDisk[idx + iSize + size]; in freeSpace()
551 idx = SWAB16(pBt, *pIdx); in freeSpace()
554 if( idx != end ){ in freeSpace()
556 pNew->iNext = SWAB16(pBt, idx); in freeSpace()
558 pNext = (FreeBlk*)&pPage->u.aDisk[idx]; in freeSpace()
581 int idx; /* An index into pPage->u.aDisk[] */ in initPage() local
599 idx = SWAB16(pBt, pPage->u.hdr.firstCell); in initPage()
600 while( idx!=0 ){ in initPage()
601 if( idx>SQLITE_USABLE_SIZE-MIN_CELL_SIZE ) goto page_format_error; in initPage()
602 if( idx<sizeof(PageHdr) ) goto page_format_error; in initPage()
603 if( idx!=ROUNDUP(idx) ) goto page_format_error; in initPage()
604 pCell = (Cell*)&pPage->u.aDisk[idx]; in initPage()
606 if( idx+sz > SQLITE_USABLE_SIZE ) goto page_format_error; in initPage()
609 idx = SWAB16(pBt, pCell->h.iNext); in initPage()
612 idx = SWAB16(pBt, pPage->u.hdr.firstFree); in initPage()
613 while( idx!=0 ){ in initPage()
615 if( idx>SQLITE_USABLE_SIZE-sizeof(FreeBlk) ) goto page_format_error; in initPage()
616 if( idx<sizeof(PageHdr) ) goto page_format_error; in initPage()
617 pFBlk = (FreeBlk*)&pPage->u.aDisk[idx]; in initPage()
620 if( iNext>0 && iNext <= idx ) goto page_format_error; in initPage()
621 idx = iNext; in initPage()
1067 pCur->idx = 0; in fileBtreeCursor()
1159 if( pCur->idx >= pPage->nCell ){ in fileBtreeKeySize()
1162 pCell = pPage->apCell[pCur->idx]; in fileBtreeKeySize()
1182 assert( pCur->idx>=0 && pCur->idx<pCur->pPage->nCell ); in getPayload()
1183 aPayload = pCur->pPage->apCell[pCur->idx]->aPayload; in getPayload()
1200 nextPage = SWAB32(pBt, pCur->pPage->apCell[pCur->idx]->ovfl); in getPayload()
1249 if( pCur->idx >= pPage->nCell ){ in fileBtreeKey()
1252 assert( amt+offset <= NKEY(pCur->pBt, pPage->apCell[pCur->idx]->h) ); in fileBtreeKey()
1270 if( pCur->idx >= pPage->nCell ){ in fileBtreeDataSize()
1273 pCell = pPage->apCell[pCur->idx]; in fileBtreeDataSize()
1295 if( pCur->idx >= pPage->nCell ){ in fileBtreeData()
1298 pCell = pPage->apCell[pCur->idx]; in fileBtreeData()
1339 assert( pCur->idx>=0 && pCur->idx<pCur->pPage->nCell ); in fileBtreeKeyCompare()
1340 pCell = pCur->pPage->apCell[pCur->idx]; in fileBtreeKeyCompare()
1401 assert( pCur->idx>=pCur->pPage->nCell in moveToChild()
1402 || pCur->pPage->apCell[pCur->idx]->h.leftChild==SWAB32(pBt,newPgno) ); in moveToChild()
1403 assert( pCur->idx<pCur->pPage->nCell in moveToChild()
1405 pNewPage->idxParent = pCur->idx; in moveToChild()
1409 pCur->idx = 0; in moveToChild()
1439 pCur->idx = idxParent; in moveToParent()
1445 if( pCur->idx<pParent->nCell ){ in moveToParent()
1458 pCur->idx = pParent->nCell; in moveToParent()
1462 pCur->idx = i; in moveToParent()
1483 pCur->idx = 0; in moveToRoot()
1495 while( (pgno = pCur->pPage->apCell[pCur->idx]->h.leftChild)!=0 ){ in moveToLeftmost()
1514 pCur->idx = pCur->pPage->nCell; in moveToRightmost()
1518 pCur->idx = pCur->pPage->nCell - 1; in moveToRightmost()
1599 pCur->idx = (lwr+upr)/2; in fileBtreeMoveto()
1608 lwr = pCur->idx+1; in fileBtreeMoveto()
1610 upr = pCur->idx-1; in fileBtreeMoveto()
1625 pCur->idx = lwr; in fileBtreeMoveto()
1652 assert( pCur->idx<pPage->nCell ); in fileBtreeNext()
1659 pCur->idx++; in fileBtreeNext()
1660 if( pCur->idx>=pPage->nCell ){ in fileBtreeNext()
1675 }while( pCur->idx>=pPage->nCell ); in fileBtreeNext()
1714 assert( pCur->idx>=0 ); in fileBtreePrevious()
1715 if( (pgno = pPage->apCell[pCur->idx]->h.leftChild)!=0 ){ in fileBtreePrevious()
1720 while( pCur->idx==0 ){ in fileBtreePrevious()
1728 pCur->idx--; in fileBtreePrevious()
1983 static void reparentPage(Pager *pPager, Pgno pgno, MemPage *pNewParent,int idx){ in reparentPage() argument
1995 pThis->idxParent = idx; in reparentPage()
2031 static void dropCell(Btree *pBt, MemPage *pPage, int idx, int sz){ in dropCell() argument
2033 assert( idx>=0 && idx<pPage->nCell ); in dropCell()
2034 assert( sz==cellSize(pBt, pPage->apCell[idx]) ); in dropCell()
2036 freeSpace(pBt, pPage, Addr(pPage->apCell[idx]) - Addr(pPage), sz); in dropCell()
2037 for(j=idx; j<pPage->nCell-1; j++){ in dropCell()
2058 int idx, j; in insertCell() local
2062 idx = allocateSpace(pBt, pPage, sz); in insertCell()
2067 if( idx<=0 ){ in insertCell()
2071 memcpy(&pPage->u.aDisk[idx], pCell, sz); in insertCell()
2072 pPage->apCell[i] = (Cell*)&pPage->u.aDisk[idx]; in insertCell()
2089 int idx = Addr(pPage->apCell[i]) - Addr(pPage); in relinkCellList() local
2090 assert( idx>0 && idx<SQLITE_USABLE_SIZE ); in relinkCellList()
2091 *pIdx = SWAB16(pBt, idx); in relinkCellList()
2186 int idx; /* Index of pPage in pParent->apCell[] */ in balance() local
2302 for(idx=0; idx<pParent->nCell; idx++){ in balance()
2303 if( pParent->apCell[idx]->h.leftChild==swabPgno ){ in balance()
2307 assert( idx<pParent->nCell || pParent->u.hdr.rightChild==swabPgno ); in balance()
2309 idx = pPage->idxParent; in balance()
2326 nxDiv = idx - NN; in balance()
2365 iCur += pCur->idx; in balance()
2369 if( i<nOld-1 && pCur->pPage==pParent && pCur->idx==idxDiv[i] ){ in balance()
2515 if( pCur && iCur==j ){ pCur->pPage = pNew; pCur->idx = pNew->nCell; } in balance()
2525 if( pCur && iCur==j ){ pCur->pPage = pParent; pCur->idx = nxDiv; } in balance()
2539 if( j<=iCur && pCur->pPage==pParent && pCur->idx>idxDiv[nOld-1] ){ in balance()
2541 pCur->idx += nNew - nOld; in balance()
2577 pCur->idx = 0; in balance()
2655 newCell.h.leftChild = pPage->apCell[pCur->idx]->h.leftChild; in fileBtreeInsert()
2656 rc = clearCell(pBt, pPage->apCell[pCur->idx]); in fileBtreeInsert()
2658 dropCell(pBt, pPage, pCur->idx, cellSize(pBt, pPage->apCell[pCur->idx])); in fileBtreeInsert()
2661 pCur->idx++; in fileBtreeInsert()
2665 insertCell(pBt, pPage, pCur->idx, &newCell, szNew); in fileBtreeInsert()
2703 if( pCur->idx >= pPage->nCell ){ in fileBtreeDelete()
2714 pCell = pPage->apCell[pCur->idx]; in fileBtreeDelete()
2737 dropCell(pBt, pPage, pCur->idx, cellSize(pBt, pCell)); in fileBtreeDelete()
2738 pNext = leafCur.pPage->apCell[leafCur.idx]; in fileBtreeDelete()
2741 insertCell(pBt, pPage, pCur->idx, pNext, szNext); in fileBtreeDelete()
2745 dropCell(pBt, leafCur.pPage, leafCur.idx, szNext); in fileBtreeDelete()
2749 dropCell(pBt, pPage, pCur->idx, cellSize(pBt, pCell)); in fileBtreeDelete()
2750 if( pCur->idx>=pPage->nCell ){ in fileBtreeDelete()
2751 pCur->idx = pPage->nCell-1; in fileBtreeDelete()
2752 if( pCur->idx<0 ){ in fileBtreeDelete()
2753 pCur->idx = 0; in fileBtreeDelete()
2804 int idx; in clearDatabasePage() local
2812 idx = SWAB16(pBt, pPage->u.hdr.firstCell); in clearDatabasePage()
2813 while( idx>0 ){ in clearDatabasePage()
2814 pCell = (Cell*)&pPage->u.aDisk[idx]; in clearDatabasePage()
2815 idx = SWAB16(pBt, pCell->h.iNext); in clearDatabasePage()
2950 int idx;
2960 idx = SWAB16(pBt, pPage->u.hdr.firstCell);
2961 while( idx>0 ){
2962 pCell = (Cell*)&pPage->u.aDisk[idx];
2963 idx = SWAB16(pBt, pCell->h.iNext);
3039 u16 idx; in fileBtreePageDump() local
3048 idx = SWAB16(pBt, pPage->u.hdr.firstCell); in fileBtreePageDump()
3049 while( idx>0 && idx<=SQLITE_USABLE_SIZE-MIN_CELL_SIZE ){ in fileBtreePageDump()
3050 Cell *pCell = (Cell*)&pPage->u.aDisk[idx]; in fileBtreePageDump()
3052 sprintf(range,"%d..%d", idx, idx+sz-1); in fileBtreePageDump()
3070 idx = SWAB16(pBt, pCell->h.iNext); in fileBtreePageDump()
3072 if( idx!=0 ){ in fileBtreePageDump()
3073 printf("ERROR: next cell index out of range: %d\n", idx); in fileBtreePageDump()
3078 idx = SWAB16(pBt, pPage->u.hdr.firstFree); in fileBtreePageDump()
3079 while( idx>0 && idx<SQLITE_USABLE_SIZE ){ in fileBtreePageDump()
3080 FreeBlk *p = (FreeBlk*)&pPage->u.aDisk[idx]; in fileBtreePageDump()
3081 sprintf(range,"%d..%d", idx, idx+p->iSize-1); in fileBtreePageDump()
3085 idx = SWAB16(pBt, p->iNext); in fileBtreePageDump()
3088 if( idx!=0 ){ in fileBtreePageDump()
3089 printf("ERROR: next freeblock index out of range: %d\n", idx); in fileBtreePageDump()
3092 idx = SWAB16(pBt, pPage->u.hdr.firstCell); in fileBtreePageDump()
3093 while( idx>0 && idx<SQLITE_USABLE_SIZE-MIN_CELL_SIZE ){ in fileBtreePageDump()
3094 Cell *pCell = (Cell*)&pPage->u.aDisk[idx]; in fileBtreePageDump()
3096 idx = SWAB16(pBt, pCell->h.iNext); in fileBtreePageDump()
3122 int cnt, idx; in fileBtreeCursorDump() local
3126 aResult[1] = pCur->idx; in fileBtreeCursorDump()
3128 if( pCur->idx>=0 && pCur->idx<pPage->nCell ){ in fileBtreeCursorDump()
3129 aResult[3] = cellSize(pBt, pPage->apCell[pCur->idx]); in fileBtreeCursorDump()
3130 aResult[6] = SWAB32(pBt, pPage->apCell[pCur->idx]->h.leftChild); in fileBtreeCursorDump()
3137 idx = SWAB16(pBt, pPage->u.hdr.firstFree); in fileBtreeCursorDump()
3138 while( idx>0 && idx<SQLITE_USABLE_SIZE ){ in fileBtreeCursorDump()
3140 idx = SWAB16(pBt, ((FreeBlk*)&pPage->u.aDisk[idx])->iNext); in fileBtreeCursorDump()
3348 cur.idx = i; in checkTreePage()