/ Check-in [8d002740]
Login

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

Overview
Comment:Fix harmless compiler warnings from clang scan-build.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1:8d002740bffca2a76d2dfbc1a67293d34f9de9ba
User & Date: drh 2013-11-18 11:20:50
Context
2013-11-18
18:48
Fix documentation typos. No changes to code. check-in: 7caeb09c user: drh tags: trunk
11:20
Fix harmless compiler warnings from clang scan-build. check-in: 8d002740 user: drh tags: trunk
08:41
Fix a problem with the shell tool EXPLAIN indentation code and VDBE sub-programs. check-in: 9c8d6856 user: dan tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to ext/fts3/fts3.c.

   329    329     assert( q - (unsigned char *)p <= FTS3_VARINT_MAX );
   330    330     return (int) (q - (unsigned char *)p);
   331    331   }
   332    332   
   333    333   #define GETVARINT_STEP(v, ptr, shift, mask1, mask2, var, ret) \
   334    334     v = (v & mask1) | ( (*ptr++) << shift );                    \
   335    335     if( (v & mask2)==0 ){ var = v; return ret; }
          336  +#define GETVARINT_INIT(v, ptr, shift, mask1, mask2, var, ret) \
          337  +  v = (*ptr++);                                               \
          338  +  if( (v & mask2)==0 ){ var = v; return ret; }
   336    339   
   337    340   /* 
   338    341   ** Read a 64-bit variable-length integer from memory starting at p[0].
   339    342   ** Return the number of bytes read, or 0 on error.
   340    343   ** The value is stored in *v.
   341    344   */
   342    345   int sqlite3Fts3GetVarint(const char *p, sqlite_int64 *v){
   343    346     const char *pStart = p;
   344    347     u32 a;
   345    348     u64 b;
   346    349     int shift;
   347    350   
   348         -  GETVARINT_STEP(a, p, 0,  0x00,     0x80, *v, 1);
          351  +  GETVARINT_INIT(a, p, 0,  0x00,     0x80, *v, 1);
   349    352     GETVARINT_STEP(a, p, 7,  0x7F,     0x4000, *v, 2);
   350    353     GETVARINT_STEP(a, p, 14, 0x3FFF,   0x200000, *v, 3);
   351    354     GETVARINT_STEP(a, p, 21, 0x1FFFFF, 0x10000000, *v, 4);
   352    355     b = (a & 0x0FFFFFFF );
   353    356   
   354    357     for(shift=28; shift<=63; shift+=7){
   355    358       u64 c = *p++;
................................................................................
   364    367   ** Similar to sqlite3Fts3GetVarint(), except that the output is truncated to a
   365    368   ** 32-bit integer before it is returned.
   366    369   */
   367    370   int sqlite3Fts3GetVarint32(const char *p, int *pi){
   368    371     u32 a;
   369    372   
   370    373   #ifndef fts3GetVarint32
   371         -  GETVARINT_STEP(a, p, 0,  0x00,     0x80, *pi, 1);
          374  +  GETVARINT_INIT(a, p, 0,  0x00,     0x80, *pi, 1);
   372    375   #else
   373    376     a = (*p++);
   374    377     assert( a & 0x80 );
   375    378   #endif
   376    379   
   377    380     GETVARINT_STEP(a, p, 7,  0x7F,     0x4000, *pi, 2);
   378    381     GETVARINT_STEP(a, p, 14, 0x3FFF,   0x200000, *pi, 3);

Changes to src/fkey.c.

   544    544     WhereInfo *pWInfo;              /* Context used by sqlite3WhereXXX() */
   545    545     int iFkIfZero = 0;              /* Address of OP_FkIfZero */
   546    546     Vdbe *v = sqlite3GetVdbe(pParse);
   547    547   
   548    548     assert( pIdx==0 || pIdx->pTable==pTab );
   549    549     assert( pIdx==0 || pIdx->nKeyCol==pFKey->nCol );
   550    550     assert( pIdx!=0 || pFKey->nCol==1 );
          551  +  assert( pIdx!=0 || HasRowid(pTab) );
   551    552   
   552    553     if( nIncr<0 ){
   553    554       iFkIfZero = sqlite3VdbeAddOp2(v, OP_FkIfZero, pFKey->isDeferred, 0);
   554    555     }
   555    556   
   556    557     /* Create an Expr object representing an SQL expression like:
   557    558     **
................................................................................
   596    597       if( HasRowid(pTab) ){
   597    598         pLeft = exprTableRegister(pParse, pTab, regData, -1);
   598    599         pRight = exprTableColumn(db, pTab, pSrc->a[0].iCursor, -1);
   599    600         pNe = sqlite3PExpr(pParse, TK_NE, pLeft, pRight, 0);
   600    601       }else{
   601    602         Expr *pEq, *pAll = 0;
   602    603         Index *pPk = sqlite3PrimaryKeyIndex(pTab);
          604  +      assert( pIdx!=0 );
   603    605         for(i=0; i<pPk->nKeyCol; i++){
   604    606           i16 iCol = pIdx->aiColumn[i];
   605    607           pLeft = exprTableRegister(pParse, pTab, regData, iCol);
   606    608           pRight = exprTableColumn(db, pTab, pSrc->a[0].iCursor, iCol);
   607    609           pEq = sqlite3PExpr(pParse, TK_EQ, pLeft, pRight, 0);
   608    610           pAll = sqlite3ExprAnd(db, pAll, pEq);
   609    611         }