/ Check-in [680755db]
Login
SQLite training in Houston TX on 2019-11-05 (details)
Part of the 2019 Tcl Conference

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Fix compiler warnings in where.c and in the TCL test harness. (CVS 5994)
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 680755dbf01e20569b87068b1515b144903c566e
User & Date: drh 2008-12-09 01:32:03
Context
2008-12-09
02:51
Suppress more silly compiler warnings. (CVS 5995) check-in: 1522c2c6 user: drh tags: trunk
01:32
Fix compiler warnings in where.c and in the TCL test harness. (CVS 5994) check-in: 680755db user: drh tags: trunk
2008-12-08
21:37
Some minor name refactoring in where.c. Avoid declaring variables before initializing them in the amalgamation because VC++ doesn't like that. (CVS 5993) check-in: 6ed696e7 user: drh tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to src/sqliteInt.h.

     7      7   **    May you do good and not evil.
     8      8   **    May you find forgiveness for yourself and forgive others.
     9      9   **    May you share freely, never taking more than you give.
    10     10   **
    11     11   *************************************************************************
    12     12   ** Internal interface definitions for SQLite.
    13     13   **
    14         -** @(#) $Id: sqliteInt.h,v 1.805 2008/12/08 21:37:15 drh Exp $
           14  +** @(#) $Id: sqliteInt.h,v 1.806 2008/12/09 01:32:03 drh Exp $
    15     15   */
    16     16   #ifndef _SQLITEINT_H_
    17     17   #define _SQLITEINT_H_
    18     18   
    19     19   /*
    20     20   ** Include the configuration header output by 'configure' if we're using the
    21     21   ** autoconf-based build
................................................................................
  1523   1523     Index *pIdx;          /* Index used.  NULL if no index */
  1524   1524     int iTabCur;          /* The VDBE cursor used to access the table */
  1525   1525     int iIdxCur;          /* The VDBE cursor used to access pIdx */
  1526   1526     int addrBrk;          /* Jump here to break out of the loop */
  1527   1527     int addrNxt;          /* Jump here to start the next IN combination */
  1528   1528     int addrCont;         /* Jump here to continue with the next loop cycle */
  1529   1529     int addrFirst;        /* First instruction of interior of the loop */
  1530         -  int op, p1, p2, p5;   /* Opcode used to terminate the loop */
         1530  +  int op, p1, p2;       /* Opcode used to terminate the loop */
         1531  +  u8 p5;                /* P5 operand of the opcode that terminates the loop */
  1531   1532     int nEq;              /* Number of == or IN constraints on this loop */
  1532   1533     int nIn;              /* Number of IN operators constraining this loop */
  1533   1534     struct InLoop {
  1534   1535       int iCur;              /* The VDBE cursor used by this IN operator */
  1535   1536       int addrInTop;         /* Top of the IN loop */
  1536   1537     } *aInLoop;           /* Information about each nested IN operator */
  1537   1538     sqlite3_index_info *pBestIdx;  /* Index information for this level */

Changes to src/test6.c.

    10     10   **
    11     11   ******************************************************************************
    12     12   **
    13     13   ** This file contains code that modified the OS layer in order to simulate
    14     14   ** the effect on the database file of an OS crash or power failure.  This
    15     15   ** is used to test the ability of SQLite to recover from those situations.
    16     16   **
    17         -** $Id: test6.c,v 1.39 2008/06/06 11:11:26 danielk1977 Exp $
           17  +** $Id: test6.c,v 1.40 2008/12/09 01:32:03 drh Exp $
    18     18   */
    19     19   #if SQLITE_TEST          /* This file is used for testing only */
    20     20   #include "sqliteInt.h"
    21     21   #include "tcl.h"
    22     22   
    23     23   #ifndef SQLITE_OMIT_DISKIO  /* This file is a no-op if disk I/O is disabled */
    24     24   
................................................................................
   602    602     sqlite3_vfs *pVfs = (sqlite3_vfs *)pCfVfs->pAppData;
   603    603     return pVfs->xDlOpen(pVfs, zPath);
   604    604   }
   605    605   static void cfDlError(sqlite3_vfs *pCfVfs, int nByte, char *zErrMsg){
   606    606     sqlite3_vfs *pVfs = (sqlite3_vfs *)pCfVfs->pAppData;
   607    607     pVfs->xDlError(pVfs, nByte, zErrMsg);
   608    608   }
   609         -static void *cfDlSym(sqlite3_vfs *pCfVfs, void *pHandle, const char *zSymbol){
          609  +static void (*cfDlSym(sqlite3_vfs *pCfVfs, void *pH, const char *zSym))(void){
   610    610     sqlite3_vfs *pVfs = (sqlite3_vfs *)pCfVfs->pAppData;
   611         -  return pVfs->xDlSym(pVfs, pHandle, zSymbol);
          611  +  return pVfs->xDlSym(pVfs, pH, zSym);
   612    612   }
   613    613   static void cfDlClose(sqlite3_vfs *pCfVfs, void *pHandle){
   614    614     sqlite3_vfs *pVfs = (sqlite3_vfs *)pCfVfs->pAppData;
   615    615     pVfs->xDlClose(pVfs, pHandle);
   616    616   }
   617    617   static int cfRandomness(sqlite3_vfs *pCfVfs, int nByte, char *zBufOut){
   618    618     sqlite3_vfs *pVfs = (sqlite3_vfs *)pCfVfs->pAppData;

Changes to src/test_devsym.c.

    10     10   **
    11     11   ******************************************************************************
    12     12   **
    13     13   ** This file contains code that modified the OS layer in order to simulate
    14     14   ** different device types (by overriding the return values of the 
    15     15   ** xDeviceCharacteristics() and xSectorSize() methods).
    16     16   **
    17         -** $Id: test_devsym.c,v 1.8 2008/09/12 10:22:40 danielk1977 Exp $
           17  +** $Id: test_devsym.c,v 1.9 2008/12/09 01:32:03 drh Exp $
    18     18   */
    19     19   #if SQLITE_TEST          /* This file is used for testing only */
    20     20   
    21     21   #include "sqlite3.h"
    22     22   #include "sqliteInt.h"
    23     23   
    24     24   /*
................................................................................
    59     59   static int devsymOpen(sqlite3_vfs*, const char *, sqlite3_file*, int , int *);
    60     60   static int devsymDelete(sqlite3_vfs*, const char *zName, int syncDir);
    61     61   static int devsymAccess(sqlite3_vfs*, const char *zName, int flags, int *);
    62     62   static int devsymFullPathname(sqlite3_vfs*, const char *zName, int, char *zOut);
    63     63   #ifndef SQLITE_OMIT_LOAD_EXTENSION
    64     64   static void *devsymDlOpen(sqlite3_vfs*, const char *zFilename);
    65     65   static void devsymDlError(sqlite3_vfs*, int nByte, char *zErrMsg);
    66         -static void *devsymDlSym(sqlite3_vfs*,void*, const char *zSymbol);
           66  +static void (*devsymDlSym(sqlite3_vfs*,void*, const char *zSymbol))(void);
    67     67   static void devsymDlClose(sqlite3_vfs*, void*);
    68     68   #endif /* SQLITE_OMIT_LOAD_EXTENSION */
    69     69   static int devsymRandomness(sqlite3_vfs*, int nByte, char *zOut);
    70     70   static int devsymSleep(sqlite3_vfs*, int microseconds);
    71     71   static int devsymCurrentTime(sqlite3_vfs*, double*);
    72     72   
    73     73   static sqlite3_vfs devsym_vfs = {
................................................................................
   296    296   static void devsymDlError(sqlite3_vfs *pVfs, int nByte, char *zErrMsg){
   297    297     sqlite3OsDlError(g.pVfs, nByte, zErrMsg);
   298    298   }
   299    299   
   300    300   /*
   301    301   ** Return a pointer to the symbol zSymbol in the dynamic library pHandle.
   302    302   */
   303         -static void *devsymDlSym(sqlite3_vfs *pVfs, void *pHandle, const char *zSymbol){
   304         -  return sqlite3OsDlSym(g.pVfs, pHandle, zSymbol);
          303  +static void (*devsymDlSym(sqlite3_vfs *pVfs, void *p, const char *zSym))(void){
          304  +  return sqlite3OsDlSym(g.pVfs, p, zSym);
   305    305   }
   306    306   
   307    307   /*
   308    308   ** Close the dynamic library handle pHandle.
   309    309   */
   310    310   static void devsymDlClose(sqlite3_vfs *pVfs, void *pHandle){
   311    311     sqlite3OsDlClose(g.pVfs, pHandle);

Changes to src/test_onefile.c.

     6      6   **
     7      7   **    May you do good and not evil.
     8      8   **    May you find forgiveness for yourself and forgive others.
     9      9   **    May you share freely, never taking more than you give.
    10     10   **
    11     11   *************************************************************************
    12     12   **
    13         -** $Id: test_onefile.c,v 1.9 2008/06/26 10:54:12 danielk1977 Exp $
           13  +** $Id: test_onefile.c,v 1.10 2008/12/09 01:32:03 drh Exp $
    14     14   **
    15     15   ** OVERVIEW:
    16     16   **
    17     17   **   This file contains some example code demonstrating how the SQLite 
    18     18   **   vfs feature can be used to have SQLite operate directly on an 
    19     19   **   embedded media, without using an intermediate file system.
    20     20   **
................................................................................
   164    164   */
   165    165   static int fsOpen(sqlite3_vfs*, const char *, sqlite3_file*, int , int *);
   166    166   static int fsDelete(sqlite3_vfs*, const char *zName, int syncDir);
   167    167   static int fsAccess(sqlite3_vfs*, const char *zName, int flags, int *);
   168    168   static int fsFullPathname(sqlite3_vfs*, const char *zName, int nOut,char *zOut);
   169    169   static void *fsDlOpen(sqlite3_vfs*, const char *zFilename);
   170    170   static void fsDlError(sqlite3_vfs*, int nByte, char *zErrMsg);
   171         -static void *fsDlSym(sqlite3_vfs*,void*, const char *zSymbol);
          171  +static void (*fsDlSym(sqlite3_vfs*,void*, const char *zSymbol))(void);
   172    172   static void fsDlClose(sqlite3_vfs*, void*);
   173    173   static int fsRandomness(sqlite3_vfs*, int nByte, char *zOut);
   174    174   static int fsSleep(sqlite3_vfs*, int microseconds);
   175    175   static int fsCurrentTime(sqlite3_vfs*, double*);
   176    176   
   177    177   
   178    178   typedef struct fs_vfs_t fs_vfs_t;
................................................................................
   761    761     sqlite3_vfs *pParent = ((fs_vfs_t *)pVfs)->pParent;
   762    762     pParent->xDlError(pParent, nByte, zErrMsg);
   763    763   }
   764    764   
   765    765   /*
   766    766   ** Return a pointer to the symbol zSymbol in the dynamic library pHandle.
   767    767   */
   768         -static void *fsDlSym(sqlite3_vfs *pVfs, void *pHandle, const char *zSymbol){
          768  +static void (*fsDlSym(sqlite3_vfs *pVfs, void *pH, const char *zSym))(void){
   769    769     sqlite3_vfs *pParent = ((fs_vfs_t *)pVfs)->pParent;
   770         -  return pParent->xDlSym(pParent, pHandle, zSymbol);
          770  +  return pParent->xDlSym(pParent, pH, zSym);
   771    771   }
   772    772   
   773    773   /*
   774    774   ** Close the dynamic library handle pHandle.
   775    775   */
   776    776   static void fsDlClose(sqlite3_vfs *pVfs, void *pHandle){
   777    777     sqlite3_vfs *pParent = ((fs_vfs_t *)pVfs)->pParent;

Changes to src/where.c.

    12     12   ** This module contains C code that generates VDBE code used to process
    13     13   ** the WHERE clause of SQL statements.  This module is responsible for
    14     14   ** generating the code that loops through a table looking for applicable
    15     15   ** rows.  Indices are selected and used to speed the search when doing
    16     16   ** so is applicable.  Because this module is responsible for selecting
    17     17   ** indices, you might also think of this module as the "query optimizer".
    18     18   **
    19         -** $Id: where.c,v 1.334 2008/12/08 21:37:16 drh Exp $
           19  +** $Id: where.c,v 1.335 2008/12/09 01:32:03 drh Exp $
    20     20   */
    21     21   #include "sqliteInt.h"
    22     22   
    23     23   /*
    24     24   ** Trace output macros
    25     25   */
    26     26   #if defined(SQLITE_TEST) || defined(SQLITE_DEBUG)
................................................................................
    76     76   ** The number of terms in a join is limited by the number of bits
    77     77   ** in prereqRight and prereqAll.  The default is 64 bits, hence SQLite
    78     78   ** is only able to process joins with 64 or fewer tables.
    79     79   */
    80     80   typedef struct WhereTerm WhereTerm;
    81     81   struct WhereTerm {
    82     82     Expr *pExpr;            /* Pointer to the subexpression that is this term */
    83         -  i16 iParent;            /* Disable pWC->a[iParent] when this term disabled */
    84         -  i16 leftCursor;         /* Cursor number of X in "X <op> <expr>" */
    85         -  i16 leftColumn;         /* Column number of X in "X <op> <expr>" */
           83  +  int iParent;            /* Disable pWC->a[iParent] when this term disabled */
           84  +  int leftCursor;         /* Cursor number of X in "X <op> <expr>" */
           85  +  int leftColumn;         /* Column number of X in "X <op> <expr>" */
    86     86     u16 eOperator;          /* A WO_xx value describing <op> */
    87     87     u8 wtFlags;             /* TERM_xxx bit flags.  See below */
    88     88     u8 nChild;              /* Number of children that must disable us */
    89     89     WhereClause *pWC;       /* The clause this term is part of */
    90     90     Bitmask prereqRight;    /* Bitmask of tables used by pExpr->pRight */
    91     91     Bitmask prereqAll;      /* Bitmask of tables referenced by pExpr */
    92     92   };
................................................................................
   106    106   */
   107    107   struct WhereClause {
   108    108     Parse *pParse;           /* The parser context */
   109    109     ExprMaskSet *pMaskSet;   /* Mapping of table indices to bitmasks */
   110    110     int nTerm;               /* Number of terms */
   111    111     int nSlot;               /* Number of entries in a[] */
   112    112     WhereTerm *a;            /* Each a[] describes a term of the WHERE cluase */
   113         -  WhereTerm aStatic[10];   /* Initial static space for a[] */
          113  +  WhereTerm aStatic[4];    /* Initial static space for a[] */
   114    114   };
   115    115   
   116    116   /*
   117    117   ** An instance of the following structure keeps track of a mapping
   118    118   ** between VDBE cursor numbers and bits of the bitmasks in WhereTerm.
   119    119   **
   120    120   ** The VDBE cursor numbers are small integers contained in 
................................................................................
   155    155   #define WO_LT     (WO_EQ<<(TK_LT-TK_EQ))
   156    156   #define WO_LE     (WO_EQ<<(TK_LE-TK_EQ))
   157    157   #define WO_GT     (WO_EQ<<(TK_GT-TK_EQ))
   158    158   #define WO_GE     (WO_EQ<<(TK_GE-TK_EQ))
   159    159   #define WO_MATCH  0x040
   160    160   #define WO_ISNULL 0x080
   161    161   #define WO_OR     0x100
          162  +
          163  +#define WO_ALL    0xfff       /* Mask of all possible WO_* values */
   162    164   
   163    165   /*
   164    166   ** Value for wsFlags returned by bestIndex().  These flags determine which
   165    167   ** search strategies are appropriate.
   166    168   **
   167    169   ** The least significant 12 bits is reserved as a mask for WO_ values above.
   168    170   ** The WhereLevel.wtFlags field is usually set to WO_IN|WO_EQ|WO_ISNULL.
................................................................................
   234    236   ** This is true even if this routine fails to allocate a new WhereTerm.
   235    237   **
   236    238   ** WARNING:  This routine might reallocate the space used to store
   237    239   ** WhereTerms.  All pointers to WhereTerms should be invalidated after
   238    240   ** calling this routine.  Such pointers may be reinitialized by referencing
   239    241   ** the pWC->a[] array.
   240    242   */
   241         -static int whereClauseInsert(WhereClause *pWC, Expr *p, u16 wtFlags){
          243  +static int whereClauseInsert(WhereClause *pWC, Expr *p, u8 wtFlags){
   242    244     WhereTerm *pTerm;
   243    245     int idx;
   244    246     if( pWC->nTerm>=pWC->nSlot ){
   245    247       WhereTerm *pOld = pWC->a;
   246    248       sqlite3 *db = pWC->pParse->db;
   247    249       pWC->a = sqlite3DbMallocRaw(db, sizeof(pWC->a[0])*pWC->nSlot*2 );
   248    250       if( pWC->a==0 ){
................................................................................
   426    428       pExpr->op = ((pExpr->op-TK_GT)^2)+TK_GT;
   427    429     }
   428    430   }
   429    431   
   430    432   /*
   431    433   ** Translate from TK_xx operator to WO_xx bitmask.
   432    434   */
   433         -static int operatorMask(int op){
   434         -  int c;
          435  +static u16 operatorMask(int op){
          436  +  u16 c;
   435    437     assert( allowedOp(op) );
   436    438     if( op==TK_IN ){
   437    439       c = WO_IN;
   438    440     }else if( op==TK_ISNULL ){
   439    441       c = WO_ISNULL;
   440    442     }else if( op==TK_OR ){
   441    443       c = WO_OR;
   442    444     }else{
   443         -    c = WO_EQ<<(op-TK_EQ);
          445  +    assert( (WO_EQ<<(op-TK_EQ)) < 0x7fff );
          446  +    c = (u16)(WO_EQ<<(op-TK_EQ));
   444    447     }
   445    448     assert( op!=TK_ISNULL || c==WO_ISNULL );
   446    449     assert( op!=TK_OR || c==WO_OR );
   447    450     assert( op!=TK_IN || c==WO_IN );
   448    451     assert( op!=TK_EQ || c==WO_EQ );
   449    452     assert( op!=TK_LT || c==WO_LT );
   450    453     assert( op!=TK_LE || c==WO_LE );
................................................................................
   460    463   ** Return a pointer to the term.  Return 0 if not found.
   461    464   */
   462    465   static WhereTerm *findTerm(
   463    466     WhereClause *pWC,     /* The WHERE clause to be searched */
   464    467     int iCur,             /* Cursor number of LHS */
   465    468     int iColumn,          /* Column number of LHS */
   466    469     Bitmask notReady,     /* RHS must not overlap with this mask */
   467         -  u16 op,               /* Mask of WO_xx values describing operator */
          470  +  u32 op,               /* Mask of WO_xx values describing operator */
   468    471     Index *pIdx           /* Must be compatible with this index, if not NULL */
   469    472   ){
   470    473     WhereTerm *pTerm;
   471    474     int k;
   472    475     assert( iCur>=0 );
          476  +  op &= WO_ALL;
   473    477     for(pTerm=pWC->a, k=pWC->nTerm; k; k--, pTerm++){
   474    478       if( pTerm->leftCursor==iCur
   475    479          && (pTerm->prereqRight & notReady)==0
   476    480          && pTerm->leftColumn==iColumn
   477    481          && (pTerm->eOperator & op)!=0
   478    482       ){
   479    483         if( pIdx && pTerm->eOperator!=WO_ISNULL ){
................................................................................
  1293   1297   
  1294   1298     /* If the sqlite3_index_info structure has not been previously
  1295   1299     ** allocated and initialized for this virtual table, then allocate
  1296   1300     ** and initialize it now
  1297   1301     */
  1298   1302     pIdxInfo = *ppIdxInfo;
  1299   1303     if( pIdxInfo==0 ){
  1300         -    WhereTerm *pTerm;
  1301   1304       int nTerm;
  1302   1305       WHERETRACE(("Recomputing index info for %s...\n", pTab->zName));
  1303   1306   
  1304   1307       /* Count the number of possible WHERE clause constraints referring
  1305   1308       ** to this virtual table */
  1306   1309       for(i=nTerm=0, pTerm=pWC->a; i<pWC->nTerm; i++, pTerm++){
  1307   1310         if( pTerm->leftCursor != pSrc->iCursor ) continue;
................................................................................
  1357   1360         if( pTerm->leftCursor != pSrc->iCursor ) continue;
  1358   1361         assert( (pTerm->eOperator&(pTerm->eOperator-1))==0 );
  1359   1362         testcase( pTerm->eOperator==WO_IN );
  1360   1363         testcase( pTerm->eOperator==WO_ISNULL );
  1361   1364         if( pTerm->eOperator & (WO_IN|WO_ISNULL) ) continue;
  1362   1365         pIdxCons[j].iColumn = pTerm->leftColumn;
  1363   1366         pIdxCons[j].iTermOffset = i;
  1364         -      pIdxCons[j].op = pTerm->eOperator;
         1367  +      pIdxCons[j].op = (u8)pTerm->eOperator;
  1365   1368         /* The direct assignment in the previous line is possible only because
  1366   1369         ** the WO_ and SQLITE_INDEX_CONSTRAINT_ codes are identical.  The
  1367   1370         ** following asserts verify this fact. */
  1368   1371         assert( WO_EQ==SQLITE_INDEX_CONSTRAINT_EQ );
  1369   1372         assert( WO_LT==SQLITE_INDEX_CONSTRAINT_LT );
  1370   1373         assert( WO_LE==SQLITE_INDEX_CONSTRAINT_LE );
  1371   1374         assert( WO_GT==SQLITE_INDEX_CONSTRAINT_GT );
................................................................................
  1423   1426     ** each time.
  1424   1427     */
  1425   1428     pIdxCons = *(struct sqlite3_index_constraint**)&pIdxInfo->aConstraint;
  1426   1429     pUsage = pIdxInfo->aConstraintUsage;
  1427   1430     for(i=0; i<pIdxInfo->nConstraint; i++, pIdxCons++){
  1428   1431       j = pIdxCons->iTermOffset;
  1429   1432       pTerm = &pWC->a[j];
  1430         -    pIdxCons->usable =  (pTerm->prereqRight & notReady)==0;
         1433  +    pIdxCons->usable =  (pTerm->prereqRight & notReady)==0 ?1:0;
  1431   1434     }
  1432   1435     memset(pUsage, 0, sizeof(pUsage[0])*pIdxInfo->nConstraint);
  1433   1436     if( pIdxInfo->needToFreeIdxStr ){
  1434   1437       sqlite3_free(pIdxInfo->idxStr);
  1435   1438     }
  1436   1439     pIdxInfo->idxStr = 0;
  1437   1440     pIdxInfo->idxNum = 0;
................................................................................
  2407   2410       }
  2408   2411   
  2409   2412   #ifndef SQLITE_OMIT_VIRTUALTABLE
  2410   2413       if( pLevel->pBestIdx ){
  2411   2414         /* Case 0:  The table is a virtual-table.  Use the VFilter and VNext
  2412   2415         **          to access the data.
  2413   2416         */
  2414         -      int j;
  2415   2417         int iReg;   /* P3 Value for OP_VFilter */
  2416   2418         sqlite3_index_info *pBestIdx = pLevel->pBestIdx;
  2417   2419         int nConstraint = pBestIdx->nConstraint;
  2418   2420         struct sqlite3_index_constraint_usage *aUsage =
  2419   2421                                                     pBestIdx->aConstraintUsage;
  2420   2422         const struct sqlite3_index_constraint *aConstraint =
  2421   2423                                                     pBestIdx->aConstraint;
  2422   2424   
  2423   2425         iReg = sqlite3GetTempRange(pParse, nConstraint+2);
  2424   2426         pParse->disableColCache++;
  2425   2427         for(j=1; j<=nConstraint; j++){
  2426         -        int k;
  2427   2428           for(k=0; k<nConstraint; k++){
  2428   2429             if( aUsage[k].argvIndex==j ){
  2429   2430               int iTerm = aConstraint[k].iTermOffset;
  2430   2431               assert( pParse->disableColCache );
  2431   2432               sqlite3ExprCode(pParse, wc.a[iTerm].pExpr->pRight, iReg+j+1);
  2432   2433               break;
  2433   2434             }
................................................................................
  2593   2594         int regBase;                 /* Base register holding constraint values */
  2594   2595         int r1;                      /* Temp register */
  2595   2596         WhereTerm *pRangeStart = 0;  /* Inequality constraint at range start */
  2596   2597         WhereTerm *pRangeEnd = 0;    /* Inequality constraint at range end */
  2597   2598         int startEq;                 /* True if range start uses ==, >= or <= */
  2598   2599         int endEq;                   /* True if range end uses ==, >= or <= */
  2599   2600         int start_constraints;       /* Start of range is constrained */
  2600         -      int k = pIdx->aiColumn[nEq]; /* Column for inequality constraints */
  2601   2601         int nConstraint;             /* Number of constraint terms */
  2602   2602         int op;
         2603  +
         2604  +      k = pIdx->aiColumn[nEq];     /* Column for inequality constraints */
  2603   2605   
  2604   2606         /* Generate code to evaluate all constraint terms using == or IN
  2605   2607         ** and store the values of those terms in an array of registers
  2606   2608         ** starting at regBase.
  2607   2609         */
  2608   2610         regBase = codeAllEqualityTerms(pParse, pLevel, &wc, notReady, 2);
  2609   2611         addrNxt = pLevel->addrNxt;
................................................................................
  2697   2699         /* Check if the index cursor is past the end of the range. */
  2698   2700         op = aEndOp[(pRangeEnd || nEq) * (1 + bRev)];
  2699   2701         testcase( op==OP_Noop );
  2700   2702         testcase( op==OP_IdxGE );
  2701   2703         testcase( op==OP_IdxLT );
  2702   2704         sqlite3VdbeAddOp4(v, op, iIdxCur, addrNxt, regBase,
  2703   2705                           SQLITE_INT_TO_PTR(nConstraint), P4_INT32);
  2704         -      sqlite3VdbeChangeP5(v, endEq!=bRev);
         2706  +      sqlite3VdbeChangeP5(v, endEq!=bRev ?1:0);
  2705   2707   
  2706   2708         /* If there are inequality constraints, check that the value
  2707   2709         ** of the table column that the inequality contrains is not NULL.
  2708   2710         ** If it is, jump to the next iteration of the loop.
  2709   2711         */
  2710   2712         r1 = sqlite3GetTempReg(pParse);
  2711   2713         testcase( pLevel->wsFlags & WHERE_BTM_LIMIT );