Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | Fix the date/time translation logic in the zipfile extension so that it works with boundary cases. See forum post d82289d69f for the trouble report. |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA3-256: |
c8de5f061359c174e143e5e81ade8aa9 |
User & Date: | drh 2021-04-22 14:43:16 |
Context
2021-04-22
| ||
16:54 | Improved handling of errors in ALTER TABLE RENAME. dbsqlfuzz 3e3e2e076e53d02288f80af41a11143a6ddf8c88 (check-in: 9c7a449f user: drh tags: trunk) | |
14:43 | Fix the date/time translation logic in the zipfile extension so that it works with boundary cases. See forum post d82289d69f for the trouble report. (check-in: c8de5f06 user: drh tags: trunk) | |
13:59 | Ensure that the typedefs for specific-length integers in zipfile.c are correct. (check-in: f1f2a490 user: drh tags: trunk) | |
Changes
Changes to ext/misc/zipfile.c.
︙ | ︙ | |||
716 717 718 719 720 721 722 | ** Bits 00-04: day ** Bits 05-08: month (1-12) ** Bits 09-15: years from 1980 ** ** https://msdn.microsoft.com/en-us/library/9kkf9tah.aspx */ static u32 zipfileMtime(ZipfileCDS *pCDS){ | > > | | | < < | | | < < < < < | | | < | | < < | < < | < > | | 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 | ** Bits 00-04: day ** Bits 05-08: month (1-12) ** Bits 09-15: years from 1980 ** ** https://msdn.microsoft.com/en-us/library/9kkf9tah.aspx */ static u32 zipfileMtime(ZipfileCDS *pCDS){ int Y,M,D,X1,X2,A,B,sec,min,hr; i64 JDsec; Y = (1980 + ((pCDS->mDate >> 9) & 0x7F)); M = ((pCDS->mDate >> 5) & 0x0F); D = (pCDS->mDate & 0x1F); sec = (pCDS->mTime & 0x1F)*2; min = (pCDS->mTime >> 5) & 0x3F; hr = (pCDS->mTime >> 11) & 0x1F; if( M<=2 ){ Y--; M += 12; } X1 = 36525*(Y+4716)/100; X2 = 306001*(M+1)/10000; A = Y/100; B = 2 - A + (A/4); JDsec = (i64)((X1 + X2 + D + B - 1524.5)*86400) + hr*3600 + min*60 + sec; return (u32)(JDsec - (i64)24405875*(i64)8640); } /* ** The opposite of zipfileMtime(). This function populates the mTime and ** mDate fields of the CDS structure passed as the first argument according ** to the UNIX timestamp value passed as the second. */ |
︙ | ︙ |
Changes to test/zipfile.test.
︙ | ︙ | |||
838 839 840 841 842 843 844 845 846 | # do_catchsql_test 16.10 { DELETE FROM zipfile; } {1 {zipfile: missing filename}} do_catchsql_test 16.20 { REPLACE INTO zipfile VALUES(null,null,null,null,null,123,null); } {1 {zipfile: missing filename}} finish_test | > > > > > > > > > > > > | 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 | # do_catchsql_test 16.10 { DELETE FROM zipfile; } {1 {zipfile: missing filename}} do_catchsql_test 16.20 { REPLACE INTO zipfile VALUES(null,null,null,null,null,123,null); } {1 {zipfile: missing filename}} # 2021-04-22 forum https://sqlite.org/forum/forumpost/d82289d69f do_execsql_test 17.1 { WITH vlist(x) AS ( VALUES(9223372036854775807), (-9223372036854775808), (9223372036854775806), (-9223372036854775807) ) SELECT DISTINCT typeof(zipfile(0,0,x,0)) FROM vlist; } {blob} finish_test |