aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/google/protobuf/io/coded_stream_inl.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/google/protobuf/io/coded_stream_inl.h')
-rw-r--r--src/google/protobuf/io/coded_stream_inl.h17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/google/protobuf/io/coded_stream_inl.h b/src/google/protobuf/io/coded_stream_inl.h
index cd8d1746..fa20f208 100644
--- a/src/google/protobuf/io/coded_stream_inl.h
+++ b/src/google/protobuf/io/coded_stream_inl.h
@@ -66,6 +66,23 @@ inline bool CodedInputStream::InternalReadStringInline(string* buffer,
return ReadStringFallback(buffer, size);
}
+inline bool CodedInputStream::InternalReadRawInline(void* buffer, int size) {
+ int current_buffer_size;
+ while ((current_buffer_size = BufferSize()) < size) {
+ // Reading past end of buffer. Copy what we have, then refresh.
+ memcpy(buffer, buffer_, current_buffer_size);
+ buffer = reinterpret_cast<uint8*>(buffer) + current_buffer_size;
+ size -= current_buffer_size;
+ Advance(current_buffer_size);
+ if (!Refresh()) return false;
+ }
+
+ memcpy(buffer, buffer_, size);
+ Advance(size);
+
+ return true;
+}
+
} // namespace io
} // namespace protobuf
} // namespace google