diff options
author | Mike Frysinger <vapier@chromium.org> | 2020-06-23 18:55:43 -0400 |
---|---|---|
committer | Mike Frysinger <vapier@chromium.org> | 2020-07-15 06:20:02 +0000 |
commit | 09b056975dacd1f0f815ad820b6dc9913b0118a3 (patch) | |
tree | 67ba67549b44e6d98b9ff2dfb3e0396e0a252b96 /src/common/windows | |
parent | Add support for dwarf5 line tables. (diff) | |
download | breakpad-09b056975dacd1f0f815ad820b6dc9913b0118a3.tar.xz |
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 <saugustine@google.com>
Reviewed-by: Mark Mentovai <mark@chromium.org>
Diffstat (limited to 'src/common/windows')
-rw-r--r-- | src/common/windows/http_upload.cc | 22 | ||||
-rw-r--r-- | src/common/windows/http_upload.h | 4 | ||||
-rw-r--r-- | src/common/windows/omap.cc | 8 | ||||
-rw-r--r-- | src/common/windows/pdb_source_line_writer.cc | 48 | ||||
-rw-r--r-- | src/common/windows/pdb_source_line_writer.h | 10 | ||||
-rw-r--r-- | src/common/windows/pe_util.cc | 4 | ||||
-rw-r--r-- | src/common/windows/string_utils-inl.h | 22 | ||||
-rw-r--r-- | src/common/windows/string_utils.cc | 6 |
8 files changed, 62 insertions, 62 deletions
diff --git a/src/common/windows/http_upload.cc b/src/common/windows/http_upload.cc index b0cc9078..efee0d58 100644 --- a/src/common/windows/http_upload.cc +++ b/src/common/windows/http_upload.cc @@ -65,7 +65,7 @@ namespace { HINTERNET handle_; }; - wstring UTF8ToWide(const string &utf8) { + wstring UTF8ToWide(const string& utf8) { if (utf8.length() == 0) { return wstring(); } @@ -85,7 +85,7 @@ namespace { return result; } - string WideToMBCP(const wstring &wide, unsigned int cp) { + string WideToMBCP(const wstring& wide, unsigned int cp) { if (wide.length() == 0) { return string(); } @@ -107,7 +107,7 @@ namespace { return result; } - bool GetFileContents(const wstring &filename, vector<char> *contents) { + bool GetFileContents(const wstring& filename, vector<char>* contents) { bool rv = false; // The "open" method on pre-MSVC8 ifstream implementations doesn't accept a // wchar_t* filename, so use _wfopen directly in that case. For VC8 and @@ -141,10 +141,10 @@ namespace { return rv; } - bool CheckParameters(const map<wstring, wstring> ¶meters) { + bool CheckParameters(const map<wstring, wstring>& parameters) { for (map<wstring, wstring>::const_iterator pos = parameters.begin(); pos != parameters.end(); ++pos) { - const wstring &str = pos->first; + const wstring& str = pos->first; if (str.size() == 0) { return false; // disallow empty parameter names } @@ -159,7 +159,7 @@ namespace { } // Converts a UTF16 string to UTF8. - string WideToUTF8(const wstring &wide) { + string WideToUTF8(const wstring& wide) { return WideToMBCP(wide, CP_UTF8); } @@ -305,7 +305,7 @@ namespace { } if (!HttpSendRequest(request.get(), NULL, 0, - const_cast<char *>(request_body.data()), + const_cast<char*>(request_body.data()), static_cast<DWORD>(request_body.size()))) { return false; } @@ -351,7 +351,7 @@ namespace { return wstring(temp); } - wstring GenerateMultipartPostRequestHeader(const wstring &boundary) { + wstring GenerateMultipartPostRequestHeader(const wstring& boundary) { wstring header = L"Content-Type: multipart/form-data; boundary="; header += boundary; return header; @@ -390,9 +390,9 @@ namespace { return true; } - bool GenerateRequestBody(const map<wstring, wstring> ¶meters, - const map<wstring, wstring> &files, - const wstring &boundary, + bool GenerateRequestBody(const map<wstring, wstring>& parameters, + const map<wstring, wstring>& files, + const wstring& boundary, string *request_body) { string boundary_str = WideToUTF8(boundary); if (boundary_str.empty()) { diff --git a/src/common/windows/http_upload.h b/src/common/windows/http_upload.h index 57e526e3..c7d8c6fe 100644 --- a/src/common/windows/http_upload.h +++ b/src/common/windows/http_upload.h @@ -114,8 +114,8 @@ class HTTPUpload { // No instances of this class should be created. // Disallow all constructors, destructors, and operator=. HTTPUpload(); - explicit HTTPUpload(const HTTPUpload &); - void operator=(const HTTPUpload &); + explicit HTTPUpload(const HTTPUpload&); + void operator=(const HTTPUpload&); ~HTTPUpload(); }; diff --git a/src/common/windows/omap.cc b/src/common/windows/omap.cc index ba3ce86b..5a821b64 100644 --- a/src/common/windows/omap.cc +++ b/src/common/windows/omap.cc @@ -449,11 +449,11 @@ void BuildEndpointIndexMap(ImageMap* image_map) { } } -void BuildSubsequentRVAMap(const OmapData &omap_data, - std::map<DWORD, DWORD> *subsequent) { +void BuildSubsequentRVAMap(const OmapData& omap_data, + std::map<DWORD, DWORD>* subsequent) { assert(subsequent->empty()); - const OmapFromTable &orig2tran = - reinterpret_cast<const OmapFromTable &>(omap_data.omap_from); + const OmapFromTable& orig2tran = + reinterpret_cast<const OmapFromTable&>(omap_data.omap_from); if (orig2tran.empty()) return; diff --git a/src/common/windows/pdb_source_line_writer.cc b/src/common/windows/pdb_source_line_writer.cc index 4030a2e9..0eeb30cc 100644 --- a/src/common/windows/pdb_source_line_writer.cc +++ b/src/common/windows/pdb_source_line_writer.cc @@ -120,7 +120,7 @@ bool SymbolsMatch(IDiaSymbol* a, IDiaSymbol* b) { return a_section == b_section && a_offset == b_offset; } -bool CreateDiaDataSourceInstance(CComPtr<IDiaDataSource> &data_source) { +bool CreateDiaDataSourceInstance(CComPtr<IDiaDataSource>& data_source) { if (SUCCEEDED(data_source.CoCreateInstance(CLSID_DiaSource))) { return true; } @@ -134,7 +134,7 @@ bool CreateDiaDataSourceInstance(CComPtr<IDiaDataSource> &data_source) { // We can try loading the DLL corresponding to the #included DIA SDK, but // the DIA headers don't provide a version. Lets try to figure out which DIA // version we're compiling against by comparing CLSIDs. - const wchar_t *msdia_dll = nullptr; + const wchar_t* msdia_dll = nullptr; if (CLSID_DiaSource == _uuidof(DiaSource100)) { msdia_dll = L"msdia100.dll"; } else if (CLSID_DiaSource == _uuidof(DiaSource110)) { @@ -147,7 +147,7 @@ bool CreateDiaDataSourceInstance(CComPtr<IDiaDataSource> &data_source) { if (msdia_dll && SUCCEEDED(NoRegCoCreate(msdia_dll, CLSID_DiaSource, IID_IDiaDataSource, - reinterpret_cast<void **>(&data_source)))) { + reinterpret_cast<void**>(&data_source)))) { return true; } @@ -163,7 +163,7 @@ PDBSourceLineWriter::~PDBSourceLineWriter() { Close(); } -bool PDBSourceLineWriter::SetCodeFile(const wstring &exe_file) { +bool PDBSourceLineWriter::SetCodeFile(const wstring& exe_file) { if (code_file_.empty()) { code_file_ = exe_file; return true; @@ -173,7 +173,7 @@ bool PDBSourceLineWriter::SetCodeFile(const wstring &exe_file) { return exe_file == code_file_; } -bool PDBSourceLineWriter::Open(const wstring &file, FileFormat format) { +bool PDBSourceLineWriter::Open(const wstring& file, FileFormat format) { Close(); code_file_.clear(); @@ -228,7 +228,7 @@ bool PDBSourceLineWriter::Open(const wstring &file, FileFormat format) { return true; } -bool PDBSourceLineWriter::PrintLines(IDiaEnumLineNumbers *lines) { +bool PDBSourceLineWriter::PrintLines(IDiaEnumLineNumbers* lines) { // The line number format is: // <rva> <line number> <source file id> CComPtr<IDiaLineNumber> line; @@ -272,8 +272,8 @@ bool PDBSourceLineWriter::PrintLines(IDiaEnumLineNumbers *lines) { return true; } -bool PDBSourceLineWriter::PrintFunction(IDiaSymbol *function, - IDiaSymbol *block, +bool PDBSourceLineWriter::PrintFunction(IDiaSymbol* function, + IDiaSymbol* block, bool has_multiple_symbols) { // The function format is: // FUNC <address> <length> <param_stack_size> <function> @@ -679,7 +679,7 @@ bool PDBSourceLineWriter::PrintFrameData() { return false; } -bool PDBSourceLineWriter::PrintCodePublicSymbol(IDiaSymbol *symbol, +bool PDBSourceLineWriter::PrintCodePublicSymbol(IDiaSymbol* symbol, bool has_multiple_symbols) { BOOL is_code; if (FAILED(symbol->get_code(&is_code))) { @@ -781,9 +781,9 @@ bool PDBSourceLineWriter::PrintPEInfo() { // and scanf families, which are not as strict about input and in some cases // don't provide a good way for the caller to determine if a conversion was // successful. -static bool wcstol_positive_strict(wchar_t *string, int *result) { +static bool wcstol_positive_strict(wchar_t* string, int* result) { int value = 0; - for (wchar_t *c = string; *c != '\0'; ++c) { + for (wchar_t* c = string; *c != '\0'; ++c) { int last_value = value; value *= 10; // Detect overflow. @@ -821,7 +821,7 @@ bool PDBSourceLineWriter::FindPEFile() { wstring file(symbols_file); // Look for an EXE or DLL file. - const wchar_t *extensions[] = { L"exe", L"dll" }; + const wchar_t* extensions[] = { L"exe", L"dll" }; for (size_t i = 0; i < sizeof(extensions) / sizeof(extensions[0]); i++) { size_t dot_pos = file.find_last_of(L"."); if (dot_pos != wstring::npos) { @@ -839,9 +839,9 @@ bool PDBSourceLineWriter::FindPEFile() { } // static -bool PDBSourceLineWriter::GetSymbolFunctionName(IDiaSymbol *function, - BSTR *name, - int *stack_param_size) { +bool PDBSourceLineWriter::GetSymbolFunctionName(IDiaSymbol* function, + BSTR* name, + int* stack_param_size) { *stack_param_size = -1; const DWORD undecorate_options = UNDNAME_NO_MS_KEYWORDS | UNDNAME_NO_FUNCTION_RETURNS | @@ -882,12 +882,12 @@ bool PDBSourceLineWriter::GetSymbolFunctionName(IDiaSymbol *function, // C++ uses a bogus "void" argument for functions and methods that don't // take any parameters. Take it out of the undecorated name because it's // ugly and unnecessary. - const wchar_t *replace_string = L"(void)"; + const wchar_t* replace_string = L"(void)"; const size_t replace_length = wcslen(replace_string); - const wchar_t *replacement_string = L"()"; + const wchar_t* replacement_string = L"()"; size_t length = wcslen(*name); if (length >= replace_length) { - wchar_t *name_end = *name + length - replace_length; + wchar_t* name_end = *name + length - replace_length; if (wcscmp(name_end, replace_string) == 0) { WindowsStringUtils::safe_wcscpy(name_end, replace_length, replacement_string); @@ -903,7 +903,7 @@ bool PDBSourceLineWriter::GetSymbolFunctionName(IDiaSymbol *function, // whether the undecorated name contains any ':' or '(' characters. if (!wcschr(*name, ':') && !wcschr(*name, '(') && (*name[0] == '_' || *name[0] == '@')) { - wchar_t *last_at = wcsrchr(*name + 1, '@'); + wchar_t* last_at = wcsrchr(*name + 1, '@'); if (last_at && wcstol_positive_strict(last_at + 1, stack_param_size)) { // If this function adheres to the fastcall convention, it accepts up // to the first 8 bytes of parameters in registers (%ecx and %edx). @@ -935,7 +935,7 @@ bool PDBSourceLineWriter::GetSymbolFunctionName(IDiaSymbol *function, } // static -int PDBSourceLineWriter::GetFunctionStackParamSize(IDiaSymbol *function) { +int PDBSourceLineWriter::GetFunctionStackParamSize(IDiaSymbol* function) { // This implementation is highly x86-specific. // Gather the symbols corresponding to data. @@ -1050,7 +1050,7 @@ next_child: return param_size; } -bool PDBSourceLineWriter::WriteSymbols(FILE *symbol_file) { +bool PDBSourceLineWriter::WriteSymbols(FILE* symbol_file) { output_ = symbol_file; // Load the OMAP information, and disable auto-translation of addresses in @@ -1078,7 +1078,7 @@ void PDBSourceLineWriter::Close() { } } -bool PDBSourceLineWriter::GetModuleInfo(PDBModuleInfo *info) { +bool PDBSourceLineWriter::GetModuleInfo(PDBModuleInfo* info) { if (!info) { return false; } @@ -1143,7 +1143,7 @@ bool PDBSourceLineWriter::GetModuleInfo(PDBModuleInfo *info) { return true; } -bool PDBSourceLineWriter::GetPEInfo(PEModuleInfo *info) { +bool PDBSourceLineWriter::GetPEInfo(PEModuleInfo* info) { if (!info) { return false; } @@ -1156,7 +1156,7 @@ bool PDBSourceLineWriter::GetPEInfo(PEModuleInfo *info) { return ReadPEInfo(code_file_, info); } -bool PDBSourceLineWriter::UsesGUID(bool *uses_guid) { +bool PDBSourceLineWriter::UsesGUID(bool* uses_guid) { if (!uses_guid) return false; diff --git a/src/common/windows/pdb_source_line_writer.h b/src/common/windows/pdb_source_line_writer.h index c0adf29f..00f6e592 100644 --- a/src/common/windows/pdb_source_line_writer.h +++ b/src/common/windows/pdb_source_line_writer.h @@ -65,7 +65,7 @@ class PDBSourceLineWriter { // file must be available; Open will be if it is not. // If there is already a pdb file open, it is automatically closed. // Returns true on success. - bool Open(const wstring &file, FileFormat format); + bool Open(const wstring& file, FileFormat format); // Closes the current pdb file and its associated resources. void Close(); @@ -77,7 +77,7 @@ class PDBSourceLineWriter { // file and it must be called after Open() and before WriteMap(). // If Open() was called for an executable file, then it is an error to call // SetCodeFile() with a different file path and it will return false. - bool SetCodeFile(const wstring &exe_file); + bool SetCodeFile(const wstring& exe_file); // Writes a Breakpad symbol file from the current pdb file to |symbol_file|. // Returns true on success. @@ -150,17 +150,17 @@ class PDBSourceLineWriter { // Returns true if this filename has already been seen, // and an ID is stored for it, or false if it has not. - bool FileIDIsCached(const wstring &file) { + bool FileIDIsCached(const wstring& file) { return unique_files_.find(file) != unique_files_.end(); } // Cache this filename and ID for later reuse. - void CacheFileID(const wstring &file, DWORD id) { + void CacheFileID(const wstring& file, DWORD id) { unique_files_[file] = id; } // Store this ID in the cache as a duplicate for this filename. - void StoreDuplicateFileID(const wstring &file, DWORD id) { + void StoreDuplicateFileID(const wstring& file, DWORD id) { unordered_map<wstring, DWORD>::iterator iter = unique_files_.find(file); if (iter != unique_files_.end()) { // map this id to the previously seen one diff --git a/src/common/windows/pe_util.cc b/src/common/windows/pe_util.cc index 6fa63fa3..9c94af05 100644 --- a/src/common/windows/pe_util.cc +++ b/src/common/windows/pe_util.cc @@ -285,7 +285,7 @@ bool PrintPEFrameData(const wstring & pe_file, FILE * out_file) unwind_rva = chained_func->UnwindInfoAddress;
}
- UnwindInfo *unwind_info = static_cast<UnwindInfo *>(
+ UnwindInfo *unwind_info = static_cast<UnwindInfo*>(
ImageRvaToVa(img->FileHeader,
img->MappedAddress,
unwind_rva,
@@ -351,7 +351,7 @@ bool PrintPEFrameData(const wstring & pe_file, FILE * out_file) (unwind_info->unwind_code +
((unwind_info->count_of_codes + 1) & ~1)));
- unwind_info = static_cast<UnwindInfo *>(
+ unwind_info = static_cast<UnwindInfo*>(
ImageRvaToVa(img->FileHeader,
img->MappedAddress,
chained_func->UnwindInfoAddress,
diff --git a/src/common/windows/string_utils-inl.h b/src/common/windows/string_utils-inl.h index 9b636072..935e19f5 100644 --- a/src/common/windows/string_utils-inl.h +++ b/src/common/windows/string_utils-inl.h @@ -72,26 +72,26 @@ class WindowsStringUtils { // Roughly equivalent to MSVC8's wcscpy_s, except pre-MSVC8, this does // not fail if source is longer than destination_size. The destination // buffer is always 0-terminated. - static void safe_wcscpy(wchar_t *destination, size_t destination_size, - const wchar_t *source); + static void safe_wcscpy(wchar_t* destination, size_t destination_size, + const wchar_t* source); // Roughly equivalent to MSVC8's wcsncpy_s, except that _TRUNCATE cannot // be passed directly, and pre-MSVC8, this will not fail if source or count // are longer than destination_size. The destination buffer is always // 0-terminated. - static void safe_wcsncpy(wchar_t *destination, size_t destination_size, - const wchar_t *source, size_t count); + static void safe_wcsncpy(wchar_t* destination, size_t destination_size, + const wchar_t* source, size_t count); // Performs multi-byte to wide character conversion on C++ strings, using // mbstowcs_s (MSVC8) or mbstowcs (pre-MSVC8). Returns false on failure, // without setting wcs. - static bool safe_mbstowcs(const string &mbs, wstring *wcs); + static bool safe_mbstowcs(const string& mbs, wstring* wcs); // The inverse of safe_mbstowcs. - static bool safe_wcstombs(const wstring &wcs, string *mbs); + static bool safe_wcstombs(const wstring& wcs, string* mbs); // Returns the base name of a file, e.g. strips off the path. - static wstring GetBaseName(const wstring &filename); + static wstring GetBaseName(const wstring& filename); private: // Disallow instantiation and other object-based operations. @@ -102,9 +102,9 @@ class WindowsStringUtils { }; // static -inline void WindowsStringUtils::safe_wcscpy(wchar_t *destination, +inline void WindowsStringUtils::safe_wcscpy(wchar_t* destination, size_t destination_size, - const wchar_t *source) { + const wchar_t* source) { #if _MSC_VER >= 1400 // MSVC 2005/8 wcscpy_s(destination, destination_size, source); #else // _MSC_VER >= 1400 @@ -118,9 +118,9 @@ inline void WindowsStringUtils::safe_wcscpy(wchar_t *destination, } // static -inline void WindowsStringUtils::safe_wcsncpy(wchar_t *destination, +inline void WindowsStringUtils::safe_wcsncpy(wchar_t* destination, size_t destination_size, - const wchar_t *source, + const wchar_t* source, size_t count) { #if _MSC_VER >= 1400 // MSVC 2005/8 wcsncpy_s(destination, destination_size, source, count); diff --git a/src/common/windows/string_utils.cc b/src/common/windows/string_utils.cc index 27280003..90aab038 100644 --- a/src/common/windows/string_utils.cc +++ b/src/common/windows/string_utils.cc @@ -35,7 +35,7 @@ namespace google_breakpad { // static -wstring WindowsStringUtils::GetBaseName(const wstring &filename) { +wstring WindowsStringUtils::GetBaseName(const wstring& filename) { wstring base_name(filename); size_t slash_pos = base_name.find_last_of(L"/\\"); if (slash_pos != wstring::npos) { @@ -45,7 +45,7 @@ wstring WindowsStringUtils::GetBaseName(const wstring &filename) { } // static -bool WindowsStringUtils::safe_mbstowcs(const string &mbs, wstring *wcs) { +bool WindowsStringUtils::safe_mbstowcs(const string& mbs, wstring* wcs) { assert(wcs); // First, determine the length of the destination buffer. @@ -88,7 +88,7 @@ bool WindowsStringUtils::safe_mbstowcs(const string &mbs, wstring *wcs) { } // static -bool WindowsStringUtils::safe_wcstombs(const wstring &wcs, string *mbs) { +bool WindowsStringUtils::safe_wcstombs(const wstring& wcs, string* mbs) { assert(mbs); // First, determine the length of the destination buffer. |