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

Side by Side Diff: xfa/fxfa/app/xfa_ffdoc.cpp

Issue 2411703003: Get rid of CFX_ArrayTemplate<CPDF_Object*> (Closed)
Patch Set: nit 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
« no previous file with comments | « xfa/fxfa/app/xfa_ffapp.cpp ('k') | xfa/fxfa/xfa_ffapp.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "xfa/fxfa/xfa_ffdoc.h" 7 #include "xfa/fxfa/xfa_ffdoc.h"
8 8
9 #include <algorithm> 9 #include <algorithm>
10 10
(...skipping 293 matching lines...) Expand 10 before | Expand all | Expand 10 after
304 return FALSE; 304 return FALSE;
305 305
306 CPDF_Dictionary* pAcroForm = pRoot->GetDictFor("AcroForm"); 306 CPDF_Dictionary* pAcroForm = pRoot->GetDictFor("AcroForm");
307 if (!pAcroForm) 307 if (!pAcroForm)
308 return FALSE; 308 return FALSE;
309 309
310 CPDF_Object* pElementXFA = pAcroForm->GetDirectObjectFor("XFA"); 310 CPDF_Object* pElementXFA = pAcroForm->GetDirectObjectFor("XFA");
311 if (!pElementXFA) 311 if (!pElementXFA)
312 return FALSE; 312 return FALSE;
313 313
314 CFX_ArrayTemplate<CPDF_Stream*> xfaStreams; 314 std::vector<CPDF_Stream*> xfaStreams;
315 if (pElementXFA->IsArray()) { 315 if (pElementXFA->IsArray()) {
316 CPDF_Array* pXFAArray = (CPDF_Array*)pElementXFA; 316 CPDF_Array* pXFAArray = (CPDF_Array*)pElementXFA;
317 for (size_t i = 0; i < pXFAArray->GetCount() / 2; i++) { 317 for (size_t i = 0; i < pXFAArray->GetCount() / 2; i++) {
318 if (CPDF_Stream* pStream = pXFAArray->GetStreamAt(i * 2 + 1)) 318 if (CPDF_Stream* pStream = pXFAArray->GetStreamAt(i * 2 + 1))
319 xfaStreams.Add(pStream); 319 xfaStreams.push_back(pStream);
320 } 320 }
321 } else if (pElementXFA->IsStream()) { 321 } else if (pElementXFA->IsStream()) {
322 xfaStreams.Add((CPDF_Stream*)pElementXFA); 322 xfaStreams.push_back((CPDF_Stream*)pElementXFA);
323 } 323 }
324 if (xfaStreams.GetSize() < 1) { 324 if (xfaStreams.empty())
325 return FALSE; 325 return FALSE;
326 } 326
327 IFX_FileRead* pFileRead = new CXFA_FileRead(xfaStreams); 327 IFX_FileRead* pFileRead = new CXFA_FileRead(xfaStreams);
328 m_pPDFDoc = pPDFDoc; 328 m_pPDFDoc = pPDFDoc;
329 if (m_pStream) { 329 if (m_pStream) {
330 m_pStream->Release(); 330 m_pStream->Release();
331 m_pStream = nullptr; 331 m_pStream = nullptr;
332 } 332 }
333 m_pStream = pFileRead; 333 m_pStream = pFileRead;
334 m_bOwnStream = TRUE; 334 m_bOwnStream = TRUE;
335 return TRUE; 335 return TRUE;
336 } 336 }
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
443 443
444 return !!pExport->Export( 444 return !!pExport->Export(
445 pFile, pNode, 0, bsChecksum.GetLength() ? bsChecksum.c_str() : nullptr); 445 pFile, pNode, 0, bsChecksum.GetLength() ? bsChecksum.c_str() : nullptr);
446 } 446 }
447 447
448 FX_BOOL CXFA_FFDoc::ImportData(IFX_FileRead* pStream, FX_BOOL bXDP) { 448 FX_BOOL CXFA_FFDoc::ImportData(IFX_FileRead* pStream, FX_BOOL bXDP) {
449 std::unique_ptr<CXFA_DataImporter> importer( 449 std::unique_ptr<CXFA_DataImporter> importer(
450 new CXFA_DataImporter(m_pDocumentParser->GetDocument())); 450 new CXFA_DataImporter(m_pDocumentParser->GetDocument()));
451 return importer->ImportData(pStream); 451 return importer->ImportData(pStream);
452 } 452 }
OLDNEW
« no previous file with comments | « xfa/fxfa/app/xfa_ffapp.cpp ('k') | xfa/fxfa/xfa_ffapp.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698