diff --git a/.jazzy.yaml b/.jazzy.yaml
index a1aa0b2e..f15025a9 100644
--- a/.jazzy.yaml
+++ b/.jazzy.yaml
@@ -3,11 +3,11 @@ sourcekitten_sourcefile: docs.json
clean: true
author: Timofey Solomko
module: SWCompression
-module_version: 4.4.0
+module_version: 4.5.0
copyright: '© 2018 Timofey Solomko'
readme: README.md
github_url: https://github.com/tsolomko/SWCompression
-github_file_prefix: https://github.com/tsolomko/SWCompression/tree/4.4.0
+github_file_prefix: https://github.com/tsolomko/SWCompression/tree/4.5.0
theme: fullwidth
custom_categories:
@@ -16,6 +16,7 @@ custom_categories:
- BZip2
- Deflate
- LZMA
+ - LZMAProperties
- LZMA2
- name: Archives
children:
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 3f672e54..86ad7c4d 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,5 +1,21 @@
# Changelog
+## 4.5.0
+
+- Added APIs which allow to specify LZMA properties for decompression:
+ - Added `LZMAProperties` struct with simple memberwise initializer.
+ - Added `LZMA.decompress(data:properties:uncompressedSize:)` function with `uncompressedSize` argument being optional.
+- Added support Delta "filter" in both XZ archives and 7-Zip containers.
+- Added support for SHA-256 check type in XZ archives.
+- Added `ZipEntryInfo.crc` property.
+- Fixed incorrect result of `XZArchive.unarchive` and `XZArchive.splitUnarchive` functions when more than one "filter"
+ was used.
+- Reduced in-memory size of `ZipEntryInfo` instances.
+- Clarified documentation for `LZMA.decompress(data:)` to explain expectation about `data` argument.
+- swcomp changes:
+ - `zip -i` command now also prints CRC32 for all entries.
+ - `-v` is now accepted as an alias for `--verbose` option.
+
## 4.4.0
- Added APIs which allow creation of new TAR containers:
diff --git a/README.md b/README.md
index ae589a79..53b689ca 100644
--- a/README.md
+++ b/README.md
@@ -46,7 +46,7 @@ let package = Package(
name: "PackageName",
dependencies: [
.package(url: "https://github.com/tsolomko/SWCompression.git",
- from: "4.4.0")
+ from: "4.5.0")
],
targets: [
.target(
@@ -61,7 +61,7 @@ More details you can find in [Swift Package Manager's Documentation](https://git
### CocoaPods
-Add `pod 'SWCompression', '~> 4.4'` and `use_frameworks!` to your Podfile.
+Add `pod 'SWCompression', '~> 4.5'` and `use_frameworks!` to your Podfile.
To complete installation, run `pod install`.
@@ -105,7 +105,7 @@ BZip2 and LZMA/LZMA2 support).
### Carthage
-Add to your Cartfile `github "tsolomko/SWCompression" ~> 4.4`.
+Add to your Cartfile `github "tsolomko/SWCompression" ~> 4.5`.
Then run `carthage update`.
diff --git a/SWCompression.podspec b/SWCompression.podspec
index f223516e..2baee84c 100644
--- a/SWCompression.podspec
+++ b/SWCompression.podspec
@@ -1,7 +1,7 @@
Pod::Spec.new do |s|
s.name = "SWCompression"
- s.version = "4.4.0"
+ s.version = "4.5.0"
s.summary = "A framework with functions for working with compression, archives and containers."
s.description = "A framework with (de)compression algorithms and functions for processing various archives and containers."
diff --git a/SWCompression.xcodeproj/SWCompression.plist b/SWCompression.xcodeproj/SWCompression.plist
index 619f4df7..af41202f 100644
--- a/SWCompression.xcodeproj/SWCompression.plist
+++ b/SWCompression.xcodeproj/SWCompression.plist
@@ -15,9 +15,9 @@
CFBundlePackageType
FMWK
CFBundleShortVersionString
- 4.4.0
+ 4.5.0
CFBundleVersion
- 64
+ 66
NSHumanReadableCopyright
Copyright © 2018 Timofey Solomko. All rights reserved.
diff --git a/SWCompression.xcodeproj/TestSWCompression.plist b/SWCompression.xcodeproj/TestSWCompression.plist
index 1eb6dd8d..2a94ff90 100644
--- a/SWCompression.xcodeproj/TestSWCompression.plist
+++ b/SWCompression.xcodeproj/TestSWCompression.plist
@@ -15,8 +15,8 @@
CFBundlePackageType
BNDL
CFBundleShortVersionString
- 4.4.0
+ 4.5.0
CFBundleVersion
- 64
+ 66
diff --git a/SWCompression.xcodeproj/project.pbxproj b/SWCompression.xcodeproj/project.pbxproj
index 825b8153..6df7ee7e 100644
--- a/SWCompression.xcodeproj/project.pbxproj
+++ b/SWCompression.xcodeproj/project.pbxproj
@@ -1219,7 +1219,7 @@
CLANG_WARN_SUSPICIOUS_MOVE = YES;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
- CURRENT_PROJECT_VERSION = 64;
+ CURRENT_PROJECT_VERSION = 66;
DEBUG_INFORMATION_FORMAT = dwarf;
ENABLE_STRICT_OBJC_MSGSEND = YES;
ENABLE_TESTABILITY = YES;
@@ -1276,7 +1276,7 @@
CLANG_WARN_SUSPICIOUS_MOVE = YES;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
- CURRENT_PROJECT_VERSION = 64;
+ CURRENT_PROJECT_VERSION = 66;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
ENABLE_STRICT_OBJC_MSGSEND = YES;
"FRAMEWORK_SEARCH_PATHS[sdk=appletvos*]" = "\"$(SRCROOT)/Carthage/Build/tvOS\"";
@@ -1314,7 +1314,7 @@
APPLICATION_EXTENSION_API_ONLY = YES;
DEFINES_MODULE = YES;
DYLIB_COMPATIBILITY_VERSION = 1;
- DYLIB_CURRENT_VERSION = 64;
+ DYLIB_CURRENT_VERSION = 66;
DYLIB_INSTALL_NAME_BASE = "@rpath";
INFOPLIST_FILE = SWCompression.xcodeproj/SWCompression.plist;
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
@@ -1342,7 +1342,7 @@
APPLICATION_EXTENSION_API_ONLY = YES;
DEFINES_MODULE = YES;
DYLIB_COMPATIBILITY_VERSION = 1;
- DYLIB_CURRENT_VERSION = 64;
+ DYLIB_CURRENT_VERSION = 66;
DYLIB_INSTALL_NAME_BASE = "@rpath";
INFOPLIST_FILE = SWCompression.xcodeproj/SWCompression.plist;
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
diff --git a/Sources/LZMA/LZMA.swift b/Sources/LZMA/LZMA.swift
index 4b8da10f..38fe3385 100644
--- a/Sources/LZMA/LZMA.swift
+++ b/Sources/LZMA/LZMA.swift
@@ -6,19 +6,19 @@
import Foundation
import BitByteData
-/// Provides decompression function for LZMA algorithm.
+/// Provides decompression function for LZMA.
public class LZMA: DecompressionAlgorithm {
/**
- Decompresses `data` using LZMA algortihm.
+ Decompresses `data` using LZMA.
- Note: It is assumed that the first nine bytes of `data` represent standard LZMA properties (so called "lc", "lp"
and "pb"), dictionary size, and uncompressed size all encoded with standard encoding scheme of LZMA format.
- Parameter data: Data compressed with LZMA.
- - Throws: `LZMAError` if unexpected byte (bit) sequence was encountered in `data`.
- It may indicate that either data is damaged or it might not be compressed with LZMA at all.
+ - Throws: `LZMAError` if unexpected byte (bit) sequence was encountered in `data`. It may indicate that either data
+ is damaged or it might not be compressed with LZMA at all.
- Returns: Decompressed data.
*/
@@ -29,6 +29,26 @@ public class LZMA: DecompressionAlgorithm {
return try decompress(byteReader, properties, uncompSize)
}
+ /**
+ Decompresses `data` using LZMA with specified algorithm's `properties`, and, optionally, output's
+ `uncompressedSize`. If `uncompressedSize` is nil, then `data` must contain finish marker.
+
+ - Note: It is assumed that `data` begins immediately with LZMA compressed bytes with no LZMA properties at the
+ beginning.
+
+ - Warning: There is no validation performed for properties of `properties` argument. This API is intended to be
+ used by advanced users.
+
+ - Parameter data: Data compressed with LZMA.
+ - Parameter properties: Properties of LZMA (such as lc, lp, etc.)
+ - Parameter uncompressedSize: Size of uncompressed data; `nil` if it is unknown. In case of `nil`, finish marker
+ must be present in `data`.
+
+ - Throws: `LZMAError` if unexpected byte (bit) sequence was encountered in `data`. It may indicate that either data
+ is damaged or it might not be compressed with LZMA at all.
+
+ - Returns: Decompressed data.
+ */
public static func decompress(data: Data,
properties: LZMAProperties,
uncompressedSize: Int? = nil) throws -> Data {
diff --git a/Sources/LZMA/LZMAProperties.swift b/Sources/LZMA/LZMAProperties.swift
index 4e00919d..d0b8c457 100644
--- a/Sources/LZMA/LZMAProperties.swift
+++ b/Sources/LZMA/LZMAProperties.swift
@@ -5,11 +5,24 @@
import BitByteData
+/// Properties of LZMA. This API is intended to be used by advanced users.
public struct LZMAProperties {
+ /// Number of bits used for the literal encoding context.
public var lc: Int
+
+ /// Number of bits to include in "literal position state".
public var lp: Int
+
+ /// Number of bits to include in "position state".
public var pb: Int
+
+ /**
+ Size of the dictionary.
+
+ - Note: Dictionary size cannot be less than 4096. In case of attempt to set it to the value less than 4096 it will
+ be automatically set to 4096 instead.
+ */
public var dictionarySize: Int {
didSet {
if dictionarySize < 1 << 12 {
@@ -18,6 +31,11 @@ public struct LZMAProperties {
}
}
+ /**
+ Initializes LZMA properties with values of lc, lp, pb, and dictionary size.
+
+ - Note: It is not tested if values of lc, lp, and pb are valid.
+ */
public init(lc: Int, lp: Int, pb: Int, dictionarySize: Int) {
self.lc = lc
self.lp = lp
diff --git a/Sources/swcomp/main.swift b/Sources/swcomp/main.swift
index 7d6d92c3..a7ad4f1e 100644
--- a/Sources/swcomp/main.swift
+++ b/Sources/swcomp/main.swift
@@ -7,7 +7,7 @@ import Foundation
import SWCompression
import SwiftCLI
-let cli = CLI(name: "swcomp", version: "4.4.0",
+let cli = CLI(name: "swcomp", version: "4.5.0",
description: """
swcomp - small command-line client for SWCompression framework.
Serves as an example of SWCompression usage.