diff --git a/src/lib/asiodns/tests/io_fetch_unittest.cc b/src/lib/asiodns/tests/io_fetch_unittest.cc index e93e796ae9..7b4cd0568e 100644 --- a/src/lib/asiodns/tests/io_fetch_unittest.cc +++ b/src/lib/asiodns/tests/io_fetch_unittest.cc @@ -290,7 +290,7 @@ public: if (cumulative_ > 2) { uint16_t dns_length = readUint16(receive_buffer_, sizeof(receive_buffer_)); - complete = ((dns_length + 2) == cumulative_); + complete = ((static_cast(dns_length) + 2) == cumulative_); } if (!complete) { diff --git a/src/lib/dhcp/option_data_types.cc b/src/lib/dhcp/option_data_types.cc index 24a4fbd789..1d581e6771 100644 --- a/src/lib/dhcp/option_data_types.cc +++ b/src/lib/dhcp/option_data_types.cc @@ -211,7 +211,7 @@ OptionDataTypeUtil::readTuple(const std::vector& buf, << buf.size()); } uint8_t len = buf[0]; - if (buf.size() < 1 + len) { + if (buf.size() < 1 + static_cast(len)) { isc_throw(BadDataTypeCast, "unable to read data from the buffer as" << " tuple (length " << static_cast(len) << "). Invalid buffer size: " << buf.size()); @@ -227,7 +227,7 @@ OptionDataTypeUtil::readTuple(const std::vector& buf, << buf.size()); } uint16_t len = isc::util::readUint16(&buf[0], 2); - if (buf.size() < 2 + len) { + if (buf.size() < 2 + static_cast(len)) { isc_throw(BadDataTypeCast, "unable to read data from the buffer as" << " tuple (length " << len << "). Invalid buffer size: " << buf.size()); diff --git a/src/lib/dns/char_string.cc b/src/lib/dns/char_string.cc index 25cb1f180f..30a99455d5 100644 --- a/src/lib/dns/char_string.cc +++ b/src/lib/dns/char_string.cc @@ -239,7 +239,7 @@ bufferToCharString(isc::util::InputBuffer& buffer, size_t rdata_len, "insufficient data to read character-string length"); } const uint8_t len = buffer.readUint8(); - if (rdata_len < len + 1) { + if (rdata_len < static_cast(len) + 1) { isc_throw(isc::dns::DNSMessageFORMERR, "character string length is too large: " << static_cast(len)); diff --git a/src/lib/dns/labelsequence.cc b/src/lib/dns/labelsequence.cc index bbdc71ca58..1d68c9fe86 100644 --- a/src/lib/dns/labelsequence.cc +++ b/src/lib/dns/labelsequence.cc @@ -134,7 +134,7 @@ LabelSequence::serialize(void* buf, size_t buf_len) const { bp += ndata_len; isc_throw_assert(bp - reinterpret_cast(buf) == - static_cast(expected_size)); + static_cast(expected_size)); } bool diff --git a/src/lib/dns/tests/time_utils_unittest.cc b/src/lib/dns/tests/time_utils_unittest.cc index 320b6ceea7..40a0baa276 100644 --- a/src/lib/dns/tests/time_utils_unittest.cc +++ b/src/lib/dns/tests/time_utils_unittest.cc @@ -73,8 +73,8 @@ TEST_F(DNSSECTimeTest, fromText) { // On the other hand, the 64-bit version should return monotonically // increasing counters. - EXPECT_EQ(4294967296LL, timeFromText64("21060207062816")); - EXPECT_EQ(4294967306LL, timeFromText64("21060207062826")); + EXPECT_EQ(4294967296LLU, timeFromText64("21060207062816")); + EXPECT_EQ(4294967306LLU, timeFromText64("21060207062826")); } // This helper templated function tells timeToText32 a faked current time. @@ -144,4 +144,4 @@ TEST_F(DNSSECTimeTest, overflow) { EXPECT_THROW(timeToText32(4294197632LU), InvalidTime); } -} // namespace \ No newline at end of file +} // namespace diff --git a/src/lib/dns/txt_like.h b/src/lib/dns/txt_like.h index f88b1a6a6e..7492f85db7 100644 --- a/src/lib/dns/txt_like.h +++ b/src/lib/dns/txt_like.h @@ -52,7 +52,7 @@ public: do { const uint8_t len = buffer.readUint8(); - if (rdata_len < len + 1) { + if (rdata_len < static_cast(len) + 1) { isc_throw(DNSMessageFORMERR, "Error in parsing " << RRType(typeCode) << " RDATA: character string length is too large: " <<