Fix build failures.

- Fix a test build failure introduced by cc7abac08b.
- Use strcmp from <string> instead of std::strcmp from <cstring>.

Bug: google-breakpad:867
Change-Id: I8dcbc7d5ac8ea799b4d5287ddbbf5d6626992123
Reviewed-on: https://chromium-review.googlesource.com/c/breakpad/breakpad/+/4095054
Reviewed-by: Mike Frysinger <vapier@chromium.org>
This commit is contained in:
Zequan Wu 2022-12-12 17:22:04 +08:00 committed by Mike Frysinger
parent cc7abac08b
commit 9acaa082c8
2 changed files with 7 additions and 7 deletions

View File

@ -183,7 +183,7 @@ class Elf64 {
template<class ElfArch>
class ElfSectionReader {
public:
ElfSectionReader(const char* name, const string& path, int fd,
ElfSectionReader(const char* cname, const string& path, int fd,
const typename ElfArch::Shdr& section_header)
: contents_aligned_(NULL),
contents_(NULL),
@ -198,8 +198,8 @@ class ElfSectionReader {
if (header_.sh_type == SHT_NOBITS || header_.sh_size == 0)
return;
// extra sh_type check for string table.
if ((std::strcmp(name, ".strtab") == 0 ||
std::strcmp(name, ".shstrtab") == 0) &&
std::string_view name{cname};
if ((name == ".strtab" || name == ".shstrtab") &&
header_.sh_type != SHT_STRTAB) {
fprintf(stderr,
"Invalid sh_type for string table section: expected "
@ -215,7 +215,7 @@ class ElfSectionReader {
(header_.sh_offset - offset_aligned);
// Check for and handle any compressed contents.
//if (strncmp(name, ".zdebug_", strlen(".zdebug_")) == 0)
//if (name == ".zdebug_")
// DecompressZlibContents();
// TODO(saugustine): Add support for proposed elf-section flag
// "SHF_COMPRESS".

View File

@ -91,7 +91,7 @@ TYPED_TEST(DumpSymbols, Invalid) {
Elf32_Ehdr header;
memset(&header, 0, sizeof(header));
Module* module;
DumpOptions options(ALL_SYMBOL_DATA, true);
DumpOptions options(ALL_SYMBOL_DATA, true, false);
EXPECT_FALSE(ReadSymbolDataInternal(reinterpret_cast<uint8_t*>(&header),
"foo",
"Linux",
@ -128,7 +128,7 @@ TYPED_TEST(DumpSymbols, SimplePublic) {
this->GetElfContents(elf);
Module* module;
DumpOptions options(ALL_SYMBOL_DATA, true);
DumpOptions options(ALL_SYMBOL_DATA, true, false);
EXPECT_TRUE(ReadSymbolDataInternal(this->elfdata,
"foo",
"Linux",
@ -185,7 +185,7 @@ TYPED_TEST(DumpSymbols, SimpleBuildID) {
this->GetElfContents(elf);
Module* module;
DumpOptions options(ALL_SYMBOL_DATA, true);
DumpOptions options(ALL_SYMBOL_DATA, true, false);
EXPECT_TRUE(ReadSymbolDataInternal(this->elfdata,
"foo",
"Linux",