| 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/parser/xfa_document_serialize.h" | 7 #include "xfa/fxfa/parser/xfa_document_serialize.h" |
| 8 | 8 |
| 9 #include "xfa/fde/xml/fde_xml_imp.h" | 9 #include "xfa/fde/xml/fde_xml_imp.h" |
| 10 #include "xfa/fgas/crt/fgas_codepage.h" | 10 #include "xfa/fgas/crt/fgas_codepage.h" |
| (...skipping 13 matching lines...) Expand all Loading... |
| 24 FX_BOOL CXFA_DataImporter::ImportData(IFX_FileRead* pDataDocument) { | 24 FX_BOOL CXFA_DataImporter::ImportData(IFX_FileRead* pDataDocument) { |
| 25 IXFA_Parser* pDataDocumentParser = IXFA_Parser::Create(m_pDocument); | 25 IXFA_Parser* pDataDocumentParser = IXFA_Parser::Create(m_pDocument); |
| 26 if (!pDataDocumentParser) { | 26 if (!pDataDocumentParser) { |
| 27 return FALSE; | 27 return FALSE; |
| 28 } | 28 } |
| 29 if (pDataDocumentParser->StartParse(pDataDocument, XFA_XDPPACKET_Datasets) != | 29 if (pDataDocumentParser->StartParse(pDataDocument, XFA_XDPPACKET_Datasets) != |
| 30 XFA_PARSESTATUS_Ready) { | 30 XFA_PARSESTATUS_Ready) { |
| 31 pDataDocumentParser->Release(); | 31 pDataDocumentParser->Release(); |
| 32 return FALSE; | 32 return FALSE; |
| 33 } | 33 } |
| 34 if (pDataDocumentParser->DoParse(NULL) < XFA_PARSESTATUS_Done) { | 34 if (pDataDocumentParser->DoParse(nullptr) < XFA_PARSESTATUS_Done) { |
| 35 pDataDocumentParser->Release(); | 35 pDataDocumentParser->Release(); |
| 36 return FALSE; | 36 return FALSE; |
| 37 } | 37 } |
| 38 CXFA_Node* pImportDataRoot = pDataDocumentParser->GetRootNode(); | 38 CXFA_Node* pImportDataRoot = pDataDocumentParser->GetRootNode(); |
| 39 if (!pImportDataRoot) { | 39 if (!pImportDataRoot) { |
| 40 pDataDocumentParser->Release(); | 40 pDataDocumentParser->Release(); |
| 41 return FALSE; | 41 return FALSE; |
| 42 } | 42 } |
| 43 CXFA_Node* pDataModel = | 43 CXFA_Node* pDataModel = |
| 44 ToNode(m_pDocument->GetXFAObject(XFA_HASHCODE_Datasets)); | 44 ToNode(m_pDocument->GetXFAObject(XFA_HASHCODE_Datasets)); |
| (...skipping 425 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 470 CXFA_Node* pNode, | 470 CXFA_Node* pNode, |
| 471 uint32_t dwFlag, | 471 uint32_t dwFlag, |
| 472 const FX_CHAR* pChecksum) { | 472 const FX_CHAR* pChecksum) { |
| 473 if (!pWrite) { | 473 if (!pWrite) { |
| 474 ASSERT(false); | 474 ASSERT(false); |
| 475 return FALSE; | 475 return FALSE; |
| 476 } | 476 } |
| 477 IFX_Stream* pStream = IFX_Stream::CreateStream( | 477 IFX_Stream* pStream = IFX_Stream::CreateStream( |
| 478 pWrite, | 478 pWrite, |
| 479 FX_STREAMACCESS_Text | FX_STREAMACCESS_Write | FX_STREAMACCESS_Append); | 479 FX_STREAMACCESS_Text | FX_STREAMACCESS_Write | FX_STREAMACCESS_Append); |
| 480 if (pStream == NULL) { | 480 if (!pStream) { |
| 481 return FALSE; | 481 return FALSE; |
| 482 } | 482 } |
| 483 pStream->SetCodePage(FX_CODEPAGE_UTF8); | 483 pStream->SetCodePage(FX_CODEPAGE_UTF8); |
| 484 FX_BOOL bRet = Export(pStream, pNode, dwFlag, pChecksum); | 484 FX_BOOL bRet = Export(pStream, pNode, dwFlag, pChecksum); |
| 485 pStream->Release(); | 485 pStream->Release(); |
| 486 return bRet; | 486 return bRet; |
| 487 } | 487 } |
| 488 FX_BOOL CXFA_DataExporter::Export(IFX_Stream* pStream, | 488 FX_BOOL CXFA_DataExporter::Export(IFX_Stream* pStream, |
| 489 CXFA_Node* pNode, | 489 CXFA_Node* pNode, |
| 490 uint32_t dwFlag, | 490 uint32_t dwFlag, |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 572 pXMLElement->RemoveAttribute(L"xfa:dataNode"); | 572 pXMLElement->RemoveAttribute(L"xfa:dataNode"); |
| 573 } | 573 } |
| 574 } else { | 574 } else { |
| 575 CFDE_XMLNode* pXMLNode = pDataNode->GetXMLMappingNode(); | 575 CFDE_XMLNode* pXMLNode = pDataNode->GetXMLMappingNode(); |
| 576 ASSERT(pXMLNode->GetType() == FDE_XMLNODE_Element); | 576 ASSERT(pXMLNode->GetType() == FDE_XMLNODE_Element); |
| 577 static_cast<CFDE_XMLElement*>(pXMLNode)->SetString(L"xfa:dataNode", | 577 static_cast<CFDE_XMLElement*>(pXMLNode)->SetString(L"xfa:dataNode", |
| 578 L"dataGroup"); | 578 L"dataGroup"); |
| 579 } | 579 } |
| 580 } | 580 } |
| 581 } | 581 } |
| OLD | NEW |