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/app/xfa_ffdoc.h" | 7 #include "xfa/fxfa/app/xfa_ffdoc.h" |
8 | 8 |
9 #include "core/fpdfapi/fpdf_parser/include/cpdf_array.h" | 9 #include "core/fpdfapi/fpdf_parser/include/cpdf_array.h" |
10 #include "core/fpdfapi/fpdf_parser/include/cpdf_document.h" | 10 #include "core/fpdfapi/fpdf_parser/include/cpdf_document.h" |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
47 uint8_t*& pByteBuffer, | 47 uint8_t*& pByteBuffer, |
48 int32_t& iBufferSize) { | 48 int32_t& iBufferSize) { |
49 CFDE_XMLElement* pDocumentElement = NULL; | 49 CFDE_XMLElement* pDocumentElement = NULL; |
50 for (CFDE_XMLNode* pXMLNode = | 50 for (CFDE_XMLNode* pXMLNode = |
51 pPDFElement->GetNodeItem(CFDE_XMLNode::FirstChild); | 51 pPDFElement->GetNodeItem(CFDE_XMLNode::FirstChild); |
52 pXMLNode; pXMLNode = pXMLNode->GetNodeItem(CFDE_XMLNode::NextSibling)) { | 52 pXMLNode; pXMLNode = pXMLNode->GetNodeItem(CFDE_XMLNode::NextSibling)) { |
53 if (pXMLNode->GetType() == FDE_XMLNODE_Element) { | 53 if (pXMLNode->GetType() == FDE_XMLNODE_Element) { |
54 CFX_WideString wsTagName; | 54 CFX_WideString wsTagName; |
55 CFDE_XMLElement* pXMLElement = static_cast<CFDE_XMLElement*>(pXMLNode); | 55 CFDE_XMLElement* pXMLElement = static_cast<CFDE_XMLElement*>(pXMLNode); |
56 pXMLElement->GetTagName(wsTagName); | 56 pXMLElement->GetTagName(wsTagName); |
57 if (wsTagName.Equal(FX_WSTRC(L"document"))) { | 57 if (wsTagName == FX_WSTRC(L"document")) { |
58 pDocumentElement = pXMLElement; | 58 pDocumentElement = pXMLElement; |
59 break; | 59 break; |
60 } | 60 } |
61 } | 61 } |
62 } | 62 } |
63 if (!pDocumentElement) { | 63 if (!pDocumentElement) { |
64 return FALSE; | 64 return FALSE; |
65 } | 65 } |
66 CFDE_XMLElement* pChunkElement = NULL; | 66 CFDE_XMLElement* pChunkElement = NULL; |
67 for (CFDE_XMLNode* pXMLNode = | 67 for (CFDE_XMLNode* pXMLNode = |
68 pDocumentElement->GetNodeItem(CFDE_XMLNode::FirstChild); | 68 pDocumentElement->GetNodeItem(CFDE_XMLNode::FirstChild); |
69 pXMLNode; pXMLNode = pXMLNode->GetNodeItem(CFDE_XMLNode::NextSibling)) { | 69 pXMLNode; pXMLNode = pXMLNode->GetNodeItem(CFDE_XMLNode::NextSibling)) { |
70 if (pXMLNode->GetType() == FDE_XMLNODE_Element) { | 70 if (pXMLNode->GetType() == FDE_XMLNODE_Element) { |
71 CFX_WideString wsTagName; | 71 CFX_WideString wsTagName; |
72 CFDE_XMLElement* pXMLElement = static_cast<CFDE_XMLElement*>(pXMLNode); | 72 CFDE_XMLElement* pXMLElement = static_cast<CFDE_XMLElement*>(pXMLNode); |
73 pXMLElement->GetTagName(wsTagName); | 73 pXMLElement->GetTagName(wsTagName); |
74 if (wsTagName.Equal(FX_WSTRC(L"chunk"))) { | 74 if (wsTagName == FX_WSTRC(L"chunk")) { |
75 pChunkElement = pXMLElement; | 75 pChunkElement = pXMLElement; |
76 break; | 76 break; |
77 } | 77 } |
78 } | 78 } |
79 } | 79 } |
80 if (!pChunkElement) { | 80 if (!pChunkElement) { |
81 return FALSE; | 81 return FALSE; |
82 } | 82 } |
83 CFX_WideString wsPDFContent; | 83 CFX_WideString wsPDFContent; |
84 pChunkElement->GetTextData(wsPDFContent); | 84 pChunkElement->GetTextData(wsPDFContent); |
(...skipping 338 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
423 } | 423 } |
424 FX_BOOL CXFA_FFDoc::ImportData(IFX_FileRead* pStream, FX_BOOL bXDP) { | 424 FX_BOOL CXFA_FFDoc::ImportData(IFX_FileRead* pStream, FX_BOOL bXDP) { |
425 FX_BOOL bRet = FALSE; | 425 FX_BOOL bRet = FALSE; |
426 IXFA_PacketImport* pImport = IXFA_PacketImport::Create(m_pDocument); | 426 IXFA_PacketImport* pImport = IXFA_PacketImport::Create(m_pDocument); |
427 if (pImport) { | 427 if (pImport) { |
428 bRet = pImport->ImportData(pStream); | 428 bRet = pImport->ImportData(pStream); |
429 pImport->Release(); | 429 pImport->Release(); |
430 } | 430 } |
431 return bRet; | 431 return bRet; |
432 } | 432 } |
OLD | NEW |