Skip to content
This repository was archived by the owner on Jul 2, 2025. It is now read-only.

Commit 6cb0e98

Browse files
fix some gcc compiler warnings when using -Wsign-compare (#284)
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)
1 parent b3acfe5 commit 6cb0e98

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/util.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,15 +60,15 @@ class Util {
6060
static std::string HexStr(const uint8_t* data, size_t len) {
6161
std::stringstream s;
6262
s << std::hex;
63-
for (int i=0; i < len; ++i)
63+
for (size_t i=0; i < len; ++i)
6464
s << std::setw(2) << std::setfill('0') << static_cast<int>(data[i]);
6565
return s.str();
6666
}
6767

6868
static std::string HexStr(const std::vector<uint8_t> &data) {
6969
std::stringstream s;
7070
s << std::hex;
71-
for (int i=0; i < data.size(); ++i)
71+
for (size_t i=0; i < data.size(); ++i)
7272
s << std::setw(2) << std::setfill('0') << static_cast<int>(data[i]);
7373
return s.str();
7474
}

0 commit comments

Comments
 (0)