From 292d7a31bb8fff409de5b387f30eee2262637c66 Mon Sep 17 00:00:00 2001 From: tg-at-google <taregaskin@google.com> Date: Wed, 27 May 2020 22:52:57 -0400 Subject: [PATCH 1/2] in resolution of [Wsign-compare] warning id 5 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Unsigned nature of 'output_stream.ByteCount()' implied by context ( the literal word count 😅 : ) ). If being more strict is prudent ( I don't think it is in this case ), the return type of 'output_stream.ByteCount()' could be explicitly set to an unsigned integer type. --- tensorflow/core/lib/strings/proto_serialization.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tensorflow/core/lib/strings/proto_serialization.cc b/tensorflow/core/lib/strings/proto_serialization.cc index 5ffc845d098..690ce411fc5 100644 --- a/tensorflow/core/lib/strings/proto_serialization.cc +++ b/tensorflow/core/lib/strings/proto_serialization.cc @@ -72,7 +72,7 @@ bool SerializeToBufferDeterministic(const protobuf::MessageLite& msg, protobuf::io::CodedOutputStream output_stream(&array_stream); output_stream.SetSerializationDeterministic(true); msg.SerializeWithCachedSizes(&output_stream); - return !output_stream.HadError() && size == output_stream.ByteCount(); + return !output_stream.HadError() && size == (size_t)(output_stream.ByteCount()); } bool AreSerializedProtosEqual(const protobuf::MessageLite& x, From 06e90f9afb086f657432d7596d23035c93c472ca Mon Sep 17 00:00:00 2001 From: Mihai Maruseac <mihai.maruseac@gmail.com> Date: Mon, 1 Jun 2020 16:10:30 +0000 Subject: [PATCH 2/2] Update tensorflow/core/lib/strings/proto_serialization.cc --- tensorflow/core/lib/strings/proto_serialization.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tensorflow/core/lib/strings/proto_serialization.cc b/tensorflow/core/lib/strings/proto_serialization.cc index 690ce411fc5..f2dfc346330 100644 --- a/tensorflow/core/lib/strings/proto_serialization.cc +++ b/tensorflow/core/lib/strings/proto_serialization.cc @@ -72,7 +72,7 @@ bool SerializeToBufferDeterministic(const protobuf::MessageLite& msg, protobuf::io::CodedOutputStream output_stream(&array_stream); output_stream.SetSerializationDeterministic(true); msg.SerializeWithCachedSizes(&output_stream); - return !output_stream.HadError() && size == (size_t)(output_stream.ByteCount()); + return !output_stream.HadError() && size == static_cast<size_t>(output_stream.ByteCount()); } bool AreSerializedProtosEqual(const protobuf::MessageLite& x,