Skip to content

Documentation changes #1311

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Nov 10, 2017
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions Foundation/URLSession/http/HTTPBodySource.swift
Original file line number Diff line number Diff line change
Expand Up @@ -20,21 +20,21 @@ import CoreFoundation
import Dispatch


/// Turn `NSData` into `dispatch_data_t`
/// Turn `NSData` into `DispatchData`
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

While you're here, can you do NSData -> Data too?

internal func createDispatchData(_ data: Data) -> DispatchData {
//TODO: Avoid copying data
let buffer = UnsafeRawBufferPointer(start: data._backing.bytes,
count: data.count)
return DispatchData(bytes: buffer)
}

/// Copy data from `dispatch_data_t` into memory pointed to by an `UnsafeMutableBufferPointer`.
/// Copy data from `DispatchData` into memory pointed to by an `UnsafeMutableBufferPointer`.
internal func copyDispatchData<T>(_ data: DispatchData, infoBuffer buffer: UnsafeMutableBufferPointer<T>) {
precondition(data.count <= (buffer.count * MemoryLayout<T>.size))
_ = data.copyBytes(to: buffer)
}

/// Split `dispatch_data_t` into `(head, tail)` pair.
/// Split `DispatchData` into `(head, tail)` pair.
internal func splitData(dispatchData data: DispatchData, atPosition position: Int) -> (DispatchData,DispatchData) {
return (data.subdata(in: 0..<position), data.subdata(in: position..<data.count))
}
Expand All @@ -57,7 +57,7 @@ internal enum _HTTPBodySourceDataChunk {
case error
}

/// A HTTP body data source backed by `dispatch_data_t`.
/// A HTTP body data source backed by `DispatchData`.
internal final class _HTTPBodyDataSource {
var data: DispatchData!
init(data: DispatchData) {
Expand Down Expand Up @@ -91,7 +91,7 @@ extension _HTTPBodyDataSource : _HTTPBodySource {
///
/// This allows non-blocking streaming of file data to the remote server.
///
/// The source reads data using a `dispatch_io_t` channel, and hence reading
/// The source reads data using a `DispatchIO` channel, and hence reading
/// file data is non-blocking. It has a local buffer that it fills as calls
/// to `getNextChunk(withLength:)` drain it.
///
Expand Down
2 changes: 1 addition & 1 deletion Foundation/URLSession/http/MultiHandle.swift
Original file line number Diff line number Diff line change
Expand Up @@ -351,7 +351,7 @@ fileprivate extension URLSession._MultiHandle {
case .milliseconds(let milliseconds):
if (timeoutSource == nil) || timeoutSource!.milliseconds != milliseconds {
//TODO: Could simply change the existing timer by calling
// dispatch_source_set_timer() again.
// DispatchSourceTimer() again.
let block = DispatchWorkItem { [weak self] in
self?.timeoutTimerFired()
}
Expand Down