diff options
author | Darshan Sen <raisinten@gmail.com> | 2021-03-02 17:52:54 +0300 |
---|---|---|
committer | Michaël Zasso <targos@protonmail.com> | 2021-05-01 13:25:17 +0300 |
commit | 77eb45aad40c558dd80f795a082c4b921edd2b63 (patch) | |
tree | 6eafbbc1155833fd25b4d1dade1bc7def1a0b272 /tools | |
parent | bd38dfbfcc5af7adb667c7e1c64e82c1e5a844fc (diff) |
tools: fix compiler warning in inspector_protocol
error: comparison of integer expressions of different signedness:
‘int’ and ‘uint64_t’ {aka ‘long unsigned int’} [-Werror=sign-compare]
2562 | if (!success || std::numeric_limits<int32_t>::max() <
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
2563 | token_start_internal_value_) {
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~
PR-URL: https://github.com/nodejs/node/pull/37573
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Diffstat (limited to 'tools')
-rw-r--r-- | tools/inspector_protocol/encoding/encoding.cc | 5 | ||||
-rw-r--r-- | tools/inspector_protocol/lib/encoding_cpp.template | 5 |
2 files changed, 6 insertions, 4 deletions
diff --git a/tools/inspector_protocol/encoding/encoding.cc b/tools/inspector_protocol/encoding/encoding.cc index f7858c9a22b..c1078769c7f 100644 --- a/tools/inspector_protocol/encoding/encoding.cc +++ b/tools/inspector_protocol/encoding/encoding.cc @@ -833,8 +833,9 @@ void CBORTokenizer::ReadNextToken(bool enter_envelope) { // inspector_protocol, it's not a CBOR limitation), so we check // against the signed max, so that the allowable values are // 0, 1, 2, ... 2^31 - 1. - if (!success || std::numeric_limits<int32_t>::max() < - token_start_internal_value_) { + if (!success || + static_cast<int64_t>(std::numeric_limits<int32_t>::max()) < + static_cast<int64_t>(token_start_internal_value_)) { SetError(Error::CBOR_INVALID_INT32); return; } diff --git a/tools/inspector_protocol/lib/encoding_cpp.template b/tools/inspector_protocol/lib/encoding_cpp.template index 54a46ecd203..6776471b663 100644 --- a/tools/inspector_protocol/lib/encoding_cpp.template +++ b/tools/inspector_protocol/lib/encoding_cpp.template @@ -840,8 +840,9 @@ void CBORTokenizer::ReadNextToken(bool enter_envelope) { // inspector_protocol, it's not a CBOR limitation), so we check // against the signed max, so that the allowable values are // 0, 1, 2, ... 2^31 - 1. - if (!success || std::numeric_limits<int32_t>::max() < - token_start_internal_value_) { + if (!success || + static_cast<int64_t>(std::numeric_limits<int32_t>::max()) < + static_cast<int64_t>(token_start_internal_value_)) { SetError(Error::CBOR_INVALID_INT32); return; } |