summaryrefslogtreecommitdiff
path: root/test_http_server.cc
diff options
context:
space:
mode:
authorMike Frysinger <vapier@chromium.org>2012-02-16 12:11:37 -0500
committerGerrit <chrome-bot@google.com>2012-02-16 13:44:49 -0800
commit0f9547d10fc3df51c8dd3828a495e89ed0260037 (patch)
tree9fcbdf4365cb80b329259de2f1202828d593c27e /test_http_server.cc
parent1877c3938afb2cc46c959d1158316671cf3460d9 (diff)
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>
Diffstat (limited to 'test_http_server.cc')
-rw-r--r--test_http_server.cc12
1 files changed, 6 insertions, 6 deletions
diff --git a/test_http_server.cc b/test_http_server.cc
index af10968b..6257e07a 100644
--- a/test_http_server.cc
+++ b/test_http_server.cc
@@ -77,7 +77,7 @@ bool ParseRequest(int fd, HttpRequest* request) {
// 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 @@ bool ParseRequest(int fd, HttpRequest* request) {
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 @@ bool ParseRequest(int fd, HttpRequest* request) {
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 @@ ssize_t WriteHeaders(int fd, const off_t start_offset, const off_t end_offset,
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 @@ ssize_t HandleGet(int fd, const HttpRequest& request,
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 @@ class UrlTerms {
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.