From ec6f9e7d0693d51150e1a543a4d7f9475a4bad68 Mon Sep 17 00:00:00 2001 From: Tellow Krinkle Date: Sun, 21 Apr 2019 19:19:01 -0500 Subject: [PATCH] Fix AssetBundleStringExtractor for Swift 5 Apparently I was never supposed to use withMemoryRebound like that and it finally started checking that in Swift 5 --- .../AssetBundleStringExtractor.swift | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/scripts/CharacterInfoExtraction/AssetBundleStringExtractor.swift b/scripts/CharacterInfoExtraction/AssetBundleStringExtractor.swift index 3060a0a..6365ad8 100644 --- a/scripts/CharacterInfoExtraction/AssetBundleStringExtractor.swift +++ b/scripts/CharacterInfoExtraction/AssetBundleStringExtractor.swift @@ -20,9 +20,9 @@ guard CommandLine.arguments.count > 1 else { #if !swift(>=4.2) extension Collection { -func firstIndex(where predicate: (Element) throws -> Bool) rethrows -> Index? { -return try self.index(where: predicate) -} + func firstIndex(where predicate: (Element) throws -> Bool) rethrows -> Index? { + return try self.index(where: predicate) + } } #endif @@ -92,13 +92,12 @@ func stringFinder(data: Data, maxStringLength: Int = 100) -> [String] { let unicode = UnsafeBufferPointer(rebasing: ints[(index + 1)...].prefix(uint32Length)) // Ensure padding is all 0s guard padding == 0 || unicode.last!.littleEndian &>> (padding * 8) == 0 else { continue } - let optionalStr = unicode.withMemoryRebound(to: UInt8.self) { (unicode) -> String? in - let stringUnicode = unicode[..