Fix compiler warnings in where.c and in the TCL test harness. (CVS 5994)

FossilOrigin-Name: 680755dbf01e20569b87068b1515b144903c566e
This commit is contained in:
drh 2008-12-09 01:32:03 +00:00
parent b3190c1501
commit ec1724e888
7 changed files with 44 additions and 41 deletions

View File

@ -1,5 +1,5 @@
C Some\sminor\sname\srefactoring\sin\swhere.c.\s\sAvoid\sdeclaring\svariables\sbefore\ninitializing\sthem\sin\sthe\samalgamation\sbecause\sVC++\sdoesn't\slike\sthat.\s(CVS\s5993)
D 2008-12-08T21:37:15
C Fix\scompiler\swarnings\sin\swhere.c\sand\sin\sthe\sTCL\stest\sharness.\s(CVS\s5994)
D 2008-12-09T01:32:03
F Makefile.arm-wince-mingw32ce-gcc fcd5e9cd67fe88836360bb4f9ef4cb7f8e2fb5a0
F Makefile.in f7e4c81c347b04f7b0f1c1b081a168645d7b8af7
F Makefile.linux-gcc d53183f4aa6a9192d249731c90dbdffbd2c68654
@ -155,7 +155,7 @@ F src/select.c 1d3616e4e48f6c15a0c69bf14bc5423f31624f87
F src/shell.c 484bddeefac9314be18d4a60d401e93848274ee8
F src/sqlite.h.in f13b2f27265b78226240cb0d2e07f165e2110bd9
F src/sqlite3ext.h 1db7d63ab5de4b3e6b83dd03d1a4e64fef6d2a17
F src/sqliteInt.h f97f357ecd3d681b19d1d85e64889d9ecd321781
F src/sqliteInt.h 2f21e46629c5d1371d23e326debbc72099e07b8e
F src/sqliteLimit.h f435e728c6b620ef7312814d660a81f9356eb5c8
F src/status.c 237b193efae0cf6ac3f0817a208de6c6c6ef6d76
F src/table.c 22744786199c9195720c15a7a42cb97b2e2728d8
@ -165,7 +165,7 @@ F src/test2.c 897528183edf2839c2a3c991d415905db56f1240
F src/test3.c 88a246b56b824275300e6c899634fbac1dc94b14
F src/test4.c f79ab52d27ff49b784b631a42e2ccd52cfd5c84c
F src/test5.c 162a1cea2105a2c460a3f39fa6919617b562a288
F src/test6.c 0a0304a69cfa4962a429d084c6d451ff9e4fb572
F src/test6.c 11fc775cced479a169ff1e4be515d61f5ef4869a
F src/test7.c b94e68c2236de76889d82b8d7d8e00ad6a4d80b1
F src/test8.c 3637439424d0d21ff2dcf9b015c30fcc1e7bcb24
F src/test9.c 904ebe0ed1472d6bad17a81e2ecbfc20017dc237
@ -173,14 +173,14 @@ F src/test_async.c 45024094ed7cf780c5d5dccda645145f95cf78ef
F src/test_autoext.c f53b0cdf7bf5f08100009572a5d65cdb540bd0ad
F src/test_btree.c d7b8716544611c323860370ee364e897c861f1b0
F src/test_config.c 4f85387a52f3c7966c3ffab913e988a3830fe1af
F src/test_devsym.c 802d10e65b4217208cb47059b84adf46318bcdf4
F src/test_devsym.c 9f4bc2551e267ce7aeda195f3897d0f30c5228f4
F src/test_func.c a55c4d5479ff2eb5c0a22d4d88e9528ab59c953b
F src/test_hexio.c 2f1122aa3f012fa0142ee3c36ce5c902a70cd12f
F src/test_loadext.c 97dc8800e46a46ed002c2968572656f37e9c0dd9
F src/test_malloc.c 5127337c9fb4c851a7f604c0170e0e5ca1fbfe33
F src/test_md5.c 28209a4e2068711b5443c33104fe41f21d160071
F src/test_mutex.c 66c4ab4e0396a440ddb17cd9b58a05305144f05d
F src/test_onefile.c 243157b10275251c5dc2d6619aee2ff9ae22379c
F src/test_onefile.c fad2e1b589a840002b8f967ae24397c3ec4a090b
F src/test_osinst.c ae29e9c09485622a157849508302dd9ffe44f21f
F src/test_pcache.c 0008968cc36558c8253585e5d321eccba44edb80
F src/test_schema.c 4b4bf7bb329326458c491b0e6facd4c8c4c5b479
@ -203,7 +203,7 @@ F src/vdbeblob.c b0dcebfafedcf9c0addc7901ad98f6f986c08935
F src/vdbemem.c c4da6cee44bbd6e4ecc0129d76330fb16c29d432
F src/vtab.c 02c51eac45dbff1a1d6e73f58febf92ecb563f7f
F src/walker.c 488c2660e13224ff70c0c82761118efb547f8f0d
F src/where.c 538cbf219002ba078dec8203fdb9b5101d46415c
F src/where.c c5a21be6d5705d1c2c6f5d56a97785e4752791d2
F tclinstaller.tcl 4356d9d94d2b5ed5e68f9f0c80c4df3048dd7617
F test/aggerror.test a867e273ef9e3d7919f03ef4f0e8c0d2767944f2
F test/alias.test 597662c5d777a122f9a3df0047ea5c5bd383a911
@ -664,7 +664,7 @@ F tool/speedtest16.c c8a9c793df96db7e4933f0852abb7a03d48f2e81
F tool/speedtest2.tcl ee2149167303ba8e95af97873c575c3e0fab58ff
F tool/speedtest8.c 2902c46588c40b55661e471d7a86e4dd71a18224
F tool/speedtest8inst1.c 293327bc76823f473684d589a8160bde1f52c14e
P 6c0b2e7579ee5504617831a5e8bb6193e283ad30
R 16d93897c611a643e89664ca78d16163
P 6ed696e7c03351514278338fa986539cf0fac178
R 3fe0e70cc904e9db4de6bdfc551815cd
U drh
Z 7c4f110d07988bd3998073bc21e9ea4f
Z d05e416df346cbac719aeceaea0b8d01

View File

@ -1 +1 @@
6ed696e7c03351514278338fa986539cf0fac178
680755dbf01e20569b87068b1515b144903c566e

View File

@ -11,7 +11,7 @@
*************************************************************************
** Internal interface definitions for SQLite.
**
** @(#) $Id: sqliteInt.h,v 1.805 2008/12/08 21:37:15 drh Exp $
** @(#) $Id: sqliteInt.h,v 1.806 2008/12/09 01:32:03 drh Exp $
*/
#ifndef _SQLITEINT_H_
#define _SQLITEINT_H_
@ -1527,7 +1527,8 @@ struct WhereLevel {
int addrNxt; /* Jump here to start the next IN combination */
int addrCont; /* Jump here to continue with the next loop cycle */
int addrFirst; /* First instruction of interior of the loop */
int op, p1, p2, p5; /* Opcode used to terminate the loop */
int op, p1, p2; /* Opcode used to terminate the loop */
u8 p5; /* P5 operand of the opcode that terminates the loop */
int nEq; /* Number of == or IN constraints on this loop */
int nIn; /* Number of IN operators constraining this loop */
struct InLoop {

View File

@ -14,7 +14,7 @@
** the effect on the database file of an OS crash or power failure. This
** is used to test the ability of SQLite to recover from those situations.
**
** $Id: test6.c,v 1.39 2008/06/06 11:11:26 danielk1977 Exp $
** $Id: test6.c,v 1.40 2008/12/09 01:32:03 drh Exp $
*/
#if SQLITE_TEST /* This file is used for testing only */
#include "sqliteInt.h"
@ -606,9 +606,9 @@ static void cfDlError(sqlite3_vfs *pCfVfs, int nByte, char *zErrMsg){
sqlite3_vfs *pVfs = (sqlite3_vfs *)pCfVfs->pAppData;
pVfs->xDlError(pVfs, nByte, zErrMsg);
}
static void *cfDlSym(sqlite3_vfs *pCfVfs, void *pHandle, const char *zSymbol){
static void (*cfDlSym(sqlite3_vfs *pCfVfs, void *pH, const char *zSym))(void){
sqlite3_vfs *pVfs = (sqlite3_vfs *)pCfVfs->pAppData;
return pVfs->xDlSym(pVfs, pHandle, zSymbol);
return pVfs->xDlSym(pVfs, pH, zSym);
}
static void cfDlClose(sqlite3_vfs *pCfVfs, void *pHandle){
sqlite3_vfs *pVfs = (sqlite3_vfs *)pCfVfs->pAppData;

View File

@ -14,7 +14,7 @@
** different device types (by overriding the return values of the
** xDeviceCharacteristics() and xSectorSize() methods).
**
** $Id: test_devsym.c,v 1.8 2008/09/12 10:22:40 danielk1977 Exp $
** $Id: test_devsym.c,v 1.9 2008/12/09 01:32:03 drh Exp $
*/
#if SQLITE_TEST /* This file is used for testing only */
@ -63,7 +63,7 @@ static int devsymFullPathname(sqlite3_vfs*, const char *zName, int, char *zOut);
#ifndef SQLITE_OMIT_LOAD_EXTENSION
static void *devsymDlOpen(sqlite3_vfs*, const char *zFilename);
static void devsymDlError(sqlite3_vfs*, int nByte, char *zErrMsg);
static void *devsymDlSym(sqlite3_vfs*,void*, const char *zSymbol);
static void (*devsymDlSym(sqlite3_vfs*,void*, const char *zSymbol))(void);
static void devsymDlClose(sqlite3_vfs*, void*);
#endif /* SQLITE_OMIT_LOAD_EXTENSION */
static int devsymRandomness(sqlite3_vfs*, int nByte, char *zOut);
@ -300,8 +300,8 @@ static void devsymDlError(sqlite3_vfs *pVfs, int nByte, char *zErrMsg){
/*
** Return a pointer to the symbol zSymbol in the dynamic library pHandle.
*/
static void *devsymDlSym(sqlite3_vfs *pVfs, void *pHandle, const char *zSymbol){
return sqlite3OsDlSym(g.pVfs, pHandle, zSymbol);
static void (*devsymDlSym(sqlite3_vfs *pVfs, void *p, const char *zSym))(void){
return sqlite3OsDlSym(g.pVfs, p, zSym);
}
/*

View File

@ -10,7 +10,7 @@
**
*************************************************************************
**
** $Id: test_onefile.c,v 1.9 2008/06/26 10:54:12 danielk1977 Exp $
** $Id: test_onefile.c,v 1.10 2008/12/09 01:32:03 drh Exp $
**
** OVERVIEW:
**
@ -168,7 +168,7 @@ static int fsAccess(sqlite3_vfs*, const char *zName, int flags, int *);
static int fsFullPathname(sqlite3_vfs*, const char *zName, int nOut,char *zOut);
static void *fsDlOpen(sqlite3_vfs*, const char *zFilename);
static void fsDlError(sqlite3_vfs*, int nByte, char *zErrMsg);
static void *fsDlSym(sqlite3_vfs*,void*, const char *zSymbol);
static void (*fsDlSym(sqlite3_vfs*,void*, const char *zSymbol))(void);
static void fsDlClose(sqlite3_vfs*, void*);
static int fsRandomness(sqlite3_vfs*, int nByte, char *zOut);
static int fsSleep(sqlite3_vfs*, int microseconds);
@ -765,9 +765,9 @@ static void fsDlError(sqlite3_vfs *pVfs, int nByte, char *zErrMsg){
/*
** Return a pointer to the symbol zSymbol in the dynamic library pHandle.
*/
static void *fsDlSym(sqlite3_vfs *pVfs, void *pHandle, const char *zSymbol){
static void (*fsDlSym(sqlite3_vfs *pVfs, void *pH, const char *zSym))(void){
sqlite3_vfs *pParent = ((fs_vfs_t *)pVfs)->pParent;
return pParent->xDlSym(pParent, pHandle, zSymbol);
return pParent->xDlSym(pParent, pH, zSym);
}
/*

View File

@ -16,7 +16,7 @@
** so is applicable. Because this module is responsible for selecting
** indices, you might also think of this module as the "query optimizer".
**
** $Id: where.c,v 1.334 2008/12/08 21:37:16 drh Exp $
** $Id: where.c,v 1.335 2008/12/09 01:32:03 drh Exp $
*/
#include "sqliteInt.h"
@ -80,9 +80,9 @@ typedef struct ExprMaskSet ExprMaskSet;
typedef struct WhereTerm WhereTerm;
struct WhereTerm {
Expr *pExpr; /* Pointer to the subexpression that is this term */
i16 iParent; /* Disable pWC->a[iParent] when this term disabled */
i16 leftCursor; /* Cursor number of X in "X <op> <expr>" */
i16 leftColumn; /* Column number of X in "X <op> <expr>" */
int iParent; /* Disable pWC->a[iParent] when this term disabled */
int leftCursor; /* Cursor number of X in "X <op> <expr>" */
int leftColumn; /* Column number of X in "X <op> <expr>" */
u16 eOperator; /* A WO_xx value describing <op> */
u8 wtFlags; /* TERM_xxx bit flags. See below */
u8 nChild; /* Number of children that must disable us */
@ -110,7 +110,7 @@ struct WhereClause {
int nTerm; /* Number of terms */
int nSlot; /* Number of entries in a[] */
WhereTerm *a; /* Each a[] describes a term of the WHERE cluase */
WhereTerm aStatic[10]; /* Initial static space for a[] */
WhereTerm aStatic[4]; /* Initial static space for a[] */
};
/*
@ -160,6 +160,8 @@ struct ExprMaskSet {
#define WO_ISNULL 0x080
#define WO_OR 0x100
#define WO_ALL 0xfff /* Mask of all possible WO_* values */
/*
** Value for wsFlags returned by bestIndex(). These flags determine which
** search strategies are appropriate.
@ -238,7 +240,7 @@ static void whereClauseClear(WhereClause *pWC){
** calling this routine. Such pointers may be reinitialized by referencing
** the pWC->a[] array.
*/
static int whereClauseInsert(WhereClause *pWC, Expr *p, u16 wtFlags){
static int whereClauseInsert(WhereClause *pWC, Expr *p, u8 wtFlags){
WhereTerm *pTerm;
int idx;
if( pWC->nTerm>=pWC->nSlot ){
@ -430,8 +432,8 @@ static void exprCommute(Parse *pParse, Expr *pExpr){
/*
** Translate from TK_xx operator to WO_xx bitmask.
*/
static int operatorMask(int op){
int c;
static u16 operatorMask(int op){
u16 c;
assert( allowedOp(op) );
if( op==TK_IN ){
c = WO_IN;
@ -440,7 +442,8 @@ static int operatorMask(int op){
}else if( op==TK_OR ){
c = WO_OR;
}else{
c = WO_EQ<<(op-TK_EQ);
assert( (WO_EQ<<(op-TK_EQ)) < 0x7fff );
c = (u16)(WO_EQ<<(op-TK_EQ));
}
assert( op!=TK_ISNULL || c==WO_ISNULL );
assert( op!=TK_OR || c==WO_OR );
@ -464,12 +467,13 @@ static WhereTerm *findTerm(
int iCur, /* Cursor number of LHS */
int iColumn, /* Column number of LHS */
Bitmask notReady, /* RHS must not overlap with this mask */
u16 op, /* Mask of WO_xx values describing operator */
u32 op, /* Mask of WO_xx values describing operator */
Index *pIdx /* Must be compatible with this index, if not NULL */
){
WhereTerm *pTerm;
int k;
assert( iCur>=0 );
op &= WO_ALL;
for(pTerm=pWC->a, k=pWC->nTerm; k; k--, pTerm++){
if( pTerm->leftCursor==iCur
&& (pTerm->prereqRight & notReady)==0
@ -1297,7 +1301,6 @@ static double bestVirtualIndex(
*/
pIdxInfo = *ppIdxInfo;
if( pIdxInfo==0 ){
WhereTerm *pTerm;
int nTerm;
WHERETRACE(("Recomputing index info for %s...\n", pTab->zName));
@ -1361,7 +1364,7 @@ static double bestVirtualIndex(
if( pTerm->eOperator & (WO_IN|WO_ISNULL) ) continue;
pIdxCons[j].iColumn = pTerm->leftColumn;
pIdxCons[j].iTermOffset = i;
pIdxCons[j].op = pTerm->eOperator;
pIdxCons[j].op = (u8)pTerm->eOperator;
/* The direct assignment in the previous line is possible only because
** the WO_ and SQLITE_INDEX_CONSTRAINT_ codes are identical. The
** following asserts verify this fact. */
@ -1427,7 +1430,7 @@ static double bestVirtualIndex(
for(i=0; i<pIdxInfo->nConstraint; i++, pIdxCons++){
j = pIdxCons->iTermOffset;
pTerm = &pWC->a[j];
pIdxCons->usable = (pTerm->prereqRight & notReady)==0;
pIdxCons->usable = (pTerm->prereqRight & notReady)==0 ?1:0;
}
memset(pUsage, 0, sizeof(pUsage[0])*pIdxInfo->nConstraint);
if( pIdxInfo->needToFreeIdxStr ){
@ -2411,7 +2414,6 @@ WhereInfo *sqlite3WhereBegin(
/* Case 0: The table is a virtual-table. Use the VFilter and VNext
** to access the data.
*/
int j;
int iReg; /* P3 Value for OP_VFilter */
sqlite3_index_info *pBestIdx = pLevel->pBestIdx;
int nConstraint = pBestIdx->nConstraint;
@ -2423,7 +2425,6 @@ WhereInfo *sqlite3WhereBegin(
iReg = sqlite3GetTempRange(pParse, nConstraint+2);
pParse->disableColCache++;
for(j=1; j<=nConstraint; j++){
int k;
for(k=0; k<nConstraint; k++){
if( aUsage[k].argvIndex==j ){
int iTerm = aConstraint[k].iTermOffset;
@ -2597,10 +2598,11 @@ WhereInfo *sqlite3WhereBegin(
int startEq; /* True if range start uses ==, >= or <= */
int endEq; /* True if range end uses ==, >= or <= */
int start_constraints; /* Start of range is constrained */
int k = pIdx->aiColumn[nEq]; /* Column for inequality constraints */
int nConstraint; /* Number of constraint terms */
int op;
k = pIdx->aiColumn[nEq]; /* Column for inequality constraints */
/* Generate code to evaluate all constraint terms using == or IN
** and store the values of those terms in an array of registers
** starting at regBase.
@ -2701,7 +2703,7 @@ WhereInfo *sqlite3WhereBegin(
testcase( op==OP_IdxLT );
sqlite3VdbeAddOp4(v, op, iIdxCur, addrNxt, regBase,
SQLITE_INT_TO_PTR(nConstraint), P4_INT32);
sqlite3VdbeChangeP5(v, endEq!=bRev);
sqlite3VdbeChangeP5(v, endEq!=bRev ?1:0);
/* If there are inequality constraints, check that the value
** of the table column that the inequality contrains is not NULL.