diff --git a/Sources/GzipArchive.swift b/Sources/GzipArchive.swift index cecd47c8..8095bec0 100644 --- a/Sources/GzipArchive.swift +++ b/Sources/GzipArchive.swift @@ -41,7 +41,7 @@ public class GzipArchive: Archive { let magic: [UInt8] let method: UInt8 let flags: UInt8 - let mtime: UInt64 + let mtime: [UInt8] let extraFlags: UInt8 let osType: UInt8 // Starting point of compressed data. Depends on presence of optional fields. @@ -72,7 +72,7 @@ public class GzipArchive: Archive { var serviceInfo = ServiceInfo(magic: magic, method: method, flags: data[3], - mtime: Data(data[4...7]).to(type: UInt64.self), + mtime: data.bytes(from: 4..<8), extraFlags: data[8], osType: data[9], startPoint: 10, diff --git a/Tests/GzipTests.swift b/Tests/GzipTests.swift index 1417fbe6..dafddd94 100644 --- a/Tests/GzipTests.swift +++ b/Tests/GzipTests.swift @@ -28,7 +28,7 @@ class GzipTests: XCTestCase { let answerServiceInfo = GzipArchive.ServiceInfo(magic: [31, 139], method: 8, flags: 8, - mtime: 1477672923, + mtime: [219, 127, 19, 88], extraFlags: 0, osType: 3, startPoint: 19, @@ -54,7 +54,7 @@ class GzipTests: XCTestCase { let answerServiceInfo = GzipArchive.ServiceInfo(magic: [31, 139], method: 8, flags: 8, - mtime: 1479237057, + mtime: [193, 93, 43, 88], extraFlags: 0, osType: 3, startPoint: 23, @@ -80,7 +80,7 @@ class GzipTests: XCTestCase { let answerServiceInfo = GzipArchive.ServiceInfo(magic: [31, 139], method: 8, flags: 8, - mtime: 1479237147, + mtime: [27, 94, 43, 88], extraFlags: 0, osType: 3, startPoint: 23, @@ -106,7 +106,7 @@ class GzipTests: XCTestCase { let answerServiceInfo = GzipArchive.ServiceInfo(magic: [31, 139], method: 8, flags: 8, - mtime: 1477673662, + mtime: [190, 130, 19, 88], extraFlags: 0, osType: 3, startPoint: 25, @@ -133,7 +133,7 @@ class GzipTests: XCTestCase { let answerServiceInfo = GzipArchive.ServiceInfo(magic: [31, 139], method: 8, flags: 8, - mtime: 1477764584, + mtime: [232, 229, 20, 88], extraFlags: 0, osType: 3, startPoint: 20, @@ -159,7 +159,7 @@ class GzipTests: XCTestCase { let answerServiceInfo = GzipArchive.ServiceInfo(magic: [31, 139], method: 8, flags: 8, - mtime: 1479237483, + mtime: [107, 95, 43, 88], extraFlags: 0, osType: 3, startPoint: 23, @@ -185,7 +185,7 @@ class GzipTests: XCTestCase { let answerServiceInfo = GzipArchive.ServiceInfo(magic: [31, 139], method: 8, flags: 8, - mtime: 1479559913, + mtime: [233, 74, 48, 88], extraFlags: 0, osType: 3, startPoint: 23,