aboutsummaryrefslogtreecommitdiff
path: root/src/common/solaris/file_id.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/common/solaris/file_id.cc')
-rw-r--r--src/common/solaris/file_id.cc36
1 files changed, 18 insertions, 18 deletions
diff --git a/src/common/solaris/file_id.cc b/src/common/solaris/file_id.cc
index 643a1462..c32c73bb 100644
--- a/src/common/solaris/file_id.cc
+++ b/src/common/solaris/file_id.cc
@@ -54,17 +54,17 @@ namespace google_breakpad {
class AutoElfEnder {
public:
- AutoElfEnder(Elf *elf) : elf_(elf) {}
+ AutoElfEnder(Elf* elf) : elf_(elf) {}
~AutoElfEnder() { if (elf_) elf_end(elf_); }
private:
- Elf *elf_;
+ Elf* elf_;
};
// Find the text section in elf object file.
// Return the section start address and the size.
-static bool FindElfTextSection(int fd, const void *elf_base,
- const void **text_start,
- int *text_size) {
+static bool FindElfTextSection(int fd, const void* elf_base,
+ const void** text_start,
+ int* text_size) {
assert(text_start);
assert(text_size);
@@ -78,10 +78,10 @@ static bool FindElfTextSection(int fd, const void *elf_base,
GElf_Ehdr elf_header;
lseek(fd, 0L, 0);
- Elf *elf = elf_begin(fd, ELF_C_READ, NULL);
+ Elf* elf = elf_begin(fd, ELF_C_READ, NULL);
AutoElfEnder elfEnder(elf);
- if (gelf_getehdr(elf, &elf_header) == (GElf_Ehdr *)NULL) {
+ if (gelf_getehdr(elf, &elf_header) == (GElf_Ehdr*)NULL) {
print_message2(2, "failed to read elf header: %s\n", elf_errmsg(-1));
return false;
}
@@ -95,18 +95,18 @@ static bool FindElfTextSection(int fd, const void *elf_base,
}
static const char kTextSectionName[] = ".text";
- const GElf_Shdr *text_section = NULL;
- Elf_Scn *scn = NULL;
+ const GElf_Shdr* text_section = NULL;
+ Elf_Scn* scn = NULL;
GElf_Shdr shdr;
while ((scn = elf_nextscn(elf, scn)) != NULL) {
- if (gelf_getshdr(scn, &shdr) == (GElf_Shdr *)0) {
+ if (gelf_getshdr(scn, &shdr) == (GElf_Shdr*)0) {
print_message2(2, "failed to read section header: %s\n", elf_errmsg(0));
return false;
}
if (shdr.sh_type == SHT_PROGBITS) {
- const char *section_name = elf_strptr(elf, elf_header.e_shstrndx,
+ const char* section_name = elf_strptr(elf, elf_header.e_shstrndx,
shdr.sh_name);
if (!section_name) {
print_message2(2, "Section name error: %s\n", elf_errmsg(-1));
@@ -120,7 +120,7 @@ static bool FindElfTextSection(int fd, const void *elf_base,
}
}
if (text_section != NULL && text_section->sh_size > 0) {
- *text_start = (char *)elf_base + text_section->sh_offset;
+ *text_start = (char*)elf_base + text_section->sh_offset;
*text_size = text_section->sh_size;
return true;
}
@@ -128,7 +128,7 @@ static bool FindElfTextSection(int fd, const void *elf_base,
return false;
}
-FileID::FileID(const char *path) {
+FileID::FileID(const char* path) {
strcpy(path_, path);
}
@@ -150,29 +150,29 @@ bool FileID::ElfFileIdentifier(unsigned char identifier[16]) {
if (fstat(fd, &st) != 0 || st.st_size <= 0)
return false;
- void *base = mmap(NULL, st.st_size, PROT_READ, MAP_PRIVATE, fd, 0);
+ void* base = mmap(NULL, st.st_size, PROT_READ, MAP_PRIVATE, fd, 0);
if (base == MAP_FAILED)
return false;
bool success = false;
- const void *text_section = NULL;
+ const void* text_section = NULL;
int text_size = 0;
if (FindElfTextSection(fd, base, &text_section, &text_size)) {
MD5Context md5;
MD5Init(&md5);
- MD5Update(&md5, (const unsigned char *)text_section, text_size);
+ MD5Update(&md5, (const unsigned char*)text_section, text_size);
MD5Final(identifier, &md5);
success = true;
}
- munmap((char *)base, st.st_size);
+ munmap((char*)base, st.st_size);
return success;
}
// static
bool FileID::ConvertIdentifierToString(const unsigned char identifier[16],
- char *buffer, int buffer_length) {
+ char* buffer, int buffer_length) {
if (buffer_length < 34)
return false;