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

Side by Side 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 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 unified diff | 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 »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 PDFium Authors. All rights reserved. 1 // Copyright 2016 PDFium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
6 6
7 #include "core/fpdfapi/parser/cpdf_stream_acc.h" 7 #include "core/fpdfapi/parser/cpdf_stream_acc.h"
8 8
9 #include "core/fpdfapi/parser/fpdf_parser_decode.h" 9 #include "core/fpdfapi/parser/fpdf_parser_decode.h"
10 10
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
67 return m_pData; 67 return m_pData;
68 return m_pStream ? m_pStream->GetRawData() : nullptr; 68 return m_pStream ? m_pStream->GetRawData() : nullptr;
69 } 69 }
70 70
71 uint32_t CPDF_StreamAcc::GetSize() const { 71 uint32_t CPDF_StreamAcc::GetSize() const {
72 if (m_bNewBuf) 72 if (m_bNewBuf)
73 return m_dwSize; 73 return m_dwSize;
74 return m_pStream ? m_pStream->GetRawSize() : 0; 74 return m_pStream ? m_pStream->GetRawSize() : 0;
75 } 75 }
76 76
77 uint8_t* CPDF_StreamAcc::DetachData() { 77 std::unique_ptr<uint8_t, FxFreeDeleter> CPDF_StreamAcc::DetachData() {
78 if (m_bNewBuf) { 78 if (m_bNewBuf) {
79 uint8_t* p = m_pData; 79 std::unique_ptr<uint8_t, FxFreeDeleter> p(m_pData);
80 m_pData = nullptr; 80 m_pData = nullptr;
81 m_dwSize = 0; 81 m_dwSize = 0;
82 return p; 82 return p;
83 } 83 }
84 uint8_t* p = FX_Alloc(uint8_t, m_dwSize); 84 std::unique_ptr<uint8_t, FxFreeDeleter> p(FX_Alloc(uint8_t, m_dwSize));
85 FXSYS_memcpy(p, m_pData, m_dwSize); 85 FXSYS_memcpy(p.get(), m_pData, m_dwSize);
86 return p; 86 return p;
87 } 87 }
OLDNEW
« 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