From 03ac7a14f2960bb5886007e4c1cf1c14ff348782 Mon Sep 17 00:00:00 2001 From: Abhishek Jain Date: Thu, 7 Jan 2021 11:11:44 +0530 Subject: [PATCH] Fix compiler warnings issue found in conformance_test_runner#8189 Signed-off-by: Abhishek Jain --- conformance/binary_json_conformance_suite.cc | 2 +- conformance/conformance_test_runner.cc | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/conformance/binary_json_conformance_suite.cc b/conformance/binary_json_conformance_suite.cc index 4a0d8e8480487..48bfa9660fa1c 100644 --- a/conformance/binary_json_conformance_suite.cc +++ b/conformance/binary_json_conformance_suite.cc @@ -300,7 +300,7 @@ const FieldDescriptor* GetFieldForOneofType(FieldDescriptor::Type type, } string UpperCase(string str) { - for (int i = 0; i < str.size(); i++) { + for (size_t i = 0; i < str.size(); i++) { str[i] = toupper(str[i]); } return str; diff --git a/conformance/conformance_test_runner.cc b/conformance/conformance_test_runner.cc index 9f893cb8e704f..a8855d423adea 100644 --- a/conformance/conformance_test_runner.cc +++ b/conformance/conformance_test_runner.cc @@ -297,7 +297,7 @@ void ForkPipeRunner::SpawnTestProgram() { std::vector argv; argv.push_back(executable.get()); - for (int i = 0; i < executable_args_.size(); ++i) { + for (size_t i = 0; i < executable_args_.size(); ++i) { argv.push_back(executable_args_[i].c_str()); } argv.push_back(nullptr); @@ -307,7 +307,8 @@ void ForkPipeRunner::SpawnTestProgram() { } void ForkPipeRunner::CheckedWrite(int fd, const void *buf, size_t len) { - if (write(fd, buf, len) != len) { + size_t bytes_write = write(fd, buf, len); + if (bytes_write != len) { GOOGLE_LOG(FATAL) << current_test_name_ << ": error writing to test program: " << strerror(errno); }