diff options
author | tsepez <tsepez@chromium.org> | 2016-04-25 11:23:43 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-04-25 11:23:43 -0700 |
commit | b6853cfe4fd1ee089dfdd0cb09bbc4063532ef82 (patch) | |
tree | 1404031e845c8b4b09d5a68fd81f09a7d2865d59 /xfa/fxfa | |
parent | 2a8a20cde4c8e2294f6868bb097fe450960a709f (diff) | |
download | pdfium-b6853cfe4fd1ee089dfdd0cb09bbc4063532ef82.tar.xz |
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
Diffstat (limited to 'xfa/fxfa')
-rw-r--r-- | xfa/fxfa/app/xfa_ffbarcode.cpp | 12 | ||||
-rw-r--r-- | xfa/fxfa/app/xfa_ffdoc.cpp | 9 | ||||
-rw-r--r-- | xfa/fxfa/app/xfa_ffdocview.cpp | 6 | ||||
-rw-r--r-- | xfa/fxfa/app/xfa_fontmgr.cpp | 25 | ||||
-rw-r--r-- | xfa/fxfa/app/xfa_textlayout.cpp | 37 | ||||
-rw-r--r-- | xfa/fxfa/app/xfa_textlayout.h | 2 | ||||
-rw-r--r-- | xfa/fxfa/fm2js/xfa_fm2jscontext.cpp | 16 | ||||
-rw-r--r-- | xfa/fxfa/fm2js/xfa_lexer.cpp | 19 | ||||
-rw-r--r-- | xfa/fxfa/fm2js/xfa_simpleexpression.cpp | 6 | ||||
-rw-r--r-- | xfa/fxfa/parser/cxfa_widgetdata.cpp | 3 | ||||
-rw-r--r-- | xfa/fxfa/parser/xfa_basic_imp.cpp | 71 | ||||
-rw-r--r-- | xfa/fxfa/parser/xfa_document_datamerger_imp.cpp | 70 | ||||
-rw-r--r-- | xfa/fxfa/parser/xfa_document_imp.cpp | 10 | ||||
-rw-r--r-- | xfa/fxfa/parser/xfa_object_imp.cpp | 53 | ||||
-rw-r--r-- | xfa/fxfa/parser/xfa_script_imp.cpp | 3 | ||||
-rw-r--r-- | xfa/fxfa/parser/xfa_script_nodehelper.cpp | 2 | ||||
-rw-r--r-- | xfa/fxfa/parser/xfa_script_resolveprocessor.cpp | 12 | ||||
-rw-r--r-- | xfa/fxfa/parser/xfa_utils_imp.cpp | 3 |
18 files changed, 151 insertions, 208 deletions
diff --git a/xfa/fxfa/app/xfa_ffbarcode.cpp b/xfa/fxfa/app/xfa_ffbarcode.cpp index 567882d546..b4608a349e 100644 --- a/xfa/fxfa/app/xfa_ffbarcode.cpp +++ b/xfa/fxfa/app/xfa_ffbarcode.cpp @@ -94,12 +94,12 @@ const int32_t g_iXFABarcodeTypeCount = XFA_LPCBARCODETYPEENUMINFO XFA_GetBarcodeTypeByName( const CFX_WideStringC& wsName) { - int32_t iLength = wsName.GetLength(); - if (iLength == 0) { - return NULL; - } - uint32_t uHash = FX_HashCode_String_GetW(wsName.c_str(), iLength, TRUE); - int32_t iStart = 0, iEnd = g_iXFABarcodeTypeCount - 1; + if (wsName.IsEmpty()) + return nullptr; + + uint32_t uHash = FX_HashCode_GetW(wsName, true); + int32_t iStart = 0; + int32_t iEnd = g_iXFABarcodeTypeCount - 1; do { int32_t iMid = (iStart + iEnd) / 2; XFA_LPCBARCODETYPEENUMINFO pInfo = g_XFABarCodeTypeEnumData + iMid; diff --git a/xfa/fxfa/app/xfa_ffdoc.cpp b/xfa/fxfa/app/xfa_ffdoc.cpp index 1fecee7547..4b0f67bb6a 100644 --- a/xfa/fxfa/app/xfa_ffdoc.cpp +++ b/xfa/fxfa/app/xfa_ffdoc.cpp @@ -326,8 +326,7 @@ CFX_DIBitmap* CXFA_FFDoc::GetPDFNamedImage(const CFX_WideStringC& wsName, if (!m_pPDFDoc) return nullptr; - uint32_t dwHash = - FX_HashCode_String_GetW(wsName.c_str(), wsName.GetLength(), FALSE); + uint32_t dwHash = FX_HashCode_GetW(wsName, false); FX_IMAGEDIB_AND_DPI* imageDIBDpi = nullptr; if (m_mapNamedImages.Lookup((void*)(uintptr_t)dwHash, (void*&)imageDIBDpi)) { iImageXDpi = imageDIBDpi->iImageXDpi; @@ -384,8 +383,7 @@ CFX_DIBitmap* CXFA_FFDoc::GetPDFNamedImage(const CFX_WideStringC& wsName, } CFDE_XMLElement* CXFA_FFDoc::GetPackageData(const CFX_WideStringC& wsPackage) { - uint32_t packetHash = - FX_HashCode_String_GetW(wsPackage.c_str(), wsPackage.GetLength()); + uint32_t packetHash = FX_HashCode_GetW(wsPackage, false); CXFA_Node* pNode = ToNode(m_pDocument->GetXFAObject(packetHash)); if (!pNode) { return NULL; @@ -399,8 +397,7 @@ FX_BOOL CXFA_FFDoc::SavePackage(const CFX_WideStringC& wsPackage, IFX_FileWrite* pFile, CXFA_ChecksumContext* pCSContext) { CXFA_DataExporter* pExport = new CXFA_DataExporter(m_pDocument); - uint32_t packetHash = - FX_HashCode_String_GetW(wsPackage.c_str(), wsPackage.GetLength()); + uint32_t packetHash = FX_HashCode_GetW(wsPackage, false); CXFA_Node* pNode = NULL; if (packetHash == XFA_HASHCODE_Xfa) { pNode = m_pDocument->GetRoot(); diff --git a/xfa/fxfa/app/xfa_ffdocview.cpp b/xfa/fxfa/app/xfa_ffdocview.cpp index 986e265a45..7a858748b7 100644 --- a/xfa/fxfa/app/xfa_ffdocview.cpp +++ b/xfa/fxfa/app/xfa_ffdocview.cpp @@ -779,9 +779,9 @@ void CXFA_FFDocView::RunBindItems() { wsLabelRef.IsEmpty() || wsLabelRef == FX_WSTRC(L"$"); const bool bValueUseContent = wsValueRef.IsEmpty() || wsValueRef == FX_WSTRC(L"$"); - CFX_WideString wsValue, wsLabel; - uint32_t uValueHash = - FX_HashCode_String_GetW(wsValueRef.c_str(), wsValueRef.GetLength()); + CFX_WideString wsValue; + CFX_WideString wsLabel; + uint32_t uValueHash = FX_HashCode_GetW(wsValueRef, false); for (int32_t i = 0; i < iCount; i++) { CXFA_Object* refObj = rs.nodes[i]; if (!refObj->IsNode()) { diff --git a/xfa/fxfa/app/xfa_fontmgr.cpp b/xfa/fxfa/app/xfa_fontmgr.cpp index 72952a7bd9..02b44be789 100644 --- a/xfa/fxfa/app/xfa_fontmgr.cpp +++ b/xfa/fxfa/app/xfa_fontmgr.cpp @@ -1694,12 +1694,7 @@ static const XFA_FONTINFO g_XFAFontsMap[] = { void XFA_LocalFontNameToEnglishName(const CFX_WideStringC& wsLocalName, CFX_WideString& wsEnglishName) { wsEnglishName = wsLocalName; -#if _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_ || \ - _FXM_PLATFORM_ == _FXM_PLATFORM_LINUX_ || \ - _FXM_PLATFORM_ == _FXM_PLATFORM_APPLE_ || \ - _FXM_PLATFORM_ == _FXM_PLATFORM_ANDROID_ - uint32_t dwLocalNameHash = FX_HashCode_String_GetW( - wsLocalName.c_str(), wsLocalName.GetLength(), TRUE); + uint32_t dwLocalNameHash = FX_HashCode_GetW(wsLocalName, true); int32_t iStart = 0; int32_t iEnd = sizeof(g_XFAFontsMap) / sizeof(XFA_FONTINFO) - 1; int32_t iMid = 0; @@ -1715,18 +1710,13 @@ void XFA_LocalFontNameToEnglishName(const CFX_WideStringC& wsLocalName, iEnd = iMid - 1; } } while (iEnd >= iStart); -#endif } const XFA_FONTINFO* XFA_GetFontINFOByFontName( const CFX_WideStringC& wsFontName) { -#if _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_ || \ - _FXM_PLATFORM_ == _FXM_PLATFORM_LINUX_ || \ - _FXM_PLATFORM_ == _FXM_PLATFORM_APPLE_ || \ - _FXM_PLATFORM_ == _FXM_PLATFORM_ANDROID_ CFX_WideString wsFontNameTemp = wsFontName; wsFontNameTemp.Remove(L' '); - uint32_t dwCurFontNameHash = FX_HashCode_String_GetW( - wsFontNameTemp.c_str(), wsFontNameTemp.GetLength(), TRUE); + uint32_t dwCurFontNameHash = + FX_HashCode_GetW(wsFontNameTemp.AsStringC(), true); int32_t iStart = 0; int32_t iEnd = sizeof(g_XFAFontsMap) / sizeof(XFA_FONTINFO) - 1; int32_t iMid = 0; @@ -1744,9 +1734,6 @@ const XFA_FONTINFO* XFA_GetFontINFOByFontName( } } while (iEnd >= iStart); return pFontInfo; -#else - return NULL; -#endif } CXFA_DefFontMgr::~CXFA_DefFontMgr() { @@ -1891,8 +1878,7 @@ IFX_Font* CXFA_PDFFontMgr::GetFont(const CFX_WideStringC& wsFontFamily, uint32_t dwFontStyles, CPDF_Font** pPDFFont, FX_BOOL bStrictMatch) { - uint32_t dwHashCode = - FX_HashCode_String_GetW(wsFontFamily.c_str(), wsFontFamily.GetLength()); + uint32_t dwHashCode = FX_HashCode_GetW(wsFontFamily, false); CFX_ByteString strKey; strKey.Format("%u%u", dwHashCode, dwFontStyles); auto it = m_FontMap.find(strKey); @@ -2018,8 +2004,7 @@ IFX_Font* CXFA_FontMgr::GetFont(CXFA_FFDoc* hDoc, const CFX_WideStringC& wsFontFamily, uint32_t dwFontStyles, uint16_t wCodePage) { - uint32_t dwHash = FX_HashCode_String_GetW(wsFontFamily.c_str(), - wsFontFamily.GetLength(), FALSE); + uint32_t dwHash = FX_HashCode_GetW(wsFontFamily, false); CFX_ByteString bsKey; bsKey.Format("%u%u%u", dwHash, dwFontStyles, wCodePage); auto it = m_FontMap.find(bsKey); diff --git a/xfa/fxfa/app/xfa_textlayout.cpp b/xfa/fxfa/app/xfa_textlayout.cpp index b2030814bc..b259a7f357 100644 --- a/xfa/fxfa/app/xfa_textlayout.cpp +++ b/xfa/fxfa/app/xfa_textlayout.cpp @@ -112,22 +112,22 @@ IFDE_CSSComputedStyle* CXFA_TextParser::CreateRootStyle( FDE_CSSLENGTH indent; indent.Set(FDE_CSSLENGTHUNIT_Point, para.GetTextIndent()); pParaStyle->SetTextIndent(indent); - FDE_CSSTEXTALIGN hAlgin = FDE_CSSTEXTALIGN_Left; + FDE_CSSTEXTALIGN hAlign = FDE_CSSTEXTALIGN_Left; switch (para.GetHorizontalAlign()) { case XFA_ATTRIBUTEENUM_Center: - hAlgin = FDE_CSSTEXTALIGN_Center; + hAlign = FDE_CSSTEXTALIGN_Center; break; case XFA_ATTRIBUTEENUM_Right: - hAlgin = FDE_CSSTEXTALIGN_Right; + hAlign = FDE_CSSTEXTALIGN_Right; break; case XFA_ATTRIBUTEENUM_Justify: - hAlgin = FDE_CSSTEXTALIGN_Justify; + hAlign = FDE_CSSTEXTALIGN_Justify; break; case XFA_ATTRIBUTEENUM_JustifyAll: - hAlgin = FDE_CSSTEXTALIGN_JustifyAll; + hAlign = FDE_CSSTEXTALIGN_JustifyAll; break; } - pParaStyle->SetTextAlign(hAlgin); + pParaStyle->SetTextAlign(hAlign); FDE_CSSRECT rtMarginWidth; rtMarginWidth.left.Set(FDE_CSSLENGTHUNIT_Point, para.GetMarginLeft()); rtMarginWidth.top.Set(FDE_CSSLENGTHUNIT_Point, para.GetSpaceAbove()); @@ -275,8 +275,7 @@ void CXFA_TextParser::ParseTagInfo(CFDE_XMLNode* pXMLNode, CFDE_XMLElement* pXMLElement = static_cast<CFDE_XMLElement*>(pXMLNode); pXMLElement->GetLocalTagName(wsName); tagProvider.SetTagNameObj(wsName); - uint32_t dwHashCode = - FX_HashCode_String_GetW(wsName.c_str(), wsName.GetLength(), TRUE); + uint32_t dwHashCode = FX_HashCode_GetW(wsName.AsStringC(), true); static const int32_t s_iCount = sizeof(s_XFATagName) / sizeof(uint32_t); CFX_DSPATemplate<uint32_t> lookup; tagProvider.m_bTagAviliable = @@ -292,7 +291,7 @@ void CXFA_TextParser::ParseTagInfo(CFDE_XMLNode* pXMLNode, } } -int32_t CXFA_TextParser::GetVAlgin(CXFA_TextProvider* pTextProvider) const { +int32_t CXFA_TextParser::GetVAlign(CXFA_TextProvider* pTextProvider) const { CXFA_Para para = pTextProvider->GetParaNode(); return para ? para.GetVerticalAlign() : XFA_ATTRIBUTEENUM_Top; } @@ -613,8 +612,7 @@ FX_BOOL CXFA_TextParser::GetTabstops( break; case XFA_TABSTOPSSTATUS_Location: if (ch == ' ') { - uint32_t dwHashCode = FX_HashCode_String_GetW( - wsAlign.c_str(), wsAlign.GetLength(), TRUE); + uint32_t dwHashCode = FX_HashCode_GetW(wsAlign.AsStringC(), true); CXFA_Measurement ms(CFX_WideStringC(pTabStops + iLast, iCur - iLast)); FX_FLOAT fPos = ms.ToUnit(XFA_UNIT_Pt); pTabstopContext->Append(dwHashCode, fPos); @@ -628,8 +626,7 @@ FX_BOOL CXFA_TextParser::GetTabstops( } } if (!wsAlign.IsEmpty()) { - uint32_t dwHashCode = - FX_HashCode_String_GetW(wsAlign.c_str(), wsAlign.GetLength(), TRUE); + uint32_t dwHashCode = FX_HashCode_GetW(wsAlign.AsStringC(), true); CXFA_Measurement ms(CFX_WideStringC(pTabStops + iLast, iCur - iLast)); FX_FLOAT fPos = ms.ToUnit(XFA_UNIT_Pt); pTabstopContext->Append(dwHashCode, fPos); @@ -934,7 +931,7 @@ FX_BOOL CXFA_TextLayout::DoLayout(int32_t iBlockIndex, if (iBlockCount == 0 && fHeight > 0) { fHeight = fTextHeight - GetLayoutHeight(); if (fHeight > 0) { - int32_t iAlign = m_textParser.GetVAlgin(m_pTextProvider); + int32_t iAlign = m_textParser.GetVAlign(m_pTextProvider); if (iAlign == XFA_ATTRIBUTEENUM_Middle) { fHeight /= 2.0f; } else if (iAlign != XFA_ATTRIBUTEENUM_Bottom) { @@ -1253,7 +1250,7 @@ void CXFA_TextLayout::UpdateAlign(FX_FLOAT fHeight, FX_FLOAT fBottom) { if (fHeight < 0.1f) { return; } - switch (m_textParser.GetVAlgin(m_pTextProvider)) { + switch (m_textParser.GetVAlign(m_pTextProvider)) { case XFA_ATTRIBUTEENUM_Middle: fHeight /= 2.0f; break; @@ -1643,13 +1640,13 @@ void CXFA_TextLayout::DoTabstops(IFDE_CSSComputedStyle* pStyle, if (m_pTabstopContext->m_bTabstops) { XFA_TABSTOPS* pTabstops = m_pTabstopContext->m_tabstops.GetDataPtr(iTabstopsIndex); - uint32_t dwAlgin = pTabstops->dwAlign; - if (dwAlgin == FX_HashCode_String_GetW(L"center", 6)) { + uint32_t dwAlign = pTabstops->dwAlign; + if (dwAlign == FX_HashCode_GetW(L"center", false)) { fLeft = pPiece->rtPiece.width / 2.0f; - } else if (dwAlgin == FX_HashCode_String_GetW(L"right", 5) || - dwAlgin == FX_HashCode_String_GetW(L"before", 6)) { + } else if (dwAlign == FX_HashCode_GetW(L"right", false) || + dwAlign == FX_HashCode_GetW(L"before", false)) { fLeft = pPiece->rtPiece.width; - } else if (dwAlgin == FX_HashCode_String_GetW(L"decimal", 7)) { + } else if (dwAlign == FX_HashCode_GetW(L"decimal", false)) { int32_t iChars = pPiece->iChars; for (int32_t i = 0; i < iChars; i++) { if (pPiece->pszText[i] == L'.') { diff --git a/xfa/fxfa/app/xfa_textlayout.h b/xfa/fxfa/app/xfa_textlayout.h index 9cced6a65a..ccebff8ad9 100644 --- a/xfa/fxfa/app/xfa_textlayout.h +++ b/xfa/fxfa/app/xfa_textlayout.h @@ -87,7 +87,7 @@ class CXFA_TextParser { IFDE_CSSComputedStyle* pParentStyle); FX_BOOL IsParsed() const { return m_pAllocator != NULL; } - int32_t GetVAlgin(CXFA_TextProvider* pTextProvider) const; + int32_t GetVAlign(CXFA_TextProvider* pTextProvider) const; FX_FLOAT GetTabInterval(IFDE_CSSComputedStyle* pStyle) const; int32_t CountTabs(IFDE_CSSComputedStyle* pStyle) const; FX_BOOL IsSpaceRun(IFDE_CSSComputedStyle* pStyle) const; diff --git a/xfa/fxfa/fm2js/xfa_fm2jscontext.cpp b/xfa/fxfa/fm2js/xfa_fm2jscontext.cpp index 351aedd669..9ab426d541 100644 --- a/xfa/fxfa/fm2js/xfa_fm2jscontext.cpp +++ b/xfa/fxfa/fm2js/xfa_fm2jscontext.cpp @@ -4238,19 +4238,17 @@ void CXFA_FM2JSContext::EncodeXML(const CFX_ByteStringC& szXMLString, } FX_BOOL CXFA_FM2JSContext::HTMLSTR2Code(const CFX_WideStringC& pData, uint32_t& iCode) { - int32_t iLength = pData.GetLength(); - uint32_t uHash = FX_HashCode_String_GetW(pData.c_str(), iLength); - XFA_FMHtmlHashedReserveCode htmlhashedreservecode; - int32_t iStart = 0, - iEnd = (sizeof(reservesForDecode) / sizeof(reservesForDecode[0])) - 1; - int32_t iMid = (iStart + iEnd) / 2; + uint32_t uHash = FX_HashCode_GetW(pData, false); + int32_t iStart = 0; + int32_t iEnd = FX_ArraySize(reservesForDecode) - 1; do { - iMid = (iStart + iEnd) / 2; - htmlhashedreservecode = reservesForDecode[iMid]; + int32_t iMid = (iStart + iEnd) / 2; + XFA_FMHtmlHashedReserveCode htmlhashedreservecode = reservesForDecode[iMid]; if (uHash == htmlhashedreservecode.m_uHash) { iCode = htmlhashedreservecode.m_uCode; return TRUE; - } else if (uHash < htmlhashedreservecode.m_uHash) { + } + if (uHash < htmlhashedreservecode.m_uHash) { iEnd = iMid - 1; } else { iStart = iMid + 1; diff --git a/xfa/fxfa/fm2js/xfa_lexer.cpp b/xfa/fxfa/fm2js/xfa_lexer.cpp index 4462bd5154..dd3b48ff54 100644 --- a/xfa/fxfa/fm2js/xfa_lexer.cpp +++ b/xfa/fxfa/fm2js/xfa_lexer.cpp @@ -516,21 +516,18 @@ void CXFA_FMLexer::Comment(const FX_WCHAR* p, const FX_WCHAR*& pEnd) { } XFA_FM_TOKEN CXFA_FMLexer::IsKeyword(const CFX_WideStringC& str) { - int32_t iLength = str.GetLength(); - uint32_t uHash = FX_HashCode_String_GetW(str.c_str(), iLength, TRUE); - int32_t iStart = KEYWORD_START, iEnd = KEYWORD_END; - int32_t iMid = (iStart + iEnd) / 2; - XFA_FMKeyword keyword; + uint32_t uHash = FX_HashCode_GetW(str, true); + int32_t iStart = KEYWORD_START; + int32_t iEnd = KEYWORD_END; do { - iMid = (iStart + iEnd) / 2; - keyword = keyWords[iMid]; - if (uHash == keyword.m_uHash) { + int32_t iMid = (iStart + iEnd) / 2; + XFA_FMKeyword keyword = keyWords[iMid]; + if (uHash == keyword.m_uHash) return keyword.m_type; - } else if (uHash < keyword.m_uHash) { + if (uHash < keyword.m_uHash) iEnd = iMid - 1; - } else { + else iStart = iMid + 1; - } } while (iStart <= iEnd); return TOKidentifier; } diff --git a/xfa/fxfa/fm2js/xfa_simpleexpression.cpp b/xfa/fxfa/fm2js/xfa_simpleexpression.cpp index f6c12ae64d..f652961b6e 100644 --- a/xfa/fxfa/fm2js/xfa_simpleexpression.cpp +++ b/xfa/fxfa/fm2js/xfa_simpleexpression.cpp @@ -483,8 +483,7 @@ CXFA_FMCallExpression::~CXFA_FMCallExpression() { } bool CXFA_FMCallExpression::IsBuildInFunc(CFX_WideTextBuf* funcName) { - uint32_t uHash = FX_HashCode_String_GetW(funcName->GetBuffer(), - funcName->GetLength(), TRUE); + uint32_t uHash = FX_HashCode_GetW(funcName->AsStringC(), true); const XFA_FMBuildInFunc* pEnd = g_BuildInFuncs + FX_ArraySize(g_BuildInFuncs); const XFA_FMBuildInFunc* pFunc = std::lower_bound(g_BuildInFuncs, pEnd, uHash, @@ -501,8 +500,7 @@ bool CXFA_FMCallExpression::IsBuildInFunc(CFX_WideTextBuf* funcName) { uint32_t CXFA_FMCallExpression::IsMethodWithObjParam( const CFX_WideStringC& methodName) { - int32_t iLength = methodName.GetLength(); - uint32_t uHash = FX_HashCode_String_GetW(methodName.c_str(), iLength); + uint32_t uHash = FX_HashCode_GetW(methodName, false); XFA_FMSOMMethod somMethodWithObjPara; uint32_t parameters = 0x00; int32_t iStart = 0, diff --git a/xfa/fxfa/parser/cxfa_widgetdata.cpp b/xfa/fxfa/parser/cxfa_widgetdata.cpp index a702527347..0c3d065a39 100644 --- a/xfa/fxfa/parser/cxfa_widgetdata.cpp +++ b/xfa/fxfa/parser/cxfa_widgetdata.cpp @@ -466,8 +466,7 @@ CXFA_Node* CXFA_WidgetData::GetSelectedMember() { CXFA_Node* CXFA_WidgetData::SetSelectedMember(const CFX_WideStringC& wsName, FX_BOOL bNotify) { CXFA_Node* pSelectedMember = NULL; - uint32_t nameHash = - FX_HashCode_String_GetW(wsName.c_str(), wsName.GetLength()); + uint32_t nameHash = FX_HashCode_GetW(wsName, false); for (CXFA_Node* pNode = ToNode(m_pNode->GetNodeItem(XFA_NODEITEM_FirstChild)); pNode; pNode = pNode->GetNodeItem(XFA_NODEITEM_NextSibling)) { if (pNode->GetNameHash() == nameHash) { diff --git a/xfa/fxfa/parser/xfa_basic_imp.cpp b/xfa/fxfa/parser/xfa_basic_imp.cpp index 631b7c10ca..728ecfc319 100644 --- a/xfa/fxfa/parser/xfa_basic_imp.cpp +++ b/xfa/fxfa/parser/xfa_basic_imp.cpp @@ -21,12 +21,12 @@ #include "xfa/fxfa/parser/xfa_utils.h" const XFA_PACKETINFO* XFA_GetPacketByName(const CFX_WideStringC& wsName) { - int32_t iLength = wsName.GetLength(); - if (iLength == 0) { - return NULL; - } - uint32_t uHash = FX_HashCode_String_GetW(wsName.c_str(), iLength); - int32_t iStart = 0, iEnd = g_iXFAPacketCount - 1; + if (wsName.IsEmpty()) + return nullptr; + + uint32_t uHash = FX_HashCode_GetW(wsName, false); + int32_t iStart = 0; + int32_t iEnd = g_iXFAPacketCount - 1; do { int32_t iMid = (iStart + iEnd) / 2; const XFA_PACKETINFO* pInfo = g_XFAPacketData + iMid; @@ -63,12 +63,12 @@ const XFA_PACKETINFO* XFA_GetPacketByIndex(XFA_PACKET ePacket) { const XFA_ATTRIBUTEENUMINFO* XFA_GetAttributeEnumByName( const CFX_WideStringC& wsName) { - int32_t iLength = wsName.GetLength(); - if (iLength == 0) { - return NULL; - } - uint32_t uHash = FX_HashCode_String_GetW(wsName.c_str(), iLength); - int32_t iStart = 0, iEnd = g_iXFAEnumCount - 1; + if (wsName.IsEmpty()) + return nullptr; + + uint32_t uHash = FX_HashCode_GetW(wsName, false); + int32_t iStart = 0; + int32_t iEnd = g_iXFAEnumCount - 1; do { int32_t iMid = (iStart + iEnd) / 2; const XFA_ATTRIBUTEENUMINFO* pInfo = g_XFAEnumData + iMid; @@ -87,12 +87,12 @@ const XFA_ATTRIBUTEENUMINFO* XFA_GetAttributeEnumByID(XFA_ATTRIBUTEENUM eName) { } const XFA_ATTRIBUTEINFO* XFA_GetAttributeByName(const CFX_WideStringC& wsName) { - int32_t iLength = wsName.GetLength(); - if (iLength == 0) { - return NULL; - } - uint32_t uHash = FX_HashCode_String_GetW(wsName.c_str(), iLength); - int32_t iStart = 0, iEnd = g_iXFAAttributeCount - 1; + if (wsName.IsEmpty()) + return nullptr; + + uint32_t uHash = FX_HashCode_GetW(wsName, false); + int32_t iStart = 0; + int32_t iEnd = g_iXFAAttributeCount - 1; do { int32_t iMid = (iStart + iEnd) / 2; const XFA_ATTRIBUTEINFO* pInfo = g_XFAAttributeData + iMid; @@ -104,7 +104,7 @@ const XFA_ATTRIBUTEINFO* XFA_GetAttributeByName(const CFX_WideStringC& wsName) { iStart = iMid + 1; } } while (iStart <= iEnd); - return NULL; + return nullptr; } const XFA_ATTRIBUTEINFO* XFA_GetAttributeByID(XFA_ATTRIBUTE eName) { return (eName < g_iXFAAttributeCount) ? (g_XFAAttributeData + eName) : NULL; @@ -177,12 +177,12 @@ CXFA_Measurement XFA_GetAttributeDefaultValue_Measure(XFA_ELEMENT eElement, } const XFA_ELEMENTINFO* XFA_GetElementByName(const CFX_WideStringC& wsName) { - int32_t iLength = wsName.GetLength(); - if (iLength == 0) { - return NULL; - } - uint32_t uHash = FX_HashCode_String_GetW(wsName.c_str(), iLength); - int32_t iStart = 0, iEnd = g_iXFAElementCount - 1; + if (wsName.IsEmpty()) + return nullptr; + + uint32_t uHash = FX_HashCode_GetW(wsName, false); + int32_t iStart = 0; + int32_t iEnd = g_iXFAElementCount - 1; do { int32_t iMid = (iStart + iEnd) / 2; const XFA_ELEMENTINFO* pInfo = g_XFAElementData + iMid; @@ -334,10 +334,9 @@ const XFA_NOTSUREATTRIBUTE* XFA_GetNotsureAttribute(XFA_ELEMENT eElement, const XFA_METHODINFO* XFA_GetMethodByName(XFA_ELEMENT eElement, const CFX_WideStringC& wsMethodName) { - int32_t iLength = wsMethodName.GetLength(); - if (iLength == 0) { - return NULL; - } + if (wsMethodName.IsEmpty()) + return nullptr; + int32_t iElementIndex = eElement; while (iElementIndex != -1) { const XFA_SCRIPTHIERARCHY* scriptIndex = g_XFAScriptIndex + iElementIndex; @@ -346,8 +345,9 @@ const XFA_METHODINFO* XFA_GetMethodByName(XFA_ELEMENT eElement, iElementIndex = scriptIndex->wParentIndex; continue; } - uint32_t uHash = FX_HashCode_String_GetW(wsMethodName.c_str(), iLength); - int32_t iStart = scriptIndex->wMethodStart, iEnd = iStart + icount - 1; + uint32_t uHash = FX_HashCode_GetW(wsMethodName, false); + int32_t iStart = scriptIndex->wMethodStart; + int32_t iEnd = iStart + icount - 1; do { int32_t iMid = (iStart + iEnd) / 2; const XFA_METHODINFO* pInfo = g_SomMethodData + iMid; @@ -366,10 +366,9 @@ const XFA_METHODINFO* XFA_GetMethodByName(XFA_ELEMENT eElement, const XFA_SCRIPTATTRIBUTEINFO* XFA_GetScriptAttributeByName( XFA_ELEMENT eElement, const CFX_WideStringC& wsAttributeName) { - int32_t iLength = wsAttributeName.GetLength(); - if (iLength == 0) { - return NULL; - } + if (wsAttributeName.IsEmpty()) + return nullptr; + int32_t iElementIndex = eElement; while (iElementIndex != -1) { const XFA_SCRIPTHIERARCHY* scriptIndex = g_XFAScriptIndex + iElementIndex; @@ -378,7 +377,7 @@ const XFA_SCRIPTATTRIBUTEINFO* XFA_GetScriptAttributeByName( iElementIndex = scriptIndex->wParentIndex; continue; } - uint32_t uHash = FX_HashCode_String_GetW(wsAttributeName.c_str(), iLength); + uint32_t uHash = FX_HashCode_GetW(wsAttributeName, false); int32_t iStart = scriptIndex->wAttributeStart, iEnd = iStart + icount - 1; do { int32_t iMid = (iStart + iEnd) / 2; diff --git a/xfa/fxfa/parser/xfa_document_datamerger_imp.cpp b/xfa/fxfa/parser/xfa_document_datamerger_imp.cpp index 22d3c625c9..59e663eec1 100644 --- a/xfa/fxfa/parser/xfa_document_datamerger_imp.cpp +++ b/xfa/fxfa/parser/xfa_document_datamerger_imp.cpp @@ -397,52 +397,48 @@ static CXFA_Node* XFA_DataMerge_FindGlobalDataNode(CXFA_Document* pDocument, CFX_WideStringC wsName, CXFA_Node* pDataScope, XFA_ELEMENT eMatchNodeType) { - uint32_t dwNameHash = - wsName.IsEmpty() ? 0 : FX_HashCode_String_GetW(wsName.c_str(), - wsName.GetLength()); - if (dwNameHash != 0) { - CXFA_Node* pBounded = XFA_DataMerge_GetGlobalBinding(pDocument, dwNameHash); - if (!pBounded) { - pBounded = XFA_DataMerge_ScopeMatchGlobalBinding(pDataScope, dwNameHash, - eMatchNodeType); - if (pBounded) { - XFA_DataMerge_RegisterGlobalBinding(pDocument, dwNameHash, pBounded); - } + if (wsName.IsEmpty()) + return nullptr; + + uint32_t dwNameHash = FX_HashCode_GetW(wsName, false); + CXFA_Node* pBounded = XFA_DataMerge_GetGlobalBinding(pDocument, dwNameHash); + if (!pBounded) { + pBounded = XFA_DataMerge_ScopeMatchGlobalBinding(pDataScope, dwNameHash, + eMatchNodeType); + if (pBounded) { + XFA_DataMerge_RegisterGlobalBinding(pDocument, dwNameHash, pBounded); } - return pBounded; } - return NULL; + return pBounded; } + static CXFA_Node* XFA_DataMerge_FindOnceDataNode(CXFA_Document* pDocument, CFX_WideStringC wsName, CXFA_Node* pDataScope, XFA_ELEMENT eMatchNodeType) { - uint32_t dwNameHash = - wsName.IsEmpty() ? 0 : FX_HashCode_String_GetW(wsName.c_str(), - wsName.GetLength()); - if (dwNameHash != 0) { - for (CXFA_Node *pCurDataScope = pDataScope, *pLastDataScope = NULL; - pCurDataScope && - pCurDataScope->GetPacketID() == XFA_XDPPACKET_Datasets; - pLastDataScope = pCurDataScope, - pCurDataScope = - pCurDataScope->GetNodeItem(XFA_NODEITEM_Parent)) { - for (CXFA_Node* pDataChild = - pCurDataScope->GetFirstChildByName(dwNameHash); - pDataChild; - pDataChild = pDataChild->GetNextSameNameSibling(dwNameHash)) { - if (pDataChild == pLastDataScope || - (eMatchNodeType != XFA_ELEMENT_DataModel && - pDataChild->GetClassID() != eMatchNodeType) || - pDataChild->HasBindItem()) { - continue; - } - return pDataChild; + if (wsName.IsEmpty()) + return nullptr; + + uint32_t dwNameHash = FX_HashCode_GetW(wsName, false); + CXFA_Node* pLastDataScope = nullptr; + for (CXFA_Node* pCurDataScope = pDataScope; + pCurDataScope && pCurDataScope->GetPacketID() == XFA_XDPPACKET_Datasets; + pCurDataScope = pCurDataScope->GetNodeItem(XFA_NODEITEM_Parent)) { + for (CXFA_Node* pDataChild = pCurDataScope->GetFirstChildByName(dwNameHash); + pDataChild; + pDataChild = pDataChild->GetNextSameNameSibling(dwNameHash)) { + if (pDataChild == pLastDataScope || pDataChild->HasBindItem() || + (eMatchNodeType != XFA_ELEMENT_DataModel && + pDataChild->GetClassID() != eMatchNodeType)) { + continue; } + return pDataChild; } + pLastDataScope = pCurDataScope; } - return NULL; + return nullptr; } + static CXFA_Node* XFA_DataMerge_FindDataRefDataNode(CXFA_Document* pDocument, CFX_WideStringC wsRef, CXFA_Node* pDataScope, @@ -561,8 +557,8 @@ static CXFA_Node* XFA_NodeMerge_CloneOrMergeInstanceManager( CXFA_NodeArray& subforms) { CFX_WideStringC wsSubformName = pTemplateNode->GetCData(XFA_ATTRIBUTE_Name); CFX_WideString wsInstMgrNodeName = FX_WSTRC(L"_") + wsSubformName; - uint32_t dwInstNameHash = FX_HashCode_String_GetW( - wsInstMgrNodeName.c_str(), wsInstMgrNodeName.GetLength()); + uint32_t dwInstNameHash = + FX_HashCode_GetW(wsInstMgrNodeName.AsStringC(), false); CXFA_Node* pExistingNode = XFA_DataMerge_FindFormDOMInstance( pDocument, XFA_ELEMENT_InstanceManager, dwInstNameHash, pFormParent); if (pExistingNode) { diff --git a/xfa/fxfa/parser/xfa_document_imp.cpp b/xfa/fxfa/parser/xfa_document_imp.cpp index 39bdf2503c..ad3fd70e0d 100644 --- a/xfa/fxfa/parser/xfa_document_imp.cpp +++ b/xfa/fxfa/parser/xfa_document_imp.cpp @@ -94,8 +94,7 @@ CXFA_FFNotify* CXFA_Document::GetNotify() const { return m_pParser->GetNotify(); } CXFA_Object* CXFA_Document::GetXFAObject(const CFX_WideStringC& wsNodeName) { - return GetXFAObject( - FX_HashCode_String_GetW(wsNodeName.c_str(), wsNodeName.GetLength())); + return GetXFAObject(FX_HashCode_GetW(wsNodeName, false)); } CXFA_Object* CXFA_Document::GetXFAObject(uint32_t dwNodeNameHash) { switch (dwNodeNameHash) { @@ -367,8 +366,7 @@ void CXFA_Document::DoProtoMerge() { pNode = sIterator.MoveToNext()) { CFX_WideStringC wsIDVal; if (pNode->TryCData(XFA_ATTRIBUTE_Id, wsIDVal) && !wsIDVal.IsEmpty()) { - mIDMap[FX_HashCode_String_GetW(wsIDVal.c_str(), wsIDVal.GetLength())] = - pNode; + mIDMap[FX_HashCode_GetW(wsIDVal, false)] = pNode; } CFX_WideStringC wsUseVal; if (pNode->TryCData(XFA_ATTRIBUTE_Use, wsUseVal) && !wsUseVal.IsEmpty()) { @@ -426,9 +424,7 @@ void CXFA_Document::DoProtoMerge() { pProtoNode = resoveNodeRS.nodes[0]->AsNode(); } } else if (!wsID.IsEmpty()) { - if (!mIDMap.Lookup( - FX_HashCode_String_GetW(wsID.c_str(), wsID.GetLength()), - pProtoNode)) { + if (!mIDMap.Lookup(FX_HashCode_GetW(wsID, false), pProtoNode)) { continue; } } diff --git a/xfa/fxfa/parser/xfa_object_imp.cpp b/xfa/fxfa/parser/xfa_object_imp.cpp index 93b596ae99..fd54b1509b 100644 --- a/xfa/fxfa/parser/xfa_object_imp.cpp +++ b/xfa/fxfa/parser/xfa_object_imp.cpp @@ -1769,24 +1769,22 @@ static const XFA_ExecEventParaInfo gs_eventParaInfos[] = { }; const XFA_ExecEventParaInfo* GetEventParaInfoByName( const CFX_WideStringC& wsEventName) { - int32_t iLength = wsEventName.GetLength(); - uint32_t uHash = FX_HashCode_String_GetW(wsEventName.c_str(), iLength); - const XFA_ExecEventParaInfo* eventParaInfo = NULL; - int32_t iStart = 0, - iEnd = (sizeof(gs_eventParaInfos) / sizeof(gs_eventParaInfos[0])) - 1; - int32_t iMid = (iStart + iEnd) / 2; + uint32_t uHash = FX_HashCode_GetW(wsEventName, false); + int32_t iStart = 0; + int32_t iEnd = (sizeof(gs_eventParaInfos) / sizeof(gs_eventParaInfos[0])) - 1; do { - iMid = (iStart + iEnd) / 2; - eventParaInfo = &gs_eventParaInfos[iMid]; + int32_t iMid = (iStart + iEnd) / 2; + const XFA_ExecEventParaInfo* eventParaInfo = &gs_eventParaInfos[iMid]; if (uHash == eventParaInfo->m_uHash) { return eventParaInfo; - } else if (uHash < eventParaInfo->m_uHash) { + } + if (uHash < eventParaInfo->m_uHash) { iEnd = iMid - 1; } else { iStart = iMid + 1; } } while (iStart <= iEnd); - return NULL; + return nullptr; } void XFA_STRING_TO_RGB(CFX_WideString& strRGB, int32_t& r, @@ -3287,9 +3285,7 @@ int32_t CXFA_Node::InstanceManager_SetInstances(int32_t iDesired) { ? wsInstManagerName : wsInstManagerName.Mid(1); uint32_t dInstanceNameHash = - wsInstanceName.IsEmpty() ? 0 : FX_HashCode_String_GetW( - wsInstanceName.c_str(), - wsInstanceName.GetLength()); + FX_HashCode_GetW(wsInstanceName.AsStringC(), false); CXFA_Node* pPrevSibling = (iDesired == 0) ? this : XFA_ScriptInstanceManager_GetItem(this, iDesired - 1); @@ -3726,7 +3722,7 @@ enum XFA_KEYTYPE { XFA_KEYTYPE_Element, }; void* XFA_GetMapKey_Custom(const CFX_WideStringC& wsKey) { - uint32_t dwKey = FX_HashCode_String_GetW(wsKey.c_str(), wsKey.GetLength()); + uint32_t dwKey = FX_HashCode_GetW(wsKey, false); return (void*)(uintptr_t)((dwKey << 1) | XFA_KEYTYPE_Custom); } void* XFA_GetMapKey_Element(XFA_ELEMENT eElement, XFA_ATTRIBUTE eAttribute) { @@ -4732,9 +4728,7 @@ FX_BOOL CXFA_Node::RemoveChild(CXFA_Node* pNode, bool bNotify) { return TRUE; } CXFA_Node* CXFA_Node::GetFirstChildByName(const CFX_WideStringC& wsName) const { - return GetFirstChildByName( - wsName.IsEmpty() ? 0 : FX_HashCode_String_GetW(wsName.c_str(), - wsName.GetLength())); + return GetFirstChildByName(FX_HashCode_GetW(wsName, false)); } CXFA_Node* CXFA_Node::GetFirstChildByName(uint32_t dwNameHash) const { for (CXFA_Node* pNode = GetNodeItem(XFA_NODEITEM_FirstChild); pNode; @@ -4765,10 +4759,7 @@ CXFA_Node* CXFA_Node::GetNextSameNameSibling(uint32_t dwNameHash) const { } CXFA_Node* CXFA_Node::GetNextSameNameSibling( const CFX_WideStringC& wsNodeName) const { - return GetNextSameNameSibling( - wsNodeName.IsEmpty() ? 0 - : FX_HashCode_String_GetW(wsNodeName.c_str(), - wsNodeName.GetLength())); + return GetNextSameNameSibling(FX_HashCode_GetW(wsNodeName, false)); } CXFA_Node* CXFA_Node::GetNextSameClassSibling(XFA_ELEMENT eElement) const { for (CXFA_Node* pNode = GetNodeItem(XFA_NODEITEM_NextSibling); pNode; @@ -4951,17 +4942,13 @@ int32_t CXFA_Node::execSingleEventByName(const CFX_WideStringC& wsEventName, void CXFA_Node::UpdateNameHash() { const XFA_NOTSUREATTRIBUTE* pNotsure = XFA_GetNotsureAttribute(GetClassID(), XFA_ATTRIBUTE_Name); + CFX_WideStringC wsName; if (!pNotsure || pNotsure->eType == XFA_ATTRIBUTETYPE_Cdata) { - CFX_WideStringC wsName = GetCData(XFA_ATTRIBUTE_Name); - m_dwNameHash = - wsName.IsEmpty() ? 0 : FX_HashCode_String_GetW(wsName.c_str(), - wsName.GetLength()); + wsName = GetCData(XFA_ATTRIBUTE_Name); + m_dwNameHash = FX_HashCode_GetW(wsName, false); } else if (pNotsure->eType == XFA_ATTRIBUTETYPE_Enum) { - CFX_WideStringC wsName = - XFA_GetAttributeEnumByID(GetEnum(XFA_ATTRIBUTE_Name))->pName; - m_dwNameHash = - wsName.IsEmpty() ? 0 : FX_HashCode_String_GetW(wsName.c_str(), - wsName.GetLength()); + wsName = XFA_GetAttributeEnumByID(GetEnum(XFA_ATTRIBUTE_Name))->pName; + m_dwNameHash = FX_HashCode_GetW(wsName, false); } } CFDE_XMLNode* CXFA_Node::CreateXMLMappingNode() { @@ -5233,14 +5220,12 @@ CXFA_NodeList::CXFA_NodeList(CXFA_Document* pDocument) m_pDocument->GetScriptContext()->CacheList(this); } CXFA_Node* CXFA_NodeList::NamedItem(const CFX_WideStringC& wsName) { + uint32_t dwHashCode = FX_HashCode_GetW(wsName, false); int32_t iCount = GetLength(); - uint32_t dwHashCode = - FX_HashCode_String_GetW(wsName.c_str(), wsName.GetLength()); for (int32_t i = 0; i < iCount; i++) { CXFA_Node* ret = Item(i); - if (dwHashCode == ret->GetNameHash()) { + if (dwHashCode == ret->GetNameHash()) return ret; - } } return NULL; } diff --git a/xfa/fxfa/parser/xfa_script_imp.cpp b/xfa/fxfa/parser/xfa_script_imp.cpp index ee95865dc6..0c8aa1a838 100644 --- a/xfa/fxfa/parser/xfa_script_imp.cpp +++ b/xfa/fxfa/parser/xfa_script_imp.cpp @@ -179,8 +179,7 @@ void CXFA_ScriptContext::GlobalPropertyGetter(FXJSE_HOBJECT hObject, XFA_FM2JS_GlobalPropertyGetter(lpScriptContext->m_hFM2JSContext, hValue); return; } - uint32_t uHashCode = - FX_HashCode_String_GetW(wsPropName.c_str(), wsPropName.GetLength()); + uint32_t uHashCode = 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_nodehelper.cpp b/xfa/fxfa/parser/xfa_script_nodehelper.cpp index 96ae98aeaf..96ecc5a125 100644 --- a/xfa/fxfa/parser/xfa_script_nodehelper.cpp +++ b/xfa/fxfa/parser/xfa_script_nodehelper.cpp @@ -33,7 +33,7 @@ CXFA_Node* CXFA_NodeHelper::XFA_ResolveNodes_GetOneChild( return NULL; } CXFA_NodeArray siblings; - uint32_t uNameHash = FX_HashCode_String_GetW(pwsName, FXSYS_wcslen(pwsName)); + uint32_t uNameHash = FX_HashCode_GetW(CFX_WideStringC(pwsName), false); XFA_NodeAcc_TraverseAnySiblings(parent, uNameHash, &siblings, bIsClassName); if (siblings.GetSize() == 0) { return NULL; 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( diff --git a/xfa/fxfa/parser/xfa_utils_imp.cpp b/xfa/fxfa/parser/xfa_utils_imp.cpp index 4fec7c071b..77cac00b89 100644 --- a/xfa/fxfa/parser/xfa_utils_imp.cpp +++ b/xfa/fxfa/parser/xfa_utils_imp.cpp @@ -196,8 +196,7 @@ void XFA_GetPlainTextFromRichText(CFDE_XMLNode* pXMLNode, CFDE_XMLElement* pXMLElement = static_cast<CFDE_XMLElement*>(pXMLNode); CFX_WideString wsTag; pXMLElement->GetLocalTagName(wsTag); - uint32_t uTag = - FX_HashCode_String_GetW(wsTag.c_str(), wsTag.GetLength(), TRUE); + uint32_t uTag = FX_HashCode_GetW(wsTag.AsStringC(), true); if (uTag == 0x0001f714) { wsPlainText += L"\n"; } else if (uTag == 0x00000070) { |