From 09630cf199b3f7971cbd758df036e1643d9371a8 Mon Sep 17 00:00:00 2001 From: Darshan Sen Date: Tue, 2 Mar 2021 20:22:54 +0530 Subject: [PATCH] tools: cherry-pick ffb34b6d5dbf0 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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::max() < | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^ 2563 | token_start_internal_value_) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ PR-URL: https://github.com/nodejs/node/pull/37573 Reviewed-By: Antoine du Hamel Reviewed-By: Benjamin Gruenbaum PR-URL: https://github.com/nodejs/node/pull/39725 Reviewed-By: Rich Trott Reviewed-By: James M Snell --- tools/inspector_protocol/encoding/encoding.cc | 5 +++-- 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 1513767a85592b..46bd67bc1356b5 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::max() < - token_start_internal_value_) { + if (!bytes_read || + static_cast(std::numeric_limits::max()) < + static_cast(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 e950acd6a6f34d..47662e71baf8de 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::max() < - token_start_internal_value_) { + if (!bytes_read || + static_cast(std::numeric_limits::max()) < + static_cast(token_start_internal_value_)) { SetError(Error::CBOR_INVALID_INT32); return; }