folly/stats/BucketedTimeSeries-defs.h: avoid -Wsign-compare error
authorJim Meyering <meyering@fb.com>
Wed, 7 Jan 2015 17:30:43 +0000 (09:30 -0800)
committerViswanath Sivakumar <viswanath@fb.com>
Tue, 13 Jan 2015 19:01:04 +0000 (11:01 -0800)
Summary:
* folly/stats/BucketedTimeSeries-defs.h (BucketedTimeSeries):
Assume that maxDuration is never negative, and cast the signed
duration_.count() to size_t, to avoid this error from gcc-4.9:

folly/stats/BucketedTimeSeries-defs.h:38:18: 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: andrei.alexandrescu@fb.com

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

FB internal diff: D1770171

Tasks: 5941250

Signature: t1:1770171:1420669115:61e6b8d3248f88b25736322c7066af015209fba5

folly/stats/BucketedTimeSeries-defs.h

index aa7786b6e59d1f497f869133ccaf151c1b99b325..7dacbded574ae9ae30b87163453ecf507290b669 100644 (file)
@@ -35,7 +35,7 @@ BucketedTimeSeries<VT, TT>::BucketedTimeSeries(size_t nBuckets,
     //
     // There is no point in having more buckets than our timestamp
     // granularity: otherwise we would have buckets that could never be used.
-    if (nBuckets > duration_.count()) {
+    if (nBuckets > size_t(duration_.count())) {
       nBuckets = duration_.count();
     }