From 8c29772e7a1619845a07cd6f38ae42fc2be3a3a8 Mon Sep 17 00:00:00 2001 From: Roy Marmelstein Date: Wed, 20 Sep 2017 14:48:36 +0200 Subject: [PATCH] Swift 4 and Xcode 9: fix Zip build issues and errors --- Zip.xcodeproj/project.pbxproj | 22 ++++++++++++++----- .../xcshareddata/xcschemes/Zip OSX.xcscheme | 4 +++- .../xcshareddata/xcschemes/Zip tvOS.xcscheme | 4 +++- .../xcshareddata/xcschemes/Zip.xcscheme | 4 +++- .../xcshareddata/xcschemes/ZipTests.xcscheme | 4 +++- Zip/Zip.swift | 13 ++++------- Zip/minizip/unzip.c | 2 +- Zip/minizip/zip.c | 2 +- 8 files changed, 35 insertions(+), 20 deletions(-) diff --git a/Zip.xcodeproj/project.pbxproj b/Zip.xcodeproj/project.pbxproj index d654db4..18b44a5 100644 --- a/Zip.xcodeproj/project.pbxproj +++ b/Zip.xcodeproj/project.pbxproj @@ -348,7 +348,7 @@ isa = PBXProject; attributes = { LastSwiftUpdateCheck = 0720; - LastUpgradeCheck = 0800; + LastUpgradeCheck = 0900; ORGANIZATIONNAME = "Roy Marmelstein"; TargetAttributes = { 343F50FE1C8DAEEC0028C434 = { @@ -359,11 +359,11 @@ }; 347E3A731C1DFFB500A11FD3 = { CreatedOnToolsVersion = 7.2; - LastSwiftMigration = 0800; + LastSwiftMigration = 0900; }; 347E3A7D1C1DFFB500A11FD3 = { CreatedOnToolsVersion = 7.2; - LastSwiftMigration = 0800; + LastSwiftMigration = 0900; }; }; }; @@ -640,14 +640,20 @@ CLANG_CXX_LIBRARY = "libc++"; CLANG_ENABLE_MODULES = YES; CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; CLANG_WARN_CONSTANT_CONVERSION = YES; CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; CLANG_WARN_EMPTY_BODY = YES; CLANG_WARN_ENUM_CONVERSION = YES; CLANG_WARN_INFINITE_RECURSION = YES; CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; CLANG_WARN_SUSPICIOUS_MOVE = YES; CLANG_WARN_UNREACHABLE_CODE = YES; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; @@ -676,7 +682,7 @@ ONLY_ACTIVE_ARCH = YES; SDKROOT = iphoneos; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; - SWIFT_VERSION = 3.0; + SWIFT_VERSION = 4.0; TARGETED_DEVICE_FAMILY = "1,2"; VERSIONING_SYSTEM = "apple-generic"; VERSION_INFO_PREFIX = ""; @@ -692,14 +698,20 @@ CLANG_CXX_LIBRARY = "libc++"; CLANG_ENABLE_MODULES = YES; CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; CLANG_WARN_CONSTANT_CONVERSION = YES; CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; CLANG_WARN_EMPTY_BODY = YES; CLANG_WARN_ENUM_CONVERSION = YES; CLANG_WARN_INFINITE_RECURSION = YES; CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; CLANG_WARN_SUSPICIOUS_MOVE = YES; CLANG_WARN_UNREACHABLE_CODE = YES; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; @@ -721,7 +733,7 @@ MTL_ENABLE_DEBUG_INFO = NO; SDKROOT = iphoneos; SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; - SWIFT_VERSION = 3.0; + SWIFT_VERSION = 4.0; TARGETED_DEVICE_FAMILY = "1,2"; VALIDATE_PRODUCT = YES; VERSIONING_SYSTEM = "apple-generic"; diff --git a/Zip.xcodeproj/xcshareddata/xcschemes/Zip OSX.xcscheme b/Zip.xcodeproj/xcshareddata/xcschemes/Zip OSX.xcscheme index dbc1918..6d88fc1 100644 --- a/Zip.xcodeproj/xcshareddata/xcschemes/Zip OSX.xcscheme +++ b/Zip.xcodeproj/xcshareddata/xcschemes/Zip OSX.xcscheme @@ -1,6 +1,6 @@ @@ -36,6 +37,7 @@ buildConfiguration = "Debug" selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB" selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB" + language = "" launchStyle = "0" useCustomWorkingDirectory = "NO" ignoresPersistentStateOnLaunch = "NO" diff --git a/Zip.xcodeproj/xcshareddata/xcschemes/Zip.xcscheme b/Zip.xcodeproj/xcshareddata/xcschemes/Zip.xcscheme index bb47f57..f045120 100644 --- a/Zip.xcodeproj/xcshareddata/xcschemes/Zip.xcscheme +++ b/Zip.xcodeproj/xcshareddata/xcschemes/Zip.xcscheme @@ -1,6 +1,6 @@ =4.0) - let directoryAttributes = [FileAttributeKey.creationDate : creationDate, - FileAttributeKey.modificationDate : creationDate] - #else - let directoryAttributes = [FileAttributeKey.creationDate.rawValue : creationDate, - FileAttributeKey.modificationDate.rawValue : creationDate] - #endif - + + let directoryAttributes = [FileAttributeKey.creationDate : creationDate, + FileAttributeKey.modificationDate : creationDate] + do { if isDirectory { try fileManager.createDirectory(atPath: fullPath, withIntermediateDirectories: true, attributes: directoryAttributes) diff --git a/Zip/minizip/unzip.c b/Zip/minizip/unzip.c index a3b9834..ce34a90 100644 --- a/Zip/minizip/unzip.c +++ b/Zip/minizip/unzip.c @@ -982,7 +982,7 @@ extern int ZEXPORT unzGetCurrentFileInfo(unzFile file, unz_file_info * pfile_inf pfile_info->internal_fa = file_info64.internal_fa; pfile_info->external_fa = file_info64.external_fa; - pfile_info->tmu_date = file_info64.tmu_date, + pfile_info->tmu_date = file_info64.tmu_date; pfile_info->compressed_size = (uLong)file_info64.compressed_size; pfile_info->uncompressed_size = (uLong)file_info64.uncompressed_size; diff --git a/Zip/minizip/zip.c b/Zip/minizip/zip.c index 0dc5dea..366ac90 100755 --- a/Zip/minizip/zip.c +++ b/Zip/minizip/zip.c @@ -183,7 +183,7 @@ typedef struct } zip64_internal; /* Allocate a new data block */ -local linkedlist_datablock_internal* allocate_new_datablock OF(()); +local linkedlist_datablock_internal* allocate_new_datablock OF((void)); local linkedlist_datablock_internal* allocate_new_datablock() { linkedlist_datablock_internal* ldi; -- 2.26.2