1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-11-19 21:43:15 +03:00

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

@@ -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.