Lines Matching refs:pBuf
8925 void *pBuf; /* The content of the page */ member
22257 SQLITE_PRIVATE int sqlite3OsRead(sqlite3_file *id, void *pBuf, int amt, i64 offset){ in sqlite3OsRead() argument
22259 return id->pMethods->xRead(id, pBuf, amt, offset); in sqlite3OsRead()
22261 SQLITE_PRIVATE int sqlite3OsWrite(sqlite3_file *id, const void *pBuf, int amt, i64 offset){ in sqlite3OsWrite() argument
22263 return id->pMethods->xWrite(id, pBuf, amt, offset); in sqlite3OsWrite()
23260 static void randomFill(char *pBuf, int nByte){ in randomFill() argument
23262 x = SQLITE_PTR_TO_INT(pBuf); in randomFill()
23268 *(int*)pBuf = r; in randomFill()
23269 pBuf += 4; in randomFill()
23276 *(pBuf++) = r & 0xff; in randomFill()
26861 LookasideSlot *pBuf = (LookasideSlot*)p;
26866 pBuf->pNext = db->lookaside.pFree;
26867 db->lookaside.pFree = pBuf;
27020 LookasideSlot *pBuf;
27028 }else if( (pBuf = db->lookaside.pFree)!=0 ){
27029 db->lookaside.pFree = pBuf->pNext;
27031 return (void*)pBuf;
27032 }else if( (pBuf = db->lookaside.pInit)!=0 ){
27033 db->lookaside.pInit = pBuf->pNext;
27035 return (void*)pBuf;
29279 SQLITE_API void sqlite3_randomness(int N, void *pBuf){
29281 unsigned char *zBuf = pBuf;
29309 if( N<=0 || pBuf==0 ){
35774 static int seekAndRead(unixFile *id, sqlite3_int64 offset, void *pBuf, int cnt){
35785 got = osPread(id->h, pBuf, cnt, offset);
35788 got = osPread64(id->h, pBuf, cnt, offset);
35797 got = osRead(id->h, pBuf, cnt);
35809 pBuf = (void*)(got + (char*)pBuf);
35825 void *pBuf,
35849 memcpy(pBuf, &((u8 *)(pFile->pMapRegion))[offset], amt);
35853 memcpy(pBuf, &((u8 *)(pFile->pMapRegion))[offset], nCopy);
35854 pBuf = &((u8 *)pBuf)[nCopy];
35861 got = seekAndRead(pFile, offset, pBuf, amt);
35870 memset(&((char*)pBuf)[got], 0, amt-got);
35885 const void *pBuf, /* Copy data from this buffer to the file */
35898 do{ rc = (int)osPwrite(fd, pBuf, nBuf, iOff); }while( rc<0 && errno==EINTR );
35900 do{ rc = (int)osPwrite64(fd, pBuf, nBuf, iOff);}while( rc<0 && errno==EINTR);
35909 rc = osWrite(fd, pBuf, nBuf);
35928 static int seekAndWrite(unixFile *id, i64 offset, const void *pBuf, int cnt){
35929 return seekAndWriteFd(id->h, offset, pBuf, cnt, &id->lastErrno);
35939 const void *pBuf,
35972 if( rc!=4 || memcmp(oldCntr, &((char*)pBuf)[24-offset], 4)!=0 ){
35984 memcpy(&((u8 *)(pFile->pMapRegion))[offset], pBuf, amt);
35988 memcpy(&((u8 *)(pFile->pMapRegion))[offset], pBuf, nCopy);
35989 pBuf = &((u8 *)pBuf)[nCopy];
35996 while( (wrote = seekAndWrite(pFile, offset, pBuf, amt))<amt && wrote>0 ){
35999 pBuf = &((char*)pBuf)[wrote];
43298 void *pBuf, /* Write content into this buffer */
43315 pFile->h, pBuf, amt, offset, pFile->locktype));
43322 memcpy(pBuf, &((u8 *)(pFile->pMapRegion))[offset], amt);
43328 memcpy(pBuf, &((u8 *)(pFile->pMapRegion))[offset], nCopy);
43329 pBuf = &((u8 *)pBuf)[nCopy];
43342 while( !osReadFile(pFile->h, pBuf, amt, &nRead, 0) ){
43347 while( !osReadFile(pFile->h, pBuf, amt, &nRead, &overlapped) &&
43361 memset(&((char*)pBuf)[nRead], 0, amt-nRead);
43378 const void *pBuf, /* The bytes to be written */
43393 pFile->h, pBuf, amt, offset, pFile->locktype));
43400 memcpy(&((u8 *)(pFile->pMapRegion))[offset], pBuf, amt);
43406 memcpy(&((u8 *)(pFile->pMapRegion))[offset], pBuf, nCopy);
43407 pBuf = &((u8 *)pBuf)[nCopy];
43423 u8 *aRem = (u8 *)pBuf; /* Data yet to be written */
47585 SQLITE_PRIVATE void sqlite3BitvecClear(Bitvec *p, u32 i, void *pBuf){
47601 u32 *aiValues = pBuf;
47844 a = (unsigned char *)pLower->pBuf;
48228 pPgHdr->pData = pPage->pBuf;
48421 memset(pPage1->pBuf, 0, pCache->szPage);
48906 SQLITE_PRIVATE void sqlite3PCacheBufferSetup(void *pBuf, int sz, int n){
48909 if( pBuf==0 ) sz = n = 0;
48915 pcache1.pStart = pBuf;
48919 p = (PgFreeslot*)pBuf;
48922 pBuf = (void*)&((char*)pBuf)[sz];
48924 pcache1.pEnd = pBuf;
48953 pX->page.pBuf = zBulk;
49099 p->page.pBuf = pPg;
49120 pcache1Free(p->page.pBuf);
49880 nFree += pcache1MemSize(p->page.pBuf);
67863 void *pBuf, /* Pointer to buffer */
67874 memcpy(pPayload, pBuf, nByte);
67877 memcpy(pBuf, pPayload, nByte);
67915 unsigned char *pBuf, /* Write the bytes into this buffer */
67924 unsigned char * const pBufStart = pBuf; /* Start of original out buffer */
67953 rc = copyPayload(&aPayload[offset], pBuf, a, eOp, pPage->pDbPage);
67955 pBuf += a;
68052 && &pBuf[-4]>=pBufStart /* (6) */
68056 u8 *aWrite = &pBuf[-4];
68073 rc = copyPayload(&aPayload[offset+4], pBuf, a, eOp, pDbPage);
68080 pBuf += a;
68111 SQLITE_PRIVATE int sqlite3BtreePayload(BtCursor *pCur, u32 offset, u32 amt, void *pBuf){
68116 return accessPayload(pCur, offset, amt, (unsigned char*)pBuf, 0);
68129 void *pBuf
68137 return rc ? rc : accessPayload(pCur, offset, amt, pBuf, 0);
68139 SQLITE_PRIVATE int sqlite3BtreePayloadChecked(BtCursor *pCur, u32 offset, u32 amt, void *pBuf){
68142 return accessPayload(pCur, offset, amt, pBuf, 0);
68144 return accessPayloadChecked(pCur, offset, amt, pBuf);
78407 void *pBuf, /* Pointer to a prior allocation */
78411 if( pBuf==0 ){
78415 pBuf = &p->pSpace[p->nFree];
78420 assert( EIGHT_BYTE_ALIGNMENT(pBuf) );
78421 return pBuf;
155298 static int setupLookaside(sqlite3 *db, void *pBuf, int sz, int cnt){
155321 }else if( pBuf==0 ){
155327 pStart = pBuf;
155346 db->lookaside.bMalloced = pBuf==0 ?1:0;
155441 void *pBuf = va_arg(ap, void*); /* IMP: R-26835-10964 */
155444 rc = setupLookaside(db, pBuf, sz, cnt);
160615 SQLITE_PRIVATE int sqlite3Fts3GetVarint(const char *pBuf, sqlite_int64 *v){
160616 const unsigned char *p = (const unsigned char*)pBuf;
176248 MatchinfoBuffer *pBuf = (MatchinfoBuffer*)((u8*)p - ((u32*)p)[-1]);
176250 assert( (u32*)p==&pBuf->aMatchinfo[1]
176251 || (u32*)p==&pBuf->aMatchinfo[pBuf->nElem+2]
176253 if( (u32*)p==&pBuf->aMatchinfo[1] ){
176254 pBuf->aRef[1] = 0;
176256 pBuf->aRef[2] = 0;
176259 if( pBuf->aRef[0]==0 && pBuf->aRef[1]==0 && pBuf->aRef[2]==0 ){
176260 sqlite3_free(pBuf);
193157 u8 *pBuf = (u8*)zBuf;
193158 p->iCookie = rbuGetU32(&pBuf[24]);
193159 p->iWriteVer = pBuf[19];
193200 u8 *pBuf = (u8*)zBuf;
193201 p->iCookie = rbuGetU32(&pBuf[24]);
193202 p->iWriteVer = pBuf[19];
197086 SessionBuffer *pBuf, /* Buffer to append to */
197095 int nRewind = pBuf->nBuf; /* Set to zero if any values are modified */
197099 sessionAppendByte(pBuf, SQLITE_UPDATE, &rc);
197100 sessionAppendByte(pBuf, p->bIndirect, &rc);
197152 sessionAppendBlob(pBuf, pCsr, nAdvance, &rc);
197154 sessionAppendByte(pBuf, 0, &rc);
197170 pBuf->nBuf = nRewind;
197172 sessionAppendBlob(pBuf, buf2.aBuf, buf2.nBuf, &rc);
197185 SessionBuffer *pBuf, /* Buffer to append to */
197193 sessionAppendByte(pBuf, SQLITE_DELETE, &rc);
197194 sessionAppendByte(pBuf, p->bIndirect, &rc);
197197 sessionAppendBlob(pBuf, p->aRecord, p->nRecord, &rc);
197224 sessionAppendBlob(pBuf, pStart, (int)(a-pStart), &rc);
197368 SessionBuffer *pBuf, /* Append header to this buffer */
197374 sessionAppendByte(pBuf, (bPatchset ? 'P' : 'T'), pRc);
197375 sessionAppendVarint(pBuf, pTab->nCol, pRc);
197376 sessionAppendBlob(pBuf, pTab->abPK, pTab->nCol, pRc);
197377 sessionAppendBlob(pBuf, (u8 *)pTab->zName, (int)strlen(pTab->zName)+1, pRc);
200150 SessionBuffer *pBuf, /* Buffer to append to */
200156 sessionBufferGrow(pBuf, n1+n2, pRc);
200159 u8 *pOut = &pBuf->aBuf[pBuf->nBuf];
200174 pBuf->nBuf = pOut-pBuf->aBuf;
200175 assert( pBuf->nBuf<=pBuf->nAlloc );
200199 SessionBuffer *pBuf, /* Append record here */
200205 sessionBufferGrow(pBuf, 2+nRec+nChange, pRc);
200208 u8 *pOut = &pBuf->aBuf[pBuf->nBuf];
200246 pBuf->nBuf = (pOut - pBuf->aBuf);
201363 #define fts5BufferGrow(pRc,pBuf,nn) ( \
201364 (u32)((pBuf)->n) + (u32)(nn) <= (u32)((pBuf)->nSpace) ? 0 : \
201365 sqlite3Fts5BufferSize((pRc),(pBuf),(nn)+(pBuf)->n) \
204127 static int sqlite3Fts5BufferSize(int *pRc, Fts5Buffer *pBuf, u32 nByte){
204128 if( (u32)pBuf->nSpace<nByte ){
204129 u64 nNew = pBuf->nSpace ? pBuf->nSpace : 64;
204134 pNew = sqlite3_realloc64(pBuf->p, nNew);
204139 pBuf->nSpace = (int)nNew;
204140 pBuf->p = pNew;
204151 static void sqlite3Fts5BufferAppendVarint(int *pRc, Fts5Buffer *pBuf, i64 iVal){
204152 if( fts5BufferGrow(pRc, pBuf, 9) ) return;
204153 pBuf->n += sqlite3Fts5PutVarint(&pBuf->p[pBuf->n], iVal);
204174 Fts5Buffer *pBuf,
204180 if( fts5BufferGrow(pRc, pBuf, nData) ) return;
204181 memcpy(&pBuf->p[pBuf->n], pData, nData);
204182 pBuf->n += nData;
204193 Fts5Buffer *pBuf,
204197 sqlite3Fts5BufferAppendBlob(pRc, pBuf, nStr+1, (const u8*)zStr);
204198 pBuf->n--;
204211 Fts5Buffer *pBuf,
204224 sqlite3Fts5BufferAppendString(pRc, pBuf, zTmp);
204248 static void sqlite3Fts5BufferFree(Fts5Buffer *pBuf){
204249 sqlite3_free(pBuf->p);
204250 memset(pBuf, 0, sizeof(Fts5Buffer));
204257 static void sqlite3Fts5BufferZero(Fts5Buffer *pBuf){
204258 pBuf->n = 0;
204268 Fts5Buffer *pBuf,
204272 pBuf->n = 0;
204273 sqlite3Fts5BufferAppendBlob(pRc, pBuf, nData, pData);
204331 Fts5Buffer *pBuf,
204337 pBuf->p[pBuf->n++] = 1;
204338 pBuf->n += sqlite3Fts5PutVarint(&pBuf->p[pBuf->n], (iPos>>32));
204341 pBuf->n += sqlite3Fts5PutVarint(&pBuf->p[pBuf->n], (iPos-*piPrev)+2);
204346 Fts5Buffer *pBuf,
204351 if( fts5BufferGrow(&rc, pBuf, 5+5+5) ) return rc;
204352 sqlite3Fts5PoslistSafeAppend(pBuf, &pWriter->iPrev, iPos);
205809 Fts5Buffer *pBuf, /* Use this buffer for space if required */
205848 fts5BufferZero(pBuf);
205863 rc = sqlite3Fts5PoslistWriterAppend(pBuf, &writer, iMin);
205867 *pa = pBuf->p;
205868 *pn = pBuf->n;
208126 Fts5Buffer *pBuf = &pExpr->apExprPhrase[i]->poslist;
208130 (pBuf->n==0 || pNode->iRowid!=pExpr->pRoot->iRowid || pNode->bEof)
208134 pBuf->n = 0;
208305 Fts5Buffer *pBuf = (Fts5Buffer*)&pTerm->pSynonym[1];
208307 pTerm, pNode->iRowid, pBuf, (u8**)ppCollist, pnCollist
209984 #define fts5BufferSafeAppendBlob(pBuf, pBlob, nBlob) { \
209985 assert( (pBuf)->nSpace>=((pBuf)->n+nBlob) ); \
209986 memcpy(&(pBuf)->p[(pBuf)->n], pBlob, nBlob); \
209987 (pBuf)->n += nBlob; \
209990 #define fts5BufferSafeAppendVarint(pBuf, iVal) { \
209991 (pBuf)->n += sqlite3Fts5PutVarint(&(pBuf)->p[(pBuf)->n], (iVal)); \
209992 assert( (pBuf)->nSpace>=(pBuf)->n ); \
211845 Fts5Buffer *pBuf; /* Append to this buffer */
211852 Fts5Buffer *pBuf; /* Append to this buffer */
211885 fts5BufferSafeAppendVarint(pCtx->pBuf, iVal + 2 - pCtx->iWrite);
211911 fts5BufferSafeAppendVarint(pCtx->pBuf, 1);
211923 fts5BufferSafeAppendBlob(pCtx->pBuf, &pChunk[iStart], i-iStart);
211935 fts5BufferSafeAppendBlob(pCtx->pBuf, &pChunk[iStart], i-iStart);
211995 Fts5Buffer *pBuf
211997 if( 0==fts5BufferGrow(&p->rc, pBuf, pSeg->nPos+FTS5_DATA_ZERO_PADDING) ){
211998 memset(&pBuf->p[pBuf->n+pSeg->nPos], 0, FTS5_DATA_ZERO_PADDING);
212000 fts5ChunkIterate(p, pSeg, (void*)pBuf, fts5PoslistCallback);
212004 sCtx.pBuf = pBuf;
212012 sCtx.pBuf = pBuf;
212068 Fts5Buffer *pBuf /* Output buffer */
212072 fts5BufferZero(pBuf);
212077 fts5BufferAppendBlob(pRc, pBuf, nSub, pSub);
212674 static i64 fts5DlidxExtractFirstRowid(Fts5Buffer *pBuf){
212678 iOff = 1 + fts5GetVarint(&pBuf->p[1], (u64*)&iRowid);
212679 fts5GetVarint(&pBuf->p[iOff], (u64*)&iRowid);
213396 Fts5Buffer *pBuf; /* Buffer in which to assemble leaf page */
213402 pBuf = &writer.writer.buf;
213407 assert( p->rc || pBuf->nSpace>=(pgsz + FTS5_DATA_PADDING) );
213426 if( pgsz>=(pBuf->n + pPgidx->n + nDoclist + 1) ){
213428 fts5BufferSafeAppendBlob(pBuf, pDoclist, nDoclist);
213442 fts5PutU16(&pBuf->p[0], (u16)pBuf->n); /* first rowid on page */
213443 pBuf->n += sqlite3Fts5PutVarint(&pBuf->p[pBuf->n], iRowid);
213448 pBuf->n += sqlite3Fts5PutVarint(&pBuf->p[pBuf->n], iDelta);
213450 assert( pBuf->n<=pBuf->nSpace );
213454 pBuf->p[pBuf->n++] = 0;
213457 pBuf->p[pBuf->n++] = 0;
213461 if( (pBuf->n + pPgidx->n)>=pgsz ){
213469 if( (pBuf->n + pPgidx->n + nCopy) <= pgsz ){
213472 fts5BufferSafeAppendBlob(pBuf, &pDoclist[iOff], nCopy);
213480 int nSpace = pgsz - pBuf->n - pPgidx->n;
213488 fts5BufferSafeAppendBlob(pBuf, &pPoslist[iPos], n);
213490 if( (pBuf->n + pPgidx->n)>=pgsz ){
213503 assert( pBuf->n<=pBuf->nSpace );
213665 Fts5Buffer *pBuf
213668 fts5BufferAppendVarint(&p->rc, pBuf, iDelta);
213675 Fts5Buffer *pBuf
213680 if( p->rc==SQLITE_OK && 0==fts5BufferGrow(&p->rc, pBuf, nByte) ){
213681 fts5BufferSafeAppendVarint(pBuf, iDelta);
213682 fts5BufferSafeAppendVarint(pBuf, nData*2);
213683 fts5BufferSafeAppendBlob(pBuf, pMulti->base.pData, nData);
213684 memset(&pBuf->p[pBuf->n], 0, FTS5_DATA_ZERO_PADDING);
213716 Fts5Buffer *pBuf,
213720 pIter->aPoslist = pBuf->p;
213721 pIter->aEof = &pBuf->p[pBuf->n];
213733 Fts5Buffer *pBuf, /* Buffer to write to */
213737 assert( pBuf->n!=0 || (*piLastRowid)==0 );
213738 fts5BufferSafeAppendVarint(pBuf, iRowid - *piLastRowid);
213743 #define fts5MergeAppendDocid(pBuf, iLastRowid, iRowid) { \
213744 assert( (pBuf)->n!=0 || (iLastRowid)==0 ); \
213745 fts5BufferSafeAppendVarint((pBuf), (iRowid) - (iLastRowid)); \
213758 static void fts5NextRowid(Fts5Buffer *pBuf, int *piOff, i64 *piRowid){
213760 if( i>=pBuf->n ){
213764 *piOff = i + sqlite3Fts5GetVarint(&pBuf->p[i], &iVal);
214997 static void fts5DebugRowid(int *pRc, Fts5Buffer *pBuf, i64 iKey){
215003 sqlite3Fts5BufferAppendPrintf(pRc, pBuf, "{averages} ");
215005 sqlite3Fts5BufferAppendPrintf(pRc, pBuf, "{structure}");
215009 sqlite3Fts5BufferAppendPrintf(pRc, pBuf, "{%ssegid=%d h=%d pgno=%d}",
215017 Fts5Buffer *pBuf,
215024 sqlite3Fts5BufferAppendPrintf(pRc, pBuf,
215029 sqlite3Fts5BufferAppendPrintf(pRc, pBuf, " {id=%d leaves=%d..%d}",
215033 sqlite3Fts5BufferAppendPrintf(pRc, pBuf, "}");
215046 Fts5Buffer *pBuf,
215058 fts5DebugStructure(pRc, pBuf, p);
215071 Fts5Buffer *pBuf,
215080 sqlite3Fts5BufferAppendPrintf(pRc, pBuf, "%s%d", zSpace, (int)iVal);
215092 static int fts5DecodePoslist(int *pRc, Fts5Buffer *pBuf, const u8 *a, int n){
215097 sqlite3Fts5BufferAppendPrintf(pRc, pBuf, " %d", iVal);
215110 static int fts5DecodeDoclist(int *pRc, Fts5Buffer *pBuf, const u8 *a, int n){
215116 sqlite3Fts5BufferAppendPrintf(pRc, pBuf, " id=%lld", iDocid);
215122 sqlite3Fts5BufferAppendPrintf(pRc, pBuf, " nPos=%d%s", nPos, bDel?"*":"");
215123 iOff += fts5DecodePoslist(pRc, pBuf, &a[iOff], MIN(n-iOff, nPos));
215128 sqlite3Fts5BufferAppendPrintf(pRc, pBuf, " id=%lld", iDocid);
215150 Fts5Buffer *pBuf, /* Buffer to append text to */
215172 sqlite3Fts5BufferAppendPrintf(pRc, pBuf, " %lld%s", iRowid, zApp);
218688 Fts5Buffer *pBuf /* sz value */
218696 sqlite3_bind_blob(pReplace, 2, pBuf->p, pBuf->n, SQLITE_STATIC);