1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-08-05 15:55:57 +03:00

Additional work at eliminating silly compiler warnings. (CVS 6010)

FossilOrigin-Name: ea01d43788a75e39c7f03c22681d1a338d52cf0e
This commit is contained in:
drh
2008-12-10 21:19:56 +00:00
parent 00c586a238
commit 1bd10f8a00
18 changed files with 148 additions and 135 deletions

View File

@@ -1,5 +1,5 @@
C Fixed\stypo\sin\scomment\sin\smkkeywordhash.c.\s(CVS\s6009) C Additional\swork\sat\seliminating\ssilly\scompiler\swarnings.\s(CVS\s6010)
D 2008-12-10T20:11:01 D 2008-12-10T21:19:57
F Makefile.arm-wince-mingw32ce-gcc fcd5e9cd67fe88836360bb4f9ef4cb7f8e2fb5a0 F Makefile.arm-wince-mingw32ce-gcc fcd5e9cd67fe88836360bb4f9ef4cb7f8e2fb5a0
F Makefile.in f7e4c81c347b04f7b0f1c1b081a168645d7b8af7 F Makefile.in f7e4c81c347b04f7b0f1c1b081a168645d7b8af7
F Makefile.linux-gcc d53183f4aa6a9192d249731c90dbdffbd2c68654 F Makefile.linux-gcc d53183f4aa6a9192d249731c90dbdffbd2c68654
@@ -100,33 +100,33 @@ F src/attach.c 1c35f95da3c62d19de75b44cfefd12c81c1791b3
F src/auth.c c8b2ab5c8bad4bd90ed7c294694f48269162c627 F src/auth.c c8b2ab5c8bad4bd90ed7c294694f48269162c627
F src/bitvec.c 4300d311b17fb3c1476623fd895a8feac02a0b08 F src/bitvec.c 4300d311b17fb3c1476623fd895a8feac02a0b08
F src/btmutex.c 63c5cc4ad5715690767ffcb741e185d7bc35ec1a F src/btmutex.c 63c5cc4ad5715690767ffcb741e185d7bc35ec1a
F src/btree.c ba7baa987f9723882ef4655886327622e02a497f F src/btree.c e5bfe007a4c4f643cb69426e6af0a9e556352f5b
F src/btree.h 179c3ea813780df78a289a8f5130db18e6d4616e F src/btree.h 179c3ea813780df78a289a8f5130db18e6d4616e
F src/btreeInt.h 7ef2c872371d7508657f8d7a4efe651c741d6ee6 F src/btreeInt.h 7ef2c872371d7508657f8d7a4efe651c741d6ee6
F src/build.c 64e9eb409ab39feb08919d28bf112fc3bf07d8e6 F src/build.c 205538f36cd5c9ec04f24beecdb69629758aaa50
F src/callback.c 5538f3fb2507f6cc44623b06a87c861b1c0477bd F src/callback.c bee8949d619b1b7b1e4dfac8a19c5116ae1dd12a
F src/complete.c cb14e06dbe79dee031031f0d9e686ff306afe07c F src/complete.c cb14e06dbe79dee031031f0d9e686ff306afe07c
F src/date.c 9a6156445442625e72f1ec06b1f392658240f6e6 F src/date.c 719afa5531c5350f2929d36122a7e0355c0f3d70
F src/delete.c 1817205f833a084f66fa9c8e322ab46ba998e4c7 F src/delete.c e2392b6808496fc0a7f54662af3ba677a3e8e44a
F src/expr.c ee295129a9efa0466ae4ebdb03adc33cd5c2e184 F src/expr.c f13ad5563470481eaa1e8016bfa9ed1b4c996574
F src/fault.c dc88c821842157460750d2d61a8a8b4197d047ff F src/fault.c dc88c821842157460750d2d61a8a8b4197d047ff
F src/func.c 1246828c0d16ad4660c00b39ad83644ed2205e0c F src/func.c 8b5f6807f05f50d88fc4efca5e9541bcf569f988
F src/global.c 91723e45a2ad03ae5bb97a0a0d2dbb1a0e69527b F src/global.c 91723e45a2ad03ae5bb97a0a0d2dbb1a0e69527b
F src/hash.c 831e9c199d8de5976c698e5aca278e2de74ff93b F src/hash.c 831e9c199d8de5976c698e5aca278e2de74ff93b
F src/hash.h 28f38ebb1006a5beedcb013bcdfe31befe7437ae F src/hash.h 28f38ebb1006a5beedcb013bcdfe31befe7437ae
F src/hwtime.h 4a1d45f4cae1f402ea19686acf24acf4f0cb53cb F src/hwtime.h 4a1d45f4cae1f402ea19686acf24acf4f0cb53cb
F src/insert.c c34dab7d450cf6612859f7c66d48ec6d4aa409fd F src/insert.c f6db1e6f43aae337e64a755208abb6ff124edc19
F src/journal.c cffd2cd214e58c0e99c3ff632b3bee6c7cbb260e F src/journal.c cffd2cd214e58c0e99c3ff632b3bee6c7cbb260e
F src/legacy.c 4f7410b29598d991628ca40b150aa089649f17d8 F src/legacy.c 4f7410b29598d991628ca40b150aa089649f17d8
F src/loadext.c 2f53996c693a347edc2d773e9217dde49d96ae64 F src/loadext.c 2f53996c693a347edc2d773e9217dde49d96ae64
F src/main.c 12b674019503ad90649cd8e6295425ef3078ce12 F src/main.c 1bb24c0720080e3258c7a9ed93d42c3da98c18d5
F src/malloc.c 6a5b91159f87238392f190b02b5fba09fe526984 F src/malloc.c 1e5eeb5a3074a6935bbe7b04bc058f630bfffd7e
F src/mem0.c f2f84062d1f35814d6535c9f9e33de3bfb3b132c F src/mem0.c f2f84062d1f35814d6535c9f9e33de3bfb3b132c
F src/mem1.c bb8e26adde7d463270e961f045802c61dbabc8f1 F src/mem1.c 3bfb39e4f60b0179713a7c087b2d4f0dc205735f
F src/mem2.c 4c53c0071d3c68b8f252fe85d1667bad59421396 F src/mem2.c 4c53c0071d3c68b8f252fe85d1667bad59421396
F src/mem3.c 67153ec933e08b70714055e872efb58a6b287939 F src/mem3.c 67153ec933e08b70714055e872efb58a6b287939
F src/mem5.c 838309b521c96a2a34507f74a5a739d28de4aac6 F src/mem5.c 838309b521c96a2a34507f74a5a739d28de4aac6
F src/memjournal.c f9fbded1b4ead4378a4f751fa3ae2bc429f72976 F src/memjournal.c e3c9aa679be8eecc4d5636f4d07aeeb084f41cf3
F src/mutex.c e9cb5fbe94afb4328869afaf3ac49bd1327559eb F src/mutex.c e9cb5fbe94afb4328869afaf3ac49bd1327559eb
F src/mutex.h 9e686e83a88838dac8b9c51271c651e833060f1e F src/mutex.h 9e686e83a88838dac8b9c51271c651e833060f1e
F src/mutex_noop.c f5a07671f25a1a9bd7c10ad7107bc2585446200f F src/mutex_noop.c f5a07671f25a1a9bd7c10ad7107bc2585446200f
@@ -138,8 +138,8 @@ F src/os.h 4ee25a35c00e75a569cecb5080be299b0c3e208e
F src/os_common.h 24525d8b7bce66c374dfc1810a6c9043f3359b60 F src/os_common.h 24525d8b7bce66c374dfc1810a6c9043f3359b60
F src/os_os2.c bed77dc26e3a95ce4a204936b9a1ca6fe612fcc5 F src/os_os2.c bed77dc26e3a95ce4a204936b9a1ca6fe612fcc5
F src/os_unix.c 970e4a98a2d026cbeb2464694e4d13e079102b2f F src/os_unix.c 970e4a98a2d026cbeb2464694e4d13e079102b2f
F src/os_win.c af9459fcd0ba1852c75c0844ec82781e6767d909 F src/os_win.c d7a12403025a69a358974ba7504562b109fd403b
F src/pager.c 64269ef14e57c545f8a9588eba15fface4265166 F src/pager.c ef93fb79ab794a0109784a2018f23127c53dd74a
F src/pager.h 37f5173612b7803f44656c16e80df3280234bb18 F src/pager.h 37f5173612b7803f44656c16e80df3280234bb18
F src/parse.y 3dfd941533cdc6ce0b09b905b25c4eb73858400b F src/parse.y 3dfd941533cdc6ce0b09b905b25c4eb73858400b
F src/pcache.c 16dc8da6e6ba6250f8dfd9ee46036db1cbceedc6 F src/pcache.c 16dc8da6e6ba6250f8dfd9ee46036db1cbceedc6
@@ -155,7 +155,7 @@ F src/select.c 49296e1abf019b965f04a6dc5ff9fafa3ae46396
F src/shell.c 793aaebd8024896c58ded47414fe688fb8b1ef6d F src/shell.c 793aaebd8024896c58ded47414fe688fb8b1ef6d
F src/sqlite.h.in 619a82b485fbf02276ecb8b1cc629f0c8bcda4ca F src/sqlite.h.in 619a82b485fbf02276ecb8b1cc629f0c8bcda4ca
F src/sqlite3ext.h 1db7d63ab5de4b3e6b83dd03d1a4e64fef6d2a17 F src/sqlite3ext.h 1db7d63ab5de4b3e6b83dd03d1a4e64fef6d2a17
F src/sqliteInt.h d34967323d5e1351a3b719c4121aed6bc3c9f520 F src/sqliteInt.h a1478d1ec40bca0b511c06e2b4c93dc932aa3426
F src/sqliteLimit.h f435e728c6b620ef7312814d660a81f9356eb5c8 F src/sqliteLimit.h f435e728c6b620ef7312814d660a81f9356eb5c8
F src/status.c 237b193efae0cf6ac3f0817a208de6c6c6ef6d76 F src/status.c 237b193efae0cf6ac3f0817a208de6c6c6ef6d76
F src/table.c 23db1e5f27c03160987c122a078b4bb51ef0b2f8 F src/table.c 23db1e5f27c03160987c122a078b4bb51ef0b2f8
@@ -192,7 +192,7 @@ F src/tokenize.c aaa5fa6a4536a9dd7c855a3f66f32508f1612138
F src/trigger.c 5a669d8fc9197db393ff85fa95ec882282162bb5 F src/trigger.c 5a669d8fc9197db393ff85fa95ec882282162bb5
F src/update.c 3e022c24e265b0975e51f2ec0348ef84eeaba311 F src/update.c 3e022c24e265b0975e51f2ec0348ef84eeaba311
F src/utf.c 7bc90bc7d1a0239f876e2c2ce573e9b103aedcd4 F src/utf.c 7bc90bc7d1a0239f876e2c2ce573e9b103aedcd4
F src/util.c 6e997af379d3aa609bf084d7d10fdc1cf32cc72c F src/util.c 27f60e2b0ab2734a35e961879366f3420465c89d
F src/vacuum.c 383d6297bddc011ab04a9eed110db6eaf523e8e9 F src/vacuum.c 383d6297bddc011ab04a9eed110db6eaf523e8e9
F src/vdbe.c 0244413f3dae1ee63479f541ec2e950b05c65112 F src/vdbe.c 0244413f3dae1ee63479f541ec2e950b05c65112
F src/vdbe.h 03516f28bf5aca00a53c4dccd6c313f96adb94f6 F src/vdbe.h 03516f28bf5aca00a53c4dccd6c313f96adb94f6
@@ -664,7 +664,7 @@ F tool/speedtest16.c c8a9c793df96db7e4933f0852abb7a03d48f2e81
F tool/speedtest2.tcl ee2149167303ba8e95af97873c575c3e0fab58ff F tool/speedtest2.tcl ee2149167303ba8e95af97873c575c3e0fab58ff
F tool/speedtest8.c 2902c46588c40b55661e471d7a86e4dd71a18224 F tool/speedtest8.c 2902c46588c40b55661e471d7a86e4dd71a18224
F tool/speedtest8inst1.c 293327bc76823f473684d589a8160bde1f52c14e F tool/speedtest8inst1.c 293327bc76823f473684d589a8160bde1f52c14e
P ccb9393a7a10f0970419b860af293b0bdad7f894 P b7dd05b403e69caca814ccd8824130f176160cd5
R e5cd4f999065b826204c96a1b5fe9334 R 5bd6d4daa43f7acc541261f54e444525
U shane U drh
Z 456bceda2dd3765ecca5d86a452706ff Z ac7cc71d687c854ae8b6ca4ac780169f

View File

@@ -1 +1 @@
b7dd05b403e69caca814ccd8824130f176160cd5 ea01d43788a75e39c7f03c22681d1a338d52cf0e

View File

@@ -9,7 +9,7 @@
** May you share freely, never taking more than you give. ** 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. ** This file implements a external (disk-based) database using BTrees.
** See the header comment on "btreeInt.h" for additional information. ** See the header comment on "btreeInt.h" for additional information.
@@ -590,7 +590,7 @@ void sqlite3BtreeParseCellPtr(
}else{ }else{
nPayload = 0; nPayload = 0;
} }
n += (u16)getVarint(&pCell[n], (u64*)&pInfo->nKey); n += getVarint(&pCell[n], (u64*)&pInfo->nKey);
pInfo->nData = nPayload; pInfo->nData = nPayload;
}else{ }else{
pInfo->nData = 0; pInfo->nData = 0;
@@ -610,7 +610,7 @@ void sqlite3BtreeParseCellPtr(
if( (nSize & ~3)==0 ){ if( (nSize & ~3)==0 ){
nSize = 4; /* Minimum cell size is 4 */ nSize = 4; /* Minimum cell size is 4 */
} }
pInfo->nSize = (int)nSize; pInfo->nSize = (u16)nSize;
}else{ }else{
/* If the payload will not fit completely on the local page, we have /* 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 ** 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]); pc = get2byte(&data[hdr+1]);
nFree = data[hdr+7] + top - (cellOffset + 2*pPage->nCell); nFree = data[hdr+7] + top - (cellOffset + 2*pPage->nCell);
while( pc>0 ){ while( pc>0 ){
int next, size; u16 next, size;
if( pc>usableSize-4 ){ if( pc>usableSize-4 ){
/* Free block is off the page */ /* Free block is off the page */
return SQLITE_CORRUPT_BKPT; return SQLITE_CORRUPT_BKPT;
@@ -1056,8 +1056,8 @@ static void zeroPage(MemPage *pPage, int flags){
assert( sqlite3PagerIswriteable(pPage->pDbPage) ); assert( sqlite3PagerIswriteable(pPage->pDbPage) );
assert( sqlite3_mutex_held(pBt->mutex) ); assert( sqlite3_mutex_held(pBt->mutex) );
/*memset(&data[hdr], 0, pBt->usableSize - hdr);*/ /*memset(&data[hdr], 0, pBt->usableSize - hdr);*/
data[hdr] = flags; data[hdr] = (char)flags;
first = hdr + 8 + 4*((flags&PTF_LEAF)==0); first = hdr + 8 + 4*((flags&PTF_LEAF)==0 ?1:0);
memset(&data[hdr+1], 0, 4); memset(&data[hdr+1], 0, 4);
data[hdr+7] = 0; data[hdr+7] = 0;
put2byte(&data[hdr+5], pBt->usableSize); put2byte(&data[hdr+5], pBt->usableSize);
@@ -1651,7 +1651,7 @@ int sqlite3BtreeSetPageSize(Btree *p, int pageSize, int nReserve){
((pageSize-1)&pageSize)==0 ){ ((pageSize-1)&pageSize)==0 ){
assert( (pageSize & 7)==0 ); assert( (pageSize & 7)==0 );
assert( !pBt->pPage1 && !pBt->pCursor ); assert( !pBt->pPage1 && !pBt->pCursor );
pBt->pageSize = pageSize; pBt->pageSize = (u16)pageSize;
freeTempSpace(pBt); freeTempSpace(pBt);
rc = sqlite3PagerSetPagesize(pBt->pPager, &pBt->pageSize); rc = sqlite3PagerSetPagesize(pBt->pPager, &pBt->pageSize);
} }
@@ -1807,8 +1807,8 @@ static int lockBtree(BtShared *pBt){
if( usableSize<500 ){ if( usableSize<500 ){
goto page1_init_failed; goto page1_init_failed;
} }
pBt->pageSize = pageSize; pBt->pageSize = (u16)pageSize;
pBt->usableSize = usableSize; pBt->usableSize = (u16)usableSize;
#ifndef SQLITE_OMIT_AUTOVACUUM #ifndef SQLITE_OMIT_AUTOVACUUM
pBt->autoVacuum = (get4byte(&page1[36 + 4*4])?1:0); pBt->autoVacuum = (get4byte(&page1[36 + 4*4])?1:0);
pBt->incrVacuum = (get4byte(&page1[36 + 7*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 *pPgnoNext /* OUT: Next overflow page number */
){ ){
Pgno next = 0; Pgno next = 0;
int rc; int rc = SQLITE_OK;
assert( sqlite3_mutex_held(pBt->mutex) ); assert( sqlite3_mutex_held(pBt->mutex) );
/* One of these must not be NULL. Otherwise, why call this function? */ /* 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){ static int moveToRightmost(BtCursor *pCur){
Pgno pgno; Pgno pgno;
int rc = SQLITE_OK; int rc = SQLITE_OK;
MemPage *pPage; MemPage *pPage = 0;
assert( cursorHoldsMutex(pCur) ); assert( cursorHoldsMutex(pCur) );
assert( pCur->eState==CURSOR_VALID ); assert( pCur->eState==CURSOR_VALID );
@@ -3822,7 +3822,7 @@ int sqlite3BtreeMovetoUnpacked(
goto moveto_finish; goto moveto_finish;
} }
rc = sqlite3BtreeKey(pCur, 0, (int)nCellKey, (void*)pCellKey); rc = sqlite3BtreeKey(pCur, 0, (int)nCellKey, (void*)pCellKey);
c = sqlite3VdbeRecordCompare(nCellKey, pCellKey, pIdxKey); c = sqlite3VdbeRecordCompare((int)nCellKey, pCellKey, pIdxKey);
sqlite3_free(pCellKey); sqlite3_free(pCellKey);
if( rc ) goto moveto_finish; if( rc ) goto moveto_finish;
} }
@@ -6009,7 +6009,7 @@ int sqlite3BtreeDelete(BtCursor *pCur){
** to be a leaf so we can use it. ** to be a leaf so we can use it.
*/ */
BtCursor leafCur; BtCursor leafCur;
MemPage *pLeafPage; MemPage *pLeafPage = 0;
unsigned char *pNext; unsigned char *pNext;
int notUsed; 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]. ** free pages is not visible. So Cookie[0] is the same as Meta[1].
*/ */
int sqlite3BtreeGetMeta(Btree *p, int idx, u32 *pMeta){ int sqlite3BtreeGetMeta(Btree *p, int idx, u32 *pMeta){
DbPage *pDbPage; DbPage *pDbPage = 0;
int rc; int rc;
unsigned char *pP1; unsigned char *pP1;
BtShared *pBt = p->pBt; BtShared *pBt = p->pBt;

View File

@@ -22,7 +22,7 @@
** COMMIT ** COMMIT
** ROLLBACK ** 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 "sqliteInt.h"
#include <ctype.h> #include <ctype.h>
@@ -32,7 +32,7 @@
** be parsed. Initialize the pParse structure as needed. ** be parsed. Initialize the pParse structure as needed.
*/ */
void sqlite3BeginParse(Parse *pParse, int explainFlag){ void sqlite3BeginParse(Parse *pParse, int explainFlag){
pParse->explain = explainFlag; pParse->explain = (u8)explainFlag;
pParse->nVar = 0; pParse->nVar = 0;
} }
@@ -187,7 +187,8 @@ void sqlite3FinishCoding(Parse *pParse){
*/ */
VdbeOp *pOp = sqlite3VdbeGetOp(v, 0); VdbeOp *pOp = sqlite3VdbeGetOp(v, 0);
if( pOp && pOp->opcode==OP_Trace ){ 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 */ #endif /* SQLITE_OMIT_TRACE */
@@ -628,7 +629,7 @@ void sqlite3OpenMasterTable(Parse *p, int iDb){
*/ */
int sqlite3FindDb(sqlite3 *db, Token *pName){ int sqlite3FindDb(sqlite3 *db, Token *pName){
int i = -1; /* Database number */ 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 */ Db *pDb; /* A database whose name space is being searched */
char *zName; /* Name we are searching for */ char *zName; /* Name we are searching for */
@@ -995,7 +996,7 @@ void sqlite3AddNotNull(Parse *pParse, int onError){
int i; int i;
if( (p = pParse->pNewTable)==0 ) return; if( (p = pParse->pNewTable)==0 ) return;
i = p->nCol-1; 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 if( zType && sqlite3StrICmp(zType, "INTEGER")==0
&& sortOrder==SQLITE_SO_ASC ){ && sortOrder==SQLITE_SO_ASC ){
pTab->iPKey = iCol; pTab->iPKey = iCol;
pTab->keyConf = onError; pTab->keyConf = (u8)onError;
assert( autoInc==0 || autoInc==1 ); assert( autoInc==0 || autoInc==1 );
pTab->tabFlags |= autoInc*TF_Autoincrement; pTab->tabFlags |= autoInc*TF_Autoincrement;
}else if( autoInc ){ }else if( autoInc ){
@@ -1554,7 +1555,7 @@ void sqlite3EndTable(
if( pSelect ){ if( pSelect ){
zStmt = createTableStmt(db, p, p->pSchema==db->aDb[1].pSchema); zStmt = createTableStmt(db, p, p->pSchema==db->aDb[1].pSchema);
}else{ }else{
n = pEnd->z - pParse->sNameToken.z + 1; n = (int)(pEnd->z - pParse->sNameToken.z) + 1;
zStmt = sqlite3MPrintf(db, zStmt = sqlite3MPrintf(db,
"CREATE %s %.*s", zType2, n, pParse->sNameToken.z "CREATE %s %.*s", zType2, n, pParse->sNameToken.z
); );
@@ -1638,7 +1639,7 @@ void sqlite3EndTable(
if( pCons->z==0 ){ if( pCons->z==0 ){
pCons = pEnd; pCons = pEnd;
} }
nName = (const char *)pCons->z - zName; nName = (int)((const char *)pCons->z - zName);
p->addColOffset = 13 + sqlite3Utf8CharLen(zName, nName); p->addColOffset = 13 + sqlite3Utf8CharLen(zName, nName);
} }
#endif #endif
@@ -1709,7 +1710,7 @@ void sqlite3CreateView(
sEnd.z += sEnd.n; sEnd.z += sEnd.n;
} }
sEnd.n = 0; sEnd.n = 0;
n = sEnd.z - pBegin->z; n = (int)(sEnd.z - pBegin->z);
z = (const unsigned char*)pBegin->z; z = (const unsigned char*)pBegin->z;
while( n>0 && (z[n-1]==';' || isspace(z[n-1])) ){ n--; } while( n>0 && (z[n-1]==';' || isspace(z[n-1])) ){ n--; }
sEnd.z = &z[n-1]; sEnd.z = &z[n-1];
@@ -2222,9 +2223,9 @@ void sqlite3CreateForeignKey(
} }
} }
pFKey->isDeferred = 0; pFKey->isDeferred = 0;
pFKey->deleteConf = flags & 0xff; pFKey->deleteConf = (u8)(flags & 0xff);
pFKey->updateConf = (flags >> 8 ) & 0xff; pFKey->updateConf = (u8)((flags >> 8 ) & 0xff);
pFKey->insertConf = (flags >> 16 ) & 0xff; pFKey->insertConf = (u8)((flags >> 16 ) & 0xff);
/* Link the foreign key to the table as the last step. /* Link the foreign key to the table as the last step.
*/ */
@@ -2250,7 +2251,8 @@ void sqlite3DeferForeignKey(Parse *pParse, int isDeferred){
Table *pTab; Table *pTab;
FKey *pFKey; FKey *pFKey;
if( (pTab = pParse->pNewTable)==0 || (pFKey = pTab->pFKey)==0 ) return; if( (pTab = pParse->pNewTable)==0 || (pFKey = pTab->pFKey)==0 ) return;
pFKey->isDeferred = isDeferred; assert( isDeferred==0 || isDeferred==1 );
pFKey->isDeferred = (u8)isDeferred;
#endif #endif
} }
@@ -2503,7 +2505,7 @@ void sqlite3CreateIndex(
nullId.n = sqlite3Strlen30((char*)nullId.z); nullId.n = sqlite3Strlen30((char*)nullId.z);
pList = sqlite3ExprListAppend(pParse, 0, 0, &nullId); pList = sqlite3ExprListAppend(pParse, 0, 0, &nullId);
if( pList==0 ) goto exit_create_index; 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 /* Figure out how many bytes of space are required to store explicitly
@@ -2543,8 +2545,8 @@ void sqlite3CreateIndex(
memcpy(pIndex->zName, zName, nName+1); memcpy(pIndex->zName, zName, nName+1);
pIndex->pTable = pTab; pIndex->pTable = pTab;
pIndex->nColumn = pList->nExpr; pIndex->nColumn = pList->nExpr;
pIndex->onError = onError; pIndex->onError = (u8)onError;
pIndex->autoIndex = pName==0; pIndex->autoIndex = (u8)(pName==0);
pIndex->pSchema = db->aDb[iDb].pSchema; pIndex->pSchema = db->aDb[iDb].pSchema;
/* Check to see if we should honor DESC requests on index columns /* Check to see if we should honor DESC requests on index columns
@@ -2596,7 +2598,7 @@ void sqlite3CreateIndex(
} }
pIndex->azColl[i] = zColl; pIndex->azColl[i] = zColl;
requestedSortOrder = pListItem->sortOrder & sortOrderMask; requestedSortOrder = pListItem->sortOrder & sortOrderMask;
pIndex->aSortOrder[i] = requestedSortOrder; pIndex->aSortOrder[i] = (u8)requestedSortOrder;
} }
sqlite3DefaultRowEst(pIndex); sqlite3DefaultRowEst(pIndex);
@@ -3046,7 +3048,7 @@ SrcList *sqlite3SrcListEnlarge(
} }
pSrc = pNew; pSrc = pNew;
nGot = (sqlite3DbMallocSize(db, pNew) - sizeof(*pSrc))/sizeof(pSrc->a[0])+1; 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 /* Move existing slots that come after the newly inserted slots
@@ -3054,7 +3056,7 @@ SrcList *sqlite3SrcListEnlarge(
for(i=pSrc->nSrc-1; i>=iStart; i--){ for(i=pSrc->nSrc-1; i>=iStart; i--){
pSrc->a[i+nExtra] = pSrc->a[i]; pSrc->a[i+nExtra] = pSrc->a[i];
} }
pSrc->nSrc += nExtra; pSrc->nSrc += (u16)nExtra;
/* Zero the newly allocated slots */ /* Zero the newly allocated slots */
memset(&pSrc->a[iStart], 0, sizeof(pSrc->a[0])*nExtra); 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->aColl[i] = sqlite3LocateCollSeq(pParse, zColl, -1);
pKey->aSortOrder[i] = pIdx->aSortOrder[i]; pKey->aSortOrder[i] = pIdx->aSortOrder[i];
} }
pKey->nField = nCol; pKey->nField = (u16)nCol;
} }
if( pParse->nErr ){ if( pParse->nErr ){

View File

@@ -13,7 +13,7 @@
** This file contains functions used to access the internal hash tables ** This file contains functions used to access the internal hash tables
** of user defined functions and collation sequences. ** 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" #include "sqliteInt.h"
@@ -381,7 +381,7 @@ FuncDef *sqlite3FindFunction(
if( createFlag && (bestScore<6 || pBest->nArg!=nArg) && if( createFlag && (bestScore<6 || pBest->nArg!=nArg) &&
(pBest = sqlite3DbMallocZero(db, sizeof(*pBest)+nName+1))!=0 ){ (pBest = sqlite3DbMallocZero(db, sizeof(*pBest)+nName+1))!=0 ){
pBest->zName = (char *)&pBest[1]; pBest->zName = (char *)&pBest[1];
pBest->nArg = nArg; pBest->nArg = (u16)nArg;
pBest->iPrefEnc = enc; pBest->iPrefEnc = enc;
memcpy(pBest->zName, zName, nName); memcpy(pBest->zName, zName, nName);
pBest->zName[nName] = 0; pBest->zName[nName] = 0;

View File

@@ -16,7 +16,7 @@
** sqlite3RegisterDateTimeFunctions() found at the bottom of the file. ** sqlite3RegisterDateTimeFunctions() found at the bottom of the file.
** All other code has file scope. ** 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 ** SQLite processes all times and dates as Julian Day numbers. The
** dates and times are stored as the number of days since noon ** 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]; char *z, zBuf[30];
z = zBuf; z = zBuf;
for(n=0; n<ArraySize(zBuf)-1 && zMod[n]; n++){ 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; z[n] = 0;
switch( z[0] ){ switch( z[0] ){

View File

@@ -12,7 +12,7 @@
** This file contains C code routines that are called by the parser ** This file contains C code routines that are called by the parser
** in order to generate code for DELETE FROM statements. ** 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" #include "sqliteInt.h"
@@ -76,7 +76,7 @@ void sqlite3OpenTable(
if( IsVirtual(pTab) ) return; if( IsVirtual(pTab) ) return;
v = sqlite3GetVdbe(p); v = sqlite3GetVdbe(p);
assert( opcode==OP_OpenWrite || opcode==OP_OpenRead ); 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); sqlite3VdbeAddOp2(v, OP_SetNumColumns, 0, pTab->nCol);
sqlite3VdbeAddOp3(v, opcode, iCur, pTab->tnum, iDb); sqlite3VdbeAddOp3(v, opcode, iCur, pTab->tnum, iDb);
VdbeComment((v, "%s", pTab->zName)); VdbeComment((v, "%s", pTab->zName));
@@ -240,10 +240,10 @@ void sqlite3DeleteFrom(
int isView; /* True if attempting to delete from a view */ int isView; /* True if attempting to delete from a view */
int triggers_exist = 0; /* True if any triggers exist */ int triggers_exist = 0; /* True if any triggers exist */
#endif #endif
int iBeginAfterTrigger; /* Address of after trigger program */ int iBeginAfterTrigger = 0; /* Address of after trigger program */
int iEndAfterTrigger; /* Exit of after trigger program */ int iEndAfterTrigger = 0; /* Exit of after trigger program */
int iBeginBeforeTrigger; /* Address of before trigger program */ int iBeginBeforeTrigger = 0; /* Address of before trigger program */
int iEndBeforeTrigger; /* Exit of before trigger program */ int iEndBeforeTrigger = 0; /* Exit of before trigger program */
u32 old_col_mask = 0; /* Mask of OLD.* columns in use */ u32 old_col_mask = 0; /* Mask of OLD.* columns in use */
sContext.pParse = 0; sContext.pParse = 0;

View File

@@ -12,7 +12,7 @@
** This file contains routines used for analyzing expressions and ** This file contains routines used for analyzing expressions and
** for generating VDBE code that evaluates expressions in SQLite. ** 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 "sqliteInt.h"
#include <ctype.h> #include <ctype.h>
@@ -190,7 +190,7 @@ int sqlite3IndexAffinityOk(Expr *pExpr, char idx_affinity){
*/ */
static u8 binaryCompareP5(Expr *pExpr1, Expr *pExpr2, int jumpIfNull){ static u8 binaryCompareP5(Expr *pExpr1, Expr *pExpr2, int jumpIfNull){
u8 aff = (char)sqlite3ExprAffinity(pExpr2); u8 aff = (char)sqlite3ExprAffinity(pExpr2);
aff = sqlite3CompareAffinity(pExpr1, aff) | jumpIfNull; aff = (u8)sqlite3CompareAffinity(pExpr1, aff) | (u8)jumpIfNull;
return aff; return aff;
} }
@@ -272,7 +272,7 @@ static int codeCompare(
p5 = binaryCompareP5(pLeft, pRight, jumpIfNull); p5 = binaryCompareP5(pLeft, pRight, jumpIfNull);
addr = sqlite3VdbeAddOp4(pParse->pVdbe, opcode, in2, dest, in1, addr = sqlite3VdbeAddOp4(pParse->pVdbe, opcode, in2, dest, in1,
(void*)p4, P4_COLLSEQ); (void*)p4, P4_COLLSEQ);
sqlite3VdbeChangeP5(pParse->pVdbe, p5); sqlite3VdbeChangeP5(pParse->pVdbe, (u8)p5);
if( (p5 & SQLITE_AFF_MASK)!=SQLITE_AFF_NONE ){ if( (p5 & SQLITE_AFF_MASK)!=SQLITE_AFF_NONE ){
sqlite3ExprCacheAffinityChange(pParse, in1, 1); sqlite3ExprCacheAffinityChange(pParse, in1, 1);
sqlite3ExprCacheAffinityChange(pParse, in2, 1); sqlite3ExprCacheAffinityChange(pParse, in2, 1);
@@ -397,7 +397,7 @@ Expr *sqlite3Expr(
sqlite3ExprDelete(db, pRight); sqlite3ExprDelete(db, pRight);
return 0; return 0;
} }
pNew->op = op; pNew->op = (u8)op;
pNew->pLeft = pLeft; pNew->pLeft = pLeft;
pNew->pRight = pRight; pNew->pRight = pRight;
pNew->iAgg = -1; 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 ** number as the prior appearance of the same name, or if the name
** has never appeared before, reuse the same variable number ** has never appeared before, reuse the same variable number
*/ */
int i, n; int i;
u32 n;
n = pToken->n; n = pToken->n;
for(i=0; i<pParse->nVarExpr; i++){ for(i=0; i<pParse->nVarExpr; i++){
Expr *pE; Expr *pE;
@@ -1331,7 +1332,7 @@ void sqlite3CodeSubselect(
assert( !isRowid ); assert( !isRowid );
sqlite3SelectDestInit(&dest, SRT_Set, pExpr->iTable); sqlite3SelectDestInit(&dest, SRT_Set, pExpr->iTable);
dest.affinity = (int)affinity; dest.affinity = (u8)affinity;
assert( (pExpr->iTable&0x0000FFFF)==pExpr->iTable ); assert( (pExpr->iTable&0x0000FFFF)==pExpr->iTable );
if( sqlite3Select(pParse, pExpr->pSelect, &dest) ){ if( sqlite3Select(pParse, pExpr->pSelect, &dest) ){
return; return;
@@ -2064,7 +2065,7 @@ int sqlite3ExprCodeTarget(Parse *pParse, Expr *pExpr, int target){
} }
sqlite3VdbeAddOp4(v, OP_Function, constMask, r1, target, sqlite3VdbeAddOp4(v, OP_Function, constMask, r1, target,
(char*)pDef, P4_FUNCDEF); (char*)pDef, P4_FUNCDEF);
sqlite3VdbeChangeP5(v, nExpr); sqlite3VdbeChangeP5(v, (u8)nExpr);
if( nExpr ){ if( nExpr ){
sqlite3ReleaseTempRange(pParse, r1, nExpr); sqlite3ReleaseTempRange(pParse, r1, nExpr);
} }
@@ -2243,7 +2244,7 @@ int sqlite3ExprCodeTarget(Parse *pParse, Expr *pExpr, int target){
Expr opCompare; /* The X==Ei expression */ Expr opCompare; /* The X==Ei expression */
Expr cacheX; /* Cached expression X */ Expr cacheX; /* Cached expression X */
Expr *pX; /* The X expression */ 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);
assert((pExpr->pList->nExpr % 2) == 0); assert((pExpr->pList->nExpr % 2) == 0);
@@ -2265,6 +2266,7 @@ int sqlite3ExprCodeTarget(Parse *pParse, Expr *pExpr, int target){
pParse->disableColCache++; pParse->disableColCache++;
for(i=0; i<nExpr; i=i+2){ for(i=0; i<nExpr; i=i+2){
if( pX ){ if( pX ){
assert( pTest!=0 );
opCompare.pRight = aListelem[i].pExpr; opCompare.pRight = aListelem[i].pExpr;
}else{ }else{
pTest = aListelem[i].pExpr; pTest = aListelem[i].pExpr;

View File

@@ -16,7 +16,7 @@
** sqliteRegisterBuildinFunctions() found at the bottom of the file. ** sqliteRegisterBuildinFunctions() found at the bottom of the file.
** All other code has file scope. ** 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 "sqliteInt.h"
#include <ctype.h> #include <ctype.h>
@@ -212,10 +212,10 @@ static void substrFunc(
for(z2=z; *z2 && p2; p2--){ for(z2=z; *z2 && p2; p2--){
SQLITE_SKIP_UTF8(z2); 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{ }else{
if( p2<0 ) p2 = 0; 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); sqlite3_result_error_toobig(context);
z = 0; z = 0;
}else{ }else{
z = sqlite3Malloc(nByte); z = sqlite3Malloc((int)nByte);
if( !z && nByte>0 ){ if( !z && nByte>0 ){
sqlite3_result_error_nomem(context); sqlite3_result_error_nomem(context);
} }
@@ -276,7 +276,7 @@ static void upperFunc(sqlite3_context *context, int argc, sqlite3_value **argv){
if( z1 ){ if( z1 ){
memcpy(z1, z2, n+1); memcpy(z1, z2, n+1);
for(i=0; z1[i]; i++){ 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); 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 ){ if( z1 ){
memcpy(z1, z2, n+1); memcpy(z1, z2, n+1);
for(i=0; z1[i]; i++){ 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); sqlite3_result_text(context, z1, -1, sqlite3_free);
} }
@@ -788,7 +788,7 @@ static void zeroblobFunc(
if( n>SQLITE_MAX_LENGTH ){ if( n>SQLITE_MAX_LENGTH ){
sqlite3_result_error_toobig(context); sqlite3_result_error_toobig(context);
}else{ }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 nIn; /* Number of bytes in input */
int flags; /* 1: trimleft 2: trimright 3: trim */ int flags; /* 1: trimleft 2: trimright 3: trim */
int i; /* Loop counter */ int i; /* Loop counter */
unsigned char *aLen; /* Length of each character in zCharSet */ unsigned char *aLen = 0; /* Length of each character in zCharSet */
unsigned char **azChar; /* Individual characters in zCharSet */ unsigned char **azChar = 0; /* Individual characters in zCharSet */
int nChar; /* Number of characters in zCharSet */ int nChar; /* Number of characters in zCharSet */
if( sqlite3_value_type(argv[0])==SQLITE_NULL ){ if( sqlite3_value_type(argv[0])==SQLITE_NULL ){
@@ -915,7 +915,7 @@ static void trimFunc(
for(z=zCharSet, nChar=0; *z; nChar++){ for(z=zCharSet, nChar=0; *z; nChar++){
azChar[nChar] = (unsigned char *)z; azChar[nChar] = (unsigned char *)z;
SQLITE_SKIP_UTF8(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)); flags = SQLITE_PTR_TO_INT(sqlite3_user_data(context));
if( flags & 1 ){ if( flags & 1 ){
while( nIn>0 ){ while( nIn>0 ){
int len; int len = 0;
for(i=0; i<nChar; i++){ for(i=0; i<nChar; i++){
len = aLen[i]; len = aLen[i];
if( memcmp(zIn, azChar[i], len)==0 ) break; if( memcmp(zIn, azChar[i], len)==0 ) break;
@@ -935,7 +935,7 @@ static void trimFunc(
} }
if( flags & 2 ){ if( flags & 2 ){
while( nIn>0 ){ while( nIn>0 ){
int len; int len = 0;
for(i=0; i<nChar; i++){ for(i=0; i<nChar; i++){
len = aLen[i]; len = aLen[i];
if( len<=nIn && memcmp(&zIn[nIn-len],azChar[i],len)==0 ) break; 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; p->rSum += v;
if( (p->approx|p->overflow)==0 ){ if( (p->approx|p->overflow)==0 ){
i64 iNewSum = p->iSum + v; i64 iNewSum = p->iSum + v;
int s1 = p->iSum >> (sizeof(i64)*8-1); int s1 = (int)(p->iSum >> (sizeof(i64)*8-1));
int s2 = v >> (sizeof(i64)*8-1); int s2 = (int)(v >> (sizeof(i64)*8-1));
int s3 = iNewSum >> (sizeof(i64)*8-1); int s3 = (int)(iNewSum >> (sizeof(i64)*8-1));
p->overflow = (s1&s2&~s3) | (~s1&~s2&s3); p->overflow = ((s1&s2&~s3) | (~s1&~s2&s3))?1:0;
p->iSum = iNewSum; p->iSum = iNewSum;
} }
}else{ }else{
@@ -1251,7 +1251,7 @@ void sqlite3RegisterBuiltinFunctions(sqlite3 *db){
/* /*
** Set the LIKEOPT flag on the 2-argument function with the given name. ** 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; FuncDef *pDef;
pDef = sqlite3FindFunction(db, zName, sqlite3Strlen30(zName), pDef = sqlite3FindFunction(db, zName, sqlite3Strlen30(zName),
2, SQLITE_UTF8, 0); 2, SQLITE_UTF8, 0);

View File

@@ -12,7 +12,7 @@
** This file contains C code routines that are called by the parser ** This file contains C code routines that are called by the parser
** to handle INSERT statements in SQLite. ** 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" #include "sqliteInt.h"
@@ -388,14 +388,14 @@ void sqlite3Insert(
int appendFlag = 0; /* True if the insert is likely to be an append */ int appendFlag = 0; /* True if the insert is likely to be an append */
/* Register allocations */ /* 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 regAutoinc = 0; /* Register holding the AUTOINCREMENT counter */
int regRowCount = 0; /* Memory cell used for the row counter */ int regRowCount = 0; /* Memory cell used for the row counter */
int regIns; /* Block of regs holding rowid+data being inserted */ int regIns; /* Block of regs holding rowid+data being inserted */
int regRowid; /* registers holding insert rowid */ int regRowid; /* registers holding insert rowid */
int regData; /* register holding first column to insert */ int regData; /* register holding first column to insert */
int regRecord; /* Holds the assemblied row record */ 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 */ int *aRegIdx = 0; /* One register allocated to each index */
@@ -405,6 +405,7 @@ void sqlite3Insert(
#endif #endif
db = pParse->db; db = pParse->db;
memset(&dest, 0, sizeof(dest));
if( pParse->nErr || db->mallocFailed ){ if( pParse->nErr || db->mallocFailed ){
goto insert_cleanup; goto insert_cleanup;
} }
@@ -1093,7 +1094,8 @@ void sqlite3GenerateConstraintChecks(
Vdbe *v; Vdbe *v;
int nCol; int nCol;
int onError; 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 regData; /* Register containing first data column */
int iCur; int iCur;
Index *pIdx; Index *pIdx;
@@ -1334,7 +1336,7 @@ void sqlite3CompleteInsertion(
Vdbe *v; Vdbe *v;
int nIdx; int nIdx;
Index *pIdx; Index *pIdx;
int pik_flags; u8 pik_flags;
int regData; int regData;
int regRec; int regRec;

View File

@@ -14,7 +14,7 @@
** other files are for internal use by SQLite and should not be ** other files are for internal use by SQLite and should not be
** accessed by users of the library. ** 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 "sqliteInt.h"
#include <ctype.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.pStart = pStart;
db->lookaside.pFree = 0; db->lookaside.pFree = 0;
db->lookaside.sz = sz; db->lookaside.sz = (u16)sz;
db->lookaside.bMalloced = pBuf==0; db->lookaside.bMalloced = pBuf==0 ?1:0;
if( pStart ){ if( pStart ){
int i; int i;
LookasideSlot *p; LookasideSlot *p;
@@ -920,7 +920,7 @@ int sqlite3CreateFunc(
** is being overridden/deleted but there are no active VMs, allow the ** is being overridden/deleted but there are no active VMs, allow the
** operation to continue but invalidate all precompiled statements. ** 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( p && p->iPrefEnc==enc && p->nArg==nArg ){
if( db->activeVdbeCnt ){ if( db->activeVdbeCnt ){
sqlite3Error(db, SQLITE_BUSY, 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); assert(p || db->mallocFailed);
if( !p ){ if( !p ){
return SQLITE_NOMEM; return SQLITE_NOMEM;
@@ -942,7 +942,7 @@ int sqlite3CreateFunc(
p->xStep = xStep; p->xStep = xStep;
p->xFinalize = xFinal; p->xFinalize = xFinal;
p->pUserData = pUserData; p->pUserData = pUserData;
p->nArg = nArg; p->nArg = (u16)nArg;
return SQLITE_OK; return SQLITE_OK;
} }
@@ -1365,7 +1365,7 @@ static int createCollation(
pColl->xCmp = xCompare; pColl->xCmp = xCompare;
pColl->pUser = pCtx; pColl->pUser = pCtx;
pColl->xDel = xDel; pColl->xDel = xDel;
pColl->enc = enc2 | (enc & SQLITE_UTF16_ALIGNED); pColl->enc = (u8)(enc2 | (enc & SQLITE_UTF16_ALIGNED));
} }
sqlite3Error(db, SQLITE_OK, 0); sqlite3Error(db, SQLITE_OK, 0);
return SQLITE_OK; return SQLITE_OK;

View File

@@ -12,7 +12,7 @@
** **
** Memory allocation functions used throughout sqlite. ** 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 "sqliteInt.h"
#include <stdarg.h> #include <stdarg.h>
@@ -50,7 +50,7 @@ void sqlite3_soft_heap_limit(int n){
}else{ }else{
sqlite3MemoryAlarm(0, 0, 0); sqlite3MemoryAlarm(0, 0, 0);
} }
overage = sqlite3_memory_used() - n; overage = (int)(sqlite3_memory_used() - (i64)n);
if( overage>0 ){ if( overage>0 ){
sqlite3_release_memory(overage); sqlite3_release_memory(overage);
} }
@@ -385,7 +385,7 @@ void sqlite3ScratchFree(void *p){
} }
}else{ }else{
int i; int i;
i = (u8 *)p - (u8 *)sqlite3GlobalConfig.pScratch; i = (int)((u8*)p - (u8*)sqlite3GlobalConfig.pScratch);
i /= sqlite3GlobalConfig.szScratch; i /= sqlite3GlobalConfig.szScratch;
assert( i>=0 && i<sqlite3GlobalConfig.nScratch ); assert( i>=0 && i<sqlite3GlobalConfig.nScratch );
sqlite3_mutex_enter(mem0.mutex); sqlite3_mutex_enter(mem0.mutex);

View File

@@ -17,7 +17,7 @@
** This file contains implementations of the low-level memory allocation ** This file contains implementations of the low-level memory allocation
** routines specified in the sqlite3_mem_methods object. ** 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" #include "sqliteInt.h"
@@ -96,7 +96,7 @@ static int sqlite3MemSize(void *pPrior){
if( pPrior==0 ) return 0; if( pPrior==0 ) return 0;
p = (sqlite3_int64*)pPrior; p = (sqlite3_int64*)pPrior;
p--; p--;
return p[0]; return (int)p[0];
} }
/* /*

View File

@@ -14,7 +14,7 @@
** The in-memory rollback journal is used to journal transactions for ** The in-memory rollback journal is used to journal transactions for
** ":memory:" databases and when the journal_mode=MEMORY pragma is used. ** ":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" #include "sqliteInt.h"
@@ -91,7 +91,7 @@ static int memjrnlRead(
pChunk = p->readpoint.pChunk; pChunk = p->readpoint.pChunk;
} }
iChunkOffset = (iOfst%JOURNAL_CHUNKSIZE); iChunkOffset = (int)(iOfst%JOURNAL_CHUNKSIZE);
do { do {
int iSpace = JOURNAL_CHUNKSIZE - iChunkOffset; int iSpace = JOURNAL_CHUNKSIZE - iChunkOffset;
int nCopy = MIN(nRead, (JOURNAL_CHUNKSIZE - iChunkOffset)); int nCopy = MIN(nRead, (JOURNAL_CHUNKSIZE - iChunkOffset));
@@ -127,7 +127,7 @@ static int memjrnlWrite(
while( nWrite>0 ){ while( nWrite>0 ){
FileChunk *pChunk = p->endpoint.pChunk; 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); int iSpace = MIN(nWrite, JOURNAL_CHUNKSIZE - iChunkOffset);
if( iChunkOffset==0 ){ if( iChunkOffset==0 ){

View File

@@ -12,7 +12,7 @@
** **
** This file contains code that is specific to windows. ** 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" #include "sqliteInt.h"
#if SQLITE_OS_WIN /* This file is used for windows only */ #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 */ int amt, /* Number of bytes to read */
sqlite3_int64 offset /* Begin reading at this offset */ sqlite3_int64 offset /* Begin reading at this offset */
){ ){
LONG upperBits = (offset>>32) & 0x7fffffff; LONG upperBits = (LONG)((offset>>32) & 0x7fffffff);
LONG lowerBits = offset & 0xffffffff; LONG lowerBits = (LONG)(offset & 0xffffffff);
DWORD rc; DWORD rc;
DWORD got; DWORD got;
winFile *pFile = (winFile*)id; winFile *pFile = (winFile*)id;
@@ -682,8 +682,8 @@ static int winWrite(
int amt, /* Number of bytes to write */ int amt, /* Number of bytes to write */
sqlite3_int64 offset /* Offset into the file to begin writing at */ sqlite3_int64 offset /* Offset into the file to begin writing at */
){ ){
LONG upperBits = (offset>>32) & 0x7fffffff; LONG upperBits = (LONG)((offset>>32) & 0x7fffffff);
LONG lowerBits = offset & 0xffffffff; LONG lowerBits = (LONG)(offset & 0xffffffff);
DWORD rc; DWORD rc;
DWORD wrote = 0; DWORD wrote = 0;
winFile *pFile = (winFile*)id; winFile *pFile = (winFile*)id;
@@ -715,8 +715,8 @@ static int winWrite(
*/ */
static int winTruncate(sqlite3_file *id, sqlite3_int64 nByte){ static int winTruncate(sqlite3_file *id, sqlite3_int64 nByte){
DWORD rc; DWORD rc;
LONG upperBits = (nByte>>32) & 0x7fffffff; LONG upperBits = (LONG)((nByte>>32) & 0x7fffffff);
LONG lowerBits = nByte & 0xffffffff; LONG lowerBits = (LONG)(nByte & 0xffffffff);
winFile *pFile = (winFile*)id; winFile *pFile = (winFile*)id;
OSTRACE3("TRUNCATE %d %lld\n", pFile->h, nByte); OSTRACE3("TRUNCATE %d %lld\n", pFile->h, nByte);
SimulateIOError(return SQLITE_IOERR_TRUNCATE); SimulateIOError(return SQLITE_IOERR_TRUNCATE);
@@ -804,7 +804,7 @@ static int getReadLock(winFile *pFile){
}else{ }else{
int lk; int lk;
sqlite3_randomness(sizeof(lk), &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); res = LockFile(pFile->h, SHARED_FIRST+pFile->sharedLockByte, 0, 1, 0);
#endif #endif
} }
@@ -957,7 +957,7 @@ static int winLock(sqlite3_file *id, int locktype){
locktype, newLocktype); locktype, newLocktype);
rc = SQLITE_BUSY; rc = SQLITE_BUSY;
} }
pFile->locktype = newLocktype; pFile->locktype = (u8)newLocktype;
return rc; return rc;
} }
@@ -1022,7 +1022,7 @@ static int winUnlock(sqlite3_file *id, int locktype){
if( type>=PENDING_LOCK ){ if( type>=PENDING_LOCK ){
UnlockFile(pFile->h, PENDING_BYTE, 0, 1, 0); UnlockFile(pFile->h, PENDING_BYTE, 0, 1, 0);
} }
pFile->locktype = locktype; pFile->locktype = (u8)locktype;
return rc; return rc;
} }
@@ -1437,7 +1437,7 @@ static int winFullPathname(
int nFull, /* Size of output buffer in bytes */ int nFull, /* Size of output buffer in bytes */
char *zFull /* Output buffer */ char *zFull /* Output buffer */
){ ){
#if defined(__CYGWIN__) #if defined(__CYGWIN__)
cygwin_conv_to_full_win32_path(zRelative, zFull); cygwin_conv_to_full_win32_path(zRelative, zFull);
return SQLITE_OK; return SQLITE_OK;
@@ -1507,6 +1507,7 @@ static int winFullPathname(
static void *winDlOpen(sqlite3_vfs *pVfs, const char *zFilename){ static void *winDlOpen(sqlite3_vfs *pVfs, const char *zFilename){
HANDLE h; HANDLE h;
void *zConverted = convertUtf8Filename(zFilename); void *zConverted = convertUtf8Filename(zFilename);
UNUSED_PARAMETER(pVfs);
if( zConverted==0 ){ if( zConverted==0 ){
return 0; return 0;
} }
@@ -1525,9 +1526,11 @@ static void *winDlOpen(sqlite3_vfs *pVfs, const char *zFilename){
return (void*)h; return (void*)h;
} }
static void winDlError(sqlite3_vfs *pVfs, int nBuf, char *zBufOut){ static void winDlError(sqlite3_vfs *pVfs, int nBuf, char *zBufOut){
UNUSED_PARAMETER(pVfs);
getLastErrorMsg(nBuf, zBufOut); getLastErrorMsg(nBuf, zBufOut);
} }
void (*winDlSym(sqlite3_vfs *pVfs, void *pHandle, const char *zSymbol))(void){ void (*winDlSym(sqlite3_vfs *pVfs, void *pHandle, const char *zSymbol))(void){
UNUSED_PARAMETER(pVfs);
#if SQLITE_OS_WINCE #if SQLITE_OS_WINCE
/* The GetProcAddressA() routine is only available on wince. */ /* The GetProcAddressA() routine is only available on wince. */
return (void(*)(void))GetProcAddressA((HANDLE)pHandle, zSymbol); return (void(*)(void))GetProcAddressA((HANDLE)pHandle, zSymbol);
@@ -1538,6 +1541,7 @@ void (*winDlSym(sqlite3_vfs *pVfs, void *pHandle, const char *zSymbol))(void){
#endif #endif
} }
void winDlClose(sqlite3_vfs *pVfs, void *pHandle){ void winDlClose(sqlite3_vfs *pVfs, void *pHandle){
UNUSED_PARAMETER(pVfs);
FreeLibrary((HANDLE)pHandle); FreeLibrary((HANDLE)pHandle);
} }
#else /* if SQLITE_OMIT_LOAD_EXTENSION is defined: */ #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){ static int winSleep(sqlite3_vfs *pVfs, int microsec){
Sleep((microsec+999)/1000); Sleep((microsec+999)/1000);
UNUSED_PARAMETER(pVfs);
return ((microsec+999)/1000)*1000; return ((microsec+999)/1000)*1000;
} }
@@ -1622,6 +1627,7 @@ int winCurrentTime(sqlite3_vfs *pVfs, double *prNow){
#else #else
GetSystemTimeAsFileTime( &ft ); GetSystemTimeAsFileTime( &ft );
#endif #endif
UNUSED_PARAMETER(pVfs);
now = ((double)ft.dwHighDateTime) * 4294967296.0; now = ((double)ft.dwHighDateTime) * 4294967296.0;
*prNow = (now + ft.dwLowDateTime)/864000000000.0 + 2305813.5; *prNow = (now + ft.dwLowDateTime)/864000000000.0 + 2305813.5;
#ifdef SQLITE_TEST #ifdef SQLITE_TEST
@@ -1663,6 +1669,7 @@ int winCurrentTime(sqlite3_vfs *pVfs, double *prNow){
** sqlite3_errmsg(), possibly making IO errors easier to debug. ** sqlite3_errmsg(), possibly making IO errors easier to debug.
*/ */
static int winGetLastError(sqlite3_vfs *pVfs, int nBuf, char *zBuf){ static int winGetLastError(sqlite3_vfs *pVfs, int nBuf, char *zBuf){
UNUSED_PARAMETER(pVfs);
return getLastErrorMsg(nBuf, zBuf); return getLastErrorMsg(nBuf, zBuf);
} }

View File

@@ -18,7 +18,7 @@
** file simultaneously, or one process from reading the database while ** file simultaneously, or one process from reading the database while
** another is writing. ** 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 #ifndef SQLITE_OMIT_DISKIO
#include "sqliteInt.h" #include "sqliteInt.h"
@@ -4160,7 +4160,7 @@ int sqlite3PagerLockingMode(Pager *pPager, int eMode){
assert( PAGER_LOCKINGMODE_QUERY<0 ); assert( PAGER_LOCKINGMODE_QUERY<0 );
assert( PAGER_LOCKINGMODE_NORMAL>=0 && PAGER_LOCKINGMODE_EXCLUSIVE>=0 ); assert( PAGER_LOCKINGMODE_NORMAL>=0 && PAGER_LOCKINGMODE_EXCLUSIVE>=0 );
if( eMode>=0 && !pPager->tempFile ){ if( eMode>=0 && !pPager->tempFile ){
pPager->exclusiveMode = eMode; pPager->exclusiveMode = (u8)eMode;
} }
return (int)pPager->exclusiveMode; return (int)pPager->exclusiveMode;
} }
@@ -4190,7 +4190,7 @@ int sqlite3PagerJournalMode(Pager *pPager, int eMode){
|| eMode==PAGER_JOURNALMODE_MEMORY ); || eMode==PAGER_JOURNALMODE_MEMORY );
assert( PAGER_JOURNALMODE_QUERY<0 ); assert( PAGER_JOURNALMODE_QUERY<0 );
if( eMode>=0 ){ if( eMode>=0 ){
pPager->journalMode = eMode; pPager->journalMode = (u8)eMode;
}else{ }else{
assert( eMode==PAGER_JOURNALMODE_QUERY ); assert( eMode==PAGER_JOURNALMODE_QUERY );
} }

View File

@@ -11,7 +11,7 @@
************************************************************************* *************************************************************************
** Internal interface definitions for SQLite. ** 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_ #ifndef _SQLITEINT_H_
#define _SQLITEINT_H_ #define _SQLITEINT_H_
@@ -2354,8 +2354,8 @@ int sqlite3Utf8Read(const u8*, const u8*, const u8**);
*/ */
int sqlite3PutVarint(unsigned char*, u64); int sqlite3PutVarint(unsigned char*, u64);
int sqlite3PutVarint32(unsigned char*, u32); int sqlite3PutVarint32(unsigned char*, u32);
int sqlite3GetVarint(const unsigned char *, u64 *); u8 sqlite3GetVarint(const unsigned char *, u64 *);
int sqlite3GetVarint32(const unsigned char *, u32 *); u8 sqlite3GetVarint32(const unsigned char *, u32 *);
int sqlite3VarintLen(u64 v); int sqlite3VarintLen(u64 v);
/* /*
@@ -2375,8 +2375,8 @@ int sqlite3VarintLen(u64 v);
** x = putVarint32( A, B ); ** x = putVarint32( A, B );
** **
*/ */
#define getVarint32(A,B) ((*(A)<(unsigned char)0x80) ? ((B) = (u32)*(A)),1 : sqlite3GetVarint32((A), (u32 *)&(B))) #define getVarint32(A,B) (u8)((*(A)<(u8)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 putVarint32(A,B) (u8)(((u32)(B)<(u32)0x80) ? (*(A) = (unsigned char)(B)),1 : sqlite3PutVarint32((A), (B)))
#define getVarint sqlite3GetVarint #define getVarint sqlite3GetVarint
#define putVarint sqlite3PutVarint #define putVarint sqlite3PutVarint

View File

@@ -14,7 +14,7 @@
** This file contains functions for allocating memory, comparing ** This file contains functions for allocating memory, comparing
** strings, and stuff like that. ** 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 "sqliteInt.h"
#include <stdarg.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]. ** 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. ** 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; u32 a,b,s;
a = *p; 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 ** single-byte case. All code should use the MACRO version as
** this function assumes the single-byte case has already been handled. ** 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; u32 a,b;
a = *p; a = *p;
@@ -780,7 +780,7 @@ int sqlite3GetVarint32(const unsigned char *p, u32 *v){
** value. */ ** value. */
{ {
u64 v64; u64 v64;
int n; u8 n;
p -= 4; p -= 4;
n = sqlite3GetVarint(p, &v64); n = sqlite3GetVarint(p, &v64);