summaryrefslogtreecommitdiff
path: root/core
diff options
context:
space:
mode:
Diffstat (limited to 'core')
-rw-r--r--core/fpdfapi/parser/cpdf_object_stream.cpp2
-rw-r--r--core/fxcrt/cfx_memorystream.cpp7
-rw-r--r--core/fxcrt/cfx_memorystream.h5
3 files changed, 8 insertions, 6 deletions
diff --git a/core/fpdfapi/parser/cpdf_object_stream.cpp b/core/fpdfapi/parser/cpdf_object_stream.cpp
index d6b3d365f6..7e4b4ae81c 100644
--- a/core/fpdfapi/parser/cpdf_object_stream.cpp
+++ b/core/fpdfapi/parser/cpdf_object_stream.cpp
@@ -97,7 +97,7 @@ void CPDF_ObjectStream::Init(const CPDF_Stream* stream) {
stream_acc->LoadAllDataFiltered();
const uint32_t data_size = stream_acc->GetSize();
data_stream_ = pdfium::MakeRetain<CFX_MemoryStream>(
- stream_acc->DetachData().release(), data_size);
+ stream_acc->DetachData(), data_size);
}
CPDF_SyntaxParser syntax(data_stream_);
diff --git a/core/fxcrt/cfx_memorystream.cpp b/core/fxcrt/cfx_memorystream.cpp
index d64d2a0b43..ac04dcc301 100644
--- a/core/fxcrt/cfx_memorystream.cpp
+++ b/core/fxcrt/cfx_memorystream.cpp
@@ -7,13 +7,16 @@
#include "core/fxcrt/cfx_memorystream.h"
#include <algorithm>
+#include <utility>
#include "core/fxcrt/fx_safe_types.h"
CFX_MemoryStream::CFX_MemoryStream() : m_nTotalSize(0), m_nCurSize(0) {}
-CFX_MemoryStream::CFX_MemoryStream(uint8_t* pBuffer, size_t nSize)
- : m_data(pBuffer), m_nTotalSize(nSize), m_nCurSize(nSize) {}
+CFX_MemoryStream::CFX_MemoryStream(
+ std::unique_ptr<uint8_t, FxFreeDeleter> pBuffer,
+ size_t nSize)
+ : m_data(std::move(pBuffer)), m_nTotalSize(nSize), m_nCurSize(nSize) {}
CFX_MemoryStream::~CFX_MemoryStream() = default;
diff --git a/core/fxcrt/cfx_memorystream.h b/core/fxcrt/cfx_memorystream.h
index 47e491275c..99e39a8ef3 100644
--- a/core/fxcrt/cfx_memorystream.h
+++ b/core/fxcrt/cfx_memorystream.h
@@ -31,9 +31,8 @@ class CFX_MemoryStream : public IFX_SeekableStream {
private:
CFX_MemoryStream();
-
- // Takes ownership of |pBuffer|.
- CFX_MemoryStream(uint8_t* pBuffer, size_t nSize);
+ CFX_MemoryStream(std::unique_ptr<uint8_t, FxFreeDeleter> pBuffer,
+ size_t nSize);
~CFX_MemoryStream() override;
std::unique_ptr<uint8_t, FxFreeDeleter> m_data;