/ Check-in [f57952ba]
Login

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

Overview
Comment: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.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: f57952bac652901e1bd48b68301941efbcf29dc4
User & Date: drh 2016-12-30 00:09:14
Context
2016-12-30
12:06
Disable the pagerAcquireMapPage() routine if memory-mapped I/O is disabled. This fixes a harmless compiler warning on OpenBSD. check-in: 3e25ba6e user: drh tags: trunk
00:09
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. check-in: f57952ba user: drh tags: trunk
2016-12-29
19:48
Fix harmless compiler warnings in the command-line shell and in Lemon. check-in: afcdc4a6 user: drh tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to src/date.c.

   391    391     }else if( sqlite3AtoF(zDate, &r, sqlite3Strlen30(zDate), SQLITE_UTF8) ){
   392    392       setRawDateNumber(p, r);
   393    393       return 0;
   394    394     }
   395    395     return 1;
   396    396   }
   397    397   
          398  +/* The julian day number for 9999-12-31 23:59:59.999 is 5373484.4999999.
          399  +** Multiplying this by 86400000 gives 464269060799999 as the maximum value
          400  +** for DateTime.iJD.
          401  +**
          402  +** But some older compilers (ex: gcc 4.2.1 on older Macs) cannot deal with 
          403  +** such a large integer literal, so we have to encode it.
          404  +*/
          405  +#define INT_464269060799999  ((((i64)0x1a640)<<32)|0x1072fdff)
          406  +
   398    407   /*
   399    408   ** Return TRUE if the given julian day number is within range.
   400    409   **
   401    410   ** The input is the JulianDay times 86400000.
   402    411   */
   403    412   static int validJulianDay(sqlite3_int64 iJD){
   404         -  return iJD>=0 && iJD<=464269060799999;
          413  +  return iJD>=0 && iJD<=INT_464269060799999;
   405    414   }
   406    415   
   407    416   /*
   408    417   ** Compute the Year, Month, and Day from the julian day number.
   409    418   */
   410    419   static void computeYMD(DateTime *p){
   411    420     int Z, A, B, C, D, E, X1;

Changes to src/vdbe.c.

   973    973       aMem = p->aMem;
   974    974       pOp = &aOp[pcx];
   975    975       break;
   976    976     }
   977    977     p->rc = pOp->p1;
   978    978     p->errorAction = (u8)pOp->p2;
   979    979     p->pc = pcx;
   980         -  assert( pOp->p5>=0 && pOp->p5<=4 );
          980  +  assert( pOp->p5<=4 );
   981    981     if( p->rc ){
   982    982       if( pOp->p5 ){
   983    983         static const char * const azType[] = { "NOT NULL", "UNIQUE", "CHECK",
   984    984                                                "FOREIGN KEY" };
   985    985         testcase( pOp->p5==1 );
   986    986         testcase( pOp->p5==2 );
   987    987         testcase( pOp->p5==3 );