diff options
author | drh <drh@noemail.net> | 2016-12-30 00:09:14 +0000 |
---|---|---|
committer | drh <drh@noemail.net> | 2016-12-30 00:09:14 +0000 |
commit | fb4e3a3bbb0e7879f07da22b304c434b0adf87e4 (patch) | |
tree | a6db271ae6be8e71b1d28b1a7c1ed65cdc24228e /src | |
parent | 96ada59cbb25b37a73618016c8af6b39af005295 (diff) | |
download | sqlite-fb4e3a3bbb0e7879f07da22b304c434b0adf87e4.tar.gz sqlite-fb4e3a3bbb0e7879f07da22b304c434b0adf87e4.zip |
Encode a 64-bit integer literal in date.c as a constant expression so that
it works on older compilers. Also fix a harmless compiler warning in vdbe.c.
FossilOrigin-Name: f57952bac652901e1bd48b68301941efbcf29dc4
Diffstat (limited to 'src')
-rw-r--r-- | src/date.c | 11 | ||||
-rw-r--r-- | src/vdbe.c | 2 |
2 files changed, 11 insertions, 2 deletions
diff --git a/src/date.c b/src/date.c index 432691960..a08248ce2 100644 --- a/src/date.c +++ b/src/date.c @@ -395,13 +395,22 @@ static int parseDateOrTime( return 1; } +/* The julian day number for 9999-12-31 23:59:59.999 is 5373484.4999999. +** Multiplying this by 86400000 gives 464269060799999 as the maximum value +** for DateTime.iJD. +** +** But some older compilers (ex: gcc 4.2.1 on older Macs) cannot deal with +** such a large integer literal, so we have to encode it. +*/ +#define INT_464269060799999 ((((i64)0x1a640)<<32)|0x1072fdff) + /* ** Return TRUE if the given julian day number is within range. ** ** The input is the JulianDay times 86400000. */ static int validJulianDay(sqlite3_int64 iJD){ - return iJD>=0 && iJD<=464269060799999; + return iJD>=0 && iJD<=INT_464269060799999; } /* diff --git a/src/vdbe.c b/src/vdbe.c index 152a37447..5e707a623 100644 --- a/src/vdbe.c +++ b/src/vdbe.c @@ -977,7 +977,7 @@ case OP_Halt: { p->rc = pOp->p1; p->errorAction = (u8)pOp->p2; p->pc = pcx; - assert( pOp->p5>=0 && pOp->p5<=4 ); + assert( pOp->p5<=4 ); if( p->rc ){ if( pOp->p5 ){ static const char * const azType[] = { "NOT NULL", "UNIQUE", "CHECK", |