1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-07-27 20:41:58 +03:00

Fix harmless compiler warnings seen with MSVC for lsm1.

FossilOrigin-Name: cf6da4a52f7f9047e653ef2972e4c0910b29d7182d789a9e30225dc1849e8779
This commit is contained in:
mistachkin
2017-07-11 16:36:10 +00:00
parent 56eb09bc23
commit 1be5051923
12 changed files with 132 additions and 131 deletions

View File

@ -1,9 +1,9 @@
# #
# This Makefile is designed for use with main.mk in the root directory of # This Makefile is designed for use with Makefile.msc in the root directory
# this project. After including main.mk, the users makefile should contain: # of this project. The Makefile.msc should contain:
# #
# LSMDIR=$(TOP)\ext\lsm1\ # LSMDIR=$(TOP)\ext\lsm1
# include $(LSMDIR)\Makefile.msc # !INCLUDE $(LSMDIR)\Makefile.msc
# #
# The most useful targets are [lsmtest.exe] and [lsm.dll]. # The most useful targets are [lsmtest.exe] and [lsm.dll].
# #
@ -39,7 +39,7 @@ LSMTESTSRC = $(LSMDIR)\lsm-test\lsmtest1.c $(LSMDIR)\lsm-test\lsmtest2.c \
$(LSMDIR)\lsm-test\lsmtest_tdb.c $(LSMDIR)\lsm-test\lsmtest_tdb3.c \ $(LSMDIR)\lsm-test\lsmtest_tdb.c $(LSMDIR)\lsm-test\lsmtest_tdb3.c \
$(LSMDIR)\lsm-test\lsmtest_util.c $(LSMDIR)\lsm-test\lsmtest_win32.c $(LSMDIR)\lsm-test\lsmtest_util.c $(LSMDIR)\lsm-test\lsmtest_win32.c
# all: lsm.dll # all: lsm.dll lsmtest.exe
LSMOPTS = $(NO_WARN) -DLSM_MUTEX_WIN32=1 -I$(LSMDIR) LSMOPTS = $(NO_WARN) -DLSM_MUTEX_WIN32=1 -I$(LSMDIR)
@ -96,5 +96,5 @@ lsm_vtab.lo: $(LSMDIR)\lsm_vtab.c $(LSMHDR) $(SQLITE3H)
lsm.dll: $(LSMOBJ) lsm.dll: $(LSMOBJ)
$(LD) $(LDFLAGS) $(LTLINKOPTS) $(LTLIBPATHS) /DLL /OUT:$@ $(LSMOBJ) $(LD) $(LDFLAGS) $(LTLINKOPTS) $(LTLIBPATHS) /DLL /OUT:$@ $(LSMOBJ)
lsmtest.exe: $(LSMOBJ) $(LSMTESTSRC) $(LSMTESTHDR) $(LIBOBJS1) lsmtest.exe: $(LSMOBJ) $(LSMTESTSRC) $(LSMTESTHDR) $(LIBOBJ)
$(LTLINK) $(LSMOPTS) $(LSMTESTSRC) /link $(LSMOBJ) $(LIBOBJS1) $(LTLINK) $(LSMOPTS) $(LSMTESTSRC) /link $(LSMOBJ) $(LIBOBJ)

View File

@ -222,7 +222,7 @@ struct CkptBuffer {
** at aCkpt[]. ** at aCkpt[].
*/ */
static void ckptChecksum(u32 *aCkpt, u32 nCkpt, u32 *piCksum1, u32 *piCksum2){ static void ckptChecksum(u32 *aCkpt, u32 nCkpt, u32 *piCksum1, u32 *piCksum2){
int i; u32 i;
u32 cksum1 = 1; u32 cksum1 = 1;
u32 cksum2 = 2; u32 cksum2 = 2;
@ -511,7 +511,7 @@ static void ckptNewSegment(
pSegment->iFirst = ckptGobble64(aIn, piIn); pSegment->iFirst = ckptGobble64(aIn, piIn);
pSegment->iLastPg = ckptGobble64(aIn, piIn); pSegment->iLastPg = ckptGobble64(aIn, piIn);
pSegment->iRoot = ckptGobble64(aIn, piIn); pSegment->iRoot = ckptGobble64(aIn, piIn);
pSegment->nSize = ckptGobble64(aIn, piIn); pSegment->nSize = (int)ckptGobble64(aIn, piIn);
assert( pSegment->iFirst ); assert( pSegment->iFirst );
} }

View File

@ -540,7 +540,7 @@ static int fsMmapPage(FileSystem *pFS, Pgno iReal){
** Given that there are currently nHash slots in the hash table, return ** Given that there are currently nHash slots in the hash table, return
** the hash key for file iFile, page iPg. ** the hash key for file iFile, page iPg.
*/ */
static int fsHashKey(int nHash, int iPg){ static int fsHashKey(int nHash, Pgno iPg){
return (iPg % nHash); return (iPg % nHash);
} }
@ -922,9 +922,9 @@ static Pgno fsLastPageOnBlock(FileSystem *pFS, int iBlock){
*/ */
static int fsPageToBlock(FileSystem *pFS, Pgno iPg){ static int fsPageToBlock(FileSystem *pFS, Pgno iPg){
if( pFS->pCompress ){ if( pFS->pCompress ){
return (iPg / pFS->nBlocksize) + 1; return (int)((iPg / pFS->nBlocksize) + 1);
}else{ }else{
return 1 + ((iPg-1) / (pFS->nBlocksize / pFS->nPagesize)); return (int)(1 + ((iPg-1) / (pFS->nBlocksize / pFS->nPagesize)));
} }
} }
@ -1286,7 +1286,7 @@ static int fsReadData(
assert( pFS->pCompress ); assert( pFS->pCompress );
iEob = fsLastPageOnPagesBlock(pFS, iOff) + 1; iEob = fsLastPageOnPagesBlock(pFS, iOff) + 1;
nRead = LSM_MIN(iEob - iOff, nData); nRead = (int)LSM_MIN(iEob - iOff, nData);
rc = lsmEnvRead(pFS->pEnv, pFS->fdDb, iOff, aData, nRead); rc = lsmEnvRead(pFS->pEnv, pFS->fdDb, iOff, aData, nRead);
if( rc==LSM_OK && nRead!=nData ){ if( rc==LSM_OK && nRead!=nData ){
@ -1722,8 +1722,8 @@ static int fsFreeBlock(
int iBlk /* Block number of block to free */ int iBlk /* Block number of block to free */
){ ){
int rc = LSM_OK; /* Return code */ int rc = LSM_OK; /* Return code */
int iFirst; /* First page on block iBlk */ Pgno iFirst; /* First page on block iBlk */
int iLast; /* Last page on block iBlk */ Pgno iLast; /* Last page on block iBlk */
Level *pLevel; /* Used to iterate through levels */ Level *pLevel; /* Used to iterate through levels */
int iIn; /* Used to iterate through append points */ int iIn; /* Used to iterate through append points */
@ -1856,7 +1856,7 @@ void lsmFsGobble(
assert( nPgno>0 && 0==fsPageRedirects(pFS, pRun, aPgno[0]) ); assert( nPgno>0 && 0==fsPageRedirects(pFS, pRun, aPgno[0]) );
iBlk = fsPageToBlock(pFS, pRun->iFirst); iBlk = fsPageToBlock(pFS, pRun->iFirst);
pRun->nSize += (pRun->iFirst - fsFirstPageOnBlock(pFS, iBlk)); pRun->nSize += (int)(pRun->iFirst - fsFirstPageOnBlock(pFS, iBlk));
while( rc==LSM_OK ){ while( rc==LSM_OK ){
int iNext = 0; int iNext = 0;
@ -1867,13 +1867,13 @@ void lsmFsGobble(
} }
rc = fsBlockNext(pFS, pRun, iBlk, &iNext); rc = fsBlockNext(pFS, pRun, iBlk, &iNext);
if( rc==LSM_OK ) rc = fsFreeBlock(pFS, pSnapshot, pRun, iBlk); if( rc==LSM_OK ) rc = fsFreeBlock(pFS, pSnapshot, pRun, iBlk);
pRun->nSize -= ( pRun->nSize -= (int)(
1 + fsLastPageOnBlock(pFS, iBlk) - fsFirstPageOnBlock(pFS, iBlk) 1 + fsLastPageOnBlock(pFS, iBlk) - fsFirstPageOnBlock(pFS, iBlk)
); );
iBlk = iNext; iBlk = iNext;
} }
pRun->nSize -= (pRun->iFirst - fsFirstPageOnBlock(pFS, iBlk)); pRun->nSize -= (int)(pRun->iFirst - fsFirstPageOnBlock(pFS, iBlk));
assert( pRun->nSize>0 ); assert( pRun->nSize>0 );
} }
@ -2087,10 +2087,10 @@ int lsmFsSortedAppend(
){ ){
int rc = LSM_OK; int rc = LSM_OK;
Page *pPg = 0; Page *pPg = 0;
int iApp = 0; Pgno iApp = 0;
int iNext = 0; Pgno iNext = 0;
Segment *p = &pLvl->lhs; Segment *p = &pLvl->lhs;
int iPrev = p->iLastPg; Pgno iPrev = p->iLastPg;
*ppOut = 0; *ppOut = 0;
assert( p->pRedirect==0 ); assert( p->pRedirect==0 );
@ -2457,8 +2457,8 @@ static Pgno fsAppendData(
int rc = *pRc; int rc = *pRc;
assert( pFS->pCompress ); assert( pFS->pCompress );
if( rc==LSM_OK ){ if( rc==LSM_OK ){
int nRem; int nRem = 0;
int nWrite; int nWrite = 0;
Pgno iLastOnBlock; Pgno iLastOnBlock;
Pgno iApp = pSeg->iLastPg+1; Pgno iApp = pSeg->iLastPg+1;
@ -2477,7 +2477,7 @@ static Pgno fsAppendData(
/* Write as much data as is possible at iApp (usually all of it). */ /* Write as much data as is possible at iApp (usually all of it). */
iLastOnBlock = fsLastPageOnPagesBlock(pFS, iApp); iLastOnBlock = fsLastPageOnPagesBlock(pFS, iApp);
if( rc==LSM_OK ){ if( rc==LSM_OK ){
int nSpace = iLastOnBlock - iApp + 1; int nSpace = (int)(iLastOnBlock - iApp + 1);
nWrite = LSM_MIN(nData, nSpace); nWrite = LSM_MIN(nData, nSpace);
nRem = nData - nWrite; nRem = nData - nWrite;
assert( nWrite>=0 ); assert( nWrite>=0 );
@ -2800,7 +2800,7 @@ int lsmFsSortedPadding(
iLast2 = (1 + iLast/pFS->szSector) * pFS->szSector - 1; iLast2 = (1 + iLast/pFS->szSector) * pFS->szSector - 1;
assert( fsPageToBlock(pFS, iLast)==fsPageToBlock(pFS, iLast2) ); assert( fsPageToBlock(pFS, iLast)==fsPageToBlock(pFS, iLast2) );
nPad = iLast2 - iLast; nPad = (int)(iLast2 - iLast);
if( iLast2>fsLastPageOnPagesBlock(pFS, iLast) ){ if( iLast2>fsLastPageOnPagesBlock(pFS, iLast) ){
nPad -= 4; nPad -= 4;

View File

@ -545,7 +545,7 @@ static int jumpIfRequired(
aPad[0] = LSM_LOG_PAD1; aPad[0] = LSM_LOG_PAD1;
}else{ }else{
aPad[0] = LSM_LOG_PAD2; aPad[0] = LSM_LOG_PAD2;
aPad[1] = (nPad-2); aPad[1] = (u8)(nPad-2);
} }
rc = lsmStringBinAppend(&pLog->buf, aPad, nPad); rc = lsmStringBinAppend(&pLog->buf, aPad, nPad);
if( rc!=LSM_OK ) return rc; if( rc!=LSM_OK ) return rc;
@ -627,7 +627,7 @@ static int logFlush(lsm_db *pDb, int eType){
}else{ }else{
int n = LSM_MIN(200, nPad-2); int n = LSM_MIN(200, nPad-2);
pLog->buf.z[pLog->buf.n++] = LSM_LOG_PAD2; pLog->buf.z[pLog->buf.n++] = LSM_LOG_PAD2;
pLog->buf.z[pLog->buf.n++] = n; pLog->buf.z[pLog->buf.n++] = (char)n;
nPad -= 2; nPad -= 2;
memset(&pLog->buf.z[pLog->buf.n], 0x2B, n); memset(&pLog->buf.z[pLog->buf.n], 0x2B, n);
pLog->buf.n += n; pLog->buf.n += n;
@ -640,7 +640,7 @@ static int logFlush(lsm_db *pDb, int eType){
** record. Then add the first byte of it. */ ** record. Then add the first byte of it. */
rc = lsmStringExtend(&pLog->buf, 9); rc = lsmStringExtend(&pLog->buf, 9);
if( rc!=LSM_OK ) return rc; if( rc!=LSM_OK ) return rc;
pLog->buf.z[pLog->buf.n++] = eType; pLog->buf.z[pLog->buf.n++] = (char)eType;
memset(&pLog->buf.z[pLog->buf.n], 0, 8); memset(&pLog->buf.z[pLog->buf.n], 0, 8);
rc = logCksumAndFlush(pDb); rc = logCksumAndFlush(pDb);
@ -772,7 +772,7 @@ void lsmLogSeek(
assert( pMark->iOff<=pLog->iOff+pLog->buf.n ); assert( pMark->iOff<=pLog->iOff+pLog->buf.n );
if( (pMark->iOff & 0xFFFFFFF8)>=pLog->iOff ){ if( (pMark->iOff & 0xFFFFFFF8)>=pLog->iOff ){
pLog->buf.n = pMark->iOff - pLog->iOff; pLog->buf.n = (int)(pMark->iOff - pLog->iOff);
pLog->iCksumBuf = (pLog->buf.n & 0xFFFFFFF8); pLog->iCksumBuf = (pLog->buf.n & 0xFFFFFFF8);
}else{ }else{
pLog->buf.n = pMark->nBuf; pLog->buf.n = pMark->nBuf;

View File

@ -97,7 +97,7 @@ static void assertNotInFreelist(Freelist *p, int iBlk){
/* /*
** Append an entry to the free-list. If (iId==-1), this is a delete. ** Append an entry to the free-list. If (iId==-1), this is a delete.
*/ */
int freelistAppend(lsm_db *db, int iBlk, i64 iId){ int freelistAppend(lsm_db *db, u32 iBlk, i64 iId){
lsm_env *pEnv = db->pEnv; lsm_env *pEnv = db->pEnv;
Freelist *p; Freelist *p;
int i; int i;
@ -639,11 +639,12 @@ static int walkFreelistCb(void *pCtx, int iBlk, i64 iSnapshot){
Freelist *pFree = p->pFreelist; Freelist *pFree = p->pFreelist;
assert( p->bDone==0 ); assert( p->bDone==0 );
assert( iBlk>=0 );
if( pFree ){ if( pFree ){
while( (p->iFree < pFree->nEntry) && p->iFree>=0 ){ while( (p->iFree < pFree->nEntry) && p->iFree>=0 ){
FreelistEntry *pEntry = &pFree->aEntry[p->iFree]; FreelistEntry *pEntry = &pFree->aEntry[p->iFree];
if( (p->bReverse==0 && pEntry->iBlk>iBlk) if( (p->bReverse==0 && pEntry->iBlk>(u32)iBlk)
|| (p->bReverse!=0 && pEntry->iBlk<iBlk) || (p->bReverse!=0 && pEntry->iBlk<(u32)iBlk)
){ ){
break; break;
}else{ }else{
@ -654,7 +655,7 @@ static int walkFreelistCb(void *pCtx, int iBlk, i64 iSnapshot){
p->bDone = 1; p->bDone = 1;
return 1; return 1;
} }
if( pEntry->iBlk==iBlk ) return 0; if( pEntry->iBlk==(u32)iBlk ) return 0;
} }
} }
} }
@ -937,7 +938,7 @@ int lsmCheckpointWrite(lsm_db *pDb, int bTruncate, u32 *pnWrite){
u8 *aData; /* Meta-page data buffer */ u8 *aData; /* Meta-page data buffer */
int nData; /* Size of aData[] in bytes */ int nData; /* Size of aData[] in bytes */
i64 iCkpt; /* Id of checkpoint just loaded */ i64 iCkpt; /* Id of checkpoint just loaded */
i64 iDisk; /* Id of checkpoint already stored in db */ i64 iDisk = 0; /* Id of checkpoint already stored in db */
iCkpt = lsmCheckpointId(pDb->aSnapshot, 0); iCkpt = lsmCheckpointId(pDb->aSnapshot, 0);
rc = lsmFsMetaPageGet(pDb->pFS, 0, pShm->iMetaPage, &pPg); rc = lsmFsMetaPageGet(pDb->pFS, 0, pShm->iMetaPage, &pPg);
if( rc==LSM_OK ){ if( rc==LSM_OK ){
@ -1886,7 +1887,7 @@ int shmLockType(lsm_db *db, int iLock){
** (eOp==LSM_LOCK_EXCL) -> true if db has an EXCLUSIVE lock on iLock. ** (eOp==LSM_LOCK_EXCL) -> true if db has an EXCLUSIVE lock on iLock.
*/ */
int lsmShmAssertLock(lsm_db *db, int iLock, int eOp){ int lsmShmAssertLock(lsm_db *db, int iLock, int eOp){
int ret; int ret = 0;
int eHave; int eHave;
assert( iLock>=1 && iLock<=LSM_LOCK_READER(LSM_LOCK_NREADER-1) ); assert( iLock>=1 && iLock<=LSM_LOCK_READER(LSM_LOCK_NREADER-1) );

View File

@ -662,9 +662,9 @@ static int btreeCursorPtr(u8 *aData, int nData, int iCell){
nCell = pageGetNRec(aData, nData); nCell = pageGetNRec(aData, nData);
if( iCell>=nCell ){ if( iCell>=nCell ){
return pageGetPtr(aData, nData); return (int)pageGetPtr(aData, nData);
} }
return pageGetRecordPtr(aData, nData, iCell); return (int)pageGetRecordPtr(aData, nData, iCell);
} }
static int btreeCursorNext(BtreeCursor *pCsr){ static int btreeCursorNext(BtreeCursor *pCsr){
@ -751,7 +751,7 @@ static int btreeCursorFirst(BtreeCursor *pCsr){
Page *pPg = 0; Page *pPg = 0;
FileSystem *pFS = pCsr->pFS; FileSystem *pFS = pCsr->pFS;
int iPg = pCsr->pSeg->iRoot; int iPg = (int)pCsr->pSeg->iRoot;
do { do {
rc = lsmFsDbPageGet(pFS, pCsr->pSeg, iPg, &pPg); rc = lsmFsDbPageGet(pFS, pCsr->pSeg, iPg, &pPg);
@ -779,7 +779,7 @@ static int btreeCursorFirst(BtreeCursor *pCsr){
assert( pCsr->aPg[pCsr->nDepth].iCell==0 ); assert( pCsr->aPg[pCsr->nDepth].iCell==0 );
pCsr->aPg[pCsr->nDepth].pPage = pPg; pCsr->aPg[pCsr->nDepth].pPage = pPg;
pCsr->nDepth++; pCsr->nDepth++;
iPg = pageGetRecordPtr(aData, nData, 0); iPg = (int)pageGetRecordPtr(aData, nData, 0);
} }
} }
}while( rc==LSM_OK ); }while( rc==LSM_OK );
@ -871,7 +871,7 @@ static int btreeCursorRestore(
int nSeek; int nSeek;
int iTopicSeek; int iTopicSeek;
int iPg = 0; int iPg = 0;
int iLoad = pSeg->iRoot; int iLoad = (int)pSeg->iRoot;
Page *pPg = pCsr->aPg[nDepth-1].pPage; Page *pPg = pCsr->aPg[nDepth-1].pPage;
if( pageObjGetNRec(pPg)==0 ){ if( pageObjGetNRec(pPg)==0 ){
@ -903,7 +903,7 @@ static int btreeCursorRestore(
aData = fsPageData(pPg, &nData); aData = fsPageData(pPg, &nData);
assert( (pageGetFlags(aData, nData) & SEGMENT_BTREE_FLAG) ); assert( (pageGetFlags(aData, nData) & SEGMENT_BTREE_FLAG) );
iLoad = pageGetPtr(aData, nData); iLoad = (int)pageGetPtr(aData, nData);
iCell = pageGetNRec(aData, nData); iCell = pageGetNRec(aData, nData);
iMax = iCell-1; iMax = iCell-1;
iMin = 0; iMin = 0;
@ -926,7 +926,7 @@ static int btreeCursorRestore(
assert( res!=0 ); assert( res!=0 );
if( res<0 ){ if( res<0 ){
iLoad = iPtr; iLoad = (int)iPtr;
iCell = iTry; iCell = iTry;
iMax = iTry-1; iMax = iTry-1;
}else{ }else{
@ -1001,7 +1001,7 @@ static void segmentPtrSetPage(SegmentPtr *pPtr, Page *pNext){
int nData; int nData;
u8 *aData = fsPageData(pNext, &nData); u8 *aData = fsPageData(pNext, &nData);
pPtr->nCell = pageGetNRec(aData, nData); pPtr->nCell = pageGetNRec(aData, nData);
pPtr->flags = pageGetFlags(aData, nData); pPtr->flags = (u16)pageGetFlags(aData, nData);
pPtr->iPtr = pageGetPtr(aData, nData); pPtr->iPtr = pageGetPtr(aData, nData);
} }
pPtr->pPg = pNext; pPtr->pPg = pNext;
@ -1637,7 +1637,7 @@ static int segmentPtrSeek(
int *pbStop int *pbStop
){ ){
int (*xCmp)(void *, int, void *, int) = pCsr->pDb->xCmp; int (*xCmp)(void *, int, void *, int) = pCsr->pDb->xCmp;
int res; /* Result of comparison operation */ int res = 0; /* Result of comparison operation */
int rc = LSM_OK; int rc = LSM_OK;
int iMin; int iMin;
int iMax; int iMax;
@ -1759,7 +1759,7 @@ static int segmentPtrSeek(
} }
assert( rc!=LSM_OK || assertSeekResult(pCsr,pPtr,iTopic,pKey,nKey,eSeek) ); assert( rc!=LSM_OK || assertSeekResult(pCsr,pPtr,iTopic,pKey,nKey,eSeek) );
*piPtr = iPtrOut; *piPtr = (int)iPtrOut;
return rc; return rc;
} }
@ -1777,7 +1777,7 @@ static int seekInBtree(
Page *pPg = 0; Page *pPg = 0;
Blob blob = {0, 0, 0}; Blob blob = {0, 0, 0};
iPg = pSeg->iRoot; iPg = (int)pSeg->iRoot;
do { do {
Pgno *piFirst = 0; Pgno *piFirst = 0;
if( aPg ){ if( aPg ){
@ -1799,7 +1799,7 @@ static int seekInBtree(
flags = pageGetFlags(aData, nData); flags = pageGetFlags(aData, nData);
if( (flags & SEGMENT_BTREE_FLAG)==0 ) break; if( (flags & SEGMENT_BTREE_FLAG)==0 ) break;
iPg = pageGetPtr(aData, nData); iPg = (int)pageGetPtr(aData, nData);
nRec = pageGetNRec(aData, nData); nRec = pageGetNRec(aData, nData);
iMin = 0; iMin = 0;
@ -1825,7 +1825,7 @@ static int seekInBtree(
pCsr->pDb->xCmp, iTopic, pKey, nKey, iTopicT, pKeyT, nKeyT pCsr->pDb->xCmp, iTopic, pKey, nKey, iTopicT, pKeyT, nKeyT
); );
if( res<0 ){ if( res<0 ){
iPg = iPtr; iPg = (int)iPtr;
iMax = iTry-1; iMax = iTry-1;
}else{ }else{
iMin = iTry+1; iMin = iTry+1;
@ -1866,7 +1866,7 @@ static int seekInSegment(
if( rc==LSM_OK ) segmentPtrSetPage(pPtr, pPg); if( rc==LSM_OK ) segmentPtrSetPage(pPtr, pPg);
}else{ }else{
if( iPtr==0 ){ if( iPtr==0 ){
iPtr = pPtr->pSeg->iFirst; iPtr = (int)pPtr->pSeg->iFirst;
} }
if( rc==LSM_OK ){ if( rc==LSM_OK ){
rc = segmentPtrLoadPage(pCsr->pDb->pFS, pPtr, iPtr); rc = segmentPtrLoadPage(pCsr->pDb->pFS, pPtr, iPtr);
@ -1923,7 +1923,7 @@ static int seekInLevel(
** left-hand-side of the level in this case. */ ** left-hand-side of the level in this case. */
if( res<0 ){ if( res<0 ){
int iPtr = 0; int iPtr = 0;
if( nRhs==0 ) iPtr = *piPgno; if( nRhs==0 ) iPtr = (int)*piPgno;
rc = seekInSegment( rc = seekInSegment(
pCsr, &aPtr[0], iTopic, pKey, nKey, iPtr, eSeek, &iOut, &bStop pCsr, &aPtr[0], iTopic, pKey, nKey, iPtr, eSeek, &iOut, &bStop
@ -1935,7 +1935,7 @@ static int seekInLevel(
if( res>=0 ){ if( res>=0 ){
int bHit = 0; /* True if at least one rhs is not EOF */ int bHit = 0; /* True if at least one rhs is not EOF */
int iPtr = *piPgno; int iPtr = (int)*piPgno;
int i; int i;
for(i=1; rc==LSM_OK && i<=nRhs && bStop==0; i++){ for(i=1; rc==LSM_OK && i<=nRhs && bStop==0; i++){
SegmentPtr *pPtr = &aPtr[i]; SegmentPtr *pPtr = &aPtr[i];
@ -2617,7 +2617,7 @@ int lsmSortedWalkFreelist(
while( rc==LSM_OK && lsmMCursorValid(pCsr) && rtIsSystem(pCsr->eType) ){ while( rc==LSM_OK && lsmMCursorValid(pCsr) && rtIsSystem(pCsr->eType) ){
void *pKey; int nKey; void *pKey; int nKey;
void *pVal; int nVal; void *pVal = 0; int nVal = 0;
rc = lsmMCursorKey(pCsr, &pKey, &nKey); rc = lsmMCursorKey(pCsr, &pKey, &nKey);
if( rc==LSM_OK ) rc = lsmMCursorValue(pCsr, &pVal, &nVal); if( rc==LSM_OK ) rc = lsmMCursorValue(pCsr, &pVal, &nVal);
@ -3475,7 +3475,7 @@ static int mergeWorkerLoadHierarchy(MergeWorker *pMW){
lsm_env *pEnv = pMW->pDb->pEnv; lsm_env *pEnv = pMW->pDb->pEnv;
Page **apHier = 0; Page **apHier = 0;
int nHier = 0; int nHier = 0;
int iPg = pSeg->iRoot; int iPg = (int)pSeg->iRoot;
do { do {
Page *pPg = 0; Page *pPg = 0;
@ -3501,7 +3501,7 @@ static int mergeWorkerLoadHierarchy(MergeWorker *pMW){
nHier++; nHier++;
apHier[0] = pPg; apHier[0] = pPg;
iPg = pageGetPtr(aData, nData); iPg = (int)pageGetPtr(aData, nData);
}else{ }else{
lsmFsPageRelease(pPg); lsmFsPageRelease(pPg);
break; break;
@ -3620,9 +3620,9 @@ static int mergeWorkerBtreeWrite(
assert( lsmFsPageWritable(pOld) ); assert( lsmFsPageWritable(pOld) );
aData = fsPageData(pOld, &nData); aData = fsPageData(pOld, &nData);
if( eType==0 ){ if( eType==0 ){
nByte = 2 + 1 + lsmVarintLen32(iPtr) + lsmVarintLen32(iKeyPg); nByte = 2 + 1 + lsmVarintLen32((int)iPtr) + lsmVarintLen32((int)iKeyPg);
}else{ }else{
nByte = 2 + 1 + lsmVarintLen32(iPtr) + lsmVarintLen32(nKey) + nKey; nByte = 2 + 1 + lsmVarintLen32((int)iPtr) + lsmVarintLen32(nKey) + nKey;
} }
nRec = pageGetNRec(aData, nData); nRec = pageGetNRec(aData, nData);
nFree = SEGMENT_EOF(nData, nRec) - mergeWorkerPageOffset(aData, nData); nFree = SEGMENT_EOF(nData, nRec) - mergeWorkerPageOffset(aData, nData);
@ -3663,15 +3663,15 @@ static int mergeWorkerBtreeWrite(
aData = fsPageData(p->apHier[iLevel], &nData); aData = fsPageData(p->apHier[iLevel], &nData);
iOff = mergeWorkerPageOffset(aData, nData); iOff = mergeWorkerPageOffset(aData, nData);
nRec = pageGetNRec(aData, nData); nRec = pageGetNRec(aData, nData);
lsmPutU16(&aData[SEGMENT_CELLPTR_OFFSET(nData, nRec)], iOff); lsmPutU16(&aData[SEGMENT_CELLPTR_OFFSET(nData, nRec)], (u16)iOff);
lsmPutU16(&aData[SEGMENT_NRECORD_OFFSET(nData)], nRec+1); lsmPutU16(&aData[SEGMENT_NRECORD_OFFSET(nData)], (u16)(nRec+1));
if( eType==0 ){ if( eType==0 ){
aData[iOff++] = 0x00; aData[iOff++] = 0x00;
iOff += lsmVarintPut32(&aData[iOff], iPtr); iOff += lsmVarintPut32(&aData[iOff], (int)iPtr);
iOff += lsmVarintPut32(&aData[iOff], iKeyPg); iOff += lsmVarintPut32(&aData[iOff], (int)iKeyPg);
}else{ }else{
aData[iOff++] = eType; aData[iOff++] = eType;
iOff += lsmVarintPut32(&aData[iOff], iPtr); iOff += lsmVarintPut32(&aData[iOff], (int)iPtr);
iOff += lsmVarintPut32(&aData[iOff], nKey); iOff += lsmVarintPut32(&aData[iOff], nKey);
memcpy(&aData[iOff], pKey, nKey); memcpy(&aData[iOff], pKey, nKey);
} }
@ -3918,7 +3918,7 @@ static int mergeWorkerFirstPage(MergeWorker *pMW){
if( pCsr->pBtCsr ){ if( pCsr->pBtCsr ){
rc = LSM_OK; rc = LSM_OK;
iFPtr = pMW->pLevel->pNext->lhs.iFirst; iFPtr = (int)pMW->pLevel->pNext->lhs.iFirst;
}else if( pCsr->nPtr>0 ){ }else if( pCsr->nPtr>0 ){
Segment *pSeg; Segment *pSeg;
pSeg = pCsr->aPtr[pCsr->nPtr-1].pSeg; pSeg = pCsr->aPtr[pCsr->nPtr-1].pSeg;
@ -3927,7 +3927,7 @@ static int mergeWorkerFirstPage(MergeWorker *pMW){
u8 *aData; /* Buffer for page pPg */ u8 *aData; /* Buffer for page pPg */
int nData; /* Size of aData[] in bytes */ int nData; /* Size of aData[] in bytes */
aData = fsPageData(pPg, &nData); aData = fsPageData(pPg, &nData);
iFPtr = pageGetPtr(aData, nData); iFPtr = (int)pageGetPtr(aData, nData);
lsmFsPageRelease(pPg); lsmFsPageRelease(pPg);
} }
} }
@ -3953,11 +3953,11 @@ static int mergeWorkerWrite(
int nHdr; /* Space required for this record header */ int nHdr; /* Space required for this record header */
Page *pPg; /* Page to write to */ Page *pPg; /* Page to write to */
u8 *aData; /* Data buffer for page pWriter->pPage */ u8 *aData; /* Data buffer for page pWriter->pPage */
int nData; /* Size of buffer aData[] in bytes */ int nData = 0; /* Size of buffer aData[] in bytes */
int nRec; /* Number of records on page pPg */ int nRec = 0; /* Number of records on page pPg */
int iFPtr; /* Value of pointer in footer of pPg */ int iFPtr = 0; /* Value of pointer in footer of pPg */
int iRPtr = 0; /* Value of pointer written into record */ int iRPtr = 0; /* Value of pointer written into record */
int iOff; /* Current write offset within page pPg */ int iOff = 0; /* Current write offset within page pPg */
Segment *pSeg; /* Segment being written */ Segment *pSeg; /* Segment being written */
int flags = 0; /* If != 0, flags value for page footer */ int flags = 0; /* If != 0, flags value for page footer */
int bFirst = 0; /* True for first key of output run */ int bFirst = 0; /* True for first key of output run */
@ -3973,7 +3973,7 @@ static int mergeWorkerWrite(
if( pPg ){ if( pPg ){
aData = fsPageData(pPg, &nData); aData = fsPageData(pPg, &nData);
nRec = pageGetNRec(aData, nData); nRec = pageGetNRec(aData, nData);
iFPtr = pageGetPtr(aData, nData); iFPtr = (int)pageGetPtr(aData, nData);
iRPtr = iPtr - iFPtr; iRPtr = iPtr - iFPtr;
} }
@ -3999,7 +3999,7 @@ static int mergeWorkerWrite(
** marked read-only, advance to the next page of the output run. */ ** marked read-only, advance to the next page of the output run. */
iOff = pMerge->iOutputOff; iOff = pMerge->iOutputOff;
if( iOff<0 || pPg==0 || iOff+nHdr > SEGMENT_EOF(nData, nRec+1) ){ if( iOff<0 || pPg==0 || iOff+nHdr > SEGMENT_EOF(nData, nRec+1) ){
iFPtr = *pMW->pCsr->pPrevMergePtr; iFPtr = (int)*pMW->pCsr->pPrevMergePtr;
iRPtr = iPtr - iFPtr; iRPtr = iPtr - iFPtr;
iOff = 0; iOff = 0;
nRec = 0; nRec = 0;
@ -4033,12 +4033,12 @@ static int mergeWorkerWrite(
aData = fsPageData(pPg, &nData); aData = fsPageData(pPg, &nData);
/* Update the page footer. */ /* Update the page footer. */
lsmPutU16(&aData[SEGMENT_NRECORD_OFFSET(nData)], nRec+1); lsmPutU16(&aData[SEGMENT_NRECORD_OFFSET(nData)], (u16)(nRec+1));
lsmPutU16(&aData[SEGMENT_CELLPTR_OFFSET(nData, nRec)], iOff); lsmPutU16(&aData[SEGMENT_CELLPTR_OFFSET(nData, nRec)], (u16)iOff);
if( flags ) lsmPutU16(&aData[SEGMENT_FLAGS_OFFSET(nData)], flags); if( flags ) lsmPutU16(&aData[SEGMENT_FLAGS_OFFSET(nData)], (u16)flags);
/* Write the entry header into the current page. */ /* Write the entry header into the current page. */
aData[iOff++] = eType; /* 1 */ aData[iOff++] = (u8)eType; /* 1 */
iOff += lsmVarintPut32(&aData[iOff], iRPtr); /* 2 */ iOff += lsmVarintPut32(&aData[iOff], iRPtr); /* 2 */
iOff += lsmVarintPut32(&aData[iOff], nKey); /* 3 */ iOff += lsmVarintPut32(&aData[iOff], nKey); /* 3 */
if( rtIsWrite(eType) ) iOff += lsmVarintPut32(&aData[iOff], nVal); /* 4 */ if( rtIsWrite(eType) ) iOff += lsmVarintPut32(&aData[iOff], nVal); /* 4 */
@ -4260,7 +4260,7 @@ static int mergeWorkerStep(MergeWorker *pMW){
pVal = pCsr->val.pData; pVal = pCsr->val.pData;
} }
if( rc==LSM_OK ){ if( rc==LSM_OK ){
rc = mergeWorkerWrite(pMW, eType, pKey, nKey, pVal, nVal, iPtr); rc = mergeWorkerWrite(pMW, eType, pKey, nKey, pVal, nVal, (int)iPtr);
} }
} }
} }
@ -4581,7 +4581,7 @@ static int mergeWorkerInit(
SegmentPtr *pPtr; SegmentPtr *pPtr;
assert( pCsr->aPtr[i].pPg==0 ); assert( pCsr->aPtr[i].pPg==0 );
pPtr = &pCsr->aPtr[i]; pPtr = &pCsr->aPtr[i];
rc = segmentPtrLoadPage(pDb->pFS, pPtr, pInput->iPg); rc = segmentPtrLoadPage(pDb->pFS, pPtr, (int)pInput->iPg);
if( rc==LSM_OK && pPtr->nCell>0 ){ if( rc==LSM_OK && pPtr->nCell>0 ){
rc = segmentPtrLoadCell(pPtr, pInput->iCell); rc = segmentPtrLoadCell(pPtr, pInput->iCell);
} }
@ -5184,7 +5184,7 @@ static int doLsmSingleWork(
nUnsync = lsmCheckpointNWrite(pDb->pShmhdr->aSnap1, 0); nUnsync = lsmCheckpointNWrite(pDb->pShmhdr->aSnap1, 0);
nPgsz = lsmCheckpointPgsz(pDb->pShmhdr->aSnap1); nPgsz = lsmCheckpointPgsz(pDb->pShmhdr->aSnap1);
nMax = LSM_MIN(nMax, (pDb->nAutockpt/nPgsz) - (int)(nUnsync-nSync)); nMax = (int)LSM_MIN(nMax, (pDb->nAutockpt/nPgsz) - (int)(nUnsync-nSync));
if( nMax<nRem ){ if( nMax<nRem ){
bCkpt = 1; bCkpt = 1;
nRem = LSM_MAX(nMax, 0); nRem = LSM_MAX(nMax, 0);
@ -5522,7 +5522,7 @@ void sortedDumpPage(lsm_db *pDb, Segment *pRun, Page *pPg, int bVals){
aData = fsPageData(pPg, &nData); aData = fsPageData(pPg, &nData);
nRec = pageGetNRec(aData, nData); nRec = pageGetNRec(aData, nData);
iPtr = pageGetPtr(aData, nData); iPtr = (int)pageGetPtr(aData, nData);
flags = pageGetFlags(aData, nData); flags = pageGetFlags(aData, nData);
lsmStringInit(&s, pDb->pEnv); lsmStringInit(&s, pDb->pEnv);
@ -5533,7 +5533,7 @@ void sortedDumpPage(lsm_db *pDb, Segment *pRun, Page *pPg, int bVals){
Page *pRef = 0; /* Pointer to page iRef */ Page *pRef = 0; /* Pointer to page iRef */
int iChar; int iChar;
u8 *aKey; int nKey = 0; /* Key */ u8 *aKey; int nKey = 0; /* Key */
u8 *aVal; int nVal = 0; /* Value */ u8 *aVal = 0; int nVal = 0; /* Value */
int iTopic; int iTopic;
u8 *aCell; u8 *aCell;
int iPgPtr; int iPgPtr;
@ -5593,7 +5593,7 @@ static void infoCellDump(
){ ){
u8 *aData; int nData; /* Page data */ u8 *aData; int nData; /* Page data */
u8 *aKey; int nKey = 0; /* Key */ u8 *aKey; int nKey = 0; /* Key */
u8 *aVal; int nVal = 0; /* Value */ u8 *aVal = 0; int nVal = 0; /* Value */
int eType; int eType;
int iPgPtr; int iPgPtr;
Page *pRef = 0; /* Pointer to page iRef */ Page *pRef = 0; /* Pointer to page iRef */
@ -5705,7 +5705,7 @@ static int infoPageDump(
aData = fsPageData(pPg, &nData); aData = fsPageData(pPg, &nData);
nRec = pageGetNRec(aData, nData); nRec = pageGetNRec(aData, nData);
iPtr = pageGetPtr(aData, nData); iPtr = (int)pageGetPtr(aData, nData);
flags = pageGetFlags(aData, nData); flags = pageGetFlags(aData, nData);
lsmStringInit(&str, pDb->pEnv); lsmStringInit(&str, pDb->pEnv);

View File

@ -278,8 +278,9 @@ static int treeKeycmp(void *p1, int n1, void *p2, int n2){
** sub-tree of the node. ** sub-tree of the node.
*/ */
static u32 getChildPtr(TreeNode *p, int iVersion, int iCell){ static u32 getChildPtr(TreeNode *p, int iVersion, int iCell){
assert( iVersion>=0 );
assert( iCell>=0 && iCell<=array_size(p->aiChildPtr) ); assert( iCell>=0 && iCell<=array_size(p->aiChildPtr) );
if( p->iV2 && p->iV2<=iVersion && iCell==p->iV2Child ) return p->iV2Ptr; if( p->iV2 && p->iV2<=(u32)iVersion && iCell==p->iV2Child ) return p->iV2Ptr;
return p->aiChildPtr[iCell]; return p->aiChildPtr[iCell];
} }
@ -300,7 +301,7 @@ static int treeOffsetToChunk(u32 iOff){
*/ */
static void *treeShmptr(lsm_db *pDb, u32 iPtr){ static void *treeShmptr(lsm_db *pDb, u32 iPtr){
assert( (iPtr>>15)<pDb->nShm ); assert( (iPtr>>15)<(u32)pDb->nShm );
assert( pDb->apShm[iPtr>>15] ); assert( pDb->apShm[iPtr>>15] );
return iPtr ? treeShmptrUnsafe(pDb, iPtr) : 0; return iPtr ? treeShmptrUnsafe(pDb, iPtr) : 0;
@ -519,7 +520,7 @@ void dump_node_contents(
}else{ }else{
for(i=0; i<4 && nHeight>0; i++){ for(i=0; i<4 && nHeight>0; i++){
u32 iPtr = getChildPtr(pNode, pDb->treehdr.root.iTransId, i); u32 iPtr = getChildPtr(pNode, pDb->treehdr.root.iTransId, i);
zPath[nPath] = i+'0'; zPath[nPath] = (char)(i+'0');
zPath[nPath+1] = '/'; zPath[nPath+1] = '/';
if( iPtr ){ if( iPtr ){
@ -644,7 +645,7 @@ static u32 treeShmalloc(lsm_db *pDb, int bAlign, int nByte, int *pRc){
assert( iWrite ); assert( iWrite );
iChunk = treeOffsetToChunk(iWrite-1); iChunk = treeOffsetToChunk(iWrite-1);
iEof = (iChunk+1) * CHUNK_SIZE; iEof = (iChunk+1) * CHUNK_SIZE;
assert( iEof>=iWrite && (iEof-iWrite)<CHUNK_SIZE ); assert( iEof>=iWrite && (iEof-iWrite)<(u32)CHUNK_SIZE );
if( (iWrite+nByte)>iEof ){ if( (iWrite+nByte)>iEof ){
ShmChunk *pHdr; /* Header of chunk just finished (iChunk) */ ShmChunk *pHdr; /* Header of chunk just finished (iChunk) */
ShmChunk *pFirst; /* Header of chunk treehdr.iFirst */ ShmChunk *pFirst; /* Header of chunk treehdr.iFirst */
@ -757,7 +758,7 @@ static TreeKey *newTreeKey(
iWrite = (pDb->treehdr.iWrite & (LSM_SHM_CHUNK_SIZE-1)); iWrite = (pDb->treehdr.iWrite & (LSM_SHM_CHUNK_SIZE-1));
iWrite = LSM_MAX(iWrite, LSM_SHM_CHUNK_HDR); iWrite = LSM_MAX(iWrite, LSM_SHM_CHUNK_HDR);
nAlloc = LSM_MIN((LSM_SHM_CHUNK_SIZE-iWrite), nRem); nAlloc = LSM_MIN((LSM_SHM_CHUNK_SIZE-iWrite), (u32)nRem);
aAlloc = treeShmptr(pDb, treeShmalloc(pDb, 0, nAlloc, pRc)); aAlloc = treeShmptr(pDb, treeShmalloc(pDb, 0, nAlloc, pRc));
if( aAlloc==0 ) break; if( aAlloc==0 ) break;
@ -1209,7 +1210,7 @@ static int treeCheckLinkedList(lsm_db *db){
nVisit++; nVisit++;
} }
if( rc==LSM_OK && nVisit!=db->treehdr.nChunk-1 ){ if( rc==LSM_OK && (u32)nVisit!=db->treehdr.nChunk-1 ){
rc = LSM_CORRUPT_BKPT; rc = LSM_CORRUPT_BKPT;
} }
return rc; return rc;
@ -1259,7 +1260,7 @@ static int treeRepairList(lsm_db *db){
/* Iterate through all shm chunks. Find the smallest shm-id present in /* Iterate through all shm chunks. Find the smallest shm-id present in
** the shared-memory region. */ ** the shared-memory region. */
for(i=1; rc==LSM_OK && i<db->treehdr.nChunk; i++){ for(i=1; rc==LSM_OK && (u32)i<db->treehdr.nChunk; i++){
p = treeShmChunkRc(db, i, &rc); p = treeShmChunkRc(db, i, &rc);
if( p && (pMin==0 || shm_sequence_ge(pMin->iShmid, p->iShmid)) ){ if( p && (pMin==0 || shm_sequence_ge(pMin->iShmid, p->iShmid)) ){
pMin = p; pMin = p;
@ -1279,7 +1280,7 @@ static int treeRepairList(lsm_db *db){
/* Allocate space for a merge sort. */ /* Allocate space for a merge sort. */
nSort = 1; nSort = 1;
while( nSort < (db->treehdr.nChunk-1) ) nSort = nSort * 2; while( (u32)nSort < (db->treehdr.nChunk-1) ) nSort = nSort * 2;
nByte = sizeof(ShmChunkLoc) * nSort * 2; nByte = sizeof(ShmChunkLoc) * nSort * 2;
aSort = lsmMallocZeroRc(db->pEnv, nByte, &rc); aSort = lsmMallocZeroRc(db->pEnv, nByte, &rc);
iPrevShmid = pMin->iShmid; iPrevShmid = pMin->iShmid;
@ -1287,11 +1288,11 @@ static int treeRepairList(lsm_db *db){
/* Fix all shm-ids, if required. */ /* Fix all shm-ids, if required. */
if( rc==LSM_OK ){ if( rc==LSM_OK ){
iPrevShmid = pMin->iShmid-1; iPrevShmid = pMin->iShmid-1;
for(i=1; i<db->treehdr.nChunk; i++){ for(i=1; (u32)i<db->treehdr.nChunk; i++){
p = treeShmChunk(db, i); p = treeShmChunk(db, i);
aSort[i-1].pShm = p; aSort[i-1].pShm = p;
aSort[i-1].iLoc = i; aSort[i-1].iLoc = i;
if( i!=db->treehdr.iFirst ){ if( (u32)i!=db->treehdr.iFirst ){
if( shm_sequence_ge(p->iShmid, db->treehdr.iNextShmid) ){ if( shm_sequence_ge(p->iShmid, db->treehdr.iNextShmid) ){
p->iShmid = iPrevShmid--; p->iShmid = iPrevShmid--;
} }
@ -1375,7 +1376,7 @@ static void treeOverwriteKey(lsm_db *db, TreeCursor *pCsr, u32 iKey, int *pRc){
int iCell = pCsr->aiCell[pCsr->iNode]; int iCell = pCsr->aiCell[pCsr->iNode];
/* Create a copy of this node */ /* Create a copy of this node */
if( (pCsr->iNode>0 && pCsr->iNode==(p->nHeight-1)) ){ if( (pCsr->iNode>0 && (u32)pCsr->iNode==(p->nHeight-1)) ){
pNew = copyTreeLeaf(db, (TreeLeaf *)pNode, &iNew, pRc); pNew = copyTreeLeaf(db, (TreeLeaf *)pNode, &iNew, pRc);
}else{ }else{
pNew = copyTreeNode(db, pNode, &iNew, pRc); pNew = copyTreeNode(db, pNode, &iNew, pRc);
@ -1398,7 +1399,7 @@ static int treeNextIsEndDelete(lsm_db *db, TreeCursor *pCsr){
int iCell = pCsr->aiCell[iNode]+1; int iCell = pCsr->aiCell[iNode]+1;
/* Cursor currently points to a leaf node. */ /* Cursor currently points to a leaf node. */
assert( pCsr->iNode==(db->treehdr.root.nHeight-1) ); assert( (u32)pCsr->iNode==(db->treehdr.root.nHeight-1) );
while( iNode>=0 ){ while( iNode>=0 ){
TreeNode *pNode = pCsr->apTreeNode[iNode]; TreeNode *pNode = pCsr->apTreeNode[iNode];
@ -1419,7 +1420,7 @@ static int treePrevIsStartDelete(lsm_db *db, TreeCursor *pCsr){
int iNode = pCsr->iNode; int iNode = pCsr->iNode;
/* Cursor currently points to a leaf node. */ /* Cursor currently points to a leaf node. */
assert( pCsr->iNode==(db->treehdr.root.nHeight-1) ); assert( (u32)pCsr->iNode==(db->treehdr.root.nHeight-1) );
while( iNode>=0 ){ while( iNode>=0 ){
TreeNode *pNode = pCsr->apTreeNode[iNode]; TreeNode *pNode = pCsr->apTreeNode[iNode];
@ -1450,7 +1451,7 @@ static int treeInsertEntry(
u32 iTreeKey; u32 iTreeKey;
TreeRoot *p = &pDb->treehdr.root; TreeRoot *p = &pDb->treehdr.root;
TreeCursor csr; /* Cursor to seek to pKey/nKey */ TreeCursor csr; /* Cursor to seek to pKey/nKey */
int res; /* Result of seek operation on csr */ int res = 0; /* Result of seek operation on csr */
assert( nVal>=0 || pVal==0 ); assert( nVal>=0 || pVal==0 );
assert_tree_looks_ok(LSM_OK, pTree); assert_tree_looks_ok(LSM_OK, pTree);
@ -1597,9 +1598,9 @@ static int treeDeleteEntry(lsm_db *db, TreeCursor *pCsr, u32 iNewptr){
assert( pNode->aiKeyPtr[1] ); assert( pNode->aiKeyPtr[1] );
assert( pNode->aiKeyPtr[iSlot] ); assert( pNode->aiKeyPtr[iSlot] );
assert( iSlot==0 || iSlot==1 || iSlot==2 ); assert( iSlot==0 || iSlot==1 || iSlot==2 );
assert( (pCsr->iNode==(db->treehdr.root.nHeight-1))==(iNewptr==0) ); assert( ((u32)pCsr->iNode==(db->treehdr.root.nHeight-1))==(iNewptr==0) );
bLeaf = (pCsr->iNode==(p->nHeight-1) && p->nHeight>1); bLeaf = ((u32)pCsr->iNode==(p->nHeight-1) && p->nHeight>1);
if( pNode->aiKeyPtr[0] || pNode->aiKeyPtr[2] ){ if( pNode->aiKeyPtr[0] || pNode->aiKeyPtr[2] ){
/* There are currently at least 2 keys on this node. So just create /* There are currently at least 2 keys on this node. So just create
@ -1764,7 +1765,7 @@ static int treeDeleteEntry(lsm_db *db, TreeCursor *pCsr, u32 iNewptr){
iPSlot--; iPSlot--;
pNew1->aiKeyPtr[iKOut++] = pParent->aiKeyPtr[iPSlot]; pNew1->aiKeyPtr[iKOut++] = pParent->aiKeyPtr[iPSlot];
if( bLeaf==0 ) pNew1->aiChildPtr[iPOut++] = iNewptr; if( bLeaf==0 ) pNew1->aiChildPtr[iPOut++] = iNewptr;
pCsr->aiCell[pCsr->iNode] = iPSlot; pCsr->aiCell[pCsr->iNode] = (u8)iPSlot;
} }
rc = treeDeleteEntry(db, pCsr, iNew1); rc = treeDeleteEntry(db, pCsr, iNew1);
@ -1839,7 +1840,7 @@ int lsmTreeDelete(
} }
if( bDone==0 ){ if( bDone==0 ){
if( csr.iNode==(p->nHeight-1) ){ if( (u32)csr.iNode==(p->nHeight-1) ){
/* The element to delete already lies on a leaf node */ /* The element to delete already lies on a leaf node */
rc = treeDeleteEntry(db, &csr, 0); rc = treeDeleteEntry(db, &csr, 0);
}else{ }else{
@ -1854,7 +1855,7 @@ int lsmTreeDelete(
TreeKey *pKey; TreeKey *pKey;
int iNode = csr.iNode; int iNode = csr.iNode;
lsmTreeCursorNext(&csr); lsmTreeCursorNext(&csr);
assert( csr.iNode==(p->nHeight-1) ); assert( (u32)csr.iNode==(p->nHeight-1) );
iKey = csr.apTreeNode[csr.iNode]->aiKeyPtr[csr.aiCell[csr.iNode]]; iKey = csr.apTreeNode[csr.iNode]->aiKeyPtr[csr.aiCell[csr.iNode]];
lsmTreeCursorPrev(&csr); lsmTreeCursorPrev(&csr);
@ -2028,19 +2029,19 @@ int lsmTreeCursorSeek(TreeCursor *pCsr, void *pKey, int nKey, int *pRes){
} }
res = treeKeycmp((void *)&pTreeKey[1], pTreeKey->nKey, pKey, nKey); res = treeKeycmp((void *)&pTreeKey[1], pTreeKey->nKey, pKey, nKey);
if( res==0 ){ if( res==0 ){
pCsr->aiCell[iNode] = iTest; pCsr->aiCell[iNode] = (u8)iTest;
break; break;
} }
}else{ }else{
iTest = 1; iTest = 1;
} }
if( iNode<(pRoot->nHeight-1) ){ if( (u32)iNode<(pRoot->nHeight-1) ){
iNodePtr = getChildPtr(pNode, pRoot->iTransId, iTest + (res<0)); iNodePtr = getChildPtr(pNode, pRoot->iTransId, iTest + (res<0));
}else{ }else{
iNodePtr = 0; iNodePtr = 0;
} }
pCsr->aiCell[iNode] = iTest + (iNodePtr && (res<0)); pCsr->aiCell[iNode] = (u8)(iTest + (iNodePtr && (res<0)));
} }
*pRes = res; *pRes = res;
@ -2167,7 +2168,7 @@ int lsmTreeCursorPrev(TreeCursor *pCsr){
if( rc!=LSM_OK ) break; if( rc!=LSM_OK ) break;
pCsr->apTreeNode[pCsr->iNode] = pNode; pCsr->apTreeNode[pCsr->iNode] = pNode;
iCell = 1 + (pNode->aiKeyPtr[2]!=0) + (pCsr->iNode < iLeaf); iCell = 1 + (pNode->aiKeyPtr[2]!=0) + (pCsr->iNode < iLeaf);
pCsr->aiCell[pCsr->iNode] = iCell; pCsr->aiCell[pCsr->iNode] = (u8)iCell;
}while( pCsr->iNode < iLeaf ); }while( pCsr->iNode < iLeaf );
} }
@ -2179,7 +2180,7 @@ int lsmTreeCursorPrev(TreeCursor *pCsr){
iCell = pCsr->aiCell[pCsr->iNode]-1; iCell = pCsr->aiCell[pCsr->iNode]-1;
if( iCell>=0 && pCsr->apTreeNode[pCsr->iNode]->aiKeyPtr[iCell] ) break; if( iCell>=0 && pCsr->apTreeNode[pCsr->iNode]->aiKeyPtr[iCell] ) break;
}while( (--pCsr->iNode)>=0 ); }while( (--pCsr->iNode)>=0 );
pCsr->aiCell[pCsr->iNode] = iCell; pCsr->aiCell[pCsr->iNode] = (u8)iCell;
} }
#ifndef NDEBUG #ifndef NDEBUG
@ -2224,12 +2225,12 @@ int lsmTreeCursorEnd(TreeCursor *pCsr, int bLast){
pCsr->iNode++; pCsr->iNode++;
pCsr->apTreeNode[pCsr->iNode] = pNode; pCsr->apTreeNode[pCsr->iNode] = pNode;
if( pCsr->iNode<pRoot->nHeight-1 ){ if( (u32)pCsr->iNode<pRoot->nHeight-1 ){
iNodePtr = getChildPtr(pNode, pRoot->iTransId, iCell); iNodePtr = getChildPtr(pNode, pRoot->iTransId, iCell);
}else{ }else{
iNodePtr = 0; iNodePtr = 0;
} }
pCsr->aiCell[pCsr->iNode] = iCell - (iNodePtr==0 && bLast); pCsr->aiCell[pCsr->iNode] = (u8)(iCell - (iNodePtr==0 && bLast));
} }
return rc; return rc;

View File

@ -176,7 +176,7 @@ int lsmVarintGet32(u8 *z, int *piVal){
} }
ret = lsmSqlite4GetVarint64(z, &i); ret = lsmSqlite4GetVarint64(z, &i);
*piVal = i; *piVal = (int)i;
return ret; return ret;
} }

View File

@ -157,7 +157,7 @@ static int lsm1Close(sqlite3_vtab_cursor *cur){
*/ */
static int lsm1Next(sqlite3_vtab_cursor *cur){ static int lsm1Next(sqlite3_vtab_cursor *cur){
lsm1_cursor *pCur = (lsm1_cursor*)cur; lsm1_cursor *pCur = (lsm1_cursor*)cur;
int rc; int rc = LSM_OK;
if( pCur->bUnique ){ if( pCur->bUnique ){
pCur->atEof = 1; pCur->atEof = 1;
}else{ }else{
@ -368,7 +368,7 @@ static int lsm1EncodeKey(
pSpace = sqlite3_malloc( nVal+1 ); pSpace = sqlite3_malloc( nVal+1 );
if( pSpace==0 ) return SQLITE_NOMEM; if( pSpace==0 ) return SQLITE_NOMEM;
} }
pSpace[0] = eType; pSpace[0] = (unsigned char)eType;
memcpy(&pSpace[1], pVal, nVal); memcpy(&pSpace[1], pVal, nVal);
*ppKey = pSpace; *ppKey = pSpace;
*pnKey = nVal+1; *pnKey = nVal+1;
@ -385,7 +385,7 @@ static int lsm1EncodeKey(
uVal = iVal; uVal = iVal;
eType = LSM1_TYPE_POSITIVE; eType = LSM1_TYPE_POSITIVE;
} }
pSpace[0] = eType; pSpace[0] = (unsigned char)eType;
*ppKey = pSpace; *ppKey = pSpace;
*pnKey = 1 + lsm1PutVarint64(&pSpace[1], uVal); *pnKey = 1 + lsm1PutVarint64(&pSpace[1], uVal);
} }
@ -597,7 +597,7 @@ int lsm1Update(
const void *pKey; const void *pKey;
int nKey; int nKey;
int eType; int eType;
int rc; int rc = LSM_OK;
sqlite3_value *pValue; sqlite3_value *pValue;
const unsigned char *pVal; const unsigned char *pVal;
unsigned char *pData; unsigned char *pData;
@ -654,7 +654,7 @@ int lsm1Update(
if( pData==0 ){ if( pData==0 ){
rc = SQLITE_NOMEM; rc = SQLITE_NOMEM;
}else{ }else{
pData[0] = eType; pData[0] = (unsigned char)eType;
memcpy(&pData[1], pVal, nVal); memcpy(&pData[1], pVal, nVal);
rc = lsm_insert(p->pDb, pKey, nKey, pData, nVal+1); rc = lsm_insert(p->pDb, pKey, nKey, pData, nVal+1);
sqlite3_free(pData); sqlite3_free(pData);
@ -677,7 +677,7 @@ int lsm1Update(
aVal[i] = x & 0xff; aVal[i] = x & 0xff;
x >>= 8; x >>= 8;
} }
aVal[i] = eType; aVal[i] = (unsigned char)eType;
rc = lsm_insert(p->pDb, pKey, nKey, &aVal[i], 9-i); rc = lsm_insert(p->pDb, pKey, nKey, &aVal[i], 9-i);
break; break;
} }

View File

@ -648,7 +648,6 @@ static int lsmWin32OsShmMap(lsm_file *pFile, int iChunk, int sz, void **ppShm){
assert( sz>=0 ); assert( sz>=0 );
assert( sz==LSM_SHM_CHUNK_SIZE ); assert( sz==LSM_SHM_CHUNK_SIZE );
if( iChunk>=pWin32File->nShm ){ if( iChunk>=pWin32File->nShm ){
int i;
LPHANDLE ahNew; LPHANDLE ahNew;
LPVOID *apNew; LPVOID *apNew;
LARGE_INTEGER fileSize; LARGE_INTEGER fileSize;

View File

@ -1,5 +1,5 @@
C Add\ssupport\sfor\stab-completion\s(using\sthe\sext/misc/completion.c\svirtual\stable)\nto\sthe\scommand-line\sshell. C Fix\sharmless\scompiler\swarnings\sseen\swith\sMSVC\sfor\slsm1.
D 2017-07-11T13:59:07.400 D 2017-07-11T16:36:10.699
F Makefile.in 081e48dfe7f995d57ce1a88ddf4d2917b4349158648a6cd45b42beae30de3a12 F Makefile.in 081e48dfe7f995d57ce1a88ddf4d2917b4349158648a6cd45b42beae30de3a12
F Makefile.linux-gcc 7bc79876b875010e8c8f9502eb935ca92aa3c434 F Makefile.linux-gcc 7bc79876b875010e8c8f9502eb935ca92aa3c434
F Makefile.msc 20850e3e8d4d4791e0531955852d768eb06f24138214870d543abb1a47346fba F Makefile.msc 20850e3e8d4d4791e0531955852d768eb06f24138214870d543abb1a47346fba
@ -210,7 +210,7 @@ F ext/icu/README.txt d9fbbad0c2f647c3fdf715fc9fd64af53aedfc43
F ext/icu/icu.c 84900472a088a3a172c6c079f58a1d3a1952c332 F ext/icu/icu.c 84900472a088a3a172c6c079f58a1d3a1952c332
F ext/icu/sqliteicu.h 728867a802baa5a96de7495e9689a8e01715ef37 F ext/icu/sqliteicu.h 728867a802baa5a96de7495e9689a8e01715ef37
F ext/lsm1/Makefile a2ea4975162be8932b5efa727080f4982715d34c32035d9eb7a015ae78404981 F ext/lsm1/Makefile a2ea4975162be8932b5efa727080f4982715d34c32035d9eb7a015ae78404981
F ext/lsm1/Makefile.msc b9227a1d308f1e408b25557b32ce722517bc22343bd7b728b3ab3979cf2c8a1d F ext/lsm1/Makefile.msc f9b5f1f9f534231bf315d96364315928f9f06eae1a96435197c98c1f834e23b4
F ext/lsm1/lsm-test/README 87ea529d2abe615e856d4714bfe8bb185e6c2771b8612aa6298588b7b43e6f86 F ext/lsm1/lsm-test/README 87ea529d2abe615e856d4714bfe8bb185e6c2771b8612aa6298588b7b43e6f86
F ext/lsm1/lsm-test/lsmtest.h 5847594d4b43ec3412e1fd97104f7eb5fd770be55e691e6cb2e80929f86bebe3 F ext/lsm1/lsm-test/lsmtest.h 5847594d4b43ec3412e1fd97104f7eb5fd770be55e691e6cb2e80929f86bebe3
F ext/lsm1/lsm-test/lsmtest1.c 33158978327f800e82b6a47c09b86ace809f56a9ff10b0162273ec1186cc3153 F ext/lsm1/lsm-test/lsmtest1.c 33158978327f800e82b6a47c09b86ace809f56a9ff10b0162273ec1186cc3153
@ -237,20 +237,20 @@ F ext/lsm1/lsm-test/lsmtest_util.c 241622db5a332a09c8e6e7606b617d288a37b557f7d3b
F ext/lsm1/lsm-test/lsmtest_win32.c 5605aac3bf3852dcc2509fb1d097f5f11556418c1cc9cf0fdd09f9af53c97fb4 F ext/lsm1/lsm-test/lsmtest_win32.c 5605aac3bf3852dcc2509fb1d097f5f11556418c1cc9cf0fdd09f9af53c97fb4
F ext/lsm1/lsm.h 0f6f64ff071471cb87bf98beb8386566f30ea001 F ext/lsm1/lsm.h 0f6f64ff071471cb87bf98beb8386566f30ea001
F ext/lsm1/lsmInt.h 68945f00c4fc97a5c82bd285a15d0baacd0019cf2e0b7d535759f000459462e1 F ext/lsm1/lsmInt.h 68945f00c4fc97a5c82bd285a15d0baacd0019cf2e0b7d535759f000459462e1
F ext/lsm1/lsm_ckpt.c 6ab5f08f60f802601eef0d2bad968d8f3729b908f88131e72311b2c2deaa7734 F ext/lsm1/lsm_ckpt.c 3f88c5b4f37f033636c13c71c89d02f8104a4a97284b525516718041dfb4e672
F ext/lsm1/lsm_file.c fc95548f8cf8e47fda4120215d2c1fc22dfa85e09294e5656a99a846dc80a62b F ext/lsm1/lsm_file.c 04049405abcd7cb9bec1c21c3a690a64e97d80362d37649733d3871aaab956d9
F ext/lsm1/lsm_log.c 8308714659b9fe4a995c239528520c57d26a03baf1d1c973967493a089a79cc6 F ext/lsm1/lsm_log.c a8bf334532109bba05b09a504ee45fc393828b0d034ca61ab45e3940709d9a7c
F ext/lsm1/lsm_main.c 15e73ccdafdd44ddeefc29e332079d88ba8f00c12c797b3c2b63d3171b5afce8 F ext/lsm1/lsm_main.c 15e73ccdafdd44ddeefc29e332079d88ba8f00c12c797b3c2b63d3171b5afce8
F ext/lsm1/lsm_mem.c 4c51ea9fa285ee6e35301b33491642d071740a0a F ext/lsm1/lsm_mem.c 4c51ea9fa285ee6e35301b33491642d071740a0a
F ext/lsm1/lsm_mutex.c 378edf0a2b142b4f7640ee982df06d50b98788ea F ext/lsm1/lsm_mutex.c 378edf0a2b142b4f7640ee982df06d50b98788ea
F ext/lsm1/lsm_shared.c 54185ae27b7580a959127c700459b3358e39723afce12b6281f2dfe408cb0efd F ext/lsm1/lsm_shared.c 6b903d1afce9e254b642be7898359b4760afde6fb5740623bae4affff5726ab8
F ext/lsm1/lsm_sorted.c 9bc5251a54a5cb24c2f003c10595fa81ffc7178c4f200c6b0f83d50a2272bb1d F ext/lsm1/lsm_sorted.c ad426f7ed930ff4bd0405fbf77e06b48cdaabd11673cc39870b4cf7e5d92109e
F ext/lsm1/lsm_str.c 65e361b488c87b10bf3e5c0070b14ffc602cf84f094880bece77bbf6678bca82 F ext/lsm1/lsm_str.c 65e361b488c87b10bf3e5c0070b14ffc602cf84f094880bece77bbf6678bca82
F ext/lsm1/lsm_tree.c 53b657439e0fcb1117b0559ad3567ac417f81f2ed0fff9bab79948a00ea3cacb F ext/lsm1/lsm_tree.c 682679d7ef2b8b6f2fe77aeb532c8d29695bca671c220b0abac77069de5fb9fb
F ext/lsm1/lsm_unix.c 57361bcf5b1a1a028f5d66571ee490e9064d2cfb145a2cc9e5ddade467bb551b F ext/lsm1/lsm_unix.c 57361bcf5b1a1a028f5d66571ee490e9064d2cfb145a2cc9e5ddade467bb551b
F ext/lsm1/lsm_varint.c b19ae9bd26b5a1e8402fb8a564b25d9542338a41 F ext/lsm1/lsm_varint.c 43f954af668a66c7928b81597c14d6ad4be9fedbc276bbd80f52fa28a02fdb62
F ext/lsm1/lsm_vtab.c 812b74a9a7539e8cab49761591ffddc1b3580735fac5d638826c8d2be95ff38b F ext/lsm1/lsm_vtab.c e4afff67205741075b74d6c598f9f9967bbdec8eb306bdc7cc1dcd0c71bffbd9
F ext/lsm1/lsm_win32.c 515f8298982e0e8aa7c6677389ffc66c65a5ff294baf678eefa19b6e61c239c3 F ext/lsm1/lsm_win32.c 0a4acbd7e8d136dd3a5753f0a9e7a9802263a9d96cef3278cf120bcaa724db7c
F ext/misc/README.md 8e008c8d2b02e09096b31dfba033253ac27c6c06a18aa5826e299fa7601d90b2 F ext/misc/README.md 8e008c8d2b02e09096b31dfba033253ac27c6c06a18aa5826e299fa7601d90b2
F ext/misc/amatch.c 6db4607cb17c54b853a2d7c7c36046d004853f65b9b733e6f019d543d5dfae87 F ext/misc/amatch.c 6db4607cb17c54b853a2d7c7c36046d004853f65b9b733e6f019d543d5dfae87
F ext/misc/anycollseq.c 5ffdfde9829eeac52219136ad6aa7cd9a4edb3b15f4f2532de52f4a22525eddb F ext/misc/anycollseq.c 5ffdfde9829eeac52219136ad6aa7cd9a4edb3b15f4f2532de52f4a22525eddb
@ -1631,7 +1631,7 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93
F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc
F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e
F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0
P 17e0bb12d82b510b86b6886b9fd0faf39b60b1374027344f89d7b89a32b842b9 P 95cd1d9f8baa6be305c9a8bfa26fef2a403f2d5b3b5c9c55382ec04f0bc98d40
R 951f8f3a9284f3001be7f39a25c50055 R e5707d39e2420bcc7332884f2942bda4
U drh U mistachkin
Z 55996074e61f063450435131cf82f298 Z 7cd7cb2156c8cf8d5e8c4a5374c20532

View File

@ -1 +1 @@
95cd1d9f8baa6be305c9a8bfa26fef2a403f2d5b3b5c9c55382ec04f0bc98d40 cf6da4a52f7f9047e653ef2972e4c0910b29d7182d789a9e30225dc1849e8779