Commit ed281068 authored by Jim Meyering's avatar Jim Meyering Committed by Viswanath Sivakumar

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

Summary:
* folly/dynamic-inl.h (format): Add an explicit
int-to-size_t cast (that is ok because we've just ensured
it is non-negative) to avoid this error from gcc-4.9:

folly/dynamic-inl.h:953: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: delong.j@fb.com

Subscribers: trunkagent, folly-diffs@

FB internal diff: D1773242

Tasks: 5941250

Signature: t1:1773242:1420822301:b1e3c065cd25728c77957ce9e1f52e884ba8693b
parent 7fdf8141
...@@ -950,7 +950,7 @@ class FormatValue<detail::DefaultValueWrapper<dynamic, V>> { ...@@ -950,7 +950,7 @@ class FormatValue<detail::DefaultValueWrapper<dynamic, V>> {
case dynamic::ARRAY: case dynamic::ARRAY:
{ {
int key = arg.splitIntKey(); int key = arg.splitIntKey();
if (key >= 0 && key < c.size()) { if (key >= 0 && size_t(key) < c.size()) {
FormatValue<dynamic>(c.at(key)).format(arg, cb); FormatValue<dynamic>(c.at(key)).format(arg, cb);
} else{ } else{
FormatValue<V>(val_.defaultValue).format(arg, cb); FormatValue<V>(val_.defaultValue).format(arg, cb);
......
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