Avoid harmless left-shifts of negative numbers in the zipfile extension

when building ZIP archives of files with pre-DOS dates.

FossilOrigin-Name: 16bba8650cc24a0fd606944422bb31f2b8bdbe0a5a483678989e400b751eab4d
This commit is contained in:
drh
2018-03-10 12:53:20 +00:00
parent ef29f73479
commit 70acb0aa6b
3 changed files with 13 additions and 9 deletions
+6 -2
View File
@@ -751,8 +751,12 @@ static void zipfileMtimeToDos(ZipfileCDS *pCds, u32 mUnixTime){
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));
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)