From b6853cfe4fd1ee089dfdd0cb09bbc4063532ef82 Mon Sep 17 00:00:00 2001 From: tsepez Date: Mon, 25 Apr 2016 11:23:43 -0700 Subject: Pass CFX_*StringCs to FX_HashCode_GETA and _GETW hash functions. Too many calls were of the form fn(x.c_str(), x.GetLength()) which is an anti-pattern given the StringC classes which tie these together. There are a few places where explicit CFX_*StringCs are constructed, but this can be avoided by changing the args to these functions in the same manner. Removed String_ from name of functions since it added little value. Also removed default argument. Review URL: https://codereview.chromium.org/1919563002 --- xfa/fxfa/parser/xfa_script_resolveprocessor.cpp | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) (limited to 'xfa/fxfa/parser/xfa_script_resolveprocessor.cpp') diff --git a/xfa/fxfa/parser/xfa_script_resolveprocessor.cpp b/xfa/fxfa/parser/xfa_script_resolveprocessor.cpp index ecf384b51c..fcd24bf949 100644 --- a/xfa/fxfa/parser/xfa_script_resolveprocessor.cpp +++ b/xfa/fxfa/parser/xfa_script_resolveprocessor.cpp @@ -122,8 +122,8 @@ int32_t CXFA_ResolveProcessor::XFA_ResolveNodes_Dollar( if (rnd.m_nLevel > 0) { return -1; } - uint32_t dwNameHash = - FX_HashCode_String_GetW(wsName.c_str() + 1, iNameLen - 1); + uint32_t dwNameHash = 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 { @@ -151,8 +151,7 @@ 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_String_GetW(rndFind.m_wsName.c_str(), - rndFind.m_wsName.GetLength()); + rndFind.m_uHashName = 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; @@ -178,8 +177,7 @@ 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_String_GetW(rndFind.m_wsName.c_str(), - rndFind.m_wsName.GetLength()); + rndFind.m_uHashName = FX_HashCode_GetW(rndFind.m_wsName.AsStringC(), false); rndFind.m_wsCondition = wsCondition; rndFind.m_CurNode = curNode; XFA_ResolveNodes_Normal(rndFind); @@ -617,7 +615,7 @@ int32_t CXFA_ResolveProcessor::XFA_ResolveNodes_GetFilter( wsCondition.ReleaseBuffer(nConditionCount); wsCondition.TrimLeft(); wsCondition.TrimRight(); - rnd.m_uHashName = FX_HashCode_String_GetW(wsName.c_str(), wsName.GetLength()); + rnd.m_uHashName = FX_HashCode_GetW(wsName.AsStringC(), false); return nStart; } void CXFA_ResolveProcessor::XFA_ResolveNode_ConditionArray( -- cgit v1.2.3