From: Anton Likhtarov Date: Thu, 27 Feb 2014 01:51:49 +0000 (-0800) Subject: Easy: fix signed/unsigned comparisons X-Git-Tag: v0.22.0~668 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=581e60e263f111252222ff4fb41851b31b33262a;p=folly.git Easy: fix signed/unsigned comparisons Test Plan: build with -Wsign-compare, no warnings Reviewed By: njormrod@fb.com FB internal diff: D1193502 --- diff --git a/folly/FBString.h b/folly/FBString.h index 7a1aa8b0..3d4ceecc 100644 --- a/folly/FBString.h +++ b/folly/FBString.h @@ -867,7 +867,9 @@ private: } size_t smallSize() const { - assert(category() == isSmall && small_[maxSmallSize] <= maxSmallSize); + assert(category() == isSmall && + static_cast(small_[maxSmallSize]) + <= static_cast(maxSmallSize)); return static_cast(maxSmallSize) - static_cast(small_[maxSmallSize]); } diff --git a/folly/detail/ThreadLocalDetail.h b/folly/detail/ThreadLocalDetail.h index 86910f0d..dc4cf76e 100644 --- a/folly/detail/ThreadLocalDetail.h +++ b/folly/detail/ThreadLocalDetail.h @@ -263,7 +263,7 @@ struct StaticMeta { return id; } - static void destroy(int id) { + static void destroy(size_t id) { try { auto & meta = instance(); // Elements in other threads that use this id. @@ -401,7 +401,7 @@ struct StaticMeta { #endif } - static ElementWrapper& get(int id) { + static ElementWrapper& get(size_t id) { ThreadEntry* threadEntry = getThreadEntry(); if (UNLIKELY(threadEntry->elementsCapacity <= id)) { reserve(id); @@ -420,4 +420,3 @@ template StaticMeta* StaticMeta::inst_ = nullptr; } // namespace folly #endif /* FOLLY_DETAIL_THREADLOCALDETAIL_H_ */ -