@@ -79,23 +79,23 @@ public struct StringRef : CustomStringConvertible, NoReflectionChildren {
7979 public var description : String { string }
8080
8181 public var count : Int {
82- Int ( _bridged. size ( ) )
82+ _bridged. count
8383 }
8484
8585 public subscript( index: Int ) -> UInt8 {
86- let buffer = UnsafeBufferPointer < UInt8 > ( start: _bridged. uintData ( ) , count: count)
86+ let buffer = UnsafeBufferPointer < UInt8 > ( start: _bridged. data , count: count)
8787 return buffer [ index]
8888 }
8989
9090 public static func == ( lhs: StringRef , rhs: StringRef ) -> Bool {
91- let lhsBuffer = UnsafeBufferPointer < UInt8 > ( start: lhs. _bridged. uintData ( ) , count: lhs. count)
92- let rhsBuffer = UnsafeBufferPointer < UInt8 > ( start: rhs. _bridged. uintData ( ) , count: rhs. count)
91+ let lhsBuffer = UnsafeBufferPointer < UInt8 > ( start: lhs. _bridged. data , count: lhs. count)
92+ let rhsBuffer = UnsafeBufferPointer < UInt8 > ( start: rhs. _bridged. data , count: rhs. count)
9393 if lhsBuffer. count != rhsBuffer. count { return false }
9494 return lhsBuffer. elementsEqual ( rhsBuffer, by: == )
9595 }
9696
9797 public static func == ( lhs: StringRef , rhs: StaticString ) -> Bool {
98- let lhsBuffer = UnsafeBufferPointer < UInt8 > ( start: lhs. _bridged. uintData ( ) , count: lhs. count)
98+ let lhsBuffer = UnsafeBufferPointer < UInt8 > ( start: lhs. _bridged. data , count: lhs. count)
9999 return rhs. withUTF8Buffer { ( rhsBuffer: UnsafeBufferPointer < UInt8 > ) in
100100 if lhsBuffer. count != rhsBuffer. count { return false }
101101 return lhsBuffer. elementsEqual ( rhsBuffer, by: == )
@@ -116,17 +116,17 @@ extension String {
116116 public func _withBridgedStringRef< T> ( _ c: ( BridgedStringRef ) -> T ) -> T {
117117 var str = self
118118 return str. withUTF8 { buffer in
119- return c ( BridgedStringRef ( buffer. baseAddress, buffer. count) )
119+ return c ( BridgedStringRef ( data : buffer. baseAddress, count : buffer. count) )
120120 }
121121 }
122122
123123 public init ( _ s: BridgedStringRef ) {
124- let buffer = UnsafeBufferPointer < UInt8 > ( start: s. uintData ( ) , count: Int ( s . size ( ) ) )
124+ let buffer = UnsafeBufferPointer < UInt8 > ( start: s. data , count: s . count )
125125 self . init ( decoding: buffer, as: UTF8 . self)
126126 }
127127
128128 public init ( taking s: BridgedOwnedString ) {
129- let buffer = UnsafeBufferPointer < UInt8 > ( start: s. uintData ( ) , count: s. size ( ) )
129+ let buffer = UnsafeBufferPointer < UInt8 > ( start: s. data , count: s. count )
130130 self . init ( decoding: buffer, as: UTF8 . self)
131131 s. destroy ( )
132132 }
@@ -135,7 +135,7 @@ extension String {
135135extension Array {
136136 public func withBridgedArrayRef< T> ( _ c: ( BridgedArrayRef ) -> T ) -> T {
137137 return withUnsafeBytes { buf in
138- return c ( BridgedArrayRef ( data: buf. baseAddress!, numElements : count) )
138+ return c ( BridgedArrayRef ( data: buf. baseAddress!, count : count) )
139139 }
140140 }
141141}
@@ -164,8 +164,8 @@ extension Optional where Wrapped == UnsafeMutablePointer<BridgedSwiftObject> {
164164
165165extension BridgedArrayRef {
166166 public func withElements< T, R> ( ofType ty: T . Type , _ c: ( UnsafeBufferPointer < T > ) -> R ) -> R {
167- let start = data? . bindMemory ( to: ty, capacity: numElements ) ;
168- let buffer = UnsafeBufferPointer ( start: start, count: numElements ) ;
167+ let start = data? . bindMemory ( to: ty, capacity: count )
168+ let buffer = UnsafeBufferPointer ( start: start, count: count )
169169 return c ( buffer)
170170 }
171171}
0 commit comments