| Index: third_party/protobuf/patches/0002-revert-patch-internal-change-111557819.patch
|
| diff --git a/third_party/protobuf/patches/0002-revert-patch-internal-change-111557819.patch b/third_party/protobuf/patches/0002-revert-patch-internal-change-111557819.patch
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..8d31af23e7508095cfee67f7407ddcda0ed265c0
|
| --- /dev/null
|
| +++ b/third_party/protobuf/patches/0002-revert-patch-internal-change-111557819.patch
|
| @@ -0,0 +1,323 @@
|
| +From 6be517aa1ada68d9245c90f82902600ca99bb72f Mon Sep 17 00:00:00 2001
|
| +From: Adam Michalik <xyzzyz@google.com>
|
| +Date: Thu, 19 May 2016 15:00:25 -0700
|
| +Subject: [PATCH] Revert "Patch internal change 111557819."
|
| +
|
| +This reverts commit 76195058e25d19fc918996d55d3ad69ee55cb77e.
|
| +---
|
| + src/google/protobuf/compiler/cpp/cpp_message.cc | 30 ++------
|
| + src/google/protobuf/io/coded_stream.cc | 18 -----
|
| + src/google/protobuf/io/coded_stream.h | 1 -
|
| + .../protobuf/io/zero_copy_stream_impl_lite.cc | 31 --------
|
| + .../protobuf/io/zero_copy_stream_impl_lite.h | 24 -------
|
| + src/google/protobuf/stubs/callback.h | 83 ----------------------
|
| + 6 files changed, 5 insertions(+), 182 deletions(-)
|
| +
|
| +diff --git a/src/google/protobuf/compiler/cpp/cpp_message.cc b/src/google/protobuf/compiler/cpp/cpp_message.cc
|
| +index da2a4c9..0cefd4e 100644
|
| +--- a/src/google/protobuf/compiler/cpp/cpp_message.cc
|
| ++++ b/src/google/protobuf/compiler/cpp/cpp_message.cc
|
| +@@ -1775,18 +1775,6 @@ GenerateShutdownCode(io::Printer* printer) {
|
| +
|
| + void MessageGenerator::
|
| + GenerateClassMethods(io::Printer* printer) {
|
| +- // mutable_unknown_fields wrapper function for LazyStringOutputStream
|
| +- // callback.
|
| +- if (PreserveUnknownFields(descriptor_) &&
|
| +- !UseUnknownFieldSet(descriptor_->file(), options_)) {
|
| +- printer->Print(
|
| +- "static ::std::string* MutableUnknownFieldsFor$classname$(\n"
|
| +- " $classname$* ptr) {\n"
|
| +- " return ptr->mutable_unknown_fields();\n"
|
| +- "}\n"
|
| +- "\n",
|
| +- "classname", classname_);
|
| +- }
|
| + if (IsAnyMessage(descriptor_)) {
|
| + printer->Print(
|
| + "void $classname$::PackFrom(const ::google::protobuf::Message& message) {\n"
|
| +@@ -2849,9 +2837,7 @@ GenerateMergeFrom(io::Printer* printer) {
|
| + "}\n");
|
| + } else {
|
| + printer->Print(
|
| +- "if (!from.unknown_fields().empty()) {\n"
|
| +- " mutable_unknown_fields()->append(from.unknown_fields());\n"
|
| +- "}\n");
|
| ++ "mutable_unknown_fields()->append(from.unknown_fields());\n");
|
| + }
|
| + }
|
| +
|
| +@@ -2929,18 +2915,12 @@ GenerateMergeFromCodedStream(io::Printer* printer) {
|
| + " ::google::protobuf::uint32 tag;\n",
|
| + "classname", classname_);
|
| +
|
| +- if (PreserveUnknownFields(descriptor_) &&
|
| +- !UseUnknownFieldSet(descriptor_->file(), options_)) {
|
| +- // Use LazyStringOutputString to avoid initializing unknown fields string
|
| +- // unless it is actually needed. For the same reason, disable eager refresh
|
| +- // on the CodedOutputStream.
|
| ++ if (!UseUnknownFieldSet(descriptor_->file())) {
|
| + printer->Print(
|
| +- " ::google::protobuf::io::LazyStringOutputStream unknown_fields_string(\n"
|
| +- " ::google::protobuf::internal::NewPermanentCallback(\n"
|
| +- " &MutableUnknownFieldsFor$classname$, this));\n"
|
| ++ " ::google::protobuf::io::StringOutputStream unknown_fields_string(\n"
|
| ++ " mutable_unknown_fields());\n"
|
| + " ::google::protobuf::io::CodedOutputStream unknown_fields_stream(\n"
|
| +- " &unknown_fields_string, false);\n",
|
| +- "classname", classname_);
|
| ++ " &unknown_fields_string);\n");
|
| + }
|
| +
|
| + printer->Print(
|
| +diff --git a/src/google/protobuf/io/coded_stream.cc b/src/google/protobuf/io/coded_stream.cc
|
| +index d8354c1..7df2fed 100644
|
| +--- a/src/google/protobuf/io/coded_stream.cc
|
| ++++ b/src/google/protobuf/io/coded_stream.cc
|
| +@@ -629,24 +629,6 @@ CodedOutputStream::CodedOutputStream(ZeroCopyOutputStream* output)
|
| + had_error_ = false;
|
| + }
|
| +
|
| +-CodedOutputStream::CodedOutputStream(ZeroCopyOutputStream* output,
|
| +- bool do_eager_refresh)
|
| +- : output_(output),
|
| +- buffer_(NULL),
|
| +- buffer_size_(0),
|
| +- total_bytes_(0),
|
| +- had_error_(false),
|
| +- aliasing_enabled_(false) {
|
| +- if (do_eager_refresh) {
|
| +- // Eagerly Refresh() so buffer space is immediately available.
|
| +- Refresh();
|
| +- // The Refresh() may have failed. If the client doesn't write any data,
|
| +- // though, don't consider this an error. If the client does write data, then
|
| +- // another Refresh() will be attempted and it will set the error once again.
|
| +- had_error_ = false;
|
| +- }
|
| +-}
|
| +-
|
| + CodedOutputStream::~CodedOutputStream() {
|
| + Trim();
|
| + }
|
| +diff --git a/src/google/protobuf/io/coded_stream.h b/src/google/protobuf/io/coded_stream.h
|
| +index c81a33a..f211c69 100644
|
| +--- a/src/google/protobuf/io/coded_stream.h
|
| ++++ b/src/google/protobuf/io/coded_stream.h
|
| +@@ -666,7 +666,6 @@ class LIBPROTOBUF_EXPORT CodedOutputStream {
|
| + public:
|
| + // Create an CodedOutputStream that writes to the given ZeroCopyOutputStream.
|
| + explicit CodedOutputStream(ZeroCopyOutputStream* output);
|
| +- CodedOutputStream(ZeroCopyOutputStream* output, bool do_eager_refresh);
|
| +
|
| + // Destroy the CodedOutputStream and position the underlying
|
| + // ZeroCopyOutputStream immediately after the last byte written.
|
| +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 e6ca88c..b6b85f4 100644
|
| +--- a/src/google/protobuf/io/zero_copy_stream_impl_lite.cc
|
| ++++ b/src/google/protobuf/io/zero_copy_stream_impl_lite.cc
|
| +@@ -157,7 +157,6 @@ StringOutputStream::~StringOutputStream() {
|
| + }
|
| +
|
| + bool StringOutputStream::Next(void** data, int* size) {
|
| +- GOOGLE_CHECK(target_ != NULL);
|
| + int old_size = target_->size();
|
| +
|
| + // Grow the string.
|
| +@@ -189,44 +188,14 @@ bool StringOutputStream::Next(void** data, int* size) {
|
| +
|
| + void StringOutputStream::BackUp(int count) {
|
| + GOOGLE_CHECK_GE(count, 0);
|
| +- GOOGLE_CHECK(target_ != NULL);
|
| + GOOGLE_CHECK_LE(count, target_->size());
|
| + target_->resize(target_->size() - count);
|
| + }
|
| +
|
| + int64 StringOutputStream::ByteCount() const {
|
| +- GOOGLE_CHECK(target_ != NULL);
|
| + return target_->size();
|
| + }
|
| +
|
| +-void StringOutputStream::SetString(string* target) {
|
| +- target_ = target;
|
| +-}
|
| +-
|
| +-// ===================================================================
|
| +-
|
| +-LazyStringOutputStream::LazyStringOutputStream(
|
| +- ResultCallback<string*>* callback)
|
| +- : StringOutputStream(NULL),
|
| +- callback_(GOOGLE_CHECK_NOTNULL(callback)),
|
| +- string_is_set_(false) {
|
| +-}
|
| +-
|
| +-LazyStringOutputStream::~LazyStringOutputStream() {
|
| +-}
|
| +-
|
| +-bool LazyStringOutputStream::Next(void** data, int* size) {
|
| +- if (!string_is_set_) {
|
| +- SetString(callback_->Run());
|
| +- string_is_set_ = true;
|
| +- }
|
| +- return StringOutputStream::Next(data, size);
|
| +-}
|
| +-
|
| +-int64 LazyStringOutputStream::ByteCount() const {
|
| +- return string_is_set_ ? StringOutputStream::ByteCount() : 0;
|
| +-}
|
| +-
|
| + // ===================================================================
|
| +
|
| + CopyingInputStream::~CopyingInputStream() {}
|
| +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 9d81ccf..650f4fc 100644
|
| +--- a/src/google/protobuf/io/zero_copy_stream_impl_lite.h
|
| ++++ b/src/google/protobuf/io/zero_copy_stream_impl_lite.h
|
| +@@ -149,9 +149,6 @@ class LIBPROTOBUF_EXPORT StringOutputStream : public ZeroCopyOutputStream {
|
| + void BackUp(int count);
|
| + int64 ByteCount() const;
|
| +
|
| +- protected:
|
| +- void SetString(string* target);
|
| +-
|
| + private:
|
| + static const int kMinimumSize = 16;
|
| +
|
| +@@ -160,27 +157,6 @@ class LIBPROTOBUF_EXPORT StringOutputStream : public ZeroCopyOutputStream {
|
| + GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(StringOutputStream);
|
| + };
|
| +
|
| +-// LazyStringOutputStream is a StringOutputStream with lazy acquisition of
|
| +-// the output string from a callback. The string is owned externally, and not
|
| +-// deleted in the stream destructor.
|
| +-class LIBPROTOBUF_EXPORT LazyStringOutputStream : public StringOutputStream {
|
| +- public:
|
| +- // 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);
|
| +- int64 ByteCount() const;
|
| +-
|
| +- private:
|
| +- const google::protobuf::scoped_ptr<ResultCallback<string*> > callback_;
|
| +- bool string_is_set_;
|
| +-
|
| +- GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(LazyStringOutputStream);
|
| +-};
|
| +-
|
| + // Note: There is no StringInputStream. Instead, just create an
|
| + // ArrayInputStream as follows:
|
| + // ArrayInputStream input(str.data(), str.size());
|
| +diff --git a/src/google/protobuf/stubs/callback.h b/src/google/protobuf/stubs/callback.h
|
| +index 87271c5..6da530d 100644
|
| +--- a/src/google/protobuf/stubs/callback.h
|
| ++++ b/src/google/protobuf/stubs/callback.h
|
| +@@ -78,18 +78,6 @@ class LIBPROTOBUF_EXPORT Closure {
|
| + GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(Closure);
|
| + };
|
| +
|
| +-template<typename R>
|
| +-class ResultCallback {
|
| +- public:
|
| +- ResultCallback() {}
|
| +- virtual ~ResultCallback() {}
|
| +-
|
| +- virtual R Run() = 0;
|
| +-
|
| +- private:
|
| +- GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(ResultCallback);
|
| +-};
|
| +-
|
| + template<typename R, typename A1>
|
| + class LIBPROTOBUF_EXPORT ResultCallback1 {
|
| + public:
|
| +@@ -252,50 +240,6 @@ class MethodClosure2 : public Closure {
|
| + Arg2 arg2_;
|
| + };
|
| +
|
| +-template<typename R>
|
| +-class FunctionResultCallback_0_0 : public ResultCallback<R> {
|
| +- public:
|
| +- typedef R (*FunctionType)();
|
| +-
|
| +- FunctionResultCallback_0_0(FunctionType function, bool self_deleting)
|
| +- : function_(function), self_deleting_(self_deleting) {}
|
| +- ~FunctionResultCallback_0_0() {}
|
| +-
|
| +- R Run() {
|
| +- bool needs_delete = self_deleting_; // read in case callback deletes
|
| +- R result = function_();
|
| +- if (needs_delete) delete this;
|
| +- return result;
|
| +- }
|
| +-
|
| +- private:
|
| +- FunctionType function_;
|
| +- bool self_deleting_;
|
| +-};
|
| +-
|
| +-template<typename R, typename P1>
|
| +-class FunctionResultCallback_1_0 : public ResultCallback<R> {
|
| +- public:
|
| +- typedef R (*FunctionType)(P1);
|
| +-
|
| +- FunctionResultCallback_1_0(FunctionType function, bool self_deleting,
|
| +- P1 p1)
|
| +- : function_(function), self_deleting_(self_deleting), p1_(p1) {}
|
| +- ~FunctionResultCallback_1_0() {}
|
| +-
|
| +- R Run() {
|
| +- bool needs_delete = self_deleting_; // read in case callback deletes
|
| +- R result = function_(p1_);
|
| +- if (needs_delete) delete this;
|
| +- return result;
|
| +- }
|
| +-
|
| +- private:
|
| +- FunctionType function_;
|
| +- bool self_deleting_;
|
| +- P1 p1_;
|
| +-};
|
| +-
|
| + template<typename R, typename Arg1>
|
| + class FunctionResultCallback_0_1 : public ResultCallback1<R, Arg1> {
|
| + public:
|
| +@@ -464,33 +408,6 @@ inline Closure* NewPermanentCallback(
|
| + object, method, false, arg1, arg2);
|
| + }
|
| +
|
| +-// See ResultCallback
|
| +-template<typename R>
|
| +-inline ResultCallback<R>* NewCallback(R (*function)()) {
|
| +- return new internal::FunctionResultCallback_0_0<R>(function, true);
|
| +-}
|
| +-
|
| +-// See ResultCallback
|
| +-template<typename R>
|
| +-inline ResultCallback<R>* NewPermanentCallback(R (*function)()) {
|
| +- return new internal::FunctionResultCallback_0_0<R>(function, false);
|
| +-}
|
| +-
|
| +-// See ResultCallback
|
| +-template<typename R, typename P1>
|
| +-inline ResultCallback<R>* NewCallback(R (*function)(P1), P1 p1) {
|
| +- return new internal::FunctionResultCallback_1_0<R, P1>(
|
| +- function, true, p1);
|
| +-}
|
| +-
|
| +-// See ResultCallback
|
| +-template<typename R, typename P1>
|
| +-inline ResultCallback<R>* NewPermanentCallback(
|
| +- R (*function)(P1), P1 p1) {
|
| +- return new internal::FunctionResultCallback_1_0<R, P1>(
|
| +- function, false, p1);
|
| +-}
|
| +-
|
| + // See ResultCallback1
|
| + template<typename R, typename A1>
|
| + inline ResultCallback1<R, A1>* NewCallback(R (*function)(A1)) {
|
| +--
|
| +2.8.0.rc3.226.g39d4020
|
| +
|
|
|