Destruct CodedOutputStream instead of using Trim()

This commit is contained in:
Martin Pärtel 2020-02-12 08:47:24 +02:00 committed by Adam Cozzette
parent f6902d6afe
commit 82a057596e

View File

@ -2229,17 +2229,19 @@ bool CommandLineInterface::WriteDescriptorSet(
io::FileOutputStream out(fd); io::FileOutputStream out(fd);
io::CodedOutputStream coded_out(&out); {
// Determinism is useful here because build outputs are sometimes checked io::CodedOutputStream coded_out(&out);
// into version control. // Determinism is useful here because build outputs are sometimes checked
coded_out.SetSerializationDeterministic(true); // into version control.
if (!file_set.SerializeToCodedStream(&coded_out)) { coded_out.SetSerializationDeterministic(true);
std::cerr << descriptor_set_out_name_ << ": " << strerror(out.GetErrno()) if (!file_set.SerializeToCodedStream(&coded_out)) {
<< std::endl; std::cerr << descriptor_set_out_name_ << ": " << strerror(out.GetErrno())
out.Close(); << std::endl;
return false; out.Close();
return false;
}
} }
coded_out.Trim();
if (!out.Close()) { if (!out.Close()) {
std::cerr << descriptor_set_out_name_ << ": " << strerror(out.GetErrno()) std::cerr << descriptor_set_out_name_ << ": " << strerror(out.GetErrno())
<< std::endl; << std::endl;