From 2144c719fcf9d73a3a97f2f378fb178635328d4f Mon Sep 17 00:00:00 2001 From: Carlos O'Ryan Date: Thu, 24 Oct 2019 13:24:33 -0400 Subject: [PATCH] Run clang_format_all_the_things.sh --- .../alts/check_gcp_environment_windows.cc | 24 +++++++++---------- .../check_gcp_environment_windows_test.cc | 16 ++++++------- 2 files changed, 19 insertions(+), 21 deletions(-) diff --git a/src/core/lib/security/credentials/alts/check_gcp_environment_windows.cc b/src/core/lib/security/credentials/alts/check_gcp_environment_windows.cc index ebbdc1803d6..59432cff361 100644 --- a/src/core/lib/security/credentials/alts/check_gcp_environment_windows.cc +++ b/src/core/lib/security/credentials/alts/check_gcp_environment_windows.cc @@ -34,12 +34,11 @@ namespace grpc_core { namespace internal { -bool check_bios_data(const char*) { - return false; -} +bool check_bios_data(const char*) { return false; } -bool check_windows_registry_product_name( - HKEY root_key, const char* reg_key_path, const char* reg_key_name) { +bool check_windows_registry_product_name(HKEY root_key, + const char* reg_key_path, + const char* reg_key_name) { const size_t kProductNameBufferSize = 256; char const expected_substr[] = "Google"; @@ -47,8 +46,7 @@ bool check_windows_registry_product_name( // enough space for the trailing NUL character that will be included. DWORD buffer_size{}; auto rc = ::RegGetValueA( - root_key, reg_key_path, reg_key_name, - RRF_RT_REG_SZ, + root_key, reg_key_path, reg_key_name, RRF_RT_REG_SZ, nullptr, // We know the type will be REG_SZ. nullptr, // We're only fetching the size; no buffer given yet. &buffer_size); // Fetch the size in bytes of the value, if it exists. @@ -64,10 +62,9 @@ bool check_windows_registry_product_name( char buffer[kProductNameBufferSize]; buffer_size = kProductNameBufferSize; rc = ::RegGetValueA( - root_key, reg_key_path, reg_key_name, - RRF_RT_REG_SZ, - nullptr, // We know the type will be REG_SZ. - static_cast(buffer), // Fetch the string value this time. + root_key, reg_key_path, reg_key_name, RRF_RT_REG_SZ, + nullptr, // We know the type will be REG_SZ. + static_cast(buffer), // Fetch the string value this time. &buffer_size); // The string size in bytes, not including trailing NUL. if (rc != 0) { return false; @@ -93,8 +90,9 @@ bool grpc_alts_is_running_on_gcp() { gpr_once_init(&g_once, init_mu); gpr_mu_lock(&g_mu); if (!g_compute_engine_detection_done) { - g_is_on_compute_engine = grpc_core::internal::check_windows_registry_product_name( - HKEY_LOCAL_MACHINE, reg_key_path, reg_key_name); + g_is_on_compute_engine = + grpc_core::internal::check_windows_registry_product_name( + HKEY_LOCAL_MACHINE, reg_key_path, reg_key_name); g_compute_engine_detection_done = true; } gpr_mu_unlock(&g_mu); diff --git a/test/core/security/check_gcp_environment_windows_test.cc b/test/core/security/check_gcp_environment_windows_test.cc index ded369f66c0..320735e904b 100644 --- a/test/core/security/check_gcp_environment_windows_test.cc +++ b/test/core/security/check_gcp_environment_windows_test.cc @@ -32,8 +32,9 @@ namespace grpc_core { namespace internal { -bool check_windows_registry_product_name( - HKEY root_key, const char* reg_key_path, const char* reg_key_name); +bool check_windows_registry_product_name(HKEY root_key, + const char* reg_key_path, + const char* reg_key_name); } // namespace internal } // namespace grpc_core @@ -44,17 +45,16 @@ static bool check_bios_data_windows_test(const char* data) { // Modify the registry for the current user to contain the // test value. We cannot use the system registry because the // user may not have privileges to change it. - auto rc = RegSetKeyValueA( - HKEY_CURRENT_USER, reg_key_path, reg_key_name, REG_SZ, - reinterpret_cast(data), - static_cast(strlen(data))); + auto rc = RegSetKeyValueA(HKEY_CURRENT_USER, reg_key_path, reg_key_name, + REG_SZ, reinterpret_cast(data), + static_cast(strlen(data))); if (rc != 0) { return false; } auto result = grpc_core::internal::check_windows_registry_product_name( - HKEY_CURRENT_USER, reg_key_path, reg_key_name); - + HKEY_CURRENT_USER, reg_key_path, reg_key_name); + (void)RegDeleteKeyValueA(HKEY_CURRENT_USER, reg_key_path, reg_key_name); return result;