diff options
author | Tom Sepez <tsepez@chromium.org> | 2018-08-23 23:47:03 +0000 |
---|---|---|
committer | Chromium commit bot <commit-bot@chromium.org> | 2018-08-23 23:47:03 +0000 |
commit | c1dde5d9b3da2af6e6f81df09ed41ab9c34bbde4 (patch) | |
tree | 74a361473c5f8b3044ab3f17e72f784edb72db4b /core/fxcrt/cfx_memorystream.cpp | |
parent | a41801ee0e7c0d76feca2dfe20103d8b82391026 (diff) | |
download | pdfium-c1dde5d9b3da2af6e6f81df09ed41ab9c34bbde4.tar.xz |
Pass unique_ptr<> to CFX_MemoryStream constructor
Proves we own the memory that the class will eventually free.
Change-Id: Ie9523da8db738e7478a1c73e3e1a6b24aed38442
Reviewed-on: https://pdfium-review.googlesource.com/41290
Reviewed-by: Lei Zhang <thestig@chromium.org>
Commit-Queue: Tom Sepez <tsepez@chromium.org>
Diffstat (limited to 'core/fxcrt/cfx_memorystream.cpp')
-rw-r--r-- | core/fxcrt/cfx_memorystream.cpp | 7 |
1 files changed, 5 insertions, 2 deletions
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; |