protobuf/src/google/protobuf/util/internal/proto_writer.cc
Go to the documentation of this file.
1 // Protocol Buffers - Google's data interchange format
2 // Copyright 2008 Google Inc. All rights reserved.
3 // https://developers.google.com/protocol-buffers/
4 //
5 // Redistribution and use in source and binary forms, with or without
6 // modification, are permitted provided that the following conditions are
7 // met:
8 //
9 // * Redistributions of source code must retain the above copyright
10 // notice, this list of conditions and the following disclaimer.
11 // * Redistributions in binary form must reproduce the above
12 // copyright notice, this list of conditions and the following disclaimer
13 // in the documentation and/or other materials provided with the
14 // distribution.
15 // * Neither the name of Google Inc. nor the names of its
16 // contributors may be used to endorse or promote products derived from
17 // this software without specific prior written permission.
18 //
19 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
20 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
21 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
22 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
23 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
24 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
25 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
27 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30 
31 #include <google/protobuf/util/internal/proto_writer.h>
32 
33 #include <cstdint>
34 #include <functional>
35 #include <stack>
36 
37 #include <google/protobuf/stubs/once.h>
38 #include <google/protobuf/wire_format_lite.h>
39 #include <google/protobuf/util/internal/field_mask_utility.h>
40 #include <google/protobuf/util/internal/object_location_tracker.h>
41 #include <google/protobuf/util/internal/constants.h>
42 #include <google/protobuf/util/internal/utility.h>
43 #include <google/protobuf/stubs/strutil.h>
44 #include <google/protobuf/stubs/statusor.h>
45 #include <google/protobuf/stubs/time.h>
46 #include <google/protobuf/stubs/map_util.h>
47 
48 
49 #include <google/protobuf/port_def.inc>
50 
51 namespace google {
52 namespace protobuf {
53 namespace util {
54 namespace converter {
55 
57 using ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite;
58 
61  strings::ByteSink* output, ErrorListener* listener)
62  : master_type_(type),
63  typeinfo_(TypeInfo::NewTypeInfo(type_resolver)),
64  own_typeinfo_(true),
65  done_(false),
66  ignore_unknown_fields_(false),
67  ignore_unknown_enum_values_(false),
68  use_lower_camel_for_enums_(false),
69  case_insensitive_enum_parsing_(true),
70  use_json_name_in_missing_fields_(false),
71  element_(nullptr),
72  size_insert_(),
73  output_(output),
74  buffer_(),
75  adapter_(&buffer_),
76  stream_(new CodedOutputStream(&adapter_)),
77  listener_(listener),
78  invalid_depth_(0),
79  tracker_(new ObjectLocationTracker()) {}
80 
81 ProtoWriter::ProtoWriter(const TypeInfo* typeinfo,
83  strings::ByteSink* output, ErrorListener* listener)
84  : master_type_(type),
85  typeinfo_(typeinfo),
86  own_typeinfo_(false),
87  done_(false),
88  ignore_unknown_fields_(false),
89  ignore_unknown_enum_values_(false),
90  use_lower_camel_for_enums_(false),
91  case_insensitive_enum_parsing_(true),
92  use_json_name_in_missing_fields_(false),
93  element_(nullptr),
94  size_insert_(),
95  output_(output),
96  buffer_(),
97  adapter_(&buffer_),
98  stream_(new CodedOutputStream(&adapter_)),
99  listener_(listener),
100  invalid_depth_(0),
101  tracker_(new ObjectLocationTracker()) {}
102 
104  if (own_typeinfo_) {
105  delete typeinfo_;
106  }
107  if (element_ == nullptr) return;
108  // Cleanup explicitly in order to avoid destructor stack overflow when input
109  // is deeply nested.
110  // Cast to BaseElement to avoid doing additional checks (like missing fields)
111  // during pop().
112  std::unique_ptr<BaseElement> element(
113  static_cast<BaseElement*>(element_.get())->pop<BaseElement>());
114  while (element != nullptr) {
115  element.reset(element->pop<BaseElement>());
116  }
117 }
118 
119 namespace {
120 
121 // Writes an INT32 field, including tag to the stream.
122 inline util::Status WriteInt32(int field_number, const DataPiece& data,
124  util::StatusOr<int32_t> i32 = data.ToInt32();
125  if (i32.ok()) {
126  WireFormatLite::WriteInt32(field_number, i32.value(), stream);
127  }
128  return i32.status();
129 }
130 
131 // writes an SFIXED32 field, including tag, to the stream.
132 inline util::Status WriteSFixed32(int field_number, const DataPiece& data,
134  util::StatusOr<int32_t> i32 = data.ToInt32();
135  if (i32.ok()) {
136  WireFormatLite::WriteSFixed32(field_number, i32.value(), stream);
137  }
138  return i32.status();
139 }
140 
141 // Writes an SINT32 field, including tag, to the stream.
142 inline util::Status WriteSInt32(int field_number, const DataPiece& data,
144  util::StatusOr<int32_t> i32 = data.ToInt32();
145  if (i32.ok()) {
146  WireFormatLite::WriteSInt32(field_number, i32.value(), stream);
147  }
148  return i32.status();
149 }
150 
151 // Writes a FIXED32 field, including tag, to the stream.
152 inline util::Status WriteFixed32(int field_number, const DataPiece& data,
154  util::StatusOr<uint32_t> u32 = data.ToUint32();
155  if (u32.ok()) {
156  WireFormatLite::WriteFixed32(field_number, u32.value(), stream);
157  }
158  return u32.status();
159 }
160 
161 // Writes a UINT32 field, including tag, to the stream.
162 inline util::Status WriteUInt32(int field_number, const DataPiece& data,
164  util::StatusOr<uint32_t> u32 = data.ToUint32();
165  if (u32.ok()) {
166  WireFormatLite::WriteUInt32(field_number, u32.value(), stream);
167  }
168  return u32.status();
169 }
170 
171 // Writes an INT64 field, including tag, to the stream.
172 inline util::Status WriteInt64(int field_number, const DataPiece& data,
174  util::StatusOr<int64_t> i64 = data.ToInt64();
175  if (i64.ok()) {
176  WireFormatLite::WriteInt64(field_number, i64.value(), stream);
177  }
178  return i64.status();
179 }
180 
181 // Writes an SFIXED64 field, including tag, to the stream.
182 inline util::Status WriteSFixed64(int field_number, const DataPiece& data,
184  util::StatusOr<int64_t> i64 = data.ToInt64();
185  if (i64.ok()) {
186  WireFormatLite::WriteSFixed64(field_number, i64.value(), stream);
187  }
188  return i64.status();
189 }
190 
191 // Writes an SINT64 field, including tag, to the stream.
192 inline util::Status WriteSInt64(int field_number, const DataPiece& data,
194  util::StatusOr<int64_t> i64 = data.ToInt64();
195  if (i64.ok()) {
196  WireFormatLite::WriteSInt64(field_number, i64.value(), stream);
197  }
198  return i64.status();
199 }
200 
201 // Writes a FIXED64 field, including tag, to the stream.
202 inline util::Status WriteFixed64(int field_number, const DataPiece& data,
204  util::StatusOr<uint64_t> u64 = data.ToUint64();
205  if (u64.ok()) {
206  WireFormatLite::WriteFixed64(field_number, u64.value(), stream);
207  }
208  return u64.status();
209 }
210 
211 // Writes a UINT64 field, including tag, to the stream.
212 inline util::Status WriteUInt64(int field_number, const DataPiece& data,
214  util::StatusOr<uint64_t> u64 = data.ToUint64();
215  if (u64.ok()) {
216  WireFormatLite::WriteUInt64(field_number, u64.value(), stream);
217  }
218  return u64.status();
219 }
220 
221 // Writes a DOUBLE field, including tag, to the stream.
222 inline util::Status WriteDouble(int field_number, const DataPiece& data,
224  util::StatusOr<double> d = data.ToDouble();
225  if (d.ok()) {
226  WireFormatLite::WriteDouble(field_number, d.value(), stream);
227  }
228  return d.status();
229 }
230 
231 // Writes a FLOAT field, including tag, to the stream.
232 inline util::Status WriteFloat(int field_number, const DataPiece& data,
234  util::StatusOr<float> f = data.ToFloat();
235  if (f.ok()) {
236  WireFormatLite::WriteFloat(field_number, f.value(), stream);
237  }
238  return f.status();
239 }
240 
241 // Writes a BOOL field, including tag, to the stream.
242 inline util::Status WriteBool(int field_number, const DataPiece& data,
244  util::StatusOr<bool> b = data.ToBool();
245  if (b.ok()) {
246  WireFormatLite::WriteBool(field_number, b.value(), stream);
247  }
248  return b.status();
249 }
250 
251 // Writes a BYTES field, including tag, to the stream.
252 inline util::Status WriteBytes(int field_number, const DataPiece& data,
254  util::StatusOr<std::string> c = data.ToBytes();
255  if (c.ok()) {
256  WireFormatLite::WriteBytes(field_number, c.value(), stream);
257  }
258  return c.status();
259 }
260 
261 // Writes a STRING field, including tag, to the stream.
262 inline util::Status WriteString(int field_number, const DataPiece& data,
264  util::StatusOr<std::string> s = data.ToString();
265  if (s.ok()) {
266  WireFormatLite::WriteString(field_number, s.value(), stream);
267  }
268  return s.status();
269 }
270 
271 // Given a google::protobuf::Type, returns the set of all required fields.
272 std::set<const google::protobuf::Field*> GetRequiredFields(
273  const google::protobuf::Type& type) {
274  std::set<const google::protobuf::Field*> required;
275  for (int i = 0; i < type.fields_size(); i++) {
276  const google::protobuf::Field& field = type.fields(i);
277  if (field.cardinality() == google::protobuf::Field::CARDINALITY_REQUIRED) {
278  required.insert(&field);
279  }
280  }
281  return required;
282 }
283 
284 } // namespace
285 
288  ProtoWriter* enclosing)
289  : BaseElement(nullptr),
290  ow_(enclosing),
291  parent_field_(nullptr),
292  typeinfo_(typeinfo),
293  proto3_(type.syntax() == google::protobuf::SYNTAX_PROTO3),
294  type_(type),
295  size_index_(-1),
296  array_index_(-1),
297  // oneof_indices_ values are 1-indexed (0 means not present).
298  oneof_indices_(type.oneofs_size() + 1) {
299  if (!proto3_) {
300  required_fields_ = GetRequiredFields(type_);
301  }
302 }
303 
304 ProtoWriter::ProtoElement::ProtoElement(ProtoWriter::ProtoElement* parent,
307  bool is_list)
308  : BaseElement(parent),
309  ow_(this->parent()->ow_),
310  parent_field_(field),
311  typeinfo_(this->parent()->typeinfo_),
312  proto3_(type.syntax() == google::protobuf::SYNTAX_PROTO3),
313  type_(type),
314  size_index_(!is_list &&
315  field->kind() == google::protobuf::Field::TYPE_MESSAGE
316  ? ow_->size_insert_.size()
317  : -1),
318  array_index_(is_list ? 0 : -1),
319  // oneof_indices_ values are 1-indexed (0 means not present).
320  oneof_indices_(type_.oneofs_size() + 1) {
321  if (!is_list) {
322  if (ow_->IsRepeated(*field)) {
323  // Update array_index_ if it is an explicit list.
324  if (this->parent()->array_index_ >= 0) this->parent()->array_index_++;
325  } else if (!proto3_) {
326  // For required fields tracking.
327  this->parent()->RegisterField(field);
328  }
329 
330  if (field->kind() == google::protobuf::Field::TYPE_MESSAGE) {
331  if (!proto3_) {
332  required_fields_ = GetRequiredFields(type_);
333  }
334  int start_pos = ow_->stream_->ByteCount();
335  // length of serialized message is the final buffer position minus
336  // starting buffer position, plus length adjustments for size fields
337  // of any nested messages. We start with -start_pos here, so we only
338  // need to add the final buffer position to it at the end.
339  SizeInfo info = {start_pos, -start_pos};
340  ow_->size_insert_.push_back(info);
341  }
342  }
343 }
344 
345 ProtoWriter::ProtoElement* ProtoWriter::ProtoElement::pop() {
346  if (!proto3_) {
347  // Calls the registered error listener for any required field(s) not yet
348  // seen.
350  required_fields_.begin();
351  it != required_fields_.end(); ++it) {
353  ? (*it)->json_name()
354  : (*it)->name());
355  }
356  }
357  // Computes the total number of proto bytes used by a message, also adjusts
358  // the size of all parent messages by the length of this size field.
359  // If size_index_ < 0, this is not a message, so no size field is added.
360  if (size_index_ >= 0) {
361  // Add the final buffer position to compute the total length of this
362  // serialized message. The stored value (before this addition) already
363  // contains the total length of the size fields of all nested messages
364  // minus the initial buffer position.
365  ow_->size_insert_[size_index_].size += ow_->stream_->ByteCount();
366  // Calculate the length required to serialize the size field of the
367  // message, and propagate this additional size information upward to
368  // all enclosing messages.
369  int size = ow_->size_insert_[size_index_].size;
371  for (ProtoElement* e = parent(); e != nullptr; e = e->parent()) {
372  // Only nested messages have size field, lists do not have size field.
373  if (e->size_index_ >= 0) {
374  ow_->size_insert_[e->size_index_].size += length;
375  }
376  }
377  }
378  return BaseElement::pop<ProtoElement>();
379 }
380 
383  if (!required_fields_.empty() &&
384  field->cardinality() == google::protobuf::Field::CARDINALITY_REQUIRED) {
385  required_fields_.erase(field);
386  }
387 }
388 
390  std::string loc = "";
391 
392  // first populate a stack with the nodes since we need to process them
393  // from root to leaf when generating the string location
394  const ProtoWriter::ProtoElement* now = this;
395  std::stack<const ProtoWriter::ProtoElement*> element_stack;
396  while (now->parent() != nullptr) {
397  element_stack.push(now);
398  now = now->parent();
399  }
400 
401  // now pop each node from the stack and append to the location string
402  while (!element_stack.empty()) {
403  now = element_stack.top();
404  element_stack.pop();
405 
406  if (!ow_->IsRepeated(*(now->parent_field_)) ||
407  now->parent()->parent_field_ != now->parent_field_) {
408  std::string name = now->parent_field_->name();
409  int i = 0;
410  while (i < name.size() &&
411  (ascii_isalnum(name[i]) || name[i] == '_'))
412  ++i;
413  if (i > 0 && i == name.size()) { // safe field name
414  if (loc.empty()) {
415  loc = name;
416  } else {
417  StrAppend(&loc, ".", name);
418  }
419  } else {
420  StrAppend(&loc, "[\"", CEscape(name), "\"]");
421  }
422  }
423 
424  int array_index_now = now->array_index_;
425  if (ow_->IsRepeated(*(now->parent_field_)) && array_index_now > 0) {
426  StrAppend(&loc, "[", array_index_now - 1, "]");
427  }
428  }
429 
430  return loc;
431 }
432 
434  return oneof_indices_[index];
435 }
436 
438  oneof_indices_[index] = true;
439 }
440 
441 void ProtoWriter::InvalidName(StringPiece unknown_name,
442  StringPiece message) {
443  listener_->InvalidName(location(), unknown_name, message);
444 }
445 
446 void ProtoWriter::InvalidValue(StringPiece type_name,
447  StringPiece value) {
449 }
450 
451 void ProtoWriter::MissingField(StringPiece missing_name) {
452  listener_->MissingField(location(), missing_name);
453 }
454 
456  StringPiece name) {
457  // Starting the root message. Create the root ProtoElement and return.
458  if (element_ == nullptr) {
459  if (!name.empty()) {
460  InvalidName(name, "Root element should not be named.");
461  }
462  element_.reset(new ProtoElement(typeinfo_, master_type_, this));
463  return this;
464  }
465 
466  const google::protobuf::Field* field = BeginNamed(name, false);
467 
468  if (field == nullptr) return this;
469 
470  // Check to see if this field is a oneof and that no oneof in that group has
471  // already been set.
472  if (!ValidOneof(*field, name)) {
473  ++invalid_depth_;
474  return this;
475  }
476 
478  if (type == nullptr) {
479  ++invalid_depth_;
480  InvalidName(name, StrCat("Missing descriptor for field: ",
481  field->type_url()));
482  return this;
483  }
484 
485  return StartObjectField(*field, *type);
486 }
487 
488 
490  if (invalid_depth_ > 0) {
491  --invalid_depth_;
492  return this;
493  }
494 
495  if (element_ != nullptr) {
496  element_.reset(element_->pop());
497  }
498 
499 
500  // If ending the root element,
501  // then serialize the full message with calculated sizes.
502  if (element_ == nullptr) {
504  }
505  return this;
506 }
507 
509  StringPiece name) {
510 
512 
513  if (field == nullptr) return this;
514 
515  if (!ValidOneof(*field, name)) {
516  ++invalid_depth_;
517  return this;
518  }
519 
521  if (type == nullptr) {
522  ++invalid_depth_;
523  InvalidName(name, StrCat("Missing descriptor for field: ",
524  field->type_url()));
525  return this;
526  }
527 
528  return StartListField(*field, *type);
529 }
530 
531 
533  if (invalid_depth_ > 0) {
534  --invalid_depth_;
535  } else if (element_ != nullptr) {
536  element_.reset(element_->pop());
537  }
538  return this;
539 }
540 
542  StringPiece name, const DataPiece& data) {
544  if (invalid_depth_ > 0) return this;
545 
547 
548  if (field == nullptr) return this;
549 
550  if (!ValidOneof(*field, name)) return this;
551 
553  if (type == nullptr) {
554  InvalidName(name, StrCat("Missing descriptor for field: ",
555  field->type_url()));
556  return this;
557  }
558 
559  return RenderPrimitiveField(*field, *type, data);
560 }
561 
563  StringPiece unnormalized_name) {
564  if (element_ == nullptr) return true;
565 
566  if (field.oneof_index() > 0) {
567  if (element_->IsOneofIndexTaken(field.oneof_index())) {
568  InvalidValue(
569  "oneof",
570  StrCat(
571  "oneof field '", element_->type().oneofs(field.oneof_index() - 1),
572  "' is already set. Cannot set '", unnormalized_name, "'"));
573  return false;
574  }
575  element_->TakeOneofIndex(field.oneof_index());
576  }
577  return true;
578 }
579 
581  return field.cardinality() == google::protobuf::Field::CARDINALITY_REPEATED;
582 }
583 
585  const google::protobuf::Type& type) {
586  WriteTag(field);
587  element_.reset(new ProtoElement(element_.release(), &field, type, false));
588  return this;
589 }
590 
592  const google::protobuf::Type& type) {
593  element_.reset(new ProtoElement(element_.release(), &field, type, true));
594  return this;
595 }
596 
597 util::Status ProtoWriter::WriteEnum(int field_number, const DataPiece& data,
600  bool use_lower_camel_for_enums,
601  bool case_insensitive_enum_parsing,
602  bool ignore_unknown_values) {
603  bool is_unknown_enum_value = false;
604  util::StatusOr<int> e = data.ToEnum(
605  enum_type, use_lower_camel_for_enums, case_insensitive_enum_parsing,
606  ignore_unknown_values, &is_unknown_enum_value);
607  if (e.ok() && !is_unknown_enum_value) {
608  WireFormatLite::WriteEnum(field_number, e.value(), stream);
609  }
610  return e.status();
611 }
612 
615  const DataPiece& data) {
617 
618  // Pushing a ProtoElement and then pop it off at the end for 2 purposes:
619  // error location reporting and required field accounting.
620  //
621  // For proto3, since there is no required field tracking, we only need to
622  // push ProtoElement for error cases.
623  if (!element_->proto3()) {
624  element_.reset(new ProtoElement(element_.release(), &field, type, false));
625  }
626 
627  switch (field.kind()) {
628  case google::protobuf::Field::TYPE_INT32: {
629  status = WriteInt32(field.number(), data, stream_.get());
630  break;
631  }
632  case google::protobuf::Field::TYPE_SFIXED32: {
633  status = WriteSFixed32(field.number(), data, stream_.get());
634  break;
635  }
636  case google::protobuf::Field::TYPE_SINT32: {
637  status = WriteSInt32(field.number(), data, stream_.get());
638  break;
639  }
640  case google::protobuf::Field::TYPE_FIXED32: {
641  status = WriteFixed32(field.number(), data, stream_.get());
642  break;
643  }
644  case google::protobuf::Field::TYPE_UINT32: {
645  status = WriteUInt32(field.number(), data, stream_.get());
646  break;
647  }
648  case google::protobuf::Field::TYPE_INT64: {
649  status = WriteInt64(field.number(), data, stream_.get());
650  break;
651  }
652  case google::protobuf::Field::TYPE_SFIXED64: {
653  status = WriteSFixed64(field.number(), data, stream_.get());
654  break;
655  }
656  case google::protobuf::Field::TYPE_SINT64: {
657  status = WriteSInt64(field.number(), data, stream_.get());
658  break;
659  }
660  case google::protobuf::Field::TYPE_FIXED64: {
661  status = WriteFixed64(field.number(), data, stream_.get());
662  break;
663  }
664  case google::protobuf::Field::TYPE_UINT64: {
665  status = WriteUInt64(field.number(), data, stream_.get());
666  break;
667  }
668  case google::protobuf::Field::TYPE_DOUBLE: {
669  status = WriteDouble(field.number(), data, stream_.get());
670  break;
671  }
672  case google::protobuf::Field::TYPE_FLOAT: {
673  status = WriteFloat(field.number(), data, stream_.get());
674  break;
675  }
676  case google::protobuf::Field::TYPE_BOOL: {
677  status = WriteBool(field.number(), data, stream_.get());
678  break;
679  }
680  case google::protobuf::Field::TYPE_BYTES: {
681  status = WriteBytes(field.number(), data, stream_.get());
682  break;
683  }
684  case google::protobuf::Field::TYPE_STRING: {
685  status = WriteString(field.number(), data, stream_.get());
686  break;
687  }
688  case google::protobuf::Field::TYPE_ENUM: {
689  status = WriteEnum(
690  field.number(), data, typeinfo_->GetEnumByTypeUrl(field.type_url()),
693  break;
694  }
695  default: // TYPE_GROUP, TYPE_MESSAGE, TYPE_UNKNOWN.
696  status = util::InvalidArgumentError(data.ValueAsStringOrDefault(""));
697  }
698 
699  if (!status.ok()) {
700  // Push a ProtoElement for location reporting purposes.
701  if (element_->proto3()) {
702  element_.reset(new ProtoElement(element_.release(), &field, type, false));
703  }
704  InvalidValue(field.type_url().empty()
706  : field.type_url(),
707  status.message());
708  element_.reset(element()->pop());
709  return this;
710  }
711 
712  if (!element_->proto3()) element_.reset(element()->pop());
713 
714  return this;
715 }
716 
718  bool is_list) {
719  if (invalid_depth_ > 0) {
720  ++invalid_depth_;
721  return nullptr;
722  }
724  if (field == nullptr) {
725  ++invalid_depth_;
726  // InvalidName() already called in Lookup().
727  return nullptr;
728  }
729  if (is_list && !IsRepeated(*field)) {
730  ++invalid_depth_;
731  InvalidName(name, "Proto field is not repeating, cannot start list.");
732  return nullptr;
733  }
734  return field;
735 }
736 
738  StringPiece unnormalized_name) {
739  ProtoElement* e = element();
740  if (e == nullptr) {
741  InvalidName(unnormalized_name, "Root element must be a message.");
742  return nullptr;
743  }
744  if (unnormalized_name.empty()) {
745  // Objects in repeated field inherit the same field descriptor.
746  if (e->parent_field() == nullptr) {
747  InvalidName(unnormalized_name, "Proto fields must have a name.");
748  } else if (!IsRepeated(*e->parent_field())) {
749  InvalidName(unnormalized_name, "Proto fields must have a name.");
750  return nullptr;
751  }
752  return e->parent_field();
753  }
755  typeinfo_->FindField(&e->type(), unnormalized_name);
756  if (field == nullptr && !ignore_unknown_fields_) {
757  InvalidName(unnormalized_name, "Cannot find field.");
758  }
759  return field;
760 }
761 
764  return ((field->kind() == google::protobuf::Field::TYPE_MESSAGE ||
765  field->kind() == google::protobuf::Field::TYPE_GROUP)
766  ? typeinfo_->GetTypeByTypeUrl(field->type_url())
767  : &element_->type());
768 }
769 
772  int curr_pos = 0;
773  // Calls the destructor of CodedOutputStream to remove any uninitialized
774  // memory from the Cord before we read it.
775  stream_.reset(nullptr);
776  const void* data;
777  int length;
778  io::ArrayInputStream input_stream(buffer_.data(), buffer_.size());
779  while (input_stream.Next(&data, &length)) {
780  if (length == 0) continue;
781  int num_bytes = length;
782  // Write up to where we need to insert the size field.
783  // The number of bytes we may write is the smaller of:
784  // - the current fragment size
785  // - the distance to the next position where a size field needs to be
786  // inserted.
787  if (!size_insert_.empty() &&
788  size_insert_.front().pos - curr_pos < num_bytes) {
789  num_bytes = size_insert_.front().pos - curr_pos;
790  }
791  output_->Append(static_cast<const char*>(data), num_bytes);
792  if (num_bytes < length) {
793  input_stream.BackUp(length - num_bytes);
794  }
795  curr_pos += num_bytes;
796  // Insert the size field.
797  // size_insert_.front(): the next <index, size> pair to be written.
798  // size_insert_.front().pos: position of the size field.
799  // size_insert_.front().size: the size (integer) to be inserted.
800  if (!size_insert_.empty() && curr_pos == size_insert_.front().pos) {
801  // Varint32 occupies at most 10 bytes.
802  uint8_t insert_buffer[10];
804  size_insert_.front().size, insert_buffer);
805  output_->Append(reinterpret_cast<const char*>(insert_buffer),
806  insert_buffer_pos - insert_buffer);
807  size_insert_.pop_front();
808  }
809  }
810  output_->Flush();
811  stream_.reset(new CodedOutputStream(&adapter_));
812  done_ = true;
813 }
814 
817  static_cast<WireFormatLite::FieldType>(field.kind()));
818  stream_->WriteTag(WireFormatLite::MakeTag(field.number(), wire_type));
819 }
820 
821 
822 } // namespace converter
823 } // namespace util
824 } // namespace protobuf
825 } // namespace google
google::protobuf::util::converter::ProtoWriter::EndList
ProtoWriter * EndList() override
Definition: bloaty/third_party/protobuf/src/google/protobuf/util/internal/proto_writer.cc:525
google::protobuf::util::converter::ProtoWriter::ignore_unknown_fields_
bool ignore_unknown_fields_
Definition: bloaty/third_party/protobuf/src/google/protobuf/util/internal/proto_writer.h:325
absl::InvalidArgumentError
Status InvalidArgumentError(absl::string_view message)
Definition: third_party/abseil-cpp/absl/status/status.cc:351
google::protobuf::util::converter::ProtoWriter::output_
strings::ByteSink * output_
Definition: bloaty/third_party/protobuf/src/google/protobuf/util/internal/proto_writer.h:350
Type
struct Type Type
Definition: bloaty/third_party/protobuf/php/ext/google/protobuf/protobuf.h:673
google::protobuf::util::converter::ErrorListener::InvalidValue
virtual void InvalidValue(const LocationTrackerInterface &loc, StringPiece type_name, StringPiece value)=0
google::protobuf::util::converter::ProtoWriter::listener_
ErrorListener * listener_
Definition: bloaty/third_party/protobuf/src/google/protobuf/util/internal/proto_writer.h:359
google::protobuf::util::converter::ErrorListener::InvalidName
virtual void InvalidName(const LocationTrackerInterface &loc, StringPiece invalid_name, StringPiece message)=0
google::protobuf::util::converter::ProtoWriter::ValidOneof
bool ValidOneof(const google::protobuf::Field &field, StringPiece unnormalized_name)
Definition: bloaty/third_party/protobuf/src/google/protobuf/util/internal/proto_writer.cc:554
google::protobuf.internal::WireFormatLite::WireTypeForFieldType
static WireFormatLite::WireType WireTypeForFieldType(WireFormatLite::FieldType type)
Definition: bloaty/third_party/protobuf/src/google/protobuf/wire_format_lite.h:152
now
static double now(void)
Definition: test/core/fling/client.cc:130
google::protobuf::strings::ByteSink::Flush
virtual void Flush()
Definition: bloaty/third_party/protobuf/src/google/protobuf/stubs/bytestream.cc:56
google::protobuf::util::converter::ProtoWriter::StartList
ProtoWriter * StartList(StringPiece name) override
Definition: bloaty/third_party/protobuf/src/google/protobuf/util/internal/proto_writer.cc:505
regen-readme.it
it
Definition: regen-readme.py:15
google::protobuf::value
const Descriptor::ReservedRange value
Definition: bloaty/third_party/protobuf/src/google/protobuf/descriptor.h:1954
google::protobuf::util::converter::ProtoWriter::EndObject
ProtoWriter * EndObject() override
Definition: bloaty/third_party/protobuf/src/google/protobuf/util/internal/proto_writer.cc:486
google::protobuf::util::converter::ProtoWriter::location
const LocationTrackerInterface & location()
Definition: bloaty/third_party/protobuf/src/google/protobuf/util/internal/proto_writer.h:120
google::protobuf.internal::WireFormatLite::WriteUInt64
static void WriteUInt64(int field_number, uint64 value, io::CodedOutputStream *output)
Definition: bloaty/third_party/protobuf/src/google/protobuf/wire_format_lite.cc:422
google::protobuf::util::converter::ProtoWriter::element
ProtoElement * element() override
Definition: bloaty/third_party/protobuf/src/google/protobuf/util/internal/proto_writer.h:248
google::protobuf::Enum
fix_build_deps.c
list c
Definition: fix_build_deps.py:490
google::protobuf::strings::ByteSink::Append
virtual void Append(const char *bytes, size_t n)=0
stream_
std::unique_ptr< grpc::ClientReaderInterface< OrcaLoadReport > > stream_
Definition: orca_service_end2end_test.cc:89
false
#define false
Definition: setup_once.h:323
google::protobuf::util::converter::TypeInfo::GetEnumByTypeUrl
virtual const google::protobuf::Enum * GetEnumByTypeUrl(StringPiece type_url) const =0
google::protobuf::util::converter::ProtoWriter::ProtoElement::ow_
ProtoWriter * ow_
Definition: bloaty/third_party/protobuf/src/google/protobuf/util/internal/proto_writer.h:207
google::protobuf::util::converter::ProtoWriter::done_
bool done_
Definition: bloaty/third_party/protobuf/src/google/protobuf/util/internal/proto_writer.h:322
google::protobuf::util::converter::ProtoWriter::size_insert_
std::deque< SizeInfo > size_insert_
Definition: bloaty/third_party/protobuf/src/google/protobuf/util/internal/proto_writer.h:343
GOOGLE_DCHECK
#define GOOGLE_DCHECK
Definition: bloaty/third_party/protobuf/src/google/protobuf/stubs/logging.h:194
google::protobuf::util::converter::ProtoWriter::MissingField
void MissingField(StringPiece missing_name)
Definition: bloaty/third_party/protobuf/src/google/protobuf/util/internal/proto_writer.cc:450
google::protobuf::util::converter::ProtoWriter::use_lower_camel_for_enums_
bool use_lower_camel_for_enums_
Definition: bloaty/third_party/protobuf/src/google/protobuf/util/internal/proto_writer.h:332
testing::internal::string
::std::string string
Definition: bloaty/third_party/protobuf/third_party/googletest/googletest/include/gtest/internal/gtest-port.h:881
google::protobuf::util::converter::ProtoWriter::InvalidName
void InvalidName(StringPiece unknown_name, StringPiece message)
Definition: bloaty/third_party/protobuf/src/google/protobuf/util/internal/proto_writer.cc:440
type_
std::string type_
Definition: client_channel_stress_test.cc:212
google::protobuf::util::converter::ProtoWriter::WriteEnum
static util::Status WriteEnum(int field_number, const DataPiece &data, const google::protobuf::Enum *enum_type, io::CodedOutputStream *stream, bool use_lower_camel_for_enums, bool case_insensitive_enum_parsing, bool ignore_unknown_values)
Definition: bloaty/third_party/protobuf/src/google/protobuf/util/internal/proto_writer.cc:590
loc
OPENSSL_EXPORT X509_EXTENSION int loc
Definition: x509.h:1418
google::protobuf::util::converter::ProtoWriter::WriteTag
void WriteTag(const google::protobuf::Field &field)
Definition: bloaty/third_party/protobuf/src/google/protobuf/util/internal/proto_writer.cc:821
google::protobuf::CEscape
string CEscape(const string &src)
Definition: bloaty/third_party/protobuf/src/google/protobuf/stubs/strutil.cc:615
TypeInfo
Definition: protobuf/php/ext/google/protobuf/def.h:69
google::protobuf
Definition: bloaty/third_party/protobuf/benchmarks/util/data_proto2_to_proto3_util.h:12
status
absl::Status status
Definition: rls.cc:251
make_cmakelists.converter
converter
Definition: make_cmakelists.py:317
google::protobuf.internal::WireFormatLite::WriteUInt32
static void WriteUInt32(int field_number, uint32 value, io::CodedOutputStream *output)
Definition: bloaty/third_party/protobuf/src/google/protobuf/wire_format_lite.cc:417
setup.name
name
Definition: setup.py:542
google::protobuf::util::converter::ProtoWriter::StartListField
ProtoWriter * StartListField(const google::protobuf::Field &field, const google::protobuf::Type &type)
Definition: bloaty/third_party/protobuf/src/google/protobuf/util/internal/proto_writer.cc:584
absl::FormatConversionChar::s
@ s
type_resolver
TypeResolver * type_resolver
Definition: bloaty/third_party/protobuf/conformance/conformance_cpp.cc:71
env.new
def new
Definition: env.py:51
uint8_t
unsigned char uint8_t
Definition: stdint-msvc2008.h:78
iterator
const typedef MCPhysReg * iterator
Definition: MCRegisterInfo.h:27
google::protobuf::util::converter::ProtoWriter::ProtoElement::RegisterField
void RegisterField(const google::protobuf::Field *field)
Definition: bloaty/third_party/protobuf/src/google/protobuf/util/internal/proto_writer.cc:381
google::protobuf::util::converter::ProtoWriter::ProtoWriter
ProtoWriter(TypeResolver *type_resolver, const google::protobuf::Type &type, strings::ByteSink *output, ErrorListener *listener)
Definition: bloaty/third_party/protobuf/src/google/protobuf/util/internal/proto_writer.cc:62
google::protobuf::util::converter::ProtoWriter::ProtoElement::required_fields_
std::set< const google::protobuf::Field * > required_fields_
Definition: bloaty/third_party/protobuf/src/google/protobuf/util/internal/proto_writer.h:226
google::protobuf.internal::WireFormatLite::WriteDouble
static void WriteDouble(int field_number, double value, io::CodedOutputStream *output)
Definition: bloaty/third_party/protobuf/src/google/protobuf/wire_format_lite.cc:462
message
char * message
Definition: libuv/docs/code/tty-gravity/main.c:12
done_
std::atomic< bool > done_
Definition: fuzzing_event_engine_test.cc:57
google::protobuf::StrCat
string StrCat(const AlphaNum &a, const AlphaNum &b)
Definition: bloaty/third_party/protobuf/src/google/protobuf/stubs/strutil.cc:1482
true
#define true
Definition: setup_once.h:324
google::protobuf::util::converter::ProtoWriter::ProtoElement::pop
ProtoElement * pop()
Definition: bloaty/third_party/protobuf/src/google/protobuf/util/internal/proto_writer.cc:347
google::protobuf::util::converter::TypeInfo::GetTypeByTypeUrl
virtual const google::protobuf::Type * GetTypeByTypeUrl(StringPiece type_url) const =0
google::protobuf.internal::WireFormatLite::MakeTag
constexpr static uint32 MakeTag(int field_number, WireType type)
Definition: bloaty/third_party/protobuf/src/google/protobuf/wire_format_lite.h:783
google::protobuf.internal::WireFormatLite::WriteBytes
static void WriteBytes(int field_number, const std::string &value, io::CodedOutputStream *output)
Definition: bloaty/third_party/protobuf/src/google/protobuf/wire_format_lite.cc:495
buffer_
static uint8 buffer_[kBufferSize]
Definition: bloaty/third_party/protobuf/src/google/protobuf/io/coded_stream_unittest.cc:136
absl::FormatConversionChar::e
@ e
autogen_x86imm.f
f
Definition: autogen_x86imm.py:9
benchmark.syntax
syntax
Definition: benchmark.py:90
google::protobuf.internal::WireFormatLite::WriteBool
static void WriteBool(int field_number, bool value, io::CodedOutputStream *output)
Definition: bloaty/third_party/protobuf/src/google/protobuf/wire_format_lite.cc:467
google::protobuf::util::converter::ProtoWriter::use_json_name_in_missing_fields_
bool use_json_name_in_missing_fields_
Definition: protobuf/src/google/protobuf/util/internal/proto_writer.h:350
google::protobuf::util::converter::ProtoWriter::StartObjectField
ProtoWriter * StartObjectField(const google::protobuf::Field &field, const google::protobuf::Type &type)
Definition: bloaty/third_party/protobuf/src/google/protobuf/util/internal/proto_writer.cc:577
google::protobuf::util::converter::ProtoWriter::~ProtoWriter
~ProtoWriter() override
Definition: bloaty/third_party/protobuf/src/google/protobuf/util/internal/proto_writer.cc:104
gmock_output_test.output
output
Definition: bloaty/third_party/googletest/googlemock/test/gmock_output_test.py:175
google::protobuf::util::converter::ProtoWriter::stream_
std::unique_ptr< io::CodedOutputStream > stream_
Definition: bloaty/third_party/protobuf/src/google/protobuf/util/internal/proto_writer.h:353
google::protobuf::util::converter::ProtoWriter::element_
std::unique_ptr< ProtoElement > element_
Definition: bloaty/third_party/protobuf/src/google/protobuf/util/internal/proto_writer.h:342
Field_Kind_Name
const std::string & Field_Kind_Name(T enum_t_value)
Definition: bloaty/third_party/protobuf/src/google/protobuf/type.pb.h:116
google::protobuf::util::converter::ProtoWriter::LookupType
const google::protobuf::Type * LookupType(const google::protobuf::Field *field)
Definition: bloaty/third_party/protobuf/src/google/protobuf/util/internal/proto_writer.cc:768
google::protobuf::util::converter::ProtoWriter::master_type_
const google::protobuf::Type & master_type_
Definition: bloaty/third_party/protobuf/src/google/protobuf/util/internal/proto_writer.h:316
google::protobuf.internal::WireFormatLite::WriteFixed32
static void WriteFixed32(int field_number, uint32 value, io::CodedOutputStream *output)
Definition: bloaty/third_party/protobuf/src/google/protobuf/wire_format_lite.cc:437
absl::Status::message
absl::string_view message() const
Definition: third_party/abseil-cpp/absl/status/status.h:806
google::protobuf.internal::WireFormatLite::WriteString
static void WriteString(int field_number, const std::string &value, io::CodedOutputStream *output)
Definition: bloaty/third_party/protobuf/src/google/protobuf/wire_format_lite.cc:478
google::protobuf::io::CodedOutputStream::VarintSize32
static size_t VarintSize32(uint32 value)
Definition: bloaty/third_party/protobuf/src/google/protobuf/io/coded_stream.h:1654
google::protobuf.internal::WireFormatLite::FieldType
FieldType
Definition: bloaty/third_party/protobuf/src/google/protobuf/wire_format_lite.h:111
data
char data[kBufferLength]
Definition: abseil-cpp/absl/strings/internal/str_format/float_conversion.cc:1006
performance.bq_upload_result.required
required
Definition: bq_upload_result.py:299
grpc::protobuf::io::CodedOutputStream
GRPC_CUSTOM_CODEDOUTPUTSTREAM CodedOutputStream
Definition: src/compiler/config.h:55
b
uint64_t b
Definition: abseil-cpp/absl/container/internal/layout_test.cc:53
google::protobuf.internal::WireFormatLite::WriteInt64
static void WriteInt64(int field_number, int64 value, io::CodedOutputStream *output)
Definition: bloaty/third_party/protobuf/src/google/protobuf/wire_format_lite.cc:412
google::protobuf.internal::WireFormatLite::WriteFloat
static void WriteFloat(int field_number, float value, io::CodedOutputStream *output)
Definition: bloaty/third_party/protobuf/src/google/protobuf/wire_format_lite.cc:457
google::protobuf::util::converter::ProtoWriter::WriteRootMessage
void WriteRootMessage()
Definition: bloaty/third_party/protobuf/src/google/protobuf/util/internal/proto_writer.cc:776
google::protobuf::util::converter::TypeInfo::FindField
virtual const google::protobuf::Field * FindField(const google::protobuf::Type *type, StringPiece camel_case_name) const =0
google::protobuf::util::converter::ProtoWriter::BeginNamed
const google::protobuf::Field * BeginNamed(StringPiece name, bool is_list)
Definition: bloaty/third_party/protobuf/src/google/protobuf/util/internal/proto_writer.cc:723
google::protobuf::util::converter::ProtoWriter::RenderDataPiece
virtual ProtoWriter * RenderDataPiece(StringPiece name, const DataPiece &value)
Definition: bloaty/third_party/protobuf/src/google/protobuf/util/internal/proto_writer.cc:534
SYNTAX_PROTO3
@ SYNTAX_PROTO3
Definition: bloaty/third_party/protobuf/src/google/protobuf/type.pb.h:157
google::protobuf::util::converter::ProtoWriter::case_insensitive_enum_parsing_
bool case_insensitive_enum_parsing_
Definition: bloaty/third_party/protobuf/src/google/protobuf/util/internal/proto_writer.h:335
google::protobuf::util::converter::ProtoWriter::invalid_depth_
int invalid_depth_
Definition: bloaty/third_party/protobuf/src/google/protobuf/util/internal/proto_writer.h:360
Field
struct Field Field
Definition: bloaty/third_party/protobuf/php/ext/google/protobuf/protobuf.h:647
output_
std::string output_
Definition: json_writer.cc:76
google::protobuf.internal::WireFormatLite::WriteSInt64
static void WriteSInt64(int field_number, int64 value, io::CodedOutputStream *output)
Definition: bloaty/third_party/protobuf/src/google/protobuf/wire_format_lite.cc:432
google::protobuf.internal::WireFormatLite::WriteEnum
static void WriteEnum(int field_number, int value, io::CodedOutputStream *output)
Definition: bloaty/third_party/protobuf/src/google/protobuf/wire_format_lite.cc:472
field
const FieldDescriptor * field
Definition: bloaty/third_party/protobuf/src/google/protobuf/compiler/parser_unittest.cc:2692
google::protobuf::util::converter::ProtoWriter::ProtoElement::ToString
std::string ToString() const override
Definition: bloaty/third_party/protobuf/src/google/protobuf/util/internal/proto_writer.cc:390
google::protobuf::util::converter::ProtoWriter::ProtoElement::size_index_
const int size_index_
Definition: bloaty/third_party/protobuf/src/google/protobuf/util/internal/proto_writer.h:227
index
int index
Definition: bloaty/third_party/protobuf/php/ext/google/protobuf/protobuf.h:1184
google::protobuf.internal::WireFormatLite::WriteSFixed64
static void WriteSFixed64(int field_number, int64 value, io::CodedOutputStream *output)
Definition: bloaty/third_party/protobuf/src/google/protobuf/wire_format_lite.cc:452
google::protobuf::util::converter::ProtoWriter::typeinfo_
const TypeInfo * typeinfo_
Definition: bloaty/third_party/protobuf/src/google/protobuf/util/internal/proto_writer.h:317
grpc::protobuf::util::Status
GRPC_CUSTOM_UTIL_STATUS Status
Definition: include/grpcpp/impl/codegen/config_protobuf.h:93
google::protobuf::util::converter::ProtoWriter::ProtoElement::ProtoElement
ProtoElement(const TypeInfo *typeinfo, const google::protobuf::Type &type, ProtoWriter *enclosing)
Definition: bloaty/third_party/protobuf/src/google/protobuf/util/internal/proto_writer.cc:288
google::protobuf::util::converter::ProtoWriter::ignore_unknown_enum_values_
bool ignore_unknown_enum_values_
Definition: bloaty/third_party/protobuf/src/google/protobuf/util/internal/proto_writer.h:328
google::protobuf::util::converter::ProtoWriter::StartObject
ProtoWriter * StartObject(StringPiece name) override
Definition: bloaty/third_party/protobuf/src/google/protobuf/util/internal/proto_writer.cc:454
absl::Status::ok
ABSL_MUST_USE_RESULT bool ok() const
Definition: third_party/abseil-cpp/absl/status/status.h:802
google::protobuf::ascii_isalnum
bool ascii_isalnum(char c)
Definition: bloaty/third_party/protobuf/src/google/protobuf/stubs/strutil.h:67
google::protobuf.internal::WireFormatLite::WireType
WireType
Definition: bloaty/third_party/protobuf/src/google/protobuf/wire_format_lite.h:101
google::protobuf::util::converter::ProtoWriter::IsRepeated
bool IsRepeated(const google::protobuf::Field &field)
Definition: bloaty/third_party/protobuf/src/google/protobuf/util/internal/proto_writer.cc:572
google::protobuf::util::converter::ProtoWriter::buffer_
std::string buffer_
Definition: bloaty/third_party/protobuf/src/google/protobuf/util/internal/proto_writer.h:351
google::protobuf::util::converter::ProtoWriter::ProtoElement::parent
ProtoElement * parent() const override
Definition: bloaty/third_party/protobuf/src/google/protobuf/util/internal/proto_writer.h:191
google::protobuf::io::CodedOutputStream::WriteVarint32ToArray
static uint8 * WriteVarint32ToArray(uint32 value, uint8 *target)
Definition: bloaty/third_party/protobuf/src/google/protobuf/io/coded_stream.h:1586
google::protobuf::util::converter::ProtoWriter::ProtoElement::IsOneofIndexTaken
bool IsOneofIndexTaken(int32 index)
Definition: bloaty/third_party/protobuf/src/google/protobuf/util/internal/proto_writer.cc:432
google::protobuf.internal::WireFormatLite::WriteSInt32
static void WriteSInt32(int field_number, int32 value, io::CodedOutputStream *output)
Definition: bloaty/third_party/protobuf/src/google/protobuf/wire_format_lite.cc:427
google::protobuf::util::converter::ProtoWriter::InvalidValue
void InvalidValue(StringPiece type_name, StringPiece value)
Definition: bloaty/third_party/protobuf/src/google/protobuf/util/internal/proto_writer.cc:445
google::protobuf.internal::WireFormatLite::WriteFixed64
static void WriteFixed64(int field_number, uint64 value, io::CodedOutputStream *output)
Definition: bloaty/third_party/protobuf/src/google/protobuf/wire_format_lite.cc:442
make_curve25519_tables.d
int d
Definition: make_curve25519_tables.py:53
google::protobuf::util::converter::ProtoWriter::adapter_
io::StringOutputStream adapter_
Definition: bloaty/third_party/protobuf/src/google/protobuf/util/internal/proto_writer.h:352
Field
Definition: bloaty/third_party/protobuf/src/google/protobuf/type.pb.h:446
google::protobuf::util::converter::ProtoWriter::own_typeinfo_
bool own_typeinfo_
Definition: bloaty/third_party/protobuf/src/google/protobuf/util/internal/proto_writer.h:319
asyncio_get_stats.type
type
Definition: asyncio_get_stats.py:37
google::protobuf::util::converter::ProtoWriter::ProtoElement::proto3_
bool proto3_
Definition: bloaty/third_party/protobuf/src/google/protobuf/util/internal/proto_writer.h:217
listener_
RefCountedPtr< Chttp2ServerListener > listener_
Definition: chttp2_server.cc:144
size
voidpf void uLong size
Definition: bloaty/third_party/zlib/contrib/minizip/ioapi.h:136
length
std::size_t length
Definition: abseil-cpp/absl/time/internal/test_util.cc:57
google::protobuf::util::converter::ProtoWriter::ProtoElement::TakeOneofIndex
void TakeOneofIndex(int32 index)
Definition: bloaty/third_party/protobuf/src/google/protobuf/util/internal/proto_writer.cc:436
int32_t
signed int int32_t
Definition: stdint-msvc2008.h:77
google::protobuf::util::converter::ProtoWriter::RenderPrimitiveField
ProtoWriter * RenderPrimitiveField(const google::protobuf::Field &field, const google::protobuf::Type &type, const DataPiece &value)
Definition: bloaty/third_party/protobuf/src/google/protobuf/util/internal/proto_writer.cc:606
phone_pb2.enum_type
enum_type
Definition: phone_pb2.py:198
google::protobuf.internal::WireFormatLite::WriteSFixed32
static void WriteSFixed32(int field_number, int32 value, io::CodedOutputStream *output)
Definition: bloaty/third_party/protobuf/src/google/protobuf/wire_format_lite.cc:447
google
Definition: bloaty/third_party/protobuf/benchmarks/util/data_proto2_to_proto3_util.h:11
google::protobuf::util::converter::ErrorListener::MissingField
virtual void MissingField(const LocationTrackerInterface &loc, StringPiece missing_name)=0
google::protobuf.internal::WireFormatLite::WriteInt32
static void WriteInt32(int field_number, int32 value, io::CodedOutputStream *output)
Definition: bloaty/third_party/protobuf/src/google/protobuf/wire_format_lite.cc:407
i
uint64_t i
Definition: abseil-cpp/absl/container/btree_benchmark.cc:230
google::protobuf::util::converter::ProtoWriter::Lookup
const google::protobuf::Field * Lookup(StringPiece name)
Definition: bloaty/third_party/protobuf/src/google/protobuf/util/internal/proto_writer.cc:743
type_name
static const char * type_name(int type)
Definition: adig.c:889
google::protobuf::StrAppend
void StrAppend(string *result, const AlphaNum &a)
Definition: bloaty/third_party/protobuf/src/google/protobuf/stubs/strutil.cc:1583
stream
voidpf stream
Definition: bloaty/third_party/zlib/contrib/minizip/ioapi.h:136


grpc
Author(s):
autogenerated on Fri May 16 2025 02:59:47