From 09b056975dacd1f0f815ad820b6dc9913b0118a3 Mon Sep 17 00:00:00 2001 From: Mike Frysinger Date: Tue, 23 Jun 2020 18:55:43 -0400 Subject: fix pointer style to match the style guide We do this in a lot of places, but we're inconsistent. Normalize the code to the Google C++ style guide. Change-Id: Ic2aceab661ce8f6b993dda21b1cdf5d2198dcbbf Reviewed-on: https://chromium-review.googlesource.com/c/breakpad/breakpad/+/2262932 Reviewed-by: Sterling Augustine Reviewed-by: Mark Mentovai --- src/client/windows/handler/exception_handler.cc | 6 +++--- src/client/windows/handler/exception_handler.h | 8 ++++---- src/client/windows/sender/crash_report_sender.cc | 14 +++++++------- src/client/windows/sender/crash_report_sender.h | 18 +++++++++--------- src/client/windows/unittests/dump_analysis.cc | 4 ++-- .../unittests/exception_handler_death_test.cc | 18 +++++++++--------- .../unittests/exception_handler_nesting_test.cc | 6 +++--- .../windows/unittests/exception_handler_test.cc | 20 ++++++++++---------- 8 files changed, 47 insertions(+), 47 deletions(-) (limited to 'src/client/windows') diff --git a/src/client/windows/handler/exception_handler.cc b/src/client/windows/handler/exception_handler.cc index ad45b200..20d63a84 100644 --- a/src/client/windows/handler/exception_handler.cc +++ b/src/client/windows/handler/exception_handler.cc @@ -118,7 +118,7 @@ ExceptionHandler::ExceptionHandler( NULL); // custom_info - not used } -ExceptionHandler::ExceptionHandler(const wstring &dump_path, +ExceptionHandler::ExceptionHandler(const wstring& dump_path, FilterCallback filter, MinidumpCallback callback, void* callback_context, @@ -383,7 +383,7 @@ bool ExceptionHandler::RequestUpload(DWORD crash_id) { // static DWORD ExceptionHandler::ExceptionHandlerThreadMain(void* lpParameter) { - ExceptionHandler* self = reinterpret_cast(lpParameter); + ExceptionHandler* self = reinterpret_cast(lpParameter); assert(self); assert(self->handler_start_semaphore_ != NULL); assert(self->handler_finish_semaphore_ != NULL); @@ -765,7 +765,7 @@ bool ExceptionHandler::WriteMinidumpForException(EXCEPTION_POINTERS* exinfo) { } // static -bool ExceptionHandler::WriteMinidump(const wstring &dump_path, +bool ExceptionHandler::WriteMinidump(const wstring& dump_path, MinidumpCallback callback, void* callback_context, MINIDUMP_TYPE dump_type) { diff --git a/src/client/windows/handler/exception_handler.h b/src/client/windows/handler/exception_handler.h index 11babe51..eb5adaac 100644 --- a/src/client/windows/handler/exception_handler.h +++ b/src/client/windows/handler/exception_handler.h @@ -218,7 +218,7 @@ class ExceptionHandler { // Get and set the minidump path. wstring dump_path() const { return dump_path_; } - void set_dump_path(const wstring &dump_path) { + void set_dump_path(const wstring& dump_path) { dump_path_ = dump_path; dump_path_c_ = dump_path_.c_str(); UpdateNextID(); // Necessary to put dump_path_ in next_minidump_path_. @@ -237,7 +237,7 @@ class ExceptionHandler { // Convenience form of WriteMinidump which does not require an // ExceptionHandler instance. - static bool WriteMinidump(const wstring &dump_path, + static bool WriteMinidump(const wstring& dump_path, MinidumpCallback callback, void* callback_context, MINIDUMP_TYPE dump_type = MiniDumpNormal); @@ -513,8 +513,8 @@ class ExceptionHandler { static volatile LONG instance_count_; // disallow copy ctor and operator= - explicit ExceptionHandler(const ExceptionHandler &); - void operator=(const ExceptionHandler &); + explicit ExceptionHandler(const ExceptionHandler&); + void operator=(const ExceptionHandler&); }; } // namespace google_breakpad diff --git a/src/client/windows/sender/crash_report_sender.cc b/src/client/windows/sender/crash_report_sender.cc index eb2b422a..7fc64483 100644 --- a/src/client/windows/sender/crash_report_sender.cc +++ b/src/client/windows/sender/crash_report_sender.cc @@ -45,12 +45,12 @@ namespace google_breakpad { static const char kCheckpointSignature[] = "GBP1\n"; -CrashReportSender::CrashReportSender(const wstring &checkpoint_file) +CrashReportSender::CrashReportSender(const wstring& checkpoint_file) : checkpoint_file_(checkpoint_file), max_reports_per_day_(-1), last_sent_date_(-1), reports_sent_(0) { - FILE *fd; + FILE* fd; if (OpenCheckpointFile(L"r", &fd) == 0) { ReadCheckpoint(fd); fclose(fd); @@ -58,8 +58,8 @@ CrashReportSender::CrashReportSender(const wstring &checkpoint_file) } ReportResult CrashReportSender::SendCrashReport( - const wstring &url, const map ¶meters, - const map &files, wstring *report_code) { + const wstring& url, const map& parameters, + const map& files, wstring* report_code) { int today = GetCurrentDate(); if (today == last_sent_date_ && max_reports_per_day_ != -1 && @@ -82,7 +82,7 @@ ReportResult CrashReportSender::SendCrashReport( } } -void CrashReportSender::ReadCheckpoint(FILE *fd) { +void CrashReportSender::ReadCheckpoint(FILE* fd) { char buf[128]; if (!fgets(buf, sizeof(buf), fd) || strcmp(buf, kCheckpointSignature) != 0) { @@ -108,7 +108,7 @@ void CrashReportSender::ReportSent(int today) { ++reports_sent_; // Update the checkpoint file - FILE *fd; + FILE* fd; if (OpenCheckpointFile(L"w", &fd) == 0) { fputs(kCheckpointSignature, fd); fprintf(fd, "%d\n", last_sent_date_); @@ -124,7 +124,7 @@ int CrashReportSender::GetCurrentDate() const { system_time.wDay; } -int CrashReportSender::OpenCheckpointFile(const wchar_t *mode, FILE **fd) { +int CrashReportSender::OpenCheckpointFile(const wchar_t* mode, FILE** fd) { if (checkpoint_file_.empty()) { return ENOENT; } diff --git a/src/client/windows/sender/crash_report_sender.h b/src/client/windows/sender/crash_report_sender.h index 7786cc69..e6055857 100644 --- a/src/client/windows/sender/crash_report_sender.h +++ b/src/client/windows/sender/crash_report_sender.h @@ -65,7 +65,7 @@ class CrashReportSender { // If checkpoint_file is non-empty, breakpad will persist crash report // state to this file. A checkpoint file is required for // set_max_reports_per_day() to function properly. - explicit CrashReportSender(const wstring &checkpoint_file); + explicit CrashReportSender(const wstring& checkpoint_file); ~CrashReportSender() {} // Sets the maximum number of crash reports that will be sent in a 24-hour @@ -87,14 +87,14 @@ class CrashReportSender { // the return value is RESULT_SUCCEEDED), a code uniquely identifying the // report will be returned in report_code. // (Otherwise, report_code will be unchanged.) - ReportResult SendCrashReport(const wstring &url, - const map ¶meters, - const map &files, - wstring *report_code); + ReportResult SendCrashReport(const wstring& url, + const map& parameters, + const map& files, + wstring* report_code); private: // Reads persistent state from a checkpoint file. - void ReadCheckpoint(FILE *fd); + void ReadCheckpoint(FILE* fd); // Called when a new report has been sent, to update the checkpoint state. void ReportSent(int today); @@ -104,7 +104,7 @@ class CrashReportSender { // Opens the checkpoint file with the specified mode. // Returns zero on success, or an error code on failure. - int OpenCheckpointFile(const wchar_t *mode, FILE **fd); + int OpenCheckpointFile(const wchar_t* mode, FILE** fd); wstring checkpoint_file_; int max_reports_per_day_; @@ -114,8 +114,8 @@ class CrashReportSender { int reports_sent_; // Disallow copy constructor and operator= - explicit CrashReportSender(const CrashReportSender &); - void operator=(const CrashReportSender &); + explicit CrashReportSender(const CrashReportSender&); + void operator=(const CrashReportSender&); }; } // namespace google_breakpad diff --git a/src/client/windows/unittests/dump_analysis.cc b/src/client/windows/unittests/dump_analysis.cc index 53d4ddbd..0bb8f6c4 100644 --- a/src/client/windows/unittests/dump_analysis.cc +++ b/src/client/windows/unittests/dump_analysis.cc @@ -127,8 +127,8 @@ size_t DumpAnalysis::GetStreamImpl(ULONG stream_number, void** stream) const { return ret ? memory_list_size : 0; } -bool DumpAnalysis::HasMemoryImpl(const void *addr_in, size_t structuresize, - void **structure) const { +bool DumpAnalysis::HasMemoryImpl(const void* addr_in, size_t structuresize, + void** structure) const { uintptr_t address = reinterpret_cast(addr_in); MINIDUMP_MEMORY_LIST* memory_list = NULL; size_t memory_list_size = GetStream(MemoryListStream, &memory_list); diff --git a/src/client/windows/unittests/exception_handler_death_test.cc b/src/client/windows/unittests/exception_handler_death_test.cc index 5ef9e64d..04034e8d 100644 --- a/src/client/windows/unittests/exception_handler_death_test.cc +++ b/src/client/windows/unittests/exception_handler_death_test.cc @@ -52,7 +52,7 @@ const char kSuccessIndicator[] = "success"; const char kFailureIndicator[] = "failure"; // Utility function to test for a path's existence. -BOOL DoesPathExist(const TCHAR *path_name); +BOOL DoesPathExist(const TCHAR* path_name); enum OutOfProcGuarantee { OUT_OF_PROC_GUARANTEED, @@ -92,7 +92,7 @@ void ExceptionHandlerDeathTest::SetUp() { CreateDirectory(temp_path_, NULL); } -BOOL DoesPathExist(const TCHAR *path_name) { +BOOL DoesPathExist(const TCHAR* path_name) { DWORD flags = GetFileAttributes(path_name); if (flags == INVALID_FILE_ATTRIBUTES) { return FALSE; @@ -135,15 +135,15 @@ TEST_F(ExceptionHandlerDeathTest, InProcTest) { // Disable GTest SEH handler testing::DisableExceptionHandlerInScope disable_exception_handler; - int *i = NULL; + int* i = NULL; ASSERT_DEATH((*i)++, kSuccessIndicator); } static bool gDumpCallbackCalled = false; -void clientDumpCallback(void *dump_context, - const google_breakpad::ClientInfo *client_info, - const std::wstring *dump_path) { +void clientDumpCallback(void* dump_context, + const google_breakpad::ClientInfo* client_info, + const std::wstring* dump_path) { gDumpCallbackCalled = true; } @@ -152,7 +152,7 @@ void ExceptionHandlerDeathTest::DoCrashAccessViolation( scoped_ptr exc; if (out_of_proc_guarantee == OUT_OF_PROC_GUARANTEED) { - google_breakpad::CrashGenerationClient *client = + google_breakpad::CrashGenerationClient* client = new google_breakpad::CrashGenerationClient(kPipeName, MiniDumpNormal, NULL); // custom_info @@ -184,7 +184,7 @@ void ExceptionHandlerDeathTest::DoCrashAccessViolation( // if it's not true we'll still get an error rather than the crash // being expected. ASSERT_TRUE(exc->IsOutOfProcess()); - int *i = NULL; + int* i = NULL; printf("%d\n", (*i)++); } @@ -283,7 +283,7 @@ TEST_F(ExceptionHandlerDeathTest, PureVirtualCallTest) { EXPECT_EXIT(DoCrashPureVirtualCall(), ::testing::ExitedWithCode(0), ""); } -wstring find_minidump_in_directory(const wstring &directory) { +wstring find_minidump_in_directory(const wstring& directory) { wstring search_path = directory + L"\\*"; WIN32_FIND_DATA find_data; HANDLE find_handle = FindFirstFileW(search_path.c_str(), &find_data); diff --git a/src/client/windows/unittests/exception_handler_nesting_test.cc b/src/client/windows/unittests/exception_handler_nesting_test.cc index 3ae1d7cd..e24bd18b 100644 --- a/src/client/windows/unittests/exception_handler_nesting_test.cc +++ b/src/client/windows/unittests/exception_handler_nesting_test.cc @@ -49,7 +49,7 @@ const char kFilterReturnsFalse[] = "filter_returns_false"; const char kCallbackReturnsTrue[] = "callback_returns_true"; const char kCallbackReturnsFalse[] = "callback_returns_false"; -bool DoesPathExist(const wchar_t *path_name) { +bool DoesPathExist(const wchar_t* path_name) { DWORD flags = GetFileAttributes(path_name); if (flags == INVALID_FILE_ATTRIBUTES) { return false; @@ -128,12 +128,12 @@ bool MinidumpWrittenCallback(const wchar_t* dump_path, } -void DoCrash(const char *message) { +void DoCrash(const char* message) { if (message) { fprintf(stderr, "%s", message); fflush(stderr); } - int *i = NULL; + int* i = NULL; (*i)++; ASSERT_TRUE(false); diff --git a/src/client/windows/unittests/exception_handler_test.cc b/src/client/windows/unittests/exception_handler_test.cc index a4ce12a8..51196ca0 100644 --- a/src/client/windows/unittests/exception_handler_test.cc +++ b/src/client/windows/unittests/exception_handler_test.cc @@ -87,13 +87,13 @@ class ExceptionHandlerTest : public ::testing::Test { void DoCrashPureVirtualCall(); // Utility function to test for a path's existence. - static BOOL DoesPathExist(const TCHAR *path_name); + static BOOL DoesPathExist(const TCHAR* path_name); // Client callback. static void ClientDumpCallback( - void *dump_context, - const google_breakpad::ClientInfo *client_info, - const std::wstring *dump_path); + void* dump_context, + const google_breakpad::ClientInfo* client_info, + const std::wstring* dump_path); static bool DumpCallback(const wchar_t* dump_path, const wchar_t* minidump_id, @@ -141,7 +141,7 @@ void ExceptionHandlerTest::TearDown() { } } -BOOL ExceptionHandlerTest::DoesPathExist(const TCHAR *path_name) { +BOOL ExceptionHandlerTest::DoesPathExist(const TCHAR* path_name) { DWORD flags = GetFileAttributes(path_name); if (flags == INVALID_FILE_ATTRIBUTES) { return FALSE; @@ -151,9 +151,9 @@ BOOL ExceptionHandlerTest::DoesPathExist(const TCHAR *path_name) { // static void ExceptionHandlerTest::ClientDumpCallback( - void *dump_context, - const google_breakpad::ClientInfo *client_info, - const wstring *dump_path) { + void* dump_context, + const google_breakpad::ClientInfo* client_info, + const wstring* dump_path) { dump_file = *dump_path; // Create the full dump file name from the dump path. full_dump_file = dump_file.substr(0, dump_file.length() - 4) + L"-full.dmp"; @@ -174,7 +174,7 @@ bool ExceptionHandlerTest::DumpCallback(const wchar_t* dump_path, } void ExceptionHandlerTest::DoCrashInvalidParameter() { - google_breakpad::ExceptionHandler *exc = + google_breakpad::ExceptionHandler* exc = new google_breakpad::ExceptionHandler( temp_path_, NULL, NULL, NULL, google_breakpad::ExceptionHandler::HANDLER_INVALID_PARAMETER, @@ -206,7 +206,7 @@ struct PureVirtualCall : public PureVirtualCallBase { }; void ExceptionHandlerTest::DoCrashPureVirtualCall() { - google_breakpad::ExceptionHandler *exc = + google_breakpad::ExceptionHandler* exc = new google_breakpad::ExceptionHandler( temp_path_, NULL, NULL, NULL, google_breakpad::ExceptionHandler::HANDLER_PURECALL, -- cgit v1.2.1