Fix static analizer errors

pull/16190/head
Muxi Yan 6 years ago
parent 1f3829180c
commit b4a926961a
  1. 11
      src/objective-c/GRPCClient/GRPCCallOptions.m
  2. 3
      src/objective-c/GRPCClient/private/GRPCChannelPool.h

@ -160,7 +160,10 @@ static BOOL areObjectsEqual(id obj1, id obj2) {
_timeout = timeout < 0 ? 0 : timeout; _timeout = timeout < 0 ? 0 : timeout;
_oauth2AccessToken = [oauth2AccessToken copy]; _oauth2AccessToken = [oauth2AccessToken copy];
_authTokenProvider = authTokenProvider; _authTokenProvider = authTokenProvider;
_initialMetadata = [[NSDictionary alloc] initWithDictionary:initialMetadata copyItems:YES]; _initialMetadata =
initialMetadata == nil
? nil
: [[NSDictionary alloc] initWithDictionary:initialMetadata copyItems:YES];
_userAgentPrefix = [userAgentPrefix copy]; _userAgentPrefix = [userAgentPrefix copy];
_responseSizeLimit = responseSizeLimit; _responseSizeLimit = responseSizeLimit;
_compressionAlgorithm = compressionAlgorithm; _compressionAlgorithm = compressionAlgorithm;
@ -171,7 +174,9 @@ static BOOL areObjectsEqual(id obj1, id obj2) {
_connectInitialBackoff = connectInitialBackoff < 0 ? 0 : connectInitialBackoff; _connectInitialBackoff = connectInitialBackoff < 0 ? 0 : connectInitialBackoff;
_connectMaxBackoff = connectMaxBackoff < 0 ? 0 : connectMaxBackoff; _connectMaxBackoff = connectMaxBackoff < 0 ? 0 : connectMaxBackoff;
_additionalChannelArgs = _additionalChannelArgs =
[[NSDictionary alloc] initWithDictionary:additionalChannelArgs copyItems:YES]; additionalChannelArgs == nil
? nil
: [[NSDictionary alloc] initWithDictionary:additionalChannelArgs copyItems:YES];
_PEMRootCertificates = [PEMRootCertificates copy]; _PEMRootCertificates = [PEMRootCertificates copy];
_PEMPrivateKey = [PEMPrivateKey copy]; _PEMPrivateKey = [PEMPrivateKey copy];
_PEMCertificateChain = [PEMCertificateChain copy]; _PEMCertificateChain = [PEMCertificateChain copy];
@ -458,7 +463,7 @@ static BOOL areObjectsEqual(id obj1, id obj2) {
- (void)setConnectMinTimeout:(NSTimeInterval)connectMinTimeout { - (void)setConnectMinTimeout:(NSTimeInterval)connectMinTimeout {
if (connectMinTimeout < 0) { if (connectMinTimeout < 0) {
connectMinTimeout = 0; _connectMinTimeout = 0;
} else { } else {
_connectMinTimeout = connectMinTimeout; _connectMinTimeout = connectMinTimeout;
} }

@ -88,7 +88,8 @@ NS_ASSUME_NONNULL_BEGIN
/** /**
* Return a channel with a particular configuration. The channel may be a cached channel. * Return a channel with a particular configuration. The channel may be a cached channel.
*/ */
- (GRPCPooledChannel *)channelWithHost:(NSString *)host callOptions:(GRPCCallOptions *)callOptions; - (nullable GRPCPooledChannel *)channelWithHost:(NSString *)host
callOptions:(GRPCCallOptions *)callOptions;
/** /**
* Disconnect all channels in this pool. * Disconnect all channels in this pool.

Loading…
Cancel
Save