folly: fix many -Wsign-compare warning/errors reported by gcc-4.9
Summary:
With the upgrade to gcc-4.9 fbcode's default is to enable
-Wsign-compare by default. That exposes nontrivial technical debt.
This is part of that clean-up. Some of these changes fix the problem
where there's an "int" for-loop index, yet an unsigned limit.
The fix is to use an unsigned type when the limit is also unsigned.
I usually choose size_t because of the general recommendation (when
writing portable code) to avoid size-tied types like uint32_t and
uint64_t unless you have a very good reason to require them.
Test Plan:
Run this and note there are fewer errors than before:
fbconfig --platform-all=gcc-4.9-glibc-2.20 tao/server && fbmake dbgo
Also, run this, compiling and running tests with gcc-4.8.1.
Verify that there are no more failures than without this patch:
fbmake opt -k && fbmake runtests_opt
Here's the tail of that process, (same with and without the patch):
Summary (total time 47.45s):
PASS: 1949
FAIL: 1
SKIP: 0
FATAL: 9
TIMEOUT: 0
Reviewed By: hans@fb.com
Subscribers: trunkagent, fugalh, njormrod, folly-diffs@
FB internal diff:
D1766722
Tasks:
5941250
Signature: t1:
1766722:
1420762240:
a8545648ddb4fd0b2adf0d3147a84409c0f706a8