From: Kefu Chai Date: Wed, 17 Aug 2016 06:38:44 +0000 (+0800) Subject: msg/async: fix compiler warnings X-Git-Tag: v11.0.1~424^2~3 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=20320f3091ed1d8d09a2dffd308e146a186237da;p=ceph.git msg/async: fix compiler warnings fix warnings like ``` comparison between signed and unsigned integer expressions [-Wsign-compare] ``` Signed-off-by: Kefu Chai --- diff --git a/src/msg/async/PosixStack.cc b/src/msg/async/PosixStack.cc index 65d0bf64b77f..e71cd6aa3d1c 100644 --- a/src/msg/async/PosixStack.cc +++ b/src/msg/async/PosixStack.cc @@ -146,7 +146,7 @@ class PosixConnectedSocketImpl final : public ConnectedSocketImpl { { suppress_sigpipe(); - ssize_t sent = 0; + size_t sent = 0; while (1) { ssize_t r; #if defined(MSG_NOSIGNAL) @@ -185,7 +185,7 @@ class PosixConnectedSocketImpl final : public ConnectedSocketImpl { } virtual ssize_t send(bufferlist &bl, bool more) { - ssize_t sent_bytes = 0; + size_t sent_bytes = 0; std::list::const_iterator pb = bl.buffers().begin(); uint64_t left_pbrs = bl.buffers().size(); while (left_pbrs) { @@ -212,7 +212,7 @@ class PosixConnectedSocketImpl final : public ConnectedSocketImpl { // "r" is the remaining length sent_bytes += r; - if (r < msglen) + if (static_cast(r) < msglen) break; // only "r" == 0 continue } @@ -227,7 +227,7 @@ class PosixConnectedSocketImpl final : public ConnectedSocketImpl { } } - return sent_bytes; + return static_cast(sent_bytes); } virtual void shutdown() { ::shutdown(_fd, SHUT_RDWR);