Commit 581e60e2 authored by Anton Likhtarov's avatar Anton Likhtarov Committed by Dave Watson

Easy: fix signed/unsigned comparisons

Test Plan: build with -Wsign-compare, no warnings

Reviewed By: njormrod@fb.com

FB internal diff: D1193502
parent 0a52fd7b
...@@ -867,7 +867,9 @@ private: ...@@ -867,7 +867,9 @@ private:
} }
size_t smallSize() const { size_t smallSize() const {
assert(category() == isSmall && small_[maxSmallSize] <= maxSmallSize); assert(category() == isSmall &&
static_cast<size_t>(small_[maxSmallSize])
<= static_cast<size_t>(maxSmallSize));
return static_cast<size_t>(maxSmallSize) return static_cast<size_t>(maxSmallSize)
- static_cast<size_t>(small_[maxSmallSize]); - static_cast<size_t>(small_[maxSmallSize]);
} }
......
...@@ -263,7 +263,7 @@ struct StaticMeta { ...@@ -263,7 +263,7 @@ struct StaticMeta {
return id; return id;
} }
static void destroy(int id) { static void destroy(size_t id) {
try { try {
auto & meta = instance(); auto & meta = instance();
// Elements in other threads that use this id. // Elements in other threads that use this id.
...@@ -401,7 +401,7 @@ struct StaticMeta { ...@@ -401,7 +401,7 @@ struct StaticMeta {
#endif #endif
} }
static ElementWrapper& get(int id) { static ElementWrapper& get(size_t id) {
ThreadEntry* threadEntry = getThreadEntry(); ThreadEntry* threadEntry = getThreadEntry();
if (UNLIKELY(threadEntry->elementsCapacity <= id)) { if (UNLIKELY(threadEntry->elementsCapacity <= id)) {
reserve(id); reserve(id);
...@@ -420,4 +420,3 @@ template <class Tag> StaticMeta<Tag>* StaticMeta<Tag>::inst_ = nullptr; ...@@ -420,4 +420,3 @@ template <class Tag> StaticMeta<Tag>* StaticMeta<Tag>::inst_ = nullptr;
} // namespace folly } // namespace folly
#endif /* FOLLY_DETAIL_THREADLOCALDETAIL_H_ */ #endif /* FOLLY_DETAIL_THREADLOCALDETAIL_H_ */
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment