mirror of
https://github.com/tsolomko/SWCompression.git
synced 2026-06-23 14:56:41 +00:00
Merge branch 'release-4.5.0' into develop
This commit is contained in:
+3
-2
@@ -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:
|
||||
|
||||
@@ -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:
|
||||
|
||||
@@ -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`.
|
||||
|
||||
|
||||
@@ -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."
|
||||
|
||||
@@ -15,9 +15,9 @@
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>FMWK</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>4.4.0</string>
|
||||
<string>4.5.0</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>64</string>
|
||||
<string>66</string>
|
||||
<key>NSHumanReadableCopyright</key>
|
||||
<string>Copyright © 2018 Timofey Solomko. All rights reserved.</string>
|
||||
</dict>
|
||||
|
||||
@@ -15,8 +15,8 @@
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>BNDL</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>4.4.0</string>
|
||||
<string>4.5.0</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>64</string>
|
||||
<string>66</string>
|
||||
</dict>
|
||||
</plist>
|
||||
|
||||
@@ -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";
|
||||
|
||||
+24
-4
@@ -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 {
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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.
|
||||
|
||||
Reference in New Issue
Block a user