Skip to content

Commit 4b1d080

Browse files
fix some gcc compiler warnings when using -Wsign-compare (dashpay#24)
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 2daa8f8 commit 4b1d080

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/util.hpp

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

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

0 commit comments

Comments
 (0)