Skip to content
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

Minor features (NSNetService and nullability fixes) #674

Merged
merged 3 commits into from
May 9, 2019

Conversation

seanm
Copy link
Contributor

@seanm seanm commented Feb 7, 2019

These changes are not as trivial as my last PR, but still pretty straightforward.

@seanm
Copy link
Contributor Author

seanm commented Feb 7, 2019

@chrisballinger @jakebromberg @jdeff @zhouzhongguang as you've all committed to this project recently, perhaps you'd care to review this too?

@@ -656,7 +662,7 @@ typedef NS_ENUM(NSInteger, GCDAsyncSocketError) {
* completes writing the bytes (which is NOT immediately after this method returns, but rather at a later time
* when the delegate method notifies you), then you should first copy the bytes, and pass the copy to this method.
**/
- (void)writeData:(NSData *)data withTimeout:(NSTimeInterval)timeout tag:(long)tag;
- (void)writeData:(nullable NSData *)data withTimeout:(NSTimeInterval)timeout tag:(long)tag;
Copy link
Collaborator

Choose a reason for hiding this comment

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

When would it be valid to pass nil data here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I made it nullable to conform to the docs, line 651: "If you pass in nil or zero-length data, this method does nothing and the delegate will not be called." There could be code out there relying on this.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm ok with reverting it to nonnull and changing the docs if you'd prefer...

seanm added 3 commits April 26, 2019 16:02
readDataToData: and writeData: are documented to accept nil data and indeed behave as documented, therefore make the parameter nullable as some users may already rely on this behaviour.
NSURL path can return nil, but fileExistsAtPath: can't accept nil, so the compiler was warning, even though this would never likely happen in practice. Added nil check.
Copy link
Collaborator

@chrisballinger chrisballinger left a comment

Choose a reason for hiding this comment

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

Looks good to me, thank you!

@chrisballinger chrisballinger merged commit b179ea4 into robbiehanson:master May 9, 2019
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.

2 participants