mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
index(n, stepsFrom: i)
M-x findr-query-replace \<advance(\([^:]+?\),\([ ]+\)by: *\([^(),]*\|[^(),]+([^()]*)[^(),]*\)\(,\(?:[ ]+\)limit: *\(?:[^()]*\|[^()]+([^()]*)[^()]*\)\)?) index(\3,\2stepsFrom: \1\4)
This commit is contained in:
@@ -721,13 +721,13 @@ internal func _transcodeSomeUTF16AsUTF8<
|
||||
// Replace it with U+FFFD.
|
||||
r = 0xbdbfef
|
||||
scalarUtf8Length = 3
|
||||
} else if _slowPath(input.advance(nextIndex, by: 1) == endIndex) {
|
||||
} else if _slowPath(input.index(1, stepsFrom: nextIndex) == endIndex) {
|
||||
// We have seen a high-surrogate and EOF, so we have an ill-formed
|
||||
// sequence. Replace it with U+FFFD.
|
||||
r = 0xbdbfef
|
||||
scalarUtf8Length = 3
|
||||
} else {
|
||||
let unit1 = UInt(input[input.advance(nextIndex, by: 1)])
|
||||
let unit1 = UInt(input[input.index(1, stepsFrom: nextIndex)])
|
||||
if _fastPath((unit1 >> 10) == 0b1101_11) {
|
||||
// `unit1` is a low-surrogate. We have a well-formed surrogate
|
||||
// pair.
|
||||
@@ -755,7 +755,7 @@ internal func _transcodeSomeUTF16AsUTF8<
|
||||
result |= numericCast(r) << shift
|
||||
utf8Count += scalarUtf8Length
|
||||
}
|
||||
nextIndex = input.advance(nextIndex, by: utf16Length)
|
||||
nextIndex = input.index(utf16Length, stepsFrom: nextIndex)
|
||||
}
|
||||
// FIXME: Annoying check, courtesy of <rdar://problem/16740169>
|
||||
if utf8Count < sizeofValue(result) {
|
||||
|
||||
Reference in New Issue
Block a user