From b9c78d2db6cbd15c87146c915b27375a41495a7d Mon Sep 17 00:00:00 2001 From: Caio SBA Date: Fri, 14 Mar 2014 22:44:35 +0000 Subject: [PATCH] Make it compile on Debian/GCC 4.7 --- db/log_test.cc | 8 ++++---- util/env_test.cc | 22 +++++++++++----------- 2 files changed, 15 insertions(+), 15 deletions(-) diff --git a/db/log_test.cc b/db/log_test.cc index b28343e63..6577a6a9c 100644 --- a/db/log_test.cc +++ b/db/log_test.cc @@ -451,7 +451,7 @@ TEST(LogTest, TruncatedTrailingRecordIsIgnored) { ShrinkSize(4); // Drop all payload as well as a header byte ASSERT_EQ("EOF", Read()); // Truncated last record is ignored, not treated as an error - ASSERT_EQ(0, DroppedBytes()); + ASSERT_EQ(0U, DroppedBytes()); ASSERT_EQ("", ReportMessage()); } @@ -470,7 +470,7 @@ TEST(LogTest, BadLengthAtEndIsIgnored) { Write("foo"); ShrinkSize(1); ASSERT_EQ("EOF", Read()); - ASSERT_EQ(0, DroppedBytes()); + ASSERT_EQ(0U, DroppedBytes()); ASSERT_EQ("", ReportMessage()); } @@ -528,7 +528,7 @@ TEST(LogTest, MissingLastIsIgnored) { ShrinkSize(14); ASSERT_EQ("EOF", Read()); ASSERT_EQ("", ReportMessage()); - ASSERT_EQ(0, DroppedBytes()); + ASSERT_EQ(0U, DroppedBytes()); } TEST(LogTest, PartialLastIsIgnored) { @@ -537,7 +537,7 @@ TEST(LogTest, PartialLastIsIgnored) { ShrinkSize(1); ASSERT_EQ("EOF", Read()); ASSERT_EQ("", ReportMessage()); - ASSERT_EQ(0, DroppedBytes()); + ASSERT_EQ(0U, DroppedBytes()); } TEST(LogTest, ErrorJoinsRecords) { diff --git a/util/env_test.cc b/util/env_test.cc index e17027a39..892586478 100644 --- a/util/env_test.cc +++ b/util/env_test.cc @@ -172,8 +172,8 @@ TEST(EnvPosixTest, TwoPools) { env_->SetBackgroundThreads(kLowPoolSize); env_->SetBackgroundThreads(kHighPoolSize, Env::Priority::HIGH); - ASSERT_EQ(0, env_->GetThreadPoolQueueLen(Env::Priority::LOW)); - ASSERT_EQ(0, env_->GetThreadPoolQueueLen(Env::Priority::HIGH)); + ASSERT_EQ(0U, env_->GetThreadPoolQueueLen(Env::Priority::LOW)); + ASSERT_EQ(0U, env_->GetThreadPoolQueueLen(Env::Priority::HIGH)); // schedule same number of jobs in each pool for (int i = 0; i < kJobs; i++) { @@ -182,10 +182,10 @@ TEST(EnvPosixTest, TwoPools) { } // Wait a short while for the jobs to be dispatched. Env::Default()->SleepForMicroseconds(kDelayMicros); - ASSERT_EQ(kJobs - kLowPoolSize, env_->GetThreadPoolQueueLen()); - ASSERT_EQ(kJobs - kLowPoolSize, + ASSERT_EQ((unsigned int)(kJobs - kLowPoolSize), env_->GetThreadPoolQueueLen()); + ASSERT_EQ((unsigned int)(kJobs - kLowPoolSize), env_->GetThreadPoolQueueLen(Env::Priority::LOW)); - ASSERT_EQ(kJobs - kHighPoolSize, + ASSERT_EQ((unsigned int)(kJobs - kHighPoolSize), env_->GetThreadPoolQueueLen(Env::Priority::HIGH)); // wait for all jobs to finish @@ -194,8 +194,8 @@ TEST(EnvPosixTest, TwoPools) { env_->SleepForMicroseconds(kDelayMicros); } - ASSERT_EQ(0, env_->GetThreadPoolQueueLen(Env::Priority::LOW)); - ASSERT_EQ(0, env_->GetThreadPoolQueueLen(Env::Priority::HIGH)); + ASSERT_EQ(0U, env_->GetThreadPoolQueueLen(Env::Priority::LOW)); + ASSERT_EQ(0U, env_->GetThreadPoolQueueLen(Env::Priority::HIGH)); } bool IsSingleVarint(const std::string& s) { @@ -296,18 +296,18 @@ TEST(EnvPosixTest, AllocateTest) { struct stat f_stat; stat(fname.c_str(), &f_stat); - ASSERT_EQ(data.size(), f_stat.st_size); + ASSERT_EQ((unsigned int)data.size(), f_stat.st_size); // verify that blocks are preallocated - ASSERT_EQ(kPreallocateSize / kBlockSize, f_stat.st_blocks); + ASSERT_EQ((unsigned int)(kPreallocateSize / kBlockSize), f_stat.st_blocks); // close the file, should deallocate the blocks wfile.reset(); stat(fname.c_str(), &f_stat); - ASSERT_EQ(data.size(), f_stat.st_size); + ASSERT_EQ((unsigned int)data.size(), f_stat.st_size); // verify that preallocated blocks were deallocated on file close size_t data_blocks_pages = ((data.size() + kPageSize - 1) / kPageSize); - ASSERT_EQ(data_blocks_pages * kPageSize / kBlockSize, f_stat.st_blocks); + ASSERT_EQ((unsigned int)(data_blocks_pages * kPageSize / kBlockSize), f_stat.st_blocks); } #endif