mirror of
https://github.com/RPCS3/llvm.git
synced 2026-07-19 23:23:38 -04:00
Add a BinarySubstreamRef, and a method to read one.
This is essentially just a BinaryStreamRef packaged with an offset and the logic for reading one is no different than the logic for reading a BinaryStreamRef, except that we save the current offset. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@306122 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -109,6 +109,12 @@ Error BinaryStreamReader::readStreamRef(BinaryStreamRef &Ref, uint32_t Length) {
|
||||
return Error::success();
|
||||
}
|
||||
|
||||
Error BinaryStreamReader::readSubstream(BinarySubstreamRef &Stream,
|
||||
uint32_t Size) {
|
||||
Stream.Offset = getOffset();
|
||||
return readStreamRef(Stream.StreamData, Size);
|
||||
}
|
||||
|
||||
Error BinaryStreamReader::skip(uint32_t Amount) {
|
||||
if (Amount > bytesRemaining())
|
||||
return make_error<BinaryStreamError>(stream_error_code::stream_too_short);
|
||||
|
||||
Reference in New Issue
Block a user