| OLD | NEW |
| 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 Loading... |
| 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 Loading... |
| 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 } |
| OLD | NEW |