/ Check-in [a7e5fcd6]
Login
SQLite training in Houston TX on 2019-11-05 (details)
Part of the 2019 Tcl Conference

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

Overview
Comment:Fix harmless compiler warnings.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: a7e5fcd66659750eb2f4675082df324e7cf35427
User & Date: drh 2013-12-11 11:00:44
Context
2013-12-11
12:02
Remove an unreachable conditional inserted by the previous check-in. check-in: 3e1d55f0 user: drh tags: trunk
11:00
Fix harmless compiler warnings. check-in: a7e5fcd6 user: drh tags: trunk
02:21
Fix harmless compiler warning. check-in: 2525296d user: mistachkin tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to src/func.c.

  1507   1507         if( argc==2 ){
  1508   1508           zSep = (char*)sqlite3_value_text(argv[1]);
  1509   1509           nSep = sqlite3_value_bytes(argv[1]);
  1510   1510         }else{
  1511   1511           zSep = ",";
  1512   1512           nSep = 1;
  1513   1513         }
  1514         -      sqlite3StrAccumAppend(pAccum, zSep, nSep);
         1514  +      if( nSep ) sqlite3StrAccumAppend(pAccum, zSep, nSep);
  1515   1515       }
  1516   1516       zVal = (char*)sqlite3_value_text(argv[0]);
  1517   1517       nVal = sqlite3_value_bytes(argv[0]);
  1518         -    sqlite3StrAccumAppend(pAccum, zVal, nVal);
         1518  +    if( nVal ) sqlite3StrAccumAppend(pAccum, zVal, nVal);
  1519   1519     }
  1520   1520   }
  1521   1521   static void groupConcatFinalize(sqlite3_context *context){
  1522   1522     StrAccum *pAccum;
  1523   1523     pAccum = sqlite3_aggregate_context(context, 0);
  1524   1524     if( pAccum ){
  1525   1525       if( pAccum->accError==STRACCUM_TOOBIG ){

Changes to src/pager.c.

  5775   5775     Pager *pPager = pPg->pPager;
  5776   5776   
  5777   5777     assert( (pPg->flags & PGHDR_MMAP)==0 );
  5778   5778     assert( pPager->eState>=PAGER_WRITER_LOCKED );
  5779   5779     assert( pPager->eState!=PAGER_ERROR );
  5780   5780     assert( assert_pager_state(pPager) );
  5781   5781   
  5782         -  if( pPager->sectorSize > pPager->pageSize ){
         5782  +  if( pPager->sectorSize > (u32)pPager->pageSize ){
  5783   5783       Pgno nPageCount;          /* Total number of pages in database file */
  5784   5784       Pgno pg1;                 /* First page of the sector pPg is located on. */
  5785   5785       int nPage = 0;            /* Number of pages starting at pg1 to journal */
  5786   5786       int ii;                   /* Loop counter */
  5787   5787       int needSync = 0;         /* True if any page has PGHDR_NEED_SYNC */
  5788   5788       Pgno nPagePerSector = (pPager->sectorSize/pPager->pageSize);
  5789   5789   

Changes to src/printf.c.

   633    633           /* The precision in %q and %Q means how many input characters to
   634    634           ** consume, not the length of the output...
   635    635           ** if( precision>=0 && precision<length ) length = precision; */
   636    636           break;
   637    637         }
   638    638         case etTOKEN: {
   639    639           Token *pToken = va_arg(ap, Token*);
   640         -        if( pToken ){
          640  +        if( pToken && pToken->n ){
   641    641             sqlite3StrAccumAppend(pAccum, (const char*)pToken->z, pToken->n);
   642    642           }
   643    643           length = width = 0;
   644    644           break;
   645    645         }
   646    646         case etSRCLIST: {
   647    647           SrcList *pSrc = va_arg(ap, SrcList*);
................................................................................
   687    687     }/* End for loop over the format string */
   688    688   } /* End of function */
   689    689   
   690    690   /*
   691    691   ** Append N bytes of text from z to the StrAccum object.
   692    692   */
   693    693   void sqlite3StrAccumAppend(StrAccum *p, const char *z, int N){
   694         -  assert( z!=0 || N==0 );
          694  +  assert( z!=0 );
   695    695     assert( p->zText!=0 || p->nChar==0 || p->accError );
   696    696     assert( N>=0 );
   697    697     assert( p->accError==0 || p->nAlloc==0 );
   698    698     if( p->nChar+N >= p->nAlloc ){
   699    699       char *zNew;
   700    700       if( p->accError ){
   701    701         testcase(p->accError==STRACCUM_TOOBIG);

Changes to src/vdbe.c.

  2658   2658     i = putVarint32(zNewRecord, nHdr);
  2659   2659     j = nHdr;
  2660   2660     assert( pData0<=pLast );
  2661   2661     pRec = pData0;
  2662   2662     do{
  2663   2663       serial_type = sqlite3VdbeSerialType(pRec, file_format);
  2664   2664       i += putVarint32(&zNewRecord[i], serial_type);            /* serial type */
  2665         -    j += sqlite3VdbeSerialPut(&zNewRecord[j], pRec, serial_type, file_format);
         2665  +    j += sqlite3VdbeSerialPut(&zNewRecord[j], pRec, serial_type); /* content */
  2666   2666     }while( (++pRec)<=pLast );
  2667   2667     assert( i==nHdr );
  2668   2668     assert( j==nByte );
  2669   2669   
  2670   2670     assert( pOp->p3>0 && pOp->p3<=(p->nMem-p->nCursor) );
  2671   2671     pOut->n = (int)nByte;
  2672   2672     pOut->flags = MEM_Blob | MEM_Dyn;
................................................................................
  3711   3711     UnpackedRecord r;
  3712   3712     char aTempRec[ROUND8(sizeof(UnpackedRecord)) + sizeof(Mem)*4 + 7];
  3713   3713   
  3714   3714   #ifdef SQLITE_TEST
  3715   3715     if( pOp->opcode!=OP_NoConflict ) sqlite3_found_count++;
  3716   3716   #endif
  3717   3717   
  3718         -  alreadyExists = 0;
  3719   3718     assert( pOp->p1>=0 && pOp->p1<p->nCursor );
  3720   3719     assert( pOp->p4type==P4_INT32 );
  3721   3720     pC = p->apCsr[pOp->p1];
  3722   3721     assert( pC!=0 );
  3723   3722     pIn3 = &aMem[pOp->p3];
  3724   3723     assert( pC->pCursor!=0 );
  3725   3724     assert( pC->isTable==0 );
         3725  +  pFree = 0;  /* Not needed.  Only used to suppress a compiler warning. */
  3726   3726     if( pOp->p4.i>0 ){
  3727   3727       r.pKeyInfo = pC->pKeyInfo;
  3728   3728       r.nField = (u16)pOp->p4.i;
  3729   3729       r.aMem = pIn3;
  3730   3730   #ifdef SQLITE_DEBUG
  3731   3731       {
  3732   3732         int i;
................................................................................
  5349   5349   ** within a sub-program). Set the value of register P1 to the maximum of 
  5350   5350   ** its current value and the value in register P2.
  5351   5351   **
  5352   5352   ** This instruction throws an error if the memory cell is not initially
  5353   5353   ** an integer.
  5354   5354   */
  5355   5355   case OP_MemMax: {        /* in2 */
  5356         -  Mem *pIn1;
  5357   5356     VdbeFrame *pFrame;
  5358   5357     if( p->pFrame ){
  5359   5358       for(pFrame=p->pFrame; pFrame->pParent; pFrame=pFrame->pParent);
  5360   5359       pIn1 = &pFrame->aMem[pOp->p1];
  5361   5360     }else{
  5362   5361       pIn1 = &aMem[pOp->p1];
  5363   5362     }

Changes to src/vdbeInt.h.

   385    385   void sqliteVdbePopStack(Vdbe*,int);
   386    386   int sqlite3VdbeCursorMoveto(VdbeCursor*);
   387    387   #if defined(SQLITE_DEBUG) || defined(VDBE_PROFILE)
   388    388   void sqlite3VdbePrintOp(FILE*, int, Op*);
   389    389   #endif
   390    390   u32 sqlite3VdbeSerialTypeLen(u32);
   391    391   u32 sqlite3VdbeSerialType(Mem*, int);
   392         -u32 sqlite3VdbeSerialPut(unsigned char*, Mem*, u32, int);
          392  +u32 sqlite3VdbeSerialPut(unsigned char*, Mem*, u32);
   393    393   u32 sqlite3VdbeSerialGet(const unsigned char*, u32, Mem*);
   394    394   void sqlite3VdbeDeleteAuxData(Vdbe*, int, int);
   395    395   
   396    396   int sqlite2BtreeKeyCompare(BtCursor *, const void *, int, int, int *);
   397    397   int sqlite3VdbeIdxKeyCompare(VdbeCursor*,UnpackedRecord*,int*);
   398    398   int sqlite3VdbeIdxRowid(sqlite3*, BtCursor *, i64 *);
   399    399   int sqlite3MemCompare(const Mem*, const Mem*, const CollSeq*);

Changes to src/vdbeaux.c.

  2831   2831   ** for allocating enough space to buf[] to hold the entire field, exclusive
  2832   2832   ** of the pMem->u.nZero bytes for a MEM_Zero value.
  2833   2833   **
  2834   2834   ** Return the number of bytes actually written into buf[].  The number
  2835   2835   ** of bytes in the zero-filled tail is included in the return value only
  2836   2836   ** if those bytes were zeroed in buf[].
  2837   2837   */ 
  2838         -u32 sqlite3VdbeSerialPut(u8 *buf, Mem *pMem, u32 serial_type, int file_format){
         2838  +u32 sqlite3VdbeSerialPut(u8 *buf, Mem *pMem, u32 serial_type){
  2839   2839     u32 len;
  2840   2840   
  2841   2841     /* Integer and Real */
  2842   2842     if( serial_type<=7 && serial_type>0 ){
  2843   2843       u64 v;
  2844   2844       u32 i;
  2845   2845       if( serial_type==7 ){

Changes to src/vdbemem.c.

  1215   1215     nRet = 1 + nSerial + nVal;
  1216   1216     aRet = sqlite3DbMallocRaw(db, nRet);
  1217   1217     if( aRet==0 ){
  1218   1218       sqlite3_result_error_nomem(context);
  1219   1219     }else{
  1220   1220       aRet[0] = nSerial+1;
  1221   1221       sqlite3PutVarint(&aRet[1], iSerial);
  1222         -    sqlite3VdbeSerialPut(&aRet[1+nSerial], argv[0], iSerial, file_format);
         1222  +    sqlite3VdbeSerialPut(&aRet[1+nSerial], argv[0], iSerial);
  1223   1223       sqlite3_result_blob(context, aRet, nRet, SQLITE_TRANSIENT);
  1224   1224       sqlite3DbFree(db, aRet);
  1225   1225     }
  1226   1226   }
  1227   1227   
  1228   1228   /*
  1229   1229   ** Register built-in functions used to help read ANALYZE data.

Changes to src/vdbetrace.c.

    86     86     db = p->db;
    87     87     sqlite3StrAccumInit(&out, zBase, sizeof(zBase), 
    88     88                         db->aLimit[SQLITE_LIMIT_LENGTH]);
    89     89     out.db = db;
    90     90     if( db->nVdbeExec>1 ){
    91     91       while( *zRawSql ){
    92     92         const char *zStart = zRawSql;
           93  +      int n;
    93     94         while( *(zRawSql++)!='\n' && *zRawSql );
    94     95         sqlite3StrAccumAppend(&out, "-- ", 3);
    95         -      sqlite3StrAccumAppend(&out, zStart, (int)(zRawSql-zStart));
           96  +      n = (int)(zRawSql - zStart);
           97  +      if( n ) sqlite3StrAccumAppend(&out, zStart, n);
    96     98       }
    97     99     }else{
    98    100       while( zRawSql[0] ){
    99    101         n = findNextHostParameter(zRawSql, &nToken);
   100    102         assert( n>0 );
   101    103         sqlite3StrAccumAppend(&out, zRawSql, n);
   102    104         zRawSql += n;