SQLite

Check-in [fcf480cc63]
Login

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

Overview
Comment:Fix a couple of harmless compiler warnings.
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | experimental
Files: files | file ages | folders
SHA1: fcf480cc630976b619aabd5f7fb7b09601a178fb
User & Date: drh 2014-03-03 21:46:55.799
Context
2014-03-03
21:59
Refactor the sqlite3VdbeRecordCompare() routine used to compare btree records. Create a couple of fast-track routines to handle the common cases of a string with BINARY collation or integer values as the left-most column. This gives a significant performance boost in common use. Oops: This build does not work on the Beaglebone where "char" defaults to unsigned. (check-in: aec5473a75 user: drh tags: broken-on-arm)
21:46
Fix a couple of harmless compiler warnings. (Closed-Leaf check-in: fcf480cc63 user: drh tags: experimental)
20:48
Avoid a buffer overread in vdbeCompareRecordInt() that might occur if the database is corrupt. (check-in: 7c0b4381f0 user: dan tags: experimental)
Changes
Unified Diff Ignore Whitespace Patch
Changes to src/btree.c.
4571
4572
4573
4574
4575
4576
4577


4578
4579
4580
4581
4582
4583
4584

  if( pIdxKey ){
    xRecordCompare = sqlite3VdbeFindCompare(pIdxKey);
    assert( pIdxKey->default_rc==1 
         || pIdxKey->default_rc==0 
         || pIdxKey->default_rc==-1
    );


  }

  rc = moveToRoot(pCur);
  if( rc ){
    return rc;
  }
  assert( pCur->pgnoRoot==0 || pCur->apPage[pCur->iPage] );







>
>







4571
4572
4573
4574
4575
4576
4577
4578
4579
4580
4581
4582
4583
4584
4585
4586

  if( pIdxKey ){
    xRecordCompare = sqlite3VdbeFindCompare(pIdxKey);
    assert( pIdxKey->default_rc==1 
         || pIdxKey->default_rc==0 
         || pIdxKey->default_rc==-1
    );
  }else{
    xRecordCompare = 0; /* Not actually used.  Avoids a compiler warning. */
  }

  rc = moveToRoot(pCur);
  if( rc ){
    return rc;
  }
  assert( pCur->pgnoRoot==0 || pCur->apPage[pCur->iPage] );
Changes to src/vdbeaux.c.
3571
3572
3573
3574
3575
3576
3577
3578
3579
3580
3581
3582
3583
3584
3585
** byte (i.e. is less than 128).
*/
static int vdbeRecordCompareInt(
  int nKey1, const void *pKey1, /* Left key */
  const UnpackedRecord *pPKey2, /* Right key */
  int bSkip                     /* Ignored */
){
  int szHdr = *(const u8*)pKey1;
  const u8 *aKey = &((const u8*)pKey1)[*(const u8*)pKey1 & 0x3F];
  int serial_type = ((const u8*)pKey1)[1];
  int res;
  i64 v = pPKey2->aMem[0].u.i;
  i64 lhs;
  UNUSED_PARAMETER(bSkip);








<







3571
3572
3573
3574
3575
3576
3577

3578
3579
3580
3581
3582
3583
3584
** byte (i.e. is less than 128).
*/
static int vdbeRecordCompareInt(
  int nKey1, const void *pKey1, /* Left key */
  const UnpackedRecord *pPKey2, /* Right key */
  int bSkip                     /* Ignored */
){

  const u8 *aKey = &((const u8*)pKey1)[*(const u8*)pKey1 & 0x3F];
  int serial_type = ((const u8*)pKey1)[1];
  int res;
  i64 v = pPKey2->aMem[0].u.i;
  i64 lhs;
  UNUSED_PARAMETER(bSkip);