Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions Sources/xcodeproj/Extensions/String+md5.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion Sources/xcodeproj/Utils/PBXBatchUpdater.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down
2 changes: 1 addition & 1 deletion Sources/xcodeproj/Utils/ReferenceGenerator.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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)])
}
}
}