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

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

Issue 2345063002: Use string pools in some dictionaries (Closed)
Patch Set: Remove default ctor 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 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
104 if (bKeepBuf) { 104 if (bKeepBuf) {
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(nullptr);
115 m_pDict->SetIntegerFor("Length", size); 115 m_pDict->SetIntegerFor("Length", size);
116 if (!bCompressed) { 116 if (!bCompressed) {
117 m_pDict->RemoveFor("Filter"); 117 m_pDict->RemoveFor("Filter");
118 m_pDict->RemoveFor("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 {
(...skipping 14 matching lines...) Expand all
139 if (m_pDict) 139 if (m_pDict)
140 m_pDict->SetIntegerFor("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

Powered by Google App Engine
This is Rietveld 408576698