Adopted Span and MutableSpan for buffers across the library to adapt to Swift 6.4.
This commit is contained in:
@@ -152,9 +152,10 @@ extension Network {
|
||||
|
||||
/// Reads up to `buffer.count` response bytes. Returns the number of
|
||||
/// bytes read.
|
||||
public func read(into buffer: UnsafeMutableRawBufferPointer) throws(NetError) -> Int {
|
||||
let result = httpAPI.pointee.read.unsafelyUnwrapped(pointer, buffer.baseAddress,
|
||||
UInt32(buffer.count))
|
||||
public func read(into buffer: inout MutableSpan<UInt8>) throws(NetError) -> Int {
|
||||
let result = buffer.withUnsafeMutableBufferPointer { buffer in
|
||||
httpAPI.pointee.read.unsafelyUnwrapped(pointer, buffer.baseAddress, UInt32(buffer.count))
|
||||
}
|
||||
if result < 0 {
|
||||
throw NetError(rawValue: result) ?? .unknown
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user