diff options
author | Greg Clayton <gclayton@apple.com> | 2013-03-21 00:29:45 +0000 |
---|---|---|
committer | Greg Clayton <gclayton@apple.com> | 2013-03-21 00:29:45 +0000 |
commit | bd180cb623b7e7b97c9179319b7562e3faa32fbc (patch) | |
tree | 5c14ca6d9ab743f9576a6f8ad84087510fa2348e /lldb/source/Core/DataEncoder.cpp | |
parent | c25e21c10ef857d034f1be4a5c16898e08f7c5a7 (diff) | |
download | bcm5719-llvm-bd180cb623b7e7b97c9179319b7562e3faa32fbc.tar.gz bcm5719-llvm-bd180cb623b7e7b97c9179319b7562e3faa32fbc.zip |
Fixed the ValidOffsetForDataOfSize() to use simpler logic. Fixed DataExtractor::BytesLeft() to return the correct value.
llvm-svn: 177616
Diffstat (limited to 'lldb/source/Core/DataEncoder.cpp')
-rw-r--r-- | lldb/source/Core/DataEncoder.cpp | 26 |
1 files changed, 0 insertions, 26 deletions
diff --git a/lldb/source/Core/DataEncoder.cpp b/lldb/source/Core/DataEncoder.cpp index 933cc3eb23b..92a9104acc3 100644 --- a/lldb/source/Core/DataEncoder.cpp +++ b/lldb/source/Core/DataEncoder.cpp @@ -142,32 +142,6 @@ DataEncoder::GetSharedDataOffset () const return 0; } -//------------------------------------------------------------------ -// Returns true if there are LENGTH bytes availabe starting OFFSET -// into the data that is in this object. -//------------------------------------------------------------------ -bool -DataEncoder::ValidOffsetForDataOfSize (uint32_t offset, uint32_t length) const -{ - size_t size = GetByteSize(); - if (offset >= size) - return false; // offset isn't valid - - if (length == 0) - return true; // No bytes requested at this offset, return true - - // If we flip the bits in offset we can figure out how - // many bytes we have left before "offset + length" - // could overflow when doing unsigned arithmetic. - if (length > ~offset) - return false; // unsigned overflow - - // Make sure "offset + length" is a valid offset as well. - // length must be greater than zero for this to be a - // valid expression, and we have already checked for this. - return ((offset + length) <= size); -} - //---------------------------------------------------------------------- // Set the data with which this object will extract from to data // starting at BYTES and set the length of the data to LENGTH bytes |