Index: src/OFZIPArchive.m ================================================================== --- src/OFZIPArchive.m +++ src/OFZIPArchive.m @@ -42,10 +42,11 @@ * - Encrypted files cannot be read. * - Split archives are not supported. * - Write support is missing. * - The ZIP has to be a file on the local file system. * - No support for ZIP64. + * - No support for data descriptors (useless without compression anyway). */ @interface OFZIPArchive_LocalFileHeader: OFObject { @public Index: src/OFZIPArchiveEntry.h ================================================================== --- src/OFZIPArchiveEntry.h +++ src/OFZIPArchiveEntry.h @@ -40,12 +40,12 @@ uint32_t _externalAttributes, _localFileHeaderOffset; } #ifdef OF_HAVE_PROPERTIES @property (readonly, copy) OFString *fileName, *fileComment; +@property (readonly) off_t compressedSize, uncompressedSize; @property (readonly, retain) OFDate *modificationDate; -@property (readonly) off_t uncompressedSize, compressedSize; @property (readonly) uint32_t CRC32; #endif - (instancetype)OF_initWithFile: (OFFile*)file; @@ -62,29 +62,29 @@ * @return The comment of the entry's file */ - (OFString*)fileComment; /*! - * @brief Returns the last modification date of the entry's file. + * @brief Returns the compressed size of the entry's file. * - * @return The last modification date of the entry's file + * @return The compressed size of the entry's file */ -- (OFDate*)modificationDate; +- (off_t)compressedSize; /*! * @brief Returns the uncompressed size of the entry's file. * * @return The uncompressed size of the entry's file */ - (off_t)uncompressedSize; /*! - * @brief Returns the compressed size of the entry's file. + * @brief Returns the last modification date of the entry's file. * - * @return The compressed size of the entry's file + * @return The last modification date of the entry's file */ -- (off_t)compressedSize; +- (OFDate*)modificationDate; /*! * @brief Returns the CRC32 checksum of the entry's file. * * @return The CRC32 checksum of the entry's file Index: src/OFZIPArchiveEntry.m ================================================================== --- src/OFZIPArchiveEntry.m +++ src/OFZIPArchiveEntry.m @@ -93,10 +93,20 @@ - (OFString*)fileComment { OF_GETTER(_fileComment, true) } + +- (off_t)compressedSize +{ + return _compressedSize; +} + +- (off_t)uncompressedSize +{ + return _uncompressedSize; +} - (OFDate*)modificationDate { void *pool = objc_autoreleasePoolPush(); uint_fast16_t year = ((_lastModifiedFileDate & 0xFE00) >> 9) + 1980; @@ -118,24 +128,37 @@ objc_autoreleasePoolPop(pool); return [date autorelease]; } -- (off_t)uncompressedSize -{ - return _uncompressedSize; -} - -- (off_t)compressedSize -{ - return _compressedSize; -} - - (uint32_t)CRC32 { return _CRC32; } + +- (OFString*)description +{ + void *pool = objc_autoreleasePoolPush(); + OFDate *modificationDate = [self modificationDate]; + OFString *ret; + + ret = [[OFString alloc] initWithFormat: @"<%@: %p\n" + @"\tFile name = %@\n" + @"\tFile comment = %@\n" + @"\tCompressed size = %jd\n" + @"\tUncompressed size = %jd\n" + @"\tModification date = %@\n" + @"\tCRC32 = %" @PRIu32 @"\n" + @"}", + [self class], self, _fileName, _fileComment, + (intmax_t)_compressedSize, (intmax_t)_uncompressedSize, + modificationDate, _CRC32]; + + objc_autoreleasePoolPop(pool); + + return [ret autorelease]; +} - (uint16_t)OF_madeWithVersion { return _madeWithVersion; }