@@ -64,7 +64,7 @@ internal func getAddressInfoForImage(atIndex i: UInt32) ->
6464 debugLog ( " BEGIN \( #function) " ) ; defer { debugLog ( " END \( #function) " ) }
6565 let header = unsafeBitCast ( _dyld_get_image_header ( i) ,
6666 to: UnsafePointer< MachHeader> . self )
67- let name = String ( validatingUTF8 : _dyld_get_image_name ( i) !) !
67+ let name = String ( validatingCString : _dyld_get_image_name ( i) !) !
6868 var size : UInt = 0
6969 let address = getsegmentdata ( header, " __TEXT " , & size)
7070 return ( name, address, size)
@@ -111,7 +111,7 @@ internal func getReflectionInfoForImage(atIndex i: UInt32) -> ReflectionInfo? {
111111 let capture = getSectionInfo ( " __swift5_capture " , header)
112112 let typeref = getSectionInfo ( " __swift5_typeref " , header)
113113 let reflstr = getSectionInfo ( " __swift5_reflstr " , header)
114- return ReflectionInfo ( imageName: String ( validatingUTF8 : imageName) !,
114+ return ReflectionInfo ( imageName: String ( validatingCString : imageName) !,
115115 fieldmd: fieldmd,
116116 assocty: assocty,
117117 builtin: builtin,
@@ -160,7 +160,7 @@ internal func getReflectionInfoForImage(atIndex i: UInt32) -> ReflectionInfo? {
160160 return _getMetadataSection ( UInt ( i) ) . map { rawPointer in
161161 let name = _getMetadataSectionName ( rawPointer)
162162 let metadataSection = rawPointer. bindMemory ( to: MetadataSections . self, capacity: 1 ) . pointee
163- return ReflectionInfo ( imageName: String ( validatingUTF8 : name) !,
163+ return ReflectionInfo ( imageName: String ( validatingCString : name) !,
164164 fieldmd: Section ( range: metadataSection. swift5_fieldmd) ,
165165 assocty: Section ( range: metadataSection. swift5_assocty) ,
166166 builtin: Section ( range: metadataSection. swift5_builtin) ,
@@ -302,7 +302,7 @@ internal func sendReflectionInfos() {
302302internal func printErrnoAndExit( ) {
303303 debugLog ( " BEGIN \( #function) " ) ; defer { debugLog ( " END \( #function) " ) }
304304 let errorCString = strerror ( errno) !
305- let message = String ( validatingUTF8 : errorCString) ! + " \n "
305+ let message = String ( validatingCString : errorCString) ! + " \n "
306306 let bytes = Array ( message. utf8)
307307 fwrite ( bytes, 1 , bytes. count, stderr)
308308 fflush ( stderr)
0 commit comments