1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-08-08 14:02:16 +03:00

Fix an issue with the new sqlite3Strlen30() introduced by

check-in (6007).  Additional casts for compiler warnings. (CVS 6011)

FossilOrigin-Name: 258722b6178f60eaccef1675aab3edc456d413a5
This commit is contained in:
drh
2008-12-10 22:15:00 +00:00
parent 1bd10f8a00
commit 4f21c4af30
9 changed files with 98 additions and 88 deletions

View File

@@ -1,5 +1,5 @@
C Additional\swork\sat\seliminating\ssilly\scompiler\swarnings.\s(CVS\s6010) C Fix\san\sissue\swith\sthe\snew\ssqlite3Strlen30()\sintroduced\sby\ncheck-in\s(6007).\s\sAdditional\scasts\sfor\scompiler\swarnings.\s(CVS\s6011)
D 2008-12-10T21:19:57 D 2008-12-10T22:15:00
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
@@ -139,27 +139,27 @@ 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 d7a12403025a69a358974ba7504562b109fd403b F src/os_win.c d7a12403025a69a358974ba7504562b109fd403b
F src/pager.c ef93fb79ab794a0109784a2018f23127c53dd74a F src/pager.c 7e8c2b7b7131031cfa88ab0fdbb2de047f5be934
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
F src/pcache.h f20c3e82dd6da622c3fe296170cb1801f9a2d75a F src/pcache.h f20c3e82dd6da622c3fe296170cb1801f9a2d75a
F src/pcache1.c 533b18aa2456b0f135e376289443e0a342e0c456 F src/pcache1.c 533b18aa2456b0f135e376289443e0a342e0c456
F src/pragma.c ad7c6eef96b599c6d0e9b2ae9a1a6a3e66108211 F src/pragma.c c77ac9952d0a273de003e40cac0278af31e8d5f5
F src/prepare.c 51d11eb1eece7548038e7e33c33ee95dc7f82e2d F src/prepare.c 51d11eb1eece7548038e7e33c33ee95dc7f82e2d
F src/printf.c 9866a9a9c4a90f6d4147407f373df3fd5d5f9b6f F src/printf.c 9866a9a9c4a90f6d4147407f373df3fd5d5f9b6f
F src/random.c 676b9d7ac820fe81e6fb2394ac8c10cff7f38628 F src/random.c 676b9d7ac820fe81e6fb2394ac8c10cff7f38628
F src/resolve.c 18dc9f0df1d60048e012ce6632251063e0dd356a F src/resolve.c 18dc9f0df1d60048e012ce6632251063e0dd356a
F src/rowset.c 2256fa4a928f750e2f3d6fc733523034beceb1d6 F src/rowset.c 2256fa4a928f750e2f3d6fc733523034beceb1d6
F src/select.c 49296e1abf019b965f04a6dc5ff9fafa3ae46396 F src/select.c a4316c5e8a417687e159b3d3ae689363d1dec5df
F src/shell.c 793aaebd8024896c58ded47414fe688fb8b1ef6d F src/shell.c 4b9c41beb71733c4ed04f3c7b3abd8baa6701da6
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 a1478d1ec40bca0b511c06e2b4c93dc932aa3426 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
F src/tclsqlite.c 63fcca6796db7dc0a5f65da953cf548cdc559c72 F src/tclsqlite.c 6613acae9fe805a6d0fa666a254f90ff9da6e174
F src/test1.c 30986773b10d75904f21bae5c3e8e8b9f20fa479 F src/test1.c 30986773b10d75904f21bae5c3e8e8b9f20fa479
F src/test2.c 897528183edf2839c2a3c991d415905db56f1240 F src/test2.c 897528183edf2839c2a3c991d415905db56f1240
F src/test3.c 88a246b56b824275300e6c899634fbac1dc94b14 F src/test3.c 88a246b56b824275300e6c899634fbac1dc94b14
@@ -190,9 +190,9 @@ F src/test_thread.c d74fc445e0dba0e00806117eb449b307c0b146bf
F src/test_wsd.c c297d7d6b8a990239e1bd25935e81d612d8ae31d F src/test_wsd.c c297d7d6b8a990239e1bd25935e81d612d8ae31d
F src/tokenize.c aaa5fa6a4536a9dd7c855a3f66f32508f1612138 F src/tokenize.c aaa5fa6a4536a9dd7c855a3f66f32508f1612138
F src/trigger.c 5a669d8fc9197db393ff85fa95ec882282162bb5 F src/trigger.c 5a669d8fc9197db393ff85fa95ec882282162bb5
F src/update.c 3e022c24e265b0975e51f2ec0348ef84eeaba311 F src/update.c 080889d241e4dcd1c545c8051eb6de86f4939295
F src/utf.c 7bc90bc7d1a0239f876e2c2ce573e9b103aedcd4 F src/utf.c 7bc90bc7d1a0239f876e2c2ce573e9b103aedcd4
F src/util.c 27f60e2b0ab2734a35e961879366f3420465c89d F src/util.c ea62608f66f33a7e8322de83024ae37c415c0c7f
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 b7dd05b403e69caca814ccd8824130f176160cd5 P ea01d43788a75e39c7f03c22681d1a338d52cf0e
R 5bd6d4daa43f7acc541261f54e444525 R fc82d5cdc1b4a29bb39788188873773b
U drh U drh
Z ac7cc71d687c854ae8b6ca4ac780169f Z 42ed0cd2a4ed59138c8dcec9deb5038f

View File

@@ -1 +1 @@
ea01d43788a75e39c7f03c22681d1a338d52cf0e 258722b6178f60eaccef1675aab3edc456d413a5

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.513 2008/12/10 21:19:57 drh Exp $ ** @(#) $Id: pager.c,v 1.514 2008/12/10 22:15:00 drh Exp $
*/ */
#ifndef SQLITE_OMIT_DISKIO #ifndef SQLITE_OMIT_DISKIO
#include "sqliteInt.h" #include "sqliteInt.h"
@@ -760,7 +760,7 @@ static int readJournalHdr(
&& iPageSize<=SQLITE_MAX_PAGE_SIZE && iPageSize<=SQLITE_MAX_PAGE_SIZE
&& ((iPageSize-1)&iPageSize)==0 && ((iPageSize-1)&iPageSize)==0
){ ){
u16 pagesize = iPageSize; u16 pagesize = (u16)iPageSize;
rc = sqlite3PagerSetPagesize(pPager, &pagesize); rc = sqlite3PagerSetPagesize(pPager, &pagesize);
} }
if( rc ) return rc; if( rc ) return rc;
@@ -1247,13 +1247,13 @@ static int pager_delmaster(Pager *pPager, const char *zMaster){
/* Load the entire master journal file into space obtained from /* Load the entire master journal file into space obtained from
** sqlite3_malloc() and pointed to by zMasterJournal. ** sqlite3_malloc() and pointed to by zMasterJournal.
*/ */
zMasterJournal = (char *)sqlite3Malloc(nMasterJournal + nMasterPtr); zMasterJournal = (char *)sqlite3Malloc((int)nMasterJournal + nMasterPtr);
if( !zMasterJournal ){ if( !zMasterJournal ){
rc = SQLITE_NOMEM; rc = SQLITE_NOMEM;
goto delmaster_out; goto delmaster_out;
} }
zMasterPtr = &zMasterJournal[nMasterJournal]; zMasterPtr = &zMasterJournal[nMasterJournal];
rc = sqlite3OsRead(pMaster, zMasterJournal, nMasterJournal, 0); rc = sqlite3OsRead(pMaster, zMasterJournal, (int)nMasterJournal, 0);
if( rc!=SQLITE_OK ) goto delmaster_out; if( rc!=SQLITE_OK ) goto delmaster_out;
zJournal = zMasterJournal; zJournal = zMasterJournal;
@@ -1476,7 +1476,7 @@ static int pager_playback(Pager *pPager, int isHot){
*/ */
if( nRec==0xffffffff ){ if( nRec==0xffffffff ){
assert( pPager->journalOff==JOURNAL_HDR_SZ(pPager) ); assert( pPager->journalOff==JOURNAL_HDR_SZ(pPager) );
nRec = (szJ - JOURNAL_HDR_SZ(pPager))/JOURNAL_PG_SZ(pPager); nRec = (int)((szJ - JOURNAL_HDR_SZ(pPager))/JOURNAL_PG_SZ(pPager));
} }
/* If nRec is 0 and this rollback is of a transaction created by this /* If nRec is 0 and this rollback is of a transaction created by this
@@ -1489,7 +1489,7 @@ static int pager_playback(Pager *pPager, int isHot){
*/ */
if( nRec==0 && !isHot && if( nRec==0 && !isHot &&
pPager->journalHdr+JOURNAL_HDR_SZ(pPager)==pPager->journalOff ){ pPager->journalHdr+JOURNAL_HDR_SZ(pPager)==pPager->journalOff ){
nRec = (szJ - pPager->journalOff) / JOURNAL_PG_SZ(pPager); nRec = (int)((szJ - pPager->journalOff) / JOURNAL_PG_SZ(pPager));
} }
/* If this is the first header read from the journal, truncate the /* If this is the first header read from the journal, truncate the
@@ -1613,7 +1613,7 @@ static int pager_stmt_playback(Pager *pPager){
** of the first journal header written during this statement transaction. ** of the first journal header written during this statement transaction.
*/ */
pPager->journalOff = pPager->stmtJSize; pPager->journalOff = pPager->stmtJSize;
pPager->cksumInit = pPager->stmtCksum; pPager->cksumInit = (int)(pPager->stmtCksum & 0xffffffff);
while( pPager->journalOff < hdrOff ){ while( pPager->journalOff < hdrOff ){
rc = pager_playback_one_page(pPager, pPager->jfd, pPager->journalOff, 1); rc = pager_playback_one_page(pPager, pPager->jfd, pPager->journalOff, 1);
assert( rc!=SQLITE_DONE ); assert( rc!=SQLITE_DONE );
@@ -1629,7 +1629,7 @@ static int pager_stmt_playback(Pager *pPager){
goto end_stmt_playback; goto end_stmt_playback;
} }
if( nJRec==0 ){ if( nJRec==0 ){
nJRec = (szJ - pPager->journalOff) / (pPager->pageSize+8); nJRec = (int)((szJ - pPager->journalOff) / (pPager->pageSize+8));
} }
for(i=nJRec-1; i>=0 && pPager->journalOff < szJ; i--){ for(i=nJRec-1; i>=0 && pPager->journalOff < szJ; i--){
rc = pager_playback_one_page(pPager, pPager->jfd, pPager->journalOff, 1); rc = pager_playback_one_page(pPager, pPager->jfd, pPager->journalOff, 1);
@@ -1683,8 +1683,8 @@ void sqlite3PagerSetCachesize(Pager *pPager, int mxPage){
*/ */
#ifndef SQLITE_OMIT_PAGER_PRAGMAS #ifndef SQLITE_OMIT_PAGER_PRAGMAS
void sqlite3PagerSetSafetyLevel(Pager *pPager, int level, int bFullFsync){ void sqlite3PagerSetSafetyLevel(Pager *pPager, int level, int bFullFsync){
pPager->noSync = level==1 || pPager->tempFile; pPager->noSync = (level==1 || pPager->tempFile) ?1:0;
pPager->fullSync = level==3 && !pPager->tempFile; pPager->fullSync = (level==3 && !pPager->tempFile) ?1:0;
pPager->sync_flags = (bFullFsync?SQLITE_SYNC_FULL:SQLITE_SYNC_NORMAL); pPager->sync_flags = (bFullFsync?SQLITE_SYNC_FULL:SQLITE_SYNC_NORMAL);
if( pPager->noSync ) pPager->needSync = 0; if( pPager->noSync ) pPager->needSync = 0;
} }
@@ -1916,12 +1916,12 @@ int sqlite3PagerOpen(
} }
/* pPager->journalOpen = 0; */ /* pPager->journalOpen = 0; */
pPager->useJournal = useJournal; pPager->useJournal = (u8)useJournal;
pPager->noReadlock = noReadlock && readOnly; pPager->noReadlock = (noReadlock && readOnly) ?1:0;
/* pPager->stmtOpen = 0; */ /* pPager->stmtOpen = 0; */
/* pPager->stmtInUse = 0; */ /* pPager->stmtInUse = 0; */
/* pPager->nRef = 0; */ /* pPager->nRef = 0; */
pPager->dbSizeValid = memDb; pPager->dbSizeValid = (u8)memDb;
pPager->pageSize = szPageDflt; pPager->pageSize = szPageDflt;
/* pPager->stmtSize = 0; */ /* pPager->stmtSize = 0; */
/* pPager->stmtJSize = 0; */ /* pPager->stmtJSize = 0; */
@@ -1931,16 +1931,16 @@ int sqlite3PagerOpen(
/* pPager->state = PAGER_UNLOCK; */ /* pPager->state = PAGER_UNLOCK; */
assert( pPager->state == (tempFile ? PAGER_EXCLUSIVE : PAGER_UNLOCK) ); assert( pPager->state == (tempFile ? PAGER_EXCLUSIVE : PAGER_UNLOCK) );
/* pPager->errMask = 0; */ /* pPager->errMask = 0; */
pPager->tempFile = tempFile; pPager->tempFile = (u8)tempFile;
assert( tempFile==PAGER_LOCKINGMODE_NORMAL assert( tempFile==PAGER_LOCKINGMODE_NORMAL
|| tempFile==PAGER_LOCKINGMODE_EXCLUSIVE ); || tempFile==PAGER_LOCKINGMODE_EXCLUSIVE );
assert( PAGER_LOCKINGMODE_EXCLUSIVE==1 ); assert( PAGER_LOCKINGMODE_EXCLUSIVE==1 );
pPager->exclusiveMode = tempFile; pPager->exclusiveMode = (u8)tempFile;
pPager->memDb = memDb; pPager->memDb = (u8)memDb;
pPager->readOnly = readOnly; pPager->readOnly = (u8)readOnly;
/* pPager->needSync = 0; */ /* pPager->needSync = 0; */
pPager->noSync = pPager->tempFile || !useJournal; pPager->noSync = (pPager->tempFile || !useJournal) ?1:0;
pPager->fullSync = (pPager->noSync?0:1); pPager->fullSync = pPager->noSync ?0:1;
pPager->sync_flags = SQLITE_SYNC_NORMAL; pPager->sync_flags = SQLITE_SYNC_NORMAL;
/* pPager->pFirst = 0; */ /* pPager->pFirst = 0; */
/* pPager->pFirstSynced = 0; */ /* pPager->pFirstSynced = 0; */
@@ -2008,7 +2008,7 @@ int sqlite3PagerSetPagesize(Pager *pPager, u16 *pPageSize){
sqlite3PcacheSetPageSize(pPager->pPCache, pageSize); sqlite3PcacheSetPageSize(pPager->pPCache, pageSize);
} }
} }
*pPageSize = pPager->pageSize; *pPageSize = (u16)pPager->pageSize;
} }
return rc; return rc;
} }
@@ -2120,7 +2120,7 @@ int sqlite3PagerPagecount(Pager *pPager, int *pnPage){
n /= pPager->pageSize; n /= pPager->pageSize;
} }
if( pPager->state!=PAGER_UNLOCK ){ if( pPager->state!=PAGER_UNLOCK ){
pPager->dbSize = n; pPager->dbSize = (int)n;
pPager->dbSizeValid = 1; pPager->dbSizeValid = 1;
} }
} }
@@ -2128,10 +2128,10 @@ int sqlite3PagerPagecount(Pager *pPager, int *pnPage){
n++; n++;
} }
if( n>pPager->mxPgno ){ if( n>pPager->mxPgno ){
pPager->mxPgno = n; pPager->mxPgno = (Pgno)n;
} }
if( pnPage ){ if( pnPage ){
*pnPage = n; *pnPage = (int)n;
} }
return SQLITE_OK; return SQLITE_OK;
} }
@@ -2183,7 +2183,7 @@ static int pager_wait_on_lock(Pager *pPager, int locktype){
rc = sqlite3OsLock(pPager->fd, locktype); rc = sqlite3OsLock(pPager->fd, locktype);
}while( rc==SQLITE_BUSY && pPager->xBusyHandler(pPager->pBusyHandlerArg) ); }while( rc==SQLITE_BUSY && pPager->xBusyHandler(pPager->pBusyHandlerArg) );
if( rc==SQLITE_OK ){ if( rc==SQLITE_OK ){
pPager->state = locktype; pPager->state = (u8)locktype;
IOTRACE(("LOCK %p %d\n", pPager, locktype)) IOTRACE(("LOCK %p %d\n", pPager, locktype))
} }
} }
@@ -2594,7 +2594,7 @@ static int pagerSharedLock(Pager *pPager){
if( pPager->state==PAGER_UNLOCK || isErrorReset ){ if( pPager->state==PAGER_UNLOCK || isErrorReset ){
sqlite3_vfs *pVfs = pPager->pVfs; sqlite3_vfs *pVfs = pPager->pVfs;
int isHotJournal; int isHotJournal = 0;
assert( !MEMDB ); assert( !MEMDB );
assert( sqlite3PcacheRefCount(pPager->pPCache)==0 ); assert( sqlite3PcacheRefCount(pPager->pPCache)==0 );
if( !pPager->noReadlock ){ if( !pPager->noReadlock ){

View File

@@ -11,7 +11,7 @@
************************************************************************* *************************************************************************
** This file contains code used to implement the PRAGMA command. ** This file contains code used to implement the PRAGMA command.
** **
** $Id: pragma.c,v 1.197 2008/12/10 19:26:24 drh Exp $ ** $Id: pragma.c,v 1.198 2008/12/10 22:15:00 drh Exp $
*/ */
#include "sqliteInt.h" #include "sqliteInt.h"
#include <ctype.h> #include <ctype.h>
@@ -30,7 +30,7 @@
** to support legacy SQL code. The safety level used to be boolean ** to support legacy SQL code. The safety level used to be boolean
** and older scripts may have used numbers 0 for OFF and 1 for ON. ** and older scripts may have used numbers 0 for OFF and 1 for ON.
*/ */
static int getSafetyLevel(const char *z){ static u8 getSafetyLevel(const char *z){
/* 123456789 123456789 */ /* 123456789 123456789 */
static const char zText[] = "onoffalseyestruefull"; static const char zText[] = "onoffalseyestruefull";
static const u8 iOffset[] = {0, 1, 2, 4, 9, 12, 16}; static const u8 iOffset[] = {0, 1, 2, 4, 9, 12, 16};
@@ -52,7 +52,7 @@ static int getSafetyLevel(const char *z){
/* /*
** Interpret the given string as a boolean value. ** Interpret the given string as a boolean value.
*/ */
static int getBoolean(const char *z){ static u8 getBoolean(const char *z){
return getSafetyLevel(z)&1; return getSafetyLevel(z)&1;
} }
@@ -80,7 +80,7 @@ static int getAutoVacuum(const char *z){
if( 0==sqlite3StrICmp(z, "full") ) return BTREE_AUTOVACUUM_FULL; if( 0==sqlite3StrICmp(z, "full") ) return BTREE_AUTOVACUUM_FULL;
if( 0==sqlite3StrICmp(z, "incremental") ) return BTREE_AUTOVACUUM_INCR; if( 0==sqlite3StrICmp(z, "incremental") ) return BTREE_AUTOVACUUM_INCR;
i = atoi(z); i = atoi(z);
return ((i>=0&&i<=2)?i:0); return (u8)((i>=0&&i<=2)?i:0);
} }
#endif /* ifndef SQLITE_OMIT_AUTOVACUUM */ #endif /* ifndef SQLITE_OMIT_AUTOVACUUM */
@@ -137,7 +137,7 @@ static int changeTempStorage(Parse *pParse, const char *zStorageType){
if( invalidateTempStorage( pParse ) != SQLITE_OK ){ if( invalidateTempStorage( pParse ) != SQLITE_OK ){
return SQLITE_ERROR; return SQLITE_ERROR;
} }
db->temp_store = ts; db->temp_store = (u8)ts;
return SQLITE_OK; return SQLITE_OK;
} }
#endif /* SQLITE_PAGER_PRAGMAS */ #endif /* SQLITE_PAGER_PRAGMAS */
@@ -435,7 +435,7 @@ void sqlite3Pragma(
pPager = sqlite3BtreePager(db->aDb[ii].pBt); pPager = sqlite3BtreePager(db->aDb[ii].pBt);
sqlite3PagerLockingMode(pPager, eMode); sqlite3PagerLockingMode(pPager, eMode);
} }
db->dfltLockMode = eMode; db->dfltLockMode = (u8)eMode;
} }
pPager = sqlite3BtreePager(pDb->pBt); pPager = sqlite3BtreePager(pDb->pBt);
eMode = sqlite3PagerLockingMode(pPager, eMode); eMode = sqlite3PagerLockingMode(pPager, eMode);
@@ -495,7 +495,7 @@ void sqlite3Pragma(
sqlite3PagerJournalMode(pPager, eMode); sqlite3PagerJournalMode(pPager, eMode);
} }
} }
db->dfltJournalMode = eMode; db->dfltJournalMode = (u8)eMode;
} }
pPager = sqlite3BtreePager(pDb->pBt); pPager = sqlite3BtreePager(pDb->pBt);
eMode = sqlite3PagerJournalMode(pPager, eMode); eMode = sqlite3PagerJournalMode(pPager, eMode);
@@ -552,7 +552,7 @@ void sqlite3Pragma(
returnSingleInt(pParse, "auto_vacuum", auto_vacuum); returnSingleInt(pParse, "auto_vacuum", auto_vacuum);
}else{ }else{
int eAuto = getAutoVacuum(zRight); int eAuto = getAutoVacuum(zRight);
db->nextAutovac = eAuto; db->nextAutovac = (u8)eAuto;
if( eAuto>=0 ){ if( eAuto>=0 ){
/* Call SetAutoVacuum() to set initialize the internal auto and /* Call SetAutoVacuum() to set initialize the internal auto and
** incr-vacuum flags. This is required in case this connection ** incr-vacuum flags. This is required in case this connection
@@ -1063,7 +1063,7 @@ void sqlite3Pragma(
/* Do the b-tree integrity checks */ /* Do the b-tree integrity checks */
sqlite3VdbeAddOp3(v, OP_IntegrityCk, 2, cnt, 1); sqlite3VdbeAddOp3(v, OP_IntegrityCk, 2, cnt, 1);
sqlite3VdbeChangeP5(v, i); sqlite3VdbeChangeP5(v, (u8)i);
addr = sqlite3VdbeAddOp1(v, OP_IsNull, 2); addr = sqlite3VdbeAddOp1(v, OP_IsNull, 2);
sqlite3VdbeAddOp4(v, OP_String8, 0, 3, 0, sqlite3VdbeAddOp4(v, OP_String8, 0, 3, 0,
sqlite3MPrintf(db, "*** in database %s ***\n", db->aDb[i].zName), sqlite3MPrintf(db, "*** in database %s ***\n", db->aDb[i].zName),

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 SELECT statements in SQLite. ** to handle SELECT statements in SQLite.
** **
** $Id: select.c,v 1.493 2008/12/10 19:26:24 drh Exp $ ** $Id: select.c,v 1.494 2008/12/10 22:15:00 drh Exp $
*/ */
#include "sqliteInt.h" #include "sqliteInt.h"
@@ -2922,7 +2922,7 @@ static int flattenSubquery(
** 2. There is a single expression in the result set, and it is ** 2. There is a single expression in the result set, and it is
** either min(x) or max(x), where x is a column reference. ** either min(x) or max(x), where x is a column reference.
*/ */
static int minMaxQuery(Select *p){ static u8 minMaxQuery(Select *p){
Expr *pExpr; Expr *pExpr;
ExprList *pEList = p->pEList; ExprList *pEList = p->pEList;

View File

@@ -12,7 +12,7 @@
** This file contains code to implement the "sqlite" command line ** This file contains code to implement the "sqlite" command line
** utility for accessing SQLite databases. ** utility for accessing SQLite databases.
** **
** $Id: shell.c,v 1.192 2008/12/10 19:26:24 drh Exp $ ** $Id: shell.c,v 1.193 2008/12/10 22:15:00 drh Exp $
*/ */
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
@@ -366,7 +366,7 @@ static const char *modeDescr[] = {
** Compute a string length that is limited to what can be stored in ** Compute a string length that is limited to what can be stored in
** lower 30 bits of a 32-bit signed integer. ** lower 30 bits of a 32-bit signed integer.
*/ */
int sqlite3Strlen30(const char *z){ static int strlen30(const char *z){
const char *z2 = z; const char *z2 = z;
while( *z2 ){ z2++; } while( *z2 ){ z2++; }
return 0x3fffffff & (int)(z2 - z); return 0x3fffffff & (int)(z2 - z);
@@ -487,7 +487,7 @@ static void output_csv(struct callback_data *p, const char *z, int bSep){
fprintf(out,"%s",p->nullvalue); fprintf(out,"%s",p->nullvalue);
}else{ }else{
int i; int i;
int nSep = sqlite3Strlen30(p->separator); int nSep = strlen30(p->separator);
for(i=0; z[i]; i++){ for(i=0; z[i]; i++){
if( needCsvQuote[((unsigned char*)z)[i]] if( needCsvQuote[((unsigned char*)z)[i]]
|| (z[i]==p->separator[0] && || (z[i]==p->separator[0] &&
@@ -535,7 +535,7 @@ static int callback(void *pArg, int nArg, char **azArg, char **azCol){
int w = 5; int w = 5;
if( azArg==0 ) break; if( azArg==0 ) break;
for(i=0; i<nArg; i++){ for(i=0; i<nArg; i++){
int len = sqlite3Strlen30(azCol[i] ? azCol[i] : ""); int len = strlen30(azCol[i] ? azCol[i] : "");
if( len>w ) w = len; if( len>w ) w = len;
} }
if( p->cnt++>0 ) fprintf(p->out,"\n"); if( p->cnt++>0 ) fprintf(p->out,"\n");
@@ -556,9 +556,9 @@ static int callback(void *pArg, int nArg, char **azArg, char **azCol){
w = 0; w = 0;
} }
if( w<=0 ){ if( w<=0 ){
w = sqlite3Strlen30(azCol[i] ? azCol[i] : ""); w = strlen30(azCol[i] ? azCol[i] : "");
if( w<10 ) w = 10; if( w<10 ) w = 10;
n = sqlite3Strlen30(azArg && azArg[i] ? azArg[i] : p->nullvalue); n = strlen30(azArg && azArg[i] ? azArg[i] : p->nullvalue);
if( w<n ) w = n; if( w<n ) w = n;
} }
if( i<ArraySize(p->actualWidth) ){ if( i<ArraySize(p->actualWidth) ){
@@ -591,8 +591,8 @@ static int callback(void *pArg, int nArg, char **azArg, char **azCol){
w = 10; w = 10;
} }
if( p->mode==MODE_Explain && azArg[i] && if( p->mode==MODE_Explain && azArg[i] &&
sqlite3Strlen30(azArg[i])>w ){ strlen30(azArg[i])>w ){
w = sqlite3Strlen30(azArg[i]); w = strlen30(azArg[i]);
} }
fprintf(p->out,"%-*.*s%s",w,w, fprintf(p->out,"%-*.*s%s",w,w,
azArg[i] ? azArg[i] : p->nullvalue, i==nArg-1 ? "\n": " "); azArg[i] ? azArg[i] : p->nullvalue, i==nArg-1 ? "\n": " ");
@@ -739,8 +739,8 @@ static void set_table_name(struct callback_data *p, const char *zName){
static char *appendText(char *zIn, char const *zAppend, char quote){ static char *appendText(char *zIn, char const *zAppend, char quote){
int len; int len;
int i; int i;
int nAppend = sqlite3Strlen30(zAppend); int nAppend = strlen30(zAppend);
int nIn = (zIn?sqlite3Strlen30(zIn):0); int nIn = (zIn?strlen30(zIn):0);
len = nAppend+nIn+1; len = nAppend+nIn+1;
if( quote ){ if( quote ){
@@ -907,7 +907,7 @@ static int run_schema_dump_query(
rc = sqlite3_exec(p->db, zQuery, dump_callback, p, pzErrMsg); rc = sqlite3_exec(p->db, zQuery, dump_callback, p, pzErrMsg);
if( rc==SQLITE_CORRUPT ){ if( rc==SQLITE_CORRUPT ){
char *zQ2; char *zQ2;
int len = sqlite3Strlen30(zQuery); int len = strlen30(zQuery);
if( pzErrMsg ) sqlite3_free(*pzErrMsg); if( pzErrMsg ) sqlite3_free(*pzErrMsg);
zQ2 = malloc( len+100 ); zQ2 = malloc( len+100 );
if( zQ2==0 ) return rc; if( zQ2==0 ) return rc;
@@ -1081,7 +1081,7 @@ static int do_meta_command(char *zLine, struct callback_data *p){
/* Process the input line. /* Process the input line.
*/ */
if( nArg==0 ) return rc; if( nArg==0 ) return rc;
n = sqlite3Strlen30(azArg[0]); n = strlen30(azArg[0]);
c = azArg[0][0]; c = azArg[0][0];
if( c=='b' && n>1 && strncmp(azArg[0], "bail", n)==0 && nArg>1 ){ if( c=='b' && n>1 && strncmp(azArg[0], "bail", n)==0 && nArg>1 ){
bail_on_error = booleanValue(azArg[1]); bail_on_error = booleanValue(azArg[1]);
@@ -1219,14 +1219,14 @@ static int do_meta_command(char *zLine, struct callback_data *p){
int lineno = 0; /* Line number of input file */ int lineno = 0; /* Line number of input file */
open_db(p); open_db(p);
nSep = sqlite3Strlen30(p->separator); nSep = strlen30(p->separator);
if( nSep==0 ){ if( nSep==0 ){
fprintf(stderr, "non-null separator required for import\n"); fprintf(stderr, "non-null separator required for import\n");
return 0; return 0;
} }
zSql = sqlite3_mprintf("SELECT * FROM '%q'", zTable); zSql = sqlite3_mprintf("SELECT * FROM '%q'", zTable);
if( zSql==0 ) return 0; if( zSql==0 ) return 0;
nByte = sqlite3Strlen30(zSql); nByte = strlen30(zSql);
rc = sqlite3_prepare(p->db, zSql, -1, &pStmt, 0); rc = sqlite3_prepare(p->db, zSql, -1, &pStmt, 0);
sqlite3_free(zSql); sqlite3_free(zSql);
if( rc ){ if( rc ){
@@ -1241,7 +1241,7 @@ static int do_meta_command(char *zLine, struct callback_data *p){
zSql = malloc( nByte + 20 + nCol*2 ); zSql = malloc( nByte + 20 + nCol*2 );
if( zSql==0 ) return 0; if( zSql==0 ) return 0;
sqlite3_snprintf(nByte+20, zSql, "INSERT INTO '%q' VALUES(?", zTable); sqlite3_snprintf(nByte+20, zSql, "INSERT INTO '%q' VALUES(?", zTable);
j = sqlite3Strlen30(zSql); j = strlen30(zSql);
for(i=1; i<nCol; i++){ for(i=1; i<nCol; i++){
zSql[j++] = ','; zSql[j++] = ',';
zSql[j++] = '?'; zSql[j++] = '?';
@@ -1374,7 +1374,7 @@ static int do_meta_command(char *zLine, struct callback_data *p){
#endif #endif
if( c=='m' && strncmp(azArg[0], "mode", n)==0 && nArg>=2 ){ if( c=='m' && strncmp(azArg[0], "mode", n)==0 && nArg>=2 ){
int n2 = sqlite3Strlen30(azArg[1]); int n2 = strlen30(azArg[1]);
if( strncmp(azArg[1],"line",n2)==0 if( strncmp(azArg[1],"line",n2)==0
|| ||
strncmp(azArg[1],"lines",n2)==0 ){ strncmp(azArg[1],"lines",n2)==0 ){
@@ -1532,7 +1532,7 @@ static int do_meta_command(char *zLine, struct callback_data *p){
output_c_string(p->out, p->nullvalue); output_c_string(p->out, p->nullvalue);
fprintf(p->out, "\n"); fprintf(p->out, "\n");
fprintf(p->out,"%9.9s: %s\n","output", fprintf(p->out,"%9.9s: %s\n","output",
sqlite3Strlen30(p->outfile) ? p->outfile : "stdout"); strlen30(p->outfile) ? p->outfile : "stdout");
fprintf(p->out,"%9.9s: ", "separator"); fprintf(p->out,"%9.9s: ", "separator");
output_c_string(p->out, p->separator); output_c_string(p->out, p->separator);
fprintf(p->out, "\n"); fprintf(p->out, "\n");
@@ -1581,7 +1581,7 @@ static int do_meta_command(char *zLine, struct callback_data *p){
int nPrintCol, nPrintRow; int nPrintCol, nPrintRow;
for(i=1; i<=nRow; i++){ for(i=1; i<=nRow; i++){
if( azResult[i]==0 ) continue; if( azResult[i]==0 ) continue;
len = sqlite3Strlen30(azResult[i]); len = strlen30(azResult[i]);
if( len>maxlen ) maxlen = len; if( len>maxlen ) maxlen = len;
} }
nPrintCol = 80/(maxlen+2); nPrintCol = 80/(maxlen+2);
@@ -1728,7 +1728,7 @@ static int process_input(struct callback_data *p, FILE *in){
int i; int i;
for(i=0; zLine[i] && isspace((unsigned char)zLine[i]); i++){} for(i=0; zLine[i] && isspace((unsigned char)zLine[i]); i++){}
if( zLine[i]!=0 ){ if( zLine[i]!=0 ){
nSql = sqlite3Strlen30(zLine); nSql = strlen30(zLine);
zSql = malloc( nSql+1 ); zSql = malloc( nSql+1 );
if( zSql==0 ){ if( zSql==0 ){
fprintf(stderr, "out of memory\n"); fprintf(stderr, "out of memory\n");
@@ -1738,7 +1738,7 @@ static int process_input(struct callback_data *p, FILE *in){
startline = lineno; startline = lineno;
} }
}else{ }else{
int len = sqlite3Strlen30(zLine); int len = strlen30(zLine);
zSql = realloc( zSql, nSql + len + 2 ); zSql = realloc( zSql, nSql + len + 2 );
if( zSql==0 ){ if( zSql==0 ){
fprintf(stderr,"%s: out of memory!\n", Argv0); fprintf(stderr,"%s: out of memory!\n", Argv0);
@@ -1825,7 +1825,7 @@ static char *find_home_dir(void){
zDrive = getenv("HOMEDRIVE"); zDrive = getenv("HOMEDRIVE");
zPath = getenv("HOMEPATH"); zPath = getenv("HOMEPATH");
if( zDrive && zPath ){ if( zDrive && zPath ){
n = sqlite3Strlen30(zDrive) + sqlite3Strlen30(zPath) + 1; n = strlen30(zDrive) + strlen30(zPath) + 1;
home_dir = malloc( n ); home_dir = malloc( n );
if( home_dir==0 ) return 0; if( home_dir==0 ) return 0;
sqlite3_snprintf(n, home_dir, "%s%s", zDrive, zPath); sqlite3_snprintf(n, home_dir, "%s%s", zDrive, zPath);
@@ -1838,7 +1838,7 @@ static char *find_home_dir(void){
#endif /* !_WIN32_WCE */ #endif /* !_WIN32_WCE */
if( home_dir ){ if( home_dir ){
int n = sqlite3Strlen30(home_dir) + 1; int n = strlen30(home_dir) + 1;
char *z = malloc( n ); char *z = malloc( n );
if( z ) memcpy(z, home_dir, n); if( z ) memcpy(z, home_dir, n);
home_dir = z; home_dir = z;
@@ -1869,7 +1869,7 @@ static void process_sqliterc(
#endif #endif
return; return;
} }
nBuf = sqlite3Strlen30(home_dir) + 16; nBuf = strlen30(home_dir) + 16;
zBuf = malloc( nBuf ); zBuf = malloc( nBuf );
if( zBuf==0 ){ if( zBuf==0 ){
fprintf(stderr,"%s: out of memory!\n", Argv0); fprintf(stderr,"%s: out of memory!\n", Argv0);
@@ -2093,7 +2093,7 @@ int main(int argc, char **argv){
); );
zHome = find_home_dir(); zHome = find_home_dir();
if( zHome ){ if( zHome ){
nHistory = sqlite3Strlen30(zHome) + 20; nHistory = strlen30(zHome) + 20;
if( (zHistory = malloc(nHistory))!=0 ){ if( (zHistory = malloc(nHistory))!=0 ){
sqlite3_snprintf(nHistory, zHistory,"%s/.sqlite_history", zHome); sqlite3_snprintf(nHistory, zHistory,"%s/.sqlite_history", zHome);
} }

View File

@@ -12,7 +12,7 @@
** A TCL Interface to SQLite. Append this file to sqlite3.c and ** A TCL Interface to SQLite. Append this file to sqlite3.c and
** compile the whole thing to build a TCL-enabled version of SQLite. ** compile the whole thing to build a TCL-enabled version of SQLite.
** **
** $Id: tclsqlite.c,v 1.229 2008/12/10 19:26:24 drh Exp $ ** $Id: tclsqlite.c,v 1.230 2008/12/10 22:15:00 drh Exp $
*/ */
#include "tcl.h" #include "tcl.h"
#include <errno.h> #include <errno.h>
@@ -134,7 +134,7 @@ struct IncrblobChannel {
** Compute a string length that is limited to what can be stored in ** Compute a string length that is limited to what can be stored in
** lower 30 bits of a 32-bit signed integer. ** lower 30 bits of a 32-bit signed integer.
*/ */
int sqlite3Strlen30(const char *z){ static int strlen30(const char *z){
const char *z2 = z; const char *z2 = z;
while( *z2 ){ z2++; } while( *z2 ){ z2++; }
return 0x3fffffff & (int)(z2 - z); return 0x3fffffff & (int)(z2 - z);
@@ -397,7 +397,7 @@ static int safeToUseEvalObjv(Tcl_Interp *interp, Tcl_Obj *pCmd){
static SqlFunc *findSqlFunc(SqliteDb *pDb, const char *zName){ static SqlFunc *findSqlFunc(SqliteDb *pDb, const char *zName){
SqlFunc *p, *pNew; SqlFunc *p, *pNew;
int i; int i;
pNew = (SqlFunc*)Tcl_Alloc( sizeof(*pNew) + sqlite3Strlen30(zName) + 1 ); pNew = (SqlFunc*)Tcl_Alloc( sizeof(*pNew) + strlen30(zName) + 1 );
pNew->zName = (char*)&pNew[1]; pNew->zName = (char*)&pNew[1];
for(i=0; zName[i]; i++){ pNew->zName[i] = tolower(zName[i]); } for(i=0; zName[i]; i++){ pNew->zName[i] = tolower(zName[i]); }
pNew->zName[i] = 0; pNew->zName[i] = 0;
@@ -1352,8 +1352,8 @@ static int DbObjCmd(void *cd, Tcl_Interp *interp, int objc,Tcl_Obj *const*objv){
zConflict = Tcl_GetStringFromObj(objv[2], 0); zConflict = Tcl_GetStringFromObj(objv[2], 0);
zTable = Tcl_GetStringFromObj(objv[3], 0); zTable = Tcl_GetStringFromObj(objv[3], 0);
zFile = Tcl_GetStringFromObj(objv[4], 0); zFile = Tcl_GetStringFromObj(objv[4], 0);
nSep = sqlite3Strlen30(zSep); nSep = strlen30(zSep);
nNull = sqlite3Strlen30(zNull); nNull = strlen30(zNull);
if( nSep==0 ){ if( nSep==0 ){
Tcl_AppendResult(interp,"Error: non-null separator required for copy",0); Tcl_AppendResult(interp,"Error: non-null separator required for copy",0);
return TCL_ERROR; return TCL_ERROR;
@@ -1373,7 +1373,7 @@ static int DbObjCmd(void *cd, Tcl_Interp *interp, int objc,Tcl_Obj *const*objv){
Tcl_AppendResult(interp, "Error: no such table: ", zTable, 0); Tcl_AppendResult(interp, "Error: no such table: ", zTable, 0);
return TCL_ERROR; return TCL_ERROR;
} }
nByte = sqlite3Strlen30(zSql); nByte = strlen30(zSql);
rc = sqlite3_prepare(pDb->db, zSql, -1, &pStmt, 0); rc = sqlite3_prepare(pDb->db, zSql, -1, &pStmt, 0);
sqlite3_free(zSql); sqlite3_free(zSql);
if( rc ){ if( rc ){
@@ -1393,7 +1393,7 @@ static int DbObjCmd(void *cd, Tcl_Interp *interp, int objc,Tcl_Obj *const*objv){
} }
sqlite3_snprintf(nByte+50, zSql, "INSERT OR %q INTO '%q' VALUES(?", sqlite3_snprintf(nByte+50, zSql, "INSERT OR %q INTO '%q' VALUES(?",
zConflict, zTable); zConflict, zTable);
j = sqlite3Strlen30(zSql); j = strlen30(zSql);
for(i=1; i<nCol; i++){ for(i=1; i<nCol; i++){
zSql[j++] = ','; zSql[j++] = ',';
zSql[j++] = '?'; zSql[j++] = '?';
@@ -1438,7 +1438,7 @@ static int DbObjCmd(void *cd, Tcl_Interp *interp, int objc,Tcl_Obj *const*objv){
} }
if( i+1!=nCol ){ if( i+1!=nCol ){
char *zErr; char *zErr;
int nErr = sqlite3Strlen30(zFile) + 200; int nErr = strlen30(zFile) + 200;
zErr = malloc(nErr); zErr = malloc(nErr);
if( zErr ){ if( zErr ){
sqlite3_snprintf(nErr, zErr, sqlite3_snprintf(nErr, zErr,
@@ -1453,7 +1453,7 @@ static int DbObjCmd(void *cd, Tcl_Interp *interp, int objc,Tcl_Obj *const*objv){
for(i=0; i<nCol; i++){ for(i=0; i<nCol; i++){
/* check for null data, if so, bind as null */ /* check for null data, if so, bind as null */
if( (nNull>0 && strcmp(azCol[i], zNull)==0) if( (nNull>0 && strcmp(azCol[i], zNull)==0)
|| sqlite3Strlen30(azCol[i])==0 || strlen30(azCol[i])==0
){ ){
sqlite3_bind_null(pStmt, i+1); sqlite3_bind_null(pStmt, i+1);
}else{ }else{
@@ -1595,7 +1595,7 @@ static int DbObjCmd(void *cd, Tcl_Interp *interp, int objc,Tcl_Obj *const*objv){
** which matches the next sequence of SQL. ** which matches the next sequence of SQL.
*/ */
pStmt = 0; pStmt = 0;
len = sqlite3Strlen30(zSql); len = strlen30(zSql);
for(pPreStmt = pDb->stmtList; pPreStmt; pPreStmt=pPreStmt->pNext){ for(pPreStmt = pDb->stmtList; pPreStmt; pPreStmt=pPreStmt->pNext){
int n = pPreStmt->nSql; int n = pPreStmt->nSql;
if( len>=n if( len>=n
@@ -1848,7 +1848,7 @@ static int DbObjCmd(void *cd, Tcl_Interp *interp, int objc,Tcl_Obj *const*objv){
pPreStmt->pStmt = pStmt; pPreStmt->pStmt = pStmt;
pPreStmt->nSql = len; pPreStmt->nSql = len;
pPreStmt->zSql = sqlite3_sql(pStmt); pPreStmt->zSql = sqlite3_sql(pStmt);
assert( sqlite3Strlen30(pPreStmt->zSql)==len ); assert( strlen30(pPreStmt->zSql)==len );
assert( 0==memcmp(pPreStmt->zSql, zSql, len) ); assert( 0==memcmp(pPreStmt->zSql, zSql, len) );
} }
@@ -1909,7 +1909,7 @@ static int DbObjCmd(void *cd, Tcl_Interp *interp, int objc,Tcl_Obj *const*objv){
int nArg = -1; int nArg = -1;
if( objc==6 ){ if( objc==6 ){
const char *z = Tcl_GetString(objv[3]); const char *z = Tcl_GetString(objv[3]);
int n = sqlite3Strlen30(z); int n = strlen30(z);
if( n>2 && strncmp(z, "-argcount",n)==0 ){ if( n>2 && strncmp(z, "-argcount",n)==0 ){
if( Tcl_GetIntFromObj(interp, objv[4], &nArg) ) return TCL_ERROR; if( Tcl_GetIntFromObj(interp, objv[4], &nArg) ) return TCL_ERROR;
if( nArg<0 ){ if( nArg<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 UPDATE statements. ** to handle UPDATE statements.
** **
** $Id: update.c,v 1.189 2008/12/10 18:03:47 drh Exp $ ** $Id: update.c,v 1.190 2008/12/10 22:15:00 drh Exp $
*/ */
#include "sqliteInt.h" #include "sqliteInt.h"
@@ -124,7 +124,7 @@ void sqlite3Update(
int regOldRowid; /* The old rowid */ int regOldRowid; /* The old rowid */
int regNewRowid; /* The new rowid */ int regNewRowid; /* The new rowid */
int regData; /* New data for the row */ int regData; /* New data for the row */
int regRowSet; /* Rowset of rows to be updated */ int regRowSet = 0; /* Rowset of rows to be updated */
sContext.pParse = 0; sContext.pParse = 0;
db = pParse->db; db = pParse->db;

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.244 2008/12/10 21:19:57 drh Exp $ ** $Id: util.c,v 1.245 2008/12/10 22:15:00 drh Exp $
*/ */
#include "sqliteInt.h" #include "sqliteInt.h"
#include <stdarg.h> #include <stdarg.h>
@@ -50,6 +50,16 @@ int sqlite3IsNaN(double x){
return y!=z; return y!=z;
} }
/*
** Compute a string length that is limited to what can be stored in
** lower 30 bits of a 32-bit signed integer.
*/
int sqlite3Strlen30(const char *z){
const char *z2 = z;
while( *z2 ){ z2++; }
return 0x3fffffff & (int)(z2 - z);
}
/* /*
** Return the length of a string, except do not allow the string length ** Return the length of a string, except do not allow the string length
** to exceed the SQLITE_LIMIT_LENGTH setting. ** to exceed the SQLITE_LIMIT_LENGTH setting.