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/test_http_server.cc b/test_http_server.cc
index af10968..6257e07 100644
--- a/test_http_server.cc
+++ b/test_http_server.cc
@@ -77,7 +77,7 @@
   // Decode URL line.
   std::vector<string> terms;
   base::SplitStringAlongWhitespace(lines[0], &terms);
-  CHECK_EQ(terms.size(), 3);
+  CHECK_EQ(terms.size(), static_cast<vector<string>::size_type>(3));
   CHECK_EQ(terms[0], "GET");
   request->url = terms[1];
   LOG(INFO) << "URL: " << request->url;
@@ -89,7 +89,7 @@
     base::SplitStringAlongWhitespace(lines[i], &terms);
 
     if (terms[0] == "Range:") {
-      CHECK_EQ(terms.size(), 2);
+      CHECK_EQ(terms.size(), static_cast<vector<string>::size_type>(2));
       string &range = terms[1];
       LOG(INFO) << "range attribute: " << range;
       CHECK(StartsWithASCII(range, "bytes=", true) &&
@@ -108,7 +108,7 @@
         base::StringAppendF(&tmp_str, "unspecified");
       LOG(INFO) << tmp_str;
     } else if (terms[0] == "Host:") {
-      CHECK_EQ(terms.size(), 2);
+      CHECK_EQ(terms.size(), static_cast<vector<string>::size_type>(2));
       request->host = terms[1];
       LOG(INFO) << "host attribute: " << request->host;
     } else {
@@ -192,7 +192,7 @@
 size_t WritePayload(int fd, const off_t start_offset, const off_t end_offset,
                     const char first_byte, const size_t line_len) {
   CHECK_LE(start_offset, end_offset);
-  CHECK_GT(line_len, 0);
+  CHECK_GT(line_len, static_cast<size_t>(0));
 
   LOG(INFO) << "writing payload: " << line_len << "-byte lines starting with `"
             << first_byte << "', offset range " << start_offset << " -> "
@@ -348,7 +348,7 @@
 void HandleRedirect(int fd, const HttpRequest& request) {
   LOG(INFO) << "Redirecting...";
   string url = request.url;
-  CHECK_EQ(0, url.find("/redirect/"));
+  CHECK_EQ(static_cast<size_t>(0), url.find("/redirect/"));
   url.erase(0, strlen("/redirect/"));
   string::size_type url_start = url.find('/');
   CHECK_NE(url_start, string::npos);
@@ -439,7 +439,7 @@
  public:
   UrlTerms(string &url, size_t num_terms) {
     // URL must be non-empty and start with a slash.
-    CHECK_GT(url.size(), 0);
+    CHECK_GT(url.size(), static_cast<size_t>(0));
     CHECK_EQ(url[0], '/');
 
     // Split it into terms delimited by slashes, omitting the preceeding slash.