Index: src/OFLHAArchive.m ================================================================== --- src/OFLHAArchive.m +++ src/OFLHAArchive.m @@ -726,27 +726,28 @@ entry: (OFLHAArchiveEntry *)entry { self = [super init]; @try { - OFString *method; + OFString *compressionMethod; _stream = [stream retain]; - method = [entry method]; + compressionMethod = [entry compressionMethod]; - if ([method isEqual: @"-lh4-"] || [method isEqual: @"-lh5-"]) + if ([compressionMethod isEqual: @"-lh4-"] || + [compressionMethod isEqual: @"-lh5-"]) _decompressedStream = [[OFLHAArchive_LHStream alloc] of_initWithStream: stream distanceBits: 4 dictionaryBits: 14]; - else if ([method isEqual: @"-lh6-"]) + else if ([compressionMethod isEqual: @"-lh6-"]) _decompressedStream = [[OFLHAArchive_LHStream alloc] of_initWithStream: stream distanceBits: 5 dictionaryBits: 16]; - else if ([method isEqual: @"-lh7-"]) + else if ([compressionMethod isEqual: @"-lh7-"]) _decompressedStream = [[OFLHAArchive_LHStream alloc] of_initWithStream: stream distanceBits: 5 dictionaryBits: 17]; else Index: src/OFLHAArchiveEntry.h ================================================================== --- src/OFLHAArchiveEntry.h +++ src/OFLHAArchiveEntry.h @@ -35,11 +35,11 @@ @interface OFLHAArchiveEntry: OFObject { #ifdef OF_LHA_ARCHIVE_ENTRY_M @public #endif - OFString *_fileName, *_Nullable _directoryName, *_method; + OFString *_fileName, *_Nullable _directoryName, *_compressionMethod; uint32_t _compressedSize, _uncompressedSize; OFDate *_date; uint8_t _level; uint16_t _CRC16; uint8_t _operatingSystemIdentifier; @@ -54,13 +54,13 @@ * @brief The file name of the entry. */ @property (readonly, copy, nonatomic) OFString *fileName; /*! - * @brief The method of the entry. + * @brief The compression method of the entry. */ -@property (readonly, copy, nonatomic) OFString *method; +@property (readonly, copy, nonatomic) OFString *compressionMethod; /*! * @brief The compressed size of the entry's file. */ @property (readonly, nonatomic) uint32_t compressedSize; Index: src/OFLHAArchiveEntry.m ================================================================== --- src/OFLHAArchiveEntry.m +++ src/OFLHAArchiveEntry.m @@ -262,11 +262,12 @@ } } } @implementation OFLHAArchiveEntry -@synthesize method = _method, compressedSize = _compressedSize; +@synthesize compressionMethod = _compressionMethod; +@synthesize compressedSize = _compressedSize; @synthesize uncompressedSize = _uncompressedSize, date = _date; @synthesize level = _level, CRC16 = _CRC16; @synthesize operatingSystemIdentifier = _operatingSystemIdentifier; @synthesize fileComment = _fileComment, mode = _mode, UID = _UID, GID = _GID; @synthesize owner = _owner, group = _group; @@ -284,11 +285,11 @@ self = [super init]; @try { uint32_t date; - _method = [[OFString alloc] + _compressionMethod = [[OFString alloc] initWithCString: header + 2 encoding: OF_STRING_ENCODING_ASCII length: 5]; memcpy(&_compressedSize, header + 7, 4); @@ -356,11 +357,11 @@ return self; } - (void)dealloc { - [_method release]; + [_compressionMethod release]; [_fileName release]; [_directoryName release]; [_date release]; [_fileComment release]; [_mode release]; @@ -396,11 +397,11 @@ stringByReplacingOccurrencesOfString: @"\n" withString: @"\n\t"]; OFString *ret = [OFString stringWithFormat: @"<%@:\n" @"\tFile name = %@\n" - @"\tMethod = %@\n" + @"\tCompression method = %@\n" @"\tCompressed size = %" @PRIu32 "\n" @"\tUncompressed size = %" @PRIu32 "\n" @"\tDate = %@\n" @"\tLevel = %u\n" @"\tCRC16 = %04" @PRIX16 @"\n" @@ -412,11 +413,11 @@ @"\tOwner = %@\n" @"\tGroup = %@\n" @"\tModification date = %@\n" @"\tExtensions: %@" @">", - [self class], [self fileName], _method, _compressedSize, + [self class], [self fileName], _compressionMethod, _compressedSize, _uncompressedSize, _date, _level, _CRC16, _operatingSystemIdentifier, _fileComment, mode, _UID, _GID, _owner, _group, _modificationDate, extensions]; [ret retain]; Index: src/OFZIPArchiveEntry.h ================================================================== --- src/OFZIPArchiveEntry.h +++ src/OFZIPArchiveEntry.h @@ -20,13 +20,23 @@ OF_ASSUME_NONNULL_BEGIN /*! @file */ enum { - OF_ZIP_ARCHIVE_ENTRY_COMPRESSION_METHOD_NONE = 0, - OF_ZIP_ARCHIVE_ENTRY_COMPRESSION_METHOD_DEFLATE = 8, - OF_ZIP_ARCHIVE_ENTRY_COMPRESSION_METHOD_DEFLATE64 = 9 + OF_ZIP_ARCHIVE_ENTRY_COMPRESSION_METHOD_NONE = 0, + OF_ZIP_ARCHIVE_ENTRY_COMPRESSION_METHOD_SHRINK = 1, + OF_ZIP_ARCHIVE_ENTRY_COMPRESSION_METHOD_REDUCE_FACTOR_1 = 2, + OF_ZIP_ARCHIVE_ENTRY_COMPRESSION_METHOD_REDUCE_FACTOR_2 = 3, + OF_ZIP_ARCHIVE_ENTRY_COMPRESSION_METHOD_REDUCE_FACTOR_3 = 4, + OF_ZIP_ARCHIVE_ENTRY_COMPRESSION_METHOD_REDUCE_FACTOR_4 = 5, + OF_ZIP_ARCHIVE_ENTRY_COMPRESSION_METHOD_IMPLODE = 6, + OF_ZIP_ARCHIVE_ENTRY_COMPRESSION_METHOD_DEFLATE = 8, + OF_ZIP_ARCHIVE_ENTRY_COMPRESSION_METHOD_DEFLATE64 = 9, + OF_ZIP_ARCHIVE_ENTRY_COMPRESSION_METHOD_BZIP2 = 12, + OF_ZIP_ARCHIVE_ENTRY_COMPRESSION_METHOD_LZMA = 14, + OF_ZIP_ARCHIVE_ENTRY_COMPRESSION_METHOD_WAVPACK = 97, + OF_ZIP_ARCHIVE_ENTRY_COMPRESSION_METHOD_PPMD = 98 }; /*! * @brief Attribute compatibility part of ZIP versions. */ @@ -213,17 +223,27 @@ #ifdef __cplusplus extern "C" { #endif /*! - * @brief Converts the ZIP entry version to a string + * @brief Converts the ZIP entry version to a string. * * @param version The ZIP entry version to convert to a string * @return The ZIP entry version as a string */ extern OFString *of_zip_archive_entry_version_to_string(uint16_t version); +/*! + * @brief Convers the ZIP entry compression method to a string. + * + * @param compressionMethod The ZIP entry compression method to convert to a + * string + * @return The ZIP entry compression method as a string + */ +extern OFString *of_zip_archive_entry_compression_method_to_string( + uint16_t compressionMethod); + /*! * @brief Gets a pointer to and the size of the extensible data field with the * specified tag. * * @param extraField The extra field to search for an extensible data field with Index: src/OFZIPArchiveEntry.m ================================================================== --- src/OFZIPArchiveEntry.m +++ src/OFZIPArchiveEntry.m @@ -106,10 +106,45 @@ else return [OFString stringWithFormat: @"%u.%u, unknown %02X", (version % 0xFF) / 10, (version & 0xFF) % 10, version >> 8]; } + +OFString * +of_zip_archive_entry_compression_method_to_string(uint16_t compressionMethod) +{ + switch (compressionMethod) { + case OF_ZIP_ARCHIVE_ENTRY_COMPRESSION_METHOD_NONE: + return @"none"; + case OF_ZIP_ARCHIVE_ENTRY_COMPRESSION_METHOD_SHRINK: + return @"Shrink"; + case OF_ZIP_ARCHIVE_ENTRY_COMPRESSION_METHOD_REDUCE_FACTOR_1: + return @"Reduce (factor 1)"; + case OF_ZIP_ARCHIVE_ENTRY_COMPRESSION_METHOD_REDUCE_FACTOR_2: + return @"Reduce (factor 2)"; + case OF_ZIP_ARCHIVE_ENTRY_COMPRESSION_METHOD_REDUCE_FACTOR_3: + return @"Reduce (factor 3)"; + case OF_ZIP_ARCHIVE_ENTRY_COMPRESSION_METHOD_REDUCE_FACTOR_4: + return @"Reduce (factor 4)"; + case OF_ZIP_ARCHIVE_ENTRY_COMPRESSION_METHOD_IMPLODE: + return @"Implode"; + case OF_ZIP_ARCHIVE_ENTRY_COMPRESSION_METHOD_DEFLATE: + return @"Deflate"; + case OF_ZIP_ARCHIVE_ENTRY_COMPRESSION_METHOD_DEFLATE64: + return @"Deflate64"; + case OF_ZIP_ARCHIVE_ENTRY_COMPRESSION_METHOD_BZIP2: + return @"BZip2"; + case OF_ZIP_ARCHIVE_ENTRY_COMPRESSION_METHOD_LZMA: + return @"LZMA"; + case OF_ZIP_ARCHIVE_ENTRY_COMPRESSION_METHOD_WAVPACK: + return @"WavPack"; + case OF_ZIP_ARCHIVE_ENTRY_COMPRESSION_METHOD_PPMD: + return @"PPMd"; + default: + return @"unknown"; + } +} size_t of_zip_archive_entry_extra_field_find(OFData *extraField, uint16_t tag, uint16_t *size) { @@ -399,24 +434,27 @@ } - (OFString *)description { void *pool = objc_autoreleasePoolPush(); + OFString *compressionMethod = + of_zip_archive_entry_compression_method_to_string( + _compressionMethod); OFString *ret = [OFString stringWithFormat: @"<%@:\n" @"\tFile name = %@\n" @"\tFile comment = %@\n" @"\tGeneral purpose bit flag = %u\n" - @"\tCompression method = %u\n" @"\tCompressed size = %" @PRIu64 "\n" @"\tUncompressed size = %" @PRIu64 "\n" + @"\tCompression method = %@\n" @"\tModification date = %@\n" @"\tCRC32 = %08" @PRIX32 @"\n" @"\tExtra field = %@\n" @">", [self class], _fileName, _fileComment, _generalPurposeBitFlag, - _compressionMethod, _compressedSize, _uncompressedSize, + _compressedSize, _uncompressedSize, compressionMethod, [self modificationDate], _CRC32, _extraField]; [ret retain]; objc_autoreleasePoolPop(pool); Index: utils/ofzip/LHAArchive.m ================================================================== --- utils/ofzip/LHAArchive.m +++ utils/ofzip/LHAArchive.m @@ -173,13 +173,13 @@ @"Level: %[level]", @"level", level)]; [of_stdout writeString: @"\t"]; [of_stdout writeLine: OF_LOCALIZED( - @"list_method", - @"Method: %[method]", - @"method", [entry method])]; + @"list_compression_method", + @"Compression method: %[method]", + @"method", [entry compressionMethod])]; if ([entry operatingSystemIdentifier] != '\0') { OFString *OSID = [OFString stringWithFormat: @"%c", [entry operatingSystemIdentifier]]; Index: utils/ofzip/ZIPArchive.m ================================================================== --- utils/ofzip/ZIPArchive.m +++ utils/ofzip/ZIPArchive.m @@ -108,10 +108,13 @@ stringWithFormat: @"%" PRIu64, [entry compressedSize]]; OFString *uncompressedSize = [OFString stringWithFormat: @"%" PRIu64, [entry uncompressedSize]]; + OFString *compressionMethod = + of_zip_archive_entry_compression_method_to_string( + [entry compressionMethod]); OFString *CRC32 = [OFString stringWithFormat: @"%08" PRIX32, [entry CRC32]]; OFString *modificationDate = [[entry modificationDate] localDateStringWithFormat: @"%Y-%m-%d %H:%M:%S"]; @@ -123,10 +126,15 @@ [of_stdout writeString: @"\t"]; [of_stdout writeLine: OF_LOCALIZED( @"list_uncompressed_size", @"Uncompressed: %[size] bytes", @"size", uncompressedSize)]; + [of_stdout writeString: @"\t"]; + [of_stdout writeLine: OF_LOCALIZED( + @"list_compression_method", + @"Compression method: %[method]", + @"method", compressionMethod)]; [of_stdout writeString: @"\t"]; [of_stdout writeLine: OF_LOCALIZED(@"list_crc32", @"CRC32: %[crc32]", @"crc32", CRC32)]; [of_stdout writeString: @"\t"]; Index: utils/ofzip/lang/de.json ================================================================== --- utils/ofzip/lang/de.json +++ utils/ofzip/lang/de.json @@ -85,12 +85,12 @@ "list_type_fifo": "Typ: FIFO", "list_type_contiguous_file": "Typ: Zusammenhängende Datei", "list_type_unknown": "Typ: Unbekannt", "list_compressed_size": "Komprimierte Größe: %[size] Bytes", "list_uncompressed_size": "Unkomprimierte Größe: %[size] Bytes", + "list_compression_method": "Kompressionsmethode: %[method]", "list_date": "Datum: %[date]", - "list_method": "Methode: %[method]", "list_osid": "Betriebssystem-Identifikator: %[osid]", "list_version_made_by": "Erstellt mit Version: %[version]", "list_min_version_needed": "Mindestens benötigte Version: %[version]", "list_general_purpose_bit_flag": "General Purpose Bit Flag: %[gpbf]", "list_extra_field": "Extra-Feld: %[extra]",