From: mistachkin Date: Wed, 14 Sep 2011 18:19:08 +0000 (+0000) Subject: Remove 'const' from a variable that might actually be written when an OOM error occur... X-Git-Tag: version-3.7.8~13 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=0fe5f95c7ffd39599b27918927eb424e63fd36ee;p=thirdparty%2Fsqlite.git Remove 'const' from a variable that might actually be written when an OOM error occurs. Also, fix a couple MSVC/Win32 compiler warnings. FossilOrigin-Name: 3035dc1c7398791d550f4c02774ef7f961b4bb02 --- diff --git a/manifest b/manifest index 81dc60c3f8..bccc5fe4dc 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Remove\sunused\sparameters\sfrom\sinternal\sroutines\sin\svdbesort.c.\s\sThis\sis\nan\sadditional\ssimplification\smade\spossible\sby\srecent\soptimizations. -D 2011-09-14T13:41:40.399 +C Remove\s'const'\sfrom\sa\svariable\sthat\smight\sactually\sbe\swritten\swhen\san\sOOM\serror\soccurs.\sAlso,\sfix\sa\scouple\sMSVC/Win32\scompiler\swarnings. +D 2011-09-14T18:19:08.529 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f F Makefile.in d314143fa6be24828021d3f583ad37d9afdce505 F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 @@ -124,7 +124,7 @@ F src/auth.c 523da7fb4979469955d822ff9298352d6b31de34 F src/backup.c 28a4fe55327ff708bfaf9d4326d02686f7a553c3 F src/bitvec.c af50f1c8c0ff54d6bdb7a80e2fceca5a93670bef F src/btmutex.c 976f45a12e37293e32cae0281b15a21d48a8aaa7 -F src/btree.c 4cb13cf019d1978b62494b970d20e9555211094b +F src/btree.c 77b09c69d4849a90361e6fe5db36d167f20600c0 F src/btree.h f5d775cd6cfc7ac32a2535b70e8d2af48ef5f2ce F src/btreeInt.h 67978c014fa4f7cc874032dd3aacadd8db656bc3 F src/build.c 851e81f26a75abbb98bd99a7c5f10e8670d867bb @@ -242,10 +242,10 @@ F src/vdbe.c 7008edbf8f608d82c035dcb1c56367ad85e68aaa F src/vdbe.h a10b360bf69474babc8aba8fcc64b824c5e97d38 F src/vdbeInt.h 693d6ac6810298fc6b4c503cfbe3f99a240f40af F src/vdbeapi.c 11dc47987abacb76ad016dcf5abc0dc422482a98 -F src/vdbeaux.c 079d37d4afac8359b2bbbf4af9876be04cc857b8 +F src/vdbeaux.c ca8aa399e1be85fe82498b107128297a5d84e6a2 F src/vdbeblob.c f024f0bf420f36b070143c32b15cc7287341ffd3 F src/vdbemem.c 5e6effb96dd53d233361cbfaa3f0a43b9af689e9 -F src/vdbesort.c 8dd9c1acd9b0ff4ed384b577313dd95e9f291be6 +F src/vdbesort.c 468d43c057063e54da4f1988b38b4f46d60e7790 F src/vdbetrace.c 5d0dc3d5fd54878cc8d6d28eb41deb8d5885b114 F src/vtab.c 901791a47318c0562cd0c676a2c6ff1bc530e582 F src/wal.c 3154756177d6219e233d84291d5b05f4e06ff5e9 @@ -961,7 +961,7 @@ F tool/symbols.sh caaf6ccc7300fd43353318b44524853e222557d5 F tool/tostr.awk e75472c2f98dd76e06b8c9c1367f4ab07e122d06 F tool/vdbe-compress.tcl d70ea6d8a19e3571d7ab8c9b75cba86d1173ff0f F tool/warnings.sh b7fdb2cc525f5ef4fa43c80e771636dd3690f9d2 -P 607aba6cd7020973200fa376cf8df55360165266 -R 173f2a8d2f899d9b1ff888e1ca0ea270 -U drh -Z 7f74dee362473d34447e67caba8f3e87 +P a1f3aeeb0988c848d40ce8f6da6e902935a997e2 +R 0af9d8f0b3f18e81a71e0aa10948427c +U mistachkin +Z d90e2842f2c20a0f3227a4c8a539b329 diff --git a/manifest.uuid b/manifest.uuid index 7f6ae00cf5..c741eb7da4 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -a1f3aeeb0988c848d40ce8f6da6e902935a997e2 \ No newline at end of file +3035dc1c7398791d550f4c02774ef7f961b4bb02 \ No newline at end of file diff --git a/src/btree.c b/src/btree.c index 130673cdcf..7e6e02f144 100644 --- a/src/btree.c +++ b/src/btree.c @@ -664,7 +664,7 @@ static int btreeMoveto( pCur->pKeyInfo, aSpace, sizeof(aSpace), &pFree ); if( pIdxKey==0 ) return SQLITE_NOMEM; - sqlite3VdbeRecordUnpack(pCur->pKeyInfo, nKey, pKey, pIdxKey); + sqlite3VdbeRecordUnpack(pCur->pKeyInfo, (int)nKey, pKey, pIdxKey); }else{ pIdxKey = 0; } diff --git a/src/vdbeaux.c b/src/vdbeaux.c index 02fadabd87..b00768477e 100644 --- a/src/vdbeaux.c +++ b/src/vdbeaux.c @@ -837,7 +837,7 @@ void sqlite3VdbeNoopComment(Vdbe *p, const char *zFormat, ...){ VdbeOp *sqlite3VdbeGetOp(Vdbe *p, int addr){ /* C89 specifies that the constant "dummy" will be initialized to all ** zeros, which is correct. MSVC generates a warning, nevertheless. */ - static const VdbeOp dummy; /* Ignore the MSVC warning about no initializer */ + static VdbeOp dummy; /* Ignore the MSVC warning about no initializer */ assert( p->magic==VDBE_MAGIC_INIT ); if( addr<0 ){ #ifdef SQLITE_OMIT_TRACE diff --git a/src/vdbesort.c b/src/vdbesort.c index 671c50e66a..c44999705b 100644 --- a/src/vdbesort.c +++ b/src/vdbesort.c @@ -160,8 +160,12 @@ static int vdbeSorterIterNext( int nRec = 0; /* Size of record in bytes */ int iOff = 0; /* Size of serialized size varint in bytes */ - nRead = pIter->iEof - pIter->iReadOff; - if( nRead>5 ) nRead = 5; + assert( pIter->iEof>=pIter->iReadOff ); + if( pIter->iEof-pIter->iReadOff>5 ){ + nRead = 5; + }else{ + nRead = (int)(pIter->iEof - pIter->iReadOff); + } if( nRead<=0 ){ /* This is an EOF condition */ vdbeSorterIterZero(db, pIter);