Commit 453a7e48 authored by Jim Meyering's avatar Jim Meyering Committed by Viswanath Sivakumar

folly/Format-inl.h: avoid -Wsign-compare error

Summary:
* folly/Format-inl.h (IndexableTraitsSeq::at): Add an explicit
int-to-size_t cast (ok here, since we've just confirmed
that the value is not negative) to avoid this error from gcc-4.9:

folly/Format-inl.h:947:29: 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: tjackson@fb.com

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

FB internal diff: D1770193

Tasks: 5941250

Signature: t1:1770193:1420670569:83ac19c2ca8cd408d7c86d7dce49e2d4b418941a
parent 3d4f7737
......@@ -944,7 +944,7 @@ struct IndexableTraitsSeq : public FormatTraitsBase {
static const value_type& at(const C& c, int idx,
const value_type& dflt) {
return (idx >= 0 && idx < c.size()) ? c.at(idx) : dflt;
return (idx >= 0 && size_t(idx) < c.size()) ? c.at(idx) : dflt;
}
};
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment