[PATCH] D26640: Restore behavior broken by r286896 when Offset > 0 and !Data.empty()
Vitaly Buka via llvm-commits
llvm-commits at lists.llvm.org
Mon Nov 14 14:44:51 PST 2016
vitalybuka created this revision.
vitalybuka added reviewers: zturner, majnemer.
vitalybuka added a subscriber: llvm-commits.
https://reviews.llvm.org/D26640
Files:
include/llvm/DebugInfo/MSF/ByteStream.h
Index: include/llvm/DebugInfo/MSF/ByteStream.h
===================================================================
--- include/llvm/DebugInfo/MSF/ByteStream.h
+++ include/llvm/DebugInfo/MSF/ByteStream.h
@@ -91,16 +91,14 @@
uint32_t getLength() const override { return ImmutableStream.getLength(); }
Error writeBytes(uint32_t Offset, ArrayRef<uint8_t> Buffer) const override {
- if (Buffer.empty())
- return Error::success();
-
if (Data.size() < Buffer.size())
return make_error<MSFError>(msf_error_code::insufficient_buffer);
if (Offset > Buffer.size() - Data.size())
return make_error<MSFError>(msf_error_code::insufficient_buffer);
uint8_t *DataPtr = const_cast<uint8_t *>(Data.data());
- ::memcpy(DataPtr + Offset, Buffer.data(), Buffer.size());
+ if (!Buffer.empty())
+ ::memcpy(DataPtr + Offset, Buffer.data(), Buffer.size());
return Error::success();
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D26640.77890.patch
Type: text/x-patch
Size: 927 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20161114/914507f6/attachment.bin>
More information about the llvm-commits
mailing list