Swiftlint autocorect

This commit is contained in:
Timofey Solomko
2017-10-02 00:31:37 +03:00
parent 480faf58bb
commit 4609fa0969
6 changed files with 12 additions and 14 deletions
+3 -3
View File
@@ -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
}
}
}
+5 -6
View File
@@ -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..<min(data.count, i + rawBlockSize))
let blockCRC = CheckSums.bzip2CRC32(blockData)
totalCRC = (totalCRC << 1) | (totalCRC >> 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 {
}
}
-1
View File
@@ -60,5 +60,4 @@ class BurrowsWheeler {
return pointers
}
}
+2 -2
View File
@@ -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.
+1 -1
View File
@@ -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
+1 -1
View File
@@ -93,7 +93,7 @@ class BZip2CompressTests: XCTestCase {
}
#endif
func testWithAnswer8BZip2Compress() throws {
try answerTest("test8")
}