From a03331d8d54b142fb0ff137dd3f37b10b9bd1bc8 Mon Sep 17 00:00:00 2001 From: Sean Cannella Date: Tue, 16 Sep 2014 17:08:52 -0700 Subject: [PATCH] Fix folly signed/unsigned comparisons Summary: Fix a few sign comparison issues in folly::IPAddress @override-unit-failures Test Plan: existing tests, compiled with clang Reviewed By: meyering@fb.com, davejwatson@fb.com Subscribers: njormrod, bmatheny, subodh, ranjeeth, pgriess FB internal diff: D1559152 --- folly/detail/IPAddress.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/folly/detail/IPAddress.h b/folly/detail/IPAddress.h index ba43bf06..f2552290 100644 --- a/folly/detail/IPAddress.h +++ b/folly/detail/IPAddress.h @@ -85,7 +85,7 @@ inline bool getNthMSBitImpl(const IPAddrType& ip, uint8_t bitIndex, struct Bytes : private boost::noncopyable { // return true if all values of src are zero static bool isZero(const uint8_t* src, std::size_t len) { - for (auto i = 0; i < len; i++) { + for (std::size_t i = 0; i < len; i++) { if (src[i] != 0x00) { return false; } @@ -100,7 +100,7 @@ struct Bytes : private boost::noncopyable { static_assert(N > 0, "Can't mask an empty ByteArray"); std::size_t asize = a.size(); std::array ba{{0}}; - for (int i = 0; i < asize; i++) { + for (std::size_t i = 0; i < asize; i++) { ba[i] = a[i] & b[i]; } return ba; @@ -176,7 +176,7 @@ struct Bytes : private boost::noncopyable { static std::string toHex(const uint8_t* src, std::size_t len) { static const char* const lut = "0123456789abcdef"; std::stringstream ss; - for (int i = 0; i < len; i++) { + for (std::size_t i = 0; i < len; i++) { const unsigned char c = src[i]; ss << lut[c >> 4] << lut[c & 15]; } -- 2.34.1