/ Check-in [b451c0f9]
Login

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

Overview
Comment:Fix compiler warnings on GCC and MSVC and fix a C89-ism that broke the build for MSVC.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: b451c0f97f0abe78ebe6c62ff489ec1ad8a1f767
User & Date: drh 2012-03-30 00:00:36
Context
2012-03-30
00:05
In the ".output" command of the shell, if the first character of the output filename is '|' then use popen() instead of fopen(). check-in: fa82062c user: drh tags: trunk
00:00
Fix compiler warnings on GCC and MSVC and fix a C89-ism that broke the build for MSVC. check-in: b451c0f9 user: drh tags: trunk
2012-03-29
15:11
Merge fts4-incr-merge with trunk. check-in: 4d6de3e9 user: dan tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to ext/fts3/fts3.c.

  3135   3135     ** nMinMerge.
  3136   3136     **
  3137   3137     ** Of course, updating the input segments also involves deleting a bunch
  3138   3138     ** of blocks from the segments table. But this is not considered overhead
  3139   3139     ** as it would also be required by a crisis-merge that used the same input 
  3140   3140     ** segments.
  3141   3141     */
  3142         -  const int nMinMerge = 64;       /* Minimum amount of incr-merge work to do */
         3142  +  const u32 nMinMerge = 64;       /* Minimum amount of incr-merge work to do */
  3143   3143   
  3144   3144     Fts3Table *p = (Fts3Table*)pVtab;
  3145   3145     int rc = sqlite3Fts3PendingTermsFlush(p);
  3146   3146   
  3147   3147     if( rc==SQLITE_OK && p->bAutoincrmerge==1 && p->nLeafAdd>(nMinMerge/16) ){
  3148   3148       int mxLevel = 0;              /* Maximum relative level value in db */
  3149   3149       int A;                        /* Incr-merge parameter A */
  3150   3150   
  3151   3151       rc = sqlite3Fts3MaxLevel(p, &mxLevel);
  3152   3152       assert( rc==SQLITE_OK || mxLevel==0 );
  3153   3153       A = p->nLeafAdd * mxLevel;
  3154   3154       A += (A/2);
  3155         -    if( A>nMinMerge ) rc = sqlite3Fts3Incrmerge(p, A, 8);
         3155  +    if( A>(int)nMinMerge ) rc = sqlite3Fts3Incrmerge(p, A, 8);
  3156   3156     }
  3157   3157     sqlite3Fts3SegmentsClose(p);
  3158   3158     return rc;
  3159   3159   }
  3160   3160   
  3161   3161   /*
  3162   3162   ** Implementation of xBegin() method. This is a no-op.

Changes to ext/fts3/fts3_write.c.

  3982   3982       if( rc==SQLITE_OK && bAppendable ){
  3983   3983         /* It is possible to append to this segment. Set up the IncrmergeWriter
  3984   3984         ** object to do so.  */
  3985   3985         int i;
  3986   3986         int nHeight = (int)aRoot[0];
  3987   3987         NodeWriter *pNode;
  3988   3988   
  3989         -      pWriter->nLeafEst = ((iEnd - iStart) + 1) / FTS_MAX_APPENDABLE_HEIGHT;
         3989  +      pWriter->nLeafEst = (int)((iEnd - iStart) + 1)/FTS_MAX_APPENDABLE_HEIGHT;
  3990   3990         pWriter->iStart = iStart;
  3991   3991         pWriter->iEnd = iEnd;
  3992   3992         pWriter->iAbsLevel = iAbsLevel;
  3993   3993         pWriter->iIdx = iIdx;
  3994   3994   
  3995   3995         for(i=nHeight+1; i<FTS_MAX_APPENDABLE_HEIGHT; i++){
  3996   3996           pWriter->aNodeWriter[i].iBlock = pWriter->iStart + i*pWriter->nLeafEst;
................................................................................
  4001   4001         blobGrowBuffer(&pNode->block, MAX(nRoot, p->nNodeSize), &rc);
  4002   4002         if( rc==SQLITE_OK ){
  4003   4003           memcpy(pNode->block.a, aRoot, nRoot);
  4004   4004           pNode->block.n = nRoot;
  4005   4005         }
  4006   4006   
  4007   4007         for(i=nHeight; i>=0 && rc==SQLITE_OK; i--){
  4008         -        pNode = &pWriter->aNodeWriter[i];
  4009   4008           NodeReader reader;
         4009  +        pNode = &pWriter->aNodeWriter[i];
  4010   4010   
  4011   4011           rc = nodeReaderInit(&reader, pNode->block.a, pNode->block.n);
  4012   4012           while( reader.aNode && rc==SQLITE_OK ) rc = nodeReaderNext(&reader);
  4013   4013           blobGrowBuffer(&pNode->key, reader.term.n, &rc);
  4014   4014           if( rc==SQLITE_OK ){
  4015   4015             memcpy(pNode->key.a, reader.term.a, reader.term.n);
  4016   4016             pNode->key.n = reader.term.n;
................................................................................
  4098   4098     sqlite3_int64 iAbsLevel,        /* Absolute level of input segments */
  4099   4099     int iIdx,                       /* Index of new output segment */
  4100   4100     Fts3MultiSegReader *pCsr,       /* Cursor that data will be read from */
  4101   4101     IncrmergeWriter *pWriter        /* Populate this object */
  4102   4102   ){
  4103   4103     int rc;                         /* Return Code */
  4104   4104     int i;                          /* Iterator variable */
  4105         -  int nLeafEst;                   /* Blocks allocated for leaf nodes */
         4105  +  int nLeafEst = 0;               /* Blocks allocated for leaf nodes */
  4106   4106     sqlite3_stmt *pLeafEst = 0;     /* SQL used to determine nLeafEst */
  4107   4107     sqlite3_stmt *pFirstBlock = 0;  /* SQL used to determine first block */
  4108   4108   
  4109   4109     /* Calculate nLeafEst. */
  4110   4110     rc = fts3SqlStmt(p, SQL_MAX_LEAF_NODE_ESTIMATE, &pLeafEst, 0);
  4111   4111     if( rc==SQLITE_OK ){
  4112   4112       sqlite3_bind_int64(pLeafEst, 1, iAbsLevel);
................................................................................
  4851   4851               }else{
  4852   4852                 pCsr += sqlite3Fts3GetVarint(pCsr, &iVal);
  4853   4853                 iDocid += iVal;
  4854   4854               }
  4855   4855             }else{
  4856   4856               iPos += (iVal - 2);
  4857   4857               cksum = cksum ^ fts3ChecksumEntry(
  4858         -                csr.zTerm, csr.nTerm, iLangid, iIndex, iDocid, iCol, iPos
         4858  +                csr.zTerm, csr.nTerm, iLangid, iIndex, iDocid,
         4859  +                (int)iCol, (int)iPos
  4859   4860               );
  4860   4861             }
  4861   4862           }
  4862   4863         }
  4863   4864       }
  4864   4865     }
  4865   4866     sqlite3Fts3SegReaderFinish(&csr);

Changes to src/expr.c.

  2595   2595   
  2596   2596           /* For length() and typeof() functions with a column argument,
  2597   2597           ** set the P5 parameter to the OP_Column opcode to OPFLAG_LENGTHARG
  2598   2598           ** or OPFLAG_TYPEOFARG respectively, to avoid unnecessary data
  2599   2599           ** loading.
  2600   2600           */
  2601   2601           if( (pDef->flags & (SQLITE_FUNC_LENGTH|SQLITE_FUNC_TYPEOF))!=0 ){
  2602         -          u8 op;
         2602  +          u8 exprOp;
  2603   2603             assert( nFarg==1 );
  2604   2604             assert( pFarg->a[0].pExpr!=0 );
  2605         -          op = pFarg->a[0].pExpr->op;
  2606         -          if( op==TK_COLUMN || op==TK_AGG_COLUMN ){
         2605  +          exprOp = pFarg->a[0].pExpr->op;
         2606  +          if( exprOp==TK_COLUMN || exprOp==TK_AGG_COLUMN ){
  2607   2607               assert( SQLITE_FUNC_LENGTH==OPFLAG_LENGTHARG );
  2608   2608               assert( SQLITE_FUNC_TYPEOF==OPFLAG_TYPEOFARG );
  2609   2609               testcase( pDef->flags==SQLITE_FUNC_LENGTH );
  2610   2610               pFarg->a[0].pExpr->op2 = pDef->flags;
  2611   2611             }
  2612   2612           }
  2613   2613