ServiceInfos of Gzip and Zlib are now Equatable.

This commit is contained in:
Timofey Solomko
2016-11-21 19:23:27 +03:00
parent e2fbf3da9f
commit 9123b24e85
2 changed files with 19 additions and 2 deletions
+9 -1
View File
@@ -36,7 +36,8 @@ public class GzipArchive: Archive {
static let fcomment: UInt8 = 0x10
}
struct ServiceInfo {
struct ServiceInfo: Equatable {
let magic: [UInt8]
let method: UInt8
let flags: UInt8
@@ -49,6 +50,13 @@ public class GzipArchive: Archive {
var fileName: String
var comment: String
var crc: UInt16
public static func ==(lhs: ServiceInfo, rhs: ServiceInfo) -> Bool {
return lhs.magic == rhs.magic && lhs.method == rhs.method &&
lhs.flags == rhs.flags && lhs.mtime == rhs.mtime && lhs.extraFlags == rhs.extraFlags &&
lhs.osType == rhs.osType && lhs.startPoint == rhs.startPoint &&
lhs.fileName == rhs.fileName && lhs.comment == rhs.comment && lhs.crc == rhs.crc
}
}
static func serviceInfo(archiveData data: Data) throws -> ServiceInfo {
+10 -1
View File
@@ -38,11 +38,20 @@ public class ZlibArchive: Archive {
case slowAlgorithm = 3
}
struct ServiceInfo {
struct ServiceInfo: Equatable {
let compressionMethod: UInt8
let windowSize: Int
let compressionLevel: CompressionLevel
var startPoint: Int
public static func ==(lhs: ServiceInfo, rhs: ServiceInfo) -> Bool {
return lhs.compressionMethod == rhs.compressionMethod &&
lhs.windowSize == rhs.windowSize &&
lhs.compressionLevel == rhs.compressionLevel &&
lhs.startPoint == rhs.startPoint
}
}
static func serviceInfo(archiveData data: Data) throws -> ServiceInfo {