From 77eb45aad40c558dd80f795a082c4b921edd2b63 Mon Sep 17 00:00:00 2001 From: Darshan Sen Date: Tue, 2 Mar 2021 20:22:54 +0530 Subject: [PATCH] tools: fix compiler warning in inspector_protocol MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- 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 f7858c9a22ba64..c1078769c7feaf 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::max() < - token_start_internal_value_) { + if (!success || + 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 54a46ecd203d4d..6776471b6637c5 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::max() < - token_start_internal_value_) { + if (!success || + static_cast(std::numeric_limits::max()) < + static_cast(token_start_internal_value_)) { SetError(Error::CBOR_INVALID_INT32); return; }