/ Check-in [1522c2c6]
Login

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

Overview
Comment:Suppress more silly compiler warnings. (CVS 5995)
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 1522c2c6677b97edfa09dd64b4f9ed139aeb5bec
User & Date: drh 2008-12-09 02:51:24
Context
2008-12-09
03:55
Get rid of more silly compiler warnings. (CVS 5996) check-in: 59ae0020 user: drh tags: trunk
02:51
Suppress more silly compiler warnings. (CVS 5995) check-in: 1522c2c6 user: drh tags: trunk
01:32
Fix compiler warnings in where.c and in the TCL test harness. (CVS 5994) check-in: 680755db user: drh tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to src/vdbe.c.

    39     39   **
    40     40   ** Various scripts scan this source file in order to generate HTML
    41     41   ** documentation, headers files, or other derived files.  The formatting
    42     42   ** of the code in this file is, therefore, important.  See other comments
    43     43   ** in this file for details.  If in doubt, do not deviate from existing
    44     44   ** commenting and indentation practices when changing or adding code.
    45     45   **
    46         -** $Id: vdbe.c,v 1.792 2008/12/06 16:46:14 drh Exp $
           46  +** $Id: vdbe.c,v 1.793 2008/12/09 02:51:24 drh Exp $
    47     47   */
    48     48   #include "sqliteInt.h"
    49     49   #include <ctype.h>
    50     50   #include "vdbeInt.h"
    51     51   
    52     52   /*
    53     53   ** The following global variable is incremented every time a cursor
................................................................................
   382    382         if( z<32 || z>126 ) *zCsr++ = '.';
   383    383         else *zCsr++ = z;
   384    384       }
   385    385   
   386    386       sqlite3_snprintf(100, zCsr, "]%s", encnames[pMem->enc]);
   387    387       zCsr += strlen(zCsr);
   388    388       if( f & MEM_Zero ){
   389         -      sqlite3_snprintf(100, zCsr,"+%lldz",pMem->u.i);
          389  +      sqlite3_snprintf(100, zCsr,"+%dz",pMem->u.nZero);
   390    390         zCsr += strlen(zCsr);
   391    391       }
   392    392       *zCsr = '\0';
   393    393     }else if( f & MEM_Str ){
   394    394       int j, k;
   395    395       zBuf[0] = ' ';
   396    396       if( f & MEM_Dyn ){
................................................................................
  2286   2286       serial_type = sqlite3VdbeSerialType(pRec, file_format);
  2287   2287       len = sqlite3VdbeSerialTypeLen(serial_type);
  2288   2288       nData += len;
  2289   2289       nHdr += sqlite3VarintLen(serial_type);
  2290   2290       if( pRec->flags & MEM_Zero ){
  2291   2291         /* Only pure zero-filled BLOBs can be input to this Opcode.
  2292   2292         ** We do not allow blobs with a prefix and a zero-filled tail. */
  2293         -      nZero += pRec->u.i;
         2293  +      nZero += pRec->u.nZero;
  2294   2294       }else if( len ){
  2295   2295         nZero = 0;
  2296   2296       }
  2297   2297     }
  2298   2298   
  2299   2299     /* Add the initial header varint and total the size */
  2300   2300     nHdr += nVarint = sqlite3VarintLen(nHdr);
................................................................................
  2330   2330     assert( i==nByte );
  2331   2331   
  2332   2332     assert( pOp->p3>0 && pOp->p3<=p->nMem );
  2333   2333     pOut->n = nByte;
  2334   2334     pOut->flags = MEM_Blob | MEM_Dyn;
  2335   2335     pOut->xDel = 0;
  2336   2336     if( nZero ){
  2337         -    pOut->u.i = nZero;
         2337  +    pOut->u.nZero = nZero;
  2338   2338       pOut->flags |= MEM_Zero;
  2339   2339     }
  2340   2340     pOut->enc = SQLITE_UTF8;  /* In case the blob is ever converted to text */
  2341   2341     REGISTER_TRACE(pOp->p3, pOut);
  2342   2342     UPDATE_MAX_BLOBSIZE(pOut);
  2343   2343     break;
  2344   2344   }
................................................................................
  3481   3481         pC->pData[pC->nData] = 0;
  3482   3482         pC->pData[pC->nData+1] = 0;
  3483   3483       }
  3484   3484       pC->nullRow = 0;
  3485   3485     }else{
  3486   3486       int nZero;
  3487   3487       if( pData->flags & MEM_Zero ){
  3488         -      nZero = pData->u.i;
         3488  +      nZero = pData->u.nZero;
  3489   3489       }else{
  3490   3490         nZero = 0;
  3491   3491       }
  3492   3492       rc = sqlite3BtreeInsert(pC->pCursor, 0, iKey,
  3493   3493                               pData->z, pData->n, nZero,
  3494   3494                               pOp->p5 & OPFLAG_APPEND);
  3495   3495     }

Changes to src/vdbeInt.h.

    11     11   *************************************************************************
    12     12   ** This is the header file for information that is private to the
    13     13   ** VDBE.  This information used to all be at the top of the single
    14     14   ** source code file "vdbe.c".  When that file became too big (over
    15     15   ** 6000 lines long) it was split up into several smaller files and
    16     16   ** this header information was factored out.
    17     17   **
    18         -** $Id: vdbeInt.h,v 1.159 2008/12/04 20:40:10 drh Exp $
           18  +** $Id: vdbeInt.h,v 1.160 2008/12/09 02:51:24 drh Exp $
    19     19   */
    20     20   #ifndef _VDBEINT_H_
    21     21   #define _VDBEINT_H_
    22     22   
    23     23   /*
    24     24   ** intToKey() and keyToInt() used to transform the rowid.  But with
    25     25   ** the latest versions of the design they are no-ops.
................................................................................
   110    110   ** in a Mem struct is returned by the MemType(Mem*) macro. The type is
   111    111   ** one of SQLITE_NULL, SQLITE_INTEGER, SQLITE_REAL, SQLITE_TEXT or
   112    112   ** SQLITE_BLOB.
   113    113   */
   114    114   struct Mem {
   115    115     union {
   116    116       i64 i;              /* Integer value. */
          117  +    int nZero;          /* Used when bit MEM_Zero is set in flags */
   117    118       FuncDef *pDef;      /* Used only when flags==MEM_Agg */
   118    119       RowSet *pRowSet;    /* Used only when flags==MEM_RowSet */
   119    120     } u;
   120    121     double r;           /* Real value */
   121    122     sqlite3 *db;        /* The associated database connection */
   122    123     char *z;            /* String or BLOB value */
   123    124     int n;              /* Number of characters in string value, excluding '\0' */

Changes to src/vdbeaux.c.

    10     10   **
    11     11   *************************************************************************
    12     12   ** This file contains code used for creating, destroying, and populating
    13     13   ** a VDBE (or an "sqlite3_stmt" as it is known to the outside world.)  Prior
    14     14   ** to version 2.8.7, all this code was combined into the vdbe.c source file.
    15     15   ** But that file was getting too big so this subroutines were split out.
    16     16   **
    17         -** $Id: vdbeaux.c,v 1.423 2008/12/05 15:24:17 drh Exp $
           17  +** $Id: vdbeaux.c,v 1.424 2008/12/09 02:51:24 drh Exp $
    18     18   */
    19     19   #include "sqliteInt.h"
    20     20   #include <ctype.h>
    21     21   #include "vdbeInt.h"
    22     22   
    23     23   
    24     24   
................................................................................
   137    137   */
   138    138   int sqlite3VdbeAddOp3(Vdbe *p, int op, int p1, int p2, int p3){
   139    139     int i;
   140    140     VdbeOp *pOp;
   141    141   
   142    142     i = p->nOp;
   143    143     assert( p->magic==VDBE_MAGIC_INIT );
          144  +  assert( op>0 && op<0xff );
   144    145     if( p->nOpAlloc<=i ){
   145    146       if( growOpArray(p) ){
   146    147         return 0;
   147    148       }
   148    149     }
   149    150     p->nOp++;
   150    151     pOp = &p->aOp[i];
   151         -  pOp->opcode = op;
          152  +  pOp->opcode = (u8)op;
   152    153     pOp->p5 = 0;
   153    154     pOp->p1 = p1;
   154    155     pOp->p2 = p2;
   155    156     pOp->p3 = p3;
   156    157     pOp->p4.p = 0;
   157    158     pOp->p4type = P4_NOTUSED;
   158    159     p->expired = 0;
................................................................................
   539    540     pOp = &p->aOp[addr];
   540    541     freeP4(db, pOp->p4type, pOp->p4.p);
   541    542     pOp->p4.p = 0;
   542    543     if( n==P4_INT32 ){
   543    544       /* Note: this cast is safe, because the origin data point was an int
   544    545       ** that was cast to a (const char *). */
   545    546       pOp->p4.i = SQLITE_PTR_TO_INT(zP4);
   546         -    pOp->p4type = n;
          547  +    pOp->p4type = P4_INT32;
   547    548     }else if( zP4==0 ){
   548    549       pOp->p4.p = 0;
   549    550       pOp->p4type = P4_NOTUSED;
   550    551     }else if( n==P4_KEYINFO ){
   551    552       KeyInfo *pKeyInfo;
   552    553       int nField, nByte;
   553    554   
................................................................................
   569    570         pOp->p4type = P4_NOTUSED;
   570    571       }
   571    572     }else if( n==P4_KEYINFO_HANDOFF ){
   572    573       pOp->p4.p = (void*)zP4;
   573    574       pOp->p4type = P4_KEYINFO;
   574    575     }else if( n<0 ){
   575    576       pOp->p4.p = (void*)zP4;
   576         -    pOp->p4type = n;
          577  +    pOp->p4type = (signed char)n;
   577    578     }else{
   578         -    if( n==0 ) n = strlen(zP4);
          579  +    if( n==0 ) n = (int)strlen(zP4);
   579    580       pOp->p4.z = sqlite3DbStrNDup(p->db, zP4, n);
   580    581       pOp->p4type = P4_DYNAMIC;
   581    582     }
   582    583   }
   583    584   
   584    585   #ifndef NDEBUG
   585    586   /*
................................................................................
   635    636     assert( nTemp>=20 );
   636    637     switch( pOp->p4type ){
   637    638       case P4_KEYINFO_STATIC:
   638    639       case P4_KEYINFO: {
   639    640         int i, j;
   640    641         KeyInfo *pKeyInfo = pOp->p4.pKeyInfo;
   641    642         sqlite3_snprintf(nTemp, zTemp, "keyinfo(%d", pKeyInfo->nField);
   642         -      i = strlen(zTemp);
          643  +      i = (int)strlen(zTemp);
   643    644         for(j=0; j<pKeyInfo->nField; j++){
   644    645           CollSeq *pColl = pKeyInfo->aColl[j];
   645    646           if( pColl ){
   646         -          int n = strlen(pColl->zName);
          647  +          int n = (int)strlen(pColl->zName);
   647    648             if( i+n>nTemp-6 ){
   648    649               memcpy(&zTemp[i],",...",4);
   649    650               break;
   650    651             }
   651    652             zTemp[i++] = ',';
   652    653             if( pKeyInfo->aSortOrder && pKeyInfo->aSortOrder[j] ){
   653    654               zTemp[i++] = '-';
................................................................................
   763    764   /*
   764    765   ** Release an array of N Mem elements
   765    766   */
   766    767   static void releaseMemArray(Mem *p, int N){
   767    768     if( p && N ){
   768    769       Mem *pEnd;
   769    770       sqlite3 *db = p->db;
   770         -    int malloc_failed = db->mallocFailed;
          771  +    u8 malloc_failed = db->mallocFailed;
   771    772       for(pEnd=&p[N]; p<pEnd; p++){
   772    773         assert( (&p[1])==pEnd || p[0].db==p[1].db );
   773    774   
   774    775         /* This block is really an inlined version of sqlite3VdbeMemRelease()
   775    776         ** that takes advantage of the fact that the memory cell value is 
   776    777         ** being set to NULL after releasing any dynamic resources.
   777    778         **
................................................................................
   873    874         pMem->type = SQLITE_INTEGER;
   874    875         pMem->u.i = i;                                /* Program counter */
   875    876         pMem++;
   876    877     
   877    878         pMem->flags = MEM_Static|MEM_Str|MEM_Term;
   878    879         pMem->z = (char*)sqlite3OpcodeName(pOp->opcode);  /* Opcode */
   879    880         assert( pMem->z!=0 );
   880         -      pMem->n = strlen(pMem->z);
          881  +      pMem->n = (int)strlen(pMem->z);
   881    882         pMem->type = SQLITE_TEXT;
   882    883         pMem->enc = SQLITE_UTF8;
   883    884         pMem++;
   884    885       }
   885    886   
   886    887       pMem->flags = MEM_Int;
   887    888       pMem->u.i = pOp->p1;                          /* P1 */
................................................................................
   906    907       }
   907    908       pMem->flags = MEM_Dyn|MEM_Str|MEM_Term;
   908    909       z = displayP4(pOp, pMem->z, 32);
   909    910       if( z!=pMem->z ){
   910    911         sqlite3VdbeMemSetStr(pMem, z, -1, SQLITE_UTF8, 0);
   911    912       }else{
   912    913         assert( pMem->z!=0 );
   913         -      pMem->n = strlen(pMem->z);
          914  +      pMem->n = (int)strlen(pMem->z);
   914    915         pMem->enc = SQLITE_UTF8;
   915    916       }
   916    917       pMem->type = SQLITE_TEXT;
   917    918       pMem++;
   918    919   
   919    920       if( p->explain==1 ){
   920    921         if( sqlite3VdbeMemGrow(pMem, 4, 0) ){
................................................................................
   928    929         pMem->enc = SQLITE_UTF8;
   929    930         pMem++;
   930    931     
   931    932   #ifdef SQLITE_DEBUG
   932    933         if( pOp->zComment ){
   933    934           pMem->flags = MEM_Str|MEM_Term;
   934    935           pMem->z = pOp->zComment;
   935         -        pMem->n = strlen(pMem->z);
          936  +        pMem->n = (int)strlen(pMem->z);
   936    937           pMem->enc = SQLITE_UTF8;
   937    938           pMem->type = SQLITE_TEXT;
   938    939         }else
   939    940   #endif
   940    941         {
   941    942           pMem->flags = MEM_Null;                       /* Comment */
   942    943           pMem->type = SQLITE_NULL;
................................................................................
  1364   1365         if( i==1 ) continue;   /* Ignore the TEMP database */
  1365   1366         if( sqlite3BtreeIsInTrans(pBt) ){
  1366   1367           char const *zFile = sqlite3BtreeGetJournalname(pBt);
  1367   1368           if( zFile[0]==0 ) continue;  /* Ignore :memory: databases */
  1368   1369           if( !needSync && !sqlite3BtreeSyncDisabled(pBt) ){
  1369   1370             needSync = 1;
  1370   1371           }
  1371         -        rc = sqlite3OsWrite(pMaster, zFile, strlen(zFile)+1, offset);
         1372  +        rc = sqlite3OsWrite(pMaster, zFile, (int)strlen(zFile)+1, offset);
  1372   1373           offset += strlen(zFile)+1;
  1373   1374           if( rc!=SQLITE_OK ){
  1374   1375             sqlite3OsCloseFree(pMaster);
  1375   1376             sqlite3OsDelete(pVfs, zMaster, 0);
  1376   1377             sqlite3DbFree(db, zMaster);
  1377   1378             return rc;
  1378   1379           }
................................................................................
  1864   1865   #ifdef SQLITE_TEST
  1865   1866       extern int sqlite3_search_count;
  1866   1867   #endif
  1867   1868       assert( p->isTable );
  1868   1869       rc = sqlite3BtreeMovetoUnpacked(p->pCursor, 0, p->movetoTarget, 0, &res);
  1869   1870       if( rc ) return rc;
  1870   1871       p->lastRowid = keyToInt(p->movetoTarget);
  1871         -    p->rowidIsValid = res==0;
         1872  +    p->rowidIsValid = res==0 ?1:0;
  1872   1873       if( res<0 ){
  1873   1874         rc = sqlite3BtreeNext(p->pCursor, &res);
  1874   1875         if( rc ) return rc;
  1875   1876       }
  1876   1877   #ifdef SQLITE_TEST
  1877   1878       sqlite3_search_count++;
  1878   1879   #endif
................................................................................
  1944   1945     }
  1945   1946     if( flags&MEM_Int ){
  1946   1947       /* Figure out whether to use 1, 2, 4, 6 or 8 bytes. */
  1947   1948   #   define MAX_6BYTE ((((i64)0x00008000)<<32)-1)
  1948   1949       i64 i = pMem->u.i;
  1949   1950       u64 u;
  1950   1951       if( file_format>=4 && (i&1)==i ){
  1951         -      return 8+i;
         1952  +      return 8+(u32)i;
  1952   1953       }
  1953   1954       u = i<0 ? -i : i;
  1954   1955       if( u<=127 ) return 1;
  1955   1956       if( u<=32767 ) return 2;
  1956   1957       if( u<=8388607 ) return 3;
  1957   1958       if( u<=2147483647 ) return 4;
  1958   1959       if( u<=MAX_6BYTE ) return 5;
................................................................................
  1960   1961     }
  1961   1962     if( flags&MEM_Real ){
  1962   1963       return 7;
  1963   1964     }
  1964   1965     assert( pMem->db->mallocFailed || flags&(MEM_Str|MEM_Blob) );
  1965   1966     n = pMem->n;
  1966   1967     if( flags & MEM_Zero ){
  1967         -    n += pMem->u.i;
         1968  +    n += pMem->u.nZero;
  1968   1969     }
  1969   1970     assert( n>=0 );
  1970   1971     return ((n*2) + 12 + ((flags&MEM_Str)!=0));
  1971   1972   }
  1972   1973   
  1973   1974   /*
  1974   1975   ** Return the length of the data corresponding to the supplied serial-type.
................................................................................
  2067   2068         swapMixedEndianFloat(v);
  2068   2069       }else{
  2069   2070         v = pMem->u.i;
  2070   2071       }
  2071   2072       len = i = sqlite3VdbeSerialTypeLen(serial_type);
  2072   2073       assert( len<=nBuf );
  2073   2074       while( i-- ){
  2074         -      buf[i] = (v&0xFF);
         2075  +      buf[i] = (u8)(v&0xFF);
  2075   2076         v >>= 8;
  2076   2077       }
  2077   2078       return len;
  2078   2079     }
  2079   2080   
  2080   2081     /* String or blob */
  2081   2082     if( serial_type>=12 ){
  2082         -    assert( pMem->n + ((pMem->flags & MEM_Zero)?pMem->u.i:0)
         2083  +    assert( pMem->n + ((pMem->flags & MEM_Zero)?pMem->u.nZero:0)
  2083   2084                == sqlite3VdbeSerialTypeLen(serial_type) );
  2084   2085       assert( pMem->n<=nBuf );
  2085   2086       len = pMem->n;
  2086   2087       memcpy(buf, pMem->z, len);
  2087   2088       if( pMem->flags & MEM_Zero ){
  2088         -      len += pMem->u.i;
         2089  +      len += pMem->u.nZero;
  2089   2090         if( len>nBuf ){
  2090   2091           len = nBuf;
  2091   2092         }
  2092   2093         memset(&buf[pMem->n], 0, len-pMem->n);
  2093   2094       }
  2094   2095       return len;
  2095   2096     }
................................................................................
  2387   2388     int rc;
  2388   2389     u32 szHdr;        /* Size of the header */
  2389   2390     u32 typeRowid;    /* Serial type of the rowid */
  2390   2391     u32 lenRowid;     /* Size of the rowid */
  2391   2392     Mem m, v;
  2392   2393   
  2393   2394     sqlite3BtreeKeySize(pCur, &nCellKey);
  2394         -  if( nCellKey<=0 ){
         2395  +  if( nCellKey<=0 || nCellKey>0x7fffffff ){
  2395   2396       return SQLITE_CORRUPT_BKPT;
  2396   2397     }
  2397   2398     m.flags = 0;
  2398   2399     m.db = 0;
  2399   2400     m.zMalloc = 0;
  2400         -  rc = sqlite3VdbeMemFromBtree(pCur, 0, nCellKey, 1, &m);
         2401  +  rc = sqlite3VdbeMemFromBtree(pCur, 0, (int)nCellKey, 1, &m);
  2401   2402     if( rc ){
  2402   2403       return rc;
  2403   2404     }
  2404   2405     (void)getVarint32((u8*)m.z, szHdr);
  2405   2406     (void)getVarint32((u8*)&m.z[szHdr-1], typeRowid);
  2406   2407     lenRowid = sqlite3VdbeSerialTypeLen(typeRowid);
  2407   2408     sqlite3VdbeSerialGet((u8*)&m.z[m.n-lenRowid], typeRowid, &v);
................................................................................
  2431   2432   ){
  2432   2433     i64 nCellKey = 0;
  2433   2434     int rc;
  2434   2435     BtCursor *pCur = pC->pCursor;
  2435   2436     Mem m;
  2436   2437   
  2437   2438     sqlite3BtreeKeySize(pCur, &nCellKey);
  2438         -  if( nCellKey<=0 ){
         2439  +  if( nCellKey<=0 || nCellKey>0x7fffffff ){
  2439   2440       *res = 0;
  2440   2441       return SQLITE_OK;
  2441   2442     }
  2442   2443     m.db = 0;
  2443   2444     m.flags = 0;
  2444   2445     m.zMalloc = 0;
  2445         -  rc = sqlite3VdbeMemFromBtree(pC->pCursor, 0, nCellKey, 1, &m);
         2446  +  rc = sqlite3VdbeMemFromBtree(pC->pCursor, 0, (int)nCellKey, 1, &m);
  2446   2447     if( rc ){
  2447   2448       return rc;
  2448   2449     }
  2449   2450     assert( pUnpacked->flags & UNPACKED_IGNORE_ROWID );
  2450   2451     *res = sqlite3VdbeRecordCompare(m.n, m.z, pUnpacked);
  2451   2452     sqlite3VdbeMemRelease(&m);
  2452   2453     return SQLITE_OK;

Changes to src/vdbemem.c.

    11     11   *************************************************************************
    12     12   **
    13     13   ** This file contains code use to manipulate "Mem" structure.  A "Mem"
    14     14   ** stores a single value in the VDBE.  Mem is an opaque structure visible
    15     15   ** only within the VDBE.  Interface routines refer to a Mem using the
    16     16   ** name sqlite_value
    17     17   **
    18         -** $Id: vdbemem.c,v 1.129 2008/12/05 23:40:23 drh Exp $
           18  +** $Id: vdbemem.c,v 1.130 2008/12/09 02:51:24 drh Exp $
    19     19   */
    20     20   #include "sqliteInt.h"
    21     21   #include <ctype.h>
    22     22   #include "vdbeInt.h"
    23     23   
    24     24   /*
    25     25   ** Call sqlite3VdbeMemExpandBlob() on the supplied value (type Mem*)
................................................................................
   147    147     if( pMem->flags & MEM_Zero ){
   148    148       int nByte;
   149    149       assert( pMem->flags&MEM_Blob );
   150    150       assert( (pMem->flags&MEM_RowSet)==0 );
   151    151       assert( pMem->db==0 || sqlite3_mutex_held(pMem->db->mutex) );
   152    152   
   153    153       /* Set nByte to the number of bytes required to store the expanded blob. */
   154         -    nByte = pMem->n + pMem->u.i;
          154  +    nByte = pMem->n + pMem->u.nZero;
   155    155       if( nByte<=0 ){
   156    156         nByte = 1;
   157    157       }
   158    158       if( sqlite3VdbeMemGrow(pMem, nByte, 1) ){
   159    159         return SQLITE_NOMEM;
   160    160       }
   161    161   
   162         -    memset(&pMem->z[pMem->n], 0, pMem->u.i);
   163         -    pMem->n += pMem->u.i;
          162  +    memset(&pMem->z[pMem->n], 0, pMem->u.nZero);
          163  +    pMem->n += pMem->u.nZero;
   164    164       pMem->flags &= ~(MEM_Zero|MEM_Term);
   165    165     }
   166    166     return SQLITE_OK;
   167    167   }
   168    168   #endif
   169    169   
   170    170   
................................................................................
   222    222     */
   223    223     if( fg & MEM_Int ){
   224    224       sqlite3_snprintf(nByte, pMem->z, "%lld", pMem->u.i);
   225    225     }else{
   226    226       assert( fg & MEM_Real );
   227    227       sqlite3_snprintf(nByte, pMem->z, "%!.15g", pMem->r);
   228    228     }
   229         -  pMem->n = strlen(pMem->z);
          229  +  pMem->n = (int)strlen(pMem->z);
   230    230     pMem->enc = SQLITE_UTF8;
   231    231     pMem->flags |= MEM_Str|MEM_Term;
   232    232     sqlite3VdbeChangeEncoding(pMem, enc);
   233    233     return rc;
   234    234   }
   235    235   
   236    236   /*
................................................................................
   463    463   void sqlite3VdbeMemSetZeroBlob(Mem *pMem, int n){
   464    464     sqlite3VdbeMemRelease(pMem);
   465    465     MemSetTypeFlag(pMem, MEM_Blob);
   466    466     pMem->flags = MEM_Blob|MEM_Zero;
   467    467     pMem->type = SQLITE_BLOB;
   468    468     pMem->n = 0;
   469    469     if( n<0 ) n = 0;
   470         -  pMem->u.i = n;
          470  +  pMem->u.nZero = n;
   471    471     pMem->enc = SQLITE_UTF8;
   472    472   }
   473    473   
   474    474   /*
   475    475   ** Delete any previous value and set the value stored in *pMem to val,
   476    476   ** manifest type INTEGER.
   477    477   */
................................................................................
   526    526   ** too large - whose size exceeds SQLITE_MAX_LENGTH.
   527    527   */
   528    528   int sqlite3VdbeMemTooBig(Mem *p){
   529    529     assert( p->db!=0 );
   530    530     if( p->flags & (MEM_Str|MEM_Blob) ){
   531    531       int n = p->n;
   532    532       if( p->flags & MEM_Zero ){
   533         -      n += p->u.i;
          533  +      n += p->u.nZero;
   534    534       }
   535    535       return n>p->db->aLimit[SQLITE_LIMIT_LENGTH];
   536    536     }
   537    537     return 0; 
   538    538   }
   539    539   
   540    540   /*
................................................................................
   614    614     const char *z,      /* String pointer */
   615    615     int n,              /* Bytes in string, or negative */
   616    616     u8 enc,             /* Encoding of z.  0 for BLOBs */
   617    617     void (*xDel)(void*) /* Destructor function */
   618    618   ){
   619    619     int nByte = n;      /* New value for pMem->n */
   620    620     int iLimit;         /* Maximum allowed string or blob size */
   621         -  int flags = 0;      /* New value for pMem->flags */
          621  +  u16 flags = 0;      /* New value for pMem->flags */
   622    622   
   623    623     assert( pMem->db==0 || sqlite3_mutex_held(pMem->db->mutex) );
   624    624     assert( (pMem->flags & MEM_RowSet)==0 );
   625    625   
   626    626     /* If z is a NULL pointer, set pMem to contain an SQL NULL. */
   627    627     if( !z ){
   628    628       sqlite3VdbeMemSetNull(pMem);
................................................................................
   728    728       }
   729    729       if( !(f2&(MEM_Int|MEM_Real)) ){
   730    730         return -1;
   731    731       }
   732    732       if( (f1 & f2 & MEM_Int)==0 ){
   733    733         double r1, r2;
   734    734         if( (f1&MEM_Real)==0 ){
   735         -        r1 = pMem1->u.i;
          735  +        r1 = (double)pMem1->u.i;
   736    736         }else{
   737    737           r1 = pMem1->r;
   738    738         }
   739    739         if( (f2&MEM_Real)==0 ){
   740         -        r2 = pMem2->u.i;
          740  +        r2 = (double)pMem2->u.i;
   741    741         }else{
   742    742           r2 = pMem2->r;
   743    743         }
   744    744         if( r1<r2 ) return -1;
   745    745         if( r1>r2 ) return 1;
   746    746         return 0;
   747    747       }else{
................................................................................
   949    949           return 0;
   950    950         }
   951    951       }
   952    952       sqlite3VdbeMemNulTerminate(pVal);
   953    953     }else{
   954    954       assert( (pVal->flags&MEM_Blob)==0 );
   955    955       sqlite3VdbeMemStringify(pVal, enc);
   956         -    assert( 0==(1&(int)pVal->z) );
          956  +    assert( 0==(1&SQLITE_PTR_TO_INT(pVal->z)) );
   957    957     }
   958    958     assert(pVal->enc==(enc & ~SQLITE_UTF16_ALIGNED) || pVal->db==0
   959    959                 || pVal->db->mallocFailed );
   960    960     if( pVal->enc==(enc & ~SQLITE_UTF16_ALIGNED) ){
   961    961       return pVal->z;
   962    962     }else{
   963    963       return 0;
................................................................................
  1074   1074   ** Return the number of bytes in the sqlite3_value object assuming
  1075   1075   ** that it uses the encoding "enc"
  1076   1076   */
  1077   1077   int sqlite3ValueBytes(sqlite3_value *pVal, u8 enc){
  1078   1078     Mem *p = (Mem*)pVal;
  1079   1079     if( (p->flags & MEM_Blob)!=0 || sqlite3ValueText(pVal, enc) ){
  1080   1080       if( p->flags & MEM_Zero ){
  1081         -      return p->n+p->u.i;
         1081  +      return p->n + p->u.nZero;
  1082   1082       }else{
  1083   1083         return p->n;
  1084   1084       }
  1085   1085     }
  1086   1086     return 0;
  1087   1087   }