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

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

Issue 2334323005: Rename dictionary set and get methods (Closed)
Patch Set: Created 4 years, 3 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/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 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
63 uint32_t size, 63 uint32_t size,
64 CPDF_Dictionary* pDict) { 64 CPDF_Dictionary* pDict) {
65 InitStreamInternal(pDict); 65 InitStreamInternal(pDict);
66 m_GenNum = kMemoryBasedGenNum; 66 m_GenNum = kMemoryBasedGenNum;
67 m_pDataBuf = FX_Alloc(uint8_t, size); 67 m_pDataBuf = FX_Alloc(uint8_t, size);
68 if (pData) 68 if (pData)
69 FXSYS_memcpy(m_pDataBuf, pData, size); 69 FXSYS_memcpy(m_pDataBuf, pData, size);
70 70
71 m_dwSize = size; 71 m_dwSize = size;
72 if (m_pDict) 72 if (m_pDict)
73 m_pDict->SetAtInteger("Length", size); 73 m_pDict->SetIntegerFor("Length", size);
74 } 74 }
75 75
76 CPDF_Object* CPDF_Stream::Clone() const { 76 CPDF_Object* CPDF_Stream::Clone() const {
77 return CloneObjectNonCyclic(false); 77 return CloneObjectNonCyclic(false);
78 } 78 }
79 79
80 CPDF_Object* CPDF_Stream::CloneNonCyclic( 80 CPDF_Object* CPDF_Stream::CloneNonCyclic(
81 bool bDirect, 81 bool bDirect,
82 std::set<const CPDF_Object*>* pVisited) const { 82 std::set<const CPDF_Object*>* pVisited) const {
83 pVisited->insert(this); 83 pVisited->insert(this);
(...skipping 21 matching lines...) Expand all
105 m_pDataBuf = const_cast<uint8_t*>(pData); 105 m_pDataBuf = const_cast<uint8_t*>(pData);
106 } else { 106 } else {
107 m_pDataBuf = FX_Alloc(uint8_t, size); 107 m_pDataBuf = FX_Alloc(uint8_t, size);
108 if (pData) { 108 if (pData) {
109 FXSYS_memcpy(m_pDataBuf, pData, size); 109 FXSYS_memcpy(m_pDataBuf, pData, size);
110 } 110 }
111 } 111 }
112 m_dwSize = size; 112 m_dwSize = size;
113 if (!m_pDict) 113 if (!m_pDict)
114 m_pDict = new CPDF_Dictionary; 114 m_pDict = new CPDF_Dictionary;
115 m_pDict->SetAtInteger("Length", size); 115 m_pDict->SetIntegerFor("Length", size);
116 if (!bCompressed) { 116 if (!bCompressed) {
117 m_pDict->RemoveAt("Filter"); 117 m_pDict->RemoveFor("Filter");
118 m_pDict->RemoveAt("DecodeParms"); 118 m_pDict->RemoveFor("DecodeParms");
119 } 119 }
120 } 120 }
121 121
122 FX_BOOL CPDF_Stream::ReadRawData(FX_FILESIZE offset, 122 FX_BOOL CPDF_Stream::ReadRawData(FX_FILESIZE offset,
123 uint8_t* buf, 123 uint8_t* buf,
124 uint32_t size) const { 124 uint32_t size) const {
125 if (!IsMemoryBased() && m_pFile) 125 if (!IsMemoryBased() && m_pFile)
126 return m_pFile->ReadBlock(buf, offset, size); 126 return m_pFile->ReadBlock(buf, offset, size);
127 127
128 if (m_pDataBuf) 128 if (m_pDataBuf)
129 FXSYS_memcpy(buf, m_pDataBuf + offset, size); 129 FXSYS_memcpy(buf, m_pDataBuf + offset, size);
130 130
131 return TRUE; 131 return TRUE;
132 } 132 }
133 133
134 void CPDF_Stream::InitStreamFromFile(IFX_FileRead* pFile, 134 void CPDF_Stream::InitStreamFromFile(IFX_FileRead* pFile,
135 CPDF_Dictionary* pDict) { 135 CPDF_Dictionary* pDict) {
136 InitStreamInternal(pDict); 136 InitStreamInternal(pDict);
137 m_pFile = pFile; 137 m_pFile = pFile;
138 m_dwSize = (uint32_t)pFile->GetSize(); 138 m_dwSize = (uint32_t)pFile->GetSize();
139 if (m_pDict) 139 if (m_pDict)
140 m_pDict->SetAtInteger("Length", m_dwSize); 140 m_pDict->SetIntegerFor("Length", m_dwSize);
141 } 141 }
142 142
143 CFX_WideString CPDF_Stream::GetUnicodeText() const { 143 CFX_WideString CPDF_Stream::GetUnicodeText() const {
144 CPDF_StreamAcc stream; 144 CPDF_StreamAcc stream;
145 stream.LoadAllData(this, FALSE); 145 stream.LoadAllData(this, FALSE);
146 return PDF_DecodeText(stream.GetData(), stream.GetSize()); 146 return PDF_DecodeText(stream.GetData(), stream.GetSize());
147 } 147 }
148 148
OLDNEW
« no previous file with comments | « core/fpdfapi/fpdf_parser/cpdf_security_handler.cpp ('k') | core/fpdfapi/fpdf_parser/cpdf_syntax_parser.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698