From a86f40d6b5c7f4e7f1df93ba29d66feca49ea840 Mon Sep 17 00:00:00 2001 From: Pasta Date: Sat, 2 Oct 2021 14:51:09 -0400 Subject: [PATCH] fix some gcc compiler warnings when using -Wsign-compare MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit util.hpp: In static member function ‘static std::string bls::Util::HexStr(const uint8_t*, size_t)’: util.hpp:62:25: warning: comparison of integer expressions of different signedness: ‘int’ and ‘size_t’ {aka ‘long unsigned int’} [-Wsign-compare] 62 | for (int i=0; i < len; ++i) --- src/util.hpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/util.hpp b/src/util.hpp index f59d308f4..78e97eac2 100644 --- a/src/util.hpp +++ b/src/util.hpp @@ -60,7 +60,7 @@ class Util { static std::string HexStr(const uint8_t* data, size_t len) { std::stringstream s; s << std::hex; - for (int i=0; i < len; ++i) + for (size_t i=0; i < len; ++i) s << std::setw(2) << std::setfill('0') << static_cast(data[i]); return s.str(); } @@ -68,7 +68,7 @@ class Util { static std::string HexStr(const std::vector &data) { std::stringstream s; s << std::hex; - for (int i=0; i < data.size(); ++i) + for (size_t i=0; i < data.size(); ++i) s << std::setw(2) << std::setfill('0') << static_cast(data[i]); return s.str(); }