Skip to content

Commit 8c29772

Browse files
committed
Swift 4 and Xcode 9: fix Zip build issues and errors
1 parent 63cf422 commit 8c29772

File tree

8 files changed

+35
-20
lines changed

8 files changed

+35
-20
lines changed

Zip.xcodeproj/project.pbxproj

+17-5
Original file line numberDiff line numberDiff line change
@@ -348,7 +348,7 @@
348348
isa = PBXProject;
349349
attributes = {
350350
LastSwiftUpdateCheck = 0720;
351-
LastUpgradeCheck = 0800;
351+
LastUpgradeCheck = 0900;
352352
ORGANIZATIONNAME = "Roy Marmelstein";
353353
TargetAttributes = {
354354
343F50FE1C8DAEEC0028C434 = {
@@ -359,11 +359,11 @@
359359
};
360360
347E3A731C1DFFB500A11FD3 = {
361361
CreatedOnToolsVersion = 7.2;
362-
LastSwiftMigration = 0800;
362+
LastSwiftMigration = 0900;
363363
};
364364
347E3A7D1C1DFFB500A11FD3 = {
365365
CreatedOnToolsVersion = 7.2;
366-
LastSwiftMigration = 0800;
366+
LastSwiftMigration = 0900;
367367
};
368368
};
369369
};
@@ -640,14 +640,20 @@
640640
CLANG_CXX_LIBRARY = "libc++";
641641
CLANG_ENABLE_MODULES = YES;
642642
CLANG_ENABLE_OBJC_ARC = YES;
643+
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
643644
CLANG_WARN_BOOL_CONVERSION = YES;
645+
CLANG_WARN_COMMA = YES;
644646
CLANG_WARN_CONSTANT_CONVERSION = YES;
645647
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
646648
CLANG_WARN_EMPTY_BODY = YES;
647649
CLANG_WARN_ENUM_CONVERSION = YES;
648650
CLANG_WARN_INFINITE_RECURSION = YES;
649651
CLANG_WARN_INT_CONVERSION = YES;
652+
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
653+
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
650654
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
655+
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
656+
CLANG_WARN_STRICT_PROTOTYPES = YES;
651657
CLANG_WARN_SUSPICIOUS_MOVE = YES;
652658
CLANG_WARN_UNREACHABLE_CODE = YES;
653659
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
@@ -676,7 +682,7 @@
676682
ONLY_ACTIVE_ARCH = YES;
677683
SDKROOT = iphoneos;
678684
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
679-
SWIFT_VERSION = 3.0;
685+
SWIFT_VERSION = 4.0;
680686
TARGETED_DEVICE_FAMILY = "1,2";
681687
VERSIONING_SYSTEM = "apple-generic";
682688
VERSION_INFO_PREFIX = "";
@@ -692,14 +698,20 @@
692698
CLANG_CXX_LIBRARY = "libc++";
693699
CLANG_ENABLE_MODULES = YES;
694700
CLANG_ENABLE_OBJC_ARC = YES;
701+
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
695702
CLANG_WARN_BOOL_CONVERSION = YES;
703+
CLANG_WARN_COMMA = YES;
696704
CLANG_WARN_CONSTANT_CONVERSION = YES;
697705
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
698706
CLANG_WARN_EMPTY_BODY = YES;
699707
CLANG_WARN_ENUM_CONVERSION = YES;
700708
CLANG_WARN_INFINITE_RECURSION = YES;
701709
CLANG_WARN_INT_CONVERSION = YES;
710+
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
711+
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
702712
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
713+
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
714+
CLANG_WARN_STRICT_PROTOTYPES = YES;
703715
CLANG_WARN_SUSPICIOUS_MOVE = YES;
704716
CLANG_WARN_UNREACHABLE_CODE = YES;
705717
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
@@ -721,7 +733,7 @@
721733
MTL_ENABLE_DEBUG_INFO = NO;
722734
SDKROOT = iphoneos;
723735
SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
724-
SWIFT_VERSION = 3.0;
736+
SWIFT_VERSION = 4.0;
725737
TARGETED_DEVICE_FAMILY = "1,2";
726738
VALIDATE_PRODUCT = YES;
727739
VERSIONING_SYSTEM = "apple-generic";

Zip.xcodeproj/xcshareddata/xcschemes/Zip OSX.xcscheme

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<Scheme
3-
LastUpgradeVersion = "0800"
3+
LastUpgradeVersion = "0900"
44
version = "1.3">
55
<BuildAction
66
parallelizeBuildables = "YES"
@@ -26,6 +26,7 @@
2626
buildConfiguration = "Debug"
2727
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
2828
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
29+
language = ""
2930
shouldUseLaunchSchemeArgsEnv = "YES">
3031
<Testables>
3132
<TestableReference
@@ -55,6 +56,7 @@
5556
buildConfiguration = "Debug"
5657
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
5758
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
59+
language = ""
5860
launchStyle = "0"
5961
useCustomWorkingDirectory = "NO"
6062
ignoresPersistentStateOnLaunch = "NO"

Zip.xcodeproj/xcshareddata/xcschemes/Zip tvOS.xcscheme

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<Scheme
3-
LastUpgradeVersion = "0800"
3+
LastUpgradeVersion = "0900"
44
version = "1.3">
55
<BuildAction
66
parallelizeBuildables = "YES"
@@ -26,6 +26,7 @@
2626
buildConfiguration = "Debug"
2727
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
2828
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
29+
language = ""
2930
shouldUseLaunchSchemeArgsEnv = "YES">
3031
<Testables>
3132
</Testables>
@@ -36,6 +37,7 @@
3637
buildConfiguration = "Debug"
3738
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
3839
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
40+
language = ""
3941
launchStyle = "0"
4042
useCustomWorkingDirectory = "NO"
4143
ignoresPersistentStateOnLaunch = "NO"

Zip.xcodeproj/xcshareddata/xcschemes/Zip.xcscheme

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<Scheme
3-
LastUpgradeVersion = "0800"
3+
LastUpgradeVersion = "0900"
44
version = "1.3">
55
<BuildAction
66
parallelizeBuildables = "YES"
@@ -26,6 +26,7 @@
2626
buildConfiguration = "Debug"
2727
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
2828
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
29+
language = ""
2930
shouldUseLaunchSchemeArgsEnv = "YES">
3031
<Testables>
3132
<TestableReference
@@ -55,6 +56,7 @@
5556
buildConfiguration = "Debug"
5657
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
5758
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
59+
language = ""
5860
launchStyle = "0"
5961
useCustomWorkingDirectory = "NO"
6062
ignoresPersistentStateOnLaunch = "NO"

Zip.xcodeproj/xcshareddata/xcschemes/ZipTests.xcscheme

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<Scheme
3-
LastUpgradeVersion = "0800"
3+
LastUpgradeVersion = "0900"
44
version = "1.3">
55
<BuildAction
66
parallelizeBuildables = "YES"
@@ -10,6 +10,7 @@
1010
buildConfiguration = "Debug"
1111
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
1212
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
13+
language = ""
1314
shouldUseLaunchSchemeArgsEnv = "YES">
1415
<Testables>
1516
<TestableReference
@@ -30,6 +31,7 @@
3031
buildConfiguration = "Debug"
3132
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
3233
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
34+
language = ""
3335
launchStyle = "0"
3436
useCustomWorkingDirectory = "NO"
3537
ignoresPersistentStateOnLaunch = "NO"

Zip/Zip.swift

+4-9
Original file line numberDiff line numberDiff line change
@@ -165,15 +165,10 @@ public class Zip {
165165
let fullPath = destination.appendingPathComponent(pathString).path
166166

167167
let creationDate = Date()
168-
169-
#if swift(>=4.0)
170-
let directoryAttributes = [FileAttributeKey.creationDate : creationDate,
171-
FileAttributeKey.modificationDate : creationDate]
172-
#else
173-
let directoryAttributes = [FileAttributeKey.creationDate.rawValue : creationDate,
174-
FileAttributeKey.modificationDate.rawValue : creationDate]
175-
#endif
176-
168+
169+
let directoryAttributes = [FileAttributeKey.creationDate : creationDate,
170+
FileAttributeKey.modificationDate : creationDate]
171+
177172
do {
178173
if isDirectory {
179174
try fileManager.createDirectory(atPath: fullPath, withIntermediateDirectories: true, attributes: directoryAttributes)

Zip/minizip/unzip.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -982,7 +982,7 @@ extern int ZEXPORT unzGetCurrentFileInfo(unzFile file, unz_file_info * pfile_inf
982982
pfile_info->internal_fa = file_info64.internal_fa;
983983
pfile_info->external_fa = file_info64.external_fa;
984984

985-
pfile_info->tmu_date = file_info64.tmu_date,
985+
pfile_info->tmu_date = file_info64.tmu_date;
986986

987987
pfile_info->compressed_size = (uLong)file_info64.compressed_size;
988988
pfile_info->uncompressed_size = (uLong)file_info64.uncompressed_size;

Zip/minizip/zip.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@ typedef struct
183183
} zip64_internal;
184184

185185
/* Allocate a new data block */
186-
local linkedlist_datablock_internal* allocate_new_datablock OF(());
186+
local linkedlist_datablock_internal* allocate_new_datablock OF((void));
187187
local linkedlist_datablock_internal* allocate_new_datablock()
188188
{
189189
linkedlist_datablock_internal* ldi;

0 commit comments

Comments
 (0)