fix build warnings with type mismatches and base check helpers
Building with base headers in a SLOT-ed setup exposes build warnings
(which causes failures due to -Werror). One such example:
In file included from extent_writer.h:9:0,
from bzip_extent_writer.h:10,
from bzip_extent_writer.cc:5:
.../base/logging.h: In function 'std::string* logging::CheckEQImpl(const t1&, const t2&, const char*)
[with t1 = unsigned int, t2 = int, std::string = std::basic_string<char>]':
bzip_extent_writer.cc:53:7: instantiated from here
.../base/logging.h:512:1: error: comparison between signed and unsigned integer expressions [-Werror=sign-compare]
cc1plus: all warnings being treated as errors
Explicitly cast the constants to avoid these.
BUG=chromium-os:16623
TEST=`emerge-x86-alex update_engine` builds
Change-Id: If3cc4e85fa54862b14305f9d045c73b5575efaa0
Reviewed-on: https://gerrit.chromium.org/gerrit/16035
Reviewed-by: Gilad Arnold <garnold@chromium.org>
Tested-by: Mike Frysinger <vapier@chromium.org>
Commit-Ready: Mike Frysinger <vapier@chromium.org>
diff --git a/delta_diff_generator.cc b/delta_diff_generator.cc
index cc8f352..67b917f 100644
--- a/delta_diff_generator.cc
+++ b/delta_diff_generator.cc
@@ -531,7 +531,7 @@
vector<char> bsdiff_delta;
TEST_AND_RETURN_FALSE(
BsdiffFiles(old_filename, new_filename, &bsdiff_delta));
- CHECK_GT(bsdiff_delta.size(), 0);
+ CHECK_GT(bsdiff_delta.size(), static_cast<vector<char>::size_type>(0));
if (bsdiff_delta.size() < current_best_size) {
operation.set_type(DeltaArchiveManifest_InstallOperation_Type_BSDIFF);
current_best_size = bsdiff_delta.size();
@@ -748,7 +748,8 @@
cuts.back().tmp_extents);
// delete the old edge
- CHECK_EQ(1, (*graph)[it->first].out_edges.erase(it->second));
+ CHECK_EQ(static_cast<Graph::size_type>(1),
+ (*graph)[it->first].out_edges.erase(it->second));
// Add an edge from dst to copy operation
EdgeProperties write_before_edge_properties;