diff options
author | Darshan Sen <raisinten@gmail.com> | 2021-03-02 17:52:54 +0300 |
---|---|---|
committer | Danielle Adams <adamzdanielle@gmail.com> | 2021-03-16 15:55:13 +0300 |
commit | 82e78f7c12836a5426e94ab002a7f6acf351c745 (patch) | |
tree | 33009b4cde583bd9a3d3b5e489ada5881afe78fe /tools | |
parent | fd7234c52fe924a1e391a59525b661a72baac19d (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; } |