From 4609fa09693178343dc0c1267620baf0d0b87f3e Mon Sep 17 00:00:00 2001 From: Timofey Solomko Date: Mon, 2 Oct 2017 00:31:37 +0300 Subject: [PATCH] Swiftlint autocorect --- Sources/BZip2+BlockSize.swift | 6 +++--- Sources/BZip2+Compress.swift | 11 +++++------ Sources/BurrowsWheeler.swift | 1 - Sources/Protocols.swift | 4 ++-- Sources/XZArchive.swift | 2 +- Tests/BZip2CompressionTests.swift | 2 +- 6 files changed, 12 insertions(+), 14 deletions(-) diff --git a/Sources/BZip2+BlockSize.swift b/Sources/BZip2+BlockSize.swift index 8106082f..dc2782dd 100644 --- a/Sources/BZip2+BlockSize.swift +++ b/Sources/BZip2+BlockSize.swift @@ -6,7 +6,7 @@ import Foundation public extension BZip2 { - + public enum BlockSize: Int { case one = 1 case two = 2 @@ -21,7 +21,7 @@ public extension BZip2 { } extension BZip2.BlockSize { - + func headerByte() -> Int { switch self { case .one: @@ -44,5 +44,5 @@ extension BZip2.BlockSize { return 0x39 } } - + } diff --git a/Sources/BZip2+Compress.swift b/Sources/BZip2+Compress.swift index 9cf5f723..e5e13af5 100644 --- a/Sources/BZip2+Compress.swift +++ b/Sources/BZip2+Compress.swift @@ -6,11 +6,11 @@ import Foundation extension BZip2: CompressionAlgorithm { - + public static func compress(data: Data) -> Data { return compress(data: data, blockSize: .one) } - + public static func compress(data: Data, blockSize: BlockSize) -> Data { let bitWriter = BitWriter(bitOrder: .straight) let rawBlockSize = blockSize.rawValue * 100 * 1024 @@ -23,10 +23,10 @@ extension BZip2: CompressionAlgorithm { for i in stride(from: 0, to: data.count, by: rawBlockSize) { let blockData = data.subdata(in: i..> 31) totalCRC ^= blockCRC - + // Start block header. bitWriter.write(number: 0x314159265359, bitsCount: 48) // Block magic number. bitWriter.write(number: blockCRC.toInt(), bitsCount: 32) // Block crc32. @@ -45,7 +45,7 @@ extension BZip2: CompressionAlgorithm { private static func process(block data: Data, _ bitWriter: BitWriter) { var out = [Int]() - + // Run Length Encoding var index = 0 while index < data.count { @@ -322,4 +322,3 @@ extension BZip2: CompressionAlgorithm { } } - diff --git a/Sources/BurrowsWheeler.swift b/Sources/BurrowsWheeler.swift index ef28d60e..24bb476c 100644 --- a/Sources/BurrowsWheeler.swift +++ b/Sources/BurrowsWheeler.swift @@ -60,5 +60,4 @@ class BurrowsWheeler { return pointers } - } diff --git a/Sources/Protocols.swift b/Sources/Protocols.swift index 17b55f9c..7561e115 100644 --- a/Sources/Protocols.swift +++ b/Sources/Protocols.swift @@ -23,10 +23,10 @@ public protocol DecompressionAlgorithm { /// A type that provides an implementation of a particular compression algorithm. public protocol CompressionAlgorithm { - + /// Cmpress data with particular algorithm. static func compress(data: Data) throws -> Data - + } /// A type that represents a container of files, directories and/or other data. diff --git a/Sources/XZArchive.swift b/Sources/XZArchive.swift index c58ce25c..fee9a991 100644 --- a/Sources/XZArchive.swift +++ b/Sources/XZArchive.swift @@ -7,7 +7,7 @@ import Foundation /// Provides unarchive function for XZ archives. public class XZArchive: Archive { - + enum CheckType: Int { case none = 0x00 case crc32 = 0x01 diff --git a/Tests/BZip2CompressionTests.swift b/Tests/BZip2CompressionTests.swift index 6f524661..20d41724 100644 --- a/Tests/BZip2CompressionTests.swift +++ b/Tests/BZip2CompressionTests.swift @@ -93,7 +93,7 @@ class BZip2CompressTests: XCTestCase { } #endif - + func testWithAnswer8BZip2Compress() throws { try answerTest("test8") }