summaryrefslogtreecommitdiff
path: root/xfa/fxfa/parser
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/parser
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/parser')
-rw-r--r--xfa/fxfa/parser/xfa_document.h3
-rw-r--r--xfa/fxfa/parser/xfa_document_datadescription_imp.cpp2
-rw-r--r--xfa/fxfa/parser/xfa_document_imp.cpp7
-rw-r--r--xfa/fxfa/parser/xfa_document_serialize.cpp2
-rw-r--r--xfa/fxfa/parser/xfa_script_imp.cpp3
-rw-r--r--xfa/fxfa/parser/xfa_script_resolveprocessor.cpp17
-rw-r--r--xfa/fxfa/parser/xfa_script_resolveprocessor.h4
7 files changed, 19 insertions, 19 deletions
diff --git a/xfa/fxfa/parser/xfa_document.h b/xfa/fxfa/parser/xfa_document.h
index 86b2a6f62c..5279d3a995 100644
--- a/xfa/fxfa/parser/xfa_document.h
+++ b/xfa/fxfa/parser/xfa_document.h
@@ -65,8 +65,7 @@ class CXFA_Document {
CXFA_DocumentParser* GetParser() const { return m_pParser; }
CXFA_FFNotify* GetNotify() const;
void SetRoot(CXFA_Node* pNewRoot);
- CXFA_Object* GetXFAObject(const CFX_WideStringC& wsNodeName);
- CXFA_Object* GetXFAObject(uint32_t wsNodeNameHash);
+ CXFA_Object* GetXFAObject(XFA_HashCode wsNodeNameHash);
void AddPurgeNode(CXFA_Node* pNode);
FX_BOOL RemovePurgeNode(CXFA_Node* pNode);
void PurgeNodes();
diff --git a/xfa/fxfa/parser/xfa_document_datadescription_imp.cpp b/xfa/fxfa/parser/xfa_document_datadescription_imp.cpp
index 31cf4119ad..27d89b4146 100644
--- a/xfa/fxfa/parser/xfa_document_datadescription_imp.cpp
+++ b/xfa/fxfa/parser/xfa_document_datadescription_imp.cpp
@@ -13,8 +13,6 @@
#include "xfa/fxfa/parser/xfa_script.h"
#include "xfa/fxfa/parser/xfa_utils.h"
-#define XFA_HASHCODE_Group 0xf7f75fcd
-
class CXFA_TraverseStrategy_DDGroup {
public:
static inline CXFA_Node* GetFirstChild(CXFA_Node* pDDGroupNode) {
diff --git a/xfa/fxfa/parser/xfa_document_imp.cpp b/xfa/fxfa/parser/xfa_document_imp.cpp
index 0421683e07..c6f9295dcc 100644
--- a/xfa/fxfa/parser/xfa_document_imp.cpp
+++ b/xfa/fxfa/parser/xfa_document_imp.cpp
@@ -77,13 +77,12 @@ void CXFA_Document::SetRoot(CXFA_Node* pNewRoot) {
m_pRootNode = pNewRoot;
RemovePurgeNode(pNewRoot);
}
+
CXFA_FFNotify* CXFA_Document::GetNotify() const {
return m_pParser->GetNotify();
}
-CXFA_Object* CXFA_Document::GetXFAObject(const CFX_WideStringC& wsNodeName) {
- return GetXFAObject(FX_HashCode_GetW(wsNodeName, false));
-}
-CXFA_Object* CXFA_Document::GetXFAObject(uint32_t dwNodeNameHash) {
+
+CXFA_Object* CXFA_Document::GetXFAObject(XFA_HashCode dwNodeNameHash) {
switch (dwNodeNameHash) {
case XFA_HASHCODE_Data: {
CXFA_Node* pDatasetsNode = ToNode(GetXFAObject(XFA_HASHCODE_Datasets));
diff --git a/xfa/fxfa/parser/xfa_document_serialize.cpp b/xfa/fxfa/parser/xfa_document_serialize.cpp
index ef85d0e266..96c70cb3fc 100644
--- a/xfa/fxfa/parser/xfa_document_serialize.cpp
+++ b/xfa/fxfa/parser/xfa_document_serialize.cpp
@@ -443,7 +443,7 @@ void XFA_DataExporter_RegenerateFormFile(CXFA_Node* pNode,
pStream->WriteString(pURI, FXSYS_wcslen(pURI));
CFX_WideString wsVersionNumber;
XFA_DataExporter_RecognizeXFAVersionNumber(
- ToNode(pNode->GetDocument()->GetXFAObject(XFA_XDPPACKET_Template)),
+ ToNode(pNode->GetDocument()->GetXFAObject(XFA_HASHCODE_Template)),
wsVersionNumber);
if (wsVersionNumber.IsEmpty()) {
wsVersionNumber = FX_WSTRC(L"2.8");
diff --git a/xfa/fxfa/parser/xfa_script_imp.cpp b/xfa/fxfa/parser/xfa_script_imp.cpp
index 893c5b79ea..b218121165 100644
--- a/xfa/fxfa/parser/xfa_script_imp.cpp
+++ b/xfa/fxfa/parser/xfa_script_imp.cpp
@@ -174,7 +174,8 @@ void CXFA_ScriptContext::GlobalPropertyGetter(FXJSE_HOBJECT hObject,
XFA_FM2JS_GlobalPropertyGetter(lpScriptContext->m_hFM2JSContext, hValue);
return;
}
- uint32_t uHashCode = FX_HashCode_GetW(wsPropName.AsStringC(), false);
+ XFA_HashCode uHashCode = static_cast<XFA_HashCode>(
+ FX_HashCode_GetW(wsPropName.AsStringC(), false));
if (uHashCode != XFA_HASHCODE_Layout) {
CXFA_Object* pObject =
lpScriptContext->GetDocument()->GetXFAObject(uHashCode);
diff --git a/xfa/fxfa/parser/xfa_script_resolveprocessor.cpp b/xfa/fxfa/parser/xfa_script_resolveprocessor.cpp
index fa21a50b3e..138ac66165 100644
--- a/xfa/fxfa/parser/xfa_script_resolveprocessor.cpp
+++ b/xfa/fxfa/parser/xfa_script_resolveprocessor.cpp
@@ -49,7 +49,7 @@ int32_t CXFA_ResolveProcessor::XFA_ResolveNodes(CXFA_ResolveNodesData& rnd) {
return XFA_ResolveNodes_NumberSign(rnd);
case '*':
return XFA_ResolveNodes_Asterisk(rnd);
- // TODO(dsinclair@chromium.org): We could probably remove this.
+ // TODO(dsinclair): We could probably remove this.
case '.':
return XFA_ResolveNodes_AnyChild(rnd);
default:
@@ -119,8 +119,8 @@ int32_t CXFA_ResolveProcessor::XFA_ResolveNodes_Dollar(
if (rnd.m_nLevel > 0) {
return -1;
}
- uint32_t dwNameHash = FX_HashCode_GetW(
- CFX_WideStringC(wsName.c_str() + 1, iNameLen - 1), false);
+ XFA_HashCode dwNameHash = static_cast<XFA_HashCode>(FX_HashCode_GetW(
+ CFX_WideStringC(wsName.c_str() + 1, iNameLen - 1), false));
if (dwNameHash == XFA_HASHCODE_Xfa) {
nodes.Add(rnd.m_pSC->GetDocument()->GetRoot());
} else {
@@ -148,7 +148,8 @@ int32_t CXFA_ResolveProcessor::XFA_ResolveNodes_Excalmatory(
rndFind.m_pSC = rnd.m_pSC;
rndFind.m_CurNode = datasets;
rndFind.m_wsName = rnd.m_wsName.Right(rnd.m_wsName.GetLength() - 1);
- rndFind.m_uHashName = FX_HashCode_GetW(rndFind.m_wsName.AsStringC(), false);
+ rndFind.m_uHashName = static_cast<XFA_HashCode>(
+ FX_HashCode_GetW(rndFind.m_wsName.AsStringC(), false));
rndFind.m_nLevel = rnd.m_nLevel + 1;
rndFind.m_dwStyles = XFA_RESOLVENODE_Children;
rndFind.m_wsCondition = rnd.m_wsCondition;
@@ -174,7 +175,8 @@ int32_t CXFA_ResolveProcessor::XFA_ResolveNodes_NumberSign(
rndFind.m_dwStyles |= XFA_RESOLVENODE_TagName;
rndFind.m_dwStyles &= ~XFA_RESOLVENODE_Attributes;
rndFind.m_wsName = wsName;
- rndFind.m_uHashName = FX_HashCode_GetW(rndFind.m_wsName.AsStringC(), false);
+ rndFind.m_uHashName = static_cast<XFA_HashCode>(
+ FX_HashCode_GetW(rndFind.m_wsName.AsStringC(), false));
rndFind.m_wsCondition = wsCondition;
rndFind.m_CurNode = curNode;
XFA_ResolveNodes_Normal(rndFind);
@@ -215,7 +217,7 @@ int32_t CXFA_ResolveProcessor::XFA_ResolveNodes_Normal(
int32_t nNum = nodes.GetSize();
uint32_t dwStyles = rnd.m_dwStyles;
CFX_WideString& wsName = rnd.m_wsName;
- uint32_t uNameHash = rnd.m_uHashName;
+ XFA_HashCode uNameHash = rnd.m_uHashName;
CFX_WideString& wsCondition = rnd.m_wsCondition;
CXFA_ResolveNodesData rndFind;
rndFind.m_wsName = rnd.m_wsName;
@@ -612,7 +614,8 @@ int32_t CXFA_ResolveProcessor::XFA_ResolveNodes_GetFilter(
wsCondition.ReleaseBuffer(nConditionCount);
wsCondition.TrimLeft();
wsCondition.TrimRight();
- rnd.m_uHashName = FX_HashCode_GetW(wsName.AsStringC(), false);
+ rnd.m_uHashName =
+ static_cast<XFA_HashCode>(FX_HashCode_GetW(wsName.AsStringC(), false));
return nStart;
}
void CXFA_ResolveProcessor::XFA_ResolveNode_ConditionArray(
diff --git a/xfa/fxfa/parser/xfa_script_resolveprocessor.h b/xfa/fxfa/parser/xfa_script_resolveprocessor.h
index b63cced721..9789ffd7b8 100644
--- a/xfa/fxfa/parser/xfa_script_resolveprocessor.h
+++ b/xfa/fxfa/parser/xfa_script_resolveprocessor.h
@@ -19,7 +19,7 @@ class CXFA_ResolveNodesData {
: m_pSC(pSC),
m_CurNode(NULL),
m_wsName(),
- m_uHashName(0),
+ m_uHashName(XFA_HASHCODE_None),
m_wsCondition(),
m_nLevel(0),
m_Nodes(),
@@ -30,7 +30,7 @@ class CXFA_ResolveNodesData {
CXFA_ScriptContext* m_pSC;
CXFA_Object* m_CurNode;
CFX_WideString m_wsName;
- uint32_t m_uHashName;
+ XFA_HashCode m_uHashName;
CFX_WideString m_wsCondition;
int32_t m_nLevel;
CXFA_ObjArray m_Nodes;