Lines Matching defs:hdr
26344 ** free. The first block has format u.hdr. u.hdr.size4x is 4 times the
26346 ** The u.hdr.size4x&1 bit is true if the chunk is checked out and
26347 ** false if the chunk is on the freelist. The u.hdr.size4x&2 bit
26349 ** previous chunk is free. The u.hdr.prevSize field is the size of
26352 ** u.hdr.prevSize can be part of the data for that chunk and should
26368 ** the u.hdr.prevSize value of the following chunk.
26376 } hdr;
26460 assert( (mem3.aPool[i-1].u.hdr.size4x & 1)==0 );
26462 size = mem3.aPool[i-1].u.hdr.size4x/4;
26463 assert( size==mem3.aPool[i+size-1].u.hdr.prevSize );
26495 assert( (mem3.aPool[i-1].u.hdr.size4x & 1)==0 );
26496 size = mem3.aPool[i-1].u.hdr.size4x/4;
26497 assert( size==mem3.aPool[i+size-1].u.hdr.prevSize );
26546 assert( mem3.aPool[i-1].u.hdr.size4x/4==nBlock );
26547 assert( mem3.aPool[i+nBlock-1].u.hdr.prevSize==nBlock );
26548 x = mem3.aPool[i-1].u.hdr.size4x;
26549 mem3.aPool[i-1].u.hdr.size4x = nBlock*4 | 1 | (x&2);
26550 mem3.aPool[i+nBlock-1].u.hdr.prevSize = nBlock;
26551 mem3.aPool[i+nBlock-1].u.hdr.size4x |= 2;
26575 mem3.aPool[mem3.iKeyBlk+mem3.szKeyBlk-1].u.hdr.prevSize = nBlock;
26576 mem3.aPool[mem3.iKeyBlk+mem3.szKeyBlk-1].u.hdr.size4x |= 2;
26577 mem3.aPool[newi-1].u.hdr.size4x = nBlock*4 + 1;
26579 mem3.aPool[newi-1].u.hdr.prevSize = mem3.szKeyBlk;
26580 x = mem3.aPool[mem3.iKeyBlk-1].u.hdr.size4x & 2;
26581 mem3.aPool[mem3.iKeyBlk-1].u.hdr.size4x = mem3.szKeyBlk*4 | x;
26611 size = mem3.aPool[i-1].u.hdr.size4x;
26615 assert( i > mem3.aPool[i-1].u.hdr.prevSize );
26616 prev = i - mem3.aPool[i-1].u.hdr.prevSize;
26622 x = mem3.aPool[prev-1].u.hdr.size4x & 2;
26623 mem3.aPool[prev-1].u.hdr.size4x = size*4 | x;
26624 mem3.aPool[prev+size-1].u.hdr.prevSize = size;
26672 if( mem3.aPool[i-1].u.hdr.size4x/4==nBlock ){
26733 assert( (mem3.aPool[i-1].u.hdr.size4x&1)==1 );
26734 size = mem3.aPool[i-1].u.hdr.size4x/4;
26736 mem3.aPool[i-1].u.hdr.size4x &= ~1;
26737 mem3.aPool[i+size-1].u.hdr.prevSize = size;
26738 mem3.aPool[i+size-1].u.hdr.size4x &= ~2;
26743 while( (mem3.aPool[mem3.iKeyBlk-1].u.hdr.size4x&2)==0 ){
26744 size = mem3.aPool[mem3.iKeyBlk-1].u.hdr.prevSize;
26748 x = mem3.aPool[mem3.iKeyBlk-1].u.hdr.size4x & 2;
26749 mem3.aPool[mem3.iKeyBlk-1].u.hdr.size4x = mem3.szKeyBlk*4 | x;
26750 mem3.aPool[mem3.iKeyBlk+mem3.szKeyBlk-1].u.hdr.prevSize = mem3.szKeyBlk;
26752 x = mem3.aPool[mem3.iKeyBlk-1].u.hdr.size4x & 2;
26753 while( (mem3.aPool[mem3.iKeyBlk+mem3.szKeyBlk-1].u.hdr.size4x&1)==0 ){
26755 mem3.szKeyBlk += mem3.aPool[mem3.iKeyBlk+mem3.szKeyBlk-1].u.hdr.size4x/4;
26756 mem3.aPool[mem3.iKeyBlk-1].u.hdr.size4x = mem3.szKeyBlk*4 | x;
26757 mem3.aPool[mem3.iKeyBlk+mem3.szKeyBlk-1].u.hdr.prevSize = mem3.szKeyBlk;
26771 assert( (pBlock[-1].u.hdr.size4x&1)!=0 );
26772 return (pBlock[-1].u.hdr.size4x&~3)*2 - 4;
26857 mem3.aPool[0].u.hdr.size4x = (mem3.szKeyBlk<<2) + 2;
26858 mem3.aPool[mem3.nPool].u.hdr.prevSize = mem3.nPool;
26859 mem3.aPool[mem3.nPool].u.hdr.size4x = 1;
26897 size = mem3.aPool[i-1].u.hdr.size4x;
26903 if( (size&1)==0 && mem3.aPool[i+size/4-1].u.hdr.prevSize!=size/4 ){
26908 if( ((mem3.aPool[i+size/4-1].u.hdr.size4x&2)>>1)!=(size&1) ){
26925 (mem3.aPool[j-1].u.hdr.size4x/4)*8-8);
26934 (mem3.aPool[j-1].u.hdr.size4x/4)*8-8);
63887 WalIndexHdr hdr; /* Wal-index header for current transaction */
64152 ** Write the header information in pWal->hdr into the wal-index.
64154 ** The checksum on pWal->hdr is updated before it is written.
64161 pWal->hdr.isInit = 1;
64162 pWal->hdr.iVersion = WALINDEX_MAX_VERSION;
64163 walChecksumBytes(1, (u8*)&pWal->hdr, nCksum, 0, pWal->hdr.aCksum);
64165 memcpy((void*)&aHdr[1], (const void*)&pWal->hdr, sizeof(WalIndexHdr));
64167 memcpy((void*)&aHdr[0], (const void*)&pWal->hdr, sizeof(WalIndexHdr));
64191 u32 *aCksum = pWal->hdr.aFrameCksum;
64196 memcpy(&aFrame[8], pWal->hdr.aSalt, 8);
64198 nativeCksum = (pWal->hdr.bigEndCksum==SQLITE_BIGENDIAN);
64222 u32 *aCksum = pWal->hdr.aFrameCksum;
64229 if( memcmp(&pWal->hdr.aSalt, &aFrame[8], 8)!=0 ){
64245 nativeCksum = (pWal->hdr.bigEndCksum==SQLITE_BIGENDIAN);
64422 ** than pWal->hdr.mxFrame.
64424 ** This function is called whenever pWal->hdr.mxFrame is decreased due
64427 ** At most only the hash table containing pWal->hdr.mxFrame needs to be
64429 ** pWal->hdr.mxFrame advances to the point where those hash tables are
64439 testcase( pWal->hdr.mxFrame==HASHTABLE_NPAGE_ONE-1 );
64440 testcase( pWal->hdr.mxFrame==HASHTABLE_NPAGE_ONE );
64441 testcase( pWal->hdr.mxFrame==HASHTABLE_NPAGE_ONE+1 );
64443 if( pWal->hdr.mxFrame==0 ) return;
64446 ** the entry that corresponds to frame pWal->hdr.mxFrame. It is guaranteed
64449 assert( pWal->nWiData>walFramePage(pWal->hdr.mxFrame) );
64450 assert( pWal->apWiData[walFramePage(pWal->hdr.mxFrame)] );
64451 i = walHashGet(pWal, walFramePage(pWal->hdr.mxFrame), &sLoc);
64455 ** than pWal->hdr.mxFrame.
64457 iLimit = pWal->hdr.mxFrame - sLoc.iZero;
64466 ** frame numbers greater than pWal->hdr.mxFrame.
64607 memset(&pWal->hdr, 0, sizeof(WalIndexHdr));
64647 pWal->hdr.bigEndCksum = (u8)(magic&0x00000001);
64650 memcpy(&pWal->hdr.aSalt, &aBuf[16], 8);
64653 walChecksumBytes(pWal->hdr.bigEndCksum==SQLITE_BIGENDIAN,
64654 aBuf, WAL_HDRSIZE-2*4, 0, pWal->hdr.aFrameCksum
64656 if( pWal->hdr.aFrameCksum[0]!=sqlite3Get4byte(&aBuf[24])
64657 || pWal->hdr.aFrameCksum[1]!=sqlite3Get4byte(&aBuf[28])
64708 pWal->hdr.mxFrame = iFrame;
64709 pWal->hdr.nPage = nTruncate;
64710 pWal->hdr.szPage = (u16)((szPage&0xff00) | (szPage>>16));
64713 aFrameCksum[0] = pWal->hdr.aFrameCksum[0];
64714 aFrameCksum[1] = pWal->hdr.aFrameCksum[1];
64758 pWal->hdr.aFrameCksum[0] = aFrameCksum[0];
64759 pWal->hdr.aFrameCksum[1] = aFrameCksum[1];
64768 pInfo->nBackfillAttempted = pWal->hdr.mxFrame;
64773 if( i==1 && pWal->hdr.mxFrame ){
64774 pInfo->aReadMark[i] = pWal->hdr.mxFrame;
64789 if( pWal->hdr.nPage ){
64792 pWal->hdr.mxFrame, pWal->zWalName
65153 assert( pWal->ckptLock && pWal->hdr.mxFrame>0 );
65154 iLast = pWal->hdr.mxFrame;
65329 return (pWal->hdr.szPage&0xfe00) + ((pWal->hdr.szPage&0x0001)<<16);
65352 u32 *aSalt = pWal->hdr.aSalt; /* Big-endian salt values */
65354 pWal->hdr.mxFrame = 0;
65356 memcpy(&pWal->hdr.aSalt[1], &salt1, 4);
65421 if( pInfo->nBackfill<pWal->hdr.mxFrame ){
65432 mxSafeFrame = pWal->hdr.mxFrame;
65433 mxPage = pWal->hdr.nPage;
65437 assert( y<=pWal->hdr.mxFrame );
65477 if( (nSize+65536+(i64)pWal->hdr.mxFrame*szPage)<nReq ){
65517 i64 szDb = pWal->hdr.nPage*(i64)szPage;
65547 if( pInfo->nBackfill<pWal->hdr.mxFrame ){
65552 assert( pInfo->nBackfill==pWal->hdr.mxFrame );
65678 ** pWal->hdr, then pWal->hdr is updated to the content of the new header
65724 if( memcmp(&pWal->hdr, &h1, sizeof(WalIndexHdr)) ){
65726 memcpy(&pWal->hdr, &h1, sizeof(WalIndexHdr));
65727 pWal->szPage = (pWal->hdr.szPage&0xfe00) + ((pWal->hdr.szPage&0x0001)<<16);
65743 ** Read the wal-index header from the wal-index and into pWal->hdr.
65747 ** Set *pChanged to 1 if the wal-index header value in pWal->hdr is
65748 ** changed by this operation. If pWal->hdr is unchanged, set *pChanged
65832 if( badHdr==0 && pWal->hdr.iVersion!=WALINDEX_MAX_VERSION ){
65887 u32 aSaveCksum[2]; /* Saved copy of pWal->hdr.aFrameCksum */
65934 ** into pWal->hdr.
65936 memcpy(&pWal->hdr, (void*)walIndexHdr(pWal), sizeof(WalIndexHdr));
65953 rc = (pWal->hdr.mxFrame==0 ? SQLITE_OK : WAL_RETRY);
65962 if( memcmp(&pWal->hdr.aSalt, &aBuf[16], 8) ){
65985 aSaveCksum[0] = pWal->hdr.aFrameCksum[0];
65986 aSaveCksum[1] = pWal->hdr.aFrameCksum[1];
65987 for(iOffset=walFrameOffset(pWal->hdr.mxFrame+1, pWal->szPage);
66007 pWal->hdr.aFrameCksum[0] = aSaveCksum[0];
66008 pWal->hdr.aFrameCksum[1] = aSaveCksum[1];
66037 ** to make a copy of the wal-index header into pWal->hdr. If the
66060 ** use WAL frames up to and including pWal->hdr.mxFrame if pWal->readLock>0
66160 if( !useWal && AtomicLoad(&pInfo->nBackfill)==pWal->hdr.mxFrame
66162 && (pWal->pSnapshot==0 || pWal->hdr.mxFrame==0)
66171 if( memcmp((void *)walIndexHdr(pWal), &pWal->hdr, sizeof(WalIndexHdr)) ){
66198 ** but not exceeding pWal->hdr.mxFrame and lock that entry.
66202 mxFrame = pWal->hdr.mxFrame;
66249 ** that occur later in the log than pWal->hdr.mxFrame may have been
66252 ** pWal->hdr.mxFrame risks reading a corrupted snapshot. So, retry
66263 ** matches the one cached in pWal->hdr, it is guaranteed that the
66265 ** header newer than that cached in pWal->hdr. If it were, that could
66270 ** frame pWal->hdr.mxFrame - then the client would incorrectly assume
66273 ** see any pages past pWal->hdr.mxFrame, this problem does not come up.
66278 || memcmp((void *)walIndexHdr(pWal), &pWal->hdr, sizeof(WalIndexHdr))
66283 assert( mxReadMark<=pWal->hdr.mxFrame );
66392 if( memcmp(pSnapshot, &pWal->hdr, sizeof(WalIndexHdr))!=0 ){
66425 if( pSnapshot && memcmp(pSnapshot, &pWal->hdr, sizeof(WalIndexHdr))!=0 ){
66427 ** a value equal to or smaller than pSnapshot->mxFrame, but pWal->hdr
66441 assert( pWal->readLock>0 || pWal->hdr.mxFrame==0 );
66447 ** true, return SQLITE_ERROR_SNAPSHOT. Otherwise, overwrite pWal->hdr
66450 if( !memcmp(pSnapshot->aSalt, pWal->hdr.aSalt, sizeof(pWal->hdr.aSalt))
66454 memcpy(&pWal->hdr, pSnapshot, sizeof(WalIndexHdr));
66510 u32 iLast = pWal->hdr.mxFrame; /* Last page in WAL for this reader */
66616 sz = pWal->hdr.szPage;
66630 return pWal->hdr.nPage;
66657 assert( !memcmp(&pWal->hdr,(void *)walIndexHdr(pWal),sizeof(WalIndexHdr)) );
66684 if( memcmp(&pWal->hdr, (void *)walIndexHdr(pWal), sizeof(WalIndexHdr))!=0 ){
66722 Pgno iMax = pWal->hdr.mxFrame;
66728 memcpy(&pWal->hdr, (void *)walIndexHdr(pWal), sizeof(WalIndexHdr));
66730 for(iFrame=pWal->hdr.mxFrame+1;
66748 if( iMax!=pWal->hdr.mxFrame ) walCleanupHash(pWal);
66761 aWalData[0] = pWal->hdr.mxFrame;
66762 aWalData[1] = pWal->hdr.aFrameCksum[0];
66763 aWalData[2] = pWal->hdr.aFrameCksum[1];
66777 assert( aWalData[3]!=pWal->nCkpt || aWalData[0]<=pWal->hdr.mxFrame );
66788 if( aWalData[0]<pWal->hdr.mxFrame ){
66789 pWal->hdr.mxFrame = aWalData[0];
66790 pWal->hdr.aFrameCksum[0] = aWalData[1];
66791 pWal->hdr.aFrameCksum[1] = aWalData[2];
66803 ** it sets pWal->hdr.mxFrame to 0. Otherwise, pWal->hdr.mxFrame is left
66807 ** or not pWal->hdr.mxFrame is modified). An SQLite error code is returned
66816 assert( pInfo->nBackfill==pWal->hdr.mxFrame );
66955 pWal->hdr.aFrameCksum[0] = sqlite3Get4byte(aBuf);
66956 pWal->hdr.aFrameCksum[1] = sqlite3Get4byte(&aBuf[sizeof(u32)]);
67010 pWal, cnt, pWal->hdr.mxFrame, isCommit ? "Commit" : "Spill"));
67015 if( memcmp(&pWal->hdr, (void *)pLive, sizeof(WalIndexHdr))!=0 ){
67020 ** log file, instead of appending to it at pWal->hdr.mxFrame.
67030 iFrame = pWal->hdr.mxFrame;
67039 if( pWal->nCkpt==0 ) sqlite3_randomness(8, pWal->hdr.aSalt);
67040 memcpy(&aWalHdr[16], pWal->hdr.aSalt, 8);
67046 pWal->hdr.bigEndCksum = SQLITE_BIGENDIAN;
67047 pWal->hdr.aFrameCksum[0] = aCksum[0];
67048 pWal->hdr.aFrameCksum[1] = aCksum[1];
67179 iFrame = pWal->hdr.mxFrame;
67194 pWal->hdr.szPage = (u16)((szPage&0xff00) | (szPage>>16));
67197 pWal->hdr.mxFrame = iFrame;
67199 pWal->hdr.iChange++;
67200 pWal->hdr.nPage = nTruncate;
67306 if( pWal->hdr.mxFrame && walPagesize(pWal)!=nBuf ){
67314 if( pnLog ) *pnLog = (int)pWal->hdr.mxFrame;
67326 memset(&pWal->hdr, 0, sizeof(WalIndexHdr));
67447 if( memcmp(&pWal->hdr.aFrameCksum[0],aZero,16)==0 ){
67455 memcpy(pRet, &pWal->hdr, sizeof(WalIndexHdr));
67504 if( memcmp(pNew->aSalt, pWal->hdr.aSalt, sizeof(pWal->hdr.aSalt))
70116 int hdr; /* Offset to the page header */
70135 hdr = pPage->hdrOffset;
70138 assert( nCell==get2byte(&data[hdr+3]) || CORRUPT_DB );
70147 if( (int)data[hdr+7]<=nMaxFrag ){
70148 int iFree = get2byte(&data[hdr+1]);
70158 int top = get2byte(&data[hdr+5]);
70187 iCellStart = get2byte(&data[hdr+5]);
70217 data[hdr+7] = 0;
70221 if( data[hdr+7]+cbrk-iCellFirst!=pPage->nFree ){
70225 put2byte(&data[hdr+5], cbrk);
70226 data[hdr+1] = 0;
70227 data[hdr+2] = 0;
70248 const int hdr = pPg->hdrOffset; /* Offset to page header */
70250 int iAddr = hdr + 1; /* Address of ptr to pc */
70270 if( aData[hdr+7]>57 ) return 0;
70275 aData[hdr+7] += (u8)x;
70320 const int hdr = pPage->hdrOffset; /* Local cache of pPage->hdrOffset */
70335 assert( pPage->cellOffset == hdr + 12 - 4*pPage->leaf );
70343 pTmp = &data[hdr+5];
70361 if( (data[hdr+2] || data[hdr+1]) && gap+2<=top ){
70386 top = get2byteNotZero(&data[hdr+5]);
70398 put2byte(&data[hdr+5], top);
70420 u8 hdr; /* Page header size. 0 or 100 */
70439 hdr = pPage->hdrOffset;
70440 iPtr = hdr + 1;
70477 if( iPtr>hdr+1 ){
70486 if( nFrag>data[hdr+7] ) return SQLITE_CORRUPT_PAGE(pPage);
70487 data[hdr+7] -= nFrag;
70489 pTmp = &data[hdr+5];
70496 if( iPtr!=hdr+1 ) return SQLITE_CORRUPT_PAGE(pPage);
70497 put2byte(&data[hdr+1], iFreeBlk);
70498 put2byte(&data[hdr+5], iEnd);
70604 u8 hdr; /* Offset to beginning of page header */
70622 hdr = pPage->hdrOffset;
70627 top = get2byteNotZero(&data[hdr+5]);
70628 iCellFirst = hdr + 8 + pPage->childPtrSize + 2*pPage->nCell;
70635 pc = get2byte(&data[hdr+1]);
70636 nFree = data[hdr+7] + top; /* Init nFree to non-freeblock free space */
70781 u8 hdr = pPage->hdrOffset;
70790 memset(&data[hdr], 0, pBt->usableSize - hdr);
70792 data[hdr] = (char)flags;
70793 first = hdr + ((flags&PTF_LEAF)==0 ? 12 : 8);
70794 memset(&data[hdr+1], 0, 4);
70795 data[hdr+7] = 0;
70796 put2byte(&data[hdr+5], pBt->usableSize);
75634 int hdr; /* Beginning of the header. 0 most pages. 100 page 1 */
75647 hdr = pPage->hdrOffset;
75648 testcase( pc==(u32)get2byte(&data[hdr+5]) );
75661 memset(&data[hdr+1], 0, 4);
75662 data[hdr+7] = 0;
75663 put2byte(&data[hdr+5], pPage->pBt->usableSize);
75668 put2byte(&data[hdr+3], pPage->nCell);
75925 const int hdr = pPg->hdrOffset; /* Offset of header on pPg */
75939 j = get2byte(&aData[hdr+5]);
75978 put2byte(&aData[hdr+1], 0);
75979 put2byte(&aData[hdr+3], pPg->nCell);
75980 put2byte(&aData[hdr+5], pData - aData);
75981 aData[hdr+7] = 0x00;
76141 const int hdr = pPg->hdrOffset;
76169 pData = &aData[get2byteNotZero(&aData[hdr+5])];
76215 put2byte(&aData[hdr+3], pPg->nCell);
76216 put2byte(&aData[hdr+5], pData - aData);
78433 int hdr;
78448 hdr = pPage->hdrOffset;
78459 rc = clearDatabasePage(pBt, get4byte(&pPage->aData[hdr+8]), 1, pnChange);
78470 zeroPage(pPage, pPage->aData[hdr] | PTF_LEAF);
79039 int hdr; /* Offset to the page header */
79089 hdr = pPage->hdrOffset;
79093 contentOffset = get2byteNotZero(&data[hdr+5]);
79098 nCell = get2byte(&data[hdr+3]);
79103 cellStart = hdr + 12 - 4*pPage->leaf;
79109 pgno = get4byte(&data[hdr+8]);
79217 i = get2byte(&data[hdr+1]);
79266 if( heap[0]==0 && nFrag!=data[hdr+7] ){
79269 nFrag, data[hdr+7], iPage);
93656 ** | hdr-size | type 0 | type 1 | ... | type N-1 | data0 | ... | data N-1 |
93664 ** hdr-size field is also a varint which is the offset from the beginning
205465 unsigned char hdr[4]; /* Header for on-disk representation */
205624 pOut->hdr[0] = *(unsigned char*)&x;
205625 pOut->hdr[1] = (s.nVertex>>16)&0xff;
205626 pOut->hdr[2] = (s.nVertex>>8)&0xff;
205627 pOut->hdr[3] = s.nVertex&0xff;
205676 memcpy(p->hdr, a, nByte);
205683 p->hdr[0] ^= 1;
205716 sqlite3_result_blob(context, p->hdr,
205824 sqlite3_result_blob(context, p->hdr,
205902 sqlite3_result_blob(context, p->hdr,
205953 p->hdr[0] = *(unsigned char*)&i;
205954 p->hdr[1] = 0;
205955 p->hdr[2] = (n>>8)&0xff;
205956 p->hdr[3] = n&0xff;
205962 sqlite3_result_blob(context, p->hdr, 4+8*n, SQLITE_TRANSIENT);
206019 pOut->hdr[0] = *(unsigned char*)ⅈ
206020 pOut->hdr[1] = 0;
206021 pOut->hdr[2] = 0;
206022 pOut->hdr[3] = 4;
206054 sqlite3_result_blob(context, p->hdr,
206105 sqlite3_result_blob(context, p->hdr,
207041 sqlite3_bind_blob(pUp, 2, p->hdr, 4+8*p->nVertex, SQLITE_TRANSIENT);