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

@ -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);