aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/google/protobuf/io
diff options
context:
space:
mode:
authorGravatar Jisi Liu <jisi.liu@gmail.com>2017-07-18 15:38:30 -0700
committerGravatar Jisi Liu <jisi.liu@gmail.com>2017-07-18 15:38:30 -0700
commit09354db1434859a31a3c81abebcc4018d42f2715 (patch)
treeb87c7cdc2255e6c8062ab92b4082665cd698d753 /src/google/protobuf/io
parent9053033a5076f82cf18b823c31f352e95e5bfd8d (diff)
Merge from Google internal for 3.4 release
Diffstat (limited to 'src/google/protobuf/io')
-rw-r--r--src/google/protobuf/io/coded_stream.cc12
-rw-r--r--src/google/protobuf/io/coded_stream.h74
-rw-r--r--src/google/protobuf/io/printer.cc32
-rw-r--r--src/google/protobuf/io/printer.h10
-rw-r--r--src/google/protobuf/io/printer_unittest.cc77
-rw-r--r--src/google/protobuf/io/zero_copy_stream.cc3
-rw-r--r--src/google/protobuf/io/zero_copy_stream.h8
-rw-r--r--src/google/protobuf/io/zero_copy_stream_impl.cc7
-rw-r--r--src/google/protobuf/io/zero_copy_stream_impl.h3
-rw-r--r--src/google/protobuf/io/zero_copy_stream_impl_lite.cc16
-rw-r--r--src/google/protobuf/io/zero_copy_stream_impl_lite.h8
11 files changed, 150 insertions, 100 deletions
diff --git a/src/google/protobuf/io/coded_stream.cc b/src/google/protobuf/io/coded_stream.cc
index df4250e5..17eb0ffa 100644
--- a/src/google/protobuf/io/coded_stream.cc
+++ b/src/google/protobuf/io/coded_stream.cc
@@ -197,17 +197,7 @@ void CodedInputStream::PrintTotalBytesLimitError() {
"in google/protobuf/io/coded_stream.h.";
}
-bool CodedInputStream::Skip(int count) {
- if (count < 0) return false; // security: count is often user-supplied
-
- const int original_buffer_size = BufferSize();
-
- if (count <= original_buffer_size) {
- // Just skipping within the current buffer. Easy.
- Advance(count);
- return true;
- }
-
+bool CodedInputStream::SkipFallback(int count, int original_buffer_size) {
if (buffer_size_after_limit_ > 0) {
// We hit a limit inside this buffer. Advance to the limit and fail.
Advance(original_buffer_size);
diff --git a/src/google/protobuf/io/coded_stream.h b/src/google/protobuf/io/coded_stream.h
index 20d86143..bce05a39 100644
--- a/src/google/protobuf/io/coded_stream.h
+++ b/src/google/protobuf/io/coded_stream.h
@@ -184,7 +184,7 @@ class LIBPROTOBUF_EXPORT CodedInputStream {
// Skips a number of bytes. Returns false if an underlying read error
// occurs.
- bool Skip(int count);
+ inline bool Skip(int count);
// Sets *data to point directly at the unread part of the CodedInputStream's
// underlying buffer, and *size to the size of that buffer, but does not
@@ -261,7 +261,10 @@ class LIBPROTOBUF_EXPORT CodedInputStream {
// Always inline because this is only called in one place per parse loop
// but it is called for every iteration of said loop, so it should be fast.
// GCC doesn't want to inline this by default.
- GOOGLE_ATTRIBUTE_ALWAYS_INLINE uint32 ReadTag();
+ GOOGLE_ATTRIBUTE_ALWAYS_INLINE uint32 ReadTag() {
+ return last_tag_ = ReadTagNoLastTag();
+ }
+
GOOGLE_ATTRIBUTE_ALWAYS_INLINE uint32 ReadTagNoLastTag();
@@ -274,7 +277,12 @@ class LIBPROTOBUF_EXPORT CodedInputStream {
// because that can arise in several ways, and for best performance we want
// to avoid an extra "is tag == 0?" check here.)
GOOGLE_ATTRIBUTE_ALWAYS_INLINE std::pair<uint32, bool> ReadTagWithCutoff(
- uint32 cutoff);
+ uint32 cutoff) {
+ std::pair<uint32, bool> result = ReadTagWithCutoffNoLastTag(cutoff);
+ last_tag_ = result.first;
+ return result;
+ }
+
GOOGLE_ATTRIBUTE_ALWAYS_INLINE std::pair<uint32, bool> ReadTagWithCutoffNoLastTag(
uint32 cutoff);
@@ -316,6 +324,7 @@ class LIBPROTOBUF_EXPORT CodedInputStream {
// tag to make sure it had the right number, so it calls LastTagWas() on
// return from the embedded parser to check.
bool LastTagWas(uint32 expected);
+ void SetLastTag(uint32 tag) { last_tag_ = tag; }
// When parsing message (but NOT a group), this method must be called
// immediately after MergeFromCodedStream() returns (if it returns true)
@@ -584,6 +593,9 @@ class LIBPROTOBUF_EXPORT CodedInputStream {
// Private member functions.
+ // Fallback when Skip() goes past the end of the current buffer.
+ bool SkipFallback(int count, int original_buffer_size);
+
// Advance the buffer by a given number of bytes.
void Advance(int amount);
@@ -621,12 +633,6 @@ class LIBPROTOBUF_EXPORT CodedInputStream {
bool ReadLittleEndian32Fallback(uint32* value);
bool ReadLittleEndian64Fallback(uint64* value);
- template<bool update_last_tag>
- GOOGLE_ATTRIBUTE_ALWAYS_INLINE uint32 ReadTagImplementation();
- template<bool update_last_tag>
- GOOGLE_ATTRIBUTE_ALWAYS_INLINE
- std::pair<uint32, bool> ReadTagWithCutoffImplementation(uint32 cutoff);
-
// Fallback/slow methods for reading tags. These do not update last_tag_,
// but will set legitimate_message_end_ if we are at the end of the input
// stream.
@@ -1018,48 +1024,21 @@ inline bool CodedInputStream::ReadLittleEndian64(uint64* value) {
#endif
}
-inline uint32 CodedInputStream::ReadTag() {
- return ReadTagImplementation<true>();
-}
-
inline uint32 CodedInputStream::ReadTagNoLastTag() {
- return ReadTagImplementation<false>();
-}
-
-template<bool update_last_tag>
-inline uint32 CodedInputStream::ReadTagImplementation() {
uint32 v = 0;
if (GOOGLE_PREDICT_TRUE(buffer_ < buffer_end_)) {
v = *buffer_;
if (v < 0x80) {
- if (update_last_tag) {
- last_tag_ = v;
- }
Advance(1);
return v;
}
}
v = ReadTagFallback(v);
- if (update_last_tag) {
- last_tag_ = v;
- }
return v;
}
-inline std::pair<uint32, bool> CodedInputStream::ReadTagWithCutoff(
- uint32 cutoff) {
- return ReadTagWithCutoffImplementation<true>(cutoff);
-}
-
inline std::pair<uint32, bool> CodedInputStream::ReadTagWithCutoffNoLastTag(
uint32 cutoff) {
- return ReadTagWithCutoffImplementation<false>(cutoff);
-}
-
-template<bool update_last_tag>
-inline std::pair<uint32, bool>
-CodedInputStream::ReadTagWithCutoffImplementation(
- uint32 cutoff) {
// In performance-sensitive code we can expect cutoff to be a compile-time
// constant, and things like "cutoff >= kMax1ByteVarint" to be evaluated at
// compile time.
@@ -1072,9 +1051,6 @@ CodedInputStream::ReadTagWithCutoffImplementation(
if (static_cast<int8>(buffer_[0]) > 0) {
const uint32 kMax1ByteVarint = 0x7f;
uint32 tag = buffer_[0];
- if (update_last_tag) {
- last_tag_ = tag;
- }
Advance(1);
return std::make_pair(tag, cutoff >= kMax1ByteVarint || tag <= cutoff);
}
@@ -1086,9 +1062,6 @@ CodedInputStream::ReadTagWithCutoffImplementation(
GOOGLE_PREDICT_TRUE((buffer_[0] & ~buffer_[1]) >= 0x80)) {
const uint32 kMax2ByteVarint = (0x7f << 7) + 0x7f;
uint32 tag = (1u << 7) * buffer_[1] + (buffer_[0] - 0x80);
- if (update_last_tag) {
- last_tag_ = tag;
- }
Advance(2);
// It might make sense to test for tag == 0 now, but it is so rare that
// that we don't bother. A varint-encoded 0 should be one byte unless
@@ -1102,9 +1075,6 @@ CodedInputStream::ReadTagWithCutoffImplementation(
}
// Slow path
const uint32 tag = ReadTagFallback(first_byte_or_zero);
- if (update_last_tag) {
- last_tag_ = tag;
- }
return std::make_pair(tag, static_cast<uint32>(tag - 1) < cutoff);
}
@@ -1430,6 +1400,20 @@ inline bool CodedInputStream::IsFlat() const {
return input_ == NULL;
}
+inline bool CodedInputStream::Skip(int count) {
+ if (count < 0) return false; // security: count is often user-supplied
+
+ const int original_buffer_size = BufferSize();
+
+ if (count <= original_buffer_size) {
+ // Just skipping within the current buffer. Easy.
+ Advance(count);
+ return true;
+ }
+
+ return SkipFallback(count, original_buffer_size);
+}
+
} // namespace io
} // namespace protobuf
diff --git a/src/google/protobuf/io/printer.cc b/src/google/protobuf/io/printer.cc
index 99e895f5..8493268d 100644
--- a/src/google/protobuf/io/printer.cc
+++ b/src/google/protobuf/io/printer.cc
@@ -111,6 +111,7 @@ void Printer::Print(const std::map<string, string>& variables,
int size = strlen(text);
int pos = 0; // The number of bytes we've written so far.
substitutions_.clear();
+ line_start_variables_.clear();
for (int i = 0; i < size; i++) {
if (text[i] == '\n') {
@@ -122,6 +123,7 @@ void Printer::Print(const std::map<string, string>& variables,
// Setting this true will cause the next WriteRaw() to insert an indent
// first.
at_start_of_line_ = true;
+ line_start_variables_.clear();
} else if (text[i] == variable_delimiter_) {
// Saw the start of a variable name.
@@ -148,12 +150,15 @@ void Printer::Print(const std::map<string, string>& variables,
if (iter == variables.end()) {
GOOGLE_LOG(DFATAL) << " Undefined variable: " << varname;
} else {
- size_t begin = offset_;
+ if (at_start_of_line_ && iter->second.empty()) {
+ line_start_variables_.push_back(varname);
+ }
WriteRaw(iter->second.data(), iter->second.size());
std::pair<std::map<string, std::pair<size_t, size_t> >::iterator,
bool>
- inserted = substitutions_.insert(
- std::make_pair(varname, std::make_pair(begin, offset_)));
+ inserted = substitutions_.insert(std::make_pair(
+ varname,
+ std::make_pair(offset_ - iter->second.size(), offset_)));
if (!inserted.second) {
// This variable was used multiple times. Make its span have
// negative length so we can detect it if it gets used in an
@@ -319,10 +324,29 @@ void Printer::WriteRaw(const char* data, int size) {
if (at_start_of_line_ && (size > 0) && (data[0] != '\n')) {
// Insert an indent.
at_start_of_line_ = false;
- WriteRaw(indent_.data(), indent_.size());
+ CopyToBuffer(indent_.data(), indent_.size());
if (failed_) return;
+ // Fix up empty variables (e.g., "{") that should be annotated as
+ // coming after the indent.
+ for (std::vector<string>::iterator i = line_start_variables_.begin();
+ i != line_start_variables_.end(); ++i) {
+ substitutions_[*i].first += indent_.size();
+ substitutions_[*i].second += indent_.size();
+ }
}
+ // If we're going to write any data, clear line_start_variables_, since
+ // we've either updated them in the block above or they no longer refer to
+ // the current line.
+ line_start_variables_.clear();
+
+ CopyToBuffer(data, size);
+}
+
+void Printer::CopyToBuffer(const char* data, int size) {
+ if (failed_) return;
+ if (size == 0) return;
+
while (size > buffer_size_) {
// Data exceeds space in the buffer. Copy what we can and request a
// new buffer.
diff --git a/src/google/protobuf/io/printer.h b/src/google/protobuf/io/printer.h
index e666445b..d11745ce 100644
--- a/src/google/protobuf/io/printer.h
+++ b/src/google/protobuf/io/printer.h
@@ -157,7 +157,7 @@ class AnnotationProtoCollector : public AnnotationCollector {
// vars["function"] = "call";
// vars["mark"] = "";
// printer.Print(vars, "$function$($foo$,$foo$)$mark$");
-// printer.Annotate("function", "rmark", call_);
+// printer.Annotate("function", "mark", call_);
//
// This code associates the span covering "call(bar,bar)" in the output with the
// call_ descriptor.
@@ -311,6 +311,9 @@ class LIBPROTOBUF_EXPORT Printer {
void Annotate(const char* begin_varname, const char* end_varname,
const string& file_path, const std::vector<int>& path);
+ // Copy size worth of bytes from data to buffer_.
+ void CopyToBuffer(const char* data, int size);
+
const char variable_delimiter_;
ZeroCopyOutputStream* const output_;
@@ -334,6 +337,11 @@ class LIBPROTOBUF_EXPORT Printer {
// length of the substituted string).
std::map<string, std::pair<size_t, size_t> > substitutions_;
+ // Keeps track of the keys in substitutions_ that need to be updated when
+ // indents are inserted. These are keys that refer to the beginning of the
+ // current line.
+ std::vector<string> line_start_variables_;
+
// Returns true and sets range to the substitution range in the output for
// varname if varname was used once in the last call to Print. If varname
// was not used, or if it was used multiple times, returns false (and
diff --git a/src/google/protobuf/io/printer_unittest.cc b/src/google/protobuf/io/printer_unittest.cc
index 0435228a..d0a0ebee 100644
--- a/src/google/protobuf/io/printer_unittest.cc
+++ b/src/google/protobuf/io/printer_unittest.cc
@@ -360,6 +360,83 @@ TEST(Printer, AnnotateDespiteUnrelatedMultipleUses) {
EXPECT_EQ(7, bar->end());
}
+TEST(Printer, AnnotateIndent) {
+ char buffer[8192];
+ ArrayOutputStream output(buffer, sizeof(buffer));
+ GeneratedCodeInfo info;
+ AnnotationProtoCollector<GeneratedCodeInfo> info_collector(&info);
+ {
+ Printer printer(&output, '$', &info_collector);
+ printer.Print("0\n");
+ printer.Indent();
+ printer.Print("$foo$", "foo", "4");
+ std::vector<int> path;
+ path.push_back(44);
+ MockDescriptor descriptor("path", path);
+ printer.Annotate("foo", &descriptor);
+ printer.Print(",\n");
+ printer.Print("$bar$", "bar", "9");
+ path[0] = 99;
+ MockDescriptor descriptor_two("path", path);
+ printer.Annotate("bar", &descriptor_two);
+ printer.Print("\n${$$D$$}$\n", "{", "", "}", "", "D", "d");
+ path[0] = 1313;
+ MockDescriptor descriptor_three("path", path);
+ printer.Annotate("{", "}", &descriptor_three);
+ printer.Outdent();
+ printer.Print("\n");
+ }
+ buffer[output.ByteCount()] = '\0';
+ EXPECT_STREQ("0\n 4,\n 9\n d\n\n", buffer);
+ ASSERT_EQ(3, info.annotation_size());
+ const GeneratedCodeInfo::Annotation* foo = &info.annotation(0);
+ ASSERT_EQ(1, foo->path_size());
+ EXPECT_EQ(44, foo->path(0));
+ EXPECT_EQ("path", foo->source_file());
+ EXPECT_EQ(4, foo->begin());
+ EXPECT_EQ(5, foo->end());
+ const GeneratedCodeInfo::Annotation* bar = &info.annotation(1);
+ ASSERT_EQ(1, bar->path_size());
+ EXPECT_EQ(99, bar->path(0));
+ EXPECT_EQ("path", bar->source_file());
+ EXPECT_EQ(9, bar->begin());
+ EXPECT_EQ(10, bar->end());
+ const GeneratedCodeInfo::Annotation* braces = &info.annotation(2);
+ ASSERT_EQ(1, braces->path_size());
+ EXPECT_EQ(1313, braces->path(0));
+ EXPECT_EQ("path", braces->source_file());
+ EXPECT_EQ(13, braces->begin());
+ EXPECT_EQ(14, braces->end());
+}
+
+TEST(Printer, AnnotateIndentNewline) {
+ char buffer[8192];
+ ArrayOutputStream output(buffer, sizeof(buffer));
+ GeneratedCodeInfo info;
+ AnnotationProtoCollector<GeneratedCodeInfo> info_collector(&info);
+ {
+ Printer printer(&output, '$', &info_collector);
+ printer.Indent();
+ printer.Print("$A$$N$$B$C\n", "A", "", "N", "\nz", "B", "");
+ std::vector<int> path;
+ path.push_back(0);
+ MockDescriptor descriptor("path", path);
+ printer.Annotate("A", "B", &descriptor);
+ printer.Outdent();
+ printer.Print("\n");
+ }
+ buffer[output.ByteCount()] = '\0';
+ EXPECT_STREQ("\nz C\n\n", buffer);
+ ASSERT_EQ(1, info.annotation_size());
+ const GeneratedCodeInfo::Annotation* ab = &info.annotation(0);
+ ASSERT_EQ(1, ab->path_size());
+ EXPECT_EQ(0, ab->path(0));
+ EXPECT_EQ("path", ab->source_file());
+ EXPECT_EQ(0, ab->begin());
+ EXPECT_EQ(4, ab->end());
+}
+
+
TEST(Printer, Indenting) {
char buffer[8192];
diff --git a/src/google/protobuf/io/zero_copy_stream.cc b/src/google/protobuf/io/zero_copy_stream.cc
index 186de001..f81555e5 100644
--- a/src/google/protobuf/io/zero_copy_stream.cc
+++ b/src/google/protobuf/io/zero_copy_stream.cc
@@ -41,9 +41,6 @@ namespace google {
namespace protobuf {
namespace io {
-ZeroCopyInputStream::~ZeroCopyInputStream() {}
-ZeroCopyOutputStream::~ZeroCopyOutputStream() {}
-
bool ZeroCopyOutputStream::WriteAliasedRaw(const void* /* data */,
int /* size */) {
diff --git a/src/google/protobuf/io/zero_copy_stream.h b/src/google/protobuf/io/zero_copy_stream.h
index 52650fc6..62ace7ae 100644
--- a/src/google/protobuf/io/zero_copy_stream.h
+++ b/src/google/protobuf/io/zero_copy_stream.h
@@ -123,8 +123,8 @@ class ZeroCopyOutputStream;
// copying.
class LIBPROTOBUF_EXPORT ZeroCopyInputStream {
public:
- inline ZeroCopyInputStream() {}
- virtual ~ZeroCopyInputStream();
+ ZeroCopyInputStream() {}
+ virtual ~ZeroCopyInputStream() {}
// Obtains a chunk of data from the stream.
//
@@ -180,8 +180,8 @@ class LIBPROTOBUF_EXPORT ZeroCopyInputStream {
// copying.
class LIBPROTOBUF_EXPORT ZeroCopyOutputStream {
public:
- inline ZeroCopyOutputStream() {}
- virtual ~ZeroCopyOutputStream();
+ ZeroCopyOutputStream() {}
+ virtual ~ZeroCopyOutputStream() {}
// Obtains a buffer into which data can be written. Any data written
// into this buffer will eventually (maybe instantly, maybe later on)
diff --git a/src/google/protobuf/io/zero_copy_stream_impl.cc b/src/google/protobuf/io/zero_copy_stream_impl.cc
index 109c55c1..d638ec05 100644
--- a/src/google/protobuf/io/zero_copy_stream_impl.cc
+++ b/src/google/protobuf/io/zero_copy_stream_impl.cc
@@ -81,8 +81,6 @@ FileInputStream::FileInputStream(int file_descriptor, int block_size)
impl_(&copying_input_, block_size) {
}
-FileInputStream::~FileInputStream() {}
-
bool FileInputStream::Close() {
return copying_input_.Close();
}
@@ -273,8 +271,6 @@ bool FileOutputStream::CopyingFileOutputStream::Write(
IstreamInputStream::IstreamInputStream(std::istream* input, int block_size)
: copying_input_(input), impl_(&copying_input_, block_size) {}
-IstreamInputStream::~IstreamInputStream() {}
-
bool IstreamInputStream::Next(const void** data, int* size) {
return impl_.Next(data, size);
}
@@ -348,9 +344,6 @@ ConcatenatingInputStream::ConcatenatingInputStream(
: streams_(streams), stream_count_(count), bytes_retired_(0) {
}
-ConcatenatingInputStream::~ConcatenatingInputStream() {
-}
-
bool ConcatenatingInputStream::Next(const void** data, int* size) {
while (stream_count_ > 0) {
if (streams_[0]->Next(data, size)) return true;
diff --git a/src/google/protobuf/io/zero_copy_stream_impl.h b/src/google/protobuf/io/zero_copy_stream_impl.h
index 3365790e..ea978bfb 100644
--- a/src/google/protobuf/io/zero_copy_stream_impl.h
+++ b/src/google/protobuf/io/zero_copy_stream_impl.h
@@ -67,7 +67,6 @@ class LIBPROTOBUF_EXPORT FileInputStream : public ZeroCopyInputStream {
// should be read and returned with each call to Next(). Otherwise,
// a reasonable default is used.
explicit FileInputStream(int file_descriptor, int block_size = -1);
- ~FileInputStream();
// Flushes any buffers and closes the underlying file. Returns false if
// an error occurs during the process; use GetErrno() to examine the error.
@@ -219,7 +218,6 @@ class LIBPROTOBUF_EXPORT IstreamInputStream : public ZeroCopyInputStream {
// should be read and returned with each call to Next(). Otherwise,
// a reasonable default is used.
explicit IstreamInputStream(std::istream* stream, int block_size = -1);
- ~IstreamInputStream();
// implements ZeroCopyInputStream ----------------------------------
bool Next(const void** data, int* size);
@@ -306,7 +304,6 @@ class LIBPROTOBUF_EXPORT ConcatenatingInputStream : public ZeroCopyInputStream {
// All streams passed in as well as the array itself must remain valid
// until the ConcatenatingInputStream is destroyed.
ConcatenatingInputStream(ZeroCopyInputStream* const streams[], int count);
- ~ConcatenatingInputStream();
// implements ZeroCopyInputStream ----------------------------------
bool Next(const void** data, int* size);
diff --git a/src/google/protobuf/io/zero_copy_stream_impl_lite.cc b/src/google/protobuf/io/zero_copy_stream_impl_lite.cc
index e6ca88c2..60c71c80 100644
--- a/src/google/protobuf/io/zero_copy_stream_impl_lite.cc
+++ b/src/google/protobuf/io/zero_copy_stream_impl_lite.cc
@@ -64,9 +64,6 @@ ArrayInputStream::ArrayInputStream(const void* data, int size,
last_returned_size_(0) {
}
-ArrayInputStream::~ArrayInputStream() {
-}
-
bool ArrayInputStream::Next(const void** data, int* size) {
if (position_ < size_) {
last_returned_size_ = std::min(block_size_, size_ - position_);
@@ -117,9 +114,6 @@ ArrayOutputStream::ArrayOutputStream(void* data, int size, int block_size)
last_returned_size_(0) {
}
-ArrayOutputStream::~ArrayOutputStream() {
-}
-
bool ArrayOutputStream::Next(void** data, int* size) {
if (position_ < size_) {
last_returned_size_ = std::min(block_size_, size_ - position_);
@@ -153,9 +147,6 @@ StringOutputStream::StringOutputStream(string* target)
: target_(target) {
}
-StringOutputStream::~StringOutputStream() {
-}
-
bool StringOutputStream::Next(void** data, int* size) {
GOOGLE_CHECK(target_ != NULL);
int old_size = target_->size();
@@ -212,9 +203,6 @@ LazyStringOutputStream::LazyStringOutputStream(
string_is_set_(false) {
}
-LazyStringOutputStream::~LazyStringOutputStream() {
-}
-
bool LazyStringOutputStream::Next(void** data, int* size) {
if (!string_is_set_) {
SetString(callback_->Run());
@@ -229,8 +217,6 @@ int64 LazyStringOutputStream::ByteCount() const {
// ===================================================================
-CopyingInputStream::~CopyingInputStream() {}
-
int CopyingInputStream::Skip(int count) {
char junk[4096];
int skipped = 0;
@@ -350,8 +336,6 @@ void CopyingInputStreamAdaptor::FreeBuffer() {
// ===================================================================
-CopyingOutputStream::~CopyingOutputStream() {}
-
CopyingOutputStreamAdaptor::CopyingOutputStreamAdaptor(
CopyingOutputStream* copying_stream, int block_size)
: copying_stream_(copying_stream),
diff --git a/src/google/protobuf/io/zero_copy_stream_impl_lite.h b/src/google/protobuf/io/zero_copy_stream_impl_lite.h
index 6db1d695..a7bbc625 100644
--- a/src/google/protobuf/io/zero_copy_stream_impl_lite.h
+++ b/src/google/protobuf/io/zero_copy_stream_impl_lite.h
@@ -73,7 +73,6 @@ class LIBPROTOBUF_EXPORT ArrayInputStream : public ZeroCopyInputStream {
// useful for testing; in production you would probably never want to set
// it.
ArrayInputStream(const void* data, int size, int block_size = -1);
- ~ArrayInputStream();
// implements ZeroCopyInputStream ----------------------------------
bool Next(const void** data, int* size);
@@ -107,7 +106,6 @@ class LIBPROTOBUF_EXPORT ArrayOutputStream : public ZeroCopyOutputStream {
// useful for testing; in production you would probably never want to set
// it.
ArrayOutputStream(void* data, int size, int block_size = -1);
- ~ArrayOutputStream();
// implements ZeroCopyOutputStream ---------------------------------
bool Next(void** data, int* size);
@@ -141,7 +139,6 @@ class LIBPROTOBUF_EXPORT StringOutputStream : public ZeroCopyOutputStream {
// the first call to Next() will return at least n bytes of buffer
// space.
explicit StringOutputStream(string* target);
- ~StringOutputStream();
// implements ZeroCopyOutputStream ---------------------------------
bool Next(void** data, int* size);
@@ -167,7 +164,6 @@ class LIBPROTOBUF_EXPORT LazyStringOutputStream : public StringOutputStream {
// Callback should be permanent (non-self-deleting). Ownership is transferred
// to the LazyStringOutputStream.
explicit LazyStringOutputStream(ResultCallback<string*>* callback);
- ~LazyStringOutputStream();
// implements ZeroCopyOutputStream, overriding StringOutputStream -----------
bool Next(void** data, int* size);
@@ -199,7 +195,7 @@ class LIBPROTOBUF_EXPORT LazyStringOutputStream : public StringOutputStream {
// in large blocks.
class LIBPROTOBUF_EXPORT CopyingInputStream {
public:
- virtual ~CopyingInputStream();
+ virtual ~CopyingInputStream() {}
// Reads up to "size" bytes into the given buffer. Returns the number of
// bytes read. Read() waits until at least one byte is available, or
@@ -293,7 +289,7 @@ class LIBPROTOBUF_EXPORT CopyingInputStreamAdaptor : public ZeroCopyInputStream
// in large blocks.
class LIBPROTOBUF_EXPORT CopyingOutputStream {
public:
- virtual ~CopyingOutputStream();
+ virtual ~CopyingOutputStream() {}
// Writes "size" bytes from the given buffer to the output. Returns true
// if successful, false on a write error.