folly/Format-inl.h: use the correct type for fwrite return value (easy)
authorJim Meyering <meyering@fb.com>
Wed, 7 Jan 2015 16:09:26 +0000 (08:09 -0800)
committerViswanath Sivakumar <viswanath@fb.com>
Tue, 13 Jan 2015 19:01:04 +0000 (11:01 -0800)
Summary:
* folly/Format-inl.h (folly): fwrite returns size_t, not ssize_t.
Fixing this avoids the following diagnostic from gcc-4.9:
folly/Format-inl.h:299:11: error: comparison between signed and unsigned integer expressions [-Werror=sign-compare]

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

Reviewed By: philipp@fb.com

Subscribers: trunkagent, net-systems@, folly-diffs@

FB internal diff: D1770155

Tasks: 5941250

Signature: t1:1770155:1420668733:62593231d35f5874521dba575f23b68891b2a4f9

folly/Format-inl.h

index b72ec861aba142d8d3007326a1982a9666a55f21..1603423eef1c921016b4656cd23bfde05e755b79 100644 (file)
@@ -295,7 +295,7 @@ template <class Derived, bool containerMode, class... Args>
 void writeTo(FILE* fp,
              const BaseFormatter<Derived, containerMode, Args...>& formatter) {
   auto writer = [fp] (StringPiece sp) {
 void writeTo(FILE* fp,
              const BaseFormatter<Derived, containerMode, Args...>& formatter) {
   auto writer = [fp] (StringPiece sp) {
-    ssize_t n = fwrite(sp.data(), 1, sp.size(), fp);
+    size_t n = fwrite(sp.data(), 1, sp.size(), fp);
     if (n < sp.size()) {
       throwSystemError("Formatter writeTo", "fwrite failed");
     }
     if (n < sp.size()) {
       throwSystemError("Formatter writeTo", "fwrite failed");
     }