From 581e60e263f111252222ff4fb41851b31b33262a Mon Sep 17 00:00:00 2001 From: Anton Likhtarov Date: Wed, 26 Feb 2014 17:51:49 -0800 Subject: [PATCH] Easy: fix signed/unsigned comparisons Test Plan: build with -Wsign-compare, no warnings Reviewed By: njormrod@fb.com FB internal diff: D1193502 --- folly/FBString.h | 4 +++- folly/detail/ThreadLocalDetail.h | 5 ++--- 2 files changed, 5 insertions(+), 4 deletions(-) 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_ */ - -- 2.34.1