aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorGravatar Kristopher Wuollett <klw@google.com>2016-02-03 19:49:03 -0500
committerGravatar Kristopher Wuollett <klw@google.com>2016-02-03 19:49:03 -0500
commit99354c3cadf21a350fc259fcb235d3c34ba200c3 (patch)
tree859d38a97345cc03f9c8b7dd4f16e2e697c413d5 /src
parent55484da58aa973aeb2ae56b5b61f94a2bf646174 (diff)
Formatting and naming fixes
Diffstat (limited to 'src')
-rw-r--r--src/objective-c/GRPCClient/GRPCCall+ChannelArg.h2
-rw-r--r--src/objective-c/GRPCClient/GRPCCall+ChannelArg.m2
-rw-r--r--src/objective-c/GRPCClient/private/GRPCChannel.h2
-rw-r--r--src/objective-c/GRPCClient/private/GRPCChannel.m29
-rw-r--r--src/objective-c/GRPCClient/private/GRPCHost.m2
5 files changed, 15 insertions, 22 deletions
diff --git a/src/objective-c/GRPCClient/GRPCCall+ChannelArg.h b/src/objective-c/GRPCClient/GRPCCall+ChannelArg.h
index 045d31caf1..ec1557df7f 100644
--- a/src/objective-c/GRPCClient/GRPCCall+ChannelArg.h
+++ b/src/objective-c/GRPCClient/GRPCCall+ChannelArg.h
@@ -42,6 +42,6 @@
*/
+ (void)setUserAgentPrefix:(NSString *)userAgentPrefix;
-+ (NSString *)useUserAgentPrefix;
++ (NSString *)userAgentPrefix;
@end
diff --git a/src/objective-c/GRPCClient/GRPCCall+ChannelArg.m b/src/objective-c/GRPCClient/GRPCCall+ChannelArg.m
index a6a61188fa..32244c3d31 100644
--- a/src/objective-c/GRPCClient/GRPCCall+ChannelArg.m
+++ b/src/objective-c/GRPCClient/GRPCCall+ChannelArg.m
@@ -45,7 +45,7 @@ static NSString *_userAgentPrefix;
}
}
-+ (NSString *)useUserAgentPrefix {
++ (NSString *)userAgentPrefix {
@synchronized(self) {
return _userAgentPrefix;
}
diff --git a/src/objective-c/GRPCClient/private/GRPCChannel.h b/src/objective-c/GRPCClient/private/GRPCChannel.h
index 01a6cfd2ec..1888dea1b4 100644
--- a/src/objective-c/GRPCClient/private/GRPCChannel.h
+++ b/src/objective-c/GRPCClient/private/GRPCChannel.h
@@ -58,7 +58,7 @@ struct grpc_channel_credentials;
* Creates a secure channel to the specified @c host using the specified @c pathToCertificates and
* @c channelArgs. Only in tests should @c pathToCertificates be nil or
* @c GRPC_SSL_TARGET_NAME_OVERRIDE_ARG channel arg be set. Passing nil for @c pathToCertificates
- * results in using the default root certificates distributed with the library. If certificates
+ * results in using the default root certificates distributed with the library. If certificates
* could not be found in any case, then @c nil is returned.
*/
+ (nullable GRPCChannel *)secureChannelWithHost:(nonnull NSString *)host
diff --git a/src/objective-c/GRPCClient/private/GRPCChannel.m b/src/objective-c/GRPCClient/private/GRPCChannel.m
index bb25743ed1..7a676060c1 100644
--- a/src/objective-c/GRPCClient/private/GRPCChannel.m
+++ b/src/objective-c/GRPCClient/private/GRPCChannel.m
@@ -39,8 +39,8 @@
#include <grpc/support/string_util.h>
/**
- * Returns @c grpc_channel_credentials from the specifie @c path. If the file at the path could not
- * be read then NULL is returned. If NULL is returned, @c errorPtr may not be NULL if there are
+ * Returns @c grpc_channel_credentials from the specified @c path. If the file at the path could not
+ * be read then NULL is returned. If NULL is returned, @c errorPtr may not be NULL if there are
* details available describing what went wrong.
*/
static grpc_channel_credentials *CertificatesAtPath(NSString *path, NSError **errorPtr) {
@@ -71,9 +71,10 @@ void freeChannelArgs(grpc_channel_args *channel_args) {
/**
* Allocates a @c grpc_channel_args and populates it with the options specified in the
- * @c dictionary. Keys must be @c NSString. If the value responds to @c @selector(UTF8String) then
- * it will be mapped to @c GRPC_ARG_STRING. If not, it will be mapped to @c GRPC_ARG_INTEGER if the
- * value responds to @c @selector(intValue). Otherwise, an exception will be raised.
+ * @c dictionary. Keys must be @c NSString. If the value responds to @c @selector(UTF8String) then
+ * it will be mapped to @c GRPC_ARG_STRING. If not, it will be mapped to @c GRPC_ARG_INTEGER if the
+ * value responds to @c @selector(intValue). Otherwise, an exception will be raised. The caller of
+ * this function is responsible for calling @c freeChannelArgs on a non-NULL returned value.
*/
grpc_channel_args * buildChannelArgs(NSDictionary *dictionary) {
if (!dictionary) {
@@ -89,8 +90,6 @@ grpc_channel_args * buildChannelArgs(NSDictionary *dictionary) {
// TODO(kriswuollett) Check that keys adhere to GRPC core library requirements
- Class invalidValueType = NULL;
-
for (NSUInteger i = 0; i < argCount; ++i) {
grpc_arg *arg = &channelArgs->args[i];
arg->key = gpr_strdup([keys[i] UTF8String]);
@@ -103,17 +102,11 @@ grpc_channel_args * buildChannelArgs(NSDictionary *dictionary) {
arg->type = GRPC_ARG_INTEGER;
arg->value.integer = [value intValue];
} else {
- invalidValueType = [value class];
- break;
+ [NSException raise:NSInvalidArgumentException
+ format:@"Invalid value type: %@", [value class]];
}
}
- if (invalidValueType) {
- freeChannelArgs(channelArgs);
- [NSException raise:NSInvalidArgumentException
- format:@"Invalid value type: %@", invalidValueType];
- }
-
return channelArgs;
}
@@ -144,7 +137,7 @@ grpc_channel_args * buildChannelArgs(NSDictionary *dictionary) {
_unmanagedChannel = grpc_secure_channel_create(credentials, _host.UTF8String, _channelArgs,
NULL);
} else {
- _unmanagedChannel = grpc_insecure_channel_create(host.UTF8String, _channelArgs, NULL);
+ _unmanagedChannel = grpc_insecure_channel_create(_host.UTF8String, _channelArgs, NULL);
}
}
@@ -184,8 +177,8 @@ grpc_channel_args * buildChannelArgs(NSDictionary *dictionary) {
//TODO(jcanizales): Add NSError** parameter to the initializer.
grpc_channel_credentials *certificates = path
- ? CertificatesAtPath(path, NULL)
- : kDefaultCertificates;
+ ? CertificatesAtPath(path, NULL)
+ : kDefaultCertificates;
return [[GRPCChannel alloc] initWithHost:host
secure:YES
diff --git a/src/objective-c/GRPCClient/private/GRPCHost.m b/src/objective-c/GRPCClient/private/GRPCHost.m
index 9d5d1a16cb..8fb9d91722 100644
--- a/src/objective-c/GRPCClient/private/GRPCHost.m
+++ b/src/objective-c/GRPCClient/private/GRPCHost.m
@@ -109,7 +109,7 @@
if (!_channel) {
NSMutableDictionary *args = [NSMutableDictionary dictionary];
- NSString *userAgentPrefix = [[GRPCCall useUserAgentPrefix] copy];
+ NSString *userAgentPrefix = [[GRPCCall userAgentPrefix] copy];
if (userAgentPrefix) {
args[@GRPC_ARG_PRIMARY_USER_AGENT_STRING] = userAgentPrefix;
}