From 42ca7c206316978a8efff46c09bc2a495a88c4bc Mon Sep 17 00:00:00 2001
From: tg-at-google <taregaskin@google.com>
Date: Wed, 27 May 2020 16:22:38 +0000
Subject: [PATCH] in resolution of [Wsign-compare] warning id 1

---
 tensorflow/core/platform/protobuf.cc | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/tensorflow/core/platform/protobuf.cc b/tensorflow/core/platform/protobuf.cc
index 1912ab11e62..a9a467e2813 100644
--- a/tensorflow/core/platform/protobuf.cc
+++ b/tensorflow/core/platform/protobuf.cc
@@ -23,7 +23,7 @@ const char* kProtobufUint64Typename = "::tensorflow::protobuf_uint64";
 TStringOutputStream::TStringOutputStream(tstring* target) : target_(target) {}
 
 bool TStringOutputStream::Next(void** data, int* size) {
-  int old_size = target_->size();
+  size_t old_size = target_->size();
 
   // Grow the string.
   if (old_size < target_->capacity()) {
@@ -32,7 +32,7 @@ bool TStringOutputStream::Next(void** data, int* size) {
     target_->resize_uninitialized(target_->capacity());
   } else {
     // Size has reached capacity, try to double the size.
-    if (old_size > std::numeric_limits<int>::max() / 2) {
+    if (old_size > std::numeric_limits<size_t>::max() / 2) {
       // Can not double the size otherwise it is going to cause integer
       // overflow in the expression below: old_size * 2 ";
       return false;
@@ -41,7 +41,7 @@ bool TStringOutputStream::Next(void** data, int* size) {
     // kMinimumSize.
     target_->resize_uninitialized(
         std::max(old_size * 2,
-                 kMinimumSize + 0));  // "+ 0" works around GCC4 weirdness.
+                 (size_t)kMinimumSize + 0));  // "+ 0" works around GCC4 weirdness.
   }
 
   *data = target_->data() + old_size;