/ Check-in [ba899372]
Login

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

Overview
Comment:Fix compiler warnings.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | experimental
Files: files | file ages | folders
SHA1: ba8993727e5752cbc92c7d78437e9e0510c899f7
User & Date: drh 2014-03-03 18:25:24
Context
2014-03-03
19:29
Fix a typo in a comment. No changes to code. check-in: 1f4991ab user: drh tags: experimental
18:25
Fix compiler warnings. check-in: ba899372 user: drh tags: experimental
17:48
Merge latest trunk changes. check-in: 1d603564 user: dan tags: experimental
Changes
Hide Diffs Side-by-Side Diffs Show Whitespace Changes Patch

Changes to src/vdbe.h.

   207    207   sqlite3_value *sqlite3VdbeGetBoundValue(Vdbe*, int, u8);
   208    208   void sqlite3VdbeSetVarmask(Vdbe*, int);
   209    209   #ifndef SQLITE_OMIT_TRACE
   210    210     char *sqlite3VdbeExpandSql(Vdbe*, const char*);
   211    211   #endif
   212    212   
   213    213   void sqlite3VdbeRecordUnpack(KeyInfo*,int,const void*,UnpackedRecord*);
   214         -int sqlite3VdbeRecordCompare(int,const void*,UnpackedRecord*,int);
          214  +int sqlite3VdbeRecordCompare(int,const void*,const UnpackedRecord*,int);
   215    215   UnpackedRecord *sqlite3VdbeAllocUnpackedRecord(KeyInfo *, char *, int, char **);
   216    216   
   217         -typedef int (*RecordCompare)(int,const void*,UnpackedRecord*,int);
          217  +typedef int (*RecordCompare)(int,const void*,const UnpackedRecord*,int);
   218    218   RecordCompare sqlite3VdbeFindCompare(UnpackedRecord*);
   219    219   
   220    220   #ifndef SQLITE_OMIT_TRIGGER
   221    221   void sqlite3VdbeLinkSubProgram(Vdbe *, SubProgram *);
   222    222   #endif
   223    223   
   224    224   /* Use SQLITE_ENABLE_COMMENTS to enable generation of extra comments on

Changes to src/vdbeInt.h.

   387    387   u32 sqlite3VdbeSerialTypeLen(u32);
   388    388   u32 sqlite3VdbeSerialType(Mem*, int);
   389    389   u32 sqlite3VdbeSerialPut(unsigned char*, Mem*, u32);
   390    390   u32 sqlite3VdbeSerialGet(const unsigned char*, u32, Mem*);
   391    391   void sqlite3VdbeDeleteAuxData(Vdbe*, int, int);
   392    392   
   393    393   int sqlite2BtreeKeyCompare(BtCursor *, const void *, int, int, int *);
   394         -int sqlite3VdbeIdxKeyCompare(VdbeCursor*,UnpackedRecord*,int*);
          394  +int sqlite3VdbeIdxKeyCompare(VdbeCursor*,const UnpackedRecord*,int*);
   395    395   int sqlite3VdbeIdxRowid(sqlite3*, BtCursor *, i64 *);
   396    396   int sqlite3MemCompare(const Mem*, const Mem*, const CollSeq*);
   397    397   int sqlite3VdbeExec(Vdbe*);
   398    398   int sqlite3VdbeList(Vdbe*);
   399    399   int sqlite3VdbeHalt(Vdbe*);
   400    400   int sqlite3VdbeChangeEncoding(Mem *, int);
   401    401   int sqlite3VdbeMemTooBig(Mem*);

Changes to src/vdbeaux.c.

  3131   3131   ** this function deserializes and compares values using the
  3132   3132   ** sqlite3VdbeSerialGet() and sqlite3MemCompare() functions. It is used
  3133   3133   ** in assert() statements to ensure that the optimized code in
  3134   3134   ** sqlite3VdbeRecordCompare() returns results with these two primitives.
  3135   3135   */
  3136   3136   static int vdbeRecordCompareDebug(
  3137   3137     int nKey1, const void *pKey1, /* Left key */
  3138         -  UnpackedRecord *pPKey2        /* Right key */
         3138  +  const UnpackedRecord *pPKey2  /* Right key */
  3139   3139   ){
  3140   3140     u32 d1;            /* Offset into aKey[] of next data element */
  3141   3141     u32 idx1;          /* Offset into aKey[] of next header element */
  3142   3142     u32 szHdr1;        /* Number of bytes in header */
  3143   3143     int i = 0;
  3144   3144     int rc = 0;
  3145   3145     const unsigned char *aKey1 = (const unsigned char *)pKey1;
................................................................................
  3392   3392   **
  3393   3393   ** Key1 and Key2 do not have to contain the same number of fields. If all 
  3394   3394   ** fields that appear in both keys are equal, then pPKey2->default_rc is 
  3395   3395   ** returned.
  3396   3396   */
  3397   3397   int sqlite3VdbeRecordCompare(
  3398   3398     int nKey1, const void *pKey1,   /* Left key */
  3399         -  UnpackedRecord *const pPKey2,   /* Right key */
         3399  +  const UnpackedRecord *pPKey2,   /* Right key */
  3400   3400     int bSkip                       /* If true, skip the first field */
  3401   3401   ){
  3402   3402     u32 d1;                         /* Offset into aKey[] of next data element */
  3403   3403     int i;                          /* Index of next field to compare */
  3404   3404     int szHdr1;                     /* Size of record header in bytes */
  3405   3405     u32 idx1;                       /* Offset of first type in header */
  3406   3406     int rc = 0;                     /* Return value */
................................................................................
  3470   3470         }else{
  3471   3471           double rhs = pRhs->r;
  3472   3472           double lhs;
  3473   3473           sqlite3VdbeSerialGet(&aKey1[d1], serial_type, &mem1);
  3474   3474           if( serial_type==7 ){
  3475   3475             lhs = mem1.r;
  3476   3476           }else{
  3477         -          lhs = mem1.u.i;
         3477  +          lhs = (double)mem1.u.i;
  3478   3478           }
  3479   3479           if( lhs<rhs ){
  3480   3480             rc = -1;
  3481   3481           }else if( lhs>rhs ){
  3482   3482             rc = +1;
  3483   3483           }
  3484   3484         }
................................................................................
  3489   3489         getVarint32(&aKey1[idx1], serial_type);
  3490   3490         if( serial_type<12 ){
  3491   3491           rc = -1;
  3492   3492         }else if( !(serial_type & 0x01) ){
  3493   3493           rc = +1;
  3494   3494         }else{
  3495   3495           mem1.n = (serial_type - 12) / 2;
  3496         -        if( (d1+mem1.n) > nKey1 ){
         3496  +        if( (d1+mem1.n) > (unsigned)nKey1 ){
  3497   3497             rc = 1;                /* Corruption */
  3498   3498           }else if( pKeyInfo->aColl[i] ){
  3499   3499             mem1.enc = pKeyInfo->enc;
  3500   3500             mem1.db = pKeyInfo->db;
  3501   3501             mem1.flags = MEM_Str;
  3502   3502             mem1.z = (char*)&aKey1[d1];
  3503   3503             rc = vdbeCompareMemString(&mem1, pRhs, pKeyInfo->aColl[i]);
................................................................................
  3512   3512       /* RHS is a blob */
  3513   3513       else if( pRhs->flags & MEM_Blob ){
  3514   3514         getVarint32(&aKey1[idx1], serial_type);
  3515   3515         if( serial_type<12 || (serial_type & 0x01) ){
  3516   3516           rc = -1;
  3517   3517         }else{
  3518   3518           int nStr = (serial_type - 12) / 2;
  3519         -        if( (d1+nStr) > nKey1 ){
         3519  +        if( (d1+nStr) > (unsigned)nKey1 ){
  3520   3520             rc = 1;                /* Corruption */
  3521   3521           }else{
  3522   3522             int nCmp = MIN(nStr, pRhs->n);
  3523   3523             rc = memcmp(&aKey1[d1], pRhs->z, nCmp);
  3524   3524             if( rc==0 ) rc = nStr - pRhs->n;
  3525   3525           }
  3526   3526         }
................................................................................
  3544   3544         return rc;
  3545   3545       }
  3546   3546   
  3547   3547       i++;
  3548   3548       pRhs++;
  3549   3549       d1 += sqlite3VdbeSerialTypeLen(serial_type);
  3550   3550       idx1 += sqlite3VarintLen(serial_type);
  3551         -  }while( idx1<szHdr1 && i<pPKey2->nField && d1<=nKey1 );
         3551  +  }while( idx1<(unsigned)szHdr1 && i<pPKey2->nField && d1<=(unsigned)nKey1 );
  3552   3552   
  3553   3553     /* No memory allocation is ever used on mem1.  Prove this using
  3554   3554     ** the following assert().  If the assert() fails, it indicates a
  3555   3555     ** memory leak and a need to call sqlite3VdbeMemRelease(&mem1).  */
  3556   3556     assert( mem1.zMalloc==0 );
  3557   3557   
  3558   3558     /* rc==0 here means that one or both of the keys ran out of fields and
................................................................................
  3568   3568   ** This function is an optimized version of sqlite3VdbeRecordCompare() 
  3569   3569   ** that (a) the first field of pPKey2 is an integer, and (b) the 
  3570   3570   ** size-of-header varint at the start of (pKey1/nKey1) fits in a single
  3571   3571   ** byte (i.e. is less than 128).
  3572   3572   */
  3573   3573   static int vdbeRecordCompareInt(
  3574   3574     int nKey1, const void *pKey1, /* Left key */
  3575         -  UnpackedRecord *pPKey2,       /* Right key */
         3575  +  const UnpackedRecord *pPKey2, /* Right key */
  3576   3576     int bSkip                     /* Ignored */
  3577   3577   ){
  3578   3578     const u8 *aKey = &((const u8*)pKey1)[*(const u8*)pKey1];
  3579   3579     int serial_type = ((const u8*)pKey1)[1];
  3580   3580     int res;
  3581   3581     i64 v = pPKey2->aMem[0].u.i;
  3582   3582     i64 lhs;
         3583  +  UNUSED_PARAMETER(bSkip);
  3583   3584   
  3584   3585     assert( bSkip==0 );
  3585   3586   
  3586   3587     switch( serial_type ){
  3587   3588       case 1:
  3588   3589         lhs = (char)(aKey[0]);
  3589   3590         break;
................................................................................
  3654   3655   ** This function is an optimized version of sqlite3VdbeRecordCompare() 
  3655   3656   ** that (a) the first field of pPKey2 is a string, that (b) the first field
  3656   3657   ** uses the collation sequence BINARY and (c) that the size-of-header varint 
  3657   3658   ** at the start of (pKey1/nKey1) fits in a single byte.
  3658   3659   */
  3659   3660   static int vdbeRecordCompareString(
  3660   3661     int nKey1, const void *pKey1, /* Left key */
  3661         -  UnpackedRecord *pPKey2,       /* Right key */
         3662  +  const UnpackedRecord *pPKey2, /* Right key */
  3662   3663     int bSkip
  3663   3664   ){
  3664   3665     const u8 *aKey1 = (const u8*)pKey1;
  3665   3666     int serial_type;
  3666   3667     int res;
         3668  +  UNUSED_PARAMETER(bSkip);
  3667   3669   
  3668   3670     assert( bSkip==0 );
  3669   3671     getVarint32(&aKey1[1], serial_type);
  3670   3672   
  3671   3673     if( serial_type<12 ){
  3672   3674       res = pPKey2->r1;      /* (pKey1/nKey1) is a number or a null */
  3673   3675     }else if( !(serial_type & 0x01) ){ 
................................................................................
  3829   3831   ** pUnpacked is either created without a rowid or is truncated so that it
  3830   3832   ** omits the rowid at the end.  The rowid at the end of the index entry
  3831   3833   ** is ignored as well.  Hence, this routine only compares the prefixes 
  3832   3834   ** of the keys prior to the final rowid, not the entire key.
  3833   3835   */
  3834   3836   int sqlite3VdbeIdxKeyCompare(
  3835   3837     VdbeCursor *pC,             /* The cursor to compare against */
  3836         -  UnpackedRecord *pUnpacked,  /* Unpacked version of key to compare against */
         3838  +  const UnpackedRecord *pUnpacked, /* Unpacked version of key */
  3837   3839     int *res                    /* Write the comparison result here */
  3838   3840   ){
  3839   3841     i64 nCellKey = 0;
  3840   3842     int rc;
  3841   3843     BtCursor *pCur = pC->pCursor;
  3842   3844     Mem m;
  3843   3845