diff --git a/base/buffer.cpp b/base/buffer.cpp index 6516528e9b..6de2ea48a8 100644 --- a/base/buffer.cpp +++ b/base/buffer.cpp @@ -139,7 +139,7 @@ bool Buffer::FlushToFile(const char *filename) { bool Buffer::FlushSocket(uintptr_t sock) { for (size_t pos = 0, end = data_.size(); pos < end; ) { - int sent = send(sock, &data_[pos], end - pos, 0); + int sent = send(sock, &data_[pos], (int)(end - pos), 0); if (sent < 0) { ELOG("FlushSocket failed"); return false; @@ -194,7 +194,7 @@ int Buffer::Read(int fd, size_t sz) { char buf[1024]; int retval; size_t received = 0; - while ((retval = recv(fd, buf, std::min(sz, sizeof(buf)), 0)) > 0) { + while ((retval = recv(fd, buf, (int)std::min(sz, sizeof(buf)), 0)) > 0) { if (retval < 0) { return retval; } @@ -205,7 +205,7 @@ int Buffer::Read(int fd, size_t sz) { if (sz == 0) return 0; } - return received; + return (int)received; } void Buffer::PeekAll(std::string *dest) { diff --git a/file/fd_util.cpp b/file/fd_util.cpp index babe09f970..8326fecf94 100644 --- a/file/fd_util.cpp +++ b/file/fd_util.cpp @@ -53,8 +53,8 @@ ssize_t WriteLine(int fd, const char *vptr, size_t n) { size_t nleft = n; while (nleft > 0) { - ssize_t nwritten; - if ((nwritten = (ssize_t)write(fd, buffer, nleft)) <= 0) { + int nwritten; + if ((nwritten = (int)write(fd, buffer, nleft)) <= 0) { if (errno == EINTR) nwritten = 0; else