From 3b909ba75da84e92c9b747540f8b9f4f8715ae09 Mon Sep 17 00:00:00 2001 From: giginet Date: Mon, 16 Sep 2019 23:34:50 +0900 Subject: [PATCH] Avoid warnings on Xcode11 --- Sources/xcodeproj/Extensions/String+md5.swift | 8 +++++--- Sources/xcodeproj/Utils/PBXBatchUpdater.swift | 2 +- Sources/xcodeproj/Utils/ReferenceGenerator.swift | 2 +- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/Sources/xcodeproj/Extensions/String+md5.swift b/Sources/xcodeproj/Extensions/String+md5.swift index f70d22ac9..da7a71424 100644 --- a/Sources/xcodeproj/Extensions/String+md5.swift +++ b/Sources/xcodeproj/Extensions/String+md5.swift @@ -25,8 +25,10 @@ import Foundation extension String { var md5: String { if let data = data(using: .utf8, allowLossyConversion: true) { - let message = data.withUnsafeBytes { bytes -> [UInt8] in - Array(UnsafeBufferPointer(start: bytes, count: data.count)) + let message = data.withUnsafeBytes { bufferPointer in + Array(UnsafeBufferPointer( + start: bufferPointer.baseAddress?.assumingMemoryBound(to: UInt8.self), + count: data.count)) } let MD5Calculator = MD5(message) @@ -215,7 +217,7 @@ class MD5: HashProtocol { for chunk in BytesSequence(chunkSize: chunkSizeBytes, data: tmpMessage) { // break chunk into sixteen 32-bit words M[j], 0 ≤ j ≤ 15 - var M = toUInt32Array(chunk) + let M = toUInt32Array(chunk) assert(M.count == 16, "Invalid array") // Initialize hash value for this chunk: diff --git a/Sources/xcodeproj/Utils/PBXBatchUpdater.swift b/Sources/xcodeproj/Utils/PBXBatchUpdater.swift index e8c87204a..69674ffab 100644 --- a/Sources/xcodeproj/Utils/PBXBatchUpdater.swift +++ b/Sources/xcodeproj/Utils/PBXBatchUpdater.swift @@ -119,7 +119,7 @@ public final class PBXBatchUpdater { if let fileParentGroup = try lazilyInstantiateGroups()[groupPath] { return (fileParentGroup, groupPath) } - var components = groupPath.components + let components = groupPath.components let componentsCount = components.count - 1 for componentIndex in (0 ... componentsCount).reversed() { let currentPathComponents = components[0 ... componentIndex] diff --git a/Sources/xcodeproj/Utils/ReferenceGenerator.swift b/Sources/xcodeproj/Utils/ReferenceGenerator.swift index 81292477e..a1573e4de 100644 --- a/Sources/xcodeproj/Utils/ReferenceGenerator.swift +++ b/Sources/xcodeproj/Utils/ReferenceGenerator.swift @@ -324,7 +324,7 @@ extension ReferenceGenerator { } case .xcode: let reference = "\(acronym)_\(typeNameAndIdentifiers)_\(counter)".md5.uppercased() - return String(reference.substring(to: reference.index(reference.startIndex, offsetBy: 24))) + return String(reference[...reference.index(reference.startIndex, offsetBy: 24)]) } } }