mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
Merge pull request #68423 from glessard/se0405-take2
[se-0405] rename `String.init(validatingUTF8:)`
This commit is contained in:
@@ -64,7 +64,7 @@ internal func getAddressInfoForImage(atIndex i: UInt32) ->
|
||||
debugLog("BEGIN \(#function)"); defer { debugLog("END \(#function)") }
|
||||
let header = unsafeBitCast(_dyld_get_image_header(i),
|
||||
to: UnsafePointer<MachHeader>.self)
|
||||
let name = String(validatingUTF8: _dyld_get_image_name(i)!)!
|
||||
let name = String(validatingCString: _dyld_get_image_name(i)!)!
|
||||
var size: UInt = 0
|
||||
let address = getsegmentdata(header, "__TEXT", &size)
|
||||
return (name, address, size)
|
||||
@@ -111,7 +111,7 @@ internal func getReflectionInfoForImage(atIndex i: UInt32) -> ReflectionInfo? {
|
||||
let capture = getSectionInfo("__swift5_capture", header)
|
||||
let typeref = getSectionInfo("__swift5_typeref", header)
|
||||
let reflstr = getSectionInfo("__swift5_reflstr", header)
|
||||
return ReflectionInfo(imageName: String(validatingUTF8: imageName)!,
|
||||
return ReflectionInfo(imageName: String(validatingCString: imageName)!,
|
||||
fieldmd: fieldmd,
|
||||
assocty: assocty,
|
||||
builtin: builtin,
|
||||
@@ -160,7 +160,7 @@ internal func getReflectionInfoForImage(atIndex i: UInt32) -> ReflectionInfo? {
|
||||
return _getMetadataSection(UInt(i)).map { rawPointer in
|
||||
let name = _getMetadataSectionName(rawPointer)
|
||||
let metadataSection = rawPointer.bindMemory(to: MetadataSections.self, capacity: 1).pointee
|
||||
return ReflectionInfo(imageName: String(validatingUTF8: name)!,
|
||||
return ReflectionInfo(imageName: String(validatingCString: name)!,
|
||||
fieldmd: Section(range: metadataSection.swift5_fieldmd),
|
||||
assocty: Section(range: metadataSection.swift5_assocty),
|
||||
builtin: Section(range: metadataSection.swift5_builtin),
|
||||
@@ -302,7 +302,7 @@ internal func sendReflectionInfos() {
|
||||
internal func printErrnoAndExit() {
|
||||
debugLog("BEGIN \(#function)"); defer { debugLog("END \(#function)") }
|
||||
let errorCString = strerror(errno)!
|
||||
let message = String(validatingUTF8: errorCString)! + "\n"
|
||||
let message = String(validatingCString: errorCString)! + "\n"
|
||||
let bytes = Array(message.utf8)
|
||||
fwrite(bytes, 1, bytes.count, stderr)
|
||||
fflush(stderr)
|
||||
|
||||
Reference in New Issue
Block a user