aboutsummaryrefslogtreecommitdiff
path: root/src/common/linux
diff options
context:
space:
mode:
authorMike Frysinger <vapier@chromium.org>2020-06-23 18:55:43 -0400
committerMike Frysinger <vapier@chromium.org>2020-07-15 06:20:02 +0000
commit09b056975dacd1f0f815ad820b6dc9913b0118a3 (patch)
tree67ba67549b44e6d98b9ff2dfb3e0396e0a252b96 /src/common/linux
parentAdd support for dwarf5 line tables. (diff)
downloadbreakpad-09b056975dacd1f0f815ad820b6dc9913b0118a3.tar.xz
fix pointer style to match the style guide
We do this in a lot of places, but we're inconsistent. Normalize the code to the Google C++ style guide. Change-Id: Ic2aceab661ce8f6b993dda21b1cdf5d2198dcbbf Reviewed-on: https://chromium-review.googlesource.com/c/breakpad/breakpad/+/2262932 Reviewed-by: Sterling Augustine <saugustine@google.com> Reviewed-by: Mark Mentovai <mark@chromium.org>
Diffstat (limited to 'src/common/linux')
-rw-r--r--src/common/linux/breakpad_getcontext.S4
-rw-r--r--src/common/linux/dump_symbols.cc44
-rw-r--r--src/common/linux/dump_symbols.h10
-rw-r--r--src/common/linux/elf_symbols_to_module.cc20
-rw-r--r--src/common/linux/elf_symbols_to_module.h6
-rw-r--r--src/common/linux/elf_symbols_to_module_unittest.cc2
-rw-r--r--src/common/linux/elfutils.cc22
-rw-r--r--src/common/linux/elfutils.h8
-rw-r--r--src/common/linux/file_id.cc6
-rw-r--r--src/common/linux/file_id_unittest.cc4
-rw-r--r--src/common/linux/guid_creator.cc8
-rw-r--r--src/common/linux/http_upload.cc56
-rw-r--r--src/common/linux/http_upload.h24
-rw-r--r--src/common/linux/libcurl_wrapper.cc10
-rw-r--r--src/common/linux/libcurl_wrapper.h26
-rw-r--r--src/common/linux/linux_libc_support.cc2
-rw-r--r--src/common/linux/symbol_upload.cc10
-rw-r--r--src/common/linux/synth_elf.cc4
-rw-r--r--src/common/linux/synth_elf.h4
-rw-r--r--src/common/linux/synth_elf_unittest.cc4
-rw-r--r--src/common/linux/tests/crash_generator.cc2
21 files changed, 138 insertions, 138 deletions
diff --git a/src/common/linux/breakpad_getcontext.S b/src/common/linux/breakpad_getcontext.S
index fea0109d..528dba7a 100644
--- a/src/common/linux/breakpad_getcontext.S
+++ b/src/common/linux/breakpad_getcontext.S
@@ -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
diff --git a/src/common/linux/dump_symbols.cc b/src/common/linux/dump_symbols.cc
index 997977b8..8ecf0bc4 100644
--- a/src/common/linux/dump_symbols.cc
+++ b/src/common/linux/dump_symbols.cc
@@ -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)) {
diff --git a/src/common/linux/dump_symbols.h b/src/common/linux/dump_symbols.h
index eaddd8b2..b033ce00 100644
--- a/src/common/linux/dump_symbols.h
+++ b/src/common/linux/dump_symbols.h
@@ -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
diff --git a/src/common/linux/elf_symbols_to_module.cc b/src/common/linux/elf_symbols_to_module.cc
index 562875e1..81e985a7 100644
--- a/src/common/linux/elf_symbols_to_module.cc
+++ b/src/common/linux/elf_symbols_to_module.cc
@@ -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;
diff --git a/src/common/linux/elf_symbols_to_module.h b/src/common/linux/elf_symbols_to_module.h
index 2e7c0971..861f7252 100644
--- a/src/common/linux/elf_symbols_to_module.h
+++ b/src/common/linux/elf_symbols_to_module.h
@@ -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
diff --git a/src/common/linux/elf_symbols_to_module_unittest.cc b/src/common/linux/elf_symbols_to_module_unittest.cc
index 8984449a..3f665898 100644
--- a/src/common/linux/elf_symbols_to_module_unittest.cc
+++ b/src/common/linux/elf_symbols_to_module_unittest.cc
@@ -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,
diff --git a/src/common/linux/elfutils.cc b/src/common/linux/elfutils.cc
index 9532d5ad..ce9e9c1c 100644
--- a/src/common/linux/elfutils.cc
+++ b/src/common/linux/elfutils.cc
@@ -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);
diff --git a/src/common/linux/elfutils.h b/src/common/linux/elfutils.h
index aefb6cf5..ec5872a4 100644
--- a/src/common/linux/elfutils.h
+++ b/src/common/linux/elfutils.h
@@ -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.
diff --git a/src/common/linux/file_id.cc b/src/common/linux/file_id.cc
index 67921c45..9944af7a 100644
--- a/src/common/linux/file_id.cc
+++ b/src/common/linux/file_id.cc
@@ -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;
}
diff --git a/src/common/linux/file_id_unittest.cc b/src/common/linux/file_id_unittest.cc
index f4f9ac45..477783d9 100644
--- a/src/common/linux/file_id_unittest.cc
+++ b/src/common/linux/file_id_unittest.cc
@@ -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));
diff --git a/src/common/linux/guid_creator.cc b/src/common/linux/guid_creator.cc
index 03e3d781..63740638 100644
--- a/src/common/linux/guid_creator.cc
+++ b/src/common/linux/guid_creator.cc
@@ -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();
diff --git a/src/common/linux/http_upload.cc b/src/common/linux/http_upload.cc
index 702526af..ace12b84 100644
--- a/src/common/linux/http_upload.cc
+++ b/src/common/linux/http_upload.cc
@@ -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) {
diff --git a/src/common/linux/http_upload.h b/src/common/linux/http_upload.h
index bc1d5d57..13f3d56c 100644
--- a/src/common/linux/http_upload.h
+++ b/src/common/linux/http_upload.h
@@ -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();
};
diff --git a/src/common/linux/libcurl_wrapper.cc b/src/common/linux/libcurl_wrapper.cc
index e96c2038..fdb200f8 100644
--- a/src/common/linux/libcurl_wrapper.cc
+++ b/src/common/linux/libcurl_wrapper.cc
@@ -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",
diff --git a/src/common/linux/libcurl_wrapper.h b/src/common/linux/libcurl_wrapper.h
index 77aa6cbb..823f83c7 100644
--- a/src/common/linux/libcurl_wrapper.h
+++ b/src/common/linux/libcurl_wrapper.h
@@ -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*);
};
}
diff --git a/src/common/linux/linux_libc_support.cc b/src/common/linux/linux_libc_support.cc
index 08b0325e..dd292962 100644
--- a/src/common/linux/linux_libc_support.cc
+++ b/src/common/linux/linux_libc_support.cc
@@ -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;
}
diff --git a/src/common/linux/symbol_upload.cc b/src/common/linux/symbol_upload.cc
index 87741a0a..1d5ff719 100644
--- a/src/common/linux/symbol_upload.cc
+++ b/src/common/linux/symbol_upload.cc
@@ -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;
diff --git a/src/common/linux/synth_elf.cc b/src/common/linux/synth_elf.cc
index 98e81dab..2ba25e61 100644
--- a/src/common/linux/synth_elf.cc
+++ b/src/common/linux/synth_elf.cc
@@ -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;
diff --git a/src/common/linux/synth_elf.h b/src/common/linux/synth_elf.h
index 1d2a20ca..90fa28c0 100644
--- a/src/common/linux/synth_elf.h
+++ b/src/common/linux/synth_elf.h
@@ -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);
};
diff --git a/src/common/linux/synth_elf_unittest.cc b/src/common/linux/synth_elf_unittest.cc
index cd74c286..fb3601e6 100644
--- a/src/common/linux/synth_elf_unittest.cc
+++ b/src/common/linux/synth_elf_unittest.cc
@@ -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[] = {
diff --git a/src/common/linux/tests/crash_generator.cc b/src/common/linux/tests/crash_generator.cc
index 6896a688..a70df28a 100644
--- a/src/common/linux/tests/crash_generator.cc
+++ b/src/common/linux/tests/crash_generator.cc
@@ -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;