aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/google/protobuf/message.cc
diff options
context:
space:
mode:
authorGravatar kenton@google.com <kenton@google.com@630680e5-0e50-0410-840e-4b1c322b438d>2009-12-22 19:43:41 +0000
committerGravatar kenton@google.com <kenton@google.com@630680e5-0e50-0410-840e-4b1c322b438d>2009-12-22 19:43:41 +0000
commitd6e84b3ed8ed5e0a3e16959abe23a876de13c314 (patch)
treeca82c27159a486de45569adb066353009b12f15e /src/google/protobuf/message.cc
parent28e46df3e9ae576bbde956927eba6332acf90cdf (diff)
When serializing to an ostream, verify that there were no stream-level errors before returning success.
Diffstat (limited to 'src/google/protobuf/message.cc')
-rw-r--r--src/google/protobuf/message.cc7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/google/protobuf/message.cc b/src/google/protobuf/message.cc
index 09166f3a..91e6878e 100644
--- a/src/google/protobuf/message.cc
+++ b/src/google/protobuf/message.cc
@@ -168,8 +168,11 @@ bool Message::SerializePartialToFileDescriptor(int file_descriptor) const {
}
bool Message::SerializeToOstream(ostream* output) const {
- io::OstreamOutputStream zero_copy_output(output);
- return SerializeToZeroCopyStream(&zero_copy_output);
+ {
+ io::OstreamOutputStream zero_copy_output(output);
+ if (!SerializeToZeroCopyStream(&zero_copy_output)) return false;
+ }
+ return output->good();
}
bool Message::SerializePartialToOstream(ostream* output) const {