aboutsummaryrefslogtreecommitdiff
path: root/src/google/protobuf/compiler/cpp/cpp_map_field.cc
diff options
context:
space:
mode:
authorstone4774 <25053818+stone4774@users.noreply.github.com>2018-03-22 11:16:34 +0800
committerGitHub <noreply@github.com>2018-03-22 11:16:34 +0800
commitc99f5278eb8dad6f42def88ce8b5a3453f6df4a8 (patch)
treec3cd284ec9d2981f61da266d040935b73275b5c4 /src/google/protobuf/compiler/cpp/cpp_map_field.cc
parentd053271deebe0efcd41729991b1f3d618b638ad5 (diff)
parented4321d1cb33199984118d801956822842771e7e (diff)
downloadprotobuf-c99f5278eb8dad6f42def88ce8b5a3453f6df4a8.tar.gz
protobuf-c99f5278eb8dad6f42def88ce8b5a3453f6df4a8.tar.bz2
protobuf-c99f5278eb8dad6f42def88ce8b5a3453f6df4a8.zip
Merge branch 'master' into fixbug_enum2json2
Diffstat (limited to 'src/google/protobuf/compiler/cpp/cpp_map_field.cc')
-rw-r--r--src/google/protobuf/compiler/cpp/cpp_map_field.cc12
1 files changed, 5 insertions, 7 deletions
diff --git a/src/google/protobuf/compiler/cpp/cpp_map_field.cc b/src/google/protobuf/compiler/cpp/cpp_map_field.cc
index b22c0754..0e485cac 100644
--- a/src/google/protobuf/compiler/cpp/cpp_map_field.cc
+++ b/src/google/protobuf/compiler/cpp/cpp_map_field.cc
@@ -104,9 +104,7 @@ void SetMessageVariables(const FieldDescriptor* descriptor,
MapFieldGenerator::MapFieldGenerator(const FieldDescriptor* descriptor,
const Options& options)
- : FieldGenerator(options),
- descriptor_(descriptor),
- dependent_field_(options.proto_h && IsFieldDependent(descriptor)) {
+ : FieldGenerator(options), descriptor_(descriptor) {
SetMessageVariables(descriptor, &variables_, options);
}
@@ -202,7 +200,7 @@ GenerateMergeFromCodedStream(io::Printer* printer) const {
key = "entry->key()";
value = "entry->value()";
printer->Print(variables_,
- "::google::protobuf::scoped_ptr<$map_classname$> entry($name$_.NewEntry());\n");
+ "::std::unique_ptr<$map_classname$> entry($name$_.NewEntry());\n");
printer->Print(variables_,
"{\n"
" ::std::string data;\n"
@@ -258,7 +256,7 @@ static void GenerateSerializationLoop(io::Printer* printer,
const string& ptr,
bool loop_via_iterators) {
printer->Print(variables,
- StrCat("::google::protobuf::scoped_ptr<$map_classname$> entry;\n",
+ StrCat("::std::unique_ptr<$map_classname$> entry;\n",
loop_header, " {\n").c_str());
printer->Indent();
@@ -365,7 +363,7 @@ void MapFieldGenerator::GenerateSerializeWithCachedSizes(
"\n"
"if ($deterministic$ &&\n"
" this->$name$().size() > 1) {\n"
- " ::google::protobuf::scoped_array<SortItem> items(\n"
+ " ::std::unique_ptr<SortItem[]> items(\n"
" new SortItem[this->$name$().size()]);\n"
" typedef ::google::protobuf::Map< $key_cpp$, $val_cpp$ >::size_type size_type;\n"
" size_type n = 0;\n"
@@ -402,7 +400,7 @@ GenerateByteSize(io::Printer* printer) const {
"total_size += $tag_size$ *\n"
" ::google::protobuf::internal::FromIntSize(this->$name$_size());\n"
"{\n"
- " ::google::protobuf::scoped_ptr<$map_classname$> entry;\n"
+ " ::std::unique_ptr<$map_classname$> entry;\n"
" for (::google::protobuf::Map< $key_cpp$, $val_cpp$ >::const_iterator\n"
" it = this->$name$().begin();\n"
" it != this->$name$().end(); ++it) {\n");