mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
stdlib/String: if we can not get a contiguous data buffer out of NSString,
don't call into CoreFoundation to perform UTF-8 transcoding. CoreFoundation can replace ill-formed sequences with a single byte, which is not good enough to implement U+FFFD insertion. Instead, use the same transcoding routine as for contiguous buffer. Pulled out the transcoding routine into a generic function that should be specialized and simplified for the case when input is UnsafeArray; we should not be losing efficiency here. Fixes <rdar://problem/17297055> [unicode] println crashes when given string with unpaired surrogate Swift SVN r19157
This commit is contained in:
@@ -76,14 +76,3 @@ func _cocoaStringSubscriptNotInitialized(
|
||||
_fatalError("_cocoaStringSubscript not initialized")
|
||||
}
|
||||
|
||||
@public var _cocoaStringEncodeSomeUTF8: (
|
||||
target: _StringCore, position: Int
|
||||
) -> (_StringCore.IndexType, _StringCore.UTF8Chunk)
|
||||
= _cocoaStringEncodeSomeUTF8NotInitialized
|
||||
|
||||
func _cocoaStringEncodeSomeUTF8NotInitialized(
|
||||
target: _StringCore, position: Int
|
||||
) -> (_StringCore.IndexType, _StringCore.UTF8Chunk) {
|
||||
_fatalError("_cocoaStringEncodeSomeUTF8 not initialized")
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user