Fix compilation of file_id_unittest.

Review URL: http://breakpad.appspot.com/198001

git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@689 4c0a9323-5329-0410-9bdc-e9ce6186880e
This commit is contained in:
thestig@chromium.org 2010-09-16 22:37:24 +00:00
parent df9901a45d
commit 1fa7c1c4c4

View file

@ -1,4 +1,4 @@
// Copyright (c) 2009, Google Inc. // Copyright (c) 2010, Google Inc.
// All rights reserved. // All rights reserved.
// //
// Redistribution and use in source and binary forms, with or without // Redistribution and use in source and binary forms, with or without
@ -37,7 +37,6 @@
using namespace google_breakpad; using namespace google_breakpad;
namespace { namespace {
typedef testing::Test FileIDTest; typedef testing::Test FileIDTest;
} }
@ -90,13 +89,14 @@ struct ElfClass64 {
template<typename ElfClass> template<typename ElfClass>
struct ElfishElf { struct ElfishElf {
static const size_t kTextSectionSize = 128;
typedef typename ElfClass::Ehdr Ehdr; typedef typename ElfClass::Ehdr Ehdr;
typedef typename ElfClass::Shdr Shdr; typedef typename ElfClass::Shdr Shdr;
Ehdr elf_header; Ehdr elf_header;
Shdr text_header; Shdr text_header;
Shdr string_header; Shdr string_header;
char text_section[128]; char text_section[kTextSectionSize];
char string_section[8]; char string_section[8];
static void Populate(ElfishElf* elf) { static void Populate(ElfishElf* elf) {
@ -109,8 +109,8 @@ struct ElfishElf {
elf->text_header.sh_name = 0; elf->text_header.sh_name = 0;
elf->text_header.sh_type = SHT_PROGBITS; elf->text_header.sh_type = SHT_PROGBITS;
elf->text_header.sh_offset = offsetof(ElfishElf, text_section); elf->text_header.sh_offset = offsetof(ElfishElf, text_section);
elf->text_header.sh_size = sizeof(text_section); elf->text_header.sh_size = kTextSectionSize;
for (size_t i = 0; i < sizeof(text_section); ++i) { for (size_t i = 0; i < kTextSectionSize; ++i) {
elf->text_section[i] = i * 3; elf->text_section[i] = i * 3;
} }
elf->string_header.sh_offset = offsetof(ElfishElf, string_section); elf->string_header.sh_offset = offsetof(ElfishElf, string_section);