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

Side by Side Diff: core/fpdfapi/parser/cpdf_stream.cpp

Issue 2451493002: Refcount all the IFX_ stream classes all the time. (Closed)
Patch Set: Clean up cast expression 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.h ('k') | core/fpdfapi/parser/cpdf_syntax_parser.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.h" 7 #include "core/fpdfapi/parser/cpdf_stream.h"
8 8
9 #include <utility> 9 #include <utility>
10 10
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
55 m_bMemoryBased = true; 55 m_bMemoryBased = true;
56 m_pFile = nullptr; 56 m_pFile = nullptr;
57 m_pDataBuf.reset(FX_Alloc(uint8_t, size)); 57 m_pDataBuf.reset(FX_Alloc(uint8_t, size));
58 if (pData) 58 if (pData)
59 FXSYS_memcpy(m_pDataBuf.get(), pData, size); 59 FXSYS_memcpy(m_pDataBuf.get(), pData, size);
60 m_dwSize = size; 60 m_dwSize = size;
61 if (m_pDict) 61 if (m_pDict)
62 m_pDict->SetNewFor<CPDF_Number>("Length", static_cast<int>(m_dwSize)); 62 m_pDict->SetNewFor<CPDF_Number>("Length", static_cast<int>(m_dwSize));
63 } 63 }
64 64
65 void CPDF_Stream::InitStreamFromFile(IFX_SeekableReadStream* pFile, 65 void CPDF_Stream::InitStreamFromFile(
66 std::unique_ptr<CPDF_Dictionary> pDict) { 66 const CFX_RetainPtr<IFX_SeekableReadStream>& pFile,
67 std::unique_ptr<CPDF_Dictionary> pDict) {
67 m_pDict = std::move(pDict); 68 m_pDict = std::move(pDict);
68 m_bMemoryBased = false; 69 m_bMemoryBased = false;
69 m_pDataBuf.reset(); 70 m_pDataBuf.reset();
70 m_pFile = pFile; 71 m_pFile = pFile;
71 m_dwSize = pdfium::base::checked_cast<uint32_t>(pFile->GetSize()); 72 m_dwSize = pdfium::base::checked_cast<uint32_t>(pFile->GetSize());
72 if (m_pDict) 73 if (m_pDict)
73 m_pDict->SetNewFor<CPDF_Number>("Length", static_cast<int>(m_dwSize)); 74 m_pDict->SetNewFor<CPDF_Number>("Length", static_cast<int>(m_dwSize));
74 } 75 }
75 76
76 std::unique_ptr<CPDF_Object> CPDF_Stream::Clone() const { 77 std::unique_ptr<CPDF_Object> CPDF_Stream::Clone() const {
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
122 123
123 bool CPDF_Stream::HasFilter() const { 124 bool CPDF_Stream::HasFilter() const {
124 return m_pDict && m_pDict->KeyExist("Filter"); 125 return m_pDict && m_pDict->KeyExist("Filter");
125 } 126 }
126 127
127 CFX_WideString CPDF_Stream::GetUnicodeText() const { 128 CFX_WideString CPDF_Stream::GetUnicodeText() const {
128 CPDF_StreamAcc stream; 129 CPDF_StreamAcc stream;
129 stream.LoadAllData(this, false); 130 stream.LoadAllData(this, false);
130 return PDF_DecodeText(stream.GetData(), stream.GetSize()); 131 return PDF_DecodeText(stream.GetData(), stream.GetSize());
131 } 132 }
OLDNEW
« no previous file with comments | « core/fpdfapi/parser/cpdf_stream.h ('k') | core/fpdfapi/parser/cpdf_syntax_parser.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698