Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ All notable changes to this project will be documented in this file. Changes not
- Update `HttpParser` so it percent-encodes the URL components before initializing `URLComponents`. ([#423](https://github.com/httpswift/swifter/pull/423)) by [@nejcvivod](https://github.com/nejcvivod)
- Update `SwifterTestsHttpParser` with a test for parsing bracketed query strings. ([#423](https://github.com/httpswift/swifter/pull/423)) by [@nejcvivod](https://github.com/nejcvivod)
- Use `swift_version` CocoaPods DSL. ([#425](https://github.com/httpswift/swifter/pull/425)) by [@dnkoutso](https://github.com/dnkoutso)
- Fix compiler warnings in Socket+File.swift for iOS, tvOS, and Linux platforms by using `withUnsafeBytes` rather than `&` to get a scoped UnsafeRawPointer.

# [1.4.7]

Expand Down
14 changes: 9 additions & 5 deletions XCode/Sources/Socket+File.swift
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,15 @@ import Foundation
}
var writeCounter = 0
while writeCounter < readResult {
#if os(Linux)
let writeResult = send(target, &buffer + writeCounter, readResult - writeCounter, Int32(MSG_NOSIGNAL))
#else
let writeResult = write(target, &buffer + writeCounter, readResult - writeCounter)
#endif
let writeResult = buffer.withUnsafeBytes { (ptr) -> Int in
let start = ptr.baseAddress! + writeCounter
let len = readResult - writeCounter
#if os(Linux)
return send(target, start, len, Int32(MSG_NOSIGNAL))
#else
return write(target, start, len)
#endif
}
guard writeResult > 0 else {
return Int32(writeResult)
}
Expand Down