-C Failure\sto\sextend\sa\stemp\sfile\sfor\suse\swith\smmap()\sin\svdbesort.c\sis\sbenign.
-D 2014-05-02T16:22:55.791
+C Simplify\sassert()\sstatements\sused\sto\sverify\scorrect\soperation\sof\s\nrecord\scomparison\sroutines.
+D 2014-05-02T17:33:16.279
F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f
F Makefile.in 2ef13430cd359f7b361bb863504e227b25cc7f81
F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23
F src/vdbe.h 394464909ed682334aa3d5831aae0c2fe2abef94
F src/vdbeInt.h e6d83e5bfd62fc6685ba1ed6153f7099f82de9f7
F src/vdbeapi.c 0ed6053f947edd0b30f64ce5aeb811872a3450a4
-F src/vdbeaux.c e493f38758c4b8f4ca2007cf6a700bd405d192f3
+F src/vdbeaux.c c9a8c917776c941af99285594d5c30d99e21c99a
F src/vdbeblob.c 9205ce9d3b064d9600f8418a897fc88b5687d9ac
F src/vdbemem.c 6fc77594c60f6155404f3f8d71bf36d1fdeb4447
F src/vdbesort.c 6bcf73fb160ee5bb8ce8a8ec61fda268b081dbb7
F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4
F tool/warnings.sh d1a6de74685f360ab718efda6265994b99bbea01
F tool/win/sqlite.vsix 030f3eeaf2cb811a3692ab9c14d021a75ce41fff
-P 9196ce407379ca3b151b601b98848771e5cb4e8f
-R 51e21c516ddbd5830d43ea54f991a56e
+P d4d396387d373bd1e82eda2c7c2e7ca35ec099c4
+R defe6572bf21263fd4b2b33706bcd8e7
U drh
-Z 19bdd7c6b9f54ab4b2fbcff19d13a623
+Z 26e6dec065eafceab8263c10d377378f
** sqlite3VdbeSerialGet() and sqlite3MemCompare() functions. It is used
** in assert() statements to ensure that the optimized code in
** sqlite3VdbeRecordCompare() returns results with these two primitives.
+**
+** Return true if the result of comparison is equivalent to desiredResult.
+** Return false if there is a disagreement.
*/
static int vdbeRecordCompareDebug(
int nKey1, const void *pKey1, /* Left key */
- const UnpackedRecord *pPKey2 /* Right key */
+ const UnpackedRecord *pPKey2, /* Right key */
+ int desiredResult /* Correct answer */
){
u32 d1; /* Offset into aKey[] of next data element */
u32 idx1; /* Offset into aKey[] of next header element */
if( pKeyInfo->aSortOrder[i] ){
rc = -rc; /* Invert the result for DESC sort order. */
}
- return rc;
+ goto debugCompareEnd;
}
i++;
}while( idx1<szHdr1 && i<pPKey2->nField );
/* rc==0 here means that one of the keys ran out of fields and
** all the fields up to that point were equal. Return the the default_rc
** value. */
- return pPKey2->default_rc;
+ rc = pPKey2->default_rc;
+
+debugCompareEnd:
+ if( desiredResult==0 && rc==0 ) return 1;
+ if( desiredResult<0 && rc<0 ) return 1;
+ if( desiredResult>0 && rc>0 ) return 1;
+ if( CORRUPT_DB ) return 1;
+ if( pKeyInfo->db->mallocFailed ) return 1;
+ return 0;
}
#endif
if( pKeyInfo->aSortOrder[i] ){
rc = -rc;
}
- assert( CORRUPT_DB
- || (rc<0 && vdbeRecordCompareDebug(nKey1, pKey1, pPKey2)<0)
- || (rc>0 && vdbeRecordCompareDebug(nKey1, pKey1, pPKey2)>0)
- || pKeyInfo->db->mallocFailed
- );
+ assert( vdbeRecordCompareDebug(nKey1, pKey1, pPKey2, rc) );
assert( mem1.zMalloc==0 ); /* See comment below */
return rc;
}
/* rc==0 here means that one or both of the keys ran out of fields and
** all the fields up to that point were equal. Return the the default_rc
** value. */
- assert( CORRUPT_DB
- || pPKey2->default_rc==vdbeRecordCompareDebug(nKey1, pKey1, pPKey2)
- );
+ assert( vdbeRecordCompareDebug(nKey1, pKey1, pPKey2, pPKey2->default_rc) );
return pPKey2->default_rc;
}
res = pPKey2->default_rc;
}
- assert( (res==0 && vdbeRecordCompareDebug(nKey1, pKey1, pPKey2)==0)
- || (res<0 && vdbeRecordCompareDebug(nKey1, pKey1, pPKey2)<0)
- || (res>0 && vdbeRecordCompareDebug(nKey1, pKey1, pPKey2)>0)
- || CORRUPT_DB
- );
+ assert( vdbeRecordCompareDebug(nKey1, pKey1, pPKey2, res) );
return res;
}
}
}
- assert( (res==0 && vdbeRecordCompareDebug(nKey1, pKey1, pPKey2)==0)
- || (res<0 && vdbeRecordCompareDebug(nKey1, pKey1, pPKey2)<0)
- || (res>0 && vdbeRecordCompareDebug(nKey1, pKey1, pPKey2)>0)
- || CORRUPT_DB
- );
+ assert( vdbeRecordCompareDebug(nKey1, pKey1, pPKey2, res) );
return res;
}