Fix a compiler warning when SQLITE_DIRECT_OVERFLOW_READ is defined.

Minor performance enhancement and size reduction.

FossilOrigin-Name: 96385dc460545807a5c8fcf6280a971700f84866
This commit is contained in:
drh 2014-03-31 23:57:41 +00:00
parent e4529c5724
commit 4c417181c2
4 changed files with 19 additions and 14 deletions

View File

@ -1,5 +1,5 @@
C Merge\sin\sthe\slatest\schanges\sand\sfixes\sfrom\strunk. C Fix\sa\scompiler\swarning\swhen\sSQLITE_DIRECT_OVERFLOW_READ\sis\sdefined.\nMinor\sperformance\senhancement\sand\ssize\sreduction.
D 2014-03-31T22:03:32.269 D 2014-03-31T23:57:41.627
F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f
F Makefile.in 2ef13430cd359f7b361bb863504e227b25cc7f81 F Makefile.in 2ef13430cd359f7b361bb863504e227b25cc7f81
F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23
@ -164,9 +164,9 @@ F src/auth.c 523da7fb4979469955d822ff9298352d6b31de34
F src/backup.c a729e63cf5cd1829507cb7b8e89f99b95141bb53 F src/backup.c a729e63cf5cd1829507cb7b8e89f99b95141bb53
F src/bitvec.c 19a4ba637bd85f8f63fc8c9bae5ade9fb05ec1cb F src/bitvec.c 19a4ba637bd85f8f63fc8c9bae5ade9fb05ec1cb
F src/btmutex.c 976f45a12e37293e32cae0281b15a21d48a8aaa7 F src/btmutex.c 976f45a12e37293e32cae0281b15a21d48a8aaa7
F src/btree.c 33338d61b912b5219fc5b466db8e0d7385c0b18b F src/btree.c b1d6309d6623f4ea8d9466aebd1ec84adc40cb9b
F src/btree.h d79306df4ed9181b48916737fe8871a4392c4594 F src/btree.h d79306df4ed9181b48916737fe8871a4392c4594
F src/btreeInt.h d1784d1e17d08d29e890190dbb9836fa64573381 F src/btreeInt.h cf180d86b2e9e418f638d65baa425c4c69c0e0e3
F src/build.c 0d50ef95aad63f4c4fc47f3fa2670d4557c45db0 F src/build.c 0d50ef95aad63f4c4fc47f3fa2670d4557c45db0
F src/callback.c 174e3c8656bc29f91d710ab61550d16eea34be98 F src/callback.c 174e3c8656bc29f91d710ab61550d16eea34be98
F src/complete.c dc1d136c0feee03c2f7550bafc0d29075e36deac F src/complete.c dc1d136c0feee03c2f7550bafc0d29075e36deac
@ -1159,7 +1159,7 @@ F tool/vdbe_profile.tcl 67746953071a9f8f2f668b73fe899074e2c6d8c1
F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4 F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4
F tool/warnings.sh d1a6de74685f360ab718efda6265994b99bbea01 F tool/warnings.sh d1a6de74685f360ab718efda6265994b99bbea01
F tool/win/sqlite.vsix 030f3eeaf2cb811a3692ab9c14d021a75ce41fff F tool/win/sqlite.vsix 030f3eeaf2cb811a3692ab9c14d021a75ce41fff
P d8e1f75ddf10f3c0b21acd5455f90fdcea54a948 b3296267fb67b9f59719a37093253062edde3746 P f6211540c9d66a08dc580dd733e4f4a98968ae30
R 6014daa58aba2f75bf5f17a4d16cbf23 R a9646e8cad6830bc030ac01ef7720050
U drh U drh
Z 6a8ee270f5925545ed8c5f82edf09850 Z be4271c513a3efe06acb17f300ec9933

View File

@ -1 +1 @@
f6211540c9d66a08dc580dd733e4f4a98968ae30 96385dc460545807a5c8fcf6280a971700f84866

View File

@ -3633,7 +3633,8 @@ static int btreeCursor(
pCur->pKeyInfo = pKeyInfo; pCur->pKeyInfo = pKeyInfo;
pCur->pBtree = p; pCur->pBtree = p;
pCur->pBt = pBt; pCur->pBt = pBt;
pCur->curFlags = wrFlag ? BTCF_WriteFlag : 0; assert( wrFlag==0 || wrFlag==BTCF_WriteFlag );
pCur->curFlags = wrFlag;
pCur->pNext = pBt->pCursor; pCur->pNext = pBt->pCursor;
if( pCur->pNext ){ if( pCur->pNext ){
pCur->pNext->pPrev = pCur; pCur->pNext->pPrev = pCur;
@ -3965,7 +3966,9 @@ static int accessPayload(
int iIdx = 0; int iIdx = 0;
MemPage *pPage = pCur->apPage[pCur->iPage]; /* Btree page of current entry */ MemPage *pPage = pCur->apPage[pCur->iPage]; /* Btree page of current entry */
BtShared *pBt = pCur->pBt; /* Btree this cursor belongs to */ BtShared *pBt = pCur->pBt; /* Btree this cursor belongs to */
int bEnd; /* True if reading to end of data */ #ifdef SQLITE_DIRECT_OVERFLOW_READ
int bEnd; /* True if reading to end of data */
#endif
assert( pPage ); assert( pPage );
assert( pCur->eState==CURSOR_VALID ); assert( pCur->eState==CURSOR_VALID );
@ -3975,7 +3978,9 @@ static int accessPayload(
getCellInfo(pCur); getCellInfo(pCur);
aPayload = pCur->info.pCell + pCur->info.nHeader; aPayload = pCur->info.pCell + pCur->info.nHeader;
nKey = (pPage->intKey ? 0 : (int)pCur->info.nKey); nKey = (pPage->intKey ? 0 : (int)pCur->info.nKey);
#ifdef SQLITE_DIRECT_OVERFLOW_READ
bEnd = (offset+amt==nKey+pCur->info.nData); bEnd = (offset+amt==nKey+pCur->info.nData);
#endif
if( NEVER(offset+amt > nKey+pCur->info.nData) if( NEVER(offset+amt > nKey+pCur->info.nData)
|| &aPayload[pCur->info.nLocal] > &pPage->aData[pBt->usableSize] || &aPayload[pCur->info.nLocal] > &pPage->aData[pBt->usableSize]

View File

@ -514,10 +514,10 @@ struct BtCursor {
/* /*
** Legal values for BtCursor.curFlags ** Legal values for BtCursor.curFlags
*/ */
#define BTCF_ValidNKey 0x01 /* True if info.nKey is valid */ #define BTCF_WriteFlag 0x01 /* True if a write cursor */
#define BTCF_ValidOvfl 0x02 /* True if aOverflow is valid */ #define BTCF_ValidNKey 0x02 /* True if info.nKey is valid */
#define BTCF_AtLast 0x04 /* Cursor is pointing ot the last entry */ #define BTCF_ValidOvfl 0x04 /* True if aOverflow is valid */
#define BTCF_WriteFlag 0x08 /* True if a write cursor */ #define BTCF_AtLast 0x08 /* Cursor is pointing ot the last entry */
#define BTCF_Incrblob 0x10 /* True if an incremental I/O handle */ #define BTCF_Incrblob 0x10 /* True if an incremental I/O handle */
/* /*