| OLD | NEW |
| 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 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 84 CPDF_StreamAcc acc; | 84 CPDF_StreamAcc acc; |
| 85 acc.LoadAllData(this, true); | 85 acc.LoadAllData(this, true); |
| 86 | 86 |
| 87 uint32_t streamSize = acc.GetSize(); | 87 uint32_t streamSize = acc.GetSize(); |
| 88 CPDF_Dictionary* pDict = GetDict(); | 88 CPDF_Dictionary* pDict = GetDict(); |
| 89 std::unique_ptr<CPDF_Dictionary> pNewDict; | 89 std::unique_ptr<CPDF_Dictionary> pNewDict; |
| 90 if (pDict && !pdfium::ContainsKey(*pVisited, pDict)) { | 90 if (pDict && !pdfium::ContainsKey(*pVisited, pDict)) { |
| 91 pNewDict = ToDictionary( | 91 pNewDict = ToDictionary( |
| 92 static_cast<CPDF_Object*>(pDict)->CloneNonCyclic(bDirect, pVisited)); | 92 static_cast<CPDF_Object*>(pDict)->CloneNonCyclic(bDirect, pVisited)); |
| 93 } | 93 } |
| 94 return pdfium::MakeUnique<CPDF_Stream>(acc.DetachData(), streamSize, | 94 return pdfium::MakeUnique<CPDF_Stream>(acc.DetachData().release(), streamSize, |
| 95 std::move(pNewDict)); | 95 std::move(pNewDict)); |
| 96 } | 96 } |
| 97 | 97 |
| 98 void CPDF_Stream::SetData(const uint8_t* pData, uint32_t size) { | 98 void CPDF_Stream::SetData(const uint8_t* pData, uint32_t size) { |
| 99 m_bMemoryBased = true; | 99 m_bMemoryBased = true; |
| 100 m_pDataBuf.reset(FX_Alloc(uint8_t, size)); | 100 m_pDataBuf.reset(FX_Alloc(uint8_t, size)); |
| 101 if (pData) | 101 if (pData) |
| 102 FXSYS_memcpy(m_pDataBuf.get(), pData, size); | 102 FXSYS_memcpy(m_pDataBuf.get(), pData, size); |
| 103 m_dwSize = size; | 103 m_dwSize = size; |
| 104 if (!m_pDict) | 104 if (!m_pDict) |
| (...skipping 17 matching lines...) Expand all Loading... |
| 122 | 122 |
| 123 bool CPDF_Stream::HasFilter() const { | 123 bool CPDF_Stream::HasFilter() const { |
| 124 return m_pDict && m_pDict->KeyExist("Filter"); | 124 return m_pDict && m_pDict->KeyExist("Filter"); |
| 125 } | 125 } |
| 126 | 126 |
| 127 CFX_WideString CPDF_Stream::GetUnicodeText() const { | 127 CFX_WideString CPDF_Stream::GetUnicodeText() const { |
| 128 CPDF_StreamAcc stream; | 128 CPDF_StreamAcc stream; |
| 129 stream.LoadAllData(this, false); | 129 stream.LoadAllData(this, false); |
| 130 return PDF_DecodeText(stream.GetData(), stream.GetSize()); | 130 return PDF_DecodeText(stream.GetData(), stream.GetSize()); |
| 131 } | 131 } |
| OLD | NEW |