From: shaneh Date: Fri, 2 Jul 2010 17:05:03 +0000 (+0000) Subject: Fix some warnings when compiling under MSVC. X-Git-Tag: version-3.7.2~203^2~14 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=5eba1f60fe9f1f29d84e555eb77a9fb19e06adc3;p=thirdparty%2Fsqlite.git Fix some warnings when compiling under MSVC. FossilOrigin-Name: 708338773919fa024abbba55180654beb60e6d84 --- diff --git a/manifest b/manifest index eb168f7314..6cea8bdd77 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Add\sinitializers\sfor\sthe\sxShmXXX()\smembers\sto\san\ssqlite3_io_methods\sstructure\sin\sjournal.c.\sThis\sdoesn't\sfix\sany\sreal\sproblem,\sjust\sprevents\sa\scompiler\swarning. -D 2010-07-02T16:36:18 +C Fix\ssome\swarnings\swhen\scompiling\sunder\sMSVC. +D 2010-07-02T17:05:03 F Makefile.arm-wince-mingw32ce-gcc fcd5e9cd67fe88836360bb4f9ef4cb7f8e2fb5a0 F Makefile.in a5cad1f8f3e021356bfcc6c77dc16f6f1952bbc3 F Makefile.linux-gcc d53183f4aa6a9192d249731c90dbdffbd2c68654 @@ -113,7 +113,7 @@ F src/auth.c 523da7fb4979469955d822ff9298352d6b31de34 F src/backup.c 51d83300fe0baee39405c416ceb19a58ed30a8ed F src/bitvec.c 06ad2c36a9c3819c0b9cbffec7b15f58d5d834e0 F src/btmutex.c 96a12f50f7a17475155971a241d85ec5171573ff -F src/btree.c ac51d077487df990de502cd0649e486a1a6cc458 +F src/btree.c c34267e8807ca89aefe3366b5c01656c8480c9b0 F src/btree.h dd83041eda10c17daf023257c1fc883b5f71f85a F src/btreeInt.h b0c87f6725b06a0aa194a6d25d54b16ce9d6e291 F src/build.c 31830208adbd6f97bef2517531ed70954a306fde @@ -155,8 +155,8 @@ F src/os.h d7775504a51e6e0d40315aa427b3e229ff9ff9ca F src/os_common.h a8f95b81eca8a1ab8593d23e94f8a35f35d4078f F src/os_os2.c 665876d5eec7585226b0a1cf5e18098de2b2da19 F src/os_unix.c ec7c7f7ca224ce2ff58736eebf804b48a75f9946 -F src/os_win.c 48f67798969ba983487fed5691059ade7fff2ef7 -F src/pager.c 95068d8b0f8a161ea364aa41af85d220a1be23df +F src/os_win.c e82ed9e1c1d5df0ece234fd3157c32d66bb2c83c +F src/pager.c fbb76339f0b999493005be976c9efb74f3fecd21 F src/pager.h 879fdde5a102d2f21a3135d6f647530b21c2796c F src/parse.y ace5c7a125d9f2a410e431ee3209034105045f7e F src/pcache.c 1e9aa2dbc0845b52e1b51cc39753b6d1e041cb07 @@ -226,10 +226,10 @@ F src/vdbeblob.c 258a6010ba7a82b72b327fb24c55790655689256 F src/vdbemem.c 5e579abf6532001dfbee0e640dc34eae897a9807 F src/vdbetrace.c 864cef96919323482ebd9986f2132435115e9cc2 F src/vtab.c a0f8a40274e4261696ef57aa806de2776ab72cda -F src/wal.c 7666c113e99fb510ecd3043490798cec5a771e73 +F src/wal.c a56876d405a38a88bb4db9bc4dffcfab67eff645 F src/wal.h 906c85760598b18584921fe08008435aa4eeeeb2 F src/walker.c 3112bb3afe1d85dc52317cb1d752055e9a781f8f -F src/where.c 1c895bef33d0dfc7ed90fb1f74120435d210ea56 +F src/where.c 9c642e4f74605039a6881d671e23471e6805322c F test/aggerror.test a867e273ef9e3d7919f03ef4f0e8c0d2767944f2 F test/alias.test 4529fbc152f190268a15f9384a5651bbbabc9d87 F test/all.test 6745008c144bd2956d58864d21f7b304689c1cce @@ -830,7 +830,7 @@ F tool/speedtest2.tcl ee2149167303ba8e95af97873c575c3e0fab58ff F tool/speedtest8.c 2902c46588c40b55661e471d7a86e4dd71a18224 F tool/speedtest8inst1.c 293327bc76823f473684d589a8160bde1f52c14e F tool/vdbe-compress.tcl d70ea6d8a19e3571d7ab8c9b75cba86d1173ff0f -P 01c1278263fdd8454763be15bddd2558e720e6e0 -R f945708978bd6e2d6ef2b7036668ceb3 -U dan -Z 365ea1ba861987a397d4382540eb2770 +P dafb3577a2d5fbeebb17c8176af837f0aebf6ee5 +R c7042942897427538823f82925732f7f +U shaneh +Z 4db98fec7305cfa9b94972f0b6bf3352 diff --git a/manifest.uuid b/manifest.uuid index 383e7207c3..70b627a628 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -dafb3577a2d5fbeebb17c8176af837f0aebf6ee5 \ No newline at end of file +708338773919fa024abbba55180654beb60e6d84 \ No newline at end of file diff --git a/src/btree.c b/src/btree.c index 2b9614de40..d82fc9f28a 100644 --- a/src/btree.c +++ b/src/btree.c @@ -2525,7 +2525,7 @@ int sqlite3BtreeBeginTrans(Btree *p, int wrflag){ rc = querySharedCacheTableLock(p, MASTER_ROOT, READ_LOCK); if( SQLITE_OK!=rc ) goto trans_begun; - pBt->initiallyEmpty = pBt->nPage==0; + pBt->initiallyEmpty = (u8)(pBt->nPage==0); do { /* Call lockBtree() until either pBt->pPage1 is populated or ** lockBtree() returns something other than SQLITE_OK. lockBtree() @@ -8013,7 +8013,7 @@ int sqlite3BtreeSetVersion(Btree *pBtree, int iVersion){ /* If setting the version fields to 1, do not automatically open the ** WAL connection, even if the version fields are currently set to 2. */ - pBt->doNotUseWAL = (iVersion==1); + pBt->doNotUseWAL = (u8)(iVersion==1); rc = sqlite3BtreeBeginTrans(pBtree, 0); if( rc==SQLITE_OK ){ diff --git a/src/os_win.c b/src/os_win.c index e09af106dc..fb57b7246d 100644 --- a/src/os_win.c +++ b/src/os_win.c @@ -1657,6 +1657,7 @@ static int winShmLock( static void winShmBarrier( sqlite3_file *fd /* Database holding the shared memory */ ){ + UNUSED_PARAMETER(fd); /* MemoryBarrier(); // does not work -- do not know why not */ winShmEnterMutex(); winShmLeaveMutex(); diff --git a/src/wal.c b/src/wal.c index d53223d985..4da8d12155 100644 --- a/src/wal.c +++ b/src/wal.c @@ -737,7 +737,7 @@ static int walLockShared(Wal *pWal, int lockIdx){ SQLITE_SHM_LOCK | SQLITE_SHM_SHARED); WALTRACE(("WAL%p: acquire SHARED-%s %s\n", pWal, walLockName(lockIdx), rc ? "failed" : "ok")); - VVA_ONLY( pWal->lockError = (rc!=SQLITE_OK && rc!=SQLITE_BUSY); ) + VVA_ONLY( pWal->lockError = (u8)(rc!=SQLITE_OK && rc!=SQLITE_BUSY); ) return rc; } static void walUnlockShared(Wal *pWal, int lockIdx){ @@ -753,7 +753,7 @@ static int walLockExclusive(Wal *pWal, int lockIdx, int n){ SQLITE_SHM_LOCK | SQLITE_SHM_EXCLUSIVE); WALTRACE(("WAL%p: acquire EXCLUSIVE-%s cnt=%d %s\n", pWal, walLockName(lockIdx), n, rc ? "failed" : "ok")); - VVA_ONLY( pWal->lockError = (rc!=SQLITE_OK && rc!=SQLITE_BUSY); ) + VVA_ONLY( pWal->lockError = (u8)(rc!=SQLITE_OK && rc!=SQLITE_BUSY); ) return rc; } static void walUnlockExclusive(Wal *pWal, int lockIdx, int n){ @@ -901,7 +901,7 @@ static void walCleanupHash(Wal *pWal){ /* Zero the entries in the aPgno array that correspond to frames with ** frame numbers greater than pWal->hdr.mxFrame. */ - nByte = ((char *)aHash - (char *)&aPgno[iLimit+1]); + nByte = (int)((char *)aHash - (char *)&aPgno[iLimit+1]); memset((void *)&aPgno[iLimit+1], 0, nByte); #ifdef SQLITE_ENABLE_EXPENSIVE_ASSERT @@ -949,7 +949,7 @@ static int walIndexAppend(Wal *pWal, u32 iFrame, u32 iPage){ ** entire hash table and aPgno[] array before proceding. */ if( idx==1 ){ - int nByte = (u8 *)&aHash[HASHTABLE_NSLOT] - (u8 *)&aPgno[1]; + int nByte = (int)((u8 *)&aHash[HASHTABLE_NSLOT] - (u8 *)&aPgno[1]); memset((void*)&aPgno[1], 0, nByte); } @@ -969,7 +969,7 @@ static int walIndexAppend(Wal *pWal, u32 iFrame, u32 iPage){ assert( nCollide++ < idx ); } aPgno[idx] = iPage; - aHash[iKey] = idx; + aHash[iKey] = (ht_slot)idx; #ifdef SQLITE_ENABLE_EXPENSIVE_ASSERT /* Verify that the number of entries in the hash table exactly equals @@ -1077,8 +1077,8 @@ static int walIndexRecover(Wal *pWal){ ){ goto finished; } - pWal->hdr.bigEndCksum = (magic&0x00000001); - pWal->szPage = szPage; + pWal->hdr.bigEndCksum = (u8)(magic&0x00000001); + pWal->szPage = (u16)szPage; pWal->nCkpt = sqlite3Get4byte(&aBuf[12]); memcpy(&pWal->hdr.aSalt, &aBuf[16], 8); @@ -1128,7 +1128,7 @@ static int walIndexRecover(Wal *pWal){ if( nTruncate ){ pWal->hdr.mxFrame = iFrame; pWal->hdr.nPage = nTruncate; - pWal->hdr.szPage = szPage; + pWal->hdr.szPage = (u16)szPage; aFrameCksum[0] = pWal->hdr.aFrameCksum[0]; aFrameCksum[1] = pWal->hdr.aFrameCksum[1]; } @@ -1456,12 +1456,12 @@ static int walIteratorInit(Wal *pWal, WalIterator **pp){ ht_slot *aIndex; /* Sorted index for this segment */ aPgno++; - nEntry = ((i+1)==nSegment)?(int)(iLast-iZero):(u32 *)aHash-(u32 *)aPgno; + nEntry = (int)(((i+1)==nSegment)?(int)(iLast-iZero):(u32 *)aHash-(u32 *)aPgno); aIndex = &((ht_slot *)&p->aSegment[p->nSegment])[iZero]; iZero++; for(j=0; jaSegment[i].iZero = iZero; @@ -1984,7 +1984,7 @@ static int walTryBeginRead(Wal *pWal, int *pChanged, int useWal, int cnt){ return WAL_RETRY; }else{ assert( mxReadMark<=pWal->hdr.mxFrame ); - pWal->readLock = mxI; + pWal->readLock = (i16)mxI; } } return rc; @@ -2397,7 +2397,7 @@ int sqlite3WalFrames( sqlite3Put4byte(&aWalHdr[24], aCksum[0]); sqlite3Put4byte(&aWalHdr[28], aCksum[1]); - pWal->szPage = szPage; + pWal->szPage = (u16)szPage; pWal->hdr.bigEndCksum = SQLITE_BIGENDIAN; pWal->hdr.aFrameCksum[0] = aCksum[0]; pWal->hdr.aFrameCksum[1] = aCksum[1]; @@ -2491,7 +2491,7 @@ int sqlite3WalFrames( if( rc==SQLITE_OK ){ /* Update the private copy of the header. */ - pWal->hdr.szPage = szPage; + pWal->hdr.szPage = (u16)szPage; pWal->hdr.mxFrame = iFrame; if( isCommit ){ pWal->hdr.iChange++; diff --git a/src/where.c b/src/where.c index 2e740674fb..737b2e8b3d 100644 --- a/src/where.c +++ b/src/where.c @@ -1841,7 +1841,7 @@ static void constructAutomaticIndex( } } } - assert( n==pLevel->plan.nEq ); + assert( (u32)n==pLevel->plan.nEq ); /* Add additional columns needed to make the automatic index into ** a covering index */