From: Jim Meyering <meyering@fb.com>
Date: Tue, 6 Jan 2015 17:24:30 +0000 (-0800)
Subject: folly/.../FileUtilDetail.h: avoid -Wsign-compare warnings
X-Git-Tag: v0.22.0~16
X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=9d9b01efa9187ee848cfe308efd99f58df48f0ef;p=folly.git

folly/.../FileUtilDetail.h: avoid -Wsign-compare warnings

Summary:
* folly/detail/FileUtilDetail.h (wrapvFull): Change type of result
variable from ssize_t to size_t: this required changing r == -1 to
r == (size_t)-1.

Test Plan:
Run this and note there are fewer errors than before:
fbconfig --platform-all=gcc-4.9-glibc-2.20 -r folly && fbmake dbgo
Also run fbmake runtests, and confirm that the results are
the same with and without this change.

Reviewed By: lucian@fb.com

Subscribers: folly-diffs@

FB internal diff: D1772171

Tasks: 5941250

Signature: t1:1772171:1420743142:1f9e02006e2d77a0c9451bae7965fb28617d95d6
---

diff --git a/folly/detail/FileUtilDetail.h b/folly/detail/FileUtilDetail.h
index af2b56e9..1cd77052 100644
--- a/folly/detail/FileUtilDetail.h
+++ b/folly/detail/FileUtilDetail.h
@@ -74,10 +74,10 @@ ssize_t wrapFull(F f, int fd, void* buf, size_t count, Offset... offset) {
 template <class F, class... Offset>
 ssize_t wrapvFull(F f, int fd, iovec* iov, int count, Offset... offset) {
   ssize_t totalBytes = 0;
-  ssize_t r;
+  size_t r;
   do {
     r = f(fd, iov, count, offset...);
-    if (r == -1) {
+    if (r == (size_t)-1) {
       if (errno == EINTR) {
         continue;
       }