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

@@ -56,7 +56,7 @@ int usage(const char* self) {
return 1;
}
int main(int argc, char **argv) {
int main(int argc, char** argv) {
if (argc < 2)
return usage(argv[0]);
bool header_only = false;

View File

@@ -149,7 +149,7 @@ SetupOptions(int argc, const char* argv[], Options* options) {
options->use_filename = false;
options->inc_guid = false;
while ((ch = getopt(argc, (char * const *)argv, "fhio:S:v")) != -1) {
while ((ch = getopt(argc, (char * const*)argv, "fhio:S:v")) != -1) {
switch (ch) {
case 'h':
Usage(argc, argv);
@@ -224,7 +224,7 @@ writea(int fd, const void* idata, size_t length) {
*/
static inline int sex() {
int probe = 1;
return !*(char *)&probe;
return !*(char*)&probe;
}
typedef struct elf_timeval { /* Time value with microsecond resolution */
@@ -660,10 +660,10 @@ ParseSystemInfo(const Options& options, CrashedProcess* crashinfo,
sysinfo->processor_architecture == MD_CPU_ARCHITECTURE_AMD64) {
fputs("Vendor id: ", stderr);
const char *nul =
(const char *)memchr(sysinfo->cpu.x86_cpu_info.vendor_id, 0,
(const char*)memchr(sysinfo->cpu.x86_cpu_info.vendor_id, 0,
sizeof(sysinfo->cpu.x86_cpu_info.vendor_id));
fwrite(sysinfo->cpu.x86_cpu_info.vendor_id,
nul ? nul - (const char *)&sysinfo->cpu.x86_cpu_info.vendor_id[0]
nul ? nul - (const char*)&sysinfo->cpu.x86_cpu_info.vendor_id[0]
: sizeof(sysinfo->cpu.x86_cpu_info.vendor_id), 1, stderr);
fputs("\n", stderr);
}
@@ -759,7 +759,7 @@ ParseEnvironment(const Options& options, CrashedProcess* crashinfo,
memcpy(env, range.data(), range.length());
int nul_count = 0;
for (char *ptr = env;;) {
ptr = (char *)memchr(ptr, '\000', range.length() - (ptr - env));
ptr = (char*)memchr(ptr, '\000', range.length() - (ptr - env));
if (!ptr) {
break;
}
@@ -1076,7 +1076,7 @@ AugmentMappings(const Options& options, CrashedProcess* crashinfo,
for (unsigned i = 0; i < crashinfo->threads.size(); ++i) {
const CrashedProcess::Thread& thread = crashinfo->threads[i];
AddDataToMapping(crashinfo,
string((char *)thread.stack, thread.stack_length),
string((char*)thread.stack, thread.stack_length),
thread.stack_addr);
}

View File

@@ -111,7 +111,7 @@ SetupOptions(int argc, const char *argv[], Options *options) {
extern int optind;
int ch;
while ((ch = getopt(argc, (char * const *)argv, "p:u:v:x:h?")) != -1) {
while ((ch = getopt(argc, (char * const*)argv, "p:u:v:x:h?")) != -1) {
switch (ch) {
case 'p':
options->product = optarg;

View File

@@ -115,7 +115,7 @@ SetupOptions(int argc, const char *argv[], Options *options) {
int ch;
constexpr char flag_pattern[] = "u:v:x:p:k:t:c:i:hf?";
while ((ch = getopt(argc, (char * const *)argv, flag_pattern)) != -1) {
while ((ch = getopt(argc, (char * const*)argv, flag_pattern)) != -1) {
switch (ch) {
case 'h':
case '?':

View File

@@ -47,30 +47,30 @@ class OnDemandSymbolSupplier : public SymbolSupplier {
public:
// |search_dir| is the directory to search for alternative symbols with
// the same name as the module in the minidump
OnDemandSymbolSupplier(const string &search_dir,
const string &symbol_search_dir);
OnDemandSymbolSupplier(const string& search_dir,
const string& symbol_search_dir);
virtual ~OnDemandSymbolSupplier() {}
// Returns the path to the symbol file for the given module.
virtual SymbolResult GetSymbolFile(const CodeModule *module,
const SystemInfo *system_info,
string *symbol_file);
virtual SymbolResult GetSymbolFile(const CodeModule* module,
const SystemInfo* system_info,
string* symbol_file);
// Returns the path to the symbol file for the given module.
virtual SymbolResult GetSymbolFile(const CodeModule *module,
const SystemInfo *system_info,
string *symbol_file,
string *symbol_data);
virtual SymbolResult GetSymbolFile(const CodeModule* module,
const SystemInfo* system_info,
string* symbol_file,
string* symbol_data);
// Allocates data buffer on heap, and takes the ownership of
// the data buffer.
virtual SymbolResult GetCStringSymbolData(const CodeModule *module,
const SystemInfo *system_info,
string *symbol_file,
char **symbol_data,
size_t *symbol_data_size);
virtual SymbolResult GetCStringSymbolData(const CodeModule* module,
const SystemInfo* system_info,
string* symbol_file,
char** symbol_data,
size_t* symbol_data_size);
// Delete the data buffer allocated for module in GetCStringSymbolData().
virtual void FreeSymbolData(const CodeModule *module);
virtual void FreeSymbolData(const CodeModule* module);
protected:
// Search directory
@@ -82,28 +82,28 @@ class OnDemandSymbolSupplier : public SymbolSupplier {
map<string, string> module_file_map_;
// Map of allocated data buffers, keyed by module->code_file().
map<string, char *> memory_buffers_;
map<string, char*> memory_buffers_;
// Return the name for |module| This will be the value used as the key
// to the |module_file_map_|.
string GetNameForModule(const CodeModule *module);
string GetNameForModule(const CodeModule* module);
// Find the module on local system. If the module resides in a different
// location than the full path in the minidump, this will be the location
// used.
string GetLocalModulePath(const CodeModule *module);
string GetLocalModulePath(const CodeModule* module);
// Return the full path for |module|.
string GetModulePath(const CodeModule *module);
string GetModulePath(const CodeModule* module);
// Return the path to the symbol file for |module|. If an empty string is
// returned, then |module| doesn't have a symbol file.
string GetModuleSymbolFile(const CodeModule *module);
string GetModuleSymbolFile(const CodeModule* module);
// Generate the breakpad symbol file for |module|. Return true if successful.
// File is generated in /tmp.
bool GenerateSymbolFile(const CodeModule *module,
const SystemInfo *system_info);
bool GenerateSymbolFile(const CodeModule* module,
const SystemInfo* system_info);
};
} // namespace google_breakpad

View File

@@ -51,10 +51,10 @@ using google_breakpad::PathnameStripper;
using google_breakpad::SymbolSupplier;
using google_breakpad::SystemInfo;
OnDemandSymbolSupplier::OnDemandSymbolSupplier(const string &search_dir,
const string &symbol_search_dir)
OnDemandSymbolSupplier::OnDemandSymbolSupplier(const string& search_dir,
const string& symbol_search_dir)
: search_dir_(search_dir) {
NSFileManager *mgr = [NSFileManager defaultManager];
NSFileManager* mgr = [NSFileManager defaultManager];
size_t length = symbol_search_dir.length();
if (length) {
// Load all sym files in symbol_search_dir into our module_file_map
@@ -62,51 +62,51 @@ OnDemandSymbolSupplier::OnDemandSymbolSupplier(const string &search_dir,
// MODULE mac x86 BBF0A8F9BEADDD2048E6464001CA193F0 GoogleDesktopDaemon
// or
// MODULE mac ppc BBF0A8F9BEADDD2048E6464001CA193F0 GoogleDesktopDaemon
const char *symbolSearchStr = symbol_search_dir.c_str();
NSString *symbolSearchPath =
const char* symbolSearchStr = symbol_search_dir.c_str();
NSString* symbolSearchPath =
[mgr stringWithFileSystemRepresentation:symbolSearchStr
length:strlen(symbolSearchStr)];
NSDirectoryEnumerator *dirEnum = [mgr enumeratorAtPath:symbolSearchPath];
NSString *fileName;
NSCharacterSet *hexSet =
NSDirectoryEnumerator* dirEnum = [mgr enumeratorAtPath:symbolSearchPath];
NSString* fileName;
NSCharacterSet* hexSet =
[NSCharacterSet characterSetWithCharactersInString:@"0123456789ABCDEF"];
NSCharacterSet *newlineSet =
NSCharacterSet* newlineSet =
[NSCharacterSet characterSetWithCharactersInString:@"\r\n"];
while ((fileName = [dirEnum nextObject])) {
// Check to see what type of file we have
NSDictionary *attrib = [dirEnum fileAttributes];
NSString *fileType = [attrib objectForKey:NSFileType];
NSDictionary* attrib = [dirEnum fileAttributes];
NSString* fileType = [attrib objectForKey:NSFileType];
if ([fileType isEqualToString:NSFileTypeDirectory]) {
// Skip subdirectories
[dirEnum skipDescendents];
} else {
NSString *filePath = [symbolSearchPath stringByAppendingPathComponent:fileName];
NSString *dataStr = [NSString stringWithContentsOfFile:filePath encoding:NSUTF8StringEncoding error:NULL];
NSString* filePath = [symbolSearchPath stringByAppendingPathComponent:fileName];
NSString* dataStr = [NSString stringWithContentsOfFile:filePath encoding:NSUTF8StringEncoding error:NULL];
if (dataStr) {
// Check file to see if it is of appropriate type, and grab module
// name.
NSScanner *scanner = [NSScanner scannerWithString:dataStr];
NSScanner* scanner = [NSScanner scannerWithString:dataStr];
BOOL goodScan = [scanner scanString:@"MODULE mac " intoString:nil];
if (goodScan) {
goodScan = ([scanner scanString:@"x86 " intoString:nil] ||
[scanner scanString:@"x86_64 " intoString:nil] ||
[scanner scanString:@"ppc " intoString:nil]);
if (goodScan) {
NSString *moduleID;
NSString* moduleID;
goodScan = [scanner scanCharactersFromSet:hexSet
intoString:&moduleID];
if (goodScan) {
// Module IDs are always 33 chars long
goodScan = [moduleID length] == 33;
if (goodScan) {
NSString *moduleName;
NSString* moduleName;
goodScan = [scanner scanUpToCharactersFromSet:newlineSet
intoString:&moduleName];
if (goodScan) {
goodScan = [moduleName length] > 0;
if (goodScan) {
const char *moduleNameStr = [moduleName UTF8String];
const char *filePathStr = [filePath fileSystemRepresentation];
const char* moduleNameStr = [moduleName UTF8String];
const char* filePathStr = [filePath fileSystemRepresentation];
// Map our file
module_file_map_[moduleNameStr] = filePathStr;
}
@@ -122,9 +122,9 @@ OnDemandSymbolSupplier::OnDemandSymbolSupplier(const string &search_dir,
}
SymbolSupplier::SymbolResult
OnDemandSymbolSupplier::GetSymbolFile(const CodeModule *module,
const SystemInfo *system_info,
string *symbol_file) {
OnDemandSymbolSupplier::GetSymbolFile(const CodeModule* module,
const SystemInfo* system_info,
string* symbol_file) {
string path(GetModuleSymbolFile(module));
if (path.empty()) {
@@ -142,10 +142,10 @@ OnDemandSymbolSupplier::GetSymbolFile(const CodeModule *module,
}
SymbolSupplier::SymbolResult
OnDemandSymbolSupplier::GetSymbolFile(const CodeModule *module,
const SystemInfo *system_info,
string *symbol_file,
string *symbol_data) {
OnDemandSymbolSupplier::GetSymbolFile(const CodeModule* module,
const SystemInfo* system_info,
string* symbol_file,
string* symbol_data) {
SymbolSupplier::SymbolResult s = GetSymbolFile(module,
system_info,
symbol_file);
@@ -162,11 +162,11 @@ OnDemandSymbolSupplier::GetSymbolFile(const CodeModule *module,
}
SymbolSupplier::SymbolResult
OnDemandSymbolSupplier::GetCStringSymbolData(const CodeModule *module,
const SystemInfo *system_info,
string *symbol_file,
char **symbol_data,
size_t *symbol_data_size) {
OnDemandSymbolSupplier::GetCStringSymbolData(const CodeModule* module,
const SystemInfo* system_info,
string* symbol_file,
char** symbol_data,
size_t* symbol_data_size) {
std::string symbol_data_string;
SymbolSupplier::SymbolResult result = GetSymbolFile(module,
system_info,
@@ -186,21 +186,21 @@ OnDemandSymbolSupplier::GetCStringSymbolData(const CodeModule *module,
return result;
}
void OnDemandSymbolSupplier::FreeSymbolData(const CodeModule *module) {
map<string, char *>::iterator it = memory_buffers_.find(module->code_file());
void OnDemandSymbolSupplier::FreeSymbolData(const CodeModule* module) {
map<string, char*>::iterator it = memory_buffers_.find(module->code_file());
if (it != memory_buffers_.end()) {
delete [] it->second;
memory_buffers_.erase(it);
}
}
string OnDemandSymbolSupplier::GetLocalModulePath(const CodeModule *module) {
NSFileManager *mgr = [NSFileManager defaultManager];
const char *moduleStr = module->code_file().c_str();
NSString *modulePath =
string OnDemandSymbolSupplier::GetLocalModulePath(const CodeModule* module) {
NSFileManager* mgr = [NSFileManager defaultManager];
const char* moduleStr = module->code_file().c_str();
NSString* modulePath =
[mgr stringWithFileSystemRepresentation:moduleStr length:strlen(moduleStr)];
const char *searchStr = search_dir_.c_str();
NSString *searchDir =
const char* searchStr = search_dir_.c_str();
NSString* searchDir =
[mgr stringWithFileSystemRepresentation:searchStr length:strlen(searchStr)];
if ([mgr fileExistsAtPath:modulePath])
@@ -209,9 +209,9 @@ string OnDemandSymbolSupplier::GetLocalModulePath(const CodeModule *module) {
// If the module is not found, try to start appending the components to the
// search string and stop if a file (not dir) is found or all components
// have been appended
NSArray *pathComponents = [modulePath componentsSeparatedByString:@"/"];
NSArray* pathComponents = [modulePath componentsSeparatedByString:@"/"];
size_t count = [pathComponents count];
NSMutableString *path = [NSMutableString string];
NSMutableString* path = [NSMutableString string];
for (size_t i = 0; i < count; ++i) {
[path setString:searchDir];
@@ -230,22 +230,22 @@ string OnDemandSymbolSupplier::GetLocalModulePath(const CodeModule *module) {
return "";
}
string OnDemandSymbolSupplier::GetModulePath(const CodeModule *module) {
string OnDemandSymbolSupplier::GetModulePath(const CodeModule* module) {
return module->code_file();
}
string OnDemandSymbolSupplier::GetNameForModule(const CodeModule *module) {
string OnDemandSymbolSupplier::GetNameForModule(const CodeModule* module) {
return PathnameStripper::File(module->code_file());
}
string OnDemandSymbolSupplier::GetModuleSymbolFile(const CodeModule *module) {
string OnDemandSymbolSupplier::GetModuleSymbolFile(const CodeModule* module) {
string name(GetNameForModule(module));
map<string, string>::iterator result = module_file_map_.find(name);
return (result == module_file_map_.end()) ? "" : (*result).second;
}
static float GetFileModificationTime(const char *path) {
static float GetFileModificationTime(const char* path) {
float result = 0;
struct stat file_stat;
if (stat(path, &file_stat) == 0)
@@ -255,12 +255,12 @@ static float GetFileModificationTime(const char *path) {
return result;
}
bool OnDemandSymbolSupplier::GenerateSymbolFile(const CodeModule *module,
const SystemInfo *system_info) {
bool OnDemandSymbolSupplier::GenerateSymbolFile(const CodeModule* module,
const SystemInfo* system_info) {
bool result = true;
string name = GetNameForModule(module);
string module_path = GetLocalModulePath(module);
NSString *symbol_path = [NSString stringWithFormat:@"/tmp/%s.%s.sym",
NSString* symbol_path = [NSString stringWithFormat:@"/tmp/%s.%s.sym",
name.c_str(), system_info->cpu.c_str()];
if (module_path.empty())

View File

@@ -106,7 +106,7 @@ static void CopyCFIDataBetweenModules(Module* to_module,
}
}
static bool Start(const Options &options) {
static bool Start(const Options& options) {
SymbolData symbol_data = options.cfi ? ALL_SYMBOL_DATA : NO_CFI;
DumpSymbols dump_symbols(symbol_data, options.handle_inter_cu_refs);
@@ -210,7 +210,7 @@ static void SetupOptions(int argc, const char *argv[], Options *options) {
extern int optind;
signed char ch;
while ((ch = getopt(argc, (char * const *)argv, "ia:g:chr?")) != -1) {
while ((ch = getopt(argc, (char * const*)argv, "ia:g:chr?")) != -1) {
switch (ch) {
case 'i':
options->header_only = true;

View File

@@ -60,7 +60,7 @@ namespace mach_o = google_breakpad::mach_o;
string program_name;
int check_syscall(int result, const char *operation, const char *filename) {
int check_syscall(int result, const char* operation, const char* filename) {
if (result < 0) {
fprintf(stderr, "%s: %s '%s': %s\n",
program_name.c_str(), operation,
@@ -73,7 +73,7 @@ int check_syscall(int result, const char *operation, const char *filename) {
class DumpSection: public mach_o::Reader::SectionHandler {
public:
DumpSection() : index_(0) { }
bool HandleSection(const mach_o::Section &section) {
bool HandleSection(const mach_o::Section& section) {
printf(" section %d '%s' in segment '%s'\n"
" address: 0x%llx\n"
" alignment: 1 << %d B\n"
@@ -92,13 +92,13 @@ class DumpSection: public mach_o::Reader::SectionHandler {
class DumpCommand: public mach_o::Reader::LoadCommandHandler {
public:
DumpCommand(mach_o::Reader *reader) : reader_(reader), index_(0) { }
DumpCommand(mach_o::Reader* reader) : reader_(reader), index_(0) { }
bool UnknownCommand(mach_o::LoadCommandType type,
const ByteBuffer &contents) {
const ByteBuffer& contents) {
printf(" load command %d: %d", index_++, type);
return true;
}
bool SegmentCommand(const mach_o::Segment &segment) {
bool SegmentCommand(const mach_o::Segment& segment) {
printf(" load command %d: %s-bit segment '%s'\n"
" address: 0x%llx\n"
" memory size: 0x%llx\n"
@@ -115,24 +115,24 @@ class DumpCommand: public mach_o::Reader::LoadCommandHandler {
return reader_->WalkSegmentSections(segment, &dump_section);
}
private:
mach_o::Reader *reader_;
mach_o::Reader* reader_;
int index_;
};
void DumpFile(const char *filename) {
void DumpFile(const char* filename) {
int fd = check_syscall(open(filename, O_RDONLY), "opening", filename);
struct stat attributes;
check_syscall(fstat(fd, &attributes),
"getting file attributes for", filename);
void *mapping = mmap(NULL, attributes.st_size, PROT_READ,
void* mapping = mmap(NULL, attributes.st_size, PROT_READ,
MAP_PRIVATE, fd, 0);
close(fd);
check_syscall(mapping == (void *)-1 ? -1 : 0,
check_syscall(mapping == (void*)-1 ? -1 : 0,
"mapping contents of", filename);
mach_o::FatReader::Reporter fat_reporter(filename);
mach_o::FatReader fat_reader(&fat_reporter);
if (!fat_reader.Read(reinterpret_cast<uint8_t *>(mapping),
if (!fat_reader.Read(reinterpret_cast<uint8_t*>(mapping),
attributes.st_size)) {
exit(1);
}
@@ -140,14 +140,14 @@ void DumpFile(const char *filename) {
size_t object_files_size;
const SuperFatArch* super_fat_object_files =
fat_reader.object_files(&object_files_size);
struct fat_arch *object_files;
struct fat_arch* object_files;
if (!super_fat_object_files->ConvertToFatArch(object_files)) {
exit(1);
}
printf(" object file count: %ld\n", object_files_size);
for (size_t i = 0; i < object_files_size; i++) {
const struct fat_arch &file = object_files[i];
const NXArchInfo *fat_arch_info =
const struct fat_arch& file = object_files[i];
const NXArchInfo* fat_arch_info =
google_breakpad::BreakpadGetArchInfoFromCpuType(
file.cputype, file.cpusubtype);
printf("\n object file %ld:\n"
@@ -162,7 +162,7 @@ void DumpFile(const char *filename) {
name << filename;
if (object_files_size > 1)
name << ", object file #" << i;
ByteBuffer file_contents(reinterpret_cast<uint8_t *>(mapping)
ByteBuffer file_contents(reinterpret_cast<uint8_t*>(mapping)
+ file.offset, file.size);
mach_o::Reader::Reporter reporter(name.str());
mach_o::Reader reader(&reporter);
@@ -170,7 +170,7 @@ void DumpFile(const char *filename) {
exit(1);
}
const NXArchInfo *macho_arch_info =
const NXArchInfo* macho_arch_info =
NXGetArchInfoFromCpuType(reader.cpu_type(),
reader.cpu_subtype());
printf(" Mach-O header:\n"
@@ -190,7 +190,7 @@ void DumpFile(const char *filename) {
} // namespace
int main(int argc, char **argv) {
int main(int argc, char** argv) {
program_name = google_breakpad::BaseName(argv[0]);
if (argc == 1) {
fprintf(stderr, "Usage: %s FILE ...\n"

View File

@@ -36,13 +36,13 @@
using namespace google_breakpad;
int main(int argc, char **argv) {
int main(int argc, char** argv) {
if (argc != 2) {
fprintf(stderr, "Usage: %s <binary-with-stab-symbol>\n", argv[0]);
return 1;
}
const char *binary = argv[1];
const char* binary = argv[1];
DumpSymbols dumper;
if (!dumper.WriteSymbolFile(binary, fileno(stdout))) {

View File

@@ -41,7 +41,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_;
@@ -53,12 +53,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

@@ -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;