/ Check-in [15c587cf]
Login
SQLite training in Houston TX on 2019-11-05 (details)
Part of the 2019 Tcl Conference

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

Overview
Comment:Fix harmless compiler warnings in the zipfile extension seen with MSVC.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 15c587cf6ffc920dc37f67cacb4f0db6a603fb998a22a639f755387910516414
User & Date: mistachkin 2018-02-23 13:38:54
Context
2018-02-26
15:27
Always interpret non-zero floating-point values as true even if their integer part is zero. Fix for ticket [36fae083b450e3af857a459e20]. check-in: a983fa85 user: drh tags: trunk
03:20
Experimental implementation of IS TRUE and IS FALSE operators. All TRUE and FALSE to act like constants if the names do not resolve to a column name. check-in: 40314bc9 user: drh tags: is-true-operator
2018-02-23
13:45
Merge updates from trunk. check-in: 53f2100a user: mistachkin tags: zonefile
13:38
Fix harmless compiler warnings in the zipfile extension seen with MSVC. check-in: 15c587cf user: mistachkin tags: trunk
13:38
Enable the JSON1 extension when compiling the test fixture with MSVC. check-in: e9e9f27b user: mistachkin tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to ext/misc/zipfile.c.

   733    733     i64 JD = (i64)2440588 + mUnixTime / (24*60*60);
   734    734   
   735    735     int A, B, C, D, E;
   736    736     int yr, mon, day;
   737    737     int hr, min, sec;
   738    738   
   739    739     A = (int)((JD - 1867216.25)/36524.25);
   740         -  A = JD + 1 + A - (A/4);
          740  +  A = (int)(JD + 1 + A - (A/4));
   741    741     B = A + 1524;
   742    742     C = (int)((B - 122.1)/365.25);
   743    743     D = (36525*(C&32767))/100;
   744    744     E = (int)((B-D)/30.6001);
   745    745   
   746    746     day = B - D - (int)(30.6001*E);
   747    747     mon = (E<14 ? E-1 : E-13);
................................................................................
  1619   1619           pNew->cds.iCompression = (u16)iMethod;
  1620   1620           zipfileMtimeToDos(&pNew->cds, mTime);
  1621   1621           pNew->cds.crc32 = iCrc32;
  1622   1622           pNew->cds.szCompressed = nData;
  1623   1623           pNew->cds.szUncompressed = (u32)sz;
  1624   1624           pNew->cds.iExternalAttr = (mode<<16);
  1625   1625           pNew->cds.iOffset = (u32)pTab->szCurrent;
  1626         -        pNew->cds.nFile = nPath;
         1626  +        pNew->cds.nFile = (u16)nPath;
  1627   1627           pNew->mUnixTime = (u32)mTime;
  1628   1628           rc = zipfileAppendEntry(pTab, pNew, pData, nData);
  1629   1629           zipfileAddEntry(pTab, pOld, pNew);
  1630   1630         }
  1631   1631       }
  1632   1632     }
  1633   1633   
................................................................................
  1922   1922       rc = SQLITE_ERROR;
  1923   1923       goto zipfile_step_out;
  1924   1924     }
  1925   1925   
  1926   1926     /* Inspect the 'method' parameter. This must be either 0 (store), 8 (use
  1927   1927     ** deflate compression) or NULL (choose automatically).  */
  1928   1928     if( pMethod && SQLITE_NULL!=sqlite3_value_type(pMethod) ){
  1929         -    iMethod = sqlite3_value_int64(pMethod);
         1929  +    iMethod = (int)sqlite3_value_int64(pMethod);
  1930   1930       if( iMethod!=0 && iMethod!=8 ){
  1931   1931         zErr = sqlite3_mprintf("illegal method value: %d", iMethod);
  1932   1932         rc = SQLITE_ERROR;
  1933   1933         goto zipfile_step_out;
  1934   1934       }
  1935   1935     }
  1936   1936   
................................................................................
  1989   1989       }
  1990   1990     }
  1991   1991   
  1992   1992     /* Assemble the ZipfileEntry object for the new zip archive entry */
  1993   1993     e.cds.iVersionMadeBy = ZIPFILE_NEWENTRY_MADEBY;
  1994   1994     e.cds.iVersionExtract = ZIPFILE_NEWENTRY_REQUIRED;
  1995   1995     e.cds.flags = ZIPFILE_NEWENTRY_FLAGS;
  1996         -  e.cds.iCompression = iMethod;
         1996  +  e.cds.iCompression = (u16)iMethod;
  1997   1997     zipfileMtimeToDos(&e.cds, (u32)e.mUnixTime);
  1998   1998     e.cds.crc32 = iCrc32;
  1999   1999     e.cds.szCompressed = nData;
  2000   2000     e.cds.szUncompressed = szUncompressed;
  2001   2001     e.cds.iExternalAttr = (mode<<16);
  2002   2002     e.cds.iOffset = p->body.n;
  2003         -  e.cds.nFile = nName;
         2003  +  e.cds.nFile = (u16)nName;
  2004   2004     e.cds.zFile = zName;
  2005   2005   
  2006   2006     /* Append the LFH to the body of the new archive */
  2007   2007     nByte = ZIPFILE_LFH_FIXED_SZ + e.cds.nFile + 9;
  2008   2008     if( (rc = zipfileBufferGrow(&p->body, nByte)) ) goto zipfile_step_out;
  2009   2009     p->body.n += zipfileSerializeLFH(&e, &p->body.a[p->body.n]);
  2010   2010   
................................................................................
  2043   2043     int nZip;
  2044   2044     u8 *aZip;
  2045   2045   
  2046   2046     p = (ZipfileCtx*)sqlite3_aggregate_context(pCtx, sizeof(ZipfileCtx));
  2047   2047     if( p==0 ) return;
  2048   2048     if( p->nEntry>0 ){
  2049   2049       memset(&eocd, 0, sizeof(eocd));
  2050         -    eocd.nEntry = p->nEntry;
  2051         -    eocd.nEntryTotal = p->nEntry;
         2050  +    eocd.nEntry = (u16)p->nEntry;
         2051  +    eocd.nEntryTotal = (u16)p->nEntry;
  2052   2052       eocd.nSize = p->cds.n;
  2053   2053       eocd.iOffset = p->body.n;
  2054   2054   
  2055   2055       nZip = p->body.n + p->cds.n + ZIPFILE_EOCD_FIXED_SZ;
  2056   2056       aZip = (u8*)sqlite3_malloc(nZip);
  2057   2057       if( aZip==0 ){
  2058   2058         sqlite3_result_error_nomem(pCtx);