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/fpdf_parser/include/cpdf_stream.h" | 7 #include "core/fpdfapi/fpdf_parser/include/cpdf_stream.h" |
8 | 8 |
9 #include "core/fpdfapi/fpdf_parser/include/cpdf_dictionary.h" | 9 #include "core/fpdfapi/fpdf_parser/include/cpdf_dictionary.h" |
10 #include "core/fpdfapi/fpdf_parser/include/cpdf_stream_acc.h" | 10 #include "core/fpdfapi/fpdf_parser/include/cpdf_stream_acc.h" |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
50 m_pDict->Release(); | 50 m_pDict->Release(); |
51 m_pDict = pDict; | 51 m_pDict = pDict; |
52 } | 52 } |
53 if (IsMemoryBased()) | 53 if (IsMemoryBased()) |
54 FX_Free(m_pDataBuf); | 54 FX_Free(m_pDataBuf); |
55 | 55 |
56 m_GenNum = 0; | 56 m_GenNum = 0; |
57 m_pFile = nullptr; | 57 m_pFile = nullptr; |
58 } | 58 } |
59 | 59 |
60 void CPDF_Stream::InitStream(uint8_t* pData, | 60 void CPDF_Stream::InitStream(const uint8_t* pData, |
61 uint32_t size, | 61 uint32_t size, |
62 CPDF_Dictionary* pDict) { | 62 CPDF_Dictionary* pDict) { |
63 InitStreamInternal(pDict); | 63 InitStreamInternal(pDict); |
64 m_GenNum = kMemoryBasedGenNum; | 64 m_GenNum = kMemoryBasedGenNum; |
65 m_pDataBuf = FX_Alloc(uint8_t, size); | 65 m_pDataBuf = FX_Alloc(uint8_t, size); |
66 if (pData) | 66 if (pData) |
67 FXSYS_memcpy(m_pDataBuf, pData, size); | 67 FXSYS_memcpy(m_pDataBuf, pData, size); |
68 | 68 |
69 m_dwSize = size; | 69 m_dwSize = size; |
70 if (m_pDict) | 70 if (m_pDict) |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
128 if (m_pDict) | 128 if (m_pDict) |
129 m_pDict->SetAtInteger("Length", m_dwSize); | 129 m_pDict->SetAtInteger("Length", m_dwSize); |
130 } | 130 } |
131 | 131 |
132 CFX_WideString CPDF_Stream::GetUnicodeText() const { | 132 CFX_WideString CPDF_Stream::GetUnicodeText() const { |
133 CPDF_StreamAcc stream; | 133 CPDF_StreamAcc stream; |
134 stream.LoadAllData(this, FALSE); | 134 stream.LoadAllData(this, FALSE); |
135 return PDF_DecodeText(stream.GetData(), stream.GetSize()); | 135 return PDF_DecodeText(stream.GetData(), stream.GetSize()); |
136 } | 136 } |
137 | 137 |
OLD | NEW |