correct month in ZIP file dates
authorKonrad Rosenbaum <konrad@silmor.de>
Tue, 28 Feb 2017 22:28:02 +0000 (23:28 +0100)
committerKonrad Rosenbaum <konrad@silmor.de>
Tue, 28 Feb 2017 22:28:02 +0000 (23:28 +0100)
Change-Id: I0b634cffc60e6022f1ed4e864d90152075585568

zip/qtziphlp.cpp

index 64b9171..b26620e 100644 (file)
@@ -1,7 +1,7 @@
 //
 // Description: Zip helper, base class
 
-/* Copyright (c) 2013 Konrad Rosenbaum <konrad@silmor.de>
+/* Copyright (c) 2013-17 Konrad Rosenbaum <konrad@silmor.de>
 
 Permission is hereby granted, free of charge, to any person obtaining a copy
 of this software and associated documentation files (the "Software"), to deal
@@ -128,7 +128,7 @@ bool Zip::storeFile(const QString& name, QIODevice& file, const QDateTime& dtime
         info.tmz_date.tm_sec=time.second();
         const QDate&date=dtime.date();
         info.tmz_date.tm_year=date.year();
-        info.tmz_date.tm_mon=date.month();
+        info.tmz_date.tm_mon=date.month()-1;
         info.tmz_date.tm_mday=date.day();
         info.dosDate=info.external_fa=info.internal_fa=0;
         
@@ -179,7 +179,7 @@ bool Zip::storeRawFile(const ZipFileInfo& zinfo, QIODevice& file)
         info.tmz_date.tm_sec=time.second();
         const QDate&date=zinfo.createTime().date();
         info.tmz_date.tm_year=date.year();
-        info.tmz_date.tm_mon=date.month();
+        info.tmz_date.tm_mon=date.month()-1;
         info.tmz_date.tm_mday=date.day();
         info.dosDate=info.external_fa=info.internal_fa=0;
         
@@ -338,7 +338,7 @@ ZipFileInfo Unzip::currentFile() const
         return ZipFileInfo(
                 QString::fromLatin1(buf,info.size_filename),
                 QDateTime(
-                        QDate(info.tmu_date.tm_year,info.tmu_date.tm_mon,info.tmu_date.tm_mday),
+                        QDate(info.tmu_date.tm_year,info.tmu_date.tm_mon+1,info.tmu_date.tm_mday),
                         QTime(info.tmu_date.tm_hour,info.tmu_date.tm_min,info.tmu_date.tm_sec)
                 ),
                 info.compression_method,