From 38693d99c48f21875ed43970e67a437b1f4f08fa Mon Sep 17 00:00:00 2001 From: Igor Canadi Date: Tue, 29 Apr 2014 12:33:57 -0700 Subject: [PATCH] Fix more signed/unsigned comparsions --- Makefile | 2 +- db/column_family_test.cc | 2 +- db/db_bench.cc | 6 +++--- db/file_indexer_test.cc | 2 +- util/benchharness.cc | 4 ++-- 5 files changed, 8 insertions(+), 8 deletions(-) diff --git a/Makefile b/Makefile index 697527326..28dbbfdd1 100644 --- a/Makefile +++ b/Makefile @@ -51,7 +51,7 @@ else PLATFORM_CCFLAGS += $(JEMALLOC_INCLUDE) -DHAVE_JEMALLOC endif -WARNING_FLAGS = -Wall -Werror -Wno-sign-compare +WARNING_FLAGS = -Wall -Werror CFLAGS += $(WARNING_FLAGS) -I. -I./include $(PLATFORM_CCFLAGS) $(OPT) CXXFLAGS += $(WARNING_FLAGS) -I. -I./include $(PLATFORM_CXXFLAGS) $(OPT) -Woverloaded-virtual diff --git a/db/column_family_test.cc b/db/column_family_test.cc index 168549d0c..f21bea481 100644 --- a/db/column_family_test.cc +++ b/db/column_family_test.cc @@ -922,7 +922,7 @@ TEST(ColumnFamilyTest, DontRollEmptyLogs) { Open(); CreateColumnFamiliesAndReopen({"one", "two", "three", "four"}); - for (int i = 0; i < handles_.size(); ++i) { + for (size_t i = 0; i < handles_.size(); ++i) { PutRandomData(i, 10, 100); } int num_writable_file_start = env_->GetNumberOfNewWritableFileCalls(); diff --git a/db/db_bench.cc b/db/db_bench.cc index 345821596..043282277 100644 --- a/db/db_bench.cc +++ b/db/db_bench.cc @@ -1685,7 +1685,7 @@ class Benchmark { OpenDb(options, FLAGS_db, &db_); } else { multi_dbs_.clear(); - for (size_t i = 0; i < FLAGS_num_multi_db; i++) { + for (int i = 0; i < FLAGS_num_multi_db; i++) { DB* db; OpenDb(options, GetDbNameForMultiple(FLAGS_db, i), &db); multi_dbs_.push_back(db); @@ -1910,7 +1910,7 @@ class Benchmark { ReadOptions options(FLAGS_verify_checksum, true); std::vector keys; std::vector values(entries_per_batch_); - while (keys.size() < entries_per_batch_) { + while (static_cast(keys.size()) < entries_per_batch_) { keys.push_back(AllocateKey()); } @@ -1922,7 +1922,7 @@ class Benchmark { FLAGS_num, &keys[i]); } std::vector statuses = db->MultiGet(options, keys, &values); - assert(statuses.size() == entries_per_batch_); + assert(static_cast(statuses.size()) == entries_per_batch_); read += entries_per_batch_; for (int64_t i = 0; i < entries_per_batch_; ++i) { diff --git a/db/file_indexer_test.cc b/db/file_indexer_test.cc index 26a0508a3..bfec8dd8f 100644 --- a/db/file_indexer_test.cc +++ b/db/file_indexer_test.cc @@ -60,7 +60,7 @@ struct FileIndexerTest { } void Reset() { - for (int i = 0; i < kNumLevels; ++i) { + for (uint32_t i = 0; i < kNumLevels; ++i) { for (auto* f : files[i]) { delete f; } diff --git a/util/benchharness.cc b/util/benchharness.cc index af612316e..8cd37007b 100644 --- a/util/benchharness.cc +++ b/util/benchharness.cc @@ -305,7 +305,7 @@ static void PrintBenchmarkResultsAsTable( // Compute the longest benchmark name size_t longestName = 0; - for (auto i = 1; i < benchmarks.size(); i++) { + for (size_t i = 1; i < benchmarks.size(); i++) { longestName = max(longestName, strlen(get<1>(benchmarks[i]))); } @@ -379,7 +379,7 @@ void RunBenchmarks() { auto const globalBaseline = RunBenchmarkGetNSPerIteration( get<2>(benchmarks.front()), 0); - for (auto i = 1; i < benchmarks.size(); i++) { + for (size_t i = 1; i < benchmarks.size(); i++) { double elapsed = 0.0; if (strcmp(get<1>(benchmarks[i]), "-") != 0) { // skip separators elapsed = RunBenchmarkGetNSPerIteration(get<2>(benchmarks[i]),