diff options
author | Darshan Sen <raisinten@gmail.com> | 2021-03-02 17:52:54 +0300 |
---|---|---|
committer | Michaël Zasso <targos@protonmail.com> | 2021-09-04 16:14:51 +0300 |
commit | 09630cf199b3f7971cbd758df036e1643d9371a8 (patch) | |
tree | 38e5d1e41966596da008470e2e270c0179b24e60 /tools | |
parent | 53300d33c7c9253da49e063d393a8ae915d5bfdf (diff) |
tools: cherry-pick ffb34b6d5dbf0
Original commit message:
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>
PR-URL: https://github.com/nodejs/node/pull/39725
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: James M Snell <jasnell@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 1513767a855..46bd67bc135 100644 --- a/tools/inspector_protocol/encoding/encoding.cc +++ b/tools/inspector_protocol/encoding/encoding.cc @@ -831,8 +831,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 (!bytes_read || std::numeric_limits<int32_t>::max() < - token_start_internal_value_) { + if (!bytes_read || + 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 e950acd6a6f..47662e71baf 100644 --- a/tools/inspector_protocol/lib/encoding_cpp.template +++ b/tools/inspector_protocol/lib/encoding_cpp.template @@ -839,8 +839,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 (!bytes_read || std::numeric_limits<int32_t>::max() < - token_start_internal_value_) { + if (!bytes_read || + static_cast<int64_t>(std::numeric_limits<int32_t>::max()) < + static_cast<int64_t>(token_start_internal_value_)) { SetError(Error::CBOR_INVALID_INT32); return; } |