Lines Matching refs:buffer
43 // buffer library in order to encode and decode protocol buffers. Clients
82 // coded_input->ReadRaw(buffer, size);
151 explicit CodedInputStream(const uint8* buffer, int size);
166 // underlying buffer, and *size to the size of that buffer, but does not
168 // a non-empty buffer or return false. If the caller consumes any of
175 // attempt to Refresh() if the buffer is currently empty.
179 // Read raw bytes, copying them into the given buffer.
180 bool ReadRaw(void* buffer, int size);
189 bool ReadString(string* buffer, int size);
192 inline bool InternalReadStringInline(string* buffer,
201 // These methods read from an externally provided buffer. The caller is
202 // responsible for ensuring that the buffer has sufficient space.
204 static const uint8* ReadLittleEndian32FromArray(const uint8* buffer,
207 static const uint8* ReadLittleEndian64FromArray(const uint8* buffer,
234 // Like above, except this reads from the specified buffer. The caller is
235 // responsible for ensuring that the buffer is large enough to read a varint
242 const uint8* buffer,
438 const uint8* buffer_end_; // pointer to the end of the buffer.
440 // the current buffer
460 // For simplicity, if the current buffer crosses a limit (either a normal
466 // we aren't at a limit -- the buffer may have ended exactly at the limit.
486 // Advance the buffer by a given number of bytes.
489 // Back up input_ to the current buffer position.
499 // Called when the buffer runs out to request more data. Implies an
504 // then optimize for the case when the varint fits within the current buffer
506 // optimization. The Slow method is yet another fallback when the buffer is
521 bool ReadStringFallback(string* buffer, int size);
523 // Return the size of the buffer.
544 // to the provided buffer, returning a pointer past the last written byte.
545 // They require that the buffer has sufficient capacity for the encoded data.
560 // uint8* buffer =
562 // if (buffer != NULL) {
563 // // The output stream has enough space in the buffer: write directly to
565 // buffer = CodedOutputStream::WriteLittleEndian32ToArray(magic_number,
566 // buffer);
567 // buffer = CodedOutputStream::WriteVarint32ToArray(strlen(text), buffer);
568 // buffer = CodedOutputStream::WriteRawToArray(text, strlen(text), buffer);
588 // buffer. Returns false if an underlying write error occurs. This is
593 // CodedOutputStream's underlying buffer, and *size to the size of that
594 // buffer, but does not advance the stream's current position. This will
595 // always either produce a non-empty buffer or return false. If the caller
596 // writes any data to this buffer, it should then call Skip() to skip over
602 // If there are at least "size" bytes available in the current buffer,
603 // returns a pointer directly into the buffer and advances over these bytes.
604 // The caller may then write directly into this buffer (e.g. using the
611 // Write raw bytes, copying them from the given buffer.
612 void WriteRaw(const void* buffer, int size);
618 static uint8* WriteRawToArray(const void* buffer, int size, uint8* target);
686 // Advance the buffer by a given number of bytes.
689 // Called when the buffer runs out to request more data. Implies an
736 const uint8* buffer,
740 memcpy(value, buffer, sizeof(*value));
741 return buffer + sizeof(*value);
743 *value = (static_cast<uint32>(buffer[0]) ) |
744 (static_cast<uint32>(buffer[1]) << 8) |
745 (static_cast<uint32>(buffer[2]) << 16) |
746 (static_cast<uint32>(buffer[3]) << 24);
747 return buffer + sizeof(*value);
752 const uint8* buffer,
756 memcpy(value, buffer, sizeof(*value));
757 return buffer + sizeof(*value);
759 uint32 part0 = (static_cast<uint32>(buffer[0]) ) |
760 (static_cast<uint32>(buffer[1]) << 8) |
761 (static_cast<uint32>(buffer[2]) << 16) |
762 (static_cast<uint32>(buffer[3]) << 24);
763 uint32 part1 = (static_cast<uint32>(buffer[4]) ) |
764 (static_cast<uint32>(buffer[5]) << 8) |
765 (static_cast<uint32>(buffer[6]) << 16) |
766 (static_cast<uint32>(buffer[7]) << 24);
769 return buffer + sizeof(*value);
846 const uint8* buffer, uint32 expected) {
848 if (buffer[0] == expected) {
849 return buffer + 1;
852 if (buffer[0] == static_cast<uint8>(expected | 0x80) &&
853 buffer[1] == static_cast<uint8>(expected >> 7)) {
854 return buffer + 2;
1055 // Eagerly Refresh() so buffer space is immediately available.
1059 inline CodedInputStream::CodedInputStream(const uint8* buffer, int size)
1061 buffer_(buffer),
1062 buffer_end_(buffer + size),