File tree Expand file tree Collapse file tree 3 files changed +3
-2
lines changed
test/stdlib/Inputs/NSSlowString Expand file tree Collapse file tree 3 files changed +3
-2
lines changed Original file line number Diff line number Diff line change @@ -210,6 +210,7 @@ internal func _cocoaStringUTF8Count(
210
210
_ target: _CocoaString ,
211
211
range: Range < Int >
212
212
) -> Int ? {
213
+ if range. isEmpty { return 0 }
213
214
return _NSStringUTF8Count ( _objc ( target) , range: range)
214
215
}
215
216
Original file line number Diff line number Diff line change @@ -506,7 +506,7 @@ extension String.UTF8View {
506
506
// _cocoaStringUTF8Count gave us the scalar aligned count, but we still
507
507
// need to compensate for sub-scalar indexing, e.g. if `i` is in the
508
508
// middle of a two-byte UTF8 scalar.
509
- let refinedCount = count - ( i. transcodedOffset + j. transcodedOffset)
509
+ let refinedCount = ( count - i. transcodedOffset) + j. transcodedOffset
510
510
_internalInvariant ( refinedCount == _distance ( from: i, to: j) )
511
511
return refinedCount
512
512
}
Original file line number Diff line number Diff line change @@ -31,7 +31,7 @@ - (NSUInteger)length {
31
31
return self.stringHolder .length ;
32
32
}
33
33
34
- - (id )copy {
34
+ - (id )copyWithZone : ( NSZone *) unused {
35
35
return self;
36
36
}
37
37
You can’t perform that action at this time.
0 commit comments