Go to the documentation of this file.
52 #include <google/protobuf/port_def.inc>
60 static const int kMaxVarintBytes = 10;
61 static const int kMaxVarint32Bytes = 5;
64 inline bool NextNonEmpty(ZeroCopyInputStream*
input,
const void**
data,
69 }
while (success && *
size == 0);
93 if (backup_bytes > 0) {
126 if (PROTOBUF_PREDICT_TRUE(byte_limit >= 0 &&
127 byte_limit <= INT_MAX - current_position &&
147 std::pair<CodedInputStream::Limit, int>
192 GOOGLE_LOG(
ERROR) <<
"A protocol message was rejected because it was too "
195 <<
" bytes). To increase the limit (or to disable these "
196 "warnings), see CodedInputStream::SetTotalBytesLimit() "
197 "in net/proto2/io/public/coded_stream.h.";
207 count -= original_buffer_size;
214 if (bytes_until_limit <
count) {
216 if (bytes_until_limit > 0) {
244 if (
size < 0)
return false;
254 if (closest_limit != INT_MAX) {
256 if (bytes_to_limit > 0 &&
size > 0 &&
size <= bytes_to_limit) {
261 int current_buffer_size;
264 if (current_buffer_size != 0) {
268 current_buffer_size);
270 size -= current_buffer_size;
336 PROTOBUF_ALWAYS_INLINE
337 ::std::pair<bool, const uint8*> ReadVarint32FromArray(
uint32 first_byte,
340 inline ::std::pair<bool, const uint8*> ReadVarint32FromArray(
348 uint32 result = first_byte - 0x80;
352 if (!(
b & 0x80))
goto done;
356 if (!(
b & 0x80))
goto done;
357 result -= 0x80 << 14;
360 if (!(
b & 0x80))
goto done;
361 result -= 0x80 << 21;
364 if (!(
b & 0x80))
goto done;
369 for (
int i = 0;
i < kMaxVarintBytes - kMaxVarint32Bytes;
i++) {
371 if (!(
b & 0x80))
goto done;
376 return std::make_pair(
false, ptr);
380 return std::make_pair(
true, ptr);
383 PROTOBUF_ALWAYS_INLINE::std::pair<bool, const uint8*> ReadVarint64FromArray(
385 inline ::std::pair<bool, const uint8*> ReadVarint64FromArray(
393 }
else if (
buffer[2] < 128) {
395 }
else if (
buffer[3] < 128) {
397 }
else if (
buffer[4] < 128) {
399 }
else if (
buffer[5] < 128) {
401 }
else if (
buffer[6] < 128) {
403 }
else if (
buffer[7] < 128) {
405 }
else if (
buffer[8] < 128) {
407 }
else if (
buffer[9] < 128) {
412 return std::make_pair(
false,
buffer + 11);
415 return std::make_pair(
true,
next);
434 <<
"Caller should provide us with *buffer_ when buffer is non-empty";
436 ::std::pair<bool, const uint8*>
p =
437 ReadVarint32FromArray(first_byte_or_zero,
buffer_, &temp);
438 if (!
p.first)
return -1;
454 if (!
p.second ||
p.first >
static_cast<uint64>(INT_MAX))
return -1;
464 ::std::pair<bool, const uint8*>
p = ReadVarint64FromArray(
buffer_, &temp);
465 if (!
p.first || temp >
static_cast<uint64>(INT_MAX))
return -1;
499 return static_cast<uint32>(result);
504 if (buf_size >= kMaxVarintBytes ||
509 if (first_byte_or_zero == 0) {
514 ::std::pair<bool, const uint8*>
p =
515 ReadVarint32FromArray(first_byte_or_zero,
buffer_, &tag);
524 if ((buf_size == 0) &&
548 if (
count == kMaxVarintBytes) {
574 ::std::pair<bool, const uint8*>
p = ReadVarint64FromArray(
buffer_, &temp);
576 return std::make_pair(0,
false);
579 return std::make_pair(temp,
true);
583 return std::make_pair(temp, success);
604 const void* void_buffer;
647 bool do_eager_refresh)
653 aliasing_enabled_(
false),
654 is_serialization_deterministic_(IsDefaultSerializationDeterministic()) {
655 if (do_eager_refresh) {
677 if (
count < 0)
return false;
static uint8 * WriteLittleEndian32ToArray(uint32 value, uint8 *target)
virtual bool WriteAliasedRaw(const void *data, int size)
CodedOutputStream(ZeroCopyOutputStream *output)
void WriteRaw(const void *buffer, int size)
const Descriptor::ReservedRange value
void WriteAliasedRaw(const void *buffer, int size)
ZeroCopyOutputStream * output_
void WriteVarint32SlowPath(uint32 value)
GLenum GLuint GLenum GLsizei length
GLsizei const GLchar *const * string
static uint8 * WriteVarint32ToArray(uint32 value, uint8 *target)
void WriteLittleEndian32(uint32 value)
GLboolean GLboolean GLboolean b
GLenum GLenum GLsizei const GLuint GLboolean enabled
void EnableAliasing(bool enabled)
static uint8 * WriteVarint64ToArray(uint64 value, uint8 *target)
#define GOOGLE_LOG(LEVEL)
virtual bool AllowsAliasing() const
void WriteVarint64SlowPath(uint64 value)
static const LogLevel ERROR
static const uint32 kuint32max
static uint8 * WriteLittleEndian64ToArray(uint64 value, uint8 *target)
static std::atomic< bool > default_serialization_deterministic_
#define GOOGLE_CHECK_GE(A, B)
static uint8 * WriteStringWithSizeToArray(const std::string &str, uint8 *target)
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
void WriteLittleEndian64(uint64 value)
static uint8 buffer_[kBufferSize]
virtual bool Next(void **data, int *size)=0
static size_t next(const upb_table *t, size_t i)
GLsizei const GLfloat * value
const upb_json_parsermethod const upb_symtab upb_sink * output
static uint8 * WriteStringToArray(const std::string &str, uint8 *target)
bool GetDirectBufferPointer(void **data, int *size)
virtual void BackUp(int count)=0
static uint8 * WriteRawToArray(const void *buffer, int size, uint8 *target)
libaditof
Author(s):
autogenerated on Wed May 21 2025 02:06:48