summaryrefslogtreecommitdiff
path: root/core/fxcrt/fx_basic_buffer.cpp
diff options
context:
space:
mode:
authortsepez <tsepez@chromium.org>2016-12-15 13:51:34 -0800
committerCommit bot <commit-bot@chromium.org>2016-12-15 13:51:34 -0800
commit47fb8c06acd0ff9ea50c8c2d7f67510ea5c28577 (patch)
treeb6c3594bdf3690d00f2fd959f06cef1d45ae0f71 /core/fxcrt/fx_basic_buffer.cpp
parentb04b96b1ea3ef88385bbf736b2bccab7ed12c486 (diff)
downloadpdfium-47fb8c06acd0ff9ea50c8c2d7f67510ea5c28577.tar.xz
Return unique_ptr from CFX_BinaryBuf::DetachBuffer()
In turn, make CPDF_Stream() take an unique_ptr. Review-Url: https://codereview.chromium.org/2584683002
Diffstat (limited to 'core/fxcrt/fx_basic_buffer.cpp')
-rw-r--r--core/fxcrt/fx_basic_buffer.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/core/fxcrt/fx_basic_buffer.cpp b/core/fxcrt/fx_basic_buffer.cpp
index fcd156b079..14a85c2ee5 100644
--- a/core/fxcrt/fx_basic_buffer.cpp
+++ b/core/fxcrt/fx_basic_buffer.cpp
@@ -6,6 +6,8 @@
#include <algorithm>
#include <limits>
+#include <memory>
+#include <utility>
#include "core/fxcrt/fx_basic.h"
#include "core/fxcrt/fx_safe_types.h"
@@ -36,10 +38,10 @@ void CFX_BinaryBuf::Clear() {
m_DataSize = 0;
}
-uint8_t* CFX_BinaryBuf::DetachBuffer() {
+std::unique_ptr<uint8_t, FxFreeDeleter> CFX_BinaryBuf::DetachBuffer() {
m_DataSize = 0;
m_AllocSize = 0;
- return m_pBuffer.release();
+ return std::move(m_pBuffer);
}
void CFX_BinaryBuf::EstimateSize(FX_STRSIZE size, FX_STRSIZE step) {