diff options
author | drh <drh@noemail.net> | 2008-12-10 21:19:56 +0000 |
---|---|---|
committer | drh <drh@noemail.net> | 2008-12-10 21:19:56 +0000 |
commit | 1bd10f8a0063bcbcb75b99f48e70ae312e145aae (patch) | |
tree | 457c8297dbebfb90dcbb5af39ed8858cfc73be48 | |
parent | 00c586a23885f14f39bb35f7c6167f0bdc62f391 (diff) | |
download | sqlite-1bd10f8a0063bcbcb75b99f48e70ae312e145aae.tar.gz sqlite-1bd10f8a0063bcbcb75b99f48e70ae312e145aae.zip |
Additional work at eliminating silly compiler warnings. (CVS 6010)
FossilOrigin-Name: ea01d43788a75e39c7f03c22681d1a338d52cf0e
-rw-r--r-- | manifest | 44 | ||||
-rw-r--r-- | manifest.uuid | 2 | ||||
-rw-r--r-- | src/btree.c | 28 | ||||
-rw-r--r-- | src/build.c | 42 | ||||
-rw-r--r-- | src/callback.c | 4 | ||||
-rw-r--r-- | src/date.c | 4 | ||||
-rw-r--r-- | src/delete.c | 12 | ||||
-rw-r--r-- | src/expr.c | 18 | ||||
-rw-r--r-- | src/func.c | 34 | ||||
-rw-r--r-- | src/insert.c | 12 | ||||
-rw-r--r-- | src/main.c | 14 | ||||
-rw-r--r-- | src/malloc.c | 6 | ||||
-rw-r--r-- | src/mem1.c | 4 | ||||
-rw-r--r-- | src/memjournal.c | 6 | ||||
-rw-r--r-- | src/os_win.c | 29 | ||||
-rw-r--r-- | src/pager.c | 6 | ||||
-rw-r--r-- | src/sqliteInt.h | 10 | ||||
-rw-r--r-- | src/util.c | 8 |
18 files changed, 148 insertions, 135 deletions
@@ -1,5 +1,5 @@ -C Fixed\stypo\sin\scomment\sin\smkkeywordhash.c.\s(CVS\s6009) -D 2008-12-10T20:11:01 +C Additional\swork\sat\seliminating\ssilly\scompiler\swarnings.\s(CVS\s6010) +D 2008-12-10T21:19:57 F Makefile.arm-wince-mingw32ce-gcc fcd5e9cd67fe88836360bb4f9ef4cb7f8e2fb5a0 F Makefile.in f7e4c81c347b04f7b0f1c1b081a168645d7b8af7 F Makefile.linux-gcc d53183f4aa6a9192d249731c90dbdffbd2c68654 @@ -100,33 +100,33 @@ F src/attach.c 1c35f95da3c62d19de75b44cfefd12c81c1791b3 F src/auth.c c8b2ab5c8bad4bd90ed7c294694f48269162c627 F src/bitvec.c 4300d311b17fb3c1476623fd895a8feac02a0b08 F src/btmutex.c 63c5cc4ad5715690767ffcb741e185d7bc35ec1a -F src/btree.c ba7baa987f9723882ef4655886327622e02a497f +F src/btree.c e5bfe007a4c4f643cb69426e6af0a9e556352f5b F src/btree.h 179c3ea813780df78a289a8f5130db18e6d4616e F src/btreeInt.h 7ef2c872371d7508657f8d7a4efe651c741d6ee6 -F src/build.c 64e9eb409ab39feb08919d28bf112fc3bf07d8e6 -F src/callback.c 5538f3fb2507f6cc44623b06a87c861b1c0477bd +F src/build.c 205538f36cd5c9ec04f24beecdb69629758aaa50 +F src/callback.c bee8949d619b1b7b1e4dfac8a19c5116ae1dd12a F src/complete.c cb14e06dbe79dee031031f0d9e686ff306afe07c -F src/date.c 9a6156445442625e72f1ec06b1f392658240f6e6 -F src/delete.c 1817205f833a084f66fa9c8e322ab46ba998e4c7 -F src/expr.c ee295129a9efa0466ae4ebdb03adc33cd5c2e184 +F src/date.c 719afa5531c5350f2929d36122a7e0355c0f3d70 +F src/delete.c e2392b6808496fc0a7f54662af3ba677a3e8e44a +F src/expr.c f13ad5563470481eaa1e8016bfa9ed1b4c996574 F src/fault.c dc88c821842157460750d2d61a8a8b4197d047ff -F src/func.c 1246828c0d16ad4660c00b39ad83644ed2205e0c +F src/func.c 8b5f6807f05f50d88fc4efca5e9541bcf569f988 F src/global.c 91723e45a2ad03ae5bb97a0a0d2dbb1a0e69527b F src/hash.c 831e9c199d8de5976c698e5aca278e2de74ff93b F src/hash.h 28f38ebb1006a5beedcb013bcdfe31befe7437ae F src/hwtime.h 4a1d45f4cae1f402ea19686acf24acf4f0cb53cb -F src/insert.c c34dab7d450cf6612859f7c66d48ec6d4aa409fd +F src/insert.c f6db1e6f43aae337e64a755208abb6ff124edc19 F src/journal.c cffd2cd214e58c0e99c3ff632b3bee6c7cbb260e F src/legacy.c 4f7410b29598d991628ca40b150aa089649f17d8 F src/loadext.c 2f53996c693a347edc2d773e9217dde49d96ae64 -F src/main.c 12b674019503ad90649cd8e6295425ef3078ce12 -F src/malloc.c 6a5b91159f87238392f190b02b5fba09fe526984 +F src/main.c 1bb24c0720080e3258c7a9ed93d42c3da98c18d5 +F src/malloc.c 1e5eeb5a3074a6935bbe7b04bc058f630bfffd7e F src/mem0.c f2f84062d1f35814d6535c9f9e33de3bfb3b132c -F src/mem1.c bb8e26adde7d463270e961f045802c61dbabc8f1 +F src/mem1.c 3bfb39e4f60b0179713a7c087b2d4f0dc205735f F src/mem2.c 4c53c0071d3c68b8f252fe85d1667bad59421396 F src/mem3.c 67153ec933e08b70714055e872efb58a6b287939 F src/mem5.c 838309b521c96a2a34507f74a5a739d28de4aac6 -F src/memjournal.c f9fbded1b4ead4378a4f751fa3ae2bc429f72976 +F src/memjournal.c e3c9aa679be8eecc4d5636f4d07aeeb084f41cf3 F src/mutex.c e9cb5fbe94afb4328869afaf3ac49bd1327559eb F src/mutex.h 9e686e83a88838dac8b9c51271c651e833060f1e F src/mutex_noop.c f5a07671f25a1a9bd7c10ad7107bc2585446200f @@ -138,8 +138,8 @@ F src/os.h 4ee25a35c00e75a569cecb5080be299b0c3e208e F src/os_common.h 24525d8b7bce66c374dfc1810a6c9043f3359b60 F src/os_os2.c bed77dc26e3a95ce4a204936b9a1ca6fe612fcc5 F src/os_unix.c 970e4a98a2d026cbeb2464694e4d13e079102b2f -F src/os_win.c af9459fcd0ba1852c75c0844ec82781e6767d909 -F src/pager.c 64269ef14e57c545f8a9588eba15fface4265166 +F src/os_win.c d7a12403025a69a358974ba7504562b109fd403b +F src/pager.c ef93fb79ab794a0109784a2018f23127c53dd74a F src/pager.h 37f5173612b7803f44656c16e80df3280234bb18 F src/parse.y 3dfd941533cdc6ce0b09b905b25c4eb73858400b F src/pcache.c 16dc8da6e6ba6250f8dfd9ee46036db1cbceedc6 @@ -155,7 +155,7 @@ F src/select.c 49296e1abf019b965f04a6dc5ff9fafa3ae46396 F src/shell.c 793aaebd8024896c58ded47414fe688fb8b1ef6d F src/sqlite.h.in 619a82b485fbf02276ecb8b1cc629f0c8bcda4ca F src/sqlite3ext.h 1db7d63ab5de4b3e6b83dd03d1a4e64fef6d2a17 -F src/sqliteInt.h d34967323d5e1351a3b719c4121aed6bc3c9f520 +F src/sqliteInt.h a1478d1ec40bca0b511c06e2b4c93dc932aa3426 F src/sqliteLimit.h f435e728c6b620ef7312814d660a81f9356eb5c8 F src/status.c 237b193efae0cf6ac3f0817a208de6c6c6ef6d76 F src/table.c 23db1e5f27c03160987c122a078b4bb51ef0b2f8 @@ -192,7 +192,7 @@ F src/tokenize.c aaa5fa6a4536a9dd7c855a3f66f32508f1612138 F src/trigger.c 5a669d8fc9197db393ff85fa95ec882282162bb5 F src/update.c 3e022c24e265b0975e51f2ec0348ef84eeaba311 F src/utf.c 7bc90bc7d1a0239f876e2c2ce573e9b103aedcd4 -F src/util.c 6e997af379d3aa609bf084d7d10fdc1cf32cc72c +F src/util.c 27f60e2b0ab2734a35e961879366f3420465c89d F src/vacuum.c 383d6297bddc011ab04a9eed110db6eaf523e8e9 F src/vdbe.c 0244413f3dae1ee63479f541ec2e950b05c65112 F src/vdbe.h 03516f28bf5aca00a53c4dccd6c313f96adb94f6 @@ -664,7 +664,7 @@ F tool/speedtest16.c c8a9c793df96db7e4933f0852abb7a03d48f2e81 F tool/speedtest2.tcl ee2149167303ba8e95af97873c575c3e0fab58ff F tool/speedtest8.c 2902c46588c40b55661e471d7a86e4dd71a18224 F tool/speedtest8inst1.c 293327bc76823f473684d589a8160bde1f52c14e -P ccb9393a7a10f0970419b860af293b0bdad7f894 -R e5cd4f999065b826204c96a1b5fe9334 -U shane -Z 456bceda2dd3765ecca5d86a452706ff +P b7dd05b403e69caca814ccd8824130f176160cd5 +R 5bd6d4daa43f7acc541261f54e444525 +U drh +Z ac7cc71d687c854ae8b6ca4ac780169f diff --git a/manifest.uuid b/manifest.uuid index 8a0587fe4..1b65eb50f 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -b7dd05b403e69caca814ccd8824130f176160cd5
\ No newline at end of file +ea01d43788a75e39c7f03c22681d1a338d52cf0e
\ No newline at end of file diff --git a/src/btree.c b/src/btree.c index 3f1287394..a55caceec 100644 --- a/src/btree.c +++ b/src/btree.c @@ -9,7 +9,7 @@ ** May you share freely, never taking more than you give. ** ************************************************************************* -** $Id: btree.c,v 1.546 2008/12/10 16:45:51 drh Exp $ +** $Id: btree.c,v 1.547 2008/12/10 21:19:57 drh Exp $ ** ** This file implements a external (disk-based) database using BTrees. ** See the header comment on "btreeInt.h" for additional information. @@ -590,7 +590,7 @@ void sqlite3BtreeParseCellPtr( }else{ nPayload = 0; } - n += (u16)getVarint(&pCell[n], (u64*)&pInfo->nKey); + n += getVarint(&pCell[n], (u64*)&pInfo->nKey); pInfo->nData = nPayload; }else{ pInfo->nData = 0; @@ -610,7 +610,7 @@ void sqlite3BtreeParseCellPtr( if( (nSize & ~3)==0 ){ nSize = 4; /* Minimum cell size is 4 */ } - pInfo->nSize = (int)nSize; + pInfo->nSize = (u16)nSize; }else{ /* If the payload will not fit completely on the local page, we have ** to decide how much to store locally and how much to spill onto @@ -995,7 +995,7 @@ int sqlite3BtreeInitPage(MemPage *pPage){ pc = get2byte(&data[hdr+1]); nFree = data[hdr+7] + top - (cellOffset + 2*pPage->nCell); while( pc>0 ){ - int next, size; + u16 next, size; if( pc>usableSize-4 ){ /* Free block is off the page */ return SQLITE_CORRUPT_BKPT; @@ -1056,8 +1056,8 @@ static void zeroPage(MemPage *pPage, int flags){ assert( sqlite3PagerIswriteable(pPage->pDbPage) ); assert( sqlite3_mutex_held(pBt->mutex) ); /*memset(&data[hdr], 0, pBt->usableSize - hdr);*/ - data[hdr] = flags; - first = hdr + 8 + 4*((flags&PTF_LEAF)==0); + data[hdr] = (char)flags; + first = hdr + 8 + 4*((flags&PTF_LEAF)==0 ?1:0); memset(&data[hdr+1], 0, 4); data[hdr+7] = 0; put2byte(&data[hdr+5], pBt->usableSize); @@ -1651,7 +1651,7 @@ int sqlite3BtreeSetPageSize(Btree *p, int pageSize, int nReserve){ ((pageSize-1)&pageSize)==0 ){ assert( (pageSize & 7)==0 ); assert( !pBt->pPage1 && !pBt->pCursor ); - pBt->pageSize = pageSize; + pBt->pageSize = (u16)pageSize; freeTempSpace(pBt); rc = sqlite3PagerSetPagesize(pBt->pPager, &pBt->pageSize); } @@ -1807,8 +1807,8 @@ static int lockBtree(BtShared *pBt){ if( usableSize<500 ){ goto page1_init_failed; } - pBt->pageSize = pageSize; - pBt->usableSize = usableSize; + pBt->pageSize = (u16)pageSize; + pBt->usableSize = (u16)usableSize; #ifndef SQLITE_OMIT_AUTOVACUUM pBt->autoVacuum = (get4byte(&page1[36 + 4*4])?1:0); pBt->incrVacuum = (get4byte(&page1[36 + 7*4])?1:0); @@ -3077,7 +3077,7 @@ static int getOverflowPage( Pgno *pPgnoNext /* OUT: Next overflow page number */ ){ Pgno next = 0; - int rc; + int rc = SQLITE_OK; assert( sqlite3_mutex_held(pBt->mutex) ); /* One of these must not be NULL. Otherwise, why call this function? */ @@ -3639,7 +3639,7 @@ static int moveToLeftmost(BtCursor *pCur){ static int moveToRightmost(BtCursor *pCur){ Pgno pgno; int rc = SQLITE_OK; - MemPage *pPage; + MemPage *pPage = 0; assert( cursorHoldsMutex(pCur) ); assert( pCur->eState==CURSOR_VALID ); @@ -3822,7 +3822,7 @@ int sqlite3BtreeMovetoUnpacked( goto moveto_finish; } rc = sqlite3BtreeKey(pCur, 0, (int)nCellKey, (void*)pCellKey); - c = sqlite3VdbeRecordCompare(nCellKey, pCellKey, pIdxKey); + c = sqlite3VdbeRecordCompare((int)nCellKey, pCellKey, pIdxKey); sqlite3_free(pCellKey); if( rc ) goto moveto_finish; } @@ -6009,7 +6009,7 @@ int sqlite3BtreeDelete(BtCursor *pCur){ ** to be a leaf so we can use it. */ BtCursor leafCur; - MemPage *pLeafPage; + MemPage *pLeafPage = 0; unsigned char *pNext; int notUsed; @@ -6524,7 +6524,7 @@ int sqlite3BtreeDropTable(Btree *p, int iTable, int *piMoved){ ** free pages is not visible. So Cookie[0] is the same as Meta[1]. */ int sqlite3BtreeGetMeta(Btree *p, int idx, u32 *pMeta){ - DbPage *pDbPage; + DbPage *pDbPage = 0; int rc; unsigned char *pP1; BtShared *pBt = p->pBt; diff --git a/src/build.c b/src/build.c index bb279b1ac..477b8e448 100644 --- a/src/build.c +++ b/src/build.c @@ -22,7 +22,7 @@ ** COMMIT ** ROLLBACK ** -** $Id: build.c,v 1.506 2008/12/10 19:26:22 drh Exp $ +** $Id: build.c,v 1.507 2008/12/10 21:19:57 drh Exp $ */ #include "sqliteInt.h" #include <ctype.h> @@ -32,7 +32,7 @@ ** be parsed. Initialize the pParse structure as needed. */ void sqlite3BeginParse(Parse *pParse, int explainFlag){ - pParse->explain = explainFlag; + pParse->explain = (u8)explainFlag; pParse->nVar = 0; } @@ -187,7 +187,8 @@ void sqlite3FinishCoding(Parse *pParse){ */ VdbeOp *pOp = sqlite3VdbeGetOp(v, 0); if( pOp && pOp->opcode==OP_Trace ){ - sqlite3VdbeChangeP4(v, 0, pParse->zSql, pParse->zTail-pParse->zSql); + sqlite3VdbeChangeP4(v, 0, pParse->zSql, + (int)(pParse->zTail - pParse->zSql)); } } #endif /* SQLITE_OMIT_TRACE */ @@ -628,7 +629,7 @@ void sqlite3OpenMasterTable(Parse *p, int iDb){ */ int sqlite3FindDb(sqlite3 *db, Token *pName){ int i = -1; /* Database number */ - size_t n; /* Number of characters in the name */ + int n; /* Number of characters in the name */ Db *pDb; /* A database whose name space is being searched */ char *zName; /* Name we are searching for */ @@ -995,7 +996,7 @@ void sqlite3AddNotNull(Parse *pParse, int onError){ int i; if( (p = pParse->pNewTable)==0 ) return; i = p->nCol-1; - if( i>=0 ) p->aCol[i].notNull = onError; + if( i>=0 ) p->aCol[i].notNull = (u8)onError; } /* @@ -1174,7 +1175,7 @@ void sqlite3AddPrimaryKey( if( zType && sqlite3StrICmp(zType, "INTEGER")==0 && sortOrder==SQLITE_SO_ASC ){ pTab->iPKey = iCol; - pTab->keyConf = onError; + pTab->keyConf = (u8)onError; assert( autoInc==0 || autoInc==1 ); pTab->tabFlags |= autoInc*TF_Autoincrement; }else if( autoInc ){ @@ -1554,7 +1555,7 @@ void sqlite3EndTable( if( pSelect ){ zStmt = createTableStmt(db, p, p->pSchema==db->aDb[1].pSchema); }else{ - n = pEnd->z - pParse->sNameToken.z + 1; + n = (int)(pEnd->z - pParse->sNameToken.z) + 1; zStmt = sqlite3MPrintf(db, "CREATE %s %.*s", zType2, n, pParse->sNameToken.z ); @@ -1638,7 +1639,7 @@ void sqlite3EndTable( if( pCons->z==0 ){ pCons = pEnd; } - nName = (const char *)pCons->z - zName; + nName = (int)((const char *)pCons->z - zName); p->addColOffset = 13 + sqlite3Utf8CharLen(zName, nName); } #endif @@ -1709,7 +1710,7 @@ void sqlite3CreateView( sEnd.z += sEnd.n; } sEnd.n = 0; - n = sEnd.z - pBegin->z; + n = (int)(sEnd.z - pBegin->z); z = (const unsigned char*)pBegin->z; while( n>0 && (z[n-1]==';' || isspace(z[n-1])) ){ n--; } sEnd.z = &z[n-1]; @@ -2222,9 +2223,9 @@ void sqlite3CreateForeignKey( } } pFKey->isDeferred = 0; - pFKey->deleteConf = flags & 0xff; - pFKey->updateConf = (flags >> 8 ) & 0xff; - pFKey->insertConf = (flags >> 16 ) & 0xff; + pFKey->deleteConf = (u8)(flags & 0xff); + pFKey->updateConf = (u8)((flags >> 8 ) & 0xff); + pFKey->insertConf = (u8)((flags >> 16 ) & 0xff); /* Link the foreign key to the table as the last step. */ @@ -2250,7 +2251,8 @@ void sqlite3DeferForeignKey(Parse *pParse, int isDeferred){ Table *pTab; FKey *pFKey; if( (pTab = pParse->pNewTable)==0 || (pFKey = pTab->pFKey)==0 ) return; - pFKey->isDeferred = isDeferred; + assert( isDeferred==0 || isDeferred==1 ); + pFKey->isDeferred = (u8)isDeferred; #endif } @@ -2503,7 +2505,7 @@ void sqlite3CreateIndex( nullId.n = sqlite3Strlen30((char*)nullId.z); pList = sqlite3ExprListAppend(pParse, 0, 0, &nullId); if( pList==0 ) goto exit_create_index; - pList->a[0].sortOrder = sortOrder; + pList->a[0].sortOrder = (u8)sortOrder; } /* Figure out how many bytes of space are required to store explicitly @@ -2543,8 +2545,8 @@ void sqlite3CreateIndex( memcpy(pIndex->zName, zName, nName+1); pIndex->pTable = pTab; pIndex->nColumn = pList->nExpr; - pIndex->onError = onError; - pIndex->autoIndex = pName==0; + pIndex->onError = (u8)onError; + pIndex->autoIndex = (u8)(pName==0); pIndex->pSchema = db->aDb[iDb].pSchema; /* Check to see if we should honor DESC requests on index columns @@ -2596,7 +2598,7 @@ void sqlite3CreateIndex( } pIndex->azColl[i] = zColl; requestedSortOrder = pListItem->sortOrder & sortOrderMask; - pIndex->aSortOrder[i] = requestedSortOrder; + pIndex->aSortOrder[i] = (u8)requestedSortOrder; } sqlite3DefaultRowEst(pIndex); @@ -3046,7 +3048,7 @@ SrcList *sqlite3SrcListEnlarge( } pSrc = pNew; nGot = (sqlite3DbMallocSize(db, pNew) - sizeof(*pSrc))/sizeof(pSrc->a[0])+1; - pSrc->nAlloc = nGot; + pSrc->nAlloc = (u16)nGot; } /* Move existing slots that come after the newly inserted slots @@ -3054,7 +3056,7 @@ SrcList *sqlite3SrcListEnlarge( for(i=pSrc->nSrc-1; i>=iStart; i--){ pSrc->a[i+nExtra] = pSrc->a[i]; } - pSrc->nSrc += nExtra; + pSrc->nSrc += (u16)nExtra; /* Zero the newly allocated slots */ memset(&pSrc->a[iStart], 0, sizeof(pSrc->a[0])*nExtra); @@ -3574,7 +3576,7 @@ KeyInfo *sqlite3IndexKeyinfo(Parse *pParse, Index *pIdx){ pKey->aColl[i] = sqlite3LocateCollSeq(pParse, zColl, -1); pKey->aSortOrder[i] = pIdx->aSortOrder[i]; } - pKey->nField = nCol; + pKey->nField = (u16)nCol; } if( pParse->nErr ){ diff --git a/src/callback.c b/src/callback.c index 90f4297d3..7204d170d 100644 --- a/src/callback.c +++ b/src/callback.c @@ -13,7 +13,7 @@ ** This file contains functions used to access the internal hash tables ** of user defined functions and collation sequences. ** -** $Id: callback.c,v 1.33 2008/12/10 19:26:22 drh Exp $ +** $Id: callback.c,v 1.34 2008/12/10 21:19:57 drh Exp $ */ #include "sqliteInt.h" @@ -381,7 +381,7 @@ FuncDef *sqlite3FindFunction( if( createFlag && (bestScore<6 || pBest->nArg!=nArg) && (pBest = sqlite3DbMallocZero(db, sizeof(*pBest)+nName+1))!=0 ){ pBest->zName = (char *)&pBest[1]; - pBest->nArg = nArg; + pBest->nArg = (u16)nArg; pBest->iPrefEnc = enc; memcpy(pBest->zName, zName, nName); pBest->zName[nName] = 0; diff --git a/src/date.c b/src/date.c index 968478eb8..cb38747ee 100644 --- a/src/date.c +++ b/src/date.c @@ -16,7 +16,7 @@ ** sqlite3RegisterDateTimeFunctions() found at the bottom of the file. ** All other code has file scope. ** -** $Id: date.c,v 1.96 2008/12/10 19:26:22 drh Exp $ +** $Id: date.c,v 1.97 2008/12/10 21:19:57 drh Exp $ ** ** SQLite processes all times and dates as Julian Day numbers. The ** dates and times are stored as the number of days since noon @@ -522,7 +522,7 @@ static int parseModifier(const char *zMod, DateTime *p){ char *z, zBuf[30]; z = zBuf; for(n=0; n<ArraySize(zBuf)-1 && zMod[n]; n++){ - z[n] = tolower(zMod[n]); + z[n] = (char)sqlite3UpperToLower[(u8)zMod[n]]; } z[n] = 0; switch( z[0] ){ diff --git a/src/delete.c b/src/delete.c index aa90b19ea..934b76da9 100644 --- a/src/delete.c +++ b/src/delete.c @@ -12,7 +12,7 @@ ** This file contains C code routines that are called by the parser ** in order to generate code for DELETE FROM statements. ** -** $Id: delete.c,v 1.189 2008/12/10 19:26:24 drh Exp $ +** $Id: delete.c,v 1.190 2008/12/10 21:19:57 drh Exp $ */ #include "sqliteInt.h" @@ -76,7 +76,7 @@ void sqlite3OpenTable( if( IsVirtual(pTab) ) return; v = sqlite3GetVdbe(p); assert( opcode==OP_OpenWrite || opcode==OP_OpenRead ); - sqlite3TableLock(p, iDb, pTab->tnum, (opcode==OP_OpenWrite), pTab->zName); + sqlite3TableLock(p, iDb, pTab->tnum, (opcode==OP_OpenWrite)?1:0, pTab->zName); sqlite3VdbeAddOp2(v, OP_SetNumColumns, 0, pTab->nCol); sqlite3VdbeAddOp3(v, opcode, iCur, pTab->tnum, iDb); VdbeComment((v, "%s", pTab->zName)); @@ -240,10 +240,10 @@ void sqlite3DeleteFrom( int isView; /* True if attempting to delete from a view */ int triggers_exist = 0; /* True if any triggers exist */ #endif - int iBeginAfterTrigger; /* Address of after trigger program */ - int iEndAfterTrigger; /* Exit of after trigger program */ - int iBeginBeforeTrigger; /* Address of before trigger program */ - int iEndBeforeTrigger; /* Exit of before trigger program */ + int iBeginAfterTrigger = 0; /* Address of after trigger program */ + int iEndAfterTrigger = 0; /* Exit of after trigger program */ + int iBeginBeforeTrigger = 0; /* Address of before trigger program */ + int iEndBeforeTrigger = 0; /* Exit of before trigger program */ u32 old_col_mask = 0; /* Mask of OLD.* columns in use */ sContext.pParse = 0; diff --git a/src/expr.c b/src/expr.c index 10db73964..f221a519a 100644 --- a/src/expr.c +++ b/src/expr.c @@ -12,7 +12,7 @@ ** This file contains routines used for analyzing expressions and ** for generating VDBE code that evaluates expressions in SQLite. ** -** $Id: expr.c,v 1.406 2008/12/08 13:42:36 drh Exp $ +** $Id: expr.c,v 1.407 2008/12/10 21:19:57 drh Exp $ */ #include "sqliteInt.h" #include <ctype.h> @@ -190,7 +190,7 @@ int sqlite3IndexAffinityOk(Expr *pExpr, char idx_affinity){ */ static u8 binaryCompareP5(Expr *pExpr1, Expr *pExpr2, int jumpIfNull){ u8 aff = (char)sqlite3ExprAffinity(pExpr2); - aff = sqlite3CompareAffinity(pExpr1, aff) | jumpIfNull; + aff = (u8)sqlite3CompareAffinity(pExpr1, aff) | (u8)jumpIfNull; return aff; } @@ -272,7 +272,7 @@ static int codeCompare( p5 = binaryCompareP5(pLeft, pRight, jumpIfNull); addr = sqlite3VdbeAddOp4(pParse->pVdbe, opcode, in2, dest, in1, (void*)p4, P4_COLLSEQ); - sqlite3VdbeChangeP5(pParse->pVdbe, p5); + sqlite3VdbeChangeP5(pParse->pVdbe, (u8)p5); if( (p5 & SQLITE_AFF_MASK)!=SQLITE_AFF_NONE ){ sqlite3ExprCacheAffinityChange(pParse, in1, 1); sqlite3ExprCacheAffinityChange(pParse, in2, 1); @@ -397,7 +397,7 @@ Expr *sqlite3Expr( sqlite3ExprDelete(db, pRight); return 0; } - pNew->op = op; + pNew->op = (u8)op; pNew->pLeft = pLeft; pNew->pRight = pRight; pNew->iAgg = -1; @@ -569,7 +569,8 @@ void sqlite3ExprAssignVarNumber(Parse *pParse, Expr *pExpr){ ** number as the prior appearance of the same name, or if the name ** has never appeared before, reuse the same variable number */ - int i, n; + int i; + u32 n; n = pToken->n; for(i=0; i<pParse->nVarExpr; i++){ Expr *pE; @@ -1331,7 +1332,7 @@ void sqlite3CodeSubselect( assert( !isRowid ); sqlite3SelectDestInit(&dest, SRT_Set, pExpr->iTable); - dest.affinity = (int)affinity; + dest.affinity = (u8)affinity; assert( (pExpr->iTable&0x0000FFFF)==pExpr->iTable ); if( sqlite3Select(pParse, pExpr->pSelect, &dest) ){ return; @@ -2064,7 +2065,7 @@ int sqlite3ExprCodeTarget(Parse *pParse, Expr *pExpr, int target){ } sqlite3VdbeAddOp4(v, OP_Function, constMask, r1, target, (char*)pDef, P4_FUNCDEF); - sqlite3VdbeChangeP5(v, nExpr); + sqlite3VdbeChangeP5(v, (u8)nExpr); if( nExpr ){ sqlite3ReleaseTempRange(pParse, r1, nExpr); } @@ -2243,7 +2244,7 @@ int sqlite3ExprCodeTarget(Parse *pParse, Expr *pExpr, int target){ Expr opCompare; /* The X==Ei expression */ Expr cacheX; /* Cached expression X */ Expr *pX; /* The X expression */ - Expr *pTest; /* X==Ei (form A) or just Ei (form B) */ + Expr *pTest = 0; /* X==Ei (form A) or just Ei (form B) */ assert(pExpr->pList); assert((pExpr->pList->nExpr % 2) == 0); @@ -2265,6 +2266,7 @@ int sqlite3ExprCodeTarget(Parse *pParse, Expr *pExpr, int target){ pParse->disableColCache++; for(i=0; i<nExpr; i=i+2){ if( pX ){ + assert( pTest!=0 ); opCompare.pRight = aListelem[i].pExpr; }else{ pTest = aListelem[i].pExpr; diff --git a/src/func.c b/src/func.c index 5e3264fea..6bb2c100a 100644 --- a/src/func.c +++ b/src/func.c @@ -16,7 +16,7 @@ ** sqliteRegisterBuildinFunctions() found at the bottom of the file. ** All other code has file scope. ** -** $Id: func.c,v 1.207 2008/12/10 19:26:24 drh Exp $ +** $Id: func.c,v 1.208 2008/12/10 21:19:57 drh Exp $ */ #include "sqliteInt.h" #include <ctype.h> @@ -212,10 +212,10 @@ static void substrFunc( for(z2=z; *z2 && p2; p2--){ SQLITE_SKIP_UTF8(z2); } - sqlite3_result_text(context, (char*)z, z2-z, SQLITE_TRANSIENT); + sqlite3_result_text(context, (char*)z, (int)(z2-z), SQLITE_TRANSIENT); }else{ if( p2<0 ) p2 = 0; - sqlite3_result_blob(context, (char*)&z[p1], p2, SQLITE_TRANSIENT); + sqlite3_result_blob(context, (char*)&z[p1], (int)p2, SQLITE_TRANSIENT); } } @@ -251,7 +251,7 @@ static void *contextMalloc(sqlite3_context *context, i64 nByte){ sqlite3_result_error_toobig(context); z = 0; }else{ - z = sqlite3Malloc(nByte); + z = sqlite3Malloc((int)nByte); if( !z && nByte>0 ){ sqlite3_result_error_nomem(context); } @@ -276,7 +276,7 @@ static void upperFunc(sqlite3_context *context, int argc, sqlite3_value **argv){ if( z1 ){ memcpy(z1, z2, n+1); for(i=0; z1[i]; i++){ - z1[i] = toupper(z1[i]); + z1[i] = (char)toupper(z1[i]); } sqlite3_result_text(context, z1, -1, sqlite3_free); } @@ -296,7 +296,7 @@ static void lowerFunc(sqlite3_context *context, int argc, sqlite3_value **argv){ if( z1 ){ memcpy(z1, z2, n+1); for(i=0; z1[i]; i++){ - z1[i] = tolower(z1[i]); + z1[i] = (char)tolower(z1[i]); } sqlite3_result_text(context, z1, -1, sqlite3_free); } @@ -788,7 +788,7 @@ static void zeroblobFunc( if( n>SQLITE_MAX_LENGTH ){ sqlite3_result_error_toobig(context); }else{ - sqlite3_result_zeroblob(context, n); + sqlite3_result_zeroblob(context, (int)n); } } @@ -881,8 +881,8 @@ static void trimFunc( int nIn; /* Number of bytes in input */ int flags; /* 1: trimleft 2: trimright 3: trim */ int i; /* Loop counter */ - unsigned char *aLen; /* Length of each character in zCharSet */ - unsigned char **azChar; /* Individual characters in zCharSet */ + unsigned char *aLen = 0; /* Length of each character in zCharSet */ + unsigned char **azChar = 0; /* Individual characters in zCharSet */ int nChar; /* Number of characters in zCharSet */ if( sqlite3_value_type(argv[0])==SQLITE_NULL ){ @@ -915,7 +915,7 @@ static void trimFunc( for(z=zCharSet, nChar=0; *z; nChar++){ azChar[nChar] = (unsigned char *)z; SQLITE_SKIP_UTF8(z); - aLen[nChar] = z - azChar[nChar]; + aLen[nChar] = (int)(z - azChar[nChar]); } } } @@ -923,7 +923,7 @@ static void trimFunc( flags = SQLITE_PTR_TO_INT(sqlite3_user_data(context)); if( flags & 1 ){ while( nIn>0 ){ - int len; + int len = 0; for(i=0; i<nChar; i++){ len = aLen[i]; if( memcmp(zIn, azChar[i], len)==0 ) break; @@ -935,7 +935,7 @@ static void trimFunc( } if( flags & 2 ){ while( nIn>0 ){ - int len; + int len = 0; for(i=0; i<nChar; i++){ len = aLen[i]; if( len<=nIn && memcmp(&zIn[nIn-len],azChar[i],len)==0 ) break; @@ -1063,10 +1063,10 @@ static void sumStep(sqlite3_context *context, int argc, sqlite3_value **argv){ p->rSum += v; if( (p->approx|p->overflow)==0 ){ i64 iNewSum = p->iSum + v; - int s1 = p->iSum >> (sizeof(i64)*8-1); - int s2 = v >> (sizeof(i64)*8-1); - int s3 = iNewSum >> (sizeof(i64)*8-1); - p->overflow = (s1&s2&~s3) | (~s1&~s2&s3); + int s1 = (int)(p->iSum >> (sizeof(i64)*8-1)); + int s2 = (int)(v >> (sizeof(i64)*8-1)); + int s3 = (int)(iNewSum >> (sizeof(i64)*8-1)); + p->overflow = ((s1&s2&~s3) | (~s1&~s2&s3))?1:0; p->iSum = iNewSum; } }else{ @@ -1251,7 +1251,7 @@ void sqlite3RegisterBuiltinFunctions(sqlite3 *db){ /* ** Set the LIKEOPT flag on the 2-argument function with the given name. */ -static void setLikeOptFlag(sqlite3 *db, const char *zName, int flagVal){ +static void setLikeOptFlag(sqlite3 *db, const char *zName, u8 flagVal){ FuncDef *pDef; pDef = sqlite3FindFunction(db, zName, sqlite3Strlen30(zName), 2, SQLITE_UTF8, 0); diff --git a/src/insert.c b/src/insert.c index 19fc75728..0ab647e12 100644 --- a/src/insert.c +++ b/src/insert.c @@ -12,7 +12,7 @@ ** This file contains C code routines that are called by the parser ** to handle INSERT statements in SQLite. ** -** $Id: insert.c,v 1.255 2008/12/10 19:26:24 drh Exp $ +** $Id: insert.c,v 1.256 2008/12/10 21:19:57 drh Exp $ */ #include "sqliteInt.h" @@ -388,14 +388,14 @@ void sqlite3Insert( int appendFlag = 0; /* True if the insert is likely to be an append */ /* Register allocations */ - int regFromSelect; /* Base register for data coming from SELECT */ + int regFromSelect = 0;/* Base register for data coming from SELECT */ int regAutoinc = 0; /* Register holding the AUTOINCREMENT counter */ int regRowCount = 0; /* Memory cell used for the row counter */ int regIns; /* Block of regs holding rowid+data being inserted */ int regRowid; /* registers holding insert rowid */ int regData; /* register holding first column to insert */ int regRecord; /* Holds the assemblied row record */ - int regEof; /* Register recording end of SELECT data */ + int regEof = 0; /* Register recording end of SELECT data */ int *aRegIdx = 0; /* One register allocated to each index */ @@ -405,6 +405,7 @@ void sqlite3Insert( #endif db = pParse->db; + memset(&dest, 0, sizeof(dest)); if( pParse->nErr || db->mallocFailed ){ goto insert_cleanup; } @@ -1093,7 +1094,8 @@ void sqlite3GenerateConstraintChecks( Vdbe *v; int nCol; int onError; - int j1, j2, j3; /* Addresses of jump instructions */ + int j1; /* Addresss of jump instruction */ + int j2 = 0, j3; /* Addresses of jump instructions */ int regData; /* Register containing first data column */ int iCur; Index *pIdx; @@ -1334,7 +1336,7 @@ void sqlite3CompleteInsertion( Vdbe *v; int nIdx; Index *pIdx; - int pik_flags; + u8 pik_flags; int regData; int regRec; diff --git a/src/main.c b/src/main.c index 2aa29acfd..ad1107cf6 100644 --- a/src/main.c +++ b/src/main.c @@ -14,7 +14,7 @@ ** other files are for internal use by SQLite and should not be ** accessed by users of the library. ** -** $Id: main.c,v 1.517 2008/12/10 16:45:51 drh Exp $ +** $Id: main.c,v 1.518 2008/12/10 21:19:57 drh Exp $ */ #include "sqliteInt.h" #include <ctype.h> @@ -403,8 +403,8 @@ static int setupLookaside(sqlite3 *db, void *pBuf, int sz, int cnt){ } db->lookaside.pStart = pStart; db->lookaside.pFree = 0; - db->lookaside.sz = sz; - db->lookaside.bMalloced = pBuf==0; + db->lookaside.sz = (u16)sz; + db->lookaside.bMalloced = pBuf==0 ?1:0; if( pStart ){ int i; LookasideSlot *p; @@ -920,7 +920,7 @@ int sqlite3CreateFunc( ** is being overridden/deleted but there are no active VMs, allow the ** operation to continue but invalidate all precompiled statements. */ - p = sqlite3FindFunction(db, zFunctionName, nName, nArg, enc, 0); + p = sqlite3FindFunction(db, zFunctionName, nName, (u16)nArg, enc, 0); if( p && p->iPrefEnc==enc && p->nArg==nArg ){ if( db->activeVdbeCnt ){ sqlite3Error(db, SQLITE_BUSY, @@ -932,7 +932,7 @@ int sqlite3CreateFunc( } } - p = sqlite3FindFunction(db, zFunctionName, nName, nArg, enc, 1); + p = sqlite3FindFunction(db, zFunctionName, nName, (u16)nArg, enc, 1); assert(p || db->mallocFailed); if( !p ){ return SQLITE_NOMEM; @@ -942,7 +942,7 @@ int sqlite3CreateFunc( p->xStep = xStep; p->xFinalize = xFinal; p->pUserData = pUserData; - p->nArg = nArg; + p->nArg = (u16)nArg; return SQLITE_OK; } @@ -1365,7 +1365,7 @@ static int createCollation( pColl->xCmp = xCompare; pColl->pUser = pCtx; pColl->xDel = xDel; - pColl->enc = enc2 | (enc & SQLITE_UTF16_ALIGNED); + pColl->enc = (u8)(enc2 | (enc & SQLITE_UTF16_ALIGNED)); } sqlite3Error(db, SQLITE_OK, 0); return SQLITE_OK; diff --git a/src/malloc.c b/src/malloc.c index 1950e048b..ba0122df6 100644 --- a/src/malloc.c +++ b/src/malloc.c @@ -12,7 +12,7 @@ ** ** Memory allocation functions used throughout sqlite. ** -** $Id: malloc.c,v 1.50 2008/12/10 19:26:24 drh Exp $ +** $Id: malloc.c,v 1.51 2008/12/10 21:19:57 drh Exp $ */ #include "sqliteInt.h" #include <stdarg.h> @@ -50,7 +50,7 @@ void sqlite3_soft_heap_limit(int n){ }else{ sqlite3MemoryAlarm(0, 0, 0); } - overage = sqlite3_memory_used() - n; + overage = (int)(sqlite3_memory_used() - (i64)n); if( overage>0 ){ sqlite3_release_memory(overage); } @@ -385,7 +385,7 @@ void sqlite3ScratchFree(void *p){ } }else{ int i; - i = (u8 *)p - (u8 *)sqlite3GlobalConfig.pScratch; + i = (int)((u8*)p - (u8*)sqlite3GlobalConfig.pScratch); i /= sqlite3GlobalConfig.szScratch; assert( i>=0 && i<sqlite3GlobalConfig.nScratch ); sqlite3_mutex_enter(mem0.mutex); diff --git a/src/mem1.c b/src/mem1.c index 7522fc8d2..ca1e6aecf 100644 --- a/src/mem1.c +++ b/src/mem1.c @@ -17,7 +17,7 @@ ** This file contains implementations of the low-level memory allocation ** routines specified in the sqlite3_mem_methods object. ** -** $Id: mem1.c,v 1.28 2008/11/19 09:05:27 danielk1977 Exp $ +** $Id: mem1.c,v 1.29 2008/12/10 21:19:57 drh Exp $ */ #include "sqliteInt.h" @@ -96,7 +96,7 @@ static int sqlite3MemSize(void *pPrior){ if( pPrior==0 ) return 0; p = (sqlite3_int64*)pPrior; p--; - return p[0]; + return (int)p[0]; } /* diff --git a/src/memjournal.c b/src/memjournal.c index bd91a3e15..d588e8ec8 100644 --- a/src/memjournal.c +++ b/src/memjournal.c @@ -14,7 +14,7 @@ ** The in-memory rollback journal is used to journal transactions for ** ":memory:" databases and when the journal_mode=MEMORY pragma is used. ** -** @(#) $Id: memjournal.c,v 1.6 2008/12/10 19:26:24 drh Exp $ +** @(#) $Id: memjournal.c,v 1.7 2008/12/10 21:19:57 drh Exp $ */ #include "sqliteInt.h" @@ -91,7 +91,7 @@ static int memjrnlRead( pChunk = p->readpoint.pChunk; } - iChunkOffset = (iOfst%JOURNAL_CHUNKSIZE); + iChunkOffset = (int)(iOfst%JOURNAL_CHUNKSIZE); do { int iSpace = JOURNAL_CHUNKSIZE - iChunkOffset; int nCopy = MIN(nRead, (JOURNAL_CHUNKSIZE - iChunkOffset)); @@ -127,7 +127,7 @@ static int memjrnlWrite( while( nWrite>0 ){ FileChunk *pChunk = p->endpoint.pChunk; - int iChunkOffset = p->endpoint.iOffset%JOURNAL_CHUNKSIZE; + int iChunkOffset = (int)(p->endpoint.iOffset%JOURNAL_CHUNKSIZE); int iSpace = MIN(nWrite, JOURNAL_CHUNKSIZE - iChunkOffset); if( iChunkOffset==0 ){ diff --git a/src/os_win.c b/src/os_win.c index f5fb4f581..90791c792 100644 --- a/src/os_win.c +++ b/src/os_win.c @@ -12,7 +12,7 @@ ** ** This file contains code that is specific to windows. ** -** $Id: os_win.c,v 1.142 2008/12/10 19:26:24 drh Exp $ +** $Id: os_win.c,v 1.143 2008/12/10 21:19:57 drh Exp $ */ #include "sqliteInt.h" #if SQLITE_OS_WIN /* This file is used for windows only */ @@ -648,8 +648,8 @@ static int winRead( int amt, /* Number of bytes to read */ sqlite3_int64 offset /* Begin reading at this offset */ ){ - LONG upperBits = (offset>>32) & 0x7fffffff; - LONG lowerBits = offset & 0xffffffff; + LONG upperBits = (LONG)((offset>>32) & 0x7fffffff); + LONG lowerBits = (LONG)(offset & 0xffffffff); DWORD rc; DWORD got; winFile *pFile = (winFile*)id; @@ -682,8 +682,8 @@ static int winWrite( int amt, /* Number of bytes to write */ sqlite3_int64 offset /* Offset into the file to begin writing at */ ){ - LONG upperBits = (offset>>32) & 0x7fffffff; - LONG lowerBits = offset & 0xffffffff; + LONG upperBits = (LONG)((offset>>32) & 0x7fffffff); + LONG lowerBits = (LONG)(offset & 0xffffffff); DWORD rc; DWORD wrote = 0; winFile *pFile = (winFile*)id; @@ -715,8 +715,8 @@ static int winWrite( */ static int winTruncate(sqlite3_file *id, sqlite3_int64 nByte){ DWORD rc; - LONG upperBits = (nByte>>32) & 0x7fffffff; - LONG lowerBits = nByte & 0xffffffff; + LONG upperBits = (LONG)((nByte>>32) & 0x7fffffff); + LONG lowerBits = (LONG)(nByte & 0xffffffff); winFile *pFile = (winFile*)id; OSTRACE3("TRUNCATE %d %lld\n", pFile->h, nByte); SimulateIOError(return SQLITE_IOERR_TRUNCATE); @@ -804,7 +804,7 @@ static int getReadLock(winFile *pFile){ }else{ int lk; sqlite3_randomness(sizeof(lk), &lk); - pFile->sharedLockByte = (lk & 0x7fffffff)%(SHARED_SIZE - 1); + pFile->sharedLockByte = (short)((lk & 0x7fffffff)%(SHARED_SIZE - 1)); res = LockFile(pFile->h, SHARED_FIRST+pFile->sharedLockByte, 0, 1, 0); #endif } @@ -957,7 +957,7 @@ static int winLock(sqlite3_file *id, int locktype){ locktype, newLocktype); rc = SQLITE_BUSY; } - pFile->locktype = newLocktype; + pFile->locktype = (u8)newLocktype; return rc; } @@ -1022,7 +1022,7 @@ static int winUnlock(sqlite3_file *id, int locktype){ if( type>=PENDING_LOCK ){ UnlockFile(pFile->h, PENDING_BYTE, 0, 1, 0); } - pFile->locktype = locktype; + pFile->locktype = (u8)locktype; return rc; } @@ -1437,7 +1437,7 @@ static int winFullPathname( int nFull, /* Size of output buffer in bytes */ char *zFull /* Output buffer */ ){ - + #if defined(__CYGWIN__) cygwin_conv_to_full_win32_path(zRelative, zFull); return SQLITE_OK; @@ -1507,6 +1507,7 @@ static int winFullPathname( static void *winDlOpen(sqlite3_vfs *pVfs, const char *zFilename){ HANDLE h; void *zConverted = convertUtf8Filename(zFilename); + UNUSED_PARAMETER(pVfs); if( zConverted==0 ){ return 0; } @@ -1525,9 +1526,11 @@ static void *winDlOpen(sqlite3_vfs *pVfs, const char *zFilename){ return (void*)h; } static void winDlError(sqlite3_vfs *pVfs, int nBuf, char *zBufOut){ + UNUSED_PARAMETER(pVfs); getLastErrorMsg(nBuf, zBufOut); } void (*winDlSym(sqlite3_vfs *pVfs, void *pHandle, const char *zSymbol))(void){ + UNUSED_PARAMETER(pVfs); #if SQLITE_OS_WINCE /* The GetProcAddressA() routine is only available on wince. */ return (void(*)(void))GetProcAddressA((HANDLE)pHandle, zSymbol); @@ -1538,6 +1541,7 @@ void (*winDlSym(sqlite3_vfs *pVfs, void *pHandle, const char *zSymbol))(void){ #endif } void winDlClose(sqlite3_vfs *pVfs, void *pHandle){ + UNUSED_PARAMETER(pVfs); FreeLibrary((HANDLE)pHandle); } #else /* if SQLITE_OMIT_LOAD_EXTENSION is defined: */ @@ -1590,6 +1594,7 @@ static int winRandomness(sqlite3_vfs *pVfs, int nBuf, char *zBuf){ */ static int winSleep(sqlite3_vfs *pVfs, int microsec){ Sleep((microsec+999)/1000); + UNUSED_PARAMETER(pVfs); return ((microsec+999)/1000)*1000; } @@ -1622,6 +1627,7 @@ int winCurrentTime(sqlite3_vfs *pVfs, double *prNow){ #else GetSystemTimeAsFileTime( &ft ); #endif + UNUSED_PARAMETER(pVfs); now = ((double)ft.dwHighDateTime) * 4294967296.0; *prNow = (now + ft.dwLowDateTime)/864000000000.0 + 2305813.5; #ifdef SQLITE_TEST @@ -1663,6 +1669,7 @@ int winCurrentTime(sqlite3_vfs *pVfs, double *prNow){ ** sqlite3_errmsg(), possibly making IO errors easier to debug. */ static int winGetLastError(sqlite3_vfs *pVfs, int nBuf, char *zBuf){ + UNUSED_PARAMETER(pVfs); return getLastErrorMsg(nBuf, zBuf); } diff --git a/src/pager.c b/src/pager.c index f8b98e654..be35dc922 100644 --- a/src/pager.c +++ b/src/pager.c @@ -18,7 +18,7 @@ ** file simultaneously, or one process from reading the database while ** another is writing. ** -** @(#) $Id: pager.c,v 1.512 2008/12/10 19:26:24 drh Exp $ +** @(#) $Id: pager.c,v 1.513 2008/12/10 21:19:57 drh Exp $ */ #ifndef SQLITE_OMIT_DISKIO #include "sqliteInt.h" @@ -4160,7 +4160,7 @@ int sqlite3PagerLockingMode(Pager *pPager, int eMode){ assert( PAGER_LOCKINGMODE_QUERY<0 ); assert( PAGER_LOCKINGMODE_NORMAL>=0 && PAGER_LOCKINGMODE_EXCLUSIVE>=0 ); if( eMode>=0 && !pPager->tempFile ){ - pPager->exclusiveMode = eMode; + pPager->exclusiveMode = (u8)eMode; } return (int)pPager->exclusiveMode; } @@ -4190,7 +4190,7 @@ int sqlite3PagerJournalMode(Pager *pPager, int eMode){ || eMode==PAGER_JOURNALMODE_MEMORY ); assert( PAGER_JOURNALMODE_QUERY<0 ); if( eMode>=0 ){ - pPager->journalMode = eMode; + pPager->journalMode = (u8)eMode; }else{ assert( eMode==PAGER_JOURNALMODE_QUERY ); } diff --git a/src/sqliteInt.h b/src/sqliteInt.h index a4b764e51..ae4b8d148 100644 --- a/src/sqliteInt.h +++ b/src/sqliteInt.h @@ -11,7 +11,7 @@ ************************************************************************* ** Internal interface definitions for SQLite. ** -** @(#) $Id: sqliteInt.h,v 1.808 2008/12/10 19:26:24 drh Exp $ +** @(#) $Id: sqliteInt.h,v 1.809 2008/12/10 21:19:57 drh Exp $ */ #ifndef _SQLITEINT_H_ #define _SQLITEINT_H_ @@ -2354,8 +2354,8 @@ int sqlite3Utf8Read(const u8*, const u8*, const u8**); */ int sqlite3PutVarint(unsigned char*, u64); int sqlite3PutVarint32(unsigned char*, u32); -int sqlite3GetVarint(const unsigned char *, u64 *); -int sqlite3GetVarint32(const unsigned char *, u32 *); +u8 sqlite3GetVarint(const unsigned char *, u64 *); +u8 sqlite3GetVarint32(const unsigned char *, u32 *); int sqlite3VarintLen(u64 v); /* @@ -2375,8 +2375,8 @@ int sqlite3VarintLen(u64 v); ** x = putVarint32( A, B ); ** */ -#define getVarint32(A,B) ((*(A)<(unsigned char)0x80) ? ((B) = (u32)*(A)),1 : sqlite3GetVarint32((A), (u32 *)&(B))) -#define putVarint32(A,B) (((u32)(B)<(u32)0x80) ? (*(A) = (unsigned char)(B)),1 : sqlite3PutVarint32((A), (B))) +#define getVarint32(A,B) (u8)((*(A)<(u8)0x80) ? ((B) = (u32)*(A)),1 : sqlite3GetVarint32((A), (u32 *)&(B))) +#define putVarint32(A,B) (u8)(((u32)(B)<(u32)0x80) ? (*(A) = (unsigned char)(B)),1 : sqlite3PutVarint32((A), (B))) #define getVarint sqlite3GetVarint #define putVarint sqlite3PutVarint diff --git a/src/util.c b/src/util.c index 34b812c47..59f1b805a 100644 --- a/src/util.c +++ b/src/util.c @@ -14,7 +14,7 @@ ** This file contains functions for allocating memory, comparing ** strings, and stuff like that. ** -** $Id: util.c,v 1.243 2008/12/09 03:55:14 drh Exp $ +** $Id: util.c,v 1.244 2008/12/10 21:19:57 drh Exp $ */ #include "sqliteInt.h" #include <stdarg.h> @@ -549,7 +549,7 @@ int sqlite3PutVarint32(unsigned char *p, u32 v){ ** Read a 64-bit variable-length integer from memory starting at p[0]. ** Return the number of bytes read. The value is stored in *v. */ -int sqlite3GetVarint(const unsigned char *p, u64 *v){ +u8 sqlite3GetVarint(const unsigned char *p, u64 *v){ u32 a,b,s; a = *p; @@ -711,7 +711,7 @@ int sqlite3GetVarint(const unsigned char *p, u64 *v){ ** single-byte case. All code should use the MACRO version as ** this function assumes the single-byte case has already been handled. */ -int sqlite3GetVarint32(const unsigned char *p, u32 *v){ +u8 sqlite3GetVarint32(const unsigned char *p, u32 *v){ u32 a,b; a = *p; @@ -780,7 +780,7 @@ int sqlite3GetVarint32(const unsigned char *p, u32 *v){ ** value. */ { u64 v64; - int n; + u8 n; p -= 4; n = sqlite3GetVarint(p, &v64); |