Skip to content

Commit 8456d22

Browse files
committed
[SE-0134] Another fixup for UTF8-related property renaming
1 parent dc1227f commit 8456d22

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

test/1_stdlib/TestData.swift

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -128,8 +128,10 @@ class TestData : TestDataSuper {
128128
func dataFrom(_ string : String) -> Data {
129129
// Create a Data out of those bytes
130130
return string.utf8CString.withUnsafeBufferPointer { (ptr) in
131-
// Subtract 1 so we don't get the null terminator byte. This matches NSString behavior.
132-
return Data(bytes: UnsafeRawPointer(ptr.baseAddress!), count: ptr.count - 1)
131+
ptr.baseAddress!.withMemoryRebound(to: UInt8.self, capacity: ptr.count) {
132+
// Subtract 1 so we don't get the null terminator byte. This matches NSString behavior.
133+
return Data(bytes: $0, count: ptr.count - 1)
134+
}
133135
}
134136
}
135137

0 commit comments

Comments
 (0)