Lines Matching refs:hdr
16041 ** free. The first block has format u.hdr. u.hdr.size4x is 4 times the
16043 ** The u.hdr.size4x&1 bit is true if the chunk is checked out and
16044 ** false if the chunk is on the freelist. The u.hdr.size4x&2 bit
16046 ** previous chunk is free. The u.hdr.prevSize field is the size of
16049 ** u.hdr.prevSize can be part of the data for that chunk and should
16065 ** the u.hdr.prevSize value of the following chunk.
16073 } hdr;
16157 assert( (mem3.aPool[i-1].u.hdr.size4x & 1)==0 );
16159 size = mem3.aPool[i-1].u.hdr.size4x/4;
16160 assert( size==mem3.aPool[i+size-1].u.hdr.prevSize );
16192 assert( (mem3.aPool[i-1].u.hdr.size4x & 1)==0 );
16193 size = mem3.aPool[i-1].u.hdr.size4x/4;
16194 assert( size==mem3.aPool[i+size-1].u.hdr.prevSize );
16243 assert( mem3.aPool[i-1].u.hdr.size4x/4==nBlock );
16244 assert( mem3.aPool[i+nBlock-1].u.hdr.prevSize==nBlock );
16245 x = mem3.aPool[i-1].u.hdr.size4x;
16246 mem3.aPool[i-1].u.hdr.size4x = nBlock*4 | 1 | (x&2);
16247 mem3.aPool[i+nBlock-1].u.hdr.prevSize = nBlock;
16248 mem3.aPool[i+nBlock-1].u.hdr.size4x |= 2;
16272 mem3.aPool[mem3.iMaster+mem3.szMaster-1].u.hdr.prevSize = nBlock;
16273 mem3.aPool[mem3.iMaster+mem3.szMaster-1].u.hdr.size4x |= 2;
16274 mem3.aPool[newi-1].u.hdr.size4x = nBlock*4 + 1;
16276 mem3.aPool[newi-1].u.hdr.prevSize = mem3.szMaster;
16277 x = mem3.aPool[mem3.iMaster-1].u.hdr.size4x & 2;
16278 mem3.aPool[mem3.iMaster-1].u.hdr.size4x = mem3.szMaster*4 | x;
16308 size = mem3.aPool[i-1].u.hdr.size4x;
16312 assert( i > mem3.aPool[i-1].u.hdr.prevSize );
16313 prev = i - mem3.aPool[i-1].u.hdr.prevSize;
16319 x = mem3.aPool[prev-1].u.hdr.size4x & 2;
16320 mem3.aPool[prev-1].u.hdr.size4x = size*4 | x;
16321 mem3.aPool[prev+size-1].u.hdr.prevSize = size;
16369 if( mem3.aPool[i-1].u.hdr.size4x/4==nBlock ){
16430 assert( (mem3.aPool[i-1].u.hdr.size4x&1)==1 );
16431 size = mem3.aPool[i-1].u.hdr.size4x/4;
16433 mem3.aPool[i-1].u.hdr.size4x &= ~1;
16434 mem3.aPool[i+size-1].u.hdr.prevSize = size;
16435 mem3.aPool[i+size-1].u.hdr.size4x &= ~2;
16440 while( (mem3.aPool[mem3.iMaster-1].u.hdr.size4x&2)==0 ){
16441 size = mem3.aPool[mem3.iMaster-1].u.hdr.prevSize;
16445 x = mem3.aPool[mem3.iMaster-1].u.hdr.size4x & 2;
16446 mem3.aPool[mem3.iMaster-1].u.hdr.size4x = mem3.szMaster*4 | x;
16447 mem3.aPool[mem3.iMaster+mem3.szMaster-1].u.hdr.prevSize = mem3.szMaster;
16449 x = mem3.aPool[mem3.iMaster-1].u.hdr.size4x & 2;
16450 while( (mem3.aPool[mem3.iMaster+mem3.szMaster-1].u.hdr.size4x&1)==0 ){
16452 mem3.szMaster += mem3.aPool[mem3.iMaster+mem3.szMaster-1].u.hdr.size4x/4;
16453 mem3.aPool[mem3.iMaster-1].u.hdr.size4x = mem3.szMaster*4 | x;
16454 mem3.aPool[mem3.iMaster+mem3.szMaster-1].u.hdr.prevSize = mem3.szMaster;
16468 assert( (pBlock[-1].u.hdr.size4x&1)!=0 );
16469 return (pBlock[-1].u.hdr.size4x&~3)*2 - 4;
16554 mem3.aPool[0].u.hdr.size4x = (mem3.szMaster<<2) + 2;
16555 mem3.aPool[mem3.nPool].u.hdr.prevSize = mem3.nPool;
16556 mem3.aPool[mem3.nPool].u.hdr.size4x = 1;
16594 size = mem3.aPool[i-1].u.hdr.size4x;
16600 if( (size&1)==0 && mem3.aPool[i+size/4-1].u.hdr.prevSize!=size/4 ){
16605 if( ((mem3.aPool[i+size/4-1].u.hdr.size4x&2)>>1)!=(size&1) ){
16622 (mem3.aPool[j-1].u.hdr.size4x/4)*8-8);
16631 (mem3.aPool[j-1].u.hdr.size4x/4)*8-8);
45762 WalIndexHdr hdr; /* Wal-index header for current transaction */
45971 ** Write the header information in pWal->hdr into the wal-index.
45973 ** The checksum on pWal->hdr is updated before it is written.
45980 pWal->hdr.isInit = 1;
45981 pWal->hdr.iVersion = WALINDEX_MAX_VERSION;
45982 walChecksumBytes(1, (u8*)&pWal->hdr, nCksum, 0, pWal->hdr.aCksum);
45983 memcpy((void *)&aHdr[1], (void *)&pWal->hdr, sizeof(WalIndexHdr));
45985 memcpy((void *)&aHdr[0], (void *)&pWal->hdr, sizeof(WalIndexHdr));
46009 u32 *aCksum = pWal->hdr.aFrameCksum;
46013 memcpy(&aFrame[8], pWal->hdr.aSalt, 8);
46015 nativeCksum = (pWal->hdr.bigEndCksum==SQLITE_BIGENDIAN);
46036 u32 *aCksum = pWal->hdr.aFrameCksum;
46043 if( memcmp(&pWal->hdr.aSalt, &aFrame[8], 8)!=0 ){
46059 nativeCksum = (pWal->hdr.bigEndCksum==SQLITE_BIGENDIAN);
46231 ** than pWal->hdr.mxFrame.
46233 ** This function is called whenever pWal->hdr.mxFrame is decreased due
46236 ** At most only the hash table containing pWal->hdr.mxFrame needs to be
46238 ** pWal->hdr.mxFrame advances to the point where those hash tables are
46250 testcase( pWal->hdr.mxFrame==HASHTABLE_NPAGE_ONE-1 );
46251 testcase( pWal->hdr.mxFrame==HASHTABLE_NPAGE_ONE );
46252 testcase( pWal->hdr.mxFrame==HASHTABLE_NPAGE_ONE+1 );
46254 if( pWal->hdr.mxFrame==0 ) return;
46257 ** the entry that corresponds to frame pWal->hdr.mxFrame. It is guaranteed
46260 assert( pWal->nWiData>walFramePage(pWal->hdr.mxFrame) );
46261 assert( pWal->apWiData[walFramePage(pWal->hdr.mxFrame)] );
46262 walHashGet(pWal, walFramePage(pWal->hdr.mxFrame), &aHash, &aPgno, &iZero);
46265 ** than pWal->hdr.mxFrame.
46267 iLimit = pWal->hdr.mxFrame - iZero;
46276 ** frame numbers greater than pWal->hdr.mxFrame.
46417 memset(&pWal->hdr, 0, sizeof(WalIndexHdr));
46456 pWal->hdr.bigEndCksum = (u8)(magic&0x00000001);
46459 memcpy(&pWal->hdr.aSalt, &aBuf[16], 8);
46462 walChecksumBytes(pWal->hdr.bigEndCksum==SQLITE_BIGENDIAN,
46463 aBuf, WAL_HDRSIZE-2*4, 0, pWal->hdr.aFrameCksum
46465 if( pWal->hdr.aFrameCksum[0]!=sqlite3Get4byte(&aBuf[24])
46466 || pWal->hdr.aFrameCksum[1]!=sqlite3Get4byte(&aBuf[28])
46505 pWal->hdr.mxFrame = iFrame;
46506 pWal->hdr.nPage = nTruncate;
46507 pWal->hdr.szPage = (u16)((szPage&0xff00) | (szPage>>16));
46510 aFrameCksum[0] = pWal->hdr.aFrameCksum[0];
46511 aFrameCksum[1] = pWal->hdr.aFrameCksum[1];
46522 pWal->hdr.aFrameCksum[0] = aFrameCksum[0];
46523 pWal->hdr.aFrameCksum[1] = aFrameCksum[1];
46540 if( pWal->hdr.nPage ){
46542 pWal->hdr.nPage, pWal->zWalName
46864 assert( pWal->ckptLock && pWal->hdr.mxFrame>0 );
46865 iLast = pWal->hdr.mxFrame;
46953 return (pWal->hdr.szPage&0xfe00) + ((pWal->hdr.szPage&0x0001)<<16);
47010 if( pInfo->nBackfill>=pWal->hdr.mxFrame ) return SQLITE_OK;
47026 mxSafeFrame = pWal->hdr.mxFrame;
47027 mxPage = pWal->hdr.nPage;
47031 assert( y<=pWal->hdr.mxFrame );
47085 i64 szDb = pWal->hdr.nPage*(i64)szPage;
47114 if( pInfo->nBackfill<pWal->hdr.mxFrame ){
47117 assert( mxSafeFrame==pWal->hdr.mxFrame );
47224 ** pWal->hdr, then pWal->hdr is updated to the content of the new header
47264 if( memcmp(&pWal->hdr, &h1, sizeof(WalIndexHdr)) ){
47266 memcpy(&pWal->hdr, &h1, sizeof(WalIndexHdr));
47267 pWal->szPage = (pWal->hdr.szPage&0xfe00) + ((pWal->hdr.szPage&0x0001)<<16);
47277 ** Read the wal-index header from the wal-index and into pWal->hdr.
47281 ** Set *pChanged to 1 if the wal-index header value in pWal->hdr is
47282 ** changed by this opertion. If pWal->hdr is unchanged, set *pChanged
47342 if( badHdr==0 && pWal->hdr.iVersion!=WALINDEX_MAX_VERSION ){
47367 ** to make a copy of the wal-index header into pWal->hdr. If the
47390 ** use WAL frames up to and including pWal->hdr.mxFrame if pWal->readLock>0
47474 if( !useWal && pInfo->nBackfill==pWal->hdr.mxFrame ){
47481 if( memcmp((void *)walIndexHdr(pWal), &pWal->hdr, sizeof(WalIndexHdr)) ){
47508 ** but not exceeding pWal->hdr.mxFrame and lock that entry.
47514 if( mxReadMark<=thisMark && thisMark<=pWal->hdr.mxFrame ){
47523 && (mxReadMark<pWal->hdr.mxFrame || mxI==0)
47528 mxReadMark = pInfo->aReadMark[i] = pWal->hdr.mxFrame;
47554 ** that occur later in the log than pWal->hdr.mxFrame may have been
47557 ** pWal->hdr.mxFrame risks reading a corrupted snapshot. So, retry
47568 || memcmp((void *)walIndexHdr(pWal), &pWal->hdr, sizeof(WalIndexHdr))
47573 assert( mxReadMark<=pWal->hdr.mxFrame );
47636 u32 iLast = pWal->hdr.mxFrame; /* Last page in WAL for this reader */
47726 sz = pWal->hdr.szPage;
47746 return pWal->hdr.nPage;
47789 if( memcmp(&pWal->hdr, (void *)walIndexHdr(pWal), sizeof(WalIndexHdr))!=0 ){
47826 Pgno iMax = pWal->hdr.mxFrame;
47832 memcpy(&pWal->hdr, (void *)walIndexHdr(pWal), sizeof(WalIndexHdr));
47834 for(iFrame=pWal->hdr.mxFrame+1;
47866 aWalData[0] = pWal->hdr.mxFrame;
47867 aWalData[1] = pWal->hdr.aFrameCksum[0];
47868 aWalData[2] = pWal->hdr.aFrameCksum[1];
47882 assert( aWalData[3]!=pWal->nCkpt || aWalData[0]<=pWal->hdr.mxFrame );
47893 if( aWalData[0]<pWal->hdr.mxFrame ){
47894 pWal->hdr.mxFrame = aWalData[0];
47895 pWal->hdr.aFrameCksum[0] = aWalData[1];
47896 pWal->hdr.aFrameCksum[1] = aWalData[2];
47909 ** it sets pWal->hdr.mxFrame to 0. Otherwise, pWal->hdr.mxFrame is left
47913 ** or not pWal->hdr.mxFrame is modified). An SQLite error code is returned
47922 assert( pInfo->nBackfill==pWal->hdr.mxFrame );
47939 u32 *aSalt = pWal->hdr.aSalt; /* Big-endian salt values */
47942 pWal->hdr.mxFrame = 0;
48068 pWal, cnt, pWal->hdr.mxFrame, isCommit ? "Commit" : "Spill"));
48073 ** log file, instead of appending to it at pWal->hdr.mxFrame.
48083 iFrame = pWal->hdr.mxFrame;
48092 if( pWal->nCkpt==0 ) sqlite3_randomness(8, pWal->hdr.aSalt);
48093 memcpy(&aWalHdr[16], pWal->hdr.aSalt, 8);
48099 pWal->hdr.bigEndCksum = SQLITE_BIGENDIAN;
48100 pWal->hdr.aFrameCksum[0] = aCksum[0];
48101 pWal->hdr.aFrameCksum[1] = aCksum[1];
48192 iFrame = pWal->hdr.mxFrame;
48205 pWal->hdr.szPage = (u16)((szPage&0xff00) | (szPage>>16));
48208 pWal->hdr.mxFrame = iFrame;
48210 pWal->hdr.iChange++;
48211 pWal->hdr.nPage = nTruncate;
48289 if( pWal->hdr.mxFrame && walPagesize(pWal)!=nBuf ){
48297 if( pnLog ) *pnLog = (int)pWal->hdr.mxFrame;
48309 memset(&pWal->hdr, 0, sizeof(WalIndexHdr));
50429 int hdr; /* Offset to the page header */
50448 hdr = pPage->hdrOffset;
50451 assert( nCell==get2byte(&data[hdr+3]) );
50453 cbrk = get2byte(&data[hdr+5]);
50491 put2byte(&data[hdr+5], cbrk);
50492 data[hdr+1] = 0;
50493 data[hdr+2] = 0;
50494 data[hdr+7] = 0;
50517 const int hdr = pPage->hdrOffset; /* Local cache of pPage->hdrOffset */
50534 nFrag = data[hdr+7];
50535 assert( pPage->cellOffset == hdr + 12 - 4*pPage->leaf );
50537 top = get2byteNotZero(&data[hdr+5]);
50547 top = get2byteNotZero(&data[hdr+5]);
50554 for(addr=hdr+1; (pc = get2byte(&data[addr]))>0; addr=pc){
50568 data[hdr+7] = (u8)(nFrag + x);
50589 top = get2byteNotZero(&data[hdr+5]);
50601 put2byte(&data[hdr+5], top);
50616 int addr, pbegin, hdr;
50642 hdr = pPage->hdrOffset;
50643 addr = hdr + 1;
50662 addr = hdr + 1;
50671 if( (frag<0) || (frag>(int)data[hdr+7]) ){
50674 data[hdr+7] -= (u8)frag;
50685 if( data[hdr+1]==data[hdr+5] && data[hdr+2]==data[hdr+6] ){
50687 pbegin = get2byte(&data[hdr+1]);
50688 memcpy(&data[hdr+1], &data[pbegin], 2);
50689 top = get2byte(&data[hdr+5]) + get2byte(&data[pbegin+2]);
50690 put2byte(&data[hdr+5], top);
50753 u8 hdr; /* Offset to beginning of page header */
50765 hdr = pPage->hdrOffset;
50767 if( decodeFlags(pPage, data[hdr]) ) return SQLITE_CORRUPT_BKPT;
50772 pPage->cellOffset = cellOffset = hdr + 12 - 4*pPage->leaf;
50775 top = get2byteNotZero(&data[hdr+5]);
50776 pPage->nCell = get2byte(&data[hdr+3]);
50816 pc = get2byte(&data[hdr+1]);
50817 nFree = data[hdr+7] + top;
50858 u8 hdr = pPage->hdrOffset;
50867 memset(&data[hdr], 0, pBt->usableSize - hdr);
50869 data[hdr] = (char)flags;
50870 first = hdr + 8 + 4*((flags&PTF_LEAF)==0 ?1:0);
50871 memset(&data[hdr+1], 0, 4);
50872 data[hdr+7] = 0;
50873 put2byte(&data[hdr+5], pBt->usableSize);
50876 pPage->hdrOffset = hdr;
51668 int nPageHeader; /* Number of pages in the database according to hdr */
54841 int hdr; /* Beginning of the header. 0 most pages. 100 page 1 */
54852 hdr = pPage->hdrOffset;
54853 testcase( pc==get2byte(&data[hdr+5]) );
54855 if( pc < (u32)get2byte(&data[hdr+5]) || pc+sz > pPage->pBt->usableSize ){
54871 put2byte(&data[hdr+3], pPage->nCell);
54994 const int hdr = pPage->hdrOffset; /* Offset of header on pPage */
55005 assert( get2byteNotZero(&data[hdr+5])==nUsable );
55016 hdr+3], nCell);
55017 put2byte(&data[hdr+5], cellbody);
57071 int hdr, cellStart;
57214 hdr = pPage->hdrOffset;
57219 int contentOffset = get2byteNotZero(&data[hdr+5]);
57223 nCell = get2byte(&data[hdr+3]);
57224 cellStart = hdr + 12 - 4*pPage->leaf;
57239 i = get2byte(&data[hdr+1]);
57260 if( cnt!=data[hdr+7] ){
57263 cnt, data[hdr+7], iPage);
67362 ** | hdr-size | type 0 | type 1 | ... | type N-1 | data0 | ... | data N-1 |
67370 ** hdr-size field is also a varint which is the offset from the beginning