/ Check-in [bd4f156d]
Login

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

Overview
Comment:Fix warnings in fts5 code.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: bd4f156d07d0db1f063d42891965920fc2229352
User & Date: dan 2015-07-24 20:34:40
Context
2015-07-24
20:43
For Windows CE, a different header is required for the byteswap intrinsics. check-in: 2d572b8c user: mistachkin tags: trunk
20:34
Fix warnings in fts5 code. check-in: bd4f156d user: dan tags: trunk
19:56
Fix the pragma2.test module so that it works with SQLITE_ENABLE_MEMORY_MANAGEMENT. check-in: de281a4f user: drh tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to ext/fts5/fts5_expr.c.

    56     56   
    57     57     i64 iRowid;                     /* Current rowid */
    58     58     Fts5ExprNearset *pNear;         /* For FTS5_STRING - cluster of phrases */
    59     59   
    60     60     /* Child nodes. For a NOT node, this array always contains 2 entries. For 
    61     61     ** AND or OR nodes, it contains 2 or more entries.  */
    62     62     int nChild;                     /* Number of child nodes */
    63         -  Fts5ExprNode *apChild[0];       /* Array of child nodes */
           63  +  Fts5ExprNode *apChild[1];       /* Array of child nodes */
    64     64   };
    65     65   
    66     66   #define Fts5NodeIsString(p) ((p)->eType==FTS5_TERM || (p)->eType==FTS5_STRING)
    67     67   
    68     68   /*
    69     69   ** An instance of the following structure represents a single search term
    70     70   ** or term prefix.
................................................................................
  1615   1615         nChild = 2;
  1616   1616       }else if( eType==FTS5_AND || eType==FTS5_OR ){
  1617   1617         nChild = 2;
  1618   1618         if( pLeft->eType==eType ) nChild += pLeft->nChild-1;
  1619   1619         if( pRight->eType==eType ) nChild += pRight->nChild-1;
  1620   1620       }
  1621   1621   
  1622         -    nByte = sizeof(Fts5ExprNode) + sizeof(Fts5ExprNode*)*nChild;
         1622  +    nByte = sizeof(Fts5ExprNode) + sizeof(Fts5ExprNode*)*(nChild-1);
  1623   1623       pRet = (Fts5ExprNode*)sqlite3Fts5MallocZero(&pParse->rc, nByte);
  1624   1624   
  1625   1625       if( pRet ){
  1626   1626         pRet->eType = eType;
  1627   1627         pRet->pNear = pNear;
  1628   1628         if( eType==FTS5_STRING ){
  1629   1629           int iPhrase;

Changes to ext/fts5/fts5_index.c.

  3750   3750     bOldest = (pLvlOut->nSeg==1 && pStruct->nLevel==iLvl+2);
  3751   3751   
  3752   3752     assert( iLvl>=0 );
  3753   3753     for(fts5MultiIterNew(p, pStruct, 0, 0, 0, 0, iLvl, nInput, &pIter);
  3754   3754         fts5MultiIterEof(p, pIter)==0;
  3755   3755         fts5MultiIterNext(p, pIter, 0, 0)
  3756   3756     ){
  3757         -    Fts5SegIter *pSeg = &pIter->aSeg[ pIter->aFirst[1].iFirst ];
         3757  +    Fts5SegIter *pSegIter = &pIter->aSeg[ pIter->aFirst[1].iFirst ];
  3758   3758       int nPos;                     /* position-list size field value */
  3759   3759       int nTerm;
  3760   3760       const u8 *pTerm;
  3761   3761   
  3762   3762       /* Check for key annihilation. */
  3763         -    if( pSeg->nPos==0 && (bOldest || pSeg->bDel==0) ) continue;
         3763  +    if( pSegIter->nPos==0 && (bOldest || pSegIter->bDel==0) ) continue;
  3764   3764   
  3765   3765       pTerm = fts5MultiIterTerm(pIter, &nTerm);
  3766   3766       if( nTerm!=term.n || memcmp(pTerm, term.p, nTerm) ){
  3767   3767         if( pnRem && writer.nLeafWritten>nRem ){
  3768   3768           break;
  3769   3769         }
  3770   3770   
................................................................................
  3775   3775         fts5WriteAppendTerm(p, &writer, nTerm, pTerm);
  3776   3776         fts5BufferSet(&p->rc, &term, nTerm, pTerm);
  3777   3777         bRequireDoclistTerm = 1;
  3778   3778       }
  3779   3779   
  3780   3780       /* Append the rowid to the output */
  3781   3781       /* WRITEPOSLISTSIZE */
  3782         -    nPos = pSeg->nPos*2 + pSeg->bDel;
         3782  +    nPos = pSegIter->nPos*2 + pSegIter->bDel;
  3783   3783       fts5WriteAppendRowid(p, &writer, fts5MultiIterRowid(pIter), nPos);
  3784   3784   
  3785   3785       /* Append the position-list data to the output */
  3786         -    fts5ChunkIterate(p, pSeg, (void*)&writer, fts5MergeChunkCallback);
         3786  +    fts5ChunkIterate(p, pSegIter, (void*)&writer, fts5MergeChunkCallback);
  3787   3787     }
  3788   3788   
  3789   3789     /* Flush the last leaf page to disk. Set the output segment b-tree height
  3790   3790     ** and last leaf page number at the same time.  */
  3791   3791     fts5WriteFinish(p, &writer, &pSeg->nHeight, &pSeg->pgnoLast);
  3792   3792   
  3793   3793     if( fts5MultiIterEof(p, pIter) ){