mirror of
https://github.com/tsolomko/SWCompression.git
synced 2026-06-23 14:56:41 +00:00
ServiceInfos of Gzip and Zlib are now Equatable.
This commit is contained in:
@@ -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 {
|
||||
|
||||
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user