folly/FileUtil.h: fix compiler warning signed/unsigned comparison
authorSven Over <over@fb.com>
Wed, 25 Feb 2015 14:54:21 +0000 (06:54 -0800)
committerAlecs King <int@fb.com>
Tue, 3 Mar 2015 03:29:42 +0000 (19:29 -0800)
Summary:
writeFull() returns ssize_t and without proper casting, comparing
it with data.size() triggers a compiler warning (which is
treated as an error) in the gcc-4.9-glibc-2.20 toolchain.

Test Plan: fbmake runtests

Reviewed By: mhx@fb.com

Subscribers: folly-diffs@, yfeldblum

FB internal diff: D1870710

Signature: t1:1870710:1424874592:f51026c35196d763ad4b192d43c8ccee0255b41d

folly/FileUtil.h

index 71d8e2551274089e9cf1cec503557790ccaf3168..c9fd3f10e38157041a9dae5494a59ef71e1cdddd 100644 (file)
@@ -188,7 +188,7 @@ bool writeFile(const Container& data, const char* filename,
     return false;
   }
   bool ok = data.empty() ||
-    writeFull(fd, &data[0], data.size()) == data.size();
+    writeFull(fd, &data[0], data.size()) == static_cast<ssize_t>(data.size());
   return closeNoInt(fd) == 0 && ok;
 }