diff options
author | Zachary Turner <zturner@google.com> | 2017-11-27 18:48:37 +0000 |
---|---|---|
committer | Zachary Turner <zturner@google.com> | 2017-11-27 18:48:37 +0000 |
commit | 81a153c99a29006cf55b31f0ba898faf3ecd02b5 (patch) | |
tree | 7eb7f5f8569f25bde5c31e5d9c9908b57d6fb668 /lib/DebugInfo | |
parent | 5f26e59f298a50e931cc169cb04a157299940371 (diff) |
[BinaryStream] Support growable streams.
The existing library assumed that a stream's length would never
change. This makes some things simpler, but it's not flexible
enough for what we need, especially for writable streams where
what you really want is for each call to write to actually append.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@319070 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/DebugInfo')
-rw-r--r-- | lib/DebugInfo/MSF/MappedBlockStream.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/lib/DebugInfo/MSF/MappedBlockStream.cpp b/lib/DebugInfo/MSF/MappedBlockStream.cpp index f28f944131b..dec28eb3069 100644 --- a/lib/DebugInfo/MSF/MappedBlockStream.cpp +++ b/lib/DebugInfo/MSF/MappedBlockStream.cpp @@ -89,7 +89,7 @@ MappedBlockStream::createFpmStream(const MSFLayout &Layout, Error MappedBlockStream::readBytes(uint32_t Offset, uint32_t Size, ArrayRef<uint8_t> &Buffer) { // Make sure we aren't trying to read beyond the end of the stream. - if (auto EC = checkOffset(Offset, Size)) + if (auto EC = checkOffsetForRead(Offset, Size)) return EC; if (tryReadContiguously(Offset, Size, Buffer)) @@ -167,7 +167,7 @@ Error MappedBlockStream::readBytes(uint32_t Offset, uint32_t Size, Error MappedBlockStream::readLongestContiguousChunk(uint32_t Offset, ArrayRef<uint8_t> &Buffer) { // Make sure we aren't trying to read beyond the end of the stream. - if (auto EC = checkOffset(Offset, 1)) + if (auto EC = checkOffsetForRead(Offset, 1)) return EC; uint32_t First = Offset / BlockSize; @@ -243,7 +243,7 @@ Error MappedBlockStream::readBytes(uint32_t Offset, uint32_t OffsetInBlock = Offset % BlockSize; // Make sure we aren't trying to read beyond the end of the stream. - if (auto EC = checkOffset(Offset, Buffer.size())) + if (auto EC = checkOffsetForRead(Offset, Buffer.size())) return EC; uint32_t BytesLeft = Buffer.size(); @@ -388,7 +388,7 @@ uint32_t WritableMappedBlockStream::getLength() { Error WritableMappedBlockStream::writeBytes(uint32_t Offset, ArrayRef<uint8_t> Buffer) { // Make sure we aren't trying to write beyond the end of the stream. - if (auto EC = checkOffset(Offset, Buffer.size())) + if (auto EC = checkOffsetForWrite(Offset, Buffer.size())) return EC; uint32_t BlockNum = Offset / getBlockSize(); |