diff options
| author | Alexander Karatarakis <alkarata@microsoft.com> | 2017-09-01 17:05:22 -0700 |
|---|---|---|
| committer | Alexander Karatarakis <alkarata@microsoft.com> | 2017-09-01 17:05:22 -0700 |
| commit | 2d758beea9d8068f189f79d79b4087e40d42154b (patch) | |
| tree | 8384375b10c39c6b7a3d357130213e6c6e9793b9 /toolsrc | |
| parent | 9e7275c5dfeb9400492ceb8bed6635208a3d3cda (diff) | |
| download | vcpkg-2d758beea9d8068f189f79d79b4087e40d42154b.tar.gz vcpkg-2d758beea9d8068f189f79d79b4087e40d42154b.zip | |
[vcpkg_Checks] Naming convention fixes
Diffstat (limited to 'toolsrc')
| -rw-r--r-- | toolsrc/include/vcpkg_Checks.h | 22 | ||||
| -rw-r--r-- | toolsrc/src/vcpkg_Checks.cpp | 19 |
2 files changed, 23 insertions, 18 deletions
diff --git a/toolsrc/include/vcpkg_Checks.h b/toolsrc/include/vcpkg_Checks.h index 01cb7209b..ce486ac19 100644 --- a/toolsrc/include/vcpkg_Checks.h +++ b/toolsrc/include/vcpkg_Checks.h @@ -20,33 +20,35 @@ namespace vcpkg::Checks [[noreturn]] inline void exit_success(const LineInfo& line_info) { exit_with_code(line_info, EXIT_SUCCESS); } // Display an error message to the user and exit the tool. - [[noreturn]] void exit_with_message(const LineInfo& line_info, const CStringView errorMessage); + [[noreturn]] void exit_with_message(const LineInfo& line_info, const CStringView error_message); template<class Arg1, class... Args> // Display an error message to the user and exit the tool. [[noreturn]] void exit_with_message(const LineInfo& line_info, - const char* errorMessageTemplate, - const Arg1 errorMessageArg1, - const Args&... errorMessageArgs) + const char* error_message_template, + const Arg1 error_message_arg1, + const Args&... error_message_args) { - exit_with_message(line_info, Strings::format(errorMessageTemplate, errorMessageArg1, errorMessageArgs...)); + exit_with_message(line_info, + Strings::format(error_message_template, error_message_arg1, error_message_args...)); } void check_exit(const LineInfo& line_info, bool expression); - void check_exit(const LineInfo& line_info, bool expression, const CStringView errorMessage); + void check_exit(const LineInfo& line_info, bool expression, const CStringView error_message); template<class Conditional, class Arg1, class... Args> void check_exit(const LineInfo& line_info, Conditional&& expression, - const char* errorMessageTemplate, - const Arg1 errorMessageArg1, - const Args&... errorMessageArgs) + const char* error_message_template, + const Arg1 error_message_arg1, + const Args&... error_message_args) { if (!expression) { // Only create the string if the expression is false - exit_with_message(line_info, Strings::format(errorMessageTemplate, errorMessageArg1, errorMessageArgs...)); + exit_with_message(line_info, + Strings::format(error_message_template, error_message_arg1, error_message_args...)); } } } diff --git a/toolsrc/src/vcpkg_Checks.cpp b/toolsrc/src/vcpkg_Checks.cpp index 3692a0e9a..e7c9046a4 100644 --- a/toolsrc/src/vcpkg_Checks.cpp +++ b/toolsrc/src/vcpkg_Checks.cpp @@ -10,7 +10,7 @@ namespace vcpkg::Checks { [[noreturn]] static void cleanup_and_exit(const int exit_code) { - auto elapsed_us = GlobalState::timer.lock()->microseconds(); + const auto elapsed_us = GlobalState::timer.lock()->microseconds(); auto metrics = Metrics::g_metrics.lock(); metrics->track_metric("elapsed_us", elapsed_us); @@ -25,17 +25,20 @@ namespace vcpkg::Checks ::TerminateProcess(::GetCurrentProcess(), exit_code); } - static BOOL CtrlHandler(DWORD fdwCtrlType) + static BOOL ctrl_handler(DWORD fdw_ctrl_type) { { auto locked_metrics = Metrics::g_metrics.lock(); - locked_metrics->track_property("CtrlHandler", std::to_string(fdwCtrlType)); + locked_metrics->track_property("CtrlHandler", std::to_string(fdw_ctrl_type)); locked_metrics->track_property("error", "CtrlHandler was fired."); } cleanup_and_exit(EXIT_FAILURE); } - void register_console_ctrl_handler() { SetConsoleCtrlHandler((PHANDLER_ROUTINE)CtrlHandler, TRUE); } + void register_console_ctrl_handler() + { + SetConsoleCtrlHandler(reinterpret_cast<PHANDLER_ROUTINE>(ctrl_handler), TRUE); + } [[noreturn]] void unreachable(const LineInfo& line_info) { @@ -54,9 +57,9 @@ namespace vcpkg::Checks cleanup_and_exit(exit_code); } - [[noreturn]] void exit_with_message(const LineInfo& line_info, const CStringView errorMessage) + [[noreturn]] void exit_with_message(const LineInfo& line_info, const CStringView error_message) { - System::println(System::Color::error, errorMessage); + System::println(System::Color::error, error_message); exit_fail(line_info); } @@ -68,11 +71,11 @@ namespace vcpkg::Checks } } - void check_exit(const LineInfo& line_info, bool expression, const CStringView errorMessage) + void check_exit(const LineInfo& line_info, bool expression, const CStringView error_message) { if (!expression) { - exit_with_message(line_info, errorMessage); + exit_with_message(line_info, error_message); } } } |
