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

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

Issue 2383843002: Fix build of pdf_hint_table_fuzzer. (Closed)
Patch Set: Created 4 years, 2 months 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
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/fpdf_parser/cpdf_stream.h" 7 #include "core/fpdfapi/fpdf_parser/cpdf_stream.h"
8 8
9 #include "core/fpdfapi/fpdf_parser/cpdf_dictionary.h" 9 #include "core/fpdfapi/fpdf_parser/cpdf_dictionary.h"
10 #include "core/fpdfapi/fpdf_parser/cpdf_stream_acc.h" 10 #include "core/fpdfapi/fpdf_parser/cpdf_stream_acc.h"
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
86 return new CPDF_Stream(acc.DetachData(), streamSize, pDict); 86 return new CPDF_Stream(acc.DetachData(), streamSize, pDict);
87 } 87 }
88 88
89 void CPDF_Stream::SetData(const uint8_t* pData, uint32_t size) { 89 void CPDF_Stream::SetData(const uint8_t* pData, uint32_t size) {
90 m_bMemoryBased = true; 90 m_bMemoryBased = true;
91 m_pDataBuf.reset(FX_Alloc(uint8_t, size)); 91 m_pDataBuf.reset(FX_Alloc(uint8_t, size));
92 if (pData) 92 if (pData)
93 FXSYS_memcpy(m_pDataBuf.get(), pData, size); 93 FXSYS_memcpy(m_pDataBuf.get(), pData, size);
94 m_dwSize = size; 94 m_dwSize = size;
95 if (!m_pDict) 95 if (!m_pDict)
96 m_pDict.reset(new CPDF_Dictionary(CFX_WeakPtr<CFX_ByteStringPool>())); 96 m_pDict.reset(new CPDF_Dictionary());
97 m_pDict->SetIntegerFor("Length", size); 97 m_pDict->SetIntegerFor("Length", size);
98 m_pDict->RemoveFor("Filter"); 98 m_pDict->RemoveFor("Filter");
99 m_pDict->RemoveFor("DecodeParms"); 99 m_pDict->RemoveFor("DecodeParms");
100 } 100 }
101 101
102 FX_BOOL CPDF_Stream::ReadRawData(FX_FILESIZE offset, 102 FX_BOOL CPDF_Stream::ReadRawData(FX_FILESIZE offset,
103 uint8_t* buf, 103 uint8_t* buf,
104 uint32_t size) const { 104 uint32_t size) const {
105 if (m_bMemoryBased && m_pFile) 105 if (m_bMemoryBased && m_pFile)
106 return m_pFile->ReadBlock(buf, offset, size); 106 return m_pFile->ReadBlock(buf, offset, size);
107 107
108 if (m_pDataBuf) 108 if (m_pDataBuf)
109 FXSYS_memcpy(buf, m_pDataBuf.get() + offset, size); 109 FXSYS_memcpy(buf, m_pDataBuf.get() + offset, size);
110 110
111 return TRUE; 111 return TRUE;
112 } 112 }
113 113
114 CFX_WideString CPDF_Stream::GetUnicodeText() const { 114 CFX_WideString CPDF_Stream::GetUnicodeText() const {
115 CPDF_StreamAcc stream; 115 CPDF_StreamAcc stream;
116 stream.LoadAllData(this, FALSE); 116 stream.LoadAllData(this, FALSE);
117 return PDF_DecodeText(stream.GetData(), stream.GetSize()); 117 return PDF_DecodeText(stream.GetData(), stream.GetSize());
118 } 118 }
119 119
OLDNEW
« no previous file with comments | « core/fpdfapi/fpdf_parser/cpdf_object_unittest.cpp ('k') | core/fpdfdoc/cpdf_filespec_unittest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698