From: Jim Meyering Date: Wed, 7 Jan 2015 16:16:07 +0000 (-0800) Subject: folly/dynamic-inl.h: avoid -Wsign-compare error X-Git-Tag: v0.22.0~6 X-Git-Url: http://plrg.eecs.uci.edu/git/?a=commitdiff_plain;h=ed281068685319a31741fcecb7917362463b3fdb;p=folly.git 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 --- diff --git a/folly/dynamic-inl.h b/folly/dynamic-inl.h index f0a580cb..c2d48eba 100644 --- a/folly/dynamic-inl.h +++ b/folly/dynamic-inl.h @@ -950,7 +950,7 @@ class FormatValue> { case dynamic::ARRAY: { int key = arg.splitIntKey(); - if (key >= 0 && key < c.size()) { + if (key >= 0 && size_t(key) < c.size()) { FormatValue(c.at(key)).format(arg, cb); } else{ FormatValue(val_.defaultValue).format(arg, cb);