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

@@ -32,7 +32,7 @@
#include "common/linux/ucontext_constants.h"
/* int getcontext (ucontext_t *ucp) */
/* int getcontext (ucontext_t* ucp) */
#if defined(__arm__)
@@ -336,7 +336,7 @@ symbol: .frame sp, framesize, rpc;
.size function,.-function
#endif
/* int getcontext (ucontext_t *ucp) */
/* int getcontext (ucontext_t* ucp) */
NESTED (breakpad_getcontext, FRAME_SIZE, ra)
.mask 0x10000000, 0

View File

@@ -144,7 +144,7 @@ class MmapWrapper {
munmap(base_, size_);
}
}
void set(void *mapped_address, size_t mapped_size) {
void set(void* mapped_address, size_t mapped_size) {
is_set_ = true;
base_ = mapped_address;
size_ = mapped_size;
@@ -232,7 +232,7 @@ bool LoadStabs(const typename ElfClass::Ehdr* elf_header,
// owned by a function) with the results.
class DumperRangesHandler : public DwarfCUToModule::RangesHandler {
public:
DumperRangesHandler(const uint8_t *buffer, uint64_t size,
DumperRangesHandler(const uint8_t* buffer, uint64_t size,
dwarf2reader::ByteReader* reader)
: buffer_(buffer), size_(size), reader_(reader) { }
@@ -246,7 +246,7 @@ class DumperRangesHandler : public DwarfCUToModule::RangesHandler {
}
private:
const uint8_t *buffer_;
const uint8_t* buffer_;
uint64_t size_;
dwarf2reader::ByteReader* reader_;
};
@@ -257,7 +257,7 @@ class DumperRangesHandler : public DwarfCUToModule::RangesHandler {
class DumperLineToModule: public DwarfCUToModule::LineToModuleHandler {
public:
// Create a line-to-module converter using BYTE_READER.
explicit DumperLineToModule(dwarf2reader::ByteReader *byte_reader)
explicit DumperLineToModule(dwarf2reader::ByteReader* byte_reader)
: byte_reader_(byte_reader) { }
void StartCompilationUnit(const string& compilation_dir) {
compilation_dir_ = compilation_dir;
@@ -278,7 +278,7 @@ class DumperLineToModule: public DwarfCUToModule::LineToModuleHandler {
}
private:
string compilation_dir_;
dwarf2reader::ByteReader *byte_reader_;
dwarf2reader::ByteReader* byte_reader_;
};
template<typename ElfClass>
@@ -308,7 +308,7 @@ bool LoadDwarf(const string& dwarf_filename,
string name = GetOffset<ElfClass, char>(elf_header,
section_names->sh_offset) +
section->sh_name;
const uint8_t *contents = GetOffset<ElfClass, uint8_t>(elf_header,
const uint8_t* contents = GetOffset<ElfClass, uint8_t>(elf_header,
section->sh_offset);
file_context.AddSectionToSectionMap(name, contents, section->sh_size);
}
@@ -318,7 +318,7 @@ bool LoadDwarf(const string& dwarf_filename,
dwarf2reader::SectionMap::const_iterator ranges_entry =
file_context.section_map().find(".debug_ranges");
if (ranges_entry != file_context.section_map().end()) {
const std::pair<const uint8_t *, uint64_t>& ranges_section =
const std::pair<const uint8_t*, uint64_t>& ranges_section =
ranges_entry->second;
ranges_handler.reset(
new DumperRangesHandler(ranges_section.first, ranges_section.second,
@@ -330,7 +330,7 @@ bool LoadDwarf(const string& dwarf_filename,
dwarf2reader::SectionMap::const_iterator debug_info_entry =
file_context.section_map().find(".debug_info");
assert(debug_info_entry != file_context.section_map().end());
const std::pair<const uint8_t *, uint64_t>& debug_info_section =
const std::pair<const uint8_t*, uint64_t>& debug_info_section =
debug_info_entry->second;
// This should never have been called if the file doesn't have a
// .debug_info section.
@@ -409,7 +409,7 @@ bool LoadDwarfCFI(const string& dwarf_filename,
dwarf2reader::ENDIANNESS_BIG : dwarf2reader::ENDIANNESS_LITTLE;
// Find the call frame information and its size.
const uint8_t *cfi =
const uint8_t* cfi =
GetOffset<ElfClass, uint8_t>(elf_header, section->sh_offset);
size_t cfi_size = section->sh_size;
@@ -497,13 +497,13 @@ bool IsSameFile(const char* left_abspath, const string& right_path) {
// Read the .gnu_debuglink and get the debug file name. If anything goes
// wrong, return an empty string.
string ReadDebugLink(const uint8_t *debuglink,
string ReadDebugLink(const uint8_t* debuglink,
const size_t debuglink_size,
const bool big_endian,
const string& obj_file,
const std::vector<string>& debug_dirs) {
// Include '\0' + CRC32 (4 bytes).
size_t debuglink_len = strlen(reinterpret_cast<const char *>(debuglink)) + 5;
size_t debuglink_len = strlen(reinterpret_cast<const char*>(debuglink)) + 5;
debuglink_len = 4 * ((debuglink_len + 3) / 4); // Round up to 4 bytes.
// Sanity check.
@@ -525,7 +525,7 @@ string ReadDebugLink(const uint8_t *debuglink,
for (it = debug_dirs.begin(); it < debug_dirs.end(); ++it) {
const string& debug_dir = *it;
debuglink_path = debug_dir + "/" +
reinterpret_cast<const char *>(debuglink);
reinterpret_cast<const char*>(debuglink);
// There is the annoying case of /path/to/foo.so having foo.so as the
// debug link file name. Thus this may end up opening /path/to/foo.so again,
@@ -599,7 +599,7 @@ class LoadSymbolsInfo {
// Keeps track of which sections have been loaded so sections don't
// accidentally get loaded twice from two different files.
void LoadedSection(const string &section) {
void LoadedSection(const string& section) {
if (loaded_sections_.count(section) == 0) {
loaded_sections_.insert(section);
} else {
@@ -610,7 +610,7 @@ class LoadSymbolsInfo {
// The ELF file and linked debug file are expected to have the same preferred
// loading address.
void set_loading_addr(Addr addr, const string &filename) {
void set_loading_addr(Addr addr, const string& filename) {
if (!has_loading_addr_) {
loading_addr_ = addr;
loaded_file_ = filename;
@@ -687,7 +687,7 @@ bool LoadSymbols(const string& obj_file,
const Shdr* section_names = sections + elf_header->e_shstrndx;
const char* names =
GetOffset<ElfClass, char>(elf_header, section_names->sh_offset);
const char *names_end = names + section_names->sh_size;
const char* names_end = names + section_names->sh_size;
bool found_debug_info_section = false;
bool found_usable_info = false;
@@ -867,7 +867,7 @@ bool LoadSymbols(const string& obj_file,
names_end, elf_header->e_shnum);
if (gnu_debuglink_section) {
if (!info->debug_dirs().empty()) {
const uint8_t *debuglink_contents =
const uint8_t* debuglink_contents =
GetOffset<ElfClass, uint8_t>(elf_header,
gnu_debuglink_section->sh_offset);
string debuglink_file =
@@ -964,7 +964,7 @@ bool InitModuleForElfClass(const typename ElfClass::Ehdr* elf_header,
return false;
}
const char *architecture = ElfArchitecture<ElfClass>(elf_header);
const char* architecture = ElfArchitecture<ElfClass>(elf_header);
if (!architecture) {
fprintf(stderr, "%s: unrecognized ELF machine architecture: %d\n",
obj_filename.c_str(), elf_header->e_machine);
@@ -1074,12 +1074,12 @@ bool ReadSymbolDataInternal(const uint8_t* obj_file,
return false;
}
bool WriteSymbolFile(const string &load_path,
const string &obj_file,
const string &obj_os,
bool WriteSymbolFile(const string& load_path,
const string& obj_file,
const string& obj_os,
const std::vector<string>& debug_dirs,
const DumpOptions& options,
std::ostream &sym_stream) {
std::ostream& sym_stream) {
Module* module;
if (!ReadSymbolData(load_path, obj_file, obj_os, debug_dirs, options,
&module))
@@ -1096,7 +1096,7 @@ bool WriteSymbolFile(const string &load_path,
bool WriteSymbolFileHeader(const string& load_path,
const string& obj_file,
const string& obj_os,
std::ostream &sym_stream) {
std::ostream& sym_stream) {
MmapWrapper map_wrapper;
void* elf_header = NULL;
if (!LoadELF(load_path, &map_wrapper, &elf_header)) {

View File

@@ -62,12 +62,12 @@ struct DumpOptions {
// If OBJ_FILE has been stripped but contains a .gnu_debuglink section,
// then look for the debug file in DEBUG_DIRS.
// SYMBOL_DATA allows limiting the type of symbol data written.
bool WriteSymbolFile(const string &load_path,
const string &obj_file,
const string &obj_os,
bool WriteSymbolFile(const string& load_path,
const string& obj_file,
const string& obj_os,
const std::vector<string>& debug_dirs,
const DumpOptions& options,
std::ostream &sym_stream);
std::ostream& sym_stream);
// Read the selected object file's debugging information, and write out the
// header only to |stream|. Return true on success; if an error occurs, report
@@ -76,7 +76,7 @@ bool WriteSymbolFile(const string &load_path,
bool WriteSymbolFileHeader(const string& load_path,
const string& obj_file,
const string& obj_os,
std::ostream &sym_stream);
std::ostream& sym_stream);
// As above, but simply return the debugging information in MODULE
// instead of writing it to a stream. The caller owns the resulting

View File

@@ -69,7 +69,7 @@ public:
// otherwise. Assume each symbol has a 'value' field whose size is
// VALUE_SIZE.
//
ELFSymbolIterator(const ByteBuffer *buffer, bool big_endian,
ELFSymbolIterator(const ByteBuffer* buffer, bool big_endian,
size_t value_size)
: value_size_(value_size), cursor_(buffer, big_endian) {
// Actually, weird sizes could be handled just fine, but they're
@@ -81,13 +81,13 @@ public:
// Move to the next symbol. This function's behavior is undefined if
// at_end() is true when it is called.
ELFSymbolIterator &operator++() { Fetch(); symbol_.index++; return *this; }
ELFSymbolIterator& operator++() { Fetch(); symbol_.index++; return *this; }
// Dereferencing this iterator produces a reference to an Symbol structure
// that holds the current symbol's values. The symbol is owned by this
// SymbolIterator, and will be invalidated at the next call to operator++.
const Symbol &operator*() const { return symbol_; }
const Symbol *operator->() const { return &symbol_; }
const Symbol& operator*() const { return symbol_; }
const Symbol* operator->() const { return &symbol_; }
private:
// Read the symbol at cursor_, and set symbol_ appropriately.
@@ -126,21 +126,21 @@ private:
Symbol symbol_;
};
const char *SymbolString(ptrdiff_t offset, ByteBuffer& strings) {
const char* SymbolString(ptrdiff_t offset, ByteBuffer& strings) {
if (offset < 0 || (size_t) offset >= strings.Size()) {
// Return the null string.
offset = 0;
}
return reinterpret_cast<const char *>(strings.start + offset);
return reinterpret_cast<const char*>(strings.start + offset);
}
bool ELFSymbolsToModule(const uint8_t *symtab_section,
bool ELFSymbolsToModule(const uint8_t* symtab_section,
size_t symtab_size,
const uint8_t *string_section,
const uint8_t* string_section,
size_t string_size,
const bool big_endian,
size_t value_size,
Module *module) {
Module* module) {
ByteBuffer symbols(symtab_section, symtab_size);
// Ensure that the string section is null-terminated.
if (string_section[string_size - 1] != '\0') {
@@ -156,7 +156,7 @@ bool ELFSymbolsToModule(const uint8_t *symtab_section,
while(!iterator->at_end) {
if (ELF32_ST_TYPE(iterator->info) == STT_FUNC &&
iterator->shndx != SHN_UNDEF) {
Module::Extern *ext = new Module::Extern(iterator->value);
Module::Extern* ext = new Module::Extern(iterator->value);
ext->name = SymbolString(iterator->name_offset, strings);
#if !defined(__ANDROID__) // Android NDK doesn't provide abi::__cxa_demangle.
int status = 0;

View File

@@ -44,13 +44,13 @@ namespace google_breakpad {
class Module;
bool ELFSymbolsToModule(const uint8_t *symtab_section,
bool ELFSymbolsToModule(const uint8_t* symtab_section,
size_t symtab_size,
const uint8_t *string_section,
const uint8_t* string_section,
size_t string_size,
const bool big_endian,
size_t value_size,
Module *module);
Module* module);
} // namespace google_breakpad

View File

@@ -86,7 +86,7 @@ public:
// 4 or 8 (bytes)
size_t value_size;
vector<Module::Extern *> externs;
vector<Module::Extern*> externs;
};
class ELFSymbolsToModuleTest32 : public ELFSymbolsToModuleTestFixture,

View File

@@ -40,11 +40,11 @@ namespace google_breakpad {
namespace {
template<typename ElfClass>
void FindElfClassSection(const char *elf_base,
const char *section_name,
void FindElfClassSection(const char* elf_base,
const char* section_name,
typename ElfClass::Word section_type,
const void **section_start,
size_t *section_size) {
const void** section_start,
size_t* section_size) {
typedef typename ElfClass::Ehdr Ehdr;
typedef typename ElfClass::Shdr Shdr;
@@ -62,7 +62,7 @@ void FindElfClassSection(const char *elf_base,
const Shdr* section_names = sections + elf_header->e_shstrndx;
const char* names =
GetOffset<ElfClass, char>(elf_header, section_names->sh_offset);
const char *names_end = names + section_names->sh_size;
const char* names_end = names + section_names->sh_size;
const Shdr* section =
FindElfSectionByName<ElfClass>(section_name, section_type,
@@ -76,9 +76,9 @@ void FindElfClassSection(const char *elf_base,
}
template<typename ElfClass>
void FindElfClassSegment(const char *elf_base,
void FindElfClassSegment(const char* elf_base,
typename ElfClass::Word segment_type,
wasteful_vector<ElfSegment> *segments) {
wasteful_vector<ElfSegment>* segments) {
typedef typename ElfClass::Ehdr Ehdr;
typedef typename ElfClass::Phdr Phdr;
@@ -117,11 +117,11 @@ int ElfClass(const void* elf_base) {
return elf_header->e_ident[EI_CLASS];
}
bool FindElfSection(const void *elf_mapped_base,
const char *section_name,
bool FindElfSection(const void* elf_mapped_base,
const char* section_name,
uint32_t section_type,
const void **section_start,
size_t *section_size) {
const void** section_start,
size_t* section_size) {
assert(elf_mapped_base);
assert(section_start);
assert(section_size);

View File

@@ -86,11 +86,11 @@ int ElfClass(const void* elf_base);
// in the ELF binary data at |elf_mapped_base|. On success, returns true
// and sets |*section_start| to point to the start of the section data,
// and |*section_size| to the size of the section's data.
bool FindElfSection(const void *elf_mapped_base,
const char *section_name,
bool FindElfSection(const void* elf_mapped_base,
const char* section_name,
uint32_t section_type,
const void **section_start,
size_t *section_size);
const void** section_start,
size_t* section_size);
// Internal helper method, exposed for convenience for callers
// that already have more info.

View File

@@ -61,7 +61,7 @@ FileID::FileID(const char* path) : path_(path) {}
// These functions are also used inside the crashed process, so be safe
// and use the syscall/libc wrappers instead of direct syscalls or libc.
static bool ElfClassBuildIDNoteIdentifier(const void *section, size_t length,
static bool ElfClassBuildIDNoteIdentifier(const void* section, size_t length,
wasteful_vector<uint8_t>& identifier) {
static_assert(sizeof(ElfClass32::Nhdr) == sizeof(ElfClass64::Nhdr),
"Elf32_Nhdr and Elf64_Nhdr should be the same");
@@ -69,7 +69,7 @@ static bool ElfClassBuildIDNoteIdentifier(const void *section, size_t length,
const void* section_end = reinterpret_cast<const char*>(section) + length;
const Nhdr* note_header = reinterpret_cast<const Nhdr*>(section);
while (reinterpret_cast<const void *>(note_header) < section_end) {
while (reinterpret_cast<const void*>(note_header) < section_end) {
if (note_header->n_type == NT_GNU_BUILD_ID)
break;
note_header = reinterpret_cast<const Nhdr*>(
@@ -77,7 +77,7 @@ static bool ElfClassBuildIDNoteIdentifier(const void *section, size_t length,
NOTE_PADDING(note_header->n_namesz) +
NOTE_PADDING(note_header->n_descsz));
}
if (reinterpret_cast<const void *>(note_header) >= section_end ||
if (reinterpret_cast<const void*>(note_header) >= section_end ||
note_header->n_descsz == 0) {
return false;
}

View File

@@ -261,7 +261,7 @@ TYPED_TEST(FileIDTest, BuildIDPH) {
elf.AddSection(".text", text, SHT_PROGBITS);
Notes notes(kLittleEndian);
notes.AddNote(0, "Linux",
reinterpret_cast<const uint8_t *>("\0x42\0x02\0\0"), 4);
reinterpret_cast<const uint8_t*>("\0x42\0x02\0\0"), 4);
notes.AddNote(NT_GNU_BUILD_ID, "GNU", kExpectedIdentifierBytes,
sizeof(kExpectedIdentifierBytes));
int note_idx = elf.AddSection(".note", notes, SHT_NOTE);
@@ -292,7 +292,7 @@ TYPED_TEST(FileIDTest, BuildIDMultiplePH) {
elf.AddSection(".text", text, SHT_PROGBITS);
Notes notes1(kLittleEndian);
notes1.AddNote(0, "Linux",
reinterpret_cast<const uint8_t *>("\0x42\0x02\0\0"), 4);
reinterpret_cast<const uint8_t*>("\0x42\0x02\0\0"), 4);
Notes notes2(kLittleEndian);
notes2.AddNote(NT_GNU_BUILD_ID, "GNU", kExpectedIdentifierBytes,
sizeof(kExpectedIdentifierBytes));

View File

@@ -105,7 +105,7 @@ class GUIDGenerator {
private:
#ifdef HAVE_ARC4RANDOM
static void CreateGuidFromArc4Random(GUID *guid) {
char *buf = reinterpret_cast<char *>(guid);
char *buf = reinterpret_cast<char*>(guid);
for (size_t i = 0; i < sizeof(GUID); i += sizeof(uint32_t)) {
uint32_t random_data = arc4random();
@@ -129,7 +129,7 @@ class GUIDGenerator {
#if defined(HAVE_SYS_RANDOM_H) && defined(HAVE_GETRANDOM)
static bool CreateGUIDFromGetrandom(GUID *guid) {
char *buf = reinterpret_cast<char *>(guid);
char *buf = reinterpret_cast<char*>(guid);
int read_bytes = getrandom(buf, sizeof(GUID), GRND_NONBLOCK);
return (read_bytes == static_cast<int>(sizeof(GUID)));
@@ -139,7 +139,7 @@ class GUIDGenerator {
// Populate the GUID using random bytes read from /dev/urandom, returns false
// if the GUID wasn't fully populated with random data.
static bool CreateGUIDFromDevUrandom(GUID *guid) {
char *buf = reinterpret_cast<char *>(guid);
char *buf = reinterpret_cast<char*>(guid);
int fd = open("/dev/urandom", O_RDONLY | O_CLOEXEC);
if (fd == -1) {
@@ -154,7 +154,7 @@ class GUIDGenerator {
// Populate the GUID using a stream of random bytes obtained from rand().
static void CreateGUIDFromRand(GUID *guid) {
char *buf = reinterpret_cast<char *>(guid);
char *buf = reinterpret_cast<char*>(guid);
InitOnce();

View File

@@ -36,14 +36,14 @@
namespace {
// Callback to get the response data from server.
static size_t WriteCallback(void *ptr, size_t size,
size_t nmemb, void *userp) {
static size_t WriteCallback(void* ptr, size_t size,
size_t nmemb, void* userp) {
if (!userp)
return 0;
string *response = reinterpret_cast<string *>(userp);
string* response = reinterpret_cast<string*>(userp);
size_t real_size = size * nmemb;
response->append(reinterpret_cast<char *>(ptr), real_size);
response->append(reinterpret_cast<char*>(ptr), real_size);
return real_size;
}
@@ -54,15 +54,15 @@ namespace google_breakpad {
static const char kUserAgent[] = "Breakpad/1.0 (Linux)";
// static
bool HTTPUpload::SendRequest(const string &url,
const map<string, string> &parameters,
const map<string, string> &files,
const string &proxy,
const string &proxy_user_pwd,
const string &ca_certificate_file,
string *response_body,
long *response_code,
string *error_description) {
bool HTTPUpload::SendRequest(const string& url,
const map<string, string>& parameters,
const map<string, string>& files,
const string& proxy,
const string& proxy_user_pwd,
const string& ca_certificate_file,
string* response_body,
long* response_code,
string* error_description) {
if (response_code != NULL)
*response_code = 0;
@@ -101,7 +101,7 @@ bool HTTPUpload::SendRequest(const string &url,
CURL* (*curl_easy_init)(void);
*(void**) (&curl_easy_init) = dlsym(curl_lib, "curl_easy_init");
CURL *curl = (*curl_easy_init)();
CURL* curl = (*curl_easy_init)();
if (error_description != NULL)
*error_description = "No Error";
@@ -111,7 +111,7 @@ bool HTTPUpload::SendRequest(const string &url,
}
CURLcode err_code = CURLE_OK;
CURLcode (*curl_easy_setopt)(CURL *, CURLoption, ...);
CURLcode (*curl_easy_setopt)(CURL*, CURLoption, ...);
*(void**) (&curl_easy_setopt) = dlsym(curl_lib, "curl_easy_setopt");
(*curl_easy_setopt)(curl, CURLOPT_URL, url.c_str());
(*curl_easy_setopt)(curl, CURLOPT_USERAGENT, kUserAgent);
@@ -128,10 +128,10 @@ bool HTTPUpload::SendRequest(const string &url,
if (!ca_certificate_file.empty())
(*curl_easy_setopt)(curl, CURLOPT_CAINFO, ca_certificate_file.c_str());
struct curl_httppost *formpost = NULL;
struct curl_httppost *lastptr = NULL;
struct curl_httppost* formpost = NULL;
struct curl_httppost* lastptr = NULL;
// Add form data.
CURLFORMcode (*curl_formadd)(struct curl_httppost **, struct curl_httppost **, ...);
CURLFORMcode (*curl_formadd)(struct curl_httppost**, struct curl_httppost**, ...);
*(void**) (&curl_formadd) = dlsym(curl_lib, "curl_formadd");
map<string, string>::const_iterator iter = parameters.begin();
for (; iter != parameters.end(); ++iter)
@@ -151,9 +151,9 @@ bool HTTPUpload::SendRequest(const string &url,
(*curl_easy_setopt)(curl, CURLOPT_HTTPPOST, formpost);
// Disable 100-continue header.
struct curl_slist *headerlist = NULL;
struct curl_slist* headerlist = NULL;
char buf[] = "Expect:";
struct curl_slist* (*curl_slist_append)(struct curl_slist *, const char *);
struct curl_slist* (*curl_slist_append)(struct curl_slist*, const char*);
*(void**) (&curl_slist_append) = dlsym(curl_lib, "curl_slist_append");
headerlist = (*curl_slist_append)(headerlist, buf);
(*curl_easy_setopt)(curl, CURLOPT_HTTPHEADER, headerlist);
@@ -161,17 +161,17 @@ bool HTTPUpload::SendRequest(const string &url,
if (response_body != NULL) {
(*curl_easy_setopt)(curl, CURLOPT_WRITEFUNCTION, WriteCallback);
(*curl_easy_setopt)(curl, CURLOPT_WRITEDATA,
reinterpret_cast<void *>(response_body));
reinterpret_cast<void*>(response_body));
}
// Fail if 400+ is returned from the web server.
(*curl_easy_setopt)(curl, CURLOPT_FAILONERROR, 1);
CURLcode (*curl_easy_perform)(CURL *);
CURLcode (*curl_easy_perform)(CURL*);
*(void**) (&curl_easy_perform) = dlsym(curl_lib, "curl_easy_perform");
err_code = (*curl_easy_perform)(curl);
if (response_code != NULL) {
CURLcode (*curl_easy_getinfo)(CURL *, CURLINFO, ...);
CURLcode (*curl_easy_getinfo)(CURL*, CURLINFO, ...);
*(void**) (&curl_easy_getinfo) = dlsym(curl_lib, "curl_easy_getinfo");
(*curl_easy_getinfo)(curl, CURLINFO_RESPONSE_CODE, response_code);
}
@@ -186,16 +186,16 @@ bool HTTPUpload::SendRequest(const string &url,
if (error_description != NULL)
*error_description = (*curl_easy_strerror)(err_code);
void (*curl_easy_cleanup)(CURL *);
void (*curl_easy_cleanup)(CURL*);
*(void**) (&curl_easy_cleanup) = dlsym(curl_lib, "curl_easy_cleanup");
(*curl_easy_cleanup)(curl);
if (formpost != NULL) {
void (*curl_formfree)(struct curl_httppost *);
void (*curl_formfree)(struct curl_httppost*);
*(void**) (&curl_formfree) = dlsym(curl_lib, "curl_formfree");
(*curl_formfree)(formpost);
}
if (headerlist != NULL) {
void (*curl_slist_free_all)(struct curl_slist *);
void (*curl_slist_free_all)(struct curl_slist*);
*(void**) (&curl_slist_free_all) = dlsym(curl_lib, "curl_slist_free_all");
(*curl_slist_free_all)(headerlist);
}
@@ -211,10 +211,10 @@ bool HTTPUpload::CheckCurlLib(void* curl_lib) {
}
// static
bool HTTPUpload::CheckParameters(const map<string, string> &parameters) {
bool HTTPUpload::CheckParameters(const map<string, string>& parameters) {
for (map<string, string>::const_iterator pos = parameters.begin();
pos != parameters.end(); ++pos) {
const string &str = pos->first;
const string& str = pos->first;
if (str.size() == 0)
return false; // disallow empty parameter names
for (unsigned int i = 0; i < str.size(); ++i) {

View File

@@ -58,21 +58,21 @@ class HTTPUpload {
// received (or 0 if the request failed before getting an HTTP response).
// If the send fails, a description of the error will be
// returned in error_description.
static bool SendRequest(const string &url,
const map<string, string> &parameters,
const map<string, string> &files,
const string &proxy,
const string &proxy_user_pwd,
const string &ca_certificate_file,
string *response_body,
long *response_code,
string *error_description);
static bool SendRequest(const string& url,
const map<string, string>& parameters,
const map<string, string>& files,
const string& proxy,
const string& proxy_user_pwd,
const string& ca_certificate_file,
string* response_body,
long* response_code,
string* error_description);
private:
// Checks that the given list of parameters has only printable
// ASCII characters in the parameter name, and does not contain
// any quote (") characters. Returns true if so.
static bool CheckParameters(const map<string, string> &parameters);
static bool CheckParameters(const map<string, string>& parameters);
// Checks the curl_lib parameter points to a valid curl lib.
static bool CheckCurlLib(void* curl_lib);
@@ -80,8 +80,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();
};

View File

@@ -88,14 +88,14 @@ bool LibcurlWrapper::AddFile(const string& upload_file_path,
}
// Callback to get the response data from server.
static size_t WriteCallback(void *ptr, size_t size,
size_t nmemb, void *userp) {
static size_t WriteCallback(void* ptr, size_t size,
size_t nmemb, void* userp) {
if (!userp)
return 0;
string *response = reinterpret_cast<string *>(userp);
string* response = reinterpret_cast<string*>(userp);
size_t real_size = size * nmemb;
response->append(reinterpret_cast<char *>(ptr), real_size);
response->append(reinterpret_cast<char*>(ptr), real_size);
return real_size;
}
@@ -250,7 +250,7 @@ bool LibcurlWrapper::SetFunctionPointers() {
SET_AND_CHECK_FUNCTION_POINTER(easy_getinfo_,
"curl_easy_getinfo",
CURLcode(*)(CURL *, CURLINFO info, ...));
CURLcode(*)(CURL*, CURLINFO info, ...));
SET_AND_CHECK_FUNCTION_POINTER(easy_reset_,
"curl_easy_reset",

View File

@@ -91,27 +91,27 @@ class LibcurlWrapper {
// dealing
// with CURL.
CURL *curl_; // Pointer for handle for CURL calls.
CURL* curl_; // Pointer for handle for CURL calls.
CURL* (*easy_init_)(void);
// Stateful pointers for calling into curl_formadd()
struct curl_httppost *formpost_;
struct curl_httppost *lastptr_;
struct curl_slist *headerlist_;
struct curl_httppost* formpost_;
struct curl_httppost* lastptr_;
struct curl_slist* headerlist_;
// Function pointers into CURL library
CURLcode (*easy_setopt_)(CURL *, CURLoption, ...);
CURLFORMcode (*formadd_)(struct curl_httppost **,
struct curl_httppost **, ...);
struct curl_slist* (*slist_append_)(struct curl_slist *, const char *);
void (*slist_free_all_)(struct curl_slist *);
CURLcode (*easy_perform_)(CURL *);
CURLcode (*easy_setopt_)(CURL*, CURLoption, ...);
CURLFORMcode (*formadd_)(struct curl_httppost**,
struct curl_httppost**, ...);
struct curl_slist* (*slist_append_)(struct curl_slist*, const char*);
void (*slist_free_all_)(struct curl_slist*);
CURLcode (*easy_perform_)(CURL*);
const char* (*easy_strerror_)(CURLcode);
void (*easy_cleanup_)(CURL *);
CURLcode (*easy_getinfo_)(CURL *, CURLINFO info, ...);
void (*easy_cleanup_)(CURL*);
CURLcode (*easy_getinfo_)(CURL*, CURLINFO info, ...);
void (*easy_reset_)(CURL*);
void (*formfree_)(struct curl_httppost *);
void (*formfree_)(struct curl_httppost*);
};
}

View File

@@ -190,7 +190,7 @@ const char* my_read_decimal_ptr(uintptr_t* result, const char* s) {
}
void my_memset(void* ip, char c, size_t len) {
char* p = (char *) ip;
char* p = (char*) ip;
while (len--)
*p++ = c;
}

View File

@@ -46,8 +46,8 @@
namespace google_breakpad {
namespace sym_upload {
void TokenizeByChar(const string &source_string, int c,
std::vector<string> *results) {
void TokenizeByChar(const string& source_string, int c,
std::vector<string>* results) {
assert(results);
string::size_type cur_pos = 0, next_pos = 0;
while ((next_pos = source_string.find(c, cur_pos)) != string::npos) {
@@ -62,8 +62,8 @@ void TokenizeByChar(const string &source_string, int c,
//=============================================================================
// Parse out the module line which have 5 parts.
// MODULE <os> <cpu> <uuid> <module-name>
bool ModuleDataForSymbolFile(const string &file,
std::vector<string> *module_parts) {
bool ModuleDataForSymbolFile(const string& file,
std::vector<string>* module_parts) {
assert(module_parts);
const size_t kModulePartNumber = 5;
FILE* fp = fopen(file.c_str(), "r");
@@ -90,7 +90,7 @@ bool ModuleDataForSymbolFile(const string &file,
}
//=============================================================================
string CompactIdentifier(const string &uuid) {
string CompactIdentifier(const string& uuid) {
std::vector<string> components;
TokenizeByChar(uuid, '-', &components);
string result;

View File

@@ -118,7 +118,7 @@ int ELF::AddSection(const string& name, const Section& section,
return index;
}
void ELF::AppendSection(ElfSection &section) {
void ELF::AppendSection(ElfSection& section) {
// NULL and NOBITS sections have no content, so they
// don't need to be written to the file.
if (section.type_ == SHT_NULL) {
@@ -242,7 +242,7 @@ void SymbolTable::AddSymbol(const string& name, uint64_t value,
D64(size);
}
void Notes::AddNote(int type, const string &name, const uint8_t* desc_bytes,
void Notes::AddNote(int type, const string& name, const uint8_t* desc_bytes,
size_t desc_size) {
// Elf32_Nhdr and Elf64_Nhdr are exactly the same.
Elf32_Nhdr note_header;

View File

@@ -154,7 +154,7 @@ class ELF : public Section {
vector<ElfSection> sections_;
void AppendSection(ElfSection &section);
void AppendSection(ElfSection& section);
};
// A class to build .symtab or .dynsym sections.
@@ -187,7 +187,7 @@ public:
}
// Add a note.
void AddNote(int type, const string &name, const uint8_t* desc_bytes,
void AddNote(int type, const string& name, const uint8_t* desc_bytes,
size_t desc_size);
};

View File

@@ -381,9 +381,9 @@ TEST_F(ElfNotesTest, Empty) {
TEST_F(ElfNotesTest, Notes) {
Notes notes(kLittleEndian);
notes.AddNote(1, "Linux", reinterpret_cast<const uint8_t *>("\x42\x02\0\0"),
notes.AddNote(1, "Linux", reinterpret_cast<const uint8_t*>("\x42\x02\0\0"),
4);
notes.AddNote(2, "a", reinterpret_cast<const uint8_t *>("foobar"),
notes.AddNote(2, "a", reinterpret_cast<const uint8_t*>("foobar"),
sizeof("foobar") - 1);
const uint8_t kExpectedNotesContents[] = {

View File

@@ -79,7 +79,7 @@ int tkill(pid_t tid, int sig) {
// Core file size limit set to 1 MB, which is big enough for test purposes.
const rlim_t kCoreSizeLimit = 1024 * 1024;
void *thread_function(void *data) {
void* thread_function(void* data) {
ThreadData* thread_data = reinterpret_cast<ThreadData*>(data);
volatile pid_t thread_id = gettid();
*(thread_data->thread_id_ptr) = thread_id;