[Lldb-commits] [lldb] r374069 - Simplify LZMA decoding by using ArrayRef::take_back
Konrad Kleine via lldb-commits
lldb-commits at lists.llvm.org
Tue Oct 8 08:43:29 PDT 2019
Author: kwk
Date: Tue Oct 8 08:43:29 2019
New Revision: 374069
URL: http://llvm.org/viewvc/llvm-project?rev=374069&view=rev
Log:
Simplify LZMA decoding by using ArrayRef::take_back
Summary: Follow-up for D66791#inline-616303
Reviewers: labath
Subscribers: lldb-commits
Tags: #lldb
Differential Revision: https://reviews.llvm.org/D68647
Modified:
lldb/trunk/source/Host/common/LZMA.cpp
Modified: lldb/trunk/source/Host/common/LZMA.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/common/LZMA.cpp?rev=374069&r1=374068&r2=374069&view=diff
==============================================================================
--- lldb/trunk/source/Host/common/LZMA.cpp (original)
+++ lldb/trunk/source/Host/common/LZMA.cpp Tue Oct 8 08:43:29 2019
@@ -76,7 +76,7 @@ getUncompressedSize(llvm::ArrayRef<uint8
// Decode xz footer.
lzma_ret xzerr = lzma_stream_footer_decode(
- &opts, InputBuffer.data() + InputBuffer.size() - LZMA_STREAM_HEADER_SIZE);
+ &opts, InputBuffer.take_back(LZMA_STREAM_HEADER_SIZE).data());
if (xzerr != LZMA_OK) {
return llvm::createStringError(llvm::inconvertibleErrorCode(),
"lzma_stream_footer_decode()=%s",
@@ -94,11 +94,11 @@ getUncompressedSize(llvm::ArrayRef<uint8
lzma_index *xzindex;
uint64_t memlimit(UINT64_MAX);
size_t inpos = 0;
- xzerr =
- lzma_index_buffer_decode(&xzindex, &memlimit, nullptr,
- InputBuffer.data() + InputBuffer.size() -
- LZMA_STREAM_HEADER_SIZE - opts.backward_size,
- &inpos, InputBuffer.size());
+ xzerr = lzma_index_buffer_decode(
+ &xzindex, &memlimit, nullptr,
+ InputBuffer.take_back(LZMA_STREAM_HEADER_SIZE + opts.backward_size)
+ .data(),
+ &inpos, InputBuffer.size());
if (xzerr != LZMA_OK) {
return llvm::createStringError(llvm::inconvertibleErrorCode(),
"lzma_index_buffer_decode()=%s",
More information about the lldb-commits
mailing list