/ Check-in [16bba865]
Login

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

Overview
Comment:Avoid harmless left-shifts of negative numbers in the zipfile extension when building ZIP archives of files with pre-DOS dates.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256:16bba8650cc24a0fd606944422bb31f2b8bdbe0a5a483678989e400b751eab4d
User & Date: drh 2018-03-10 12:53:20
Context
2018-03-10
13:21
Improved error messages from the zipfile extension. check-in: f634a7e3 user: drh tags: trunk
12:53
Avoid harmless left-shifts of negative numbers in the zipfile extension when building ZIP archives of files with pre-DOS dates. check-in: 16bba865 user: drh tags: trunk
12:34
Fix the zipfile extension so that it is able to create symbolic link entries in the ZIP file even on systems like Win32 that do not support symbolic links on the native filesystem. check-in: 2a4493f4 user: drh tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to ext/misc/zipfile.c.

747
748
749
750
751
752
753

754
755



756
757
758
759
760
761
762
  mon = (E<14 ? E-1 : E-13);
  yr = mon>2 ? C-4716 : C-4715;

  hr = (mUnixTime % (24*60*60)) / (60*60);
  min = (mUnixTime % (60*60)) / 60;
  sec = (mUnixTime % 60);


  pCds->mDate = (u16)(day + (mon << 5) + ((yr-1980) << 9));
  pCds->mTime = (u16)(sec/2 + (min<<5) + (hr<<11));




  assert( mUnixTime<315507600 
       || mUnixTime==zipfileMtime(pCds) 
       || ((mUnixTime % 2) && mUnixTime-1==zipfileMtime(pCds)) 
       /* || (mUnixTime % 2) */
  );
}







>
|
|
>
>
>







747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
  mon = (E<14 ? E-1 : E-13);
  yr = mon>2 ? C-4716 : C-4715;

  hr = (mUnixTime % (24*60*60)) / (60*60);
  min = (mUnixTime % (60*60)) / 60;
  sec = (mUnixTime % 60);

  if( yr>=1980 ){
    pCds->mDate = (u16)(day + (mon << 5) + ((yr-1980) << 9));
    pCds->mTime = (u16)(sec/2 + (min<<5) + (hr<<11));
  }else{
    pCds->mDate = pCds->mTime = 0;
  }

  assert( mUnixTime<315507600 
       || mUnixTime==zipfileMtime(pCds) 
       || ((mUnixTime % 2) && mUnixTime-1==zipfileMtime(pCds)) 
       /* || (mUnixTime % 2) */
  );
}