mirror of
https://github.com/tsolomko/SWCompression.git
synced 2026-06-23 14:56:41 +00:00
Fixed typo in the name of the function. Added function to get bytes.
This commit is contained in:
@@ -289,10 +289,10 @@
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
06A3931F1DE06FFE00182E12 /* Common */,
|
||||
069AC20C1E02DB1D0041AC13 /* LZMA.swift */,
|
||||
06E2346B1E068E9600F18798 /* XZArchive.swift */,
|
||||
063364E21DC52979007E313F /* GzipArchive.swift */,
|
||||
064492581DC606D400F10981 /* ZlibArchive.swift */,
|
||||
069AC20C1E02DB1D0041AC13 /* LZMA.swift */,
|
||||
061FCE251DBCC4BE0052F7BE /* Deflate.swift */,
|
||||
06FED40B1DD7717E0013DFB2 /* BZip2.swift */,
|
||||
06A3933D1DE070B500182E12 /* Service */,
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
// SWCompression
|
||||
//
|
||||
// Created by Timofey Solomko on 18.12.16.
|
||||
// Copyright © 2016 tsolomko. All rights reserved.
|
||||
// Copyright © 2016 Timofey Solomko. All rights reserved.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
|
||||
@@ -126,7 +126,17 @@ class DataWithPointer {
|
||||
return self.bitArray[self.index - 1]
|
||||
}
|
||||
|
||||
func intFromAlingedBytes(count: Int) -> Int {
|
||||
func alignedBytes(count: Int) -> [UInt8] {
|
||||
self.skipUntilNextByte()
|
||||
var result: [UInt8] = Array(repeating: 0, count: count)
|
||||
for i in 0..<count {
|
||||
result[i] = self.bitArray[self.index]
|
||||
self.index += 1
|
||||
}
|
||||
return result
|
||||
}
|
||||
|
||||
func intFromAlignedBytes(count: Int) -> Int {
|
||||
self.skipUntilNextByte()
|
||||
var result = 0
|
||||
for i in 0..<count {
|
||||
|
||||
+2
-2
@@ -328,13 +328,13 @@ public final class LZMA: DecompressionAlgorithm {
|
||||
let pb = properties / 5
|
||||
/// The number of literal pos bits
|
||||
let lp = properties % 5
|
||||
var dictionarySize = pointerData.intFromAlingedBytes(count: 4)
|
||||
var dictionarySize = pointerData.intFromAlignedBytes(count: 4)
|
||||
dictionarySize = dictionarySize < (1 << 12) ? 1 << 12 : dictionarySize
|
||||
|
||||
lzmaInfoPrint("lc: \(lc), lp: \(lp), pb: \(pb), dictionarySize: \(dictionarySize)")
|
||||
|
||||
/// Size of uncompressed data. -1 means it is unknown.
|
||||
var uncompressedSize = pointerData.intFromAlingedBytes(count: 8)
|
||||
var uncompressedSize = pointerData.intFromAlignedBytes(count: 8)
|
||||
uncompressedSize = Double(uncompressedSize) == pow(Double(2), Double(64)) - 1 ? -1 : uncompressedSize
|
||||
|
||||
/// An array for storing output data
|
||||
|
||||
Reference in New Issue
Block a user