Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(65)

Unified Diff: core/fxcrt/fx_basic_buffer.cpp

Issue 2584683002: Return unique_ptr from CFX_BinaryBuf::DetachBuffer() (Closed)
Patch Set: Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « core/fxcrt/fx_basic.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: core/fxcrt/fx_basic_buffer.cpp
diff --git a/core/fxcrt/fx_basic_buffer.cpp b/core/fxcrt/fx_basic_buffer.cpp
index fcd156b0795d77a9aa76128a441cb7b4b8a26012..14a85c2ee5ed487e0afe7d584fce8c067ac54fb4 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) {
« no previous file with comments | « core/fxcrt/fx_basic.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698