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>
This commit is contained in:
Mike Frysinger
2020-06-23 18:55:43 -04:00
parent a741027533
commit 09b056975d
289 changed files with 3770 additions and 3775 deletions

View File

@@ -92,7 +92,7 @@ namespace google_breakpad {
#endif // _MSC_VER >= 1400
bool GUIDOrSignatureIdentifier::InitializeFromString(
const string &identifier) {
const string& identifier) {
type_ = TYPE_NONE;
size_t length = identifier.length();
@@ -128,7 +128,7 @@ bool GUIDOrSignatureIdentifier::InitializeFromString(
#undef SSCANF
MSSymbolServerConverter::MSSymbolServerConverter(
const string &local_cache, const vector<string> &symbol_servers)
const string& local_cache, const vector<string>& symbol_servers)
: symbol_path_(),
fail_dns_(false),
fail_timeout_(false),
@@ -184,7 +184,7 @@ class AutoSymSrv {
}
}
bool Initialize(HANDLE process, char *path, bool invade_process) {
bool Initialize(HANDLE process, char* path, bool invade_process) {
process_ = process;
// TODO(nbilling): Figure out why dbghelp.dll is being loaded from
@@ -240,7 +240,7 @@ class AutoSymSrv {
// are supported by calling Delete().
class AutoDeleter {
public:
explicit AutoDeleter(const string &path) : path_(path) {}
explicit AutoDeleter(const string& path) : path_(path) {}
~AutoDeleter() {
int error;
@@ -270,10 +270,10 @@ class AutoDeleter {
};
MSSymbolServerConverter::LocateResult
MSSymbolServerConverter::LocateFile(const string &debug_or_code_file,
const string &debug_or_code_id,
const string &version,
string *file_name) {
MSSymbolServerConverter::LocateFile(const string& debug_or_code_file,
const string& debug_or_code_id,
const string& version,
string* file_name) {
assert(file_name);
file_name->clear();
@@ -290,7 +290,7 @@ MSSymbolServerConverter::LocateFile(const string &debug_or_code_file,
HANDLE process = GetCurrentProcess(); // CloseHandle is not needed.
AutoSymSrv symsrv;
if (!symsrv.Initialize(process,
const_cast<char *>(symbol_path_.c_str()),
const_cast<char*>(symbol_path_.c_str()),
false)) {
fprintf(stderr, "LocateFile: SymInitialize: error %lu for %s %s %s\n",
GetLastError(),
@@ -326,8 +326,8 @@ MSSymbolServerConverter::LocateFile(const string &debug_or_code_file,
char path[MAX_PATH];
if (!SymFindFileInPath(
process, NULL,
const_cast<char *>(debug_or_code_file.c_str()),
const_cast<void *>(identifier.guid_or_signature_pointer()),
const_cast<char*>(debug_or_code_file.c_str()),
const_cast<void*>(identifier.guid_or_signature_pointer()),
identifier.age(), 0,
identifier.type() == GUIDOrSignatureIdentifier::TYPE_GUID ?
SSRVOPT_GUIDPTR : SSRVOPT_DWORDPTR,
@@ -393,15 +393,15 @@ MSSymbolServerConverter::LocateFile(const string &debug_or_code_file,
MSSymbolServerConverter::LocateResult
MSSymbolServerConverter::LocatePEFile(const MissingSymbolInfo &missing,
string *pe_file) {
MSSymbolServerConverter::LocatePEFile(const MissingSymbolInfo& missing,
string* pe_file) {
return LocateFile(missing.code_file, missing.code_identifier,
missing.version, pe_file);
}
MSSymbolServerConverter::LocateResult
MSSymbolServerConverter::LocateSymbolFile(const MissingSymbolInfo &missing,
string *symbol_file) {
MSSymbolServerConverter::LocateSymbolFile(const MissingSymbolInfo& missing,
string* symbol_file) {
return LocateFile(missing.debug_file, missing.debug_identifier,
missing.version, symbol_file);
}
@@ -412,13 +412,13 @@ BOOL CALLBACK MSSymbolServerConverter::SymCallback(HANDLE process,
ULONG action,
ULONG64 data,
ULONG64 context) {
MSSymbolServerConverter *self =
reinterpret_cast<MSSymbolServerConverter *>(context);
MSSymbolServerConverter* self =
reinterpret_cast<MSSymbolServerConverter*>(context);
switch (action) {
case CBA_EVENT: {
IMAGEHLP_CBA_EVENT *cba_event =
reinterpret_cast<IMAGEHLP_CBA_EVENT *>(data);
IMAGEHLP_CBA_EVENT* cba_event =
reinterpret_cast<IMAGEHLP_CBA_EVENT*>(data);
// Put the string into a string object to be able to use string::find
// for substring matching. This is important because the not-found
@@ -429,8 +429,8 @@ BOOL CALLBACK MSSymbolServerConverter::SymCallback(HANDLE process,
// desc_action maps strings (in desc) to boolean pointers that are to
// be set to true if the string matches.
struct desc_action {
const char *desc; // The substring to match.
bool *action; // On match, this pointer will be set to true.
const char* desc; // The substring to match.
bool* action; // On match, this pointer will be set to true.
};
static const desc_action desc_actions[] = {
@@ -478,7 +478,7 @@ BOOL CALLBACK MSSymbolServerConverter::SymCallback(HANDLE process,
// static
BOOL CALLBACK MSSymbolServerConverter::SymFindFileInPathCallback(
const char *filename, void *context) {
const char* filename, void* context) {
// FALSE ends the search, indicating that the located symbol file is
// satisfactory.
return FALSE;
@@ -486,12 +486,12 @@ BOOL CALLBACK MSSymbolServerConverter::SymFindFileInPathCallback(
MSSymbolServerConverter::LocateResult
MSSymbolServerConverter::LocateAndConvertSymbolFile(
const MissingSymbolInfo &missing,
const MissingSymbolInfo& missing,
bool keep_symbol_file,
bool keep_pe_file,
string *converted_symbol_file,
string *symbol_file,
string *out_pe_file) {
string* converted_symbol_file,
string* symbol_file,
string* out_pe_file) {
assert(converted_symbol_file);
converted_symbol_file->clear();
if (symbol_file) {
@@ -580,7 +580,7 @@ MSSymbolServerConverter::LocateAndConvertSymbolFile(
*converted_symbol_file = pdb_file.substr(0, pdb_file.length() - 4) + ".sym";
FILE *converted_output = NULL;
FILE* converted_output = NULL;
#if _MSC_VER >= 1400 // MSVC 2005/8
errno_t err;
if ((err = fopen_s(&converted_output, converted_symbol_file->c_str(), "w"))
@@ -634,10 +634,10 @@ MSSymbolServerConverter::LocateAndConvertSymbolFile(
MSSymbolServerConverter::LocateResult
MSSymbolServerConverter::LocateAndConvertPEFile(
const MissingSymbolInfo &missing,
const MissingSymbolInfo& missing,
bool keep_pe_file,
string *converted_symbol_file,
string *out_pe_file) {
string* converted_symbol_file,
string* out_pe_file) {
assert(converted_symbol_file);
converted_symbol_file->clear();
@@ -676,7 +676,7 @@ MSSymbolServerConverter::LocateAndConvertPEFile(
*converted_symbol_file = pe_file.substr(0, pe_file.length() - 4) + ".sym";
FILE *converted_output = NULL;
FILE* converted_output = NULL;
#if _MSC_VER >= 1400 // MSVC 2005/8
errno_t err;
if ((err = fopen_s(&converted_output, converted_symbol_file->c_str(), "w"))

View File

@@ -101,13 +101,13 @@ class GUIDOrSignatureIdentifier {
// component fields: either a GUID and age, or signature and age. If
// successful, sets the relevant fields in the object, including the type
// field, and returns true. On error, returns false.
bool InitializeFromString(const string &identifier);
bool InitializeFromString(const string& identifier);
GUIDOrSignatureType type() const { return type_; }
GUID guid() const { return guid_; }
DWORD signature() const { return signature_; }
int age() const { return age_; }
const void *guid_or_signature_pointer() const { return &guid_; }
const void* guid_or_signature_pointer() const { return &guid_; }
private:
GUIDOrSignatureType type_;
@@ -141,23 +141,23 @@ class MSSymbolServerConverter {
// store to try. The vector must contain at least one string. None of the
// strings passed to this constructor may contain asterisk ('*') or semicolon
// (';') characters, as the symbol engine uses these characters as separators.
MSSymbolServerConverter(const string &local_cache,
const vector<string> &symbol_servers);
MSSymbolServerConverter(const string& local_cache,
const vector<string>& symbol_servers);
// Locates the PE file (DLL or EXE) specified by the identifying information
// in |missing|, by checking the symbol stores identified when the object
// was created. When returning LOCATE_SUCCESS, pe_file is set to
// the pathname of the decompressed PE file as it is stored in the
// local cache.
LocateResult LocatePEFile(const MissingSymbolInfo &missing, string *pe_file);
LocateResult LocatePEFile(const MissingSymbolInfo& missing, string* pe_file);
// Locates the symbol file specified by the identifying information in
// |missing|, by checking the symbol stores identified when the object
// was created. When returning LOCATE_SUCCESS, symbol_file is set to
// the pathname of the decompressed symbol file as it is stored in the
// local cache.
LocateResult LocateSymbolFile(const MissingSymbolInfo &missing,
string *symbol_file);
LocateResult LocateSymbolFile(const MissingSymbolInfo& missing,
string* symbol_file);
// Calls LocateSymbolFile and converts the returned symbol file to the
// dumped-symbol format, storing it adjacent to the symbol file. The
@@ -170,12 +170,12 @@ class MSSymbolServerConverter {
// is desired, set |keep_symbol_file| and |keep_pe_file| to false to indicate
// that the original symbol file (pdb) and executable file (exe, dll) should
// be deleted after conversion.
LocateResult LocateAndConvertSymbolFile(const MissingSymbolInfo &missing,
LocateResult LocateAndConvertSymbolFile(const MissingSymbolInfo& missing,
bool keep_symbol_file,
bool keep_pe_file,
string *converted_symbol_file,
string *symbol_file,
string *pe_file);
string* converted_symbol_file,
string* symbol_file,
string* pe_file);
// Calls LocatePEFile and converts the returned PE file to the
// dumped-symbol format, storing it adjacent to the PE file. The
@@ -188,10 +188,10 @@ class MSSymbolServerConverter {
// to false to indicate that the executable file (exe, dll) should be deleted
// after conversion.
// NOTE: Currrently only supports x64 PEs.
LocateResult LocateAndConvertPEFile(const MissingSymbolInfo &missing,
bool keep_pe_file,
string *converted_symbol_file,
string *pe_file);
LocateResult LocateAndConvertPEFile(const MissingSymbolInfo& missing,
bool keep_pe_file,
string* converted_symbol_file,
string* pe_file);
private:
// Locates the PDB or PE file (DLL or EXE) specified by the identifying
@@ -199,9 +199,9 @@ class MSSymbolServerConverter {
// the symbol stores identified when the object was created. When
// returning LOCATE_SUCCESS, file_name is set to the pathname of the
// decompressed PDB or PE file file as it is stored in the local cache.
LocateResult LocateFile(const string &debug_or_code_file,
const string &debug_or_code_id,
const string &version, string *file_name);
LocateResult LocateFile(const string& debug_or_code_file,
const string& debug_or_code_id,
const string& version, string* file_name);
// Called by various SymSrv functions to report status as progress is made
// and to allow the callback to influence processing. Messages sent to this
@@ -215,8 +215,8 @@ class MSSymbolServerConverter {
// SymFindFileInPath actually seems to accept NULL for a callback function
// and behave properly for our needs in that case, but the documentation
// doesn't mention it, so this little callback is provided.
static BOOL CALLBACK SymFindFileInPathCallback(const char *filename,
void *context);
static BOOL CALLBACK SymFindFileInPathCallback(const char* filename,
void* context);
// The search path used by SymSrv, built based on the arguments to the
// constructor.

View File

@@ -62,14 +62,14 @@ using google_breakpad::MissingSymbolInfo;
using google_breakpad::MSSymbolServerConverter;
using google_breakpad::WindowsStringUtils;
const char *kMissingStringDelimiters = "|";
const char *kLocalCachePath = "c:\\symbols";
const char *kNoExeMSSSServer = "http://msdl.microsoft.com/download/symbols/";
const char* kMissingStringDelimiters = "|";
const char* kLocalCachePath = "c:\\symbols";
const char* kNoExeMSSSServer = "http://msdl.microsoft.com/download/symbols/";
// Windows stdio doesn't do line buffering. Use this function to flush after
// writing to stdout and stderr so that a log will be available if the
// converter crashes.
static int FprintfFlush(FILE *file, const char *format, ...) {
static int FprintfFlush(FILE* file, const char* format, ...) {
va_list arguments;
va_start(arguments, format);
int retval = vfprintf(file, format, arguments);
@@ -86,11 +86,11 @@ static string CurrentDateAndTime() {
// localtime_s is safer but is only available in MSVC8. Use localtime
// in earlier environments.
struct tm *time_pointer;
struct tm* time_pointer;
#if _MSC_VER >= 1400 // MSVC 2005/8
struct tm time_struct;
time_pointer = &time_struct;
if (localtime_s(time_pointer, &current_time) != 0) {
time_pointer =& time_struct;
if (localtime_s(time_pointer,& current_time) != 0) {
return kUnknownDateAndTime;
}
#else // _MSC_VER >= 1400
@@ -111,12 +111,12 @@ static string CurrentDateAndTime() {
// ParseMissingString turns |missing_string| into a MissingSymbolInfo
// structure. It returns true on success, and false if no such conversion
// is possible.
static bool ParseMissingString(const string &missing_string,
MissingSymbolInfo *missing_info) {
static bool ParseMissingString(const string& missing_string,
MissingSymbolInfo* missing_info) {
assert(missing_info);
vector<string> tokens;
Tokenizer::Tokenize(kMissingStringDelimiters, missing_string, &tokens);
Tokenizer::Tokenize(kMissingStringDelimiters, missing_string,& tokens);
if (tokens.size() != 5) {
return false;
}
@@ -133,8 +133,8 @@ static bool ParseMissingString(const string &missing_string,
// StringMapToWStringMap takes each element in a map that associates
// (narrow) strings to strings and converts the keys and values to wstrings.
// Returns true on success and false on failure, printing an error message.
static bool StringMapToWStringMap(const map<string, string> &smap,
map<wstring, wstring> *wsmap) {
static bool StringMapToWStringMap(const map<string, string>& smap,
map<wstring, wstring>* wsmap) {
assert(wsmap);
wsmap->clear();
@@ -142,7 +142,7 @@ static bool StringMapToWStringMap(const map<string, string> &smap,
iterator != smap.end();
++iterator) {
wstring key;
if (!WindowsStringUtils::safe_mbstowcs(iterator->first, &key)) {
if (!WindowsStringUtils::safe_mbstowcs(iterator->first,& key)) {
FprintfFlush(stderr,
"StringMapToWStringMap: safe_mbstowcs failed for key %s\n",
iterator->first.c_str());
@@ -150,7 +150,7 @@ static bool StringMapToWStringMap(const map<string, string> &smap,
}
wstring value;
if (!WindowsStringUtils::safe_mbstowcs(iterator->second, &value)) {
if (!WindowsStringUtils::safe_mbstowcs(iterator->second,& value)) {
FprintfFlush(stderr, "StringMapToWStringMap: safe_mbstowcs failed "
"for value %s\n",
iterator->second.c_str());
@@ -166,8 +166,8 @@ static bool StringMapToWStringMap(const map<string, string> &smap,
// MissingSymbolInfoToParameters turns a MissingSymbolInfo structure into a
// map of parameters suitable for passing to HTTPDownload or HTTPUpload.
// Returns true on success and false on failure, printing an error message.
static bool MissingSymbolInfoToParameters(const MissingSymbolInfo &missing_info,
map<wstring, wstring> *wparameters) {
static bool MissingSymbolInfoToParameters(const MissingSymbolInfo& missing_info,
map<wstring, wstring>* wparameters) {
assert(wparameters);
map<string, string> parameters;
@@ -175,25 +175,25 @@ static bool MissingSymbolInfoToParameters(const MissingSymbolInfo &missing_info,
// Indicate the params are encoded.
parameters["encoded"] = "true"; // The string value here does not matter.
WebSafeBase64Escape(missing_info.code_file, &encoded_param);
WebSafeBase64Escape(missing_info.code_file,& encoded_param);
parameters["code_file"] = encoded_param;
WebSafeBase64Escape(missing_info.code_identifier, &encoded_param);
WebSafeBase64Escape(missing_info.code_identifier,& encoded_param);
parameters["code_identifier"] = encoded_param;
WebSafeBase64Escape(missing_info.debug_file, &encoded_param);
WebSafeBase64Escape(missing_info.debug_file,& encoded_param);
parameters["debug_file"] = encoded_param;
WebSafeBase64Escape(missing_info.debug_identifier, &encoded_param);
WebSafeBase64Escape(missing_info.debug_identifier,& encoded_param);
parameters["debug_identifier"] = encoded_param;
if (!missing_info.version.empty()) {
// The version is optional.
WebSafeBase64Escape(missing_info.version, &encoded_param);
WebSafeBase64Escape(missing_info.version,& encoded_param);
parameters["version"] = encoded_param;
}
WebSafeBase64Escape("WinSymConv", &encoded_param);
WebSafeBase64Escape("WinSymConv",& encoded_param);
parameters["product"] = encoded_param;
if (!StringMapToWStringMap(parameters, wparameters)) {
@@ -207,18 +207,18 @@ static bool MissingSymbolInfoToParameters(const MissingSymbolInfo &missing_info,
// UploadSymbolFile sends |converted_file| as identified by |missing_info|
// to the symbol server rooted at |upload_symbol_url|. Returns true on
// success and false on failure, printing an error message.
static bool UploadSymbolFile(const wstring &upload_symbol_url,
const MissingSymbolInfo &missing_info,
const string &converted_file) {
static bool UploadSymbolFile(const wstring& upload_symbol_url,
const MissingSymbolInfo& missing_info,
const string& converted_file) {
map<wstring, wstring> parameters;
if (!MissingSymbolInfoToParameters(missing_info, &parameters)) {
if (!MissingSymbolInfoToParameters(missing_info,& parameters)) {
// MissingSymbolInfoToParameters or a callee will have printed an error.
return false;
}
wstring converted_file_w;
if (!WindowsStringUtils::safe_mbstowcs(converted_file, &converted_file_w)) {
if (!WindowsStringUtils::safe_mbstowcs(converted_file,& converted_file_w)) {
FprintfFlush(stderr, "UploadSymbolFile: safe_mbstowcs failed for %s\n",
converted_file.c_str());
return false;
@@ -245,18 +245,18 @@ static bool UploadSymbolFile(const wstring &upload_symbol_url,
// |fetch_symbol_failure_url| that the symbol file identified by
// |missing_info| could authoritatively not be located. Returns
// true on success and false on failure.
static bool SendFetchFailedPing(const wstring &fetch_symbol_failure_url,
const MissingSymbolInfo &missing_info) {
static bool SendFetchFailedPing(const wstring& fetch_symbol_failure_url,
const MissingSymbolInfo& missing_info) {
map<wstring, wstring> parameters;
if (!MissingSymbolInfoToParameters(missing_info, &parameters)) {
if (!MissingSymbolInfoToParameters(missing_info,& parameters)) {
// MissingSymbolInfoToParameters or a callee will have printed an error.
return false;
}
string content;
if (!HTTPDownload::Download(fetch_symbol_failure_url,
&parameters,
&content,
& parameters,
& content,
NULL)) {
FprintfFlush(stderr, "SendFetchFailedPing: HTTPDownload::Download failed "
"for %s %s %s\n",
@@ -275,7 +275,7 @@ static bool SendFetchFailedPing(const wstring &fetch_symbol_failure_url,
// the given blacklist regular expression.
// The debug_file name is used from the MissingSymbolInfo struct,
// matched against the blacklist_regex.
static bool SafeToMakeExternalRequest(const MissingSymbolInfo &missing_info,
static bool SafeToMakeExternalRequest(const MissingSymbolInfo& missing_info,
std::regex blacklist_regex) {
string file_name = missing_info.debug_file;
// Use regex_search because we want to match substrings.
@@ -352,8 +352,8 @@ struct ConverterOptions {
// stored at |options.local_cache_path|. Because nothing can be done even in
// the event of a failure, this function returns no value, although it
// may result in error messages being printed.
static void ConvertMissingSymbolFile(const MissingSymbolInfo &missing_info,
const ConverterOptions &options) {
static void ConvertMissingSymbolFile(const MissingSymbolInfo& missing_info,
const ConverterOptions& options) {
string time_string = CurrentDateAndTime();
FprintfFlush(stdout, "converter: %s: attempting %s %s %s\n",
time_string.c_str(),
@@ -402,7 +402,7 @@ static void ConvertMissingSymbolFile(const MissingSymbolInfo &missing_info,
located = converter.LocateAndConvertSymbolFile(missing_info,
false, // keep_symbol_file
false, // keep_pe_file
&converted_file,
& converted_file,
NULL, // symbol_file
NULL); // pe_file
switch (located) {
@@ -476,7 +476,7 @@ static void ConvertMissingSymbolFile(const MissingSymbolInfo &missing_info,
missing_info,
false, // keep_symbol_file
false, // keep_pe_file
&converted_file,
& converted_file,
NULL, // symbol_file
NULL); // pe_file
} else {
@@ -561,9 +561,9 @@ static void ConvertMissingSymbolFile(const MissingSymbolInfo &missing_info,
// Reads the contents of file |file_name| and populates |contents|.
// Returns true on success.
static bool ReadFile(string file_name, string *contents) {
static bool ReadFile(string file_name, string* contents) {
char buffer[1024 * 8];
FILE *fp = fopen(file_name.c_str(), "rt");
FILE* fp = fopen(file_name.c_str(), "rt");
if (!fp) {
return false;
}
@@ -578,7 +578,7 @@ static bool ReadFile(string file_name, string *contents) {
// ConvertMissingSymbolsList obtains a missing symbol list from
// |options.missing_symbols_url| or |options.missing_symbols_file| and calls
// ConvertMissingSymbolFile for each missing symbol file in the list.
static bool ConvertMissingSymbolsList(const ConverterOptions &options) {
static bool ConvertMissingSymbolsList(const ConverterOptions& options) {
// Set param to indicate requesting for encoded response.
map<wstring, wstring> parameters;
parameters[L"product"] = L"WinSymConv";
@@ -586,17 +586,17 @@ static bool ConvertMissingSymbolsList(const ConverterOptions &options) {
// Get the missing symbol list.
string missing_symbol_list;
if (!options.missing_symbols_file.empty()) {
if (!ReadFile(options.missing_symbols_file, &missing_symbol_list)) {
if (!ReadFile(options.missing_symbols_file,& missing_symbol_list)) {
return false;
}
} else if (!HTTPDownload::Download(options.missing_symbols_url, &parameters,
&missing_symbol_list, NULL)) {
} else if (!HTTPDownload::Download(options.missing_symbols_url,& parameters,
& missing_symbol_list, NULL)) {
return false;
}
// Tokenize the content into a vector.
vector<string> missing_symbol_lines;
Tokenizer::Tokenize("\n", missing_symbol_list, &missing_symbol_lines);
Tokenizer::Tokenize("\n", missing_symbol_list,& missing_symbol_lines);
FprintfFlush(stderr, "Found %d missing symbol files in list.\n",
missing_symbol_lines.size() - 1); // last line is empty.
@@ -605,14 +605,14 @@ static bool ConvertMissingSymbolsList(const ConverterOptions &options) {
iterator != missing_symbol_lines.end();
++iterator) {
// Decode symbol line.
const string &encoded_line = *iterator;
const string& encoded_line = *iterator;
// Skip lines that are blank.
if (encoded_line.empty()) {
continue;
}
string line;
if (!WebSafeBase64Unescape(encoded_line, &line)) {
if (!WebSafeBase64Unescape(encoded_line,& line)) {
// If decoding fails, assume the line is not encoded.
// This is helpful when the program connects to a debug server without
// encoding.
@@ -623,7 +623,7 @@ static bool ConvertMissingSymbolsList(const ConverterOptions &options) {
// Turn each element into a MissingSymbolInfo structure.
MissingSymbolInfo missing_info;
if (!ParseMissingString(line, &missing_info)) {
if (!ParseMissingString(line,& missing_info)) {
FprintfFlush(stderr, "ConvertMissingSymbols: ParseMissingString failed "
"for %s from %ws\n",
line.c_str(), options.missing_symbols_url.c_str());
@@ -647,7 +647,7 @@ static bool ConvertMissingSymbolsList(const ConverterOptions &options) {
// usage prints the usage message. It returns 1 as a convenience, to be used
// as a return value from main.
static int usage(const char *program_name) {
static int usage(const char* program_name) {
FprintfFlush(stderr,
"usage: %s [options]\n"
" -f <full_msss_server> MS servers to ask for all symbols\n"
@@ -670,7 +670,7 @@ static int usage(const char *program_name) {
// "Internal" servers consist only of those whose names start with
// the literal string "\\filer\".
static bool IsInternalServer(const string &server_name) {
static bool IsInternalServer(const string& server_name) {
if (server_name.find("\\\\filer\\") == 0) {
return true;
}
@@ -679,9 +679,9 @@ static bool IsInternalServer(const string &server_name) {
// Adds a server with the given name to the list of internal or external
// servers, as appropriate.
static void AddServer(const string &server_name,
vector<string> *internal_servers,
vector<string> *external_servers) {
static void AddServer(const string& server_name,
vector<string>* internal_servers,
vector<string>* external_servers) {
if (IsInternalServer(server_name)) {
internal_servers->push_back(server_name);
} else {
@@ -691,7 +691,7 @@ static void AddServer(const string &server_name,
} // namespace
int main(int argc, char **argv) {
int main(int argc, char** argv) {
string time_string = CurrentDateAndTime();
FprintfFlush(stdout, "converter: %s: starting\n", time_string.c_str());
@@ -710,12 +710,12 @@ int main(int argc, char **argv) {
string value = argv[argi + 1];
if (option == "-f") {
AddServer(value, &options.full_internal_msss_servers,
&options.full_external_msss_servers);
AddServer(value,& options.full_internal_msss_servers,
& options.full_external_msss_servers);
have_any_msss_servers = true;
} else if (option == "-n") {
AddServer(value, &options.no_exe_internal_msss_servers,
&options.no_exe_external_msss_servers);
AddServer(value,& options.no_exe_internal_msss_servers,
& options.no_exe_external_msss_servers);
have_any_msss_servers = true;
} else if (option == "-l") {
if (!options.local_cache_path.empty()) {
@@ -724,14 +724,14 @@ int main(int argc, char **argv) {
options.local_cache_path = value;
} else if (option == "-s") {
if (!WindowsStringUtils::safe_mbstowcs(value,
&options.upload_symbols_url)) {
& options.upload_symbols_url)) {
FprintfFlush(stderr, "main: safe_mbstowcs failed for %s\n",
value.c_str());
return 1;
}
} else if (option == "-m") {
if (!WindowsStringUtils::safe_mbstowcs(value,
&options.missing_symbols_url)) {
& options.missing_symbols_url)) {
FprintfFlush(stderr, "main: safe_mbstowcs failed for %s\n",
value.c_str());
return 1;
@@ -744,7 +744,7 @@ int main(int argc, char **argv) {
} else if (option == "-t") {
if (!WindowsStringUtils::safe_mbstowcs(
value,
&options.fetch_symbol_failure_url)) {
& options.fetch_symbol_failure_url)) {
FprintfFlush(stderr, "main: safe_mbstowcs failed for %s\n",
value.c_str());
return 1;
@@ -768,8 +768,8 @@ int main(int argc, char **argv) {
// Set the defaults. If the user specified any MSSS servers, don't use
// any default.
if (!have_any_msss_servers) {
AddServer(kNoExeMSSSServer, &options.no_exe_internal_msss_servers,
&options.no_exe_external_msss_servers);
AddServer(kNoExeMSSSServer,& options.no_exe_internal_msss_servers,
& options.no_exe_external_msss_servers);
}
if (options.local_cache_path.empty()) {

View File

@@ -83,11 +83,11 @@ class AutoPtr {
// CheckParameters ensures that the parameters in |parameters| are safe for
// use in an HTTP URL. Returns true if they are, false if unsafe characters
// are present.
static bool CheckParameters(const map<wstring, wstring> *parameters) {
static bool CheckParameters(const map<wstring, wstring>* parameters) {
for (map<wstring, wstring>::const_iterator iterator = parameters->begin();
iterator != parameters->end();
++iterator) {
const wstring &key = iterator->first;
const wstring& key = iterator->first;
if (key.empty()) {
// Disallow empty parameter names.
return false;
@@ -99,7 +99,7 @@ static bool CheckParameters(const map<wstring, wstring> *parameters) {
}
}
const wstring &value = iterator->second;
const wstring& value = iterator->second;
for (unsigned int i = 0; i < value.size(); ++i) {
wchar_t c = value[i];
if (c < 32 || c == '"' || c == '?' || c == '&' || c > 127) {
@@ -141,8 +141,8 @@ HttpClient* HTTPDownload::CreateHttpClient(const wchar_t* url) {
}
// static
bool HTTPDownload::Download(const wstring &url,
const map<wstring, wstring> *parameters,
bool HTTPDownload::Download(const wstring& url,
const map<wstring, wstring>* parameters,
string *content, int *status_code) {
assert(content);
AutoPtr<HttpClient> http_client(CreateHttpClient(url.c_str()));

View File

@@ -50,8 +50,8 @@ class HTTPDownload {
// transaction occurs. If Download fails before a transaction can occur,
// |status_code| will be set to 0. Any failures will result in messages
// being printed to stderr.
static bool Download(const wstring &url,
const map<wstring, wstring> *parameters,
static bool Download(const wstring& url,
const map<wstring, wstring>* parameters,
string *content, int *status_code);
private:
static HttpClient* CreateHttpClient(const wchar_t*);

View File

@@ -33,8 +33,8 @@
namespace crash {
// static
void Tokenizer::Tokenize(const string &delimiters, const string &input,
vector<string> *output) {
void Tokenizer::Tokenize(const string& delimiters, const string& input,
vector<string>* output) {
assert(output);
output->clear();

View File

@@ -42,8 +42,8 @@ class Tokenizer {
// Splits |input| into a series of tokens delimited in the input string by
// any of the characters in |delimiters|. The tokens are passed back in the
// |output| vector.
static void Tokenize(const string &delimiters, const string &input,
vector<string> *output);
static void Tokenize(const string& delimiters, const string& input,
vector<string>* output);
};
} // namespace crash

View File

@@ -197,7 +197,7 @@ bool WinHttpClient::GetHttpStatusCode(HttpHandle request_handle,
if (!::WinHttpQueryHeaders(ToHINTERNET(request_handle),
WINHTTP_QUERY_STATUS_CODE,
WINHTTP_HEADER_NAME_BY_INDEX,
static_cast<void *>(&http_status_string),
static_cast<void*>(&http_status_string),
&http_status_string_size, 0)) {
return false;
}
@@ -216,7 +216,7 @@ bool WinHttpClient::GetContentLength(HttpHandle request_handle,
if (!::WinHttpQueryHeaders(ToHINTERNET(request_handle),
WINHTTP_QUERY_CONTENT_LENGTH,
WINHTTP_HEADER_NAME_BY_INDEX,
static_cast<void *>(&content_length_string),
static_cast<void*>(&content_length_string),
&content_length_string_size, 0)) {
*content_length = kUnknownContentLength;
} else {

View File

@@ -196,7 +196,7 @@ bool WinInetClient::GetHttpStatusCode(HttpHandle request_handle,
DWORD http_status_string_size = sizeof(http_status_string);
if (!::HttpQueryInfo(ToHINTERNET(request_handle),
HTTP_QUERY_STATUS_CODE,
static_cast<void *>(&http_status_string),
static_cast<void*>(&http_status_string),
&http_status_string_size,
0)) {
return false;
@@ -215,7 +215,7 @@ bool WinInetClient::GetContentLength(HttpHandle request_handle,
DWORD content_length_string_size = sizeof(content_length_string);
if (!::HttpQueryInfo(ToHINTERNET(request_handle),
HTTP_QUERY_CONTENT_LENGTH,
static_cast<void *>(&content_length_string),
static_cast<void*>(&content_length_string),
&content_length_string_size,
0)) {
*content_length = kUnknownContentLength;

View File

@@ -43,7 +43,7 @@ using google_breakpad::PDBSourceLineWriter;
using google_breakpad::PESourceLineWriter;
using std::unique_ptr;
int wmain(int argc, wchar_t **argv) {
int wmain(int argc, wchar_t** argv) {
bool success;
if (argc == 2) {
PDBSourceLineWriter pdb_writer;

View File

@@ -166,7 +166,7 @@ void GetFileContents(const std::wstring& path, std::string* content) {
}
}
class DumpSymsRegressionTest : public testing::TestWithParam<const wchar_t *> {
class DumpSymsRegressionTest : public testing::TestWithParam<const wchar_t*> {
public:
virtual void SetUp() {
std::wstring self_dir;
@@ -181,7 +181,7 @@ class DumpSymsRegressionTest : public testing::TestWithParam<const wchar_t *> {
std::wstring testdata_dir;
};
class DumpSymsPEOnlyRegressionTest : public testing::TestWithParam<const wchar_t *> {
class DumpSymsPEOnlyRegressionTest : public testing::TestWithParam<const wchar_t*> {
public:
virtual void SetUp() {
std::wstring self_dir;

View File

@@ -48,7 +48,7 @@ class C {
void f() { member_ = g(); }
virtual int g() { return 2; }
static char* h(const C &that) { return 0; }
static char* h(const C& that) { return 0; }
private:
int member_;
@@ -60,12 +60,12 @@ static int i() {
} // namespace google_breakpad
int main(int argc, char **argv) {
int main(int argc, char** argv) {
google_breakpad::C object;
object.set_member(google_breakpad::i());
object.f();
int value = object.g();
char *nothing = object.h(object);
char* nothing = object.h(object);
return 0;
}

View File

@@ -73,7 +73,7 @@ using google_breakpad::WindowsStringUtils;
// Extracts the file version information for the given filename,
// as a string, for example, "1.2.3.4". Returns true on success.
static bool GetFileVersionString(const wchar_t *filename, wstring *version) {
static bool GetFileVersionString(const wchar_t* filename, wstring* version) {
DWORD handle;
DWORD version_size = GetFileVersionInfoSize(filename, &handle);
if (version_size < sizeof(VS_FIXEDFILEINFO)) {
@@ -85,7 +85,7 @@ static bool GetFileVersionString(const wchar_t *filename, wstring *version) {
return false;
}
void *file_info_buffer = NULL;
void* file_info_buffer = NULL;
unsigned int file_info_length;
if (!VerQueryValue(&version_info[0], L"\\",
&file_info_buffer, &file_info_length)) {
@@ -95,7 +95,7 @@ static bool GetFileVersionString(const wchar_t *filename, wstring *version) {
// The maximum value of each version component is 65535 (0xffff),
// so the max length is 24, including the terminating null.
wchar_t ver_string[24];
VS_FIXEDFILEINFO *file_info =
VS_FIXEDFILEINFO* file_info =
reinterpret_cast<VS_FIXEDFILEINFO*>(file_info_buffer);
swprintf(ver_string, sizeof(ver_string) / sizeof(ver_string[0]),
L"%d.%d.%d.%d",
@@ -114,9 +114,9 @@ static bool GetFileVersionString(const wchar_t *filename, wstring *version) {
// Creates a new temporary file and writes the symbol data from the given
// exe/dll file to it. Returns the path to the temp file in temp_file_path
// and information about the pdb in pdb_info.
static bool DumpSymbolsToTempFile(const wchar_t *file,
wstring *temp_file_path,
PDBModuleInfo *pdb_info) {
static bool DumpSymbolsToTempFile(const wchar_t* file,
wstring* temp_file_path,
PDBModuleInfo* pdb_info) {
google_breakpad::PDBSourceLineWriter writer;
// Use EXE_FILE to get information out of the exe/dll in addition to the
// pdb. The name and version number of the exe/dll are of value, and
@@ -135,7 +135,7 @@ static bool DumpSymbolsToTempFile(const wchar_t *file,
return false;
}
FILE *temp_file = NULL;
FILE* temp_file = NULL;
#if _MSC_VER >= 1400 // MSVC 2005/8
if (_wfopen_s(&temp_file, temp_filename, L"w") != 0)
#else // _MSC_VER >= 1400
@@ -270,9 +270,9 @@ __declspec(noreturn) void printUsageAndExit() {
exit(0);
}
int wmain(int argc, wchar_t *argv[]) {
const wchar_t *module;
const wchar_t *product = nullptr;
int wmain(int argc, wchar_t* argv[]) {
const wchar_t* module;
const wchar_t* product = nullptr;
int timeout = -1;
int currentarg = 1;
bool use_sym_upload_v2 = false;