Fix MSVC compiler warnings in test code.
FossilOrigin-Name: cb7a850439c9a4a7887650d6b81d95ab8025de5b
This commit is contained in:
+4
-3
@@ -3263,7 +3263,7 @@ static int test_bind_text16(
|
||||
char *value;
|
||||
int rc;
|
||||
|
||||
void (*xDel)() = (objc==6?SQLITE_STATIC:SQLITE_TRANSIENT);
|
||||
void (*xDel)(void*) = (objc==6?SQLITE_STATIC:SQLITE_TRANSIENT);
|
||||
Tcl_Obj *oStmt = objv[objc-4];
|
||||
Tcl_Obj *oN = objv[objc-3];
|
||||
Tcl_Obj *oString = objv[objc-2];
|
||||
@@ -3611,7 +3611,7 @@ static int test_prepare(
|
||||
if( bytes>=0 ){
|
||||
bytes = bytes - (zTail-zSql);
|
||||
}
|
||||
if( strlen(zTail)<bytes ){
|
||||
if( (int)strlen(zTail)<bytes ){
|
||||
bytes = strlen(zTail);
|
||||
}
|
||||
Tcl_ObjSetVar2(interp, objv[4], 0, Tcl_NewStringObj(zTail, bytes), 0);
|
||||
@@ -5816,6 +5816,7 @@ struct win32FileLocker {
|
||||
|
||||
|
||||
#if SQLITE_OS_WIN
|
||||
#include <process.h>
|
||||
/*
|
||||
** The background thread that does file locking.
|
||||
*/
|
||||
@@ -6128,7 +6129,7 @@ int Sqlitetest1_Init(Tcl_Interp *interp){
|
||||
#endif
|
||||
#ifdef SQLITE_ENABLE_COLUMN_METADATA
|
||||
{"sqlite3_column_database_name16",
|
||||
test_stmt_utf16, sqlite3_column_database_name16},
|
||||
test_stmt_utf16, (void*)sqlite3_column_database_name16},
|
||||
{"sqlite3_column_table_name16", test_stmt_utf16, (void*)sqlite3_column_table_name16},
|
||||
{"sqlite3_column_origin_name16", test_stmt_utf16, (void*)sqlite3_column_origin_name16},
|
||||
#endif
|
||||
|
||||
+1
-1
@@ -465,7 +465,7 @@ static int btree_varint_test(
|
||||
if( Tcl_GetInt(interp, argv[4], (int*)&incr) ) return TCL_ERROR;
|
||||
in = start;
|
||||
in *= mult;
|
||||
for(i=0; i<count; i++){
|
||||
for(i=0; i<(int)count; i++){
|
||||
char zErr[200];
|
||||
n1 = putVarint(zBuf, in);
|
||||
if( n1>9 || n1<1 ){
|
||||
|
||||
+8
-8
@@ -177,7 +177,7 @@ static int writeDbFile(CrashFile *p, u8 *z, i64 iAmt, i64 iOff){
|
||||
iSkip = 512;
|
||||
}
|
||||
if( (iAmt-iSkip)>0 ){
|
||||
rc = sqlite3OsWrite(p->pRealFile, &z[iSkip], iAmt-iSkip, iOff+iSkip);
|
||||
rc = sqlite3OsWrite(p->pRealFile, &z[iSkip], (int)(iAmt-iSkip), iOff+iSkip);
|
||||
}
|
||||
return rc;
|
||||
}
|
||||
@@ -306,8 +306,8 @@ static int writeListSync(CrashFile *pFile, int isCrash){
|
||||
}
|
||||
case 3: { /* Trash sectors */
|
||||
u8 *zGarbage;
|
||||
int iFirst = (pWrite->iOffset/g.iSectorSize);
|
||||
int iLast = (pWrite->iOffset+pWrite->nBuf-1)/g.iSectorSize;
|
||||
int iFirst = (int)(pWrite->iOffset/g.iSectorSize);
|
||||
int iLast = (int)((pWrite->iOffset+pWrite->nBuf-1)/g.iSectorSize);
|
||||
|
||||
assert(pWrite->zBuf);
|
||||
|
||||
@@ -430,7 +430,7 @@ static int cfWrite(
|
||||
){
|
||||
CrashFile *pCrash = (CrashFile *)pFile;
|
||||
if( iAmt+iOfst>pCrash->iSize ){
|
||||
pCrash->iSize = iAmt+iOfst;
|
||||
pCrash->iSize = (int)(iAmt+iOfst);
|
||||
}
|
||||
while( pCrash->iSize>pCrash->nData ){
|
||||
u8 *zNew;
|
||||
@@ -454,7 +454,7 @@ static int cfTruncate(sqlite3_file *pFile, sqlite_int64 size){
|
||||
CrashFile *pCrash = (CrashFile *)pFile;
|
||||
assert(size>=0);
|
||||
if( pCrash->iSize>size ){
|
||||
pCrash->iSize = size;
|
||||
pCrash->iSize = (int)size;
|
||||
}
|
||||
return writeListAppend(pFile, size, 0, 0);
|
||||
}
|
||||
@@ -518,7 +518,7 @@ static int cfFileControl(sqlite3_file *pFile, int op, void *pArg){
|
||||
i64 nByte = *(i64 *)pArg;
|
||||
if( nByte>pCrash->iSize ){
|
||||
if( SQLITE_OK==writeListAppend(pFile, nByte, 0, 0) ){
|
||||
pCrash->iSize = nByte;
|
||||
pCrash->iSize = (int)nByte;
|
||||
}
|
||||
}
|
||||
return SQLITE_OK;
|
||||
@@ -635,11 +635,11 @@ static int cfOpen(
|
||||
iChunk = PENDING_BYTE;
|
||||
}
|
||||
memset(pWrapper->zData, 0, pWrapper->nData);
|
||||
rc = sqlite3OsRead(pReal, pWrapper->zData, iChunk, 0);
|
||||
rc = sqlite3OsRead(pReal, pWrapper->zData, (int)iChunk, 0);
|
||||
if( SQLITE_OK==rc && pWrapper->iSize>(PENDING_BYTE+512) && isDb ){
|
||||
i64 iOff = PENDING_BYTE+512;
|
||||
iChunk = pWrapper->iSize - iOff;
|
||||
rc = sqlite3OsRead(pReal, &pWrapper->zData[iOff], iChunk, iOff);
|
||||
rc = sqlite3OsRead(pReal, &pWrapper->zData[iOff], (int)iChunk, iOff);
|
||||
}
|
||||
}else{
|
||||
rc = SQLITE_NOMEM;
|
||||
|
||||
+5
-5
@@ -404,7 +404,7 @@ static int openTransaction(jt_file *pMain, jt_file *pJournal){
|
||||
/* Calculate and store a checksum for each page in the database file. */
|
||||
if( rc==SQLITE_OK ){
|
||||
int ii;
|
||||
for(ii=0; rc==SQLITE_OK && ii<pMain->nPage; ii++){
|
||||
for(ii=0; rc==SQLITE_OK && ii<(int)pMain->nPage; ii++){
|
||||
i64 iOff = (i64)(pMain->nPagesize) * (i64)ii;
|
||||
if( iOff==PENDING_BYTE ) continue;
|
||||
rc = sqlite3OsRead(pMain->pReal, aData, pMain->nPagesize, iOff);
|
||||
@@ -466,7 +466,7 @@ static int readJournalFile(jt_file *p, jt_file *pMain){
|
||||
continue;
|
||||
}
|
||||
}
|
||||
nRec = (iSize-iOff) / (pMain->nPagesize+8);
|
||||
nRec = (u32)((iSize-iOff) / (pMain->nPagesize+8));
|
||||
}
|
||||
|
||||
/* Read all the records that follow the journal-header just read. */
|
||||
@@ -538,7 +538,7 @@ static int jtWrite(
|
||||
}
|
||||
|
||||
if( p->flags&SQLITE_OPEN_MAIN_DB && p->pWritable ){
|
||||
if( iAmt<p->nPagesize
|
||||
if( iAmt<(int)p->nPagesize
|
||||
&& p->nPagesize%iAmt==0
|
||||
&& iOfst>=(PENDING_BYTE+512)
|
||||
&& iOfst+iAmt<=PENDING_BYTE+p->nPagesize
|
||||
@@ -549,7 +549,7 @@ static int jtWrite(
|
||||
** pending-byte page.
|
||||
*/
|
||||
}else{
|
||||
u32 pgno = iOfst/p->nPagesize + 1;
|
||||
u32 pgno = (u32)(iOfst/p->nPagesize + 1);
|
||||
assert( (iAmt==1||iAmt==p->nPagesize) && ((iOfst+iAmt)%p->nPagesize)==0 );
|
||||
assert( pgno<=p->nPage || p->nSync>0 );
|
||||
assert( pgno>p->nPage || sqlite3BitvecTest(p->pWritable, pgno) );
|
||||
@@ -578,7 +578,7 @@ static int jtTruncate(sqlite3_file *pFile, sqlite_int64 size){
|
||||
if( p->flags&SQLITE_OPEN_MAIN_DB && p->pWritable ){
|
||||
u32 pgno;
|
||||
u32 locking_page = (u32)(PENDING_BYTE/p->nPagesize+1);
|
||||
for(pgno=size/p->nPagesize+1; pgno<=p->nPage; pgno++){
|
||||
for(pgno=(u32)(size/p->nPagesize+1); pgno<=p->nPage; pgno++){
|
||||
assert( pgno==locking_page || sqlite3BitvecTest(p->pWritable, pgno) );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -529,7 +529,7 @@ static int multiplexOpen(
|
||||
pGroup->bEnabled = -1;
|
||||
pGroup->bTruncate = sqlite3_uri_boolean(zUri, "truncate",
|
||||
(flags & SQLITE_OPEN_MAIN_DB)==0);
|
||||
pGroup->szChunk = sqlite3_uri_int64(zUri, "chunksize",
|
||||
pGroup->szChunk = (int)sqlite3_uri_int64(zUri, "chunksize",
|
||||
SQLITE_MULTIPLEX_CHUNK_SIZE);
|
||||
pGroup->szChunk = (pGroup->szChunk+0xffff)&~0xffff;
|
||||
if( zName ){
|
||||
@@ -597,7 +597,7 @@ static int multiplexOpen(
|
||||
bExists = multiplexSubSize(pGroup, 1, &rc)>0;
|
||||
if( rc==SQLITE_OK && bExists && sz==(sz&0xffff0000) && sz>0
|
||||
&& sz!=pGroup->szChunk ){
|
||||
pGroup->szChunk = sz;
|
||||
pGroup->szChunk = (int)sz;
|
||||
}else if( rc==SQLITE_OK && !bExists && sz>pGroup->szChunk ){
|
||||
pGroup->bEnabled = 0;
|
||||
}
|
||||
|
||||
+10
-10
@@ -288,7 +288,7 @@ static int tmpWrite(
|
||||
){
|
||||
tmp_file *pTmp = (tmp_file *)pFile;
|
||||
if( (iAmt+iOfst)>pTmp->nAlloc ){
|
||||
int nNew = 2*(iAmt+iOfst+pTmp->nAlloc);
|
||||
int nNew = (int)(2*(iAmt+iOfst+pTmp->nAlloc));
|
||||
char *zNew = sqlite3_realloc(pTmp->zAlloc, nNew);
|
||||
if( !zNew ){
|
||||
return SQLITE_NOMEM;
|
||||
@@ -297,7 +297,7 @@ static int tmpWrite(
|
||||
pTmp->nAlloc = nNew;
|
||||
}
|
||||
memcpy(&pTmp->zAlloc[iOfst], zBuf, iAmt);
|
||||
pTmp->nSize = MAX(pTmp->nSize, iOfst+iAmt);
|
||||
pTmp->nSize = (int)MAX(pTmp->nSize, iOfst+iAmt);
|
||||
return SQLITE_OK;
|
||||
}
|
||||
|
||||
@@ -306,7 +306,7 @@ static int tmpWrite(
|
||||
*/
|
||||
static int tmpTruncate(sqlite3_file *pFile, sqlite_int64 size){
|
||||
tmp_file *pTmp = (tmp_file *)pFile;
|
||||
pTmp->nSize = MIN(pTmp->nSize, size);
|
||||
pTmp->nSize = (int)MIN(pTmp->nSize, size);
|
||||
return SQLITE_OK;
|
||||
}
|
||||
|
||||
@@ -418,7 +418,7 @@ static int fsRead(
|
||||
/* Journal file. */
|
||||
int iRem = iAmt;
|
||||
int iBuf = 0;
|
||||
int ii = iOfst;
|
||||
int ii = (int)iOfst;
|
||||
while( iRem>0 && rc==SQLITE_OK ){
|
||||
int iRealOff = pReal->nBlob - BLOCKSIZE*((ii/BLOCKSIZE)+1) + ii%BLOCKSIZE;
|
||||
int iRealAmt = MIN(iRem, BLOCKSIZE - (iRealOff%BLOCKSIZE));
|
||||
@@ -453,14 +453,14 @@ static int fsWrite(
|
||||
}else{
|
||||
rc = pF->pMethods->xWrite(pF, zBuf, iAmt, iOfst+BLOCKSIZE);
|
||||
if( rc==SQLITE_OK ){
|
||||
pReal->nDatabase = MAX(pReal->nDatabase, iAmt+iOfst);
|
||||
pReal->nDatabase = (int)MAX(pReal->nDatabase, iAmt+iOfst);
|
||||
}
|
||||
}
|
||||
}else{
|
||||
/* Journal file. */
|
||||
int iRem = iAmt;
|
||||
int iBuf = 0;
|
||||
int ii = iOfst;
|
||||
int ii = (int)iOfst;
|
||||
while( iRem>0 && rc==SQLITE_OK ){
|
||||
int iRealOff = pReal->nBlob - BLOCKSIZE*((ii/BLOCKSIZE)+1) + ii%BLOCKSIZE;
|
||||
int iRealAmt = MIN(iRem, BLOCKSIZE - (iRealOff%BLOCKSIZE));
|
||||
@@ -475,7 +475,7 @@ static int fsWrite(
|
||||
}
|
||||
}
|
||||
if( rc==SQLITE_OK ){
|
||||
pReal->nJournal = MAX(pReal->nJournal, iAmt+iOfst);
|
||||
pReal->nJournal = (int)MAX(pReal->nJournal, iAmt+iOfst);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -489,9 +489,9 @@ static int fsTruncate(sqlite3_file *pFile, sqlite_int64 size){
|
||||
fs_file *p = (fs_file *)pFile;
|
||||
fs_real_file *pReal = p->pReal;
|
||||
if( p->eType==DATABASE_FILE ){
|
||||
pReal->nDatabase = MIN(pReal->nDatabase, size);
|
||||
pReal->nDatabase = (int)MIN(pReal->nDatabase, size);
|
||||
}else{
|
||||
pReal->nJournal = MIN(pReal->nJournal, size);
|
||||
pReal->nJournal = (int)MIN(pReal->nJournal, size);
|
||||
}
|
||||
return SQLITE_OK;
|
||||
}
|
||||
@@ -641,7 +641,7 @@ static int fsOpen(
|
||||
pReal->nBlob = BLOBSIZE;
|
||||
}else{
|
||||
unsigned char zS[4];
|
||||
pReal->nBlob = size;
|
||||
pReal->nBlob = (int)size;
|
||||
rc = pRealFile->pMethods->xRead(pRealFile, zS, 4, 0);
|
||||
pReal->nDatabase = (zS[0]<<24)+(zS[1]<<16)+(zS[2]<<8)+zS[3];
|
||||
if( rc==SQLITE_OK ){
|
||||
|
||||
+4
-4
@@ -242,7 +242,7 @@ static sqlite3_uint64 vfslog_time(){
|
||||
}
|
||||
#endif
|
||||
|
||||
static void vfslog_call(sqlite3_vfs *, int, int, int, int, int, int);
|
||||
static void vfslog_call(sqlite3_vfs *, int, int, sqlite3_int64, int, int, int);
|
||||
static void vfslog_string(sqlite3_vfs *, const char *);
|
||||
|
||||
/*
|
||||
@@ -648,7 +648,7 @@ static void vfslog_call(
|
||||
sqlite3_vfs *pVfs,
|
||||
int eEvent,
|
||||
int iFileid,
|
||||
int nClick,
|
||||
sqlite3_int64 nClick,
|
||||
int return_code,
|
||||
int size,
|
||||
int offset
|
||||
@@ -661,7 +661,7 @@ static void vfslog_call(
|
||||
zRec = (unsigned char *)&p->aBuf[p->nBuf];
|
||||
put32bits(&zRec[0], eEvent);
|
||||
put32bits(&zRec[4], iFileid);
|
||||
put32bits(&zRec[8], nClick);
|
||||
put32bits(&zRec[8], (unsigned int)(nClick&0xffff));
|
||||
put32bits(&zRec[12], return_code);
|
||||
put32bits(&zRec[16], size);
|
||||
put32bits(&zRec[20], offset);
|
||||
@@ -1043,7 +1043,7 @@ static int vlogColumn(
|
||||
}
|
||||
case 1: {
|
||||
char *zStr = pCsr->zTransient;
|
||||
if( val!=0 && val<pCsr->nFile ){
|
||||
if( val!=0 && val<(unsigned)pCsr->nFile ){
|
||||
zStr = pCsr->azFile[val];
|
||||
}
|
||||
sqlite3_result_text(ctx, zStr, -1, SQLITE_TRANSIENT);
|
||||
|
||||
+1
-1
@@ -1060,7 +1060,7 @@ size_t sqlite3_quota_fwrite(
|
||||
}
|
||||
if( szNew>pGroup->iLimit && pGroup->iLimit>0 ){
|
||||
iEnd = pGroup->iLimit - pGroup->iSize + pFile->iSize;
|
||||
nmemb = (iEnd - iOfst)/size;
|
||||
nmemb = (size_t)((iEnd - iOfst)/size);
|
||||
iEnd = iOfst + size*nmemb;
|
||||
szNew = pGroup->iSize - pFile->iSize + iEnd;
|
||||
}
|
||||
|
||||
+5
-4
@@ -324,12 +324,13 @@ static int statDecodePage(Btree *pBt, StatPage *p){
|
||||
u64 dummy;
|
||||
iOff += sqlite3GetVarint(&aData[iOff], &dummy);
|
||||
}
|
||||
if( nPayload>p->nMxPayload ) p->nMxPayload = nPayload;
|
||||
if( nPayload>(u32)p->nMxPayload ) p->nMxPayload = nPayload;
|
||||
getLocalPayload(nUsable, p->flags, nPayload, &nLocal);
|
||||
pCell->nLocal = nLocal;
|
||||
assert( nLocal>=0 );
|
||||
assert( nPayload>=nLocal );
|
||||
assert( nLocal<=(nUsable-35) );
|
||||
if( nPayload>nLocal ){
|
||||
if( nPayload>(u32)nLocal ){
|
||||
int j;
|
||||
int nOvfl = ((nPayload - nLocal) + nUsable-4 - 1) / (nUsable - 4);
|
||||
pCell->nLastOvfl = (nPayload-nLocal) - (nOvfl-1) * (nUsable-4);
|
||||
@@ -378,7 +379,7 @@ static void statSizeAndOffset(StatCursor *pCsr){
|
||||
x[0] = pCsr->iPageno;
|
||||
if( sqlite3OsFileControl(fd, 230440, &x)==SQLITE_OK ){
|
||||
pCsr->iOffset = x[0];
|
||||
pCsr->szPage = x[1];
|
||||
pCsr->szPage = (int)x[1];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -400,7 +401,7 @@ static int statNext(sqlite3_vtab_cursor *pCursor){
|
||||
rc = sqlite3_step(pCsr->pStmt);
|
||||
if( rc==SQLITE_ROW ){
|
||||
int nPage;
|
||||
u32 iRoot = sqlite3_column_int64(pCsr->pStmt, 1);
|
||||
u32 iRoot = (u32)sqlite3_column_int64(pCsr->pStmt, 1);
|
||||
sqlite3PagerPagecount(pPager, &nPage);
|
||||
if( nPage==0 ){
|
||||
pCsr->isEof = 1;
|
||||
|
||||
@@ -33,8 +33,8 @@
|
||||
typedef struct wholenumber_cursor wholenumber_cursor;
|
||||
struct wholenumber_cursor {
|
||||
sqlite3_vtab_cursor base; /* Base class - must be first */
|
||||
unsigned iValue; /* Current value */
|
||||
unsigned mxValue; /* Maximum value */
|
||||
sqlite3_int64 iValue; /* Current value */
|
||||
sqlite3_int64 mxValue; /* Maximum value */
|
||||
};
|
||||
|
||||
/* Methods for the wholenumber module */
|
||||
|
||||
Reference in New Issue
Block a user