/ Check-in [85ebd46c]
Login

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

Overview
Comment:Fixes for harmless compiler warnings.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1:85ebd46c701e0a094a4690cd8f1d0cbae9aa257c
User & Date: drh 2015-12-17 13:28:50
Context
2015-12-17
14:18
Fix the spellfix1_scriptcode() function to ignore whitespace and punctuation, and to recognize hebrew and arabic scripts. check-in: 7adfa4a5 user: drh tags: trunk
13:28
Fixes for harmless compiler warnings. check-in: 85ebd46c user: drh tags: trunk
2015-12-16
23:30
Fix even more harmless compiler warnings. Closed-Leaf check-in: 1d0e6aa1 user: mistachkin tags: msvcWarn
13:07
Make greater use of the SQLITE_WITHIN macro. check-in: f2fc3aed user: drh tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to Makefile.msc.

    46     46   # If necessary, create a list of harmless compiler warnings to disable when
    47     47   # compiling the various tools.  For the SQLite source code itself, warnings,
    48     48   # if any, will be disabled from within it.
    49     49   #
    50     50   !IFNDEF NO_WARN
    51     51   !IF $(USE_FULLWARN)!=0
    52     52   NO_WARN = -wd4054 -wd4055 -wd4100 -wd4127 -wd4130 -wd4152 -wd4189 -wd4206
    53         -NO_WARN = $(NO_WARN) -wd4210 -wd4232 -wd4244 -wd4305 -wd4306 -wd4702 -wd4706
           53  +NO_WARN = $(NO_WARN) -wd4210 -wd4232 -wd4305 -wd4306 -wd4702 -wd4706
    54     54   !ENDIF
    55     55   !ENDIF
    56     56   
    57     57   # Set this non-0 to use the library paths and other options necessary for
    58     58   # Windows Phone 8.1.
    59     59   #
    60     60   !IFNDEF USE_WP81_OPTS

Changes to ext/fts3/tool/fts3view.c.

   394    394              "         WHERE (a.blockid BETWEEN b.start_block"
   395    395                                          " AND b.leaves_end_block)"
   396    396              "           AND (b.level%%1024)==%d)",
   397    397              pgsz-45, zTab, zTab, i);
   398    398       if( sqlite3_step(pStmt)==SQLITE_ROW
   399    399        && (nLeaf = sqlite3_column_int(pStmt, 0))>0
   400    400       ){
   401         -      int nIdx = sqlite3_column_int(pStmt, 5);
          401  +      nIdx = sqlite3_column_int(pStmt, 5);
   402    402         sqlite3_int64 sz;
   403    403         printf("For level %d:\n", i);
   404    404         printf("  Number of indexes...................... %9d\n", nIdx);
   405    405         printf("  Number of leaf segments................ %9d\n", nLeaf);
   406    406         if( nIdx>1 ){
   407    407           printf("  Average leaf segments per index........ %11.1f\n",
   408    408                  (double)nLeaf/(double)nIdx);

Changes to ext/fts5/fts5_expr.c.

   426    426             pTerm, pColset, pNode->iRowid, &bFlag, (u8**)&a, &n
   427    427         );
   428    428       }else{
   429    429         rc = sqlite3Fts5IterPoslist(pTerm->pIter, pColset, &a, &n, &dummy);
   430    430       }
   431    431       if( rc!=SQLITE_OK ) goto ismatch_out;
   432    432       sqlite3Fts5PoslistReaderInit(a, n, &aIter[i]);
   433         -    aIter[i].bFlag = bFlag;
          433  +    aIter[i].bFlag = (u8)bFlag;
   434    434       if( aIter[i].bEof ) goto ismatch_out;
   435    435     }
   436    436   
   437    437     while( 1 ){
   438    438       int bMatch;
   439    439       i64 iPos = aIter[0].iPos;
   440    440       do {

Changes to ext/fts5/fts5_hash.c.

   186    186     if( p->iSzPoslist ){
   187    187       u8 *pPtr = (u8*)p;
   188    188       int nSz = (p->nData - p->iSzPoslist - 1);         /* Size in bytes */
   189    189       int nPos = nSz*2 + p->bDel;                       /* Value of nPos field */
   190    190   
   191    191       assert( p->bDel==0 || p->bDel==1 );
   192    192       if( nPos<=127 ){
   193         -      pPtr[p->iSzPoslist] = nPos;
          193  +      pPtr[p->iSzPoslist] = (u8)nPos;
   194    194       }else{
   195    195         int nByte = sqlite3Fts5GetVarintLen((u32)nPos);
   196    196         memmove(&pPtr[p->iSzPoslist + nByte], &pPtr[p->iSzPoslist + 1], nSz);
   197    197         sqlite3Fts5PutVarint(&pPtr[p->iSzPoslist], nPos);
   198    198         p->nData += (nByte-1);
   199    199       }
   200    200       p->bDel = 0;

Changes to ext/fts5/fts5_index.c.

  2389   2389       if( res<0 ){
  2390   2390         iRes = i1;
  2391   2391       }else{
  2392   2392         iRes = i2;
  2393   2393       }
  2394   2394     }
  2395   2395   
  2396         -  pRes->iFirst = iRes;
         2396  +  pRes->iFirst = (u16)iRes;
  2397   2397     return 0;
  2398   2398   }
  2399   2399   
  2400   2400   /*
  2401   2401   ** Move the seg-iter so that it points to the first rowid on page iLeafPgno.
  2402   2402   ** It is an error if leaf iLeafPgno does not exist or contains no rowids.
  2403   2403   */
................................................................................
  2556   2556           }else if( (pOther->iRowid>pNew->iRowid)==pIter->bRev ){
  2557   2557             pIter->iSwitchRowid = pOther->iRowid;
  2558   2558             pNew = pOther;
  2559   2559           }else if( (pOther->iRowid>pIter->iSwitchRowid)==pIter->bRev ){
  2560   2560             pIter->iSwitchRowid = pOther->iRowid;
  2561   2561           }
  2562   2562         }
  2563         -      pRes->iFirst = (pNew - pIter->aSeg);
         2563  +      pRes->iFirst = (u16)(pNew - pIter->aSeg);
  2564   2564         if( i==1 ) break;
  2565   2565   
  2566   2566         pOther = &pIter->aSeg[ pIter->aFirst[i ^ 0x0001].iFirst ];
  2567   2567       }
  2568   2568     }
  2569   2569   
  2570   2570     return 0;
................................................................................
  2707   2707       }else{
  2708   2708         nSeg = MIN(pStruct->aLevel[iLevel].nSeg, nSegment);
  2709   2709       }
  2710   2710     }
  2711   2711     *ppOut = pNew = fts5MultiIterAlloc(p, nSeg);
  2712   2712     if( pNew==0 ) return;
  2713   2713     pNew->bRev = (0!=(flags & FTS5INDEX_QUERY_DESC));
  2714         -  pNew->bSkipEmpty = bSkipEmpty;
         2714  +  pNew->bSkipEmpty = (u8)bSkipEmpty;
  2715   2715     pNew->pStruct = pStruct;
  2716   2716     fts5StructureRef(pStruct);
  2717   2717   
  2718   2718     /* Initialize each of the component segment iterators. */
  2719   2719     if( iLevel<0 ){
  2720   2720       Fts5StructureLevel *pEnd = &pStruct->aLevel[pStruct->nLevel];
  2721   2721       if( p->pHash ){
................................................................................
  3170   3170     Fts5PageWriter *pPage = &pWriter->writer;
  3171   3171     i64 iRowid;
  3172   3172   
  3173   3173     assert( (pPage->pgidx.n==0)==(pWriter->bFirstTermInPage) );
  3174   3174   
  3175   3175     /* Set the szLeaf header field. */
  3176   3176     assert( 0==fts5GetU16(&pPage->buf.p[2]) );
  3177         -  fts5PutU16(&pPage->buf.p[2], pPage->buf.n);
         3177  +  fts5PutU16(&pPage->buf.p[2], (u16)pPage->buf.n);
  3178   3178   
  3179   3179     if( pWriter->bFirstTermInPage ){
  3180   3180       /* No term was written to this page. */
  3181   3181       assert( pPage->pgidx.n==0 );
  3182   3182       fts5WriteBtreeNoTerm(p, pWriter);
  3183   3183     }else{
  3184   3184       /* Append the pgidx to the page buffer. Set the szLeaf header field. */
................................................................................
  3302   3302         fts5WriteFlushLeaf(p, pWriter);
  3303   3303       }
  3304   3304   
  3305   3305       /* If this is to be the first rowid written to the page, set the 
  3306   3306       ** rowid-pointer in the page-header. Also append a value to the dlidx
  3307   3307       ** buffer, in case a doclist-index is required.  */
  3308   3308       if( pWriter->bFirstRowidInPage ){
  3309         -      fts5PutU16(pPage->buf.p, pPage->buf.n);
         3309  +      fts5PutU16(pPage->buf.p, (u16)pPage->buf.n);
  3310   3310         fts5WriteDlidxAppend(p, pWriter, iRowid);
  3311   3311       }
  3312   3312   
  3313   3313       /* Write the rowid. */
  3314   3314       if( pWriter->bFirstRowidInDoclist || pWriter->bFirstRowidInPage ){
  3315   3315         fts5BufferAppendVarint(&p->rc, &pPage->buf, iRowid);
  3316   3316       }else{
................................................................................
  3460   3460           fts5BufferGrow(&p->rc, &buf, pData->nn);
  3461   3461           fts5BufferAppendBlob(&p->rc, &buf, sizeof(aHdr), aHdr);
  3462   3462           fts5BufferAppendVarint(&p->rc, &buf, pSeg->term.n);
  3463   3463           fts5BufferAppendBlob(&p->rc, &buf, pSeg->term.n, pSeg->term.p);
  3464   3464           fts5BufferAppendBlob(&p->rc, &buf, pData->szLeaf-iOff, &pData->p[iOff]);
  3465   3465           if( p->rc==SQLITE_OK ){
  3466   3466             /* Set the szLeaf field */
  3467         -          fts5PutU16(&buf.p[2], buf.n);
         3467  +          fts5PutU16(&buf.p[2], (u16)buf.n);
  3468   3468           }
  3469   3469   
  3470   3470           /* Set up the new page-index array */
  3471   3471           fts5BufferAppendVarint(&p->rc, &buf, 4);
  3472   3472           if( pSeg->iLeafPgno==pSeg->iTermLeafPgno 
  3473   3473            && pSeg->iEndofDoclist<pData->szLeaf 
  3474   3474           ){
................................................................................
  3826   3826             int bDummy;
  3827   3827             iOff += fts5GetVarint(&pDoclist[iOff], (u64*)&iDelta);
  3828   3828             nCopy = fts5GetPoslistSize(&pDoclist[iOff], &nPos, &bDummy);
  3829   3829             nCopy += nPos;
  3830   3830             iRowid += iDelta;
  3831   3831             
  3832   3832             if( writer.bFirstRowidInPage ){
  3833         -            fts5PutU16(&pBuf->p[0], pBuf->n);   /* first rowid on page */
         3833  +            fts5PutU16(&pBuf->p[0], (u16)pBuf->n);   /* first rowid on page */
  3834   3834               pBuf->n += sqlite3Fts5PutVarint(&pBuf->p[pBuf->n], iRowid);
  3835   3835               writer.bFirstRowidInPage = 0;
  3836   3836               fts5WriteDlidxAppend(p, &writer, iRowid);
  3837   3837             }else{
  3838   3838               pBuf->n += sqlite3Fts5PutVarint(&pBuf->p[pBuf->n], iDelta);
  3839   3839             }
  3840   3840             assert( pBuf->n<=pBuf->nSpace );
................................................................................
  4623   4623         p->pHash, p->iWriteRowid, iCol, iPos, FTS5_MAIN_PREFIX, pToken, nToken
  4624   4624     );
  4625   4625   
  4626   4626     for(i=0; i<pConfig->nPrefix && rc==SQLITE_OK; i++){
  4627   4627       int nByte = fts5IndexCharlenToBytelen(pToken, nToken, pConfig->aPrefix[i]);
  4628   4628       if( nByte ){
  4629   4629         rc = sqlite3Fts5HashWrite(p->pHash, 
  4630         -          p->iWriteRowid, iCol, iPos, FTS5_MAIN_PREFIX+i+1, pToken, nByte
         4630  +          p->iWriteRowid, iCol, iPos, (char)(FTS5_MAIN_PREFIX+i+1), pToken,
         4631  +          nByte
  4631   4632         );
  4632   4633       }
  4633   4634     }
  4634   4635   
  4635   4636     return rc;
  4636   4637   }
  4637   4638   
................................................................................
  4673   4674         for(iIdx=1; iIdx<=pConfig->nPrefix; iIdx++){
  4674   4675           if( pConfig->aPrefix[iIdx-1]==nChar ) break;
  4675   4676         }
  4676   4677       }
  4677   4678   
  4678   4679       if( iIdx<=pConfig->nPrefix ){
  4679   4680         Fts5Structure *pStruct = fts5StructureRead(p);
  4680         -      buf.p[0] = FTS5_MAIN_PREFIX + iIdx;
         4681  +      buf.p[0] = (u8)(FTS5_MAIN_PREFIX + iIdx);
  4681   4682         if( pStruct ){
  4682   4683           fts5MultiIterNew(p, pStruct, 1, flags, buf.p, nToken+1, -1, 0, &pRet);
  4683   4684           fts5StructureRelease(pStruct);
  4684   4685         }
  4685   4686       }else{
  4686   4687         int bDesc = (flags & FTS5INDEX_QUERY_DESC)!=0;
  4687   4688         buf.p[0] = FTS5_MAIN_PREFIX;

Changes to ext/fts5/fts5_main.c.

   584    584   
   585    585     /* Assign argvIndex values to each constraint in use. */
   586    586     iNext = 1;
   587    587     for(i=0; i<sizeof(aConstraint)/sizeof(aConstraint[0]); i++){
   588    588       struct Constraint *pC = &aConstraint[i];
   589    589       if( pC->iConsIndex>=0 ){
   590    590         pInfo->aConstraintUsage[pC->iConsIndex].argvIndex = iNext++;
   591         -      pInfo->aConstraintUsage[pC->iConsIndex].omit = pC->omit;
          591  +      pInfo->aConstraintUsage[pC->iConsIndex].omit = (unsigned char)pC->omit;
   592    592       }
   593    593     }
   594    594   
   595    595     pInfo->idxNum = idxFlags;
   596    596     return SQLITE_OK;
   597    597   }
   598    598   

Changes to ext/fts5/fts5_tokenize.c.

   252    252         const unsigned char *zCsr = (const unsigned char*)z;
   253    253         const unsigned char *zTerm = (const unsigned char*)&z[n];
   254    254         while( zCsr<zTerm ){
   255    255           int iCode;
   256    256           int bToken;
   257    257           READ_UTF8(zCsr, zTerm, iCode);
   258    258           if( iCode<128 ){
   259         -          p->aTokenChar[iCode] = bTokenChars;
          259  +          p->aTokenChar[iCode] = (unsigned char)bTokenChars;
   260    260           }else{
   261    261             bToken = sqlite3Fts5UnicodeIsalnum(iCode);
   262    262             assert( (bToken==0 || bToken==1) ); 
   263    263             assert( (bTokenChars==0 || bTokenChars==1) );
   264    264             if( bToken!=bTokenChars && sqlite3Fts5UnicodeIsdiacritic(iCode)==0 ){
   265    265               int i;
   266    266               for(i=0; i<nNew; i++){

Changes to mptest/mptest.c.

   418    418   }
   419    419   
   420    420   /* Append n bytes of text to a string.  If n<0 append the entire string. */
   421    421   static void stringAppend(String *p, const char *z, int n){
   422    422     if( n<0 ) n = (int)strlen(z);
   423    423     if( p->n+n>=p->nAlloc ){
   424    424       int nAlloc = p->nAlloc*2 + n + 100;
   425         -    char *z = sqlite3_realloc(p->z, nAlloc);
   426         -    if( z==0 ) fatalError("out of memory");
   427         -    p->z = z;
          425  +    char *zNew = sqlite3_realloc(p->z, nAlloc);
          426  +    if( zNew==0 ) fatalError("out of memory");
          427  +    p->z = zNew;
   428    428       p->nAlloc = nAlloc;
   429    429     }
   430    430     memcpy(p->z+p->n, z, n);
   431    431     p->n += n;
   432    432     p->z[p->n] = 0;
   433    433   }
   434    434   

Changes to src/test8.c.

   859    859       pConstraint = &pIdxInfo->aConstraint[ii];
   860    860       pUsage = &pIdxInfo->aConstraintUsage[ii];
   861    861   
   862    862       if( !isIgnoreUsable && !pConstraint->usable ) continue;
   863    863   
   864    864       iCol = pConstraint->iColumn;
   865    865       if( iCol<0 || pVtab->aIndex[iCol] ){
   866         -      char *zCol = iCol>=0 ? pVtab->aCol[iCol] : "rowid";
          866  +      char *zNewCol = iCol>=0 ? pVtab->aCol[iCol] : "rowid";
   867    867         char *zOp = 0;
   868    868         useIdx = 1;
   869    869         switch( pConstraint->op ){
   870    870           case SQLITE_INDEX_CONSTRAINT_EQ:
   871    871             zOp = "="; break;
   872    872           case SQLITE_INDEX_CONSTRAINT_LT:
   873    873             zOp = "<"; break;
................................................................................
   891    891           case SQLITE_INDEX_CONSTRAINT_GLOB:
   892    892             zOp = "glob"; break;
   893    893           case SQLITE_INDEX_CONSTRAINT_REGEXP:
   894    894             zOp = "regexp"; break;
   895    895         }
   896    896         if( zOp[0]=='L' ){
   897    897           zNew = sqlite3_mprintf(" %s %s LIKE (SELECT '%%'||?||'%%')", 
   898         -                               zSep, zCol);
          898  +                               zSep, zNewCol);
   899    899         } else {
   900         -        zNew = sqlite3_mprintf(" %s %s %s ?", zSep, zCol, zOp);
          900  +        zNew = sqlite3_mprintf(" %s %s %s ?", zSep, zNewCol, zOp);
   901    901         }
   902    902         string_concat(&zQuery, zNew, 1, &rc);
   903    903   
   904    904         zSep = "AND";
   905    905         pUsage->argvIndex = ++nArg;
   906    906         pUsage->omit = 1;
   907    907       }
................................................................................
   911    911     ** on a column that this virtual table has an index for, then consume 
   912    912     ** the ORDER BY clause.
   913    913     */
   914    914     if( pIdxInfo->nOrderBy==1 && (
   915    915           pIdxInfo->aOrderBy->iColumn<0 ||
   916    916           pVtab->aIndex[pIdxInfo->aOrderBy->iColumn]) ){
   917    917       int iCol = pIdxInfo->aOrderBy->iColumn;
   918         -    char *zCol = iCol>=0 ? pVtab->aCol[iCol] : "rowid";
          918  +    char *zNewCol = iCol>=0 ? pVtab->aCol[iCol] : "rowid";
   919    919       char *zDir = pIdxInfo->aOrderBy->desc?"DESC":"ASC";
   920         -    zNew = sqlite3_mprintf(" ORDER BY %s %s", zCol, zDir);
          920  +    zNew = sqlite3_mprintf(" ORDER BY %s %s", zNewCol, zDir);
   921    921       string_concat(&zQuery, zNew, 1, &rc);
   922    922       pIdxInfo->orderByConsumed = 1;
   923    923     }
   924    924   
   925    925     appendToEchoModule(pVtab->interp, "xBestIndex");;
   926    926     appendToEchoModule(pVtab->interp, zQuery);
   927    927   

Changes to src/test_loadext.c.

    30     30   ** SQL functions to call the sqlite3_status function and return results.
    31     31   */
    32     32   static void statusFunc(
    33     33     sqlite3_context *context,
    34     34     int argc,
    35     35     sqlite3_value **argv
    36     36   ){
    37         -  int op, mx, cur, resetFlag, rc;
           37  +  int op = 0, mx, cur, resetFlag, rc;
    38     38     if( sqlite3_value_type(argv[0])==SQLITE_INTEGER ){
    39     39       op = sqlite3_value_int(argv[0]);
    40     40     }else if( sqlite3_value_type(argv[0])==SQLITE_TEXT ){
    41     41       int i;
    42     42       const char *zName;
    43     43       static const struct {
    44     44         const char *zName;

Changes to src/vdbe.c.

  2520   2520         */
  2521   2521         if( (zHdr>=zEndHdr && (zHdr>zEndHdr || offset64!=pC->payloadSize))
  2522   2522          || (offset64 > pC->payloadSize)
  2523   2523         ){
  2524   2524           rc = SQLITE_CORRUPT_BKPT;
  2525   2525           goto op_column_error;
  2526   2526         }
         2527  +    }else{
         2528  +      VVA_ONLY( t = 0; ) /* Only needed by assert() statements */
  2527   2529       }
  2528   2530   
  2529   2531       /* If after trying to extract new entries from the header, nHdrParsed is
  2530   2532       ** still not up to p2, that means that the record has fewer than p2
  2531   2533       ** columns.  So the result will be either the default value or a NULL.
  2532   2534       */
  2533   2535       if( pC->nHdrParsed<=p2 ){

Changes to tool/showdb.c.

  1148   1148           a = fileRead(ofst, nByte);
  1149   1149           decode_btree_page(a, iStart, hdrSize, &zLeft[1]);
  1150   1150           sqlite3_free(a);
  1151   1151           continue;
  1152   1152         }else if( zLeft && zLeft[0]=='t' ){
  1153   1153           int detail = 0;
  1154   1154           int recursive = 0;
  1155         -        int i;
  1156         -        for(i=1; zLeft[i]; i++){
  1157         -          if( zLeft[i]=='r' ) recursive = 1;
  1158         -          if( zLeft[i]=='d' ) detail = 1;
         1155  +        int j;
         1156  +        for(j=1; zLeft[j]; j++){
         1157  +          if( zLeft[j]=='r' ) recursive = 1;
         1158  +          if( zLeft[j]=='d' ) detail = 1;
  1159   1159           }
  1160   1160           decode_trunk_page(iStart, detail, recursive);
  1161   1161           continue;
  1162   1162         }else{
  1163   1163           iEnd = iStart;
  1164   1164         }
  1165   1165         if( iStart<1 || iEnd<iStart || iEnd>g.mxPage ){