Cleaning up google-breakpad source code of signed-unsigned comparison warnings

http://breakpad.appspot.com/488002/



git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@1083 4c0a9323-5329-0410-9bdc-e9ce6186880e
This commit is contained in:
ivan.penkov@gmail.com 2012-11-21 01:33:08 +00:00
parent d80f175c1a
commit c937b0ee01
30 changed files with 188 additions and 182 deletions

View file

@ -50,7 +50,8 @@ AM_CXXFLAGS += \
-Werror=vla \
-Werror=unused-variable \
-Werror=missing-braces \
-Werror=overloaded-virtual
-Werror=overloaded-virtual \
-Werror=sign-compare
endif
if LINUX_HOST

View file

@ -80,7 +80,8 @@ host_triplet = @host@
@GCC_TRUE@ -Werror=vla \
@GCC_TRUE@ -Werror=unused-variable \
@GCC_TRUE@ -Werror=missing-braces \
@GCC_TRUE@ -Werror=overloaded-virtual
@GCC_TRUE@ -Werror=overloaded-virtual \
@GCC_TRUE@ -Werror=sign-compare
# Build as PIC on Linux, for linux_client_unittest_shlib
@ -148,7 +149,7 @@ check_PROGRAMS = $(am__EXEEXT_4) $(am__EXEEXT_5) $(am__EXEEXT_6) \
@ANDROID_HOST_TRUE@@LINUX_HOST_TRUE@am__append_16 = src/common/android/breakpad_getcontext.S \
@ANDROID_HOST_TRUE@@LINUX_HOST_TRUE@ src/common/android/breakpad_getcontext_unittest.cc
@ANDROID_HOST_TRUE@@LINUX_HOST_TRUE@am__append_17 = \
@ANDROID_HOST_TRUE@@LINUX_HOST_TRUE@ -llog
@ANDROID_HOST_TRUE@@LINUX_HOST_TRUE@ -llog -lm
@ANDROID_HOST_TRUE@@LINUX_HOST_TRUE@am__append_18 = \
@ANDROID_HOST_TRUE@@LINUX_HOST_TRUE@ -llog

View file

@ -240,7 +240,7 @@ bool ExceptionHandler::InstallHandlersLocked() {
return false;
// Fail if unable to store all the old handlers.
for (unsigned i = 0; i < kNumHandledSignals; ++i) {
for (int i = 0; i < kNumHandledSignals; ++i) {
if (sigaction(kExceptionSignals[i], NULL, &old_handlers[i]) == -1)
return false;
}
@ -250,13 +250,13 @@ bool ExceptionHandler::InstallHandlersLocked() {
sigemptyset(&sa.sa_mask);
// Mask all exception signals when we're handling one of them.
for (unsigned i = 0; i < kNumHandledSignals; ++i)
for (int i = 0; i < kNumHandledSignals; ++i)
sigaddset(&sa.sa_mask, kExceptionSignals[i]);
sa.sa_sigaction = SignalHandler;
sa.sa_flags = SA_ONSTACK | SA_SIGINFO;
for (unsigned i = 0; i < kNumHandledSignals; ++i) {
for (int i = 0; i < kNumHandledSignals; ++i) {
if (sigaction(kExceptionSignals[i], &sa, NULL) == -1) {
// At this point it is impractical to back out changes, and so failure to
// install a signal is intentionally ignored.
@ -273,7 +273,7 @@ void ExceptionHandler::RestoreHandlersLocked() {
if (!handlers_installed)
return;
for (unsigned i = 0; i < kNumHandledSignals; ++i) {
for (int i = 0; i < kNumHandledSignals; ++i) {
if (sigaction(kExceptionSignals[i], &old_handlers[i], NULL) == -1) {
signal(kExceptionSignals[i], SIG_DFL);
}

View file

@ -108,9 +108,9 @@ void ReadMinidumpPathFromPipe(int fd, string* path) {
ASSERT_EQ(1, r);
ASSERT_TRUE(pfd.revents & POLLIN);
uint32_t len;
int32_t len;
ASSERT_EQ(static_cast<ssize_t>(sizeof(len)), read(fd, &len, sizeof(len)));
ASSERT_LT(len, static_cast<uint32_t>(2048));
ASSERT_LT(len, 2048);
char* filename = static_cast<char*>(malloc(len + 1));
ASSERT_EQ(len, read(fd, filename, len));
filename[len] = 0;
@ -194,7 +194,7 @@ void ChildCrash(bool use_fd) {
struct stat st;
ASSERT_EQ(0, stat(minidump_path.c_str(), &st));
ASSERT_GT(st.st_size, 0u);
ASSERT_GT(st.st_size, 0);
unlink(minidump_path.c_str());
}
@ -465,7 +465,7 @@ TEST(ExceptionHandlerTest, InstructionPointerMemory) {
struct stat st;
ASSERT_EQ(0, stat(minidump_path.c_str(), &st));
ASSERT_GT(st.st_size, 0u);
ASSERT_GT(st.st_size, 0);
// Read the minidump. Locate the exception record and the
// memory list, and then ensure that there is a memory region
@ -478,7 +478,7 @@ TEST(ExceptionHandlerTest, InstructionPointerMemory) {
MinidumpMemoryList* memory_list = minidump.GetMemoryList();
ASSERT_TRUE(exception);
ASSERT_TRUE(memory_list);
ASSERT_LT(0, memory_list->region_count());
ASSERT_LT(0U, memory_list->region_count());
MinidumpContext* context = exception->GetContext();
ASSERT_TRUE(context);
@ -557,7 +557,7 @@ TEST(ExceptionHandlerTest, InstructionPointerMemoryMinBound) {
struct stat st;
ASSERT_EQ(0, stat(minidump_path.c_str(), &st));
ASSERT_GT(st.st_size, 0u);
ASSERT_GT(st.st_size, 0);
// Read the minidump. Locate the exception record and the
// memory list, and then ensure that there is a memory region
@ -570,7 +570,7 @@ TEST(ExceptionHandlerTest, InstructionPointerMemoryMinBound) {
MinidumpMemoryList* memory_list = minidump.GetMemoryList();
ASSERT_TRUE(exception);
ASSERT_TRUE(memory_list);
ASSERT_LT(0, memory_list->region_count());
ASSERT_LT(0U, memory_list->region_count());
MinidumpContext* context = exception->GetContext();
ASSERT_TRUE(context);
@ -648,7 +648,7 @@ TEST(ExceptionHandlerTest, InstructionPointerMemoryMaxBound) {
struct stat st;
ASSERT_EQ(0, stat(minidump_path.c_str(), &st));
ASSERT_GT(st.st_size, 0u);
ASSERT_GT(st.st_size, 0);
// Read the minidump. Locate the exception record and the memory list, and
// then ensure that there is a memory region in the memory list that covers
@ -660,7 +660,7 @@ TEST(ExceptionHandlerTest, InstructionPointerMemoryMaxBound) {
MinidumpMemoryList* memory_list = minidump.GetMemoryList();
ASSERT_TRUE(exception);
ASSERT_TRUE(memory_list);
ASSERT_LT(0, memory_list->region_count());
ASSERT_LT(0U, memory_list->region_count());
MinidumpContext* context = exception->GetContext();
ASSERT_TRUE(context);
@ -719,7 +719,7 @@ TEST(ExceptionHandlerTest, InstructionPointerMemoryNullPointer) {
struct stat st;
ASSERT_EQ(0, stat(minidump_path.c_str(), &st));
ASSERT_GT(st.st_size, 0u);
ASSERT_GT(st.st_size, 0);
// Read the minidump. Locate the exception record and the
// memory list, and then ensure that there is a memory region
@ -887,7 +887,7 @@ TEST(ExceptionHandlerTest, ExternalDumper) {
msg.msg_controllen = kControlMsgSize;
const ssize_t n = HANDLE_EINTR(recvmsg(fds[0], &msg, 0));
ASSERT_EQ(kCrashContextSize, n);
ASSERT_EQ(static_cast<ssize_t>(kCrashContextSize), n);
ASSERT_EQ(kControlMsgSize, msg.msg_controllen);
ASSERT_EQ(0, msg.msg_flags);
ASSERT_EQ(0, close(fds[0]));
@ -918,14 +918,14 @@ TEST(ExceptionHandlerTest, ExternalDumper) {
ASSERT_TRUE(WriteMinidump(templ.c_str(), crashing_pid, context,
kCrashContextSize));
static const char b = 0;
ASSERT_EQ(1U, (HANDLE_EINTR(write(signal_fd, &b, 1))));
ASSERT_EQ(1, (HANDLE_EINTR(write(signal_fd, &b, 1))));
ASSERT_EQ(0, close(signal_fd));
ASSERT_NO_FATAL_FAILURE(WaitForProcessToTerminate(child, SIGSEGV));
struct stat st;
ASSERT_EQ(0, stat(templ.c_str(), &st));
ASSERT_GT(st.st_size, 0U);
ASSERT_GT(st.st_size, 0);
unlink(templ.c_str());
}
@ -974,7 +974,7 @@ TEST(ExceptionHandlerTest, GenerateMultipleDumpsWithPath) {
const MinidumpDescriptor& minidump_1 = handler.minidump_descriptor();
struct stat st;
ASSERT_EQ(0, stat(minidump_1.path(), &st));
ASSERT_GT(st.st_size, 0U);
ASSERT_GT(st.st_size, 0);
string minidump_1_path(minidump_1.path());
// Check it is a valid minidump.
Minidump minidump1(minidump_1_path);
@ -985,7 +985,7 @@ TEST(ExceptionHandlerTest, GenerateMultipleDumpsWithPath) {
ASSERT_TRUE(handler.WriteMinidump());
const MinidumpDescriptor& minidump_2 = handler.minidump_descriptor();
ASSERT_EQ(0, stat(minidump_2.path(), &st));
ASSERT_GT(st.st_size, 0U);
ASSERT_GT(st.st_size, 0);
string minidump_2_path(minidump_2.path());
// Check it is a valid minidump.
Minidump minidump2(minidump_2_path);
@ -1111,7 +1111,7 @@ TEST(ExceptionHandlerTest, WriteMinidumpForChild) {
ASSERT_TRUE(exception);
u_int32_t thread_id;
ASSERT_TRUE(exception->GetThreadID(&thread_id));
EXPECT_EQ(child, thread_id);
EXPECT_EQ(child, static_cast<int32_t>(thread_id));
const MDRawExceptionStream* raw = exception->exception();
ASSERT_TRUE(raw);

View file

@ -166,7 +166,7 @@ TEST(LineReaderTest, MaxLength) {
char l[LineReader::kMaxLineLen - 1];
memset(l, 'a', sizeof(l));
const int r = HANDLE_EINTR(write(fd, l, sizeof(l)));
ASSERT_EQ(sizeof(l), r);
ASSERT_EQ(static_cast<ssize_t>(sizeof(l)), r);
lseek(fd, 0, SEEK_SET);
LineReader reader(fd);
@ -185,7 +185,7 @@ TEST(LineReaderTest, TooLong) {
char l[LineReader::kMaxLineLen];
memset(l, 'a', sizeof(l));
const int r = HANDLE_EINTR(write(fd, l, sizeof(l)));
ASSERT_EQ(sizeof(l), r);
ASSERT_EQ(static_cast<ssize_t>(sizeof(l)), r);
lseek(fd, 0, SEEK_SET);
LineReader reader(fd);

View file

@ -96,7 +96,7 @@ TEST(LinuxCoreDumperTest, VerifyDumpWithMultipleThreads) {
// LinuxCoreDumper cannot determine the crash address and thus it always
// sets the crash address to 0.
EXPECT_EQ(0, dumper.crash_address());
EXPECT_EQ(0U, dumper.crash_address());
EXPECT_EQ(kCrashSignal, dumper.crash_signal());
EXPECT_EQ(crash_generator.GetThreadId(kCrashThread),
dumper.crash_thread());

View file

@ -160,7 +160,7 @@ TEST(LinuxPtraceDumperTest, MergedMappings) {
// range.
EXPECT_EQ(kMappingAddress, mapping.start_addr);
EXPECT_EQ(kMappingSize, mapping.size);
EXPECT_EQ(0, mapping.offset);
EXPECT_EQ(0U, mapping.offset);
mapping_count++;
}
}
@ -212,7 +212,8 @@ TEST(LinuxPtraceDumperTest, VerifyStackReadWithMultipleThreads) {
ASSERT_EQ(1, r);
ASSERT_TRUE(pfd.revents & POLLIN);
uint8_t junk;
ASSERT_EQ(read(fds[0], &junk, sizeof(junk)), sizeof(junk));
ASSERT_EQ(read(fds[0], &junk, sizeof(junk)),
static_cast<ssize_t>(sizeof(junk)));
}
close(fds[0]);

View file

@ -653,8 +653,10 @@ class MinidumpWriter {
size_t stack_len;
if (dumper_->GetStackInfo(&stack, &stack_len, stack_pointer)) {
UntypedMDRVA memory(&minidump_writer_);
if (max_stack_len >= 0 && stack_len > max_stack_len)
if (max_stack_len >= 0 &&
stack_len > static_cast<unsigned int>(max_stack_len)) {
stack_len = max_stack_len;
}
if (!memory.Allocate(stack_len))
return false;
*stack_copy = reinterpret_cast<uint8_t*>(Alloc(stack_len));

View file

@ -88,7 +88,7 @@ TEST(MinidumpWriterTest, SetupWithPath) {
ASSERT_TRUE(WriteMinidump(templ.c_str(), child, &context, sizeof(context)));
struct stat st;
ASSERT_EQ(0, stat(templ.c_str(), &st));
ASSERT_GT(st.st_size, 0u);
ASSERT_GT(st.st_size, 0);
close(fds[1]);
}
@ -118,7 +118,7 @@ TEST(MinidumpWriterTest, SetupWithFD) {
ASSERT_TRUE(WriteMinidump(fd, child, &context, sizeof(context)));
struct stat st;
ASSERT_EQ(0, stat(templ.c_str(), &st));
ASSERT_GT(st.st_size, 0u);
ASSERT_GT(st.st_size, 0);
close(fds[1]);
}
@ -239,7 +239,7 @@ TEST(MinidumpWriterTest, MappingInfoContained) {
// These are defined here so the parent can use them to check the
// data from the minidump afterwards.
const u_int32_t memory_size = sysconf(_SC_PAGESIZE);
const int32_t memory_size = sysconf(_SC_PAGESIZE);
const char* kMemoryName = "a fake module";
const u_int8_t kModuleGUID[sizeof(MDGUID)] = {
0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77,
@ -379,7 +379,7 @@ TEST(MinidumpWriterTest, DeletedBinary) {
ASSERT_TRUE(pfd.revents & POLLIN);
uint8_t junk;
const int nr = HANDLE_EINTR(read(fds[0], &junk, sizeof(junk)));
ASSERT_EQ(sizeof(junk), nr);
ASSERT_EQ(static_cast<ssize_t>(sizeof(junk)), nr);
close(fds[0]);
// Child is ready now.
@ -398,7 +398,7 @@ TEST(MinidumpWriterTest, DeletedBinary) {
struct stat st;
ASSERT_EQ(0, stat(templ.c_str(), &st));
ASSERT_GT(st.st_size, 0u);
ASSERT_GT(st.st_size, 0);
Minidump minidump(templ.c_str());
ASSERT_TRUE(minidump.Read());
@ -623,7 +623,8 @@ TEST(MinidumpWriterTest, MinidumpSizeLimit) {
ASSERT_EQ(1, r);
ASSERT_TRUE(pfd.revents & POLLIN);
uint8_t junk;
ASSERT_EQ(read(fds[0], &junk, sizeof(junk)), sizeof(junk));
ASSERT_EQ(read(fds[0], &junk, sizeof(junk)),
static_cast<ssize_t>(sizeof(junk)));
}
close(fds[0]);
@ -648,14 +649,14 @@ TEST(MinidumpWriterTest, MinidumpSizeLimit) {
MappingList(), AppMemoryList()));
struct stat st;
ASSERT_EQ(0, stat(normal_dump.c_str(), &st));
ASSERT_GT(st.st_size, 0u);
ASSERT_GT(st.st_size, 0);
normal_file_size = st.st_size;
Minidump minidump(normal_dump.c_str());
ASSERT_TRUE(minidump.Read());
MinidumpThreadList* dump_thread_list = minidump.GetThreadList();
ASSERT_TRUE(dump_thread_list);
for (int i = 0; i < dump_thread_list->thread_count(); i++) {
for (unsigned int i = 0; i < dump_thread_list->thread_count(); i++) {
MinidumpThread* thread = dump_thread_list->GetThreadAtIndex(i);
ASSERT_TRUE(thread->thread() != NULL);
// When the stack size is zero bytes, GetMemory() returns NULL.
@ -699,7 +700,7 @@ TEST(MinidumpWriterTest, MinidumpSizeLimit) {
MappingList(), AppMemoryList()));
struct stat st;
ASSERT_EQ(0, stat(limit_dump.c_str(), &st));
ASSERT_GT(st.st_size, 0u);
ASSERT_GT(st.st_size, 0);
// Make sure the file size is at least smaller than the original.
EXPECT_LT(st.st_size, normal_file_size);
@ -708,7 +709,7 @@ TEST(MinidumpWriterTest, MinidumpSizeLimit) {
MinidumpThreadList* dump_thread_list = minidump.GetThreadList();
ASSERT_TRUE(dump_thread_list);
int total_limit_stack_size = 0;
for (int i = 0; i < dump_thread_list->thread_count(); i++) {
for (unsigned int i = 0; i < dump_thread_list->thread_count(); i++) {
MinidumpThread* thread = dump_thread_list->GetThreadAtIndex(i);
ASSERT_TRUE(thread->thread() != NULL);
// When the stack size is zero bytes, GetMemory() returns NULL.

View file

@ -67,7 +67,7 @@ class DumpSymbols : public Test {
void GetElfContents(ELF& elf) {
string contents;
ASSERT_TRUE(elf.GetContents(&contents));
ASSERT_LT(0, contents.size());
ASSERT_LT(0U, contents.size());
elfdata_v.clear();
elfdata_v.insert(elfdata_v.begin(), contents.begin(), contents.end());

View file

@ -53,7 +53,7 @@ TEST(ElfCoreDumpTest, DefaultConstructor) {
ElfCoreDump core;
EXPECT_FALSE(core.IsValid());
EXPECT_EQ(NULL, core.GetHeader());
EXPECT_EQ(0, core.GetProgramHeaderCount());
EXPECT_EQ(0U, core.GetProgramHeaderCount());
EXPECT_EQ(NULL, core.GetProgramHeader(0));
EXPECT_EQ(NULL, core.GetFirstProgramHeaderOfType(PT_LOAD));
EXPECT_FALSE(core.GetFirstNote().IsValid());
@ -74,7 +74,7 @@ TEST(ElfCoreDumpTest, TestElfHeader) {
core.SetContent(mapped_core_file.content());
EXPECT_FALSE(core.IsValid());
EXPECT_EQ(NULL, core.GetHeader());
EXPECT_EQ(0, core.GetProgramHeaderCount());
EXPECT_EQ(0U, core.GetProgramHeaderCount());
EXPECT_EQ(NULL, core.GetProgramHeader(0));
EXPECT_EQ(NULL, core.GetFirstProgramHeaderOfType(PT_LOAD));
EXPECT_FALSE(core.GetFirstNote().IsValid());
@ -238,7 +238,7 @@ TEST(ElfCoreDumpTest, ValidCoreFile) {
}
EXPECT_TRUE(expected_thread_ids == actual_thread_ids);
EXPECT_EQ(1, num_nt_prpsinfo);
EXPECT_EQ(1U, num_nt_prpsinfo);
EXPECT_EQ(kNumOfThreads, num_nt_prstatus);
#if defined(__i386__) || defined(__x86_64__)
EXPECT_EQ(kNumOfThreads, num_nt_fpregset);

View file

@ -99,7 +99,7 @@ public:
void GetElfContents(ELF& elf) {
string contents;
ASSERT_TRUE(elf.GetContents(&contents));
ASSERT_LT(0, contents.size());
ASSERT_LT(0U, contents.size());
elfdata_v.clear();
elfdata_v.insert(elfdata_v.begin(), contents.begin(), contents.end());

View file

@ -90,17 +90,17 @@ TEST(LinuxLibcSupportTest, strtoui) {
}
TEST(LinuxLibcSupportTest, uint_len) {
ASSERT_EQ(my_uint_len(0), 1);
ASSERT_EQ(my_uint_len(2), 1);
ASSERT_EQ(my_uint_len(5), 1);
ASSERT_EQ(my_uint_len(9), 1);
ASSERT_EQ(my_uint_len(10), 2);
ASSERT_EQ(my_uint_len(99), 2);
ASSERT_EQ(my_uint_len(100), 3);
ASSERT_EQ(my_uint_len(101), 3);
ASSERT_EQ(my_uint_len(1000), 4);
ASSERT_EQ(my_uint_len(0), 1U);
ASSERT_EQ(my_uint_len(2), 1U);
ASSERT_EQ(my_uint_len(5), 1U);
ASSERT_EQ(my_uint_len(9), 1U);
ASSERT_EQ(my_uint_len(10), 2U);
ASSERT_EQ(my_uint_len(99), 2U);
ASSERT_EQ(my_uint_len(100), 3U);
ASSERT_EQ(my_uint_len(101), 3U);
ASSERT_EQ(my_uint_len(1000), 4U);
// 0xFFFFFFFFFFFFFFFF
ASSERT_EQ(my_uint_len(18446744073709551615LLU), 20);
ASSERT_EQ(my_uint_len(18446744073709551615LLU), 20U);
}
TEST(LinuxLibcSupportTest, uitos) {
@ -159,23 +159,23 @@ TEST(LinuxLibcSupportTest, read_hex_ptr) {
const char* last;
last = my_read_hex_ptr(&result, "");
ASSERT_EQ(result, 0);
ASSERT_EQ(result, 0U);
ASSERT_EQ(*last, 0);
last = my_read_hex_ptr(&result, "0");
ASSERT_EQ(result, 0);
ASSERT_EQ(result, 0U);
ASSERT_EQ(*last, 0);
last = my_read_hex_ptr(&result, "0123");
ASSERT_EQ(result, 0x123);
ASSERT_EQ(result, 0x123U);
ASSERT_EQ(*last, 0);
last = my_read_hex_ptr(&result, "0123a");
ASSERT_EQ(result, 0x123a);
ASSERT_EQ(result, 0x123aU);
ASSERT_EQ(*last, 0);
last = my_read_hex_ptr(&result, "0123a-");
ASSERT_EQ(result, 0x123a);
ASSERT_EQ(result, 0x123aU);
ASSERT_EQ(*last, '-');
}
@ -184,18 +184,18 @@ TEST(LinuxLibcSupportTest, read_decimal_ptr) {
const char* last;
last = my_read_decimal_ptr(&result, "0");
ASSERT_EQ(result, 0);
ASSERT_EQ(result, 0U);
ASSERT_EQ(*last, 0);
last = my_read_decimal_ptr(&result, "0123");
ASSERT_EQ(result, 123);
ASSERT_EQ(result, 123U);
ASSERT_EQ(*last, 0);
last = my_read_decimal_ptr(&result, "1234");
ASSERT_EQ(result, 1234);
ASSERT_EQ(result, 1234U);
ASSERT_EQ(*last, 0);
last = my_read_decimal_ptr(&result, "01234-");
ASSERT_EQ(result, 1234);
ASSERT_EQ(result, 1234U);
ASSERT_EQ(*last, '-');
}

View file

@ -54,7 +54,7 @@ class MemoryMappedFileTest : public testing::Test {
void ExpectNoMappedData(const MemoryMappedFile& mapped_file) {
EXPECT_TRUE(mapped_file.content().IsEmpty());
EXPECT_TRUE(mapped_file.data() == NULL);
EXPECT_EQ(0, mapped_file.size());
EXPECT_EQ(0U, mapped_file.size());
}
};

View file

@ -48,7 +48,7 @@ TEST(SafeReadLinkTest, BoundaryBufferSize) {
char buffer[PATH_MAX];
EXPECT_TRUE(SafeReadLink("/proc/self/exe", buffer, sizeof(buffer)));
size_t path_length = strlen(buffer);
EXPECT_LT(0, path_length);
EXPECT_LT(0U, path_length);
EXPECT_GT(sizeof(buffer), path_length);
// Buffer size equals to the expected path length plus 1 for the NULL byte.

View file

@ -55,7 +55,7 @@ public:
};
TEST_F(StringTableTest, Empty) {
EXPECT_EQ(1, table.Size());
EXPECT_EQ(1U, table.Size());
string contents;
ASSERT_TRUE(table.GetContents(&contents));
const char* kExpectedContents = "\0";
@ -63,7 +63,7 @@ TEST_F(StringTableTest, Empty) {
contents.c_str(),
contents.size()));
ASSERT_TRUE(table.empty_string.IsKnownConstant());
EXPECT_EQ(0, table.empty_string.Value());
EXPECT_EQ(0U, table.empty_string.Value());
}
TEST_F(StringTableTest, Basic) {
@ -84,7 +84,7 @@ TEST_F(StringTableTest, Basic) {
contents.size()));
// empty_string is at zero, other strings start at 1.
ASSERT_TRUE(l1.IsKnownConstant());
EXPECT_EQ(1, l1.Value());
EXPECT_EQ(1U, l1.Value());
// Each string has an extra byte for a trailing null.
EXPECT_EQ(1 + s1.length() + 1, l2.Value());
EXPECT_EQ(1 + s1.length() + 1 + s2.length() + 1, l3.Value());
@ -105,7 +105,7 @@ TEST_F(StringTableTest, Duplicates) {
EXPECT_EQ(0, memcmp(kExpectedContents,
contents.c_str(),
contents.size()));
EXPECT_EQ(0, table.empty_string.Value());
EXPECT_EQ(0U, table.empty_string.Value());
EXPECT_EQ(table.empty_string.Value(), l3.Value());
EXPECT_EQ(l2.Value(), l4.Value());
}
@ -209,12 +209,12 @@ TEST_F(BasicElf, EmptyLE32) {
EXPECT_EQ(0, memcmp(kIdent, header->e_ident, sizeof(kIdent)));
EXPECT_EQ(ET_EXEC, header->e_type);
EXPECT_EQ(EM_386, header->e_machine);
EXPECT_EQ(EV_CURRENT, header->e_version);
EXPECT_EQ(0, header->e_entry);
EXPECT_EQ(0, header->e_phoff);
EXPECT_EQ(static_cast<unsigned int>(EV_CURRENT), header->e_version);
EXPECT_EQ(0U, header->e_entry);
EXPECT_EQ(0U, header->e_phoff);
EXPECT_EQ(sizeof(Elf32_Ehdr) + kStringTableSize + kStringTableAlign,
header->e_shoff);
EXPECT_EQ(0, header->e_flags);
EXPECT_EQ(0U, header->e_flags);
EXPECT_EQ(sizeof(Elf32_Ehdr), header->e_ehsize);
EXPECT_EQ(sizeof(Elf32_Phdr), header->e_phentsize);
EXPECT_EQ(0, header->e_phnum);
@ -248,12 +248,12 @@ TEST_F(BasicElf, EmptyLE64) {
EXPECT_EQ(0, memcmp(kIdent, header->e_ident, sizeof(kIdent)));
EXPECT_EQ(ET_EXEC, header->e_type);
EXPECT_EQ(EM_X86_64, header->e_machine);
EXPECT_EQ(EV_CURRENT, header->e_version);
EXPECT_EQ(0, header->e_entry);
EXPECT_EQ(0, header->e_phoff);
EXPECT_EQ(static_cast<unsigned int>(EV_CURRENT), header->e_version);
EXPECT_EQ(0U, header->e_entry);
EXPECT_EQ(0U, header->e_phoff);
EXPECT_EQ(sizeof(Elf64_Ehdr) + kStringTableSize + kStringTableAlign,
header->e_shoff);
EXPECT_EQ(0, header->e_flags);
EXPECT_EQ(0U, header->e_flags);
EXPECT_EQ(sizeof(Elf64_Ehdr), header->e_ehsize);
EXPECT_EQ(sizeof(Elf64_Phdr), header->e_phentsize);
EXPECT_EQ(0, header->e_phnum);

View file

@ -94,7 +94,7 @@ const size_t kNumElements = sizeof(kElements) / sizeof(kElements[0]);
TEST(MemoryRangeTest, DefaultConstructor) {
MemoryRange range;
EXPECT_EQ(NULL, range.data());
EXPECT_EQ(0, range.length());
EXPECT_EQ(0U, range.length());
}
TEST(MemoryRangeTest, ConstructorWithDataAndLength) {
@ -107,7 +107,7 @@ TEST(MemoryRangeTest, Reset) {
MemoryRange range;
range.Reset();
EXPECT_EQ(NULL, range.data());
EXPECT_EQ(0, range.length());
EXPECT_EQ(0U, range.length());
range.Set(kBuffer, kBufferSize);
EXPECT_EQ(kBufferPointer, range.data());
@ -115,7 +115,7 @@ TEST(MemoryRangeTest, Reset) {
range.Reset();
EXPECT_EQ(NULL, range.data());
EXPECT_EQ(0, range.length());
EXPECT_EQ(0U, range.length());
}
TEST(MemoryRangeTest, Set) {
@ -126,14 +126,14 @@ TEST(MemoryRangeTest, Set) {
range.Set(NULL, 0);
EXPECT_EQ(NULL, range.data());
EXPECT_EQ(0, range.length());
EXPECT_EQ(0U, range.length());
}
TEST(MemoryRangeTest, SubrangeOfEmptyMemoryRange) {
MemoryRange range;
MemoryRange subrange = range.Subrange(0, 10);
EXPECT_EQ(NULL, subrange.data());
EXPECT_EQ(0, subrange.length());
EXPECT_EQ(0U, subrange.length());
}
TEST(MemoryRangeTest, SubrangeAndGetData) {
@ -156,7 +156,7 @@ TEST(MemoryRangeTest, SubrangeAndGetData) {
EXPECT_FALSE(range.Covers(sub_offset, sub_length));
EXPECT_EQ(NULL, range.GetData(sub_offset, sub_length));
EXPECT_EQ(NULL, subrange.data());
EXPECT_EQ(0, subrange.length());
EXPECT_EQ(0U, subrange.length());
}
}
}

View file

@ -184,20 +184,20 @@ TEST_F(TestBasicSourceLineResolver, TestLoadAndResolve)
resolver.FillSourceLineInfo(&frame);
ASSERT_FALSE(frame.module);
ASSERT_TRUE(frame.function_name.empty());
ASSERT_EQ(frame.function_base, 0);
ASSERT_EQ(frame.function_base, 0U);
ASSERT_TRUE(frame.source_file_name.empty());
ASSERT_EQ(frame.source_line, 0);
ASSERT_EQ(frame.source_line_base, 0);
ASSERT_EQ(frame.source_line_base, 0U);
frame.module = &module1;
resolver.FillSourceLineInfo(&frame);
ASSERT_EQ(frame.function_name, "Function1_1");
ASSERT_TRUE(frame.module);
ASSERT_EQ(frame.module->code_file(), "module1");
ASSERT_EQ(frame.function_base, 0x1000);
ASSERT_EQ(frame.function_base, 0x1000U);
ASSERT_EQ(frame.source_file_name, "file1_1.cc");
ASSERT_EQ(frame.source_line, 44);
ASSERT_EQ(frame.source_line_base, 0x1000);
ASSERT_EQ(frame.source_line_base, 0x1000U);
windows_frame_info.reset(resolver.FindWindowsFrameInfo(&frame));
ASSERT_TRUE(windows_frame_info.get());
ASSERT_EQ(windows_frame_info->type_, WindowsFrameInfo::STACK_INFO_FRAME_DATA);
@ -346,16 +346,16 @@ TEST_F(TestBasicSourceLineResolver, TestLoadAndResolve)
frame.module = &module2;
resolver.FillSourceLineInfo(&frame);
ASSERT_EQ(frame.function_name, "Function2_2");
ASSERT_EQ(frame.function_base, 0x2170);
ASSERT_EQ(frame.function_base, 0x2170U);
ASSERT_TRUE(frame.module);
ASSERT_EQ(frame.module->code_file(), "module2");
ASSERT_EQ(frame.source_file_name, "file2_2.cc");
ASSERT_EQ(frame.source_line, 21);
ASSERT_EQ(frame.source_line_base, 0x2180);
ASSERT_EQ(frame.source_line_base, 0x2180U);
windows_frame_info.reset(resolver.FindWindowsFrameInfo(&frame));
ASSERT_TRUE(windows_frame_info.get());
ASSERT_EQ(windows_frame_info->type_, WindowsFrameInfo::STACK_INFO_FRAME_DATA);
ASSERT_EQ(windows_frame_info->prolog_size, 1);
ASSERT_EQ(windows_frame_info->prolog_size, 1U);
frame.instruction = 0x216f;
resolver.FillSourceLineInfo(&frame);

View file

@ -51,7 +51,7 @@ TEST_F(BinaryStreamBasicTest, ReadU8) {
ASSERT_FALSE(stream.eof());
stream >> u8;
ASSERT_TRUE(stream.eof());
EXPECT_EQ(0, u8);
EXPECT_EQ(0U, u8);
stream.rewind();
stream.clear();
stream << (u_int8_t)1;
@ -66,7 +66,7 @@ TEST_F(BinaryStreamBasicTest, ReadU16) {
ASSERT_FALSE(stream.eof());
stream >> u16;
ASSERT_TRUE(stream.eof());
EXPECT_EQ(0, u16);
EXPECT_EQ(0U, u16);
stream.rewind();
stream.clear();
stream << (u_int16_t)1;
@ -81,13 +81,13 @@ TEST_F(BinaryStreamBasicTest, ReadU32) {
ASSERT_FALSE(stream.eof());
stream >> u32;
ASSERT_TRUE(stream.eof());
EXPECT_EQ(0, u32);
EXPECT_EQ(0U, u32);
stream.rewind();
stream.clear();
stream << (u_int32_t)1;
ASSERT_FALSE(stream.eof());
stream >> u32;
EXPECT_EQ(1, u32);
EXPECT_EQ(1U, u32);
EXPECT_FALSE(stream.eof());
}
@ -96,13 +96,13 @@ TEST_F(BinaryStreamBasicTest, ReadU64) {
ASSERT_FALSE(stream.eof());
stream >> u64;
ASSERT_TRUE(stream.eof());
EXPECT_EQ(0, u64);
EXPECT_EQ(0U, u64);
stream.rewind();
stream.clear();
stream << (u_int64_t)1;
ASSERT_FALSE(stream.eof());
stream >> u64;
EXPECT_EQ(1, u64);
EXPECT_EQ(1U, u64);
EXPECT_FALSE(stream.eof());
}
@ -149,7 +149,7 @@ TEST_F(BinaryStreamBasicTest, ReadMultiU8) {
ASSERT_FALSE(stream.eof());
e = 0;
stream >> e;
EXPECT_EQ(0, e);
EXPECT_EQ(0U, e);
ASSERT_TRUE(stream.eof());
// try reading all at once, including one past eof
stream.rewind();
@ -162,7 +162,7 @@ TEST_F(BinaryStreamBasicTest, ReadMultiU8) {
EXPECT_EQ(eb, b);
EXPECT_EQ(ec, c);
EXPECT_EQ(ed, d);
EXPECT_EQ(0, e);
EXPECT_EQ(0U, e);
EXPECT_TRUE(stream.eof());
}
@ -179,7 +179,7 @@ TEST_F(BinaryStreamBasicTest, ReadMultiU16) {
ASSERT_FALSE(stream.eof());
e = 0;
stream >> e;
EXPECT_EQ(0, e);
EXPECT_EQ(0U, e);
EXPECT_TRUE(stream.eof());
// try reading all at once, including one past eof
stream.rewind();
@ -192,7 +192,7 @@ TEST_F(BinaryStreamBasicTest, ReadMultiU16) {
EXPECT_EQ(eb, b);
EXPECT_EQ(ec, c);
EXPECT_EQ(ed, d);
EXPECT_EQ(0, e);
EXPECT_EQ(0U, e);
EXPECT_TRUE(stream.eof());
}
@ -209,7 +209,7 @@ TEST_F(BinaryStreamBasicTest, ReadMultiU32) {
ASSERT_FALSE(stream.eof());
e = 0;
stream >> e;
EXPECT_EQ(0, e);
EXPECT_EQ(0U, e);
EXPECT_TRUE(stream.eof());
// try reading all at once, including one past eof
stream.rewind();
@ -222,7 +222,7 @@ TEST_F(BinaryStreamBasicTest, ReadMultiU32) {
EXPECT_EQ(eb, b);
EXPECT_EQ(ec, c);
EXPECT_EQ(ed, d);
EXPECT_EQ(0, e);
EXPECT_EQ(0U, e);
EXPECT_TRUE(stream.eof());
}
@ -240,7 +240,7 @@ TEST_F(BinaryStreamBasicTest, ReadMultiU64) {
ASSERT_FALSE(stream.eof());
e = 0;
stream >> e;
EXPECT_EQ(0, e);
EXPECT_EQ(0U, e);
EXPECT_TRUE(stream.eof());
// try reading all at once, including one past eof
stream.rewind();
@ -253,7 +253,7 @@ TEST_F(BinaryStreamBasicTest, ReadMultiU64) {
EXPECT_EQ(eb, b);
EXPECT_EQ(ec, c);
EXPECT_EQ(ed, d);
EXPECT_EQ(0, e);
EXPECT_EQ(0U, e);
EXPECT_TRUE(stream.eof());
}
@ -306,7 +306,7 @@ TEST_F(BinaryStreamBasicTest, StreamByteLength) {
stream << (u_int8_t)0 << (u_int16_t)1 << (u_int32_t)2 << (u_int64_t)3
<< string("test");
string s = stream.str();
EXPECT_EQ(21, s.length());
EXPECT_EQ(21U, s.length());
}
TEST_F(BinaryStreamBasicTest, AppendStreamResultsByteLength) {
@ -319,7 +319,7 @@ TEST_F(BinaryStreamBasicTest, AppendStreamResultsByteLength) {
string s = stream.str();
string s2 = stream2.str();
s.append(s2);
EXPECT_EQ(21, s.length());
EXPECT_EQ(21U, s.length());
}
TEST_F(BinaryStreamBasicTest, StreamSetStr) {
@ -353,7 +353,7 @@ TEST_F(BinaryStreamU8Test, ReadU16) {
ASSERT_FALSE(stream.eof());
stream >> u16;
ASSERT_TRUE(stream.eof());
EXPECT_EQ(0, u16);
EXPECT_EQ(0U, u16);
}
TEST_F(BinaryStreamU8Test, ReadU32) {
@ -361,7 +361,7 @@ TEST_F(BinaryStreamU8Test, ReadU32) {
ASSERT_FALSE(stream.eof());
stream >> u32;
ASSERT_TRUE(stream.eof());
EXPECT_EQ(0, u32);
EXPECT_EQ(0U, u32);
}
TEST_F(BinaryStreamU8Test, ReadU64) {
@ -369,7 +369,7 @@ TEST_F(BinaryStreamU8Test, ReadU64) {
ASSERT_FALSE(stream.eof());
stream >> u64;
ASSERT_TRUE(stream.eof());
EXPECT_EQ(0, u64);
EXPECT_EQ(0U, u64);
}
TEST_F(BinaryStreamU8Test, ReadString) {
@ -399,7 +399,7 @@ TEST(BinaryStreamTest, InitWithDataLeadingNull) {
u_int8_t z, a, b, c, d;
stream >> z >> a >> b >> c >> d;
ASSERT_FALSE(stream.eof());
EXPECT_EQ(0, z);
EXPECT_EQ(0U, z);
EXPECT_EQ('a', a);
EXPECT_EQ('b', b);
EXPECT_EQ('c', c);

View file

@ -91,39 +91,39 @@ unsigned char read_cmp[] =
TEST(DisassemblerX86Test, SimpleReturnInstruction) {
DisassemblerX86 dis(just_return, sizeof(just_return)-1, 0);
EXPECT_EQ(1, dis.NextInstruction());
EXPECT_EQ(1U, dis.NextInstruction());
EXPECT_TRUE(dis.currentInstructionValid());
EXPECT_EQ(0, dis.flags());
EXPECT_EQ(0U, dis.flags());
EXPECT_TRUE(dis.endOfBlock());
EXPECT_EQ(libdis::insn_controlflow, dis.currentInstructionGroup());
const libdis::x86_insn_t* instruction = dis.currentInstruction();
EXPECT_EQ(libdis::insn_controlflow, instruction->group);
EXPECT_EQ(libdis::insn_return, instruction->type);
EXPECT_EQ(0, dis.NextInstruction());
EXPECT_EQ(0U, dis.NextInstruction());
EXPECT_FALSE(dis.currentInstructionValid());
EXPECT_EQ(NULL, dis.currentInstruction());
}
TEST(DisassemblerX86Test, SimpleInvalidInstruction) {
DisassemblerX86 dis(invalid_instruction, sizeof(invalid_instruction)-1, 0);
EXPECT_EQ(0, dis.NextInstruction());
EXPECT_EQ(0U, dis.NextInstruction());
EXPECT_FALSE(dis.currentInstructionValid());
}
TEST(DisassemblerX86Test, BadReadLeadsToBranch) {
DisassemblerX86 dis(read_eax_jmp_eax, sizeof(read_eax_jmp_eax)-1, 0);
EXPECT_EQ(2, dis.NextInstruction());
EXPECT_EQ(2U, dis.NextInstruction());
EXPECT_TRUE(dis.currentInstructionValid());
EXPECT_EQ(0, dis.flags());
EXPECT_EQ(0U, dis.flags());
EXPECT_FALSE(dis.endOfBlock());
EXPECT_EQ(libdis::insn_move, dis.currentInstructionGroup());
EXPECT_TRUE(dis.setBadRead());
EXPECT_EQ(2, dis.NextInstruction());
EXPECT_EQ(2U, dis.NextInstruction());
EXPECT_TRUE(dis.currentInstructionValid());
EXPECT_EQ(0, dis.flags());
EXPECT_EQ(0U, dis.flags());
EXPECT_FALSE(dis.endOfBlock());
EXPECT_EQ(libdis::insn_logic, dis.currentInstructionGroup());
EXPECT_EQ(2, dis.NextInstruction());
EXPECT_EQ(2U, dis.NextInstruction());
EXPECT_TRUE(dis.currentInstructionValid());
EXPECT_EQ(google_breakpad::DISX86_BAD_BRANCH_TARGET, dis.flags());
EXPECT_FALSE(dis.endOfBlock());
@ -133,22 +133,22 @@ TEST(DisassemblerX86Test, BadReadLeadsToBranch) {
TEST(DisassemblerX86Test, BadWriteLeadsToPushedArg) {
DisassemblerX86 dis(write_eax_arg_to_call,
sizeof(write_eax_arg_to_call)-1, 0);
EXPECT_EQ(6, dis.NextInstruction());
EXPECT_EQ(6U, dis.NextInstruction());
EXPECT_TRUE(dis.currentInstructionValid());
EXPECT_EQ(0, dis.flags());
EXPECT_EQ(0U, dis.flags());
EXPECT_FALSE(dis.endOfBlock());
EXPECT_EQ(libdis::insn_move, dis.currentInstructionGroup());
EXPECT_TRUE(dis.setBadWrite());
EXPECT_EQ(3, dis.NextInstruction());
EXPECT_EQ(3U, dis.NextInstruction());
EXPECT_TRUE(dis.currentInstructionValid());
EXPECT_EQ(0, dis.flags());
EXPECT_EQ(0U, dis.flags());
EXPECT_FALSE(dis.endOfBlock());
EXPECT_EQ(libdis::insn_arithmetic, dis.currentInstructionGroup());
EXPECT_EQ(1, dis.NextInstruction());
EXPECT_EQ(1U, dis.NextInstruction());
EXPECT_TRUE(dis.currentInstructionValid());
EXPECT_EQ(0, dis.flags());
EXPECT_EQ(0U, dis.flags());
EXPECT_FALSE(dis.endOfBlock());
EXPECT_EQ(5, dis.NextInstruction());
EXPECT_EQ(5U, dis.NextInstruction());
EXPECT_TRUE(dis.currentInstructionValid());
EXPECT_EQ(google_breakpad::DISX86_BAD_ARGUMENT_PASSED, dis.flags());
EXPECT_EQ(libdis::insn_controlflow, dis.currentInstructionGroup());
@ -158,18 +158,18 @@ TEST(DisassemblerX86Test, BadWriteLeadsToPushedArg) {
TEST(DisassemblerX86Test, BadReadLeadsToBlockWrite) {
DisassemblerX86 dis(read_edi_stosb, sizeof(read_edi_stosb)-1, 0);
EXPECT_EQ(2, dis.NextInstruction());
EXPECT_EQ(2U, dis.NextInstruction());
EXPECT_TRUE(dis.currentInstructionValid());
EXPECT_EQ(0, dis.flags());
EXPECT_EQ(0U, dis.flags());
EXPECT_FALSE(dis.endOfBlock());
EXPECT_EQ(libdis::insn_move, dis.currentInstructionGroup());
EXPECT_TRUE(dis.setBadRead());
EXPECT_EQ(2, dis.NextInstruction());
EXPECT_EQ(2U, dis.NextInstruction());
EXPECT_TRUE(dis.currentInstructionValid());
EXPECT_EQ(0, dis.flags());
EXPECT_EQ(0U, dis.flags());
EXPECT_FALSE(dis.endOfBlock());
EXPECT_EQ(libdis::insn_move, dis.currentInstructionGroup());
EXPECT_EQ(2, dis.NextInstruction());
EXPECT_EQ(2U, dis.NextInstruction());
EXPECT_TRUE(dis.currentInstructionValid());
EXPECT_EQ(google_breakpad::DISX86_BAD_BLOCK_WRITE, dis.flags());
EXPECT_FALSE(dis.endOfBlock());
@ -178,43 +178,43 @@ TEST(DisassemblerX86Test, BadReadLeadsToBlockWrite) {
TEST(DisassemblerX86Test, BadReadClobberThenWrite) {
DisassemblerX86 dis(read_clobber_write, sizeof(read_clobber_write)-1, 0);
EXPECT_EQ(2, dis.NextInstruction());
EXPECT_EQ(2U, dis.NextInstruction());
EXPECT_TRUE(dis.currentInstructionValid());
EXPECT_EQ(0, dis.flags());
EXPECT_EQ(0U, dis.flags());
EXPECT_FALSE(dis.endOfBlock());
EXPECT_EQ(libdis::insn_arithmetic, dis.currentInstructionGroup());
EXPECT_TRUE(dis.setBadRead());
EXPECT_EQ(2, dis.NextInstruction());
EXPECT_EQ(2U, dis.NextInstruction());
EXPECT_TRUE(dis.currentInstructionValid());
EXPECT_EQ(0, dis.flags());
EXPECT_EQ(0U, dis.flags());
EXPECT_FALSE(dis.endOfBlock());
EXPECT_EQ(libdis::insn_move, dis.currentInstructionGroup());
EXPECT_EQ(2, dis.NextInstruction());
EXPECT_EQ(2U, dis.NextInstruction());
EXPECT_TRUE(dis.currentInstructionValid());
EXPECT_EQ(0, dis.flags());
EXPECT_EQ(0U, dis.flags());
EXPECT_FALSE(dis.endOfBlock());
EXPECT_EQ(libdis::insn_move, dis.currentInstructionGroup());
}
TEST(DisassemblerX86Test, BadReadXCHGThenWrite) {
DisassemblerX86 dis(read_xchg_write, sizeof(read_xchg_write)-1, 0);
EXPECT_EQ(2, dis.NextInstruction());
EXPECT_EQ(2U, dis.NextInstruction());
EXPECT_TRUE(dis.currentInstructionValid());
EXPECT_EQ(0, dis.flags());
EXPECT_EQ(0U, dis.flags());
EXPECT_FALSE(dis.endOfBlock());
EXPECT_EQ(libdis::insn_arithmetic, dis.currentInstructionGroup());
EXPECT_TRUE(dis.setBadRead());
EXPECT_EQ(1, dis.NextInstruction());
EXPECT_EQ(1U, dis.NextInstruction());
EXPECT_TRUE(dis.currentInstructionValid());
EXPECT_EQ(0, dis.flags());
EXPECT_EQ(0U, dis.flags());
EXPECT_FALSE(dis.endOfBlock());
EXPECT_EQ(libdis::insn_move, dis.currentInstructionGroup());
EXPECT_EQ(2, dis.NextInstruction());
EXPECT_EQ(2U, dis.NextInstruction());
EXPECT_TRUE(dis.currentInstructionValid());
EXPECT_EQ(0, dis.flags());
EXPECT_EQ(0U, dis.flags());
EXPECT_FALSE(dis.endOfBlock());
EXPECT_EQ(libdis::insn_move, dis.currentInstructionGroup());
EXPECT_EQ(2, dis.NextInstruction());
EXPECT_EQ(2U, dis.NextInstruction());
EXPECT_TRUE(dis.currentInstructionValid());
EXPECT_EQ(google_breakpad::DISX86_BAD_WRITE, dis.flags());
EXPECT_FALSE(dis.endOfBlock());
@ -223,18 +223,18 @@ TEST(DisassemblerX86Test, BadReadXCHGThenWrite) {
TEST(DisassemblerX86Test, BadReadThenCMP) {
DisassemblerX86 dis(read_cmp, sizeof(read_cmp)-1, 0);
EXPECT_EQ(2, dis.NextInstruction());
EXPECT_EQ(2U, dis.NextInstruction());
EXPECT_TRUE(dis.currentInstructionValid());
EXPECT_EQ(0, dis.flags());
EXPECT_EQ(0U, dis.flags());
EXPECT_FALSE(dis.endOfBlock());
EXPECT_EQ(libdis::insn_arithmetic, dis.currentInstructionGroup());
EXPECT_TRUE(dis.setBadRead());
EXPECT_EQ(3, dis.NextInstruction());
EXPECT_EQ(3U, dis.NextInstruction());
EXPECT_TRUE(dis.currentInstructionValid());
EXPECT_EQ(google_breakpad::DISX86_BAD_COMPARISON, dis.flags());
EXPECT_FALSE(dis.endOfBlock());
EXPECT_EQ(libdis::insn_comparison, dis.currentInstructionGroup());
EXPECT_EQ(2, dis.NextInstruction());
EXPECT_EQ(2U, dis.NextInstruction());
EXPECT_TRUE(dis.currentInstructionValid());
EXPECT_EQ(google_breakpad::DISX86_BAD_COMPARISON, dis.flags());
EXPECT_FALSE(dis.endOfBlock());

View file

@ -213,20 +213,20 @@ TEST_F(TestFastSourceLineResolver, TestLoadAndResolve) {
fast_resolver.FillSourceLineInfo(&frame);
ASSERT_FALSE(frame.module);
ASSERT_TRUE(frame.function_name.empty());
ASSERT_EQ(frame.function_base, 0);
ASSERT_EQ(frame.function_base, 0U);
ASSERT_TRUE(frame.source_file_name.empty());
ASSERT_EQ(frame.source_line, 0);
ASSERT_EQ(frame.source_line_base, 0);
ASSERT_EQ(frame.source_line_base, 0U);
frame.module = &module1;
fast_resolver.FillSourceLineInfo(&frame);
ASSERT_EQ(frame.function_name, "Function1_1");
ASSERT_TRUE(frame.module);
ASSERT_EQ(frame.module->code_file(), "module1");
ASSERT_EQ(frame.function_base, 0x1000);
ASSERT_EQ(frame.function_base, 0x1000U);
ASSERT_EQ(frame.source_file_name, "file1_1.cc");
ASSERT_EQ(frame.source_line, 44);
ASSERT_EQ(frame.source_line_base, 0x1000);
ASSERT_EQ(frame.source_line_base, 0x1000U);
windows_frame_info.reset(fast_resolver.FindWindowsFrameInfo(&frame));
ASSERT_TRUE(windows_frame_info.get());
ASSERT_FALSE(windows_frame_info->allocates_base_pointer);
@ -374,16 +374,16 @@ TEST_F(TestFastSourceLineResolver, TestLoadAndResolve) {
frame.module = &module2;
fast_resolver.FillSourceLineInfo(&frame);
ASSERT_EQ(frame.function_name, "Function2_2");
ASSERT_EQ(frame.function_base, 0x2170);
ASSERT_EQ(frame.function_base, 0x2170U);
ASSERT_TRUE(frame.module);
ASSERT_EQ(frame.module->code_file(), "module2");
ASSERT_EQ(frame.source_file_name, "file2_2.cc");
ASSERT_EQ(frame.source_line, 21);
ASSERT_EQ(frame.source_line_base, 0x2180);
ASSERT_EQ(frame.source_line_base, 0x2180U);
windows_frame_info.reset(fast_resolver.FindWindowsFrameInfo(&frame));
ASSERT_TRUE(windows_frame_info.get());
ASSERT_EQ(windows_frame_info->type_, WindowsFrameInfo::STACK_INFO_FRAME_DATA);
ASSERT_EQ(windows_frame_info->prolog_size, 1);
ASSERT_EQ(windows_frame_info->prolog_size, 1U);
frame.instruction = 0x216f;
fast_resolver.FillSourceLineInfo(&frame);

View file

@ -492,8 +492,8 @@ TEST_F(MinidumpProcessorTest, TestThreadMissingMemory) {
google_breakpad::PROCESS_OK);
// Should have a single thread with a single frame in it.
ASSERT_EQ(1, state.threads()->size());
ASSERT_EQ(1, state.threads()->at(0)->frames()->size());
ASSERT_EQ(1U, state.threads()->size());
ASSERT_EQ(1U, state.threads()->at(0)->frames()->size());
ASSERT_EQ(kExpectedEIP, state.threads()->at(0)->frames()->at(0)->instruction);
}
@ -543,8 +543,8 @@ TEST_F(MinidumpProcessorTest, TestThreadMissingContext) {
google_breakpad::PROCESS_OK);
// Should have a single thread with zero frames.
ASSERT_EQ(1, state.threads()->size());
ASSERT_EQ(0, state.threads()->at(0)->frames()->size());
ASSERT_EQ(1U, state.threads()->size());
ASSERT_EQ(0U, state.threads()->at(0)->frames()->size());
}
} // namespace

View file

@ -88,7 +88,7 @@ static int PrintRegister(const char *name, u_int32_t value, int start_col) {
char buffer[64];
snprintf(buffer, sizeof(buffer), " %5s = 0x%08x", name, value);
if (start_col + strlen(buffer) > kMaxWidth) {
if (start_col + static_cast<ssize_t>(strlen(buffer)) > kMaxWidth) {
start_col = 0;
printf("\n ");
}
@ -102,7 +102,7 @@ static int PrintRegister64(const char *name, u_int64_t value, int start_col) {
char buffer[64];
snprintf(buffer, sizeof(buffer), " %5s = 0x%016" PRIx64 , name, value);
if (start_col + strlen(buffer) > kMaxWidth) {
if (start_col + static_cast<ssize_t>(strlen(buffer)) > kMaxWidth) {
start_col = 0;
printf("\n ");
}

View file

@ -726,7 +726,7 @@ TEST(Dump, OneExceptionX86) {
u_int32_t thread_id;
ASSERT_TRUE(md_exception->GetThreadID(&thread_id));
ASSERT_EQ(0x1234abcd, thread_id);
ASSERT_EQ(0x1234abcdU, thread_id);
const MDRawExceptionStream* raw_exception = md_exception->exception();
ASSERT_TRUE(raw_exception != NULL);
@ -800,7 +800,7 @@ TEST(Dump, OneExceptionX86XState) {
u_int32_t thread_id;
ASSERT_TRUE(md_exception->GetThreadID(&thread_id));
ASSERT_EQ(0x1234abcd, thread_id);
ASSERT_EQ(0x1234abcdU, thread_id);
const MDRawExceptionStream* raw_exception = md_exception->exception();
ASSERT_TRUE(raw_exception != NULL);
@ -878,7 +878,7 @@ TEST(Dump, OneExceptionARM) {
u_int32_t thread_id;
ASSERT_TRUE(md_exception->GetThreadID(&thread_id));
ASSERT_EQ(0x1234abcd, thread_id);
ASSERT_EQ(0x1234abcdU, thread_id);
const MDRawExceptionStream* raw_exception = md_exception->exception();
ASSERT_TRUE(raw_exception != NULL);
@ -962,7 +962,7 @@ TEST(Dump, OneExceptionARMOldFlags) {
u_int32_t thread_id;
ASSERT_TRUE(md_exception->GetThreadID(&thread_id));
ASSERT_EQ(0x1234abcd, thread_id);
ASSERT_EQ(0x1234abcdU, thread_id);
const MDRawExceptionStream* raw_exception = md_exception->exception();
ASSERT_TRUE(raw_exception != NULL);

View file

@ -106,7 +106,7 @@ class ModuleSerializer {
FastSourceLineResolver *fast_resolver);
// Number of Maps that Module class contains.
static const u_int32_t kNumberMaps_ =
static const int32_t kNumberMaps_ =
FastSourceLineResolver::Module::kNumberMaps_;
// Memory sizes required to serialize map components in Module.

View file

@ -293,7 +293,7 @@ TEST_F(GetCallerFrame, ScanWithFunctionSymbols) {
ASSERT_EQ(StackFrameARM::CONTEXT_VALID_ALL, frame0->context_validity);
EXPECT_EQ(0, memcmp(&raw_context, &frame0->context, sizeof(raw_context)));
EXPECT_EQ("monotreme", frame0->function_name);
EXPECT_EQ(0x40000100, frame0->function_base);
EXPECT_EQ(0x40000100U, frame0->function_base);
StackFrameARM *frame1 = static_cast<StackFrameARM *>(frames->at(1));
EXPECT_EQ(StackFrame::FRAME_TRUST_SCAN, frame1->trust);
@ -303,7 +303,7 @@ TEST_F(GetCallerFrame, ScanWithFunctionSymbols) {
EXPECT_EQ(return_address, frame1->context.iregs[MD_CONTEXT_ARM_REG_PC]);
EXPECT_EQ(frame1_sp.Value(), frame1->context.iregs[MD_CONTEXT_ARM_REG_SP]);
EXPECT_EQ("marsupial", frame1->function_name);
EXPECT_EQ(0x50000100, frame1->function_base);
EXPECT_EQ(0x50000100U, frame1->function_base);
}
struct CFIFixture: public StackwalkerARMFixture {
@ -688,9 +688,9 @@ TEST_F(GetFramesByFramePointer, OnlyFramePointer) {
StackFrameARM::CONTEXT_VALID_SP),
frame2->context_validity);
EXPECT_EQ(return_address2, frame2->context.iregs[MD_CONTEXT_ARM_REG_PC]);
EXPECT_EQ(0, frame2->context.iregs[MD_CONTEXT_ARM_REG_LR]);
EXPECT_EQ(0U, frame2->context.iregs[MD_CONTEXT_ARM_REG_LR]);
EXPECT_EQ(frame2_sp.Value(), frame2->context.iregs[MD_CONTEXT_ARM_REG_SP]);
EXPECT_EQ(0, frame2->context.iregs[MD_CONTEXT_ARM_REG_IOS_FP]);
EXPECT_EQ(0U, frame2->context.iregs[MD_CONTEXT_ARM_REG_IOS_FP]);
}
TEST_F(GetFramesByFramePointer, FramePointerAndCFI) {
@ -781,7 +781,7 @@ TEST_F(GetFramesByFramePointer, FramePointerAndCFI) {
StackFrameARM::CONTEXT_VALID_SP),
frame2->context_validity);
EXPECT_EQ(return_address2, frame2->context.iregs[MD_CONTEXT_ARM_REG_PC]);
EXPECT_EQ(0, frame2->context.iregs[MD_CONTEXT_ARM_REG_LR]);
EXPECT_EQ(0U, frame2->context.iregs[MD_CONTEXT_ARM_REG_LR]);
EXPECT_EQ(frame2_sp.Value(), frame2->context.iregs[MD_CONTEXT_ARM_REG_SP]);
EXPECT_EQ(0, frame2->context.iregs[MD_CONTEXT_ARM_REG_IOS_FP]);
EXPECT_EQ(0U, frame2->context.iregs[MD_CONTEXT_ARM_REG_IOS_FP]);
}

View file

@ -126,7 +126,7 @@ class StaticMap {
const char* raw_data_;
// Number of nodes in the static map.
u_int32_t num_nodes_;
int32_t num_nodes_;
// Array of offset addresses for stored values.
// For example:

View file

@ -79,7 +79,7 @@ class StaticRangeMap {
const;
// Returns the number of ranges stored in the RangeMap.
inline unsigned int GetCount() const { return map_.size(); }
inline int GetCount() const { return map_.size(); }
private:
friend class ModuleComparer;

View file

@ -675,7 +675,7 @@ ParseDSODebugInfo(CrashedProcess* crashinfo, const MinidumpMemoryRange& range,
range.length() - sizeof(MDRawDebug));
}
if (debug->map != kInvalidMDRVA) {
for (int i = 0; i < debug->dso_count; ++i) {
for (unsigned int i = 0; i < debug->dso_count; ++i) {
const MDRawLinkMap* link_map =
full_file.GetArrayElement<MDRawLinkMap>(debug->map, i);
if (link_map) {

View file

@ -95,7 +95,7 @@ const size_t kNumElements = sizeof(kElements) / sizeof(kElements[0]);
TEST(MinidumpMemoryRangeTest, DefaultConstructor) {
MinidumpMemoryRange range;
EXPECT_EQ(NULL, range.data());
EXPECT_EQ(0, range.length());
EXPECT_EQ(0U, range.length());
}
TEST(MinidumpMemoryRangeTest, ConstructorWithDataAndLength) {
@ -108,7 +108,7 @@ TEST(MinidumpMemoryRangeTest, Reset) {
MinidumpMemoryRange range;
range.Reset();
EXPECT_EQ(NULL, range.data());
EXPECT_EQ(0, range.length());
EXPECT_EQ(0U, range.length());
range.Set(kBuffer, kBufferSize);
EXPECT_EQ(kBufferPointer, range.data());
@ -116,7 +116,7 @@ TEST(MinidumpMemoryRangeTest, Reset) {
range.Reset();
EXPECT_EQ(NULL, range.data());
EXPECT_EQ(0, range.length());
EXPECT_EQ(0U, range.length());
}
TEST(MinidumpMemoryRangeTest, Set) {
@ -127,14 +127,14 @@ TEST(MinidumpMemoryRangeTest, Set) {
range.Set(NULL, 0);
EXPECT_EQ(NULL, range.data());
EXPECT_EQ(0, range.length());
EXPECT_EQ(0U, range.length());
}
TEST(MinidumpMemoryRangeTest, SubrangeOfEmptyMemoryRange) {
MinidumpMemoryRange range;
MinidumpMemoryRange subrange = range.Subrange(0, 10);
EXPECT_EQ(NULL, subrange.data());
EXPECT_EQ(0, subrange.length());
EXPECT_EQ(0U, subrange.length());
}
TEST(MinidumpMemoryRangeTest, SubrangeAndGetData) {
@ -157,7 +157,7 @@ TEST(MinidumpMemoryRangeTest, SubrangeAndGetData) {
EXPECT_FALSE(range.Covers(sub_offset, sub_length));
EXPECT_EQ(NULL, range.GetData(sub_offset, sub_length));
EXPECT_EQ(NULL, subrange.data());
EXPECT_EQ(0, subrange.length());
EXPECT_EQ(0U, subrange.length());
}
}
}
@ -185,7 +185,7 @@ TEST(MinidumpMemoryRangeTest, SubrangeWithMDLocationDescriptor) {
EXPECT_FALSE(range.Covers(sub_offset, sub_length));
EXPECT_EQ(NULL, range.GetData(sub_offset, sub_length));
EXPECT_EQ(NULL, subrange.data());
EXPECT_EQ(0, subrange.length());
EXPECT_EQ(0U, subrange.length());
}
}
}