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

Side by Side Diff: fpdfsdk/formfiller/cba_fontmap.cpp

Issue 2347993002: Clean up CPDF_Stream. (Closed)
Patch Set: 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 2014 PDFium Authors. All rights reserved. 1 // Copyright 2014 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 "fpdfsdk/formfiller/cba_fontmap.h" 7 #include "fpdfsdk/formfiller/cba_fontmap.h"
8 8
9 #include "core/fpdfapi/fpdf_font/include/cpdf_font.h" 9 #include "core/fpdfapi/fpdf_font/include/cpdf_font.h"
10 #include "core/fpdfapi/fpdf_page/include/cpdf_page.h" 10 #include "core/fpdfapi/fpdf_page/include/cpdf_page.h"
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after
160 m_pAnnotDict->SetFor("AP", pAPDict); 160 m_pAnnotDict->SetFor("AP", pAPDict);
161 } 161 }
162 162
163 // to avoid checkbox and radiobutton 163 // to avoid checkbox and radiobutton
164 CPDF_Object* pObject = pAPDict->GetObjectFor(m_sAPType); 164 CPDF_Object* pObject = pAPDict->GetObjectFor(m_sAPType);
165 if (ToDictionary(pObject)) 165 if (ToDictionary(pObject))
166 return; 166 return;
167 167
168 CPDF_Stream* pStream = pAPDict->GetStreamFor(m_sAPType); 168 CPDF_Stream* pStream = pAPDict->GetStreamFor(m_sAPType);
169 if (!pStream) { 169 if (!pStream) {
170 pStream = new CPDF_Stream(nullptr, 0, nullptr); 170 pStream = new CPDF_Stream;
171 int32_t objnum = m_pDocument->AddIndirectObject(pStream); 171 int32_t objnum = m_pDocument->AddIndirectObject(pStream);
172 pAPDict->SetReferenceFor(m_sAPType, m_pDocument, objnum); 172 pAPDict->SetReferenceFor(m_sAPType, m_pDocument, objnum);
173 } 173 }
174 174
175 CPDF_Dictionary* pStreamDict = pStream->GetDict(); 175 CPDF_Dictionary* pStreamDict = pStream->GetDict();
176 176
177 if (!pStreamDict) { 177 if (!pStreamDict) {
178 pStreamDict = new CPDF_Dictionary; 178 pStreamDict = new CPDF_Dictionary;
179 pStream->InitStream(nullptr, 0, pStreamDict); 179 pStream->InitStream(nullptr, 0, pStreamDict);
180 } 180 }
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
247 247
248 return pFontDict ? m_pDocument->LoadFont(pFontDict) : nullptr; 248 return pFontDict ? m_pDocument->LoadFont(pFontDict) : nullptr;
249 } 249 }
250 250
251 void CBA_FontMap::SetAPType(const CFX_ByteString& sAPType) { 251 void CBA_FontMap::SetAPType(const CFX_ByteString& sAPType) {
252 m_sAPType = sAPType; 252 m_sAPType = sAPType;
253 253
254 Reset(); 254 Reset();
255 Initialize(); 255 Initialize();
256 } 256 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698