From a5dc7dc88f197e2d628aeb38e4086027e81e1428 Mon Sep 17 00:00:00 2001 From: Timofey Solomko Date: Sat, 27 May 2017 19:59:02 +0300 Subject: [PATCH] Some zip classes are made final. Moved some internal comments. --- SWCompression.xcodeproj/project.pbxproj | 4 ++-- Sources/ZipContainer.swift | 9 +++++---- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/SWCompression.xcodeproj/project.pbxproj b/SWCompression.xcodeproj/project.pbxproj index c2353357..ea72ad36 100644 --- a/SWCompression.xcodeproj/project.pbxproj +++ b/SWCompression.xcodeproj/project.pbxproj @@ -433,10 +433,10 @@ 06CC187E1DE35607003532F5 /* DeflateTests.swift */, 0680E1B21DDA3D0A005C05EB /* GzipTests.swift */, 0680E1B01DDA2D7C005C05EB /* ZlibTests.swift */, - 061FCE2C1DBCC6A30052F7BE /* Constants.swift */, 0675183C1E2A883600D16354 /* ZipTests.swift */, - 06BE1AD81DB410F100EE0F59 /* Info.plist */, 0696E5C51ED0B22F00921D4D /* TarTests.swift */, + 061FCE2C1DBCC6A30052F7BE /* Constants.swift */, + 06BE1AD81DB410F100EE0F59 /* Info.plist */, ); path = Tests; sourceTree = ""; diff --git a/Sources/ZipContainer.swift b/Sources/ZipContainer.swift index f794355b..e966b2ed 100644 --- a/Sources/ZipContainer.swift +++ b/Sources/ZipContainer.swift @@ -52,7 +52,7 @@ public enum ZipError: Error { } /// Represents either a file or directory entry inside ZIP archive. -public class ZipEntry: ContainerEntry { +public final class ZipEntry: ContainerEntry { private let cdEntry: CentralDirectoryEntry private var pointerData: DataWithPointer @@ -176,7 +176,7 @@ public class ZipEntry: ContainerEntry { } /// Provides function which opens ZIP archives (containers). -public class ZipContainer: Container { +public final class ZipContainer: Container { /** Processes ZIP archive (container) and returns an array of `ContainerEntries` (which are actually `ZipEntries`). @@ -456,7 +456,10 @@ struct CentralDirectoryEntry { struct EndOfCentralDirectory { + /// Number of the current disk. private(set) var currentDiskNumber: UInt32 + + /// Number of the disk with the start of CD. private(set) var cdDiskNumber: UInt32 private(set) var cdEntries: UInt64 private(set) var cdSize: UInt64 @@ -466,9 +469,7 @@ struct EndOfCentralDirectory { /// Indicates if Zip64 records should be present. var zip64RecordExists = false - /// Number of current disk. self.currentDiskNumber = pointerData.uint32FromAlignedBytes(count: 2) - /// Number of the disk with the start of CD. self.cdDiskNumber = pointerData.uint32FromAlignedBytes(count: 2) guard self.currentDiskNumber == self.cdDiskNumber else { throw ZipError.multiVolumesNotSupported }