From: Jim Meyering Date: Wed, 7 Jan 2015 16:09:26 +0000 (-0800) Subject: folly/Format-inl.h: use the correct type for fwrite return value (easy) X-Git-Tag: v0.22.0~29 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=ab794fb62edf575ae5985db55d9b4df815d96fc3;p=folly.git folly/Format-inl.h: use the correct type for fwrite return value (easy) 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 --- diff --git a/folly/Format-inl.h b/folly/Format-inl.h index b72ec861..1603423e 100644 --- a/folly/Format-inl.h +++ b/folly/Format-inl.h @@ -295,7 +295,7 @@ template void writeTo(FILE* fp, const BaseFormatter& 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"); }