webkit  2cdf99a9e3038c7e01b3c37e8ad903ecbe5eecf1
https://github.com/WebKit/webkit
wire_format_lite_inl.h
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 // Author: kenton@google.com (Kenton Varda)
32 // wink@google.com (Wink Saville) (refactored from wire_format.h)
33 // Based on original Protocol Buffers design by
34 // Sanjay Ghemawat, Jeff Dean, and others.
35 
36 #ifndef GOOGLE_PROTOBUF_WIRE_FORMAT_LITE_INL_H__
37 #define GOOGLE_PROTOBUF_WIRE_FORMAT_LITE_INL_H__
38 
39 #ifdef _MSC_VER
40 // This is required for min/max on VS2013 only.
41 #include <algorithm>
42 #endif
43 
44 #include <string>
52 
53 
54 namespace google {
55 namespace protobuf {
56 namespace internal {
57 
58 // Implementation details of ReadPrimitive.
59 
60 template <>
61 inline bool WireFormatLite::ReadPrimitive<int32, WireFormatLite::TYPE_INT32>(
63  int32* value) {
64  uint32 temp;
65  if (!input->ReadVarint32(&temp)) return false;
66  *value = static_cast<int32>(temp);
67  return true;
68 }
69 template <>
70 inline bool WireFormatLite::ReadPrimitive<int64, WireFormatLite::TYPE_INT64>(
72  int64* value) {
73  uint64 temp;
74  if (!input->ReadVarint64(&temp)) return false;
75  *value = static_cast<int64>(temp);
76  return true;
77 }
78 template <>
79 inline bool WireFormatLite::ReadPrimitive<uint32, WireFormatLite::TYPE_UINT32>(
81  uint32* value) {
82  return input->ReadVarint32(value);
83 }
84 template <>
85 inline bool WireFormatLite::ReadPrimitive<uint64, WireFormatLite::TYPE_UINT64>(
87  uint64* value) {
88  return input->ReadVarint64(value);
89 }
90 template <>
91 inline bool WireFormatLite::ReadPrimitive<int32, WireFormatLite::TYPE_SINT32>(
93  int32* value) {
94  uint32 temp;
95  if (!input->ReadVarint32(&temp)) return false;
96  *value = ZigZagDecode32(temp);
97  return true;
98 }
99 template <>
100 inline bool WireFormatLite::ReadPrimitive<int64, WireFormatLite::TYPE_SINT64>(
102  int64* value) {
103  uint64 temp;
104  if (!input->ReadVarint64(&temp)) return false;
105  *value = ZigZagDecode64(temp);
106  return true;
107 }
108 template <>
109 inline bool WireFormatLite::ReadPrimitive<uint32, WireFormatLite::TYPE_FIXED32>(
111  uint32* value) {
112  return input->ReadLittleEndian32(value);
113 }
114 template <>
115 inline bool WireFormatLite::ReadPrimitive<uint64, WireFormatLite::TYPE_FIXED64>(
117  uint64* value) {
118  return input->ReadLittleEndian64(value);
119 }
120 template <>
121 inline bool WireFormatLite::ReadPrimitive<int32, WireFormatLite::TYPE_SFIXED32>(
123  int32* value) {
124  uint32 temp;
125  if (!input->ReadLittleEndian32(&temp)) return false;
126  *value = static_cast<int32>(temp);
127  return true;
128 }
129 template <>
130 inline bool WireFormatLite::ReadPrimitive<int64, WireFormatLite::TYPE_SFIXED64>(
132  int64* value) {
133  uint64 temp;
134  if (!input->ReadLittleEndian64(&temp)) return false;
135  *value = static_cast<int64>(temp);
136  return true;
137 }
138 template <>
139 inline bool WireFormatLite::ReadPrimitive<float, WireFormatLite::TYPE_FLOAT>(
141  float* value) {
142  uint32 temp;
143  if (!input->ReadLittleEndian32(&temp)) return false;
144  *value = DecodeFloat(temp);
145  return true;
146 }
147 template <>
148 inline bool WireFormatLite::ReadPrimitive<double, WireFormatLite::TYPE_DOUBLE>(
150  double* value) {
151  uint64 temp;
152  if (!input->ReadLittleEndian64(&temp)) return false;
153  *value = DecodeDouble(temp);
154  return true;
155 }
156 template <>
157 inline bool WireFormatLite::ReadPrimitive<bool, WireFormatLite::TYPE_BOOL>(
159  bool* value) {
160  uint64 temp;
161  if (!input->ReadVarint64(&temp)) return false;
162  *value = temp != 0;
163  return true;
164 }
165 template <>
166 inline bool WireFormatLite::ReadPrimitive<int, WireFormatLite::TYPE_ENUM>(
168  int* value) {
169  uint32 temp;
170  if (!input->ReadVarint32(&temp)) return false;
171  *value = static_cast<int>(temp);
172  return true;
173 }
174 
175 template <>
178  const uint8* buffer,
179  uint32* value) {
181 }
182 template <>
185  const uint8* buffer,
186  uint64* value) {
188 }
189 template <>
192  const uint8* buffer,
193  int32* value) {
194  uint32 temp;
196  *value = static_cast<int32>(temp);
197  return buffer;
198 }
199 template <>
202  const uint8* buffer,
203  int64* value) {
204  uint64 temp;
206  *value = static_cast<int64>(temp);
207  return buffer;
208 }
209 template <>
212  const uint8* buffer,
213  float* value) {
214  uint32 temp;
216  *value = DecodeFloat(temp);
217  return buffer;
218 }
219 template <>
222  const uint8* buffer,
223  double* value) {
224  uint64 temp;
226  *value = DecodeDouble(temp);
227  return buffer;
228 }
229 
230 template <typename CType, enum WireFormatLite::FieldType DeclaredType>
232  int, // tag_size, unused.
233  uint32 tag,
234  io::CodedInputStream* input,
236  CType value;
237  if (!ReadPrimitive<CType, DeclaredType>(input, &value)) return false;
238  values->Add(value);
239  int elements_already_reserved = values->Capacity() - values->size();
240  while (elements_already_reserved > 0 && input->ExpectTag(tag)) {
241  if (!ReadPrimitive<CType, DeclaredType>(input, &value)) return false;
242  values->AddAlreadyReserved(value);
243  elements_already_reserved--;
244  }
245  return true;
246 }
247 
248 template <typename CType, enum WireFormatLite::FieldType DeclaredType>
249 inline bool WireFormatLite::ReadRepeatedFixedSizePrimitive(
250  int tag_size,
251  uint32 tag,
252  io::CodedInputStream* input,
254  GOOGLE_DCHECK_EQ(UInt32Size(tag), tag_size);
255  CType value;
256  if (!ReadPrimitive<CType, DeclaredType>(input, &value))
257  return false;
258  values->Add(value);
259 
260  // For fixed size values, repeated values can be read more quickly by
261  // reading directly from a raw array.
262  //
263  // We can get a tight loop by only reading as many elements as can be
264  // added to the RepeatedField without having to do any resizing. Additionally,
265  // we only try to read as many elements as are available from the current
266  // buffer space. Doing so avoids having to perform boundary checks when
267  // reading the value: the maximum number of elements that can be read is
268  // known outside of the loop.
269  const void* void_pointer;
270  int size;
271  input->GetDirectBufferPointerInline(&void_pointer, &size);
272  if (size > 0) {
273  const uint8* buffer = reinterpret_cast<const uint8*>(void_pointer);
274  // The number of bytes each type occupies on the wire.
275  const int per_value_size = tag_size + sizeof(value);
276 
277  int elements_available =
278  std::min(values->Capacity() - values->size(), size / per_value_size);
279  int num_read = 0;
280  while (num_read < elements_available &&
282  buffer, tag)) != NULL) {
283  buffer = ReadPrimitiveFromArray<CType, DeclaredType>(buffer, &value);
284  values->AddAlreadyReserved(value);
285  ++num_read;
286  }
287  const int read_bytes = num_read * per_value_size;
288  if (read_bytes > 0) {
289  input->Skip(read_bytes);
290  }
291  }
292  return true;
293 }
294 
295 // Specializations of ReadRepeatedPrimitive for the fixed size types, which use
296 // the optimized code path.
297 #define READ_REPEATED_FIXED_SIZE_PRIMITIVE(CPPTYPE, DECLARED_TYPE) \
298 template <> \
299 inline bool WireFormatLite::ReadRepeatedPrimitive< \
300  CPPTYPE, WireFormatLite::DECLARED_TYPE>( \
301  int tag_size, \
302  uint32 tag, \
303  io::CodedInputStream* input, \
304  RepeatedField<CPPTYPE>* values) { \
305  return ReadRepeatedFixedSizePrimitive< \
306  CPPTYPE, WireFormatLite::DECLARED_TYPE>( \
307  tag_size, tag, input, values); \
308 }
309 
316 
317 #undef READ_REPEATED_FIXED_SIZE_PRIMITIVE
318 
319 template <typename CType, enum WireFormatLite::FieldType DeclaredType>
321  int tag_size,
322  uint32 tag,
323  io::CodedInputStream* input,
325  return ReadRepeatedPrimitive<CType, DeclaredType>(
326  tag_size, tag, input, value);
327 }
328 
329 template <typename CType, enum WireFormatLite::FieldType DeclaredType>
332  uint32 length;
333  if (!input->ReadVarint32(&length)) return false;
334  io::CodedInputStream::Limit limit = input->PushLimit(length);
335  while (input->BytesUntilLimit() > 0) {
336  CType value;
337  if (!ReadPrimitive<CType, DeclaredType>(input, &value)) return false;
338  values->Add(value);
339  }
340  input->PopLimit(limit);
341  return true;
342 }
343 
344 template <typename CType, enum WireFormatLite::FieldType DeclaredType>
345 inline bool WireFormatLite::ReadPackedFixedSizePrimitive(
347  uint32 length;
348  if (!input->ReadVarint32(&length)) return false;
349  const uint32 old_entries = values->size();
350  const uint32 new_entries = length / sizeof(CType);
351  const uint32 new_bytes = new_entries * sizeof(CType);
352  if (new_bytes != length) return false;
353  // We would *like* to pre-allocate the buffer to write into (for
354  // speed), but *must* avoid performing a very large allocation due
355  // to a malicious user-supplied "length" above. So we have a fast
356  // path that pre-allocates when the "length" is less than a bound.
357  // We determine the bound by calling BytesUntilTotalBytesLimit() and
358  // BytesUntilLimit(). These return -1 to mean "no limit set".
359  // There are four cases:
360  // TotalBytesLimit Limit
361  // -1 -1 Use slow path.
362  // -1 >= 0 Use fast path if length <= Limit.
363  // >= 0 -1 Use slow path.
364  // >= 0 >= 0 Use fast path if length <= min(both limits).
365  int64 bytes_limit = input->BytesUntilTotalBytesLimit();
366  if (bytes_limit == -1) {
367  bytes_limit = input->BytesUntilLimit();
368  } else {
369  bytes_limit =
370  std::min(bytes_limit, static_cast<int64>(input->BytesUntilLimit()));
371  }
372  if (bytes_limit >= new_bytes) {
373  // Fast-path that pre-allocates *values to the final size.
374 #if defined(PROTOBUF_LITTLE_ENDIAN)
375  values->Resize(old_entries + new_entries, 0);
376  // values->mutable_data() may change after Resize(), so do this after:
377  void* dest = reinterpret_cast<void*>(values->mutable_data() + old_entries);
378  if (!input->ReadRaw(dest, new_bytes)) {
379  values->Truncate(old_entries);
380  return false;
381  }
382 #else
383  values->Reserve(old_entries + new_entries);
384  CType value;
385  for (uint32 i = 0; i < new_entries; ++i) {
386  if (!ReadPrimitive<CType, DeclaredType>(input, &value)) return false;
387  values->AddAlreadyReserved(value);
388  }
389 #endif
390  } else {
391  // This is the slow-path case where "length" may be too large to
392  // safely allocate. We read as much as we can into *values
393  // without pre-allocating "length" bytes.
394  CType value;
395  for (uint32 i = 0; i < new_entries; ++i) {
396  if (!ReadPrimitive<CType, DeclaredType>(input, &value)) return false;
397  values->Add(value);
398  }
399  }
400  return true;
401 }
402 
403 // Specializations of ReadPackedPrimitive for the fixed size types, which use
404 // an optimized code path.
405 #define READ_REPEATED_PACKED_FIXED_SIZE_PRIMITIVE(CPPTYPE, DECLARED_TYPE) \
406 template <> \
407 inline bool WireFormatLite::ReadPackedPrimitive< \
408  CPPTYPE, WireFormatLite::DECLARED_TYPE>( \
409  io::CodedInputStream* input, \
410  RepeatedField<CPPTYPE>* values) { \
411  return ReadPackedFixedSizePrimitive< \
412  CPPTYPE, WireFormatLite::DECLARED_TYPE>(input, values); \
413 }
414 
421 
422 #undef READ_REPEATED_PACKED_FIXED_SIZE_PRIMITIVE
423 
424 template <typename CType, enum WireFormatLite::FieldType DeclaredType>
427  return ReadPackedPrimitive<CType, DeclaredType>(input, values);
428 }
429 
430 
431 
433  io::CodedInputStream* input,
434  MessageLite* value) {
435  if (!input->IncrementRecursionDepth()) return false;
436  if (!value->MergePartialFromCodedStream(input)) return false;
437  input->DecrementRecursionDepth();
438  // Make sure the last thing read was an end tag for this group.
439  if (!input->LastTagWas(MakeTag(field_number, WIRETYPE_END_GROUP))) {
440  return false;
441  }
442  return true;
443 }
445  MessageLite* value) {
446  uint32 length;
447  if (!input->ReadVarint32(&length)) return false;
448  std::pair<io::CodedInputStream::Limit, int> p =
450  if (p.second < 0 || !value->MergePartialFromCodedStream(input)) return false;
451  // Make sure that parsing stopped when the limit was hit, not at an endgroup
452  // tag.
453  return input->DecrementRecursionDepthAndPopLimit(p.first);
454 }
455 
456 // We name the template parameter something long and extremely unlikely to occur
457 // elsewhere because a *qualified* member access expression designed to avoid
458 // virtual dispatch, C++03 [basic.lookup.classref] 3.4.5/4 requires that the
459 // name of the qualifying class to be looked up both in the context of the full
460 // expression (finding the template parameter) and in the context of the object
461 // whose member we are accessing. This could potentially find a nested type
462 // within that object. The standard goes on to require these names to refer to
463 // the same entity, which this collision would violate. The lack of a safe way
464 // to avoid this collision appears to be a defect in the standard, but until it
465 // is corrected, we choose the name to avoid accidental collisions.
466 template<typename MessageType_WorkAroundCppLookupDefect>
469  MessageType_WorkAroundCppLookupDefect* value) {
470  if (!input->IncrementRecursionDepth()) return false;
471  if (!value->
472  MessageType_WorkAroundCppLookupDefect::MergePartialFromCodedStream(input))
473  return false;
475  // Make sure the last thing read was an end tag for this group.
476  if (!input->LastTagWas(MakeTag(field_number, WIRETYPE_END_GROUP))) {
477  return false;
478  }
479  return true;
480 }
481 template<typename MessageType_WorkAroundCppLookupDefect>
484  MessageType_WorkAroundCppLookupDefect* value) {
485  return value->MessageType_WorkAroundCppLookupDefect:: MergePartialFromCodedStream(input) &&
486  input->LastTagWas(MakeTag(field_number, WIRETYPE_END_GROUP));
487 }
488 template<typename MessageType_WorkAroundCppLookupDefect>
490  io::CodedInputStream* input, MessageType_WorkAroundCppLookupDefect* value) {
491  uint32 length;
492  if (!input->ReadVarint32(&length)) return false;
493  std::pair<io::CodedInputStream::Limit, int> p =
495  if (p.second < 0 || !value->
496  MessageType_WorkAroundCppLookupDefect::MergePartialFromCodedStream(input))
497  return false;
498  // Make sure that parsing stopped when the limit was hit, not at an endgroup
499  // tag.
500  return input->DecrementRecursionDepthAndPopLimit(p.first);
501 }
502 template<typename MessageType_WorkAroundCppLookupDefect>
504  io::CodedInputStream* input, MessageType_WorkAroundCppLookupDefect* value) {
506  if (!value->
507  MessageType_WorkAroundCppLookupDefect::MergePartialFromCodedStream(input))
508  return false;
509  // Make sure that parsing stopped when the limit was hit, not at an endgroup
510  // tag.
511  return input->CheckEntireMessageConsumedAndPopLimit(old_limit);
512 }
513 
514 // ===================================================================
515 
518  output->WriteTag(MakeTag(field_number, type));
519 }
520 
523  output->WriteVarint32SignExtended(value);
524 }
527  output->WriteVarint64(static_cast<uint64>(value));
528 }
531  output->WriteVarint32(value);
532 }
535  output->WriteVarint64(value);
536 }
540 }
544 }
547  output->WriteLittleEndian32(value);
548 }
551  output->WriteLittleEndian64(value);
552 }
555  output->WriteLittleEndian32(static_cast<uint32>(value));
556 }
559  output->WriteLittleEndian64(static_cast<uint64>(value));
560 }
561 inline void WireFormatLite::WriteFloatNoTag(float value,
564 }
565 inline void WireFormatLite::WriteDoubleNoTag(double value,
568 }
569 inline void WireFormatLite::WriteBoolNoTag(bool value,
571  output->WriteVarint32(value ? 1 : 0);
572 }
573 inline void WireFormatLite::WriteEnumNoTag(int value,
576 }
577 
578 // See comment on ReadGroupNoVirtual to understand the need for this template
579 // parameter name.
580 template<typename MessageType_WorkAroundCppLookupDefect>
582  int field_number, const MessageType_WorkAroundCppLookupDefect& value,
583  io::CodedOutputStream* output) {
585  value.MessageType_WorkAroundCppLookupDefect::SerializeWithCachedSizes(output);
587 }
588 template<typename MessageType_WorkAroundCppLookupDefect>
590  int field_number, const MessageType_WorkAroundCppLookupDefect& value,
591  io::CodedOutputStream* output) {
593  output->WriteVarint32(
594  value.MessageType_WorkAroundCppLookupDefect::GetCachedSize());
595  value.MessageType_WorkAroundCppLookupDefect::SerializeWithCachedSizes(output);
596 }
597 
598 // ===================================================================
599 
602  uint8* target) {
604  target);
605 }
606 
610 }
614  static_cast<uint64>(value), target);
615 }
619 }
623 }
627  target);
628 }
632  target);
633 }
637 }
641 }
645  static_cast<uint32>(value), target);
646 }
650  static_cast<uint64>(value), target);
651 }
655  target);
656 }
660  target);
661 }
665 }
669 }
670 
673  uint8* target) {
676 }
679  uint8* target) {
682 }
685  uint8* target) {
688 }
691  uint8* target) {
694 }
697  uint8* target) {
700 }
703  uint8* target) {
706 }
709  uint8* target) {
712 }
715  uint8* target) {
718 }
721  uint8* target) {
724 }
727  uint8* target) {
730 }
732  float value,
733  uint8* target) {
736 }
738  double value,
739  uint8* target) {
742 }
744  bool value,
745  uint8* target) {
748 }
750  int value,
751  uint8* target) {
754 }
755 
757  const string& value,
758  uint8* target) {
759  // String is for UTF-8 text only
760  // WARNING: In wire_format.cc, both strings and bytes are handled by
761  // WriteString() to avoid code duplication. If the implementations become
762  // different, you will need to update that usage.
765 }
767  const string& value,
768  uint8* target) {
771 }
772 
773 
776  uint8* target) {
780 }
782  const MessageLite& value,
783  uint8* target) {
786  value.GetCachedSize(), target);
788 }
789 
790 // See comment on ReadGroupNoVirtual to understand the need for this template
791 // parameter name.
792 template<typename MessageType_WorkAroundCppLookupDefect>
794  int field_number, const MessageType_WorkAroundCppLookupDefect& value,
795  uint8* target) {
797  target = value.MessageType_WorkAroundCppLookupDefect ::SerializeWithCachedSizesToArray(target);
799 }
800 template<typename MessageType_WorkAroundCppLookupDefect>
802  int field_number, const MessageType_WorkAroundCppLookupDefect& value,
806  value.MessageType_WorkAroundCppLookupDefect::GetCachedSize(), target);
807  return value.MessageType_WorkAroundCppLookupDefect ::SerializeWithCachedSizesToArray(target);
808 }
809 
810 // ===================================================================
811 
812 inline int WireFormatLite::Int32Size(int32 value) {
814 }
815 inline int WireFormatLite::Int64Size(int64 value) {
816  return io::CodedOutputStream::VarintSize64(static_cast<uint64>(value));
817 }
820 }
823 }
826 }
829 }
830 inline int WireFormatLite::EnumSize(int value) {
832 }
834 inline int WireFormatLite::StringSize(const string& value) {
835  return static_cast<int>(
836  io::CodedOutputStream::VarintSize32(static_cast<uint32>(value.size())) +
837  value.size());
838 }
839 inline int WireFormatLite::BytesSize(const string& value) {
840  return static_cast<int>(
841  io::CodedOutputStream::VarintSize32(static_cast<uint32>(value.size())) +
842  value.size());
843 }
844 
845 
846 inline int WireFormatLite::GroupSize(const MessageLite& value) {
847  return value.ByteSize();
848 }
849 inline int WireFormatLite::MessageSize(const MessageLite& value) {
850  return LengthDelimitedSize(value.ByteSize());
851 }
853 // See comment on ReadGroupNoVirtual to understand the need for this template
854 // parameter name.
855 template<typename MessageType_WorkAroundCppLookupDefect>
857  const MessageType_WorkAroundCppLookupDefect& value) {
858  return value.MessageType_WorkAroundCppLookupDefect::ByteSize();
859 }
860 template<typename MessageType_WorkAroundCppLookupDefect>
862  const MessageType_WorkAroundCppLookupDefect& value) {
863  return LengthDelimitedSize(
864  value.MessageType_WorkAroundCppLookupDefect::ByteSize());
865 }
866 
869 }
871 } // namespace internal
872 } // namespace protobuf
873 
874 } // namespace google
875 #endif // GOOGLE_PROTOBUF_WIRE_FORMAT_LITE_INL_H__
876 
static int Int64Size(int64 value)
Definition: wire_format_lite_inl.h:818
virtual int GetCachedSize() const =0
static int SInt64Size(int64 value)
Definition: wire_format_lite_inl.h:830
static INL uint8 * WriteSFixed32NoTagToArray(int32 value, output)
Definition: wire_format_lite_inl.h:643
void Resize(int new_size, const Element &value)
Definition: repeated_field.h:1067
static uint8 * WriteVarint32SignExtendedToArray(int32 value, uint8 *target)
Definition: coded_stream.h:1091
bool Skip(int count)
Definition: coded_stream.cc:214
static INL bool ReadPackedPrimitive(input, RepeatedField< CType > *value)
static INL uint8 * WriteDoubleNoTagToArray(double value, output)
Definition: wire_format_lite_inl.h:658
#define size
Definition: float-mm.c:27
bool CheckEntireMessageConsumedAndPopLimit(Limit limit)
Definition: coded_stream.cc:173
#define ZigZagDecode32(x)
static uint8 * WriteVarint64ToArray(uint64 value, uint8 *target)
Definition: coded_stream.cc:847
static INL uint8 * WriteEnumToArray(field_number, int value, output)
Definition: wire_format_lite_inl.h:750
DOMString p
Definition: WebCryptoAPI.idl:116
static INL uint8 * WriteFloatNoTagToArray(float value, output)
Definition: wire_format_lite_inl.h:653
int size() const
Definition: repeated_field.h:1045
static int UInt64Size(uint64 value)
Definition: wire_format_lite_inl.h:824
static int BytesSize(const string &value)
Definition: wire_format_lite_inl.h:842
static bool ReadMessageNoVirtual(input, MessageType *value)
static INL void WriteSInt64NoTag(int64 value, output)
Definition: wire_format_lite_inl.h:542
static INL uint8 * WriteBytesToArray(field_number, const string &value, output)
Definition: wire_format_lite_inl.h:767
static INL const uint8 * ReadPrimitiveFromArray(const uint8 *buffer, CType *value)
static int VarintSize32(uint32 value)
Definition: coded_stream.h:1155
#define GOOGLE_DCHECK_EQ
Definition: logging.h:194
Definition: xmlparse.c:181
EGLContext EGLenum target
Definition: eglext.h:192
#define ZigZagDecode64(x)
static INL uint8 * WriteInt64ToArray(field_number, int64 value, output)
Definition: wire_format_lite_inl.h:678
static INL void WriteFloatNoTag(float value, output)
Definition: wire_format_lite_inl.h:562
bool IncrementRecursionDepth()
Definition: coded_stream.h:1207
bool ReadVarint32(uint32 *value)
Definition: coded_stream.h:845
uint8_t uint8
Definition: port.h:133
static uint8 * WriteVarint32ToArray(uint32 value, uint8 *target)
Definition: coded_stream.h:1072
Limit ReadLengthAndPushLimit()
Definition: coded_stream.cc:160
bool DecrementRecursionDepthAndPopLimit(Limit limit)
Definition: coded_stream.cc:165
WireType
Definition: wire_format_lite.h:86
static INL uint8 * WriteFixed64ToArray(field_number, uint64 value, output)
Definition: wire_format_lite_inl.h:714
dest
Definition: upload.py:394
int BytesUntilTotalBytesLimit() const
Definition: coded_stream.cc:201
static INL uint8 * WriteUInt32NoTagToArray(uint32 value, output)
Definition: wire_format_lite_inl.h:617
static INL void WriteInt32NoTag(int32 value, output)
Definition: wire_format_lite_inl.h:522
static const uint8 * ReadLittleEndian64FromArray(const uint8 *buffer, uint64 *value)
Definition: coded_stream.h:887
static int StringSize(const string &value)
Definition: wire_format_lite_inl.h:837
static bool ReadMessageNoVirtualNoRecursionDepth(input, MessageType *value)
static uint8 * WriteStringWithSizeToArray(const string &str, uint8 *target)
Definition: coded_stream.cc:908
static INL uint8 * WriteTagToArray(field_number, WireType type, output)
Definition: wire_format_lite_inl.h:601
static INL void WriteDoubleNoTag(double value, output)
Definition: wire_format_lite_inl.h:566
int BytesUntilLimit() const
Definition: coded_stream.cc:179
static INL uint8 * WriteInt32NoTagToArray(int32 value, output)
Definition: wire_format_lite_inl.h:608
static const uint8 * ReadLittleEndian32FromArray(const uint8 *buffer, uint32 *value)
Definition: coded_stream.h:872
Element * mutable_data()
Definition: repeated_field.h:1177
static INL uint8 * WriteMessageNoVirtualToArray(field_number, const MessageType &value, output)
void WriteVarint32SignExtended(int32 value)
Definition: coded_stream.h:1083
static INL uint8 * WriteUInt32ToArray(field_number, uint32 value, output)
Definition: wire_format_lite_inl.h:684
#define output
Definition: wire_format_lite.h:418
void UnsafeDecrementRecursionDepth()
Definition: coded_stream.h:1216
void Truncate(int new_size)
Definition: repeated_field.h:1305
static bool ReadMessage(input, MessageLite *value)
Definition: wire_format_lite_inl.h:444
uint64_t uint64
Definition: angle_config.h:30
virtual bool MergePartialFromCodedStream(io::CodedInputStream *input)=0
DOMString tag
Definition: Notification.idl:66
int64_t int64
Definition: angle_config.h:29
void DecrementRecursionDepth()
Definition: coded_stream.h:1212
const FieldDescriptor const OneofDescriptor value
Definition: descriptor.h:1717
static INL uint8 * WriteSFixed32ToArray(field_number, int32 value, output)
Definition: wire_format_lite_inl.h:720
int32_t int32
Definition: port.h:130
static INL uint8 * WriteInt64NoTagToArray(int64 value, output)
Definition: wire_format_lite_inl.h:612
static INL void WriteFixed64NoTag(uint64 value, output)
Definition: wire_format_lite_inl.h:550
GLenum GLsizei GLsizei GLint * values
Definition: gl2ext.h:1222
bool LastTagWas(uint32 expected)
Definition: coded_stream.h:991
static INL uint8 * WriteFixed32NoTagToArray(uint32 value, output)
Definition: wire_format_lite_inl.h:635
Limit PushLimit(int byte_limit)
Definition: coded_stream.cc:119
static INL uint8 * WriteMessageToArray(field_number, const MessageLite &value, output)
Definition: wire_format_lite_inl.h:782
void WriteTag(uint32 value)
Definition: coded_stream.h:1146
EGLAttrib * value
Definition: eglext.h:120
int Limit
Definition: coded_stream.h:314
static INL uint8 * WriteDoubleToArray(field_number, double value, output)
Definition: wire_format_lite_inl.h:738
static int VarintSize32SignExtended(int32 value)
Definition: coded_stream.h:1163
static int MessageSizeNoVirtual(const MessageType &value)
static bool ReadRepeatedPrimitiveNoInline(int tag_size, uint32 tag, input, RepeatedField< CType > *value)
static INL uint8 * WriteFixed64NoTagToArray(uint64 value, output)
Definition: wire_format_lite_inl.h:639
Definition: message.h:158
static bool ReadPackedPrimitiveNoInline(input, RepeatedField< CType > *value)
virtual uint8 * SerializeWithCachedSizesToArray(uint8 *target) const
Definition: message_lite.cc:224
void Add(const Element &value)
Definition: repeated_field.h:1099
virtual int ByteSize() const =0
static INL bool ReadRepeatedPrimitive(int tag_size, uint32 tag, input, RepeatedField< CType > *value)
static INL void WriteBoolNoTag(bool value, output)
Definition: wire_format_lite_inl.h:570
Definition: message_lite.h:78
uint32_t uint32
Definition: port.h:135
static int SInt32Size(int32 value)
Definition: wire_format_lite_inl.h:827
static uint64 ZigZagEncode64(int64 n)
Definition: wire_format_lite.h:670
Definition: __init__.py:1
static int EnumSize(int value)
Definition: wire_format_lite_inl.h:833
uint64_t uint64
Definition: port.h:136
static INL uint8 * WriteSInt32NoTagToArray(int32 value, output)
Definition: wire_format_lite_inl.h:625
static INL uint8 * WriteSInt32ToArray(field_number, int32 value, output)
Definition: wire_format_lite_inl.h:696
static GOOGLE_ATTRIBUTE_ALWAYS_INLINE uint8 * WriteTagToArray(uint32 value, uint8 *target)
Definition: coded_stream.h:1150
bool ReadRaw(void *buffer, int size)
Definition: coded_stream.cc:259
static bool ReadGroupNoVirtual(field_number, input, MessageType *value)
static GOOGLE_ATTRIBUTE_ALWAYS_INLINE const uint8 * ExpectTagFromArray(const uint8 *buffer, uint32 expected)
Definition: coded_stream.h:1022
static void WriteMessageNoVirtual(field_number, const MessageType &value, output)
static int MessageSize(const MessageLite &value)
Definition: wire_format_lite_inl.h:852
static INL uint8 * WriteSInt64NoTagToArray(int64 value, output)
Definition: wire_format_lite_inl.h:630
static uint32 EncodeFloat(float value)
Definition: wire_format_lite.h:613
static void WriteGroupNoVirtual(field_number, const MessageType &value, output)
static INL void WriteSFixed64NoTag(int64 value, output)
Definition: wire_format_lite_inl.h:558
void AddAlreadyReserved(const Element &value)
Definition: repeated_field.h:1055
EGLenum type
Definition: eglext.h:63
static bool ReadGroup(field_number, input, MessageLite *value)
Definition: wire_format_lite_inl.h:432
static INL uint8 * WriteFixed32ToArray(field_number, uint32 value, output)
Definition: wire_format_lite_inl.h:708
static INL uint8 * WriteUInt64ToArray(field_number, uint64 value, output)
Definition: wire_format_lite_inl.h:690
Definition: document.h:393
static INL uint8 * WriteStringToArray(field_number, const string &value, output)
Definition: wire_format_lite_inl.h:757
std::pair< CodedInputStream::Limit, int > IncrementRecursionDepthAndPushLimit(int byte_limit)
Definition: coded_stream.cc:156
#define buffer
Definition: xmlparse.c:622
static INL uint8 * WriteSFixed64ToArray(field_number, int64 value, output)
Definition: wire_format_lite_inl.h:726
#define min(a, b)
Definition: user_environment.h:66
static INL void WriteEnumNoTag(int value, output)
Definition: wire_format_lite_inl.h:574
static int UInt32Size(uint32 value)
Definition: wire_format_lite_inl.h:821
static INL void WriteUInt32NoTag(uint32 value, output)
Definition: wire_format_lite_inl.h:530
static INL void WriteInt64NoTag(int64 value, output)
Definition: wire_format_lite_inl.h:526
for i
Definition: complexityMeasures.m:24
static INL uint8 * WriteGroupToArray(field_number, const MessageLite &value, output)
Definition: wire_format_lite_inl.h:775
static bool ReadGroupNoVirtualNoRecursionDepth(field_number, input, MessageType *value)
static INL uint8 * WriteGroupNoVirtualToArray(field_number, const MessageType &value, output)
GOOGLE_ATTRIBUTE_ALWAYS_INLINE void GetDirectBufferPointerInline(const void **data, int *size)
Definition: coded_stream.h:1037
static INL uint8 * WriteFloatToArray(field_number, float value, output)
Definition: wire_format_lite_inl.h:732
static int Int32Size(int32 value)
Definition: wire_format_lite_inl.h:815
int64_t int64
Definition: port.h:131
static INL void WriteTag(field_number, WireType type, output)
Definition: wire_format_lite_inl.h:517
static uint8 * WriteLittleEndian32ToArray(uint32 value, uint8 *target)
Definition: coded_stream.h:1100
#define NULL
Definition: common_types.h:41
static INL void WriteFixed32NoTag(uint32 value, output)
Definition: wire_format_lite_inl.h:546
void WriteVarint64(uint64 value)
Definition: coded_stream.cc:824
int Capacity() const
Definition: repeated_field.h:1050
GOOGLE_ATTRIBUTE_ALWAYS_INLINE bool ExpectTag(uint32 expected)
Definition: coded_stream.h:999
static INL void WriteUInt64NoTag(uint64 value, output)
Definition: wire_format_lite_inl.h:534
static uint64 EncodeDouble(double value)
Definition: wire_format_lite.h:625
#define READ_REPEATED_FIXED_SIZE_PRIMITIVE(CPPTYPE, DECLARED_TYPE)
Definition: wire_format_lite_inl.h:297
uint32_t uint32
Definition: angle_config.h:28
Definition: gflags_completions.h:115
static INL uint8 * WriteBoolToArray(field_number, bool value, output)
Definition: wire_format_lite_inl.h:744
static int LengthDelimitedSize(int length)
Definition: wire_format_lite_inl.h:870
string input
Definition: tokenizer_unittest.cc:198
static int GroupSize(const MessageLite &value)
Definition: wire_format_lite_inl.h:849
static INL void WriteSInt32NoTag(int32 value, output)
Definition: wire_format_lite_inl.h:538
static INL uint8 * WriteSFixed64NoTagToArray(int64 value, output)
Definition: wire_format_lite_inl.h:648
Definition: coded_stream.h:665
void WriteLittleEndian32(uint32 value)
Definition: coded_stream.cc:714
static uint32 ZigZagEncode32(int32 n)
Definition: wire_format_lite.h:661
static int VarintSize64(uint64 value)
Definition: coded_stream.cc:880
void WriteLittleEndian64(uint64 value)
Definition: coded_stream.cc:729
void WriteVarint32(uint32 value)
Definition: coded_stream.h:1133
static INL void WriteSFixed32NoTag(int32 value, output)
Definition: wire_format_lite_inl.h:554
static INL uint8 * WriteBoolNoTagToArray(bool value, output)
Definition: wire_format_lite_inl.h:663
static INL uint8 * WriteEnumNoTagToArray(int value, output)
Definition: wire_format_lite_inl.h:667
Definition: coded_stream.h:159
static INL uint8 * WriteSInt64ToArray(field_number, int64 value, output)
Definition: wire_format_lite_inl.h:702
#define READ_REPEATED_PACKED_FIXED_SIZE_PRIMITIVE(CPPTYPE, DECLARED_TYPE)
Definition: wire_format_lite_inl.h:405
temp
Definition: parse_delay_file.m:64
static uint8 * WriteLittleEndian64ToArray(uint64 value, uint8 *target)
Definition: coded_stream.h:1113
static uint32 MakeTag(int field_number, WireType type)
Definition: wire_format_lite.h:589
void PopLimit(Limit limit)
Definition: coded_stream.cc:144
static INL uint8 * WriteInt32ToArray(field_number, int32 value, output)
Definition: wire_format_lite_inl.h:672
GLuint GLsizei GLsizei * length
Definition: gl2.h:435
static int GroupSizeNoVirtual(const MessageType &value)
int32_t int32
Definition: angle_config.h:27
static INL uint8 * WriteUInt64NoTagToArray(uint64 value, output)
Definition: wire_format_lite_inl.h:621
#define field_number
Definition: wire_format_lite.h:244
void Reserve(int new_size)
Definition: repeated_field.h:1260