From 745368e50d00f69019773b64d4155d0fbb081539 Mon Sep 17 00:00:00 2001 From: Timofey Solomko Date: Wed, 16 Aug 2017 22:47:24 +0300 Subject: [PATCH] Small fixes here and there --- SWCompression.podspec | 2 +- Sources/TarEntry.swift | 1 + Sources/XZArchive.swift | 9 ++++----- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/SWCompression.podspec b/SWCompression.podspec index bcfbb6d7..eb51fed1 100644 --- a/SWCompression.podspec +++ b/SWCompression.podspec @@ -70,7 +70,7 @@ Pod::Spec.new do |s| s.subspec 'SevenZip' do |sp| sp.dependency 'SWCompression/LZMA' - sp.source_files = 'Sources/{7z*,CheckSums,}.swift' + sp.source_files = 'Sources/{7z*,CheckSums,BitReader}.swift' sp.pod_target_xcconfig = { 'OTHER_SWIFT_FLAGS' => '-DSWCOMPRESSION_POD_SEVENZIP' } end diff --git a/Sources/TarEntry.swift b/Sources/TarEntry.swift index 24b205e8..83f7df07 100644 --- a/Sources/TarEntry.swift +++ b/Sources/TarEntry.swift @@ -175,6 +175,7 @@ public class TarEntry: ContainerEntry { // File mode guard let octalPosixPermissions = Int(try pointerData.nullSpaceEndedAsciiString(cutoff: 8)) else { throw TarError.fieldIsNotNumber } + // Sometime file mode also contains unix type, so we need to filter it out. let posixPermissions = octalPosixPermissions.octalToDecimal() & 0xFFF attributesDict[FileAttributeKey.posixPermissions] = posixPermissions mode = posixPermissions diff --git a/Sources/XZArchive.swift b/Sources/XZArchive.swift index c449976c..7f7e46fa 100644 --- a/Sources/XZArchive.swift +++ b/Sources/XZArchive.swift @@ -203,7 +203,7 @@ public class XZArchive: Archive { Bit values 00, 01, 10, 11 indicate filters number from 1 to 4, so we actually need to add 1 to get filters' number. */ - let numberOfFilters = blockFlags & 0x03 + 1 + let filtersCount = blockFlags & 0x03 + 1 guard blockFlags & 0x3C == 0 else { throw XZError.fieldReservedValue } @@ -214,13 +214,12 @@ public class XZArchive: Archive { let uncompressedSize = blockFlags & 0x80 != 0 ? try pointerData.multiByteDecode() : -1 var filters: [(DataWithPointer) throws -> [UInt8]] = [] - for _ in 0..