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

Unified Diff: core/fpdfapi/parser/cpdf_stream_acc.cpp

Issue 2522313002: Use CFX_MaybeOwned<> in fpdf_edit_create.cpp (Closed)
Patch Set: nits Created 4 years, 1 month 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/fpdfapi/parser/cpdf_stream_acc.h ('k') | core/fxcrt/cfx_maybe_owned.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: core/fpdfapi/parser/cpdf_stream_acc.cpp
diff --git a/core/fpdfapi/parser/cpdf_stream_acc.cpp b/core/fpdfapi/parser/cpdf_stream_acc.cpp
index 01d8e148dff96bf2d7e09e47fb74a7e3ceb50d4e..423de7c571d05f05ee81e3f2d3326ecd6d4b6dbd 100644
--- a/core/fpdfapi/parser/cpdf_stream_acc.cpp
+++ b/core/fpdfapi/parser/cpdf_stream_acc.cpp
@@ -74,14 +74,14 @@ uint32_t CPDF_StreamAcc::GetSize() const {
return m_pStream ? m_pStream->GetRawSize() : 0;
}
-uint8_t* CPDF_StreamAcc::DetachData() {
+std::unique_ptr<uint8_t, FxFreeDeleter> CPDF_StreamAcc::DetachData() {
if (m_bNewBuf) {
- uint8_t* p = m_pData;
+ std::unique_ptr<uint8_t, FxFreeDeleter> p(m_pData);
m_pData = nullptr;
m_dwSize = 0;
return p;
}
- uint8_t* p = FX_Alloc(uint8_t, m_dwSize);
- FXSYS_memcpy(p, m_pData, m_dwSize);
+ std::unique_ptr<uint8_t, FxFreeDeleter> p(FX_Alloc(uint8_t, m_dwSize));
+ FXSYS_memcpy(p.get(), m_pData, m_dwSize);
return p;
}
« no previous file with comments | « core/fpdfapi/parser/cpdf_stream_acc.h ('k') | core/fxcrt/cfx_maybe_owned.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698