protobuf/src/google/protobuf/io/coded_stream.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 // Author: kenton@google.com (Kenton Varda)
32 // Based on original Protocol Buffers design by
33 // Sanjay Ghemawat, Jeff Dean, and others.
34 //
35 // This implementation is heavily optimized to make reads and writes
36 // of small values (especially varints) as fast as possible. In
37 // particular, we optimize for the common case that a read or a write
38 // will not cross the end of the buffer, since we can avoid a lot
39 // of branching in this case.
40 
41 #include <google/protobuf/io/coded_stream.h>
42 
43 #include <limits.h>
44 
45 #include <algorithm>
46 #include <cstring>
47 #include <utility>
48 
49 #include <google/protobuf/stubs/logging.h>
50 #include <google/protobuf/stubs/common.h>
51 #include <google/protobuf/arena.h>
52 #include <google/protobuf/io/zero_copy_stream.h>
53 #include <google/protobuf/io/zero_copy_stream_impl_lite.h>
54 #include <google/protobuf/stubs/stl_util.h>
55 
56 
57 #include <google/protobuf/port_def.inc>
58 
59 namespace google {
60 namespace protobuf {
61 namespace io {
62 
63 namespace {
64 
65 static const int kMaxVarintBytes = 10;
66 static const int kMaxVarint32Bytes = 5;
67 
68 
69 inline bool NextNonEmpty(ZeroCopyInputStream* input, const void** data,
70  int* size) {
71  bool success;
72  do {
73  success = input->Next(data, size);
74  } while (success && *size == 0);
75  return success;
76 }
77 
78 } // namespace
79 
80 // CodedInputStream ==================================================
81 
83  if (input_ != NULL) {
85  }
86 }
87 
88 // Static.
90 
91 
93  int backup_bytes = BufferSize() + buffer_size_after_limit_ + overflow_bytes_;
94  if (backup_bytes > 0) {
95  input_->BackUp(backup_bytes);
96 
97  // total_bytes_read_ doesn't include overflow_bytes_.
101  overflow_bytes_ = 0;
102  }
103 }
104 
107  int closest_limit = std::min(current_limit_, total_bytes_limit_);
108  if (closest_limit < total_bytes_read_) {
109  // The limit position is in the current buffer. We must adjust
110  // the buffer size accordingly.
113  } else {
115  }
116 }
117 
119  // Current position relative to the beginning of the stream.
120  int current_position = CurrentPosition();
121 
122  Limit old_limit = current_limit_;
123 
124  // security: byte_limit is possibly evil, so check for negative values
125  // and overflow. Also check that the new requested limit is before the
126  // previous limit; otherwise we continue to enforce the previous limit.
127  if (PROTOBUF_PREDICT_TRUE(byte_limit >= 0 &&
128  byte_limit <= INT_MAX - current_position &&
129  byte_limit < current_limit_ - current_position)) {
130  current_limit_ = current_position + byte_limit;
132  }
133 
134  return old_limit;
135 }
136 
137 void CodedInputStream::PopLimit(Limit limit) {
138  // The limit passed in is actually the *old* limit, which we returned from
139  // PushLimit().
140  current_limit_ = limit;
142 
143  // We may no longer be at a legitimate message end. ReadTag() needs to be
144  // called again to find out.
145  legitimate_message_end_ = false;
146 }
147 
148 std::pair<CodedInputStream::Limit, int>
150  return std::make_pair(PushLimit(byte_limit), --recursion_budget_);
151 }
152 
155  return PushLimit(ReadVarint32(&length) ? length : 0);
156 }
157 
159  bool result = ConsumedEntireMessage();
160  PopLimit(limit);
163  return result;
164 }
165 
167  bool result = ConsumedEntireMessage();
168  PopLimit(limit);
169  return result;
170 }
171 
173  if (current_limit_ == INT_MAX) return -1;
174  int current_position = CurrentPosition();
175 
176  return current_limit_ - current_position;
177 }
178 
179 void CodedInputStream::SetTotalBytesLimit(int total_bytes_limit) {
180  // Make sure the limit isn't already past, since this could confuse other
181  // code.
182  int current_position = CurrentPosition();
183  total_bytes_limit_ = std::max(current_position, total_bytes_limit);
185 }
186 
188  if (total_bytes_limit_ == INT_MAX) return -1;
190 }
191 
194  << "A protocol message was rejected because it was too "
195  "big (more than "
197  << " bytes). To increase the limit (or to disable these "
198  "warnings), see CodedInputStream::SetTotalBytesLimit() "
199  "in third_party/protobuf/src/google/protobuf/io/coded_stream.h.";
200 }
201 
202 bool CodedInputStream::SkipFallback(int count, int original_buffer_size) {
203  if (buffer_size_after_limit_ > 0) {
204  // We hit a limit inside this buffer. Advance to the limit and fail.
205  Advance(original_buffer_size);
206  return false;
207  }
208 
209  count -= original_buffer_size;
210  buffer_ = NULL;
212 
213  // Make sure this skip doesn't try to skip past the current limit.
214  int closest_limit = std::min(current_limit_, total_bytes_limit_);
215  int bytes_until_limit = closest_limit - total_bytes_read_;
216  if (bytes_until_limit < count) {
217  // We hit the limit. Skip up to it then fail.
218  if (bytes_until_limit > 0) {
219  total_bytes_read_ = closest_limit;
220  input_->Skip(bytes_until_limit);
221  }
222  return false;
223  }
224 
225  if (!input_->Skip(count)) {
227  return false;
228  }
230  return true;
231 }
232 
233 bool CodedInputStream::GetDirectBufferPointer(const void** data, int* size) {
234  if (BufferSize() == 0 && !Refresh()) return false;
235 
236  *data = buffer_;
237  *size = BufferSize();
238  return true;
239 }
240 
241 bool CodedInputStream::ReadRaw(void* buffer, int size) {
242  int current_buffer_size;
243  while ((current_buffer_size = BufferSize()) < size) {
244  // Reading past end of buffer. Copy what we have, then refresh.
245  memcpy(buffer, buffer_, current_buffer_size);
246  buffer = reinterpret_cast<uint8_t*>(buffer) + current_buffer_size;
247  size -= current_buffer_size;
248  Advance(current_buffer_size);
249  if (!Refresh()) return false;
250  }
251 
253  Advance(size);
254 
255  return true;
256 }
257 
259  if (size < 0) return false; // security: size is often user-supplied
260 
261  if (BufferSize() >= size) {
263  std::pair<char*, bool> z = as_string_data(buffer);
264  if (z.second) {
265  // Oddly enough, memcpy() requires its first two args to be non-NULL even
266  // if we copy 0 bytes. So, we have ensured that z.first is non-NULL here.
267  GOOGLE_DCHECK(z.first != NULL);
268  memcpy(z.first, buffer_, size);
269  Advance(size);
270  }
271  return true;
272  }
273 
274  return ReadStringFallback(buffer, size);
275 }
276 
278  if (!buffer->empty()) {
279  buffer->clear();
280  }
281 
282  int closest_limit = std::min(current_limit_, total_bytes_limit_);
283  if (closest_limit != INT_MAX) {
284  int bytes_to_limit = closest_limit - CurrentPosition();
285  if (bytes_to_limit > 0 && size > 0 && size <= bytes_to_limit) {
286  buffer->reserve(size);
287  }
288  }
289 
290  int current_buffer_size;
291  while ((current_buffer_size = BufferSize()) < size) {
292  // Some STL implementations "helpfully" crash on buffer->append(NULL, 0).
293  if (current_buffer_size != 0) {
294  // Note: string1.append(string2) is O(string2.size()) (as opposed to
295  // O(string1.size() + string2.size()), which would be bad).
296  buffer->append(reinterpret_cast<const char*>(buffer_),
297  current_buffer_size);
298  }
299  size -= current_buffer_size;
300  Advance(current_buffer_size);
301  if (!Refresh()) return false;
302  }
303 
304  buffer->append(reinterpret_cast<const char*>(buffer_), size);
305  Advance(size);
306 
307  return true;
308 }
309 
310 
312  uint8_t bytes[sizeof(*value)];
313 
314  const uint8_t* ptr;
315  if (BufferSize() >= static_cast<int64_t>(sizeof(*value))) {
316  // Fast path: Enough bytes in the buffer to read directly.
317  ptr = buffer_;
318  Advance(sizeof(*value));
319  } else {
320  // Slow path: Had to read past the end of the buffer.
321  if (!ReadRaw(bytes, sizeof(*value))) return false;
322  ptr = bytes;
323  }
325  return true;
326 }
327 
329  uint8_t bytes[sizeof(*value)];
330 
331  const uint8_t* ptr;
332  if (BufferSize() >= static_cast<int64_t>(sizeof(*value))) {
333  // Fast path: Enough bytes in the buffer to read directly.
334  ptr = buffer_;
335  Advance(sizeof(*value));
336  } else {
337  // Slow path: Had to read past the end of the buffer.
338  if (!ReadRaw(bytes, sizeof(*value))) return false;
339  ptr = bytes;
340  }
342  return true;
343 }
344 
345 namespace {
346 
347 // Decodes varint64 with known size, N, and returns next pointer. Knowing N at
348 // compile time, compiler can generate optimal code. For example, instead of
349 // subtracting 0x80 at each iteration, it subtracts properly shifted mask once.
350 template <size_t N>
351 const uint8_t* DecodeVarint64KnownSize(const uint8_t* buffer, uint64_t* value) {
352  GOOGLE_DCHECK_GT(N, 0);
353  uint64_t result = static_cast<uint64_t>(buffer[N - 1]) << (7 * (N - 1));
354  for (size_t i = 0, offset = 0; i < N - 1; i++, offset += 7) {
355  result += static_cast<uint64_t>(buffer[i] - 0x80) << offset;
356  }
357  *value = result;
358  return buffer + N;
359 }
360 
361 // Read a varint from the given buffer, write it to *value, and return a pair.
362 // The first part of the pair is true iff the read was successful. The second
363 // part is buffer + (number of bytes read). This function is always inlined,
364 // so returning a pair is costless.
365 PROTOBUF_ALWAYS_INLINE
366 ::std::pair<bool, const uint8_t*> ReadVarint32FromArray(uint32_t first_byte,
367  const uint8_t* buffer,
368  uint32_t* value);
369 inline ::std::pair<bool, const uint8_t*> ReadVarint32FromArray(
370  uint32_t first_byte, const uint8_t* buffer, uint32_t* value) {
371  // Fast path: We have enough bytes left in the buffer to guarantee that
372  // this read won't cross the end, so we can skip the checks.
373  GOOGLE_DCHECK_EQ(*buffer, first_byte);
374  GOOGLE_DCHECK_EQ(first_byte & 0x80, 0x80) << first_byte;
375  const uint8_t* ptr = buffer;
376  uint32_t b;
377  uint32_t result = first_byte - 0x80;
378  ++ptr; // We just processed the first byte. Move on to the second.
379  b = *(ptr++);
380  result += b << 7;
381  if (!(b & 0x80)) goto done;
382  result -= 0x80 << 7;
383  b = *(ptr++);
384  result += b << 14;
385  if (!(b & 0x80)) goto done;
386  result -= 0x80 << 14;
387  b = *(ptr++);
388  result += b << 21;
389  if (!(b & 0x80)) goto done;
390  result -= 0x80 << 21;
391  b = *(ptr++);
392  result += b << 28;
393  if (!(b & 0x80)) goto done;
394  // "result -= 0x80 << 28" is irrevelant.
395 
396  // If the input is larger than 32 bits, we still need to read it all
397  // and discard the high-order bits.
398  for (int i = 0; i < kMaxVarintBytes - kMaxVarint32Bytes; i++) {
399  b = *(ptr++);
400  if (!(b & 0x80)) goto done;
401  }
402 
403  // We have overrun the maximum size of a varint (10 bytes). Assume
404  // the data is corrupt.
405  return std::make_pair(false, ptr);
406 
407 done:
408  *value = result;
409  return std::make_pair(true, ptr);
410 }
411 
412 PROTOBUF_ALWAYS_INLINE::std::pair<bool, const uint8_t*> ReadVarint64FromArray(
413  const uint8_t* buffer, uint64_t* value);
414 inline ::std::pair<bool, const uint8_t*> ReadVarint64FromArray(
415  const uint8_t* buffer, uint64_t* value) {
416  // Assumes varint64 is at least 2 bytes.
417  GOOGLE_DCHECK_GE(buffer[0], 128);
418 
419  const uint8_t* next;
420  if (buffer[1] < 128) {
421  next = DecodeVarint64KnownSize<2>(buffer, value);
422  } else if (buffer[2] < 128) {
423  next = DecodeVarint64KnownSize<3>(buffer, value);
424  } else if (buffer[3] < 128) {
425  next = DecodeVarint64KnownSize<4>(buffer, value);
426  } else if (buffer[4] < 128) {
427  next = DecodeVarint64KnownSize<5>(buffer, value);
428  } else if (buffer[5] < 128) {
429  next = DecodeVarint64KnownSize<6>(buffer, value);
430  } else if (buffer[6] < 128) {
431  next = DecodeVarint64KnownSize<7>(buffer, value);
432  } else if (buffer[7] < 128) {
433  next = DecodeVarint64KnownSize<8>(buffer, value);
434  } else if (buffer[8] < 128) {
435  next = DecodeVarint64KnownSize<9>(buffer, value);
436  } else if (buffer[9] < 128) {
437  next = DecodeVarint64KnownSize<10>(buffer, value);
438  } else {
439  // We have overrun the maximum size of a varint (10 bytes). Assume
440  // the data is corrupt.
441  return std::make_pair(false, buffer + 11);
442  }
443 
444  return std::make_pair(true, next);
445 }
446 
447 } // namespace
448 
450  // Directly invoke ReadVarint64Fallback, since we already tried to optimize
451  // for one-byte varints.
452  std::pair<uint64_t, bool> p = ReadVarint64Fallback();
453  *value = static_cast<uint32_t>(p.first);
454  return p.second;
455 }
456 
458  if (BufferSize() >= kMaxVarintBytes ||
459  // Optimization: We're also safe if the buffer is non-empty and it ends
460  // with a byte that would terminate a varint.
461  (buffer_end_ > buffer_ && !(buffer_end_[-1] & 0x80))) {
462  GOOGLE_DCHECK_NE(first_byte_or_zero, 0)
463  << "Caller should provide us with *buffer_ when buffer is non-empty";
464  uint32_t temp;
465  ::std::pair<bool, const uint8_t*> p =
466  ReadVarint32FromArray(first_byte_or_zero, buffer_, &temp);
467  if (!p.first) return -1;
468  buffer_ = p.second;
469  return temp;
470  } else {
471  // Really slow case: we will incur the cost of an extra function call here,
472  // but moving this out of line reduces the size of this function, which
473  // improves the common case. In micro benchmarks, this is worth about 10-15%
474  uint32_t temp;
475  return ReadVarint32Slow(&temp) ? static_cast<int64_t>(temp) : -1;
476  }
477 }
478 
480  // Directly invoke ReadVarint64Fallback, since we already tried to optimize
481  // for one-byte varints.
482  std::pair<uint64_t, bool> p = ReadVarint64Fallback();
483  if (!p.second || p.first > static_cast<uint64_t>(INT_MAX)) return -1;
484  return p.first;
485 }
486 
488  if (BufferSize() >= kMaxVarintBytes ||
489  // Optimization: We're also safe if the buffer is non-empty and it ends
490  // with a byte that would terminate a varint.
491  (buffer_end_ > buffer_ && !(buffer_end_[-1] & 0x80))) {
492  uint64_t temp;
493  ::std::pair<bool, const uint8_t*> p = ReadVarint64FromArray(buffer_, &temp);
494  if (!p.first || temp > static_cast<uint64_t>(INT_MAX)) return -1;
495  buffer_ = p.second;
496  return temp;
497  } else {
498  // Really slow case: we will incur the cost of an extra function call here,
499  // but moving this out of line reduces the size of this function, which
500  // improves the common case. In micro benchmarks, this is worth about 10-15%
501  return ReadVarintSizeAsIntSlow();
502  }
503 }
504 
506  if (buffer_ == buffer_end_) {
507  // Call refresh.
508  if (!Refresh()) {
509  // Refresh failed. Make sure that it failed due to EOF, not because
510  // we hit total_bytes_limit_, which, unlike normal limits, is not a
511  // valid place to end a message.
512  int current_position = total_bytes_read_ - buffer_size_after_limit_;
513  if (current_position >= total_bytes_limit_) {
514  // Hit total_bytes_limit_. But if we also hit the normal limit,
515  // we're still OK.
517  } else {
519  }
520  return 0;
521  }
522  }
523 
524  // For the slow path, just do a 64-bit read. Try to optimize for one-byte tags
525  // again, since we have now refreshed the buffer.
526  uint64_t result = 0;
527  if (!ReadVarint64(&result)) return 0;
528  return static_cast<uint32_t>(result);
529 }
530 
532  const int buf_size = BufferSize();
533  if (buf_size >= kMaxVarintBytes ||
534  // Optimization: We're also safe if the buffer is non-empty and it ends
535  // with a byte that would terminate a varint.
536  (buf_size > 0 && !(buffer_end_[-1] & 0x80))) {
537  GOOGLE_DCHECK_EQ(first_byte_or_zero, buffer_[0]);
538  if (first_byte_or_zero == 0) {
539  ++buffer_;
540  return 0;
541  }
542  uint32_t tag;
543  ::std::pair<bool, const uint8_t*> p =
544  ReadVarint32FromArray(first_byte_or_zero, buffer_, &tag);
545  if (!p.first) {
546  return 0;
547  }
548  buffer_ = p.second;
549  return tag;
550  } else {
551  // We are commonly at a limit when attempting to read tags. Try to quickly
552  // detect this case without making another function call.
553  if ((buf_size == 0) &&
554  ((buffer_size_after_limit_ > 0) ||
556  // Make sure that the limit we hit is not total_bytes_limit_, since
557  // in that case we still need to call Refresh() so that it prints an
558  // error.
560  // We hit a byte limit.
562  return 0;
563  }
564  return ReadTagSlow();
565  }
566 }
567 
569  // Slow path: This read might cross the end of the buffer, so we
570  // need to check and refresh the buffer if and when it does.
571 
572  uint64_t result = 0;
573  int count = 0;
574  uint32_t b;
575 
576  do {
577  if (count == kMaxVarintBytes) {
578  *value = 0;
579  return false;
580  }
581  while (buffer_ == buffer_end_) {
582  if (!Refresh()) {
583  *value = 0;
584  return false;
585  }
586  }
587  b = *buffer_;
588  result |= static_cast<uint64_t>(b & 0x7F) << (7 * count);
589  Advance(1);
590  ++count;
591  } while (b & 0x80);
592 
593  *value = result;
594  return true;
595 }
596 
597 std::pair<uint64_t, bool> CodedInputStream::ReadVarint64Fallback() {
598  if (BufferSize() >= kMaxVarintBytes ||
599  // Optimization: We're also safe if the buffer is non-empty and it ends
600  // with a byte that would terminate a varint.
601  (buffer_end_ > buffer_ && !(buffer_end_[-1] & 0x80))) {
602  uint64_t temp;
603  ::std::pair<bool, const uint8_t*> p = ReadVarint64FromArray(buffer_, &temp);
604  if (!p.first) {
605  return std::make_pair(0, false);
606  }
607  buffer_ = p.second;
608  return std::make_pair(temp, true);
609  } else {
610  uint64_t temp;
611  bool success = ReadVarint64Slow(&temp);
612  return std::make_pair(temp, success);
613  }
614 }
615 
618 
619  if (buffer_size_after_limit_ > 0 || overflow_bytes_ > 0 ||
621  // We've hit a limit. Stop.
622  int current_position = total_bytes_read_ - buffer_size_after_limit_;
623 
624  if (current_position >= total_bytes_limit_ &&
626  // Hit total_bytes_limit_.
628  }
629 
630  return false;
631  }
632 
633  const void* void_buffer;
634  int buffer_size;
635  if (NextNonEmpty(input_, &void_buffer, &buffer_size)) {
636  buffer_ = reinterpret_cast<const uint8_t*>(void_buffer);
639 
640  if (total_bytes_read_ <= INT_MAX - buffer_size) {
642  } else {
643  // Overflow. Reset buffer_end_ to not include the bytes beyond INT_MAX.
644  // We can't get that far anyway, because total_bytes_limit_ is guaranteed
645  // to be less than it. We need to keep track of the number of bytes
646  // we discarded, though, so that we can call input_->BackUp() to back
647  // up over them on destruction.
648 
649  // The following line is equivalent to:
650  // overflow_bytes_ = total_bytes_read_ + buffer_size - INT_MAX;
651  // except that it avoids overflows. Signed integer overflow has
652  // undefined results according to the C standard.
655  total_bytes_read_ = INT_MAX;
656  }
657 
659  return true;
660  } else {
661  buffer_ = NULL;
662  buffer_end_ = NULL;
663  return false;
664  }
665 }
666 
667 // CodedOutputStream =================================================
668 
669 void EpsCopyOutputStream::EnableAliasing(bool enabled) {
670  aliasing_enabled_ = enabled && stream_->AllowsAliasing();
671 }
672 
674  // Calculate the current offset relative to the end of the stream buffer.
675  int delta = (end_ - ptr) + (buffer_end_ ? 0 : kSlopBytes);
676  return stream_->ByteCount() - delta;
677 }
678 
679 // Flushes what's written out to the underlying ZeroCopyOutputStream buffers.
680 // Returns the size remaining in the buffer and sets buffer_end_ to the start
681 // of the remaining buffer, ie. [buffer_end_, buffer_end_ + return value)
683  while (buffer_end_ && ptr > end_) {
684  int overrun = ptr - end_;
686  GOOGLE_DCHECK(overrun <= kSlopBytes); // NOLINT
687  ptr = Next() + overrun;
688  if (had_error_) return 0;
689  }
690  int s;
691  if (buffer_end_) {
693  buffer_end_ += ptr - buffer_;
694  s = end_ - ptr;
695  } else {
696  // The stream is writing directly in the ZeroCopyOutputStream buffer.
697  s = end_ + kSlopBytes - ptr;
698  buffer_end_ = ptr;
699  }
700  GOOGLE_DCHECK(s >= 0); // NOLINT
701  return s;
702 }
703 
705  if (had_error_) return ptr;
706  int s = Flush(ptr);
707  if (s) stream_->BackUp(s);
708  // Reset to initial state (expecting new buffer)
710  return buffer_;
711 }
712 
713 
715  if (had_error_) return buffer_;
716  int s = Flush(ptr);
717  if (had_error_) return buffer_;
718  return SetInitialBuffer(buffer_end_, s);
719 }
720 
722  if (count < 0) return false;
723  if (had_error_) {
724  *pp = buffer_;
725  return false;
726  }
727  int size = Flush(*pp);
728  if (had_error_) {
729  *pp = buffer_;
730  return false;
731  }
732  void* data = buffer_end_;
733  while (count > size) {
734  count -= size;
735  if (!stream_->Next(&data, &size)) {
736  *pp = Error();
737  return false;
738  }
739  }
740  *pp = SetInitialBuffer(static_cast<uint8_t*>(data) + count, size - count);
741  return true;
742 }
743 
745  uint8_t** pp) {
746  if (had_error_) {
747  *pp = buffer_;
748  return false;
749  }
750  *size = Flush(*pp);
751  if (had_error_) {
752  *pp = buffer_;
753  return false;
754  }
755  *data = buffer_end_;
756  while (*size == 0) {
757  if (!stream_->Next(data, size)) {
758  *pp = Error();
759  return false;
760  }
761  }
762  *pp = SetInitialBuffer(*data, *size);
763  return true;
764 }
765 
767  uint8_t** pp) {
768  if (had_error_) {
769  *pp = buffer_;
770  return nullptr;
771  }
772  int s = Flush(*pp);
773  if (had_error_) {
774  *pp = buffer_;
775  return nullptr;
776  }
777  if (s >= size) {
778  auto res = buffer_end_;
780  return res;
781  } else {
783  return nullptr;
784  }
785 }
786 
788  GOOGLE_DCHECK(!had_error_); // NOLINT
789  if (PROTOBUF_PREDICT_FALSE(stream_ == nullptr)) return Error();
790  if (buffer_end_) {
791  // We're in the patch buffer and need to fill up the previous buffer.
793  uint8_t* ptr;
794  int size;
795  do {
796  void* data;
797  if (PROTOBUF_PREDICT_FALSE(!stream_->Next(&data, &size))) {
798  // Stream has an error, we use the patch buffer to continue to be
799  // able to write.
800  return Error();
801  }
802  ptr = static_cast<uint8_t*>(data);
803  } while (size == 0);
804  if (PROTOBUF_PREDICT_TRUE(size > kSlopBytes)) {
806  end_ = ptr + size - kSlopBytes;
807  buffer_end_ = nullptr;
808  return ptr;
809  } else {
810  GOOGLE_DCHECK(size > 0); // NOLINT
811  // Buffer to small
812  std::memmove(buffer_, end_, kSlopBytes);
813  buffer_end_ = ptr;
814  end_ = buffer_ + size;
815  return buffer_;
816  }
817  } else {
819  buffer_end_ = end_;
820  end_ = buffer_ + kSlopBytes;
821  return buffer_;
822  }
823 }
824 
826  do {
827  if (PROTOBUF_PREDICT_FALSE(had_error_)) return buffer_;
828  int overrun = ptr - end_;
829  GOOGLE_DCHECK(overrun >= 0); // NOLINT
830  GOOGLE_DCHECK(overrun <= kSlopBytes); // NOLINT
831  ptr = Next() + overrun;
832  } while (ptr >= end_);
833  GOOGLE_DCHECK(ptr < end_); // NOLINT
834  return ptr;
835 }
836 
838  uint8_t* ptr) {
839  int s = GetSize(ptr);
840  while (s < size) {
841  std::memcpy(ptr, data, s);
842  size -= s;
843  data = static_cast<const uint8_t*>(data) + s;
844  ptr = EnsureSpaceFallback(ptr + s);
845  s = GetSize(ptr);
846  }
848  return ptr + size;
849 }
850 
852  uint8_t* ptr) {
853  if (size < GetSize(ptr)
854  ) {
855  return WriteRaw(data, size, ptr);
856  } else {
857  ptr = Trim(ptr);
858  if (stream_->WriteAliasedRaw(data, size)) return ptr;
859  return Error();
860  }
861 }
862 
863 #ifndef PROTOBUF_LITTLE_ENDIAN
865  uint8_t* ptr) {
866  auto p = static_cast<const uint8_t*>(data);
867  auto end = p + size;
868  while (end - p >= kSlopBytes) {
869  ptr = EnsureSpace(ptr);
870  uint32_t buffer[4];
871  static_assert(sizeof(buffer) == kSlopBytes, "Buffer must be kSlopBytes");
873  p += kSlopBytes;
874  for (auto x : buffer)
876  }
877  while (p < end) {
878  ptr = EnsureSpace(ptr);
880  std::memcpy(&buffer, p, 4);
881  p += 4;
883  }
884  return ptr;
885 }
886 
888  uint8_t* ptr) {
889  auto p = static_cast<const uint8_t*>(data);
890  auto end = p + size;
891  while (end - p >= kSlopBytes) {
892  ptr = EnsureSpace(ptr);
893  uint64_t buffer[2];
894  static_assert(sizeof(buffer) == kSlopBytes, "Buffer must be kSlopBytes");
896  p += kSlopBytes;
897  for (auto x : buffer)
899  }
900  while (p < end) {
901  ptr = EnsureSpace(ptr);
903  std::memcpy(&buffer, p, 8);
904  p += 8;
906  }
907  return ptr;
908 }
909 #endif
910 
911 
913  const std::string& s,
914  uint8_t* ptr) {
915  ptr = EnsureSpace(ptr);
916  uint32_t size = s.size();
918  return WriteRawMaybeAliased(s.data(), size, ptr);
919 }
920 
922  uint8_t* ptr) {
923  ptr = EnsureSpace(ptr);
924  uint32_t size = s.size();
926  return WriteRaw(s.data(), size, ptr);
927 }
928 
930  false};
931 
933  bool do_eager_refresh)
934  : impl_(stream, IsDefaultSerializationDeterministic(), &cur_),
935  start_count_(stream->ByteCount()) {
936  if (do_eager_refresh) {
937  void* data;
938  int size;
939  if (!stream->Next(&data, &size) || size == 0) return;
941  }
942 }
943 
945 
946 
948  uint8_t* target) {
951  return WriteStringToArray(str, target);
952 }
953 
955  uint8_t* target) {
956  GOOGLE_DCHECK_GE(value, 0x80);
957  target[0] |= static_cast<uint8_t>(0x80);
958  value >>= 7;
959  target[1] = static_cast<uint8_t>(value);
960  if (value < 0x80) {
961  return target + 2;
962  }
963  target += 2;
964  do {
965  // Turn on continuation bit in the byte we just wrote.
966  target[-1] |= static_cast<uint8_t>(0x80);
967  value >>= 7;
968  *target = static_cast<uint8_t>(value);
969  ++target;
970  } while (value >= 0x80);
971  return target;
972 }
973 
974 } // namespace io
975 } // namespace protobuf
976 } // namespace google
977 
978 #include <google/protobuf/port_undef.inc>
google::protobuf::io::CodedOutputStream::WriteStringToArray
static uint8 * WriteStringToArray(const std::string &str, uint8 *target)
Definition: bloaty/third_party/protobuf/src/google/protobuf/io/coded_stream.h:1697
xds_interop_client.str
str
Definition: xds_interop_client.py:487
google::protobuf::io::CodedInputStream::Refresh
bool Refresh()
Definition: bloaty/third_party/protobuf/src/google/protobuf/io/coded_stream.cc:616
google::protobuf::io::CodedInputStream::buffer_
const uint8 * buffer_
Definition: bloaty/third_party/protobuf/src/google/protobuf/io/coded_stream.h:537
ptr
char * ptr
Definition: abseil-cpp/absl/base/internal/low_level_alloc_test.cc:45
google::protobuf::io::EpsCopyOutputStream::aliasing_enabled_
bool aliasing_enabled_
Definition: bloaty/third_party/protobuf/src/google/protobuf/io/coded_stream.h:829
_gevent_test_main.result
result
Definition: _gevent_test_main.py:96
google::protobuf::io::CodedInputStream::ReadVarintSizeAsIntFallback
int ReadVarintSizeAsIntFallback()
Definition: bloaty/third_party/protobuf/src/google/protobuf/io/coded_stream.cc:487
google::protobuf::io::ZeroCopyOutputStream::WriteAliasedRaw
virtual bool WriteAliasedRaw(const void *data, int size)
Definition: bloaty/third_party/protobuf/src/google/protobuf/io/zero_copy_stream.cc:45
google::protobuf::io::CodedInputStream::buffer_size_after_limit_
int buffer_size_after_limit_
Definition: bloaty/third_party/protobuf/src/google/protobuf/io/coded_stream.h:568
fix_build_deps.temp
temp
Definition: fix_build_deps.py:488
GOOGLE_DCHECK_NE
#define GOOGLE_DCHECK_NE
Definition: bloaty/third_party/protobuf/src/google/protobuf/stubs/logging.h:197
google::protobuf::io::ZeroCopyInputStream::Skip
virtual bool Skip(int count)=0
google::protobuf::value
const Descriptor::ReservedRange value
Definition: bloaty/third_party/protobuf/src/google/protobuf/descriptor.h:1954
google::protobuf::io::EpsCopyOutputStream::Skip
bool Skip(int count, uint8 **pp)
Definition: bloaty/third_party/protobuf/src/google/protobuf/io/coded_stream.cc:721
google::protobuf::io::CodedInputStream::PopLimit
void PopLimit(Limit limit)
Definition: bloaty/third_party/protobuf/src/google/protobuf/io/coded_stream.cc:137
google::protobuf::io::CodedInputStream::CurrentPosition
int CurrentPosition() const
Definition: bloaty/third_party/protobuf/src/google/protobuf/io/coded_stream.h:1487
google::protobuf::io::CodedInputStream::ReadVarintSizeAsIntSlow
int ReadVarintSizeAsIntSlow()
Definition: bloaty/third_party/protobuf/src/google/protobuf/io/coded_stream.cc:479
google::protobuf::io::EpsCopyOutputStream::end_
uint8 * end_
Definition: bloaty/third_party/protobuf/src/google/protobuf/io/coded_stream.h:824
google::protobuf::io::EpsCopyOutputStream::WriteStringOutline
uint8 * WriteStringOutline(uint32 num, const std::string &s, uint8 *ptr)
Definition: bloaty/third_party/protobuf/src/google/protobuf/io/coded_stream.cc:921
google::protobuf::io::CodedOutputStream::WriteStringWithSizeToArray
static uint8 * WriteStringWithSizeToArray(const std::string &str, uint8 *target)
Definition: bloaty/third_party/protobuf/src/google/protobuf/io/coded_stream.cc:947
google::protobuf::io::EpsCopyOutputStream::EnableAliasing
void EnableAliasing(bool enabled)
Definition: bloaty/third_party/protobuf/src/google/protobuf/io/coded_stream.cc:669
google::protobuf::io::CodedInputStream::~CodedInputStream
~CodedInputStream()
Definition: bloaty/third_party/protobuf/src/google/protobuf/io/coded_stream.cc:82
grpc::protobuf::io::ZeroCopyInputStream
GRPC_CUSTOM_ZEROCOPYINPUTSTREAM ZeroCopyInputStream
Definition: include/grpcpp/impl/codegen/config_protobuf.h:101
google::protobuf::io::CodedInputStream::SetTotalBytesLimit
void SetTotalBytesLimit(int total_bytes_limit)
Definition: bloaty/third_party/protobuf/src/google/protobuf/io/coded_stream.cc:179
google::protobuf::io::EpsCopyOutputStream::FlushAndResetBuffer
uint8 * FlushAndResetBuffer(uint8 *)
Definition: bloaty/third_party/protobuf/src/google/protobuf/io/coded_stream.cc:714
google::protobuf::io::EpsCopyOutputStream::had_error_
bool had_error_
Definition: bloaty/third_party/protobuf/src/google/protobuf/io/coded_stream.h:828
GOOGLE_DCHECK
#define GOOGLE_DCHECK
Definition: bloaty/third_party/protobuf/src/google/protobuf/stubs/logging.h:194
google::protobuf::io::EpsCopyOutputStream::WriteRawMaybeAliased
uint8 * WriteRawMaybeAliased(const void *data, int size, uint8 *ptr)
Definition: bloaty/third_party/protobuf/src/google/protobuf/io/coded_stream.h:704
google::protobuf::io::CodedInputStream::IncrementRecursionDepthAndPushLimit
std::pair< CodedInputStream::Limit, int > IncrementRecursionDepthAndPushLimit(int byte_limit)
Definition: bloaty/third_party/protobuf/src/google/protobuf/io/coded_stream.cc:149
google::protobuf::io::EpsCopyOutputStream::GetSize
std::ptrdiff_t GetSize(uint8 *ptr) const
Definition: bloaty/third_party/protobuf/src/google/protobuf/io/coded_stream.h:835
testing::internal::string
::std::string string
Definition: bloaty/third_party/protobuf/third_party/googletest/googletest/include/gtest/internal/gtest-port.h:881
google::protobuf::io::CodedOutputStream::Trim
void Trim()
Definition: bloaty/third_party/protobuf/src/google/protobuf/io/coded_stream.h:1069
google::protobuf::io::CodedInputStream::CheckEntireMessageConsumedAndPopLimit
bool CheckEntireMessageConsumedAndPopLimit(Limit limit)
Definition: bloaty/third_party/protobuf/src/google/protobuf/io/coded_stream.cc:166
google::protobuf::io::CodedInputStream::overflow_bytes_
int overflow_bytes_
Definition: bloaty/third_party/protobuf/src/google/protobuf/io/coded_stream.h:545
google::protobuf
Definition: bloaty/third_party/protobuf/benchmarks/util/data_proto2_to_proto3_util.h:12
google::protobuf::io::CodedOutputStream::cur_
uint8 * cur_
Definition: bloaty/third_party/protobuf/src/google/protobuf/io/coded_stream.h:1246
grpc::protobuf::io::ZeroCopyOutputStream
GRPC_CUSTOM_ZEROCOPYOUTPUTSTREAM ZeroCopyOutputStream
Definition: include/grpcpp/impl/codegen/config_protobuf.h:100
google::protobuf::io::EpsCopyOutputStream::WriteRaw
uint8 * WriteRaw(const void *data, int size, uint8 *ptr)
Definition: bloaty/third_party/protobuf/src/google/protobuf/io/coded_stream.h:693
absl::FormatConversionChar::s
@ s
google::protobuf::io::CodedInputStream::BackUpInputToCurrentPosition
void BackUpInputToCurrentPosition()
Definition: bloaty/third_party/protobuf/src/google/protobuf/io/coded_stream.cc:92
google::protobuf::io::CodedOutputStream::WriteLittleEndian64ToArray
static uint8 * WriteLittleEndian64ToArray(uint64 value, uint8 *target)
Definition: bloaty/third_party/protobuf/src/google/protobuf/io/coded_stream.h:1618
xds_manager.p
p
Definition: xds_manager.py:60
z
Uncopyable z
Definition: bloaty/third_party/googletest/googlemock/test/gmock-matchers_test.cc:3612
uint8_t
unsigned char uint8_t
Definition: stdint-msvc2008.h:78
google::protobuf::io::CodedInputStream::legitimate_message_end_
bool legitimate_message_end_
Definition: bloaty/third_party/protobuf/src/google/protobuf/io/coded_stream.h:553
google::protobuf::io::EpsCopyOutputStream::Next
uint8 * Next()
Definition: bloaty/third_party/protobuf/src/google/protobuf/io/coded_stream.cc:787
GOOGLE_DCHECK_LT
#define GOOGLE_DCHECK_LT
Definition: bloaty/third_party/protobuf/src/google/protobuf/stubs/logging.h:198
google::protobuf::io::EpsCopyOutputStream::EnsureSpaceFallback
uint8 * EnsureSpaceFallback(uint8 *ptr)
Definition: bloaty/third_party/protobuf/src/google/protobuf/io/coded_stream.cc:825
google::protobuf::io::EpsCopyOutputStream::WriteStringMaybeAliasedOutline
uint8 * WriteStringMaybeAliasedOutline(uint32 num, const std::string &s, uint8 *ptr)
Definition: bloaty/third_party/protobuf/src/google/protobuf/io/coded_stream.cc:912
google::protobuf::io::as_string_data
std::pair< char *, bool > as_string_data(std::string *s)
Definition: bloaty/third_party/protobuf/src/google/protobuf/io/zero_copy_stream_impl_lite.h:394
uint32_t
unsigned int uint32_t
Definition: stdint-msvc2008.h:80
google::protobuf::io::CodedInputStream::BytesUntilLimit
int BytesUntilLimit() const
Definition: bloaty/third_party/protobuf/src/google/protobuf/io/coded_stream.cc:172
google::protobuf::io::EpsCopyOutputStream::WriteRawFallback
uint8 * WriteRawFallback(const void *data, int size, uint8 *ptr)
Definition: bloaty/third_party/protobuf/src/google/protobuf/io/coded_stream.cc:837
google::protobuf::io::ZeroCopyInputStream::ByteCount
virtual int64_t ByteCount() const =0
memcpy
memcpy(mem, inblock.get(), min(CONTAINING_RECORD(inblock.get(), MEMBLOCK, data) ->size, size))
google::protobuf::io::CodedOutputStream::CodedOutputStream
CodedOutputStream(ZeroCopyOutputStream *stream)
Definition: bloaty/third_party/protobuf/src/google/protobuf/io/coded_stream.h:1047
google::protobuf::io::EpsCopyOutputStream::Flush
int Flush(uint8 *ptr)
Definition: bloaty/third_party/protobuf/src/google/protobuf/io/coded_stream.cc:682
google::protobuf::io::CodedInputStream::GetDirectBufferPointer
bool GetDirectBufferPointer(const void **data, int *size)
Definition: bloaty/third_party/protobuf/src/google/protobuf/io/coded_stream.cc:233
end
char * end
Definition: abseil-cpp/absl/strings/internal/str_format/float_conversion.cc:1008
int64_t
signed __int64 int64_t
Definition: stdint-msvc2008.h:89
google::protobuf::io::EpsCopyOutputStream::EnsureSpace
void EnsureSpace(uint8 **ptr)
Definition: bloaty/third_party/protobuf/src/google/protobuf/io/coded_stream.h:687
tag
static void * tag(intptr_t t)
Definition: bad_client.cc:318
max
int max
Definition: bloaty/third_party/zlib/examples/enough.c:170
GOOGLE_DCHECK_GT
#define GOOGLE_DCHECK_GT
Definition: bloaty/third_party/protobuf/src/google/protobuf/stubs/logging.h:200
impl_
std::shared_ptr< ExternalConnectionAcceptorImpl > impl_
Definition: external_connection_acceptor_impl.cc:43
google::protobuf::io::EpsCopyOutputStream::SetInitialBuffer
uint8 * SetInitialBuffer(void *data, int size)
Definition: bloaty/third_party/protobuf/src/google/protobuf/io/coded_stream.h:943
google::protobuf::io::CodedInputStream::ConsumedEntireMessage
bool ConsumedEntireMessage()
Definition: bloaty/third_party/protobuf/src/google/protobuf/io/coded_stream.h:1424
google::protobuf::io::CodedInputStream::PrintTotalBytesLimitError
void PrintTotalBytesLimitError()
Definition: bloaty/third_party/protobuf/src/google/protobuf/io/coded_stream.cc:192
google::protobuf::io::CodedInputStream::ReadVarint32
bool ReadVarint32(uint32 *value)
Definition: bloaty/third_party/protobuf/src/google/protobuf/io/coded_stream.h:1268
google::protobuf::io::CodedOutputStream::~CodedOutputStream
~CodedOutputStream()
Definition: bloaty/third_party/protobuf/src/google/protobuf/io/coded_stream.cc:944
google::protobuf::io::CodedInputStream::total_bytes_read_
int total_bytes_read_
Definition: bloaty/third_party/protobuf/src/google/protobuf/io/coded_stream.h:540
GOOGLE_CHECK_GE
#define GOOGLE_CHECK_GE(A, B)
Definition: bloaty/third_party/protobuf/src/google/protobuf/stubs/logging.h:161
uint64_t
unsigned __int64 uint64_t
Definition: stdint-msvc2008.h:90
google::protobuf::io::EpsCopyOutputStream::Trim
uint8 * Trim(uint8 *ptr)
Definition: bloaty/third_party/protobuf/src/google/protobuf/io/coded_stream.cc:704
google::protobuf::io::EpsCopyOutputStream::Error
uint8 * Error()
Definition: bloaty/third_party/protobuf/src/google/protobuf/io/coded_stream.h:840
done
struct tab * done
Definition: bloaty/third_party/zlib/examples/enough.c:176
GOOGLE_DCHECK_GE
#define GOOGLE_DCHECK_GE
Definition: bloaty/third_party/protobuf/src/google/protobuf/stubs/logging.h:201
google::protobuf::io::CodedInputStream::SkipFallback
bool SkipFallback(int count, int original_buffer_size)
Definition: bloaty/third_party/protobuf/src/google/protobuf/io/coded_stream.cc:202
google::protobuf::io::EpsCopyOutputStream::WriteLengthDelim
PROTOBUF_ALWAYS_INLINE uint8 * WriteLengthDelim(int num, uint32 size, uint8 *ptr)
Definition: bloaty/third_party/protobuf/src/google/protobuf/io/coded_stream.h:860
google::protobuf::io::CodedInputStream::total_bytes_limit_
int total_bytes_limit_
Definition: bloaty/third_party/protobuf/src/google/protobuf/io/coded_stream.h:572
google::protobuf::io::CodedOutputStream::default_serialization_deterministic_
static std::atomic< bool > default_serialization_deterministic_
Definition: bloaty/third_party/protobuf/src/google/protobuf/io/coded_stream.h:1248
io
data
char data[kBufferLength]
Definition: abseil-cpp/absl/strings/internal/str_format/float_conversion.cc:1006
buffer
char buffer[1024]
Definition: libuv/docs/code/idle-compute/main.c:8
google::protobuf::io::EpsCopyOutputStream::stream_
ZeroCopyOutputStream * stream_
Definition: bloaty/third_party/protobuf/src/google/protobuf/io/coded_stream.h:827
google::protobuf::io::ZeroCopyOutputStream::AllowsAliasing
virtual bool AllowsAliasing() const
Definition: bloaty/third_party/protobuf/src/google/protobuf/io/zero_copy_stream.h:239
min
#define min(a, b)
Definition: qsort.h:83
google::protobuf::io::CodedInputStream::ReadVarint32Fallback
int64 ReadVarint32Fallback(uint32 first_byte_or_zero)
Definition: bloaty/third_party/protobuf/src/google/protobuf/io/coded_stream.cc:457
b
uint64_t b
Definition: abseil-cpp/absl/container/internal/layout_test.cc:53
google::protobuf::io::CodedInputStream::input_
ZeroCopyInputStream * input_
Definition: bloaty/third_party/protobuf/src/google/protobuf/io/coded_stream.h:539
google::protobuf::ERROR
static const LogLevel ERROR
Definition: bloaty/third_party/protobuf/src/google/protobuf/testing/googletest.h:70
google::protobuf::io::CodedInputStream::ReadTagSlow
uint32 ReadTagSlow()
Definition: bloaty/third_party/protobuf/src/google/protobuf/io/coded_stream.cc:505
google::protobuf::io::CodedInputStream::PushLimit
Limit PushLimit(int byte_limit)
Definition: bloaty/third_party/protobuf/src/google/protobuf/io/coded_stream.cc:118
google::protobuf::io::CodedInputStream::ReadVarint64Slow
bool ReadVarint64Slow(uint64 *value)
Definition: bloaty/third_party/protobuf/src/google/protobuf/io/coded_stream.cc:568
google::protobuf::io::CodedInputStream::Advance
void Advance(int amount)
Definition: bloaty/third_party/protobuf/src/google/protobuf/io/coded_stream.h:1491
google::protobuf::io::CodedInputStream::ReadString
bool ReadString(std::string *buffer, int size)
Definition: bloaty/third_party/protobuf/src/google/protobuf/io/coded_stream.cc:258
google::protobuf::io::CodedInputStream::ReadStringFallback
bool ReadStringFallback(std::string *buffer, int size)
Definition: bloaty/third_party/protobuf/src/google/protobuf/io/coded_stream.cc:277
google::protobuf::io::CodedInputStream::ReadVarint32Slow
bool ReadVarint32Slow(uint32 *value)
Definition: bloaty/third_party/protobuf/src/google/protobuf/io/coded_stream.cc:449
pp
const uint8_t ** pp
Definition: ssl_x509.cc:1020
google::protobuf::io::EpsCopyOutputStream::GetDirectBufferPointer
bool GetDirectBufferPointer(void **data, int *size, uint8 **pp)
Definition: bloaty/third_party/protobuf/src/google/protobuf/io/coded_stream.cc:744
google::protobuf::io::CodedOutputStream::impl_
EpsCopyOutputStream impl_
Definition: bloaty/third_party/protobuf/src/google/protobuf/io/coded_stream.h:1245
google::protobuf::io::EpsCopyOutputStream::WriteAliasedRaw
uint8 * WriteAliasedRaw(const void *data, int size, uint8 *ptr)
Definition: bloaty/third_party/protobuf/src/google/protobuf/io/coded_stream.cc:851
google::protobuf::io::EpsCopyOutputStream::GetDirectBufferForNBytesAndAdvance
uint8 * GetDirectBufferForNBytesAndAdvance(int size, uint8 **pp)
Definition: bloaty/third_party/protobuf/src/google/protobuf/io/coded_stream.cc:766
google::protobuf::io::CodedInputStream::default_recursion_limit_
static int default_recursion_limit_
Definition: bloaty/third_party/protobuf/src/google/protobuf/io/coded_stream.h:639
N
#define N
Definition: sync_test.cc:37
bytes
uint8 bytes[10]
Definition: bloaty/third_party/protobuf/src/google/protobuf/io/coded_stream_unittest.cc:153
count
int * count
Definition: bloaty/third_party/googletest/googlemock/test/gmock_stress_test.cc:96
google::protobuf::io::CodedInputStream::ReadLengthAndPushLimit
Limit ReadLengthAndPushLimit()
Definition: bloaty/third_party/protobuf/src/google/protobuf/io/coded_stream.cc:153
google::protobuf::io::EpsCopyOutputStream::WriteRawLittleEndian64
uint8 * WriteRawLittleEndian64(const void *data, int size, uint8 *ptr)
Definition: bloaty/third_party/protobuf/src/google/protobuf/io/coded_stream.cc:887
google::protobuf::io::CodedOutputStream::WriteVarint32ToArrayOutOfLineHelper
static uint8_t * WriteVarint32ToArrayOutOfLineHelper(uint32_t value, uint8_t *target)
Definition: protobuf/src/google/protobuf/io/coded_stream.cc:954
google::protobuf::io::CodedInputStream::recursion_limit_
int recursion_limit_
Definition: bloaty/third_party/protobuf/src/google/protobuf/io/coded_stream.h:579
next
AllocList * next[kMaxLevel]
Definition: abseil-cpp/absl/base/internal/low_level_alloc.cc:100
google::protobuf::io::ZeroCopyOutputStream::ByteCount
virtual int64_t ByteCount() const =0
google::protobuf::io::CodedInputStream::ReadRaw
bool ReadRaw(void *buffer, int size)
Definition: bloaty/third_party/protobuf/src/google/protobuf/io/coded_stream.cc:241
xds_manager.num
num
Definition: xds_manager.py:56
google::protobuf::io::CodedInputStream::BytesUntilTotalBytesLimit
int BytesUntilTotalBytesLimit() const
Definition: bloaty/third_party/protobuf/src/google/protobuf/io/coded_stream.cc:187
google::protobuf::io::CodedInputStream::buffer_end_
const uint8 * buffer_end_
Definition: bloaty/third_party/protobuf/src/google/protobuf/io/coded_stream.h:538
GOOGLE_DCHECK_EQ
#define GOOGLE_DCHECK_EQ
Definition: bloaty/third_party/protobuf/src/google/protobuf/stubs/logging.h:196
google::protobuf::io::CodedInputStream::ReadTagFallback
uint32 ReadTagFallback(uint32 first_byte_or_zero)
Definition: bloaty/third_party/protobuf/src/google/protobuf/io/coded_stream.cc:531
google::protobuf::io::CodedInputStream::RecomputeBufferLimits
void RecomputeBufferLimits()
Definition: bloaty/third_party/protobuf/src/google/protobuf/io/coded_stream.cc:105
google::protobuf::io::EpsCopyOutputStream::buffer_end_
uint8 * buffer_end_
Definition: bloaty/third_party/protobuf/src/google/protobuf/io/coded_stream.h:825
input
std::string input
Definition: bloaty/third_party/protobuf/src/google/protobuf/io/tokenizer_unittest.cc:197
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::io::CodedInputStream::current_limit_
Limit current_limit_
Definition: bloaty/third_party/protobuf/src/google/protobuf/io/coded_stream.h:559
google::protobuf::io::CodedInputStream::ReadLittleEndian64FromArray
static const uint8 * ReadLittleEndian64FromArray(const uint8 *buffer, uint64 *value)
Definition: bloaty/third_party/protobuf/src/google/protobuf/io/coded_stream.h:1322
google::protobuf::io::CodedInputStream::ReadLittleEndian32Fallback
bool ReadLittleEndian32Fallback(uint32 *value)
Definition: bloaty/third_party/protobuf/src/google/protobuf/io/coded_stream.cc:311
google::protobuf::io::EpsCopyOutputStream::WriteRawLittleEndian32
uint8 * WriteRawLittleEndian32(const void *data, int size, uint8 *ptr)
Definition: bloaty/third_party/protobuf/src/google/protobuf/io/coded_stream.cc:864
google::protobuf::io::CodedInputStream::ReadLittleEndian64Fallback
bool ReadLittleEndian64Fallback(uint64 *value)
Definition: bloaty/third_party/protobuf/src/google/protobuf/io/coded_stream.cc:328
google::protobuf::io::CodedInputStream::ReadLittleEndian32FromArray
static const uint8 * ReadLittleEndian32FromArray(const uint8 *buffer, uint32 *value)
Definition: bloaty/third_party/protobuf/src/google/protobuf/io/coded_stream.h:1308
google::protobuf::io::CodedInputStream::Limit
int Limit
Definition: bloaty/third_party/protobuf/src/google/protobuf/io/coded_stream.h:348
google::protobuf::io::ZeroCopyOutputStream::Next
virtual bool Next(void **data, int *size)=0
google::protobuf::io::CodedInputStream::ReadVarint64Fallback
std::pair< uint64, bool > ReadVarint64Fallback()
Definition: bloaty/third_party/protobuf/src/google/protobuf/io/coded_stream.cc:597
google::protobuf::io::ZeroCopyInputStream::BackUp
virtual void BackUp(int count)=0
google::protobuf::io::EpsCopyOutputStream::buffer_
uint8 buffer_[2 *kSlopBytes]
Definition: bloaty/third_party/protobuf/src/google/protobuf/io/coded_stream.h:826
google::protobuf::io::EpsCopyOutputStream::kSlopBytes
@ kSlopBytes
Definition: bloaty/third_party/protobuf/src/google/protobuf/io/coded_stream.h:653
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::io::CodedInputStream::recursion_budget_
int recursion_budget_
Definition: bloaty/third_party/protobuf/src/google/protobuf/io/coded_stream.h:577
GOOGLE_LOG
#define GOOGLE_LOG(LEVEL)
Definition: bloaty/third_party/protobuf/src/google/protobuf/stubs/logging.h:146
GOOGLE_DCHECK_LE
#define GOOGLE_DCHECK_LE
Definition: bloaty/third_party/protobuf/src/google/protobuf/stubs/logging.h:199
versiongenerate.buffer_size
int buffer_size
Definition: bloaty/third_party/protobuf/third_party/googletest/googletest/xcode/Scripts/versiongenerate.py:65
setup.target
target
Definition: third_party/bloaty/third_party/protobuf/python/setup.py:179
google::protobuf::STLStringResizeUninitialized
void STLStringResizeUninitialized(string *s, size_t new_size)
Definition: bloaty/third_party/protobuf/src/google/protobuf/stubs/stl_util.h:47
google::protobuf::io::CodedInputStream::DecrementRecursionDepthAndPopLimit
bool DecrementRecursionDepthAndPopLimit(Limit limit)
Definition: bloaty/third_party/protobuf/src/google/protobuf/io/coded_stream.cc:158
google
Definition: bloaty/third_party/protobuf/benchmarks/util/data_proto2_to_proto3_util.h:11
google::protobuf::io::EpsCopyOutputStream::ByteCount
int64 ByteCount(uint8 *ptr) const
Definition: bloaty/third_party/protobuf/src/google/protobuf/io/coded_stream.cc:673
i
uint64_t i
Definition: abseil-cpp/absl/container/btree_benchmark.cc:230
google::protobuf::io::CodedOutputStream::WriteLittleEndian32ToArray
static uint8 * WriteLittleEndian32ToArray(uint32 value, uint8 *target)
Definition: bloaty/third_party/protobuf/src/google/protobuf/io/coded_stream.h:1605
offset
voidpf uLong offset
Definition: bloaty/third_party/zlib/contrib/minizip/ioapi.h:142
google::protobuf::io::ZeroCopyOutputStream::BackUp
virtual void BackUp(int count)=0
google::protobuf::io::CodedInputStream::BufferSize
int BufferSize() const
Definition: bloaty/third_party/protobuf/src/google/protobuf/io/coded_stream.h:1526
google::protobuf::io::CodedInputStream::ReadVarint64
bool ReadVarint64(uint64 *value)
Definition: bloaty/third_party/protobuf/src/google/protobuf/io/coded_stream.h:1283
stream
voidpf stream
Definition: bloaty/third_party/zlib/contrib/minizip/ioapi.h:136


grpc
Author(s):
autogenerated on Fri May 16 2025 02:57:56