Skip to content

Conversation

@kbongort
Copy link

Use withUnsafeBytes() instead, as recommended.

The warnings (which occur only on Linux, iOS, and tvOs) are:

/root/.build/checkouts/swifter/XCode/Sources/Socket+File.swift:24:52: warning: inout expression creates a temporary pointer, but argument #1 should be a pointer that outlives the call to '+'
                    let writeResult = send(target, &buffer + writeCounter, readResult - writeCounter, Int32(MSG_NOSIGNAL))
                                                   ^~~~~~~
/root/.build/checkouts/swifter/XCode/Sources/Socket+File.swift:24:52: note: implicit argument conversion from '[UInt8]' to 'UnsafeRawPointer' produces a pointer valid only for the duration of the call to '+'
                    let writeResult = send(target, &buffer + writeCounter, readResult - writeCounter, Int32(MSG_NOSIGNAL))
                                                   ^~~~~~~
/root/.build/checkouts/swifter/XCode/Sources/Socket+File.swift:24:52: note: use the 'withUnsafeBytes' method on Array in order to explicitly convert argument to buffer pointer valid for a defined scope
                    let writeResult = send(target, &buffer + writeCounter, readResult - writeCounter, Int32(MSG_NOSIGNAL))

Use withUnsafeBytes() instead, as recommended.
@swifter-bot
Copy link

swifter-bot commented Apr 10, 2020

1 Message
📖 Hey, @kbongort 👋.

Generated by 🚫 Danger

@Vkt0r Vkt0r self-requested a review April 11, 2020 04:00
Copy link
Member

@Vkt0r Vkt0r left a comment

Choose a reason for hiding this comment

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

Thanks for taking care of this 👍. This looks good.

@Vkt0r Vkt0r merged commit 425f28b into httpswift:stable Apr 11, 2020
badboy added a commit to mozilla/glean that referenced this pull request Aug 26, 2020
This includes an important bugfix to avoid warnings and an error:
httpswift/swifter#445

This is fine, because:
1. We only use Swifter in the sample app
2. We only use it for tests
3. We already built it from source anyway, so this is switching which commit to pull
badboy added a commit to mozilla/glean that referenced this pull request Aug 26, 2020
This includes an important bugfix to avoid warnings and an error:
httpswift/swifter#445

This is fine, because:
1. We only use Swifter in the sample app
2. We only use it for tests
3. We already built it from source anyway, so this is switching which commit to pull
badboy added a commit to mozilla/glean that referenced this pull request Aug 27, 2020
This includes an important bugfix to avoid warnings and an error:
httpswift/swifter#445

This is fine, because:
1. We only use Swifter in the sample app
2. We only use it for tests
3. We already built it from source anyway, so this is switching which commit to pull
badboy added a commit to mozilla/glean that referenced this pull request Aug 27, 2020
This includes an important bugfix to avoid warnings and an error:
httpswift/swifter#445

This is fine, because:
1. We only use Swifter in the sample app
2. We only use it for tests
3. We already built it from source anyway, so this is switching which commit to pull
tomieq pushed a commit to tomieq/swifterfork that referenced this pull request Apr 1, 2021
Fix build warnings from use of `&` to create a pointer to `buffer`.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants