aboutsummaryrefslogtreecommitdiffhomepage
path: root/test/core/security/fetch_oauth2.cc
diff options
context:
space:
mode:
authorGravatar Craig Tiller <ctiller@google.com>2017-11-10 14:14:17 -0800
committerGravatar Craig Tiller <ctiller@google.com>2017-11-10 14:14:17 -0800
commit4ac2b8e585cbf7064f9bdde4eabaf8ff42801142 (patch)
tree5379629b43d287972916a87637a26251c1b0de5f /test/core/security/fetch_oauth2.cc
parente77b3c36d1b3e2033abd19d553748b678c22253f (diff)
Enable clang-tidy as a sanity check, fix up all known failures
Diffstat (limited to 'test/core/security/fetch_oauth2.cc')
-rw-r--r--test/core/security/fetch_oauth2.cc28
1 files changed, 14 insertions, 14 deletions
diff --git a/test/core/security/fetch_oauth2.cc b/test/core/security/fetch_oauth2.cc
index fa8036e581..69c470641a 100644
--- a/test/core/security/fetch_oauth2.cc
+++ b/test/core/security/fetch_oauth2.cc
@@ -38,16 +38,16 @@ static grpc_call_credentials* create_refresh_token_creds(
"load_file",
grpc_load_file(json_refresh_token_file_path, 1, &refresh_token)));
return grpc_google_refresh_token_credentials_create(
- (const char*)GRPC_SLICE_START_PTR(refresh_token), NULL);
+ (const char*)GRPC_SLICE_START_PTR(refresh_token), nullptr);
}
int main(int argc, char** argv) {
- grpc_call_credentials* creds = NULL;
- char* json_key_file_path = NULL;
- const char* json_refresh_token_file_path = NULL;
- char* token = NULL;
+ grpc_call_credentials* creds = nullptr;
+ char* json_key_file_path = nullptr;
+ const char* json_refresh_token_file_path = nullptr;
+ char* token = nullptr;
int use_gce = 0;
- char* scope = NULL;
+ char* scope = nullptr;
gpr_cmdline* cl = gpr_cmdline_create("fetch_oauth2");
gpr_cmdline_add_string(cl, "json_refresh_token",
"File path of the json refresh token.",
@@ -60,26 +60,26 @@ int main(int argc, char** argv) {
grpc_init();
- if (json_key_file_path != NULL && json_refresh_token_file_path != NULL) {
+ if (json_key_file_path != nullptr && json_refresh_token_file_path != nullptr) {
gpr_log(GPR_ERROR,
"--json_key and --json_refresh_token are mutually exclusive.");
exit(1);
}
if (use_gce) {
- if (json_key_file_path != NULL || scope != NULL) {
+ if (json_key_file_path != nullptr || scope != nullptr) {
gpr_log(GPR_INFO,
"Ignoring json key and scope to get a token from the GCE "
"metadata server.");
}
- creds = grpc_google_compute_engine_credentials_create(NULL);
- if (creds == NULL) {
+ creds = grpc_google_compute_engine_credentials_create(nullptr);
+ if (creds == nullptr) {
gpr_log(GPR_ERROR, "Could not create gce credentials.");
exit(1);
}
- } else if (json_refresh_token_file_path != NULL) {
+ } else if (json_refresh_token_file_path != nullptr) {
creds = create_refresh_token_creds(json_refresh_token_file_path);
- if (creds == NULL) {
+ if (creds == nullptr) {
gpr_log(GPR_ERROR,
"Could not create refresh token creds. %s does probably not "
"contain a valid json refresh token.",
@@ -90,10 +90,10 @@ int main(int argc, char** argv) {
gpr_log(GPR_ERROR, "Missing --gce or --json_refresh_token option.");
exit(1);
}
- GPR_ASSERT(creds != NULL);
+ GPR_ASSERT(creds != nullptr);
token = grpc_test_fetch_oauth2_token_with_credentials(creds);
- if (token != NULL) {
+ if (token != nullptr) {
printf("Got token: %s.\n", token);
gpr_free(token);
}