Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(5)

Unified Diff: src/platform/update_engine/test_http_server.cc

Issue 1599029: update engine: 32- and 64-bit compile (Closed)
Patch Set: int32->int32_t, PRIi64, 80 cols for review Created 10 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: src/platform/update_engine/test_http_server.cc
diff --git a/src/platform/update_engine/test_http_server.cc b/src/platform/update_engine/test_http_server.cc
index 94c88fa1bb4b9700ff5e14bd7b3a5142dff4cf4f..9fbe97f5c40d32be8fbc6f9d6a802f603f6711dc 100644
--- a/src/platform/update_engine/test_http_server.cc
+++ b/src/platform/update_engine/test_http_server.cc
@@ -14,6 +14,7 @@
#include <sys/socket.h>
#include <sys/types.h>
#include <errno.h>
+#include <inttypes.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@@ -98,7 +99,7 @@ void WriteString(int fd, const string& str) {
string Itoa(off_t num) {
char buf[100] = {0};
- snprintf(buf, sizeof(buf), "%lld", num);
+ snprintf(buf, sizeof(buf), "%" PRIi64, num);
return buf;
}
@@ -120,6 +121,7 @@ void WriteHeaders(int fd, bool support_range, off_t full_size,
}
void HandleQuitQuitQuit(int fd) {
+ WriteHeaders(fd, true, 0, 0);
exit(0);
}
@@ -142,14 +144,15 @@ void HandleBig(int fd, const HttpRequest& request) {
void HandleFlaky(int fd, const HttpRequest& request) {
const off_t full_length = kBigLength;
WriteHeaders(fd, true, full_length, request.offset);
- const off_t content_length = min(9000LL, full_length - request.offset);
+ const off_t content_length =
+ min(static_cast<off_t>(9000), full_length - request.offset);
const bool should_sleep = (request.offset % (9000 * 7)) == 0;
string buf;
for (int i = request.offset; i % 10; i++)
buf.append(1, 'a' + (i % 10));
- while (buf.size() < content_length)
+ while (static_cast<off_t>(buf.size()) < content_length)
buf.append("abcdefghij");
buf.resize(content_length);

Powered by Google App Engine
This is Rietveld 408576698