Skip to content

Commit

Permalink
Merge pull request #764 from hvbommel/FixWarnings
Browse files Browse the repository at this point in the history
Fix Xcode 12.5 Warning: Write to autoreleasing out parameter ...
  • Loading branch information
chrisballinger committed May 12, 2021
2 parents 9f47ef9 + 2d131ac commit 5ddba5e
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions Source/GCD/GCDAsyncSocket.m
Original file line number Diff line number Diff line change
Expand Up @@ -1077,6 +1077,7 @@ + (nullable instancetype)socketFromConnectedSocketFD:(int)socketFD delegate:(nul
+ (nullable instancetype)socketFromConnectedSocketFD:(int)socketFD delegate:(nullable id<GCDAsyncSocketDelegate>)aDelegate delegateQueue:(nullable dispatch_queue_t)dq socketQueue:(nullable dispatch_queue_t)sq error:(NSError* __autoreleasing *)error
{
__block BOOL errorOccured = NO;
__block NSError *thisError = nil;

GCDAsyncSocket *socket = [[[self class] alloc] initWithDelegate:aDelegate delegateQueue:dq socketQueue:sq];

Expand All @@ -1093,8 +1094,7 @@ + (nullable instancetype)socketFromConnectedSocketFD:(int)socketFD delegate:(nul
NSDictionary *userInfo = @{NSLocalizedDescriptionKey : errMsg};

errorOccured = YES;
if (error)
*error = [NSError errorWithDomain:GCDAsyncSocketErrorDomain code:GCDAsyncSocketOtherError userInfo:userInfo];
thisError = [NSError errorWithDomain:GCDAsyncSocketErrorDomain code:GCDAsyncSocketOtherError userInfo:userInfo];
return;
}

Expand All @@ -1115,15 +1115,18 @@ + (nullable instancetype)socketFromConnectedSocketFD:(int)socketFD delegate:(nul
NSDictionary *userInfo = @{NSLocalizedDescriptionKey : errMsg};

errorOccured = YES;
if (error)
*error = [NSError errorWithDomain:GCDAsyncSocketErrorDomain code:GCDAsyncSocketOtherError userInfo:userInfo];
thisError = [NSError errorWithDomain:GCDAsyncSocketErrorDomain code:GCDAsyncSocketOtherError userInfo:userInfo];
return;
}

socket->flags = kSocketStarted;
[socket didConnect:socket->stateIndex];
}});

if (error && thisError) {
*error = thisError;
}

return errorOccured? nil: socket;
}

Expand Down

0 comments on commit 5ddba5e

Please sign in to comment.