summaryrefslogtreecommitdiff
path: root/xfa/fxfa/app
diff options
context:
space:
mode:
authordsinclair <dsinclair@chromium.org>2016-05-18 13:16:12 -0700
committerCommit bot <commit-bot@chromium.org>2016-05-18 13:16:12 -0700
commitcbfef5772c52fbd3378905a61fc9432da1515433 (patch)
treebe4c25e41d2467609612232a92e598ccd9baa7eb /xfa/fxfa/app
parent1763f62972a3ebf080f645899a8de79b00dbfb23 (diff)
downloadpdfium-cbfef5772c52fbd3378905a61fc9432da1515433.tar.xz
Cleanup XFA_HASHCODE usage.
This CL cleans up several uses of XFA_HASHCODE. The defines have been converted into an enum. For the SavePackage call the type is now used as the param instead of a string. The callers pass in the correct type instead of doing an internal conversion. The GetXFAObject accepting a string was removed as it was unused. The other variant was changed to accept the XFA_HashCode type instead of uint32_t. GetPackageData was removed as it is unused. Review-Url: https://codereview.chromium.org/1989313002
Diffstat (limited to 'xfa/fxfa/app')
-rw-r--r--xfa/fxfa/app/xfa_ffdoc.cpp29
1 files changed, 8 insertions, 21 deletions
diff --git a/xfa/fxfa/app/xfa_ffdoc.cpp b/xfa/fxfa/app/xfa_ffdoc.cpp
index 8621430d3f..f93881564d 100644
--- a/xfa/fxfa/app/xfa_ffdoc.cpp
+++ b/xfa/fxfa/app/xfa_ffdoc.cpp
@@ -351,36 +351,23 @@ CFX_DIBitmap* CXFA_FFDoc::GetPDFNamedImage(const CFX_WideStringC& wsName,
return pDibSource;
}
-CFDE_XMLElement* CXFA_FFDoc::GetPackageData(const CFX_WideStringC& wsPackage) {
- uint32_t packetHash = FX_HashCode_GetW(wsPackage, false);
- CXFA_Node* pNode = ToNode(m_pDocument->GetXFAObject(packetHash));
- if (!pNode) {
- return NULL;
- }
- CFDE_XMLNode* pXMLNode = pNode->GetXMLMappingNode();
- return (pXMLNode && pXMLNode->GetType() == FDE_XMLNODE_Element)
- ? static_cast<CFDE_XMLElement*>(pXMLNode)
- : NULL;
-}
-
-FX_BOOL CXFA_FFDoc::SavePackage(const CFX_WideStringC& wsPackage,
- IFX_FileWrite* pFile,
- CXFA_ChecksumContext* pCSContext) {
+bool CXFA_FFDoc::SavePackage(XFA_HashCode code,
+ IFX_FileWrite* pFile,
+ CXFA_ChecksumContext* pCSContext) {
std::unique_ptr<CXFA_DataExporter> pExport(
new CXFA_DataExporter(m_pDocument));
- uint32_t packetHash = FX_HashCode_GetW(wsPackage, false);
- CXFA_Node* pNode = packetHash == XFA_HASHCODE_Xfa
+ CXFA_Node* pNode = code == XFA_HASHCODE_Xfa
? m_pDocument->GetRoot()
- : ToNode(m_pDocument->GetXFAObject(packetHash));
+ : ToNode(m_pDocument->GetXFAObject(code));
if (!pNode)
- return pExport->Export(pFile);
+ return !!pExport->Export(pFile);
CFX_ByteString bsChecksum;
if (pCSContext)
bsChecksum = pCSContext->GetChecksum();
- return pExport->Export(pFile, pNode, 0,
- bsChecksum.GetLength() ? bsChecksum.c_str() : nullptr);
+ return !!pExport->Export(
+ pFile, pNode, 0, bsChecksum.GetLength() ? bsChecksum.c_str() : nullptr);
}
FX_BOOL CXFA_FFDoc::ImportData(IFX_FileRead* pStream, FX_BOOL bXDP) {