Skip to content

Commit

Permalink
fix some gcc compiler warnings when using -Wsign-compare (#284)
Browse files Browse the repository at this point in the history
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)
  • Loading branch information
PastaPastaPasta committed Nov 4, 2021
1 parent b3acfe5 commit 6cb0e98
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/util.hpp
Expand Up @@ -60,15 +60,15 @@ 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<int>(data[i]);
return s.str();
}

static std::string HexStr(const std::vector<uint8_t> &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<int>(data[i]);
return s.str();
}
Expand Down

0 comments on commit 6cb0e98

Please sign in to comment.