aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorGravatar Muxi Yan <mxyan@google.com>2019-01-04 09:40:18 -0800
committerGravatar Muxi Yan <mxyan@google.com>2019-01-04 09:40:18 -0800
commitb4a926961abc9e29016b2ba30093f3925de10514 (patch)
tree3e46843d34824d5c0789b9f70801d60c0554b87c /src
parent1f3829180c32c8c2ee1a3d546d6c2bcb3287e312 (diff)
Fix static analizer errors
Diffstat (limited to 'src')
-rw-r--r--src/objective-c/GRPCClient/GRPCCallOptions.m11
-rw-r--r--src/objective-c/GRPCClient/private/GRPCChannelPool.h3
2 files changed, 10 insertions, 4 deletions
diff --git a/src/objective-c/GRPCClient/GRPCCallOptions.m b/src/objective-c/GRPCClient/GRPCCallOptions.m
index d3440ee6c0..e59a812bd8 100644
--- a/src/objective-c/GRPCClient/GRPCCallOptions.m
+++ b/src/objective-c/GRPCClient/GRPCCallOptions.m
@@ -160,7 +160,10 @@ static BOOL areObjectsEqual(id obj1, id obj2) {
_timeout = timeout < 0 ? 0 : timeout;
_oauth2AccessToken = [oauth2AccessToken copy];
_authTokenProvider = authTokenProvider;
- _initialMetadata = [[NSDictionary alloc] initWithDictionary:initialMetadata copyItems:YES];
+ _initialMetadata =
+ initialMetadata == nil
+ ? nil
+ : [[NSDictionary alloc] initWithDictionary:initialMetadata copyItems:YES];
_userAgentPrefix = [userAgentPrefix copy];
_responseSizeLimit = responseSizeLimit;
_compressionAlgorithm = compressionAlgorithm;
@@ -171,7 +174,9 @@ static BOOL areObjectsEqual(id obj1, id obj2) {
_connectInitialBackoff = connectInitialBackoff < 0 ? 0 : connectInitialBackoff;
_connectMaxBackoff = connectMaxBackoff < 0 ? 0 : connectMaxBackoff;
_additionalChannelArgs =
- [[NSDictionary alloc] initWithDictionary:additionalChannelArgs copyItems:YES];
+ additionalChannelArgs == nil
+ ? nil
+ : [[NSDictionary alloc] initWithDictionary:additionalChannelArgs copyItems:YES];
_PEMRootCertificates = [PEMRootCertificates copy];
_PEMPrivateKey = [PEMPrivateKey copy];
_PEMCertificateChain = [PEMCertificateChain copy];
@@ -458,7 +463,7 @@ static BOOL areObjectsEqual(id obj1, id obj2) {
- (void)setConnectMinTimeout:(NSTimeInterval)connectMinTimeout {
if (connectMinTimeout < 0) {
- connectMinTimeout = 0;
+ _connectMinTimeout = 0;
} else {
_connectMinTimeout = connectMinTimeout;
}
diff --git a/src/objective-c/GRPCClient/private/GRPCChannelPool.h b/src/objective-c/GRPCClient/private/GRPCChannelPool.h
index d3a99ca826..e00ee69e63 100644
--- a/src/objective-c/GRPCClient/private/GRPCChannelPool.h
+++ b/src/objective-c/GRPCClient/private/GRPCChannelPool.h
@@ -88,7 +88,8 @@ NS_ASSUME_NONNULL_BEGIN
/**
* 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.