/ Check-in [fe62179e]
Login

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

Overview
Comment:Fix various harmless compiler warnings in FTS3 and RTREE.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: fe62179efdea40887e23a16f898060b879013824
User & Date: drh 2011-06-20 17:24:29
Context
2011-06-20
17:41
Update a couple test scripts to account for more floating point display variation in Windows-based versions of TCL. check-in: a4a8402b user: shaneh tags: trunk
17:24
Fix various harmless compiler warnings in FTS3 and RTREE. check-in: fe62179e user: drh tags: trunk
15:24
Enable crnl to nl translation for the mksqlite3c.tcl script. check-in: 161379d2 user: drh tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to ext/fts3/fts3.c.

  1090   1090     p->zDb = zCsr;
  1091   1091     memcpy(zCsr, argv[1], nDb);
  1092   1092     zCsr += nDb;
  1093   1093   
  1094   1094     /* Fill in the azColumn array */
  1095   1095     for(iCol=0; iCol<nCol; iCol++){
  1096   1096       char *z; 
  1097         -    int n;
         1097  +    int n = 0;
  1098   1098       z = (char *)sqlite3Fts3NextToken(aCol[iCol], &n);
  1099   1099       memcpy(zCsr, z, n);
  1100   1100       zCsr[n] = '\0';
  1101   1101       sqlite3Fts3Dequote(zCsr);
  1102   1102       p->azColumn[iCol] = zCsr;
  1103   1103       zCsr += n+1;
  1104   1104       assert( zCsr <= &((char *)p)[nByte] );

Changes to ext/fts3/fts3_snippet.c.

  1020   1020   
  1021   1021         case FTS3_MATCHINFO_NCOL:
  1022   1022           if( bGlobal ) pInfo->aMatchinfo[0] = pInfo->nCol;
  1023   1023           break;
  1024   1024           
  1025   1025         case FTS3_MATCHINFO_NDOC:
  1026   1026           if( bGlobal ){
  1027         -          sqlite3_int64 nDoc;
         1027  +          sqlite3_int64 nDoc = 0;
  1028   1028             rc = fts3MatchinfoSelectDoctotal(pTab, &pSelect, &nDoc, 0);
  1029   1029             pInfo->aMatchinfo[0] = (u32)nDoc;
  1030   1030           }
  1031   1031           break;
  1032   1032   
  1033   1033         case FTS3_MATCHINFO_AVGLENGTH: 
  1034   1034           if( bGlobal ){

Changes to ext/fts3/fts3_term.c.

    17     17   
    18     18   #include "fts3Int.h"
    19     19   #if !defined(SQLITE_CORE) || defined(SQLITE_ENABLE_FTS3)
    20     20   #ifdef SQLITE_TEST
    21     21   
    22     22   #include <string.h>
    23     23   #include <assert.h>
           24  +#include <stdlib.h>
    24     25   
    25     26   typedef struct Fts3termTable Fts3termTable;
    26     27   typedef struct Fts3termCursor Fts3termCursor;
    27     28   
    28     29   struct Fts3termTable {
    29     30     sqlite3_vtab base;              /* Base class used by SQLite core */
    30     31     int iIndex;                     /* Index for Fts3Table.aIndex[] */

Changes to ext/fts3/fts3_test.c.

   275    275     Tcl_Interp *interp,
   276    276     int objc,
   277    277     Tcl_Obj *CONST objv[]
   278    278   ){
   279    279   #ifdef SQLITE_ENABLE_FTS3
   280    280     extern int test_fts3_node_chunksize;
   281    281     extern int test_fts3_node_chunk_threshold;
   282         -  int iArg1;
   283         -  int iArg2;
   284    282     Tcl_Obj *pRet;
   285    283   
   286    284     if( objc!=1 && objc!=3 ){
   287    285       Tcl_WrongNumArgs(interp, 1, objv, "?CHUNKSIZE THRESHOLD?");
   288    286       return TCL_ERROR;
   289    287     }
   290    288   

Changes to ext/fts3/fts3_tokenizer.c.

   152    152     Fts3Hash *pHash,                /* Tokenizer hash table */
   153    153     const char *zArg,               /* Tokenizer name */
   154    154     sqlite3_tokenizer **ppTok,      /* OUT: Tokenizer (if applicable) */
   155    155     char **pzErr                    /* OUT: Set to malloced error message */
   156    156   ){
   157    157     int rc;
   158    158     char *z = (char *)zArg;
   159         -  int n;
          159  +  int n = 0;
   160    160     char *zCopy;
   161    161     char *zEnd;                     /* Pointer to nul-term of zCopy */
   162    162     sqlite3_tokenizer_module *m;
   163    163   
   164    164     zCopy = sqlite3_mprintf("%s", zArg);
   165    165     if( !zCopy ) return SQLITE_NOMEM;
   166    166     zEnd = &zCopy[strlen(zCopy)];

Changes to ext/rtree/rtree.c.

  1561   1561     int rc;
  1562   1562     int ii;
  1563   1563     RtreeNode *pNode;
  1564   1564     rc = nodeAcquire(pRtree, 1, 0, &pNode);
  1565   1565   
  1566   1566     for(ii=0; rc==SQLITE_OK && ii<(pRtree->iDepth-iHeight); ii++){
  1567   1567       int iCell;
  1568         -    sqlite3_int64 iBest;
         1568  +    sqlite3_int64 iBest = 0;
  1569   1569   
  1570         -    float fMinGrowth;
  1571         -    float fMinArea;
  1572         -    float fMinOverlap;
         1570  +    float fMinGrowth = 0.0;
         1571  +    float fMinArea = 0.0;
         1572  +    float fMinOverlap = 0.0;
  1573   1573   
  1574   1574       int nCell = NCELL(pNode);
  1575   1575       RtreeCell cell;
  1576   1576       RtreeNode *pChild;
  1577   1577   
  1578   1578       RtreeCell *aCell = 0;
  1579   1579   
................................................................................
  1995   1995     RtreeCell *pBboxLeft,
  1996   1996     RtreeCell *pBboxRight
  1997   1997   ){
  1998   1998     int **aaSorted;
  1999   1999     int *aSpare;
  2000   2000     int ii;
  2001   2001   
  2002         -  int iBestDim;
  2003         -  int iBestSplit;
  2004         -  float fBestMargin;
         2002  +  int iBestDim = 0;
         2003  +  int iBestSplit = 0;
         2004  +  float fBestMargin = 0.0;
  2005   2005   
  2006   2006     int nByte = (pRtree->nDim+1)*(sizeof(int*)+nCell*sizeof(int));
  2007   2007   
  2008   2008     aaSorted = (int **)sqlite3_malloc(nByte);
  2009   2009     if( !aaSorted ){
  2010   2010       return SQLITE_NOMEM;
  2011   2011     }
................................................................................
  2019   2019         aaSorted[ii][jj] = jj;
  2020   2020       }
  2021   2021       SortByDimension(pRtree, aaSorted[ii], nCell, ii, aCell, aSpare);
  2022   2022     }
  2023   2023   
  2024   2024     for(ii=0; ii<pRtree->nDim; ii++){
  2025   2025       float margin = 0.0;
  2026         -    float fBestOverlap;
  2027         -    float fBestArea;
  2028         -    int iBestLeft;
         2026  +    float fBestOverlap = 0.0;
         2027  +    float fBestArea = 0.0;
         2028  +    int iBestLeft = 0;
  2029   2029       int nLeft;
  2030   2030   
  2031   2031       for(
  2032   2032         nLeft=RTREE_MINCELLS(pRtree); 
  2033   2033         nLeft<=(nCell-RTREE_MINCELLS(pRtree)); 
  2034   2034         nLeft++
  2035   2035       ){
................................................................................
  2336   2336   }
  2337   2337   
  2338   2338   static int deleteCell(Rtree *, RtreeNode *, int, int);
  2339   2339   
  2340   2340   static int removeNode(Rtree *pRtree, RtreeNode *pNode, int iHeight){
  2341   2341     int rc;
  2342   2342     int rc2;
  2343         -  RtreeNode *pParent;
         2343  +  RtreeNode *pParent = 0;
  2344   2344     int iCell;
  2345   2345   
  2346   2346     assert( pNode->nRef==1 );
  2347   2347   
  2348   2348     /* Remove the entry in the parent cell. */
  2349   2349     rc = nodeParentIndex(pRtree, pNode, &iCell);
  2350   2350     if( rc==SQLITE_OK ){
................................................................................
  2987   2987     sqlite3 *db,                    /* Database handle */
  2988   2988     Rtree *pRtree,                  /* Rtree handle */
  2989   2989     int isCreate                    /* True for xCreate, false for xConnect */
  2990   2990   ){
  2991   2991     int rc;
  2992   2992     char *zSql;
  2993   2993     if( isCreate ){
  2994         -    int iPageSize;
         2994  +    int iPageSize = 0;
  2995   2995       zSql = sqlite3_mprintf("PRAGMA %Q.page_size", pRtree->zDb);
  2996   2996       rc = getIntFromStmt(db, zSql, &iPageSize);
  2997   2997       if( rc==SQLITE_OK ){
  2998   2998         pRtree->iNodeSize = iPageSize-64;
  2999   2999         if( (4+pRtree->nBytesPerCell*RTREE_MAXCELLS)<pRtree->iNodeSize ){
  3000   3000           pRtree->iNodeSize = 4+pRtree->nBytesPerCell*RTREE_MAXCELLS;
  3001   3001         }