Changeset 846 for trunk/src/gui/text/qzip.cpp
- Timestamp:
- May 5, 2011, 5:36:53 AM (14 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk
- Property svn:mergeinfo changed
/branches/vendor/nokia/qt/4.7.2 (added) merged: 845 /branches/vendor/nokia/qt/current merged: 844 /branches/vendor/nokia/qt/4.6.3 removed
- Property svn:mergeinfo changed
-
trunk/src/gui/text/qzip.cpp
r769 r846 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 201 0Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation (qt-info@nokia.com) … … 281 281 } 282 282 283 static QDateTime readMSDosDate(const uchar *src) 284 { 285 uint dosDate = readUInt(src); 286 quint64 uDate; 287 uDate = (quint64)(dosDate >> 16); 288 uint tm_mday = (uDate & 0x1f); 289 uint tm_mon = ((uDate & 0x1E0) >> 5); 290 uint tm_year = (((uDate & 0x0FE00) >> 9) + 1980); 291 uint tm_hour = ((dosDate & 0xF800) >> 11); 292 uint tm_min = ((dosDate & 0x7E0) >> 5); 293 uint tm_sec = ((dosDate & 0x1f) << 1); 294 295 return QDateTime(QDate(tm_year, tm_mon, tm_mday), QTime(tm_hour, tm_min, tm_sec)); 296 } 297 283 298 struct LocalFileHeader 284 299 { … … 344 359 345 360 QZipReader::FileInfo::FileInfo() 346 : isDir(false), isFile( true), isSymLink(false), crc32(0), size(0)361 : isDir(false), isFile(false), isSymLink(false), crc32(0), size(0) 347 362 { 348 363 } … … 366 381 crc32 = other.crc32; 367 382 size = other.size; 383 lastModified = other.lastModified; 368 384 return *this; 385 } 386 387 bool QZipReader::FileInfo::isValid() const 388 { 389 return isDir || isFile || isSymLink; 369 390 } 370 391 … … 404 425 fileInfo.crc32 = readUInt(header.h.crc_32); 405 426 fileInfo.size = readUInt(header.h.uncompressed_size); 427 fileInfo.lastModified = readMSDosDate(header.h.last_mod_file); 406 428 } 407 429 … … 751 773 752 774 /*! 775 Returns device used for reading zip archive. 776 */ 777 QIODevice* QZipReader::device() const 778 { 779 return d->device; 780 } 781 782 /*! 753 783 Returns true if the user can read the file; otherwise returns false. 754 784 */ … … 796 826 /*! 797 827 Returns a FileInfo of an entry in the zipfile. 798 The \a index is the index into the directoy listing of the zipfile. 828 The \a index is the index into the directory listing of the zipfile. 829 Returns an invalid FileInfo if \a index is out of boundaries. 799 830 800 831 \sa fileInfoList() … … 804 835 d->scanFiles(); 805 836 QZipReader::FileInfo fi; 806 d->fillFileInfo(index, fi); 837 if (index >= 0 && index < d->fileHeaders.count()) 838 d->fillFileInfo(index, fi); 807 839 return fi; 808 840 } … … 1023 1055 1024 1056 /*! 1057 Returns device used for writing zip archive. 1058 */ 1059 QIODevice* QZipWriter::device() const 1060 { 1061 return d->device; 1062 } 1063 1064 /*! 1025 1065 Returns true if the user can write to the archive; otherwise returns false. 1026 1066 */
Note:
See TracChangeset
for help on using the changeset viewer.