Skip to content

Commit 82e78f7

Browse files
RaisinTendanielleadams
authored andcommittedMar 16, 2021
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: #37573 Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com> Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
1 parent fd7234c commit 82e78f7

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed
 

‎tools/inspector_protocol/encoding/encoding.cc

+3-2
Original file line numberDiff line numberDiff line change
@@ -833,8 +833,9 @@ void CBORTokenizer::ReadNextToken(bool enter_envelope) {
833833
// inspector_protocol, it's not a CBOR limitation), so we check
834834
// against the signed max, so that the allowable values are
835835
// 0, 1, 2, ... 2^31 - 1.
836-
if (!success || std::numeric_limits<int32_t>::max() <
837-
token_start_internal_value_) {
836+
if (!success ||
837+
static_cast<int64_t>(std::numeric_limits<int32_t>::max()) <
838+
static_cast<int64_t>(token_start_internal_value_)) {
838839
SetError(Error::CBOR_INVALID_INT32);
839840
return;
840841
}

‎tools/inspector_protocol/lib/encoding_cpp.template

+3-2
Original file line numberDiff line numberDiff line change
@@ -840,8 +840,9 @@ void CBORTokenizer::ReadNextToken(bool enter_envelope) {
840840
// inspector_protocol, it's not a CBOR limitation), so we check
841841
// against the signed max, so that the allowable values are
842842
// 0, 1, 2, ... 2^31 - 1.
843-
if (!success || std::numeric_limits<int32_t>::max() <
844-
token_start_internal_value_) {
843+
if (!success ||
844+
static_cast<int64_t>(std::numeric_limits<int32_t>::max()) <
845+
static_cast<int64_t>(token_start_internal_value_)) {
845846
SetError(Error::CBOR_INVALID_INT32);
846847
return;
847848
}

0 commit comments

Comments
 (0)
Please sign in to comment.