From 8a1758bf11c2d741e0cddc761b1dd2cdf564db93 Mon Sep 17 00:00:00 2001 From: Ryan Harrison Date: Tue, 15 Aug 2017 10:37:59 -0400 Subject: Remove GetAt from string classes This method duplicates the behaviour of the const [] operator and doesn't offer any additional safety. Folding them into one implementation. SetAt is retained, since implementing the non-const [] operator to replace SetAt has potential performance concerns. Specifically many non-obvious cases of reading an element using [] will cause a realloc & copy. BUG=pdfium:860 Change-Id: I3ef5e5e5a15376f040256b646eb0d90636e24b67 Reviewed-on: https://pdfium-review.googlesource.com/10870 Commit-Queue: Ryan Harrison Reviewed-by: Tom Sepez --- xfa/fxfa/cxfa_ffpasswordedit.cpp | 2 +- xfa/fxfa/cxfa_pdffontmgr.cpp | 2 +- xfa/fxfa/cxfa_textlayout.cpp | 4 ++-- xfa/fxfa/cxfa_textparser.cpp | 2 +- xfa/fxfa/cxfa_widgetacc.cpp | 2 +- xfa/fxfa/fm2js/cxfa_fm2jscontext.cpp | 22 +++++++++++----------- xfa/fxfa/fm2js/cxfa_fmexpression.cpp | 18 +++++++++--------- xfa/fxfa/parser/cxfa_dataexporter.cpp | 6 +++--- xfa/fxfa/parser/cxfa_layoutpagemgr.cpp | 2 +- xfa/fxfa/parser/cxfa_localemgr.cpp | 7 +++---- xfa/fxfa/parser/cxfa_measurement.cpp | 2 +- xfa/fxfa/parser/cxfa_node.cpp | 10 +++++----- xfa/fxfa/parser/cxfa_nodehelper.cpp | 6 +++--- xfa/fxfa/parser/cxfa_resolveprocessor.cpp | 4 ++-- xfa/fxfa/parser/cxfa_scriptcontext.cpp | 2 +- xfa/fxfa/parser/cxfa_widgetdata.cpp | 4 ++-- 16 files changed, 47 insertions(+), 48 deletions(-) (limited to 'xfa') diff --git a/xfa/fxfa/cxfa_ffpasswordedit.cpp b/xfa/fxfa/cxfa_ffpasswordedit.cpp index e0d9f33428..df2ea99cde 100644 --- a/xfa/fxfa/cxfa_ffpasswordedit.cpp +++ b/xfa/fxfa/cxfa_ffpasswordedit.cpp @@ -52,7 +52,7 @@ void CXFA_FFPasswordEdit::UpdateWidgetProperty() { CFX_WideString wsPassWord; m_pDataAcc->GetPasswordChar(wsPassWord); if (!wsPassWord.IsEmpty()) - pWidget->SetAliasChar(wsPassWord.GetAt(0)); + pWidget->SetAliasChar(wsPassWord[0]); if (m_pDataAcc->GetHorizontalScrollPolicy() != XFA_ATTRIBUTEENUM_Off) dwExtendedStyle |= FWL_STYLEEXT_EDT_AutoHScroll; if (m_pDataAcc->GetAccess() != XFA_ATTRIBUTEENUM_Open || diff --git a/xfa/fxfa/cxfa_pdffontmgr.cpp b/xfa/fxfa/cxfa_pdffontmgr.cpp index 6e7a2ede4b..af94ee8c82 100644 --- a/xfa/fxfa/cxfa_pdffontmgr.cpp +++ b/xfa/fxfa/cxfa_pdffontmgr.cpp @@ -162,7 +162,7 @@ bool CXFA_PDFFontMgr::PsNameMatchDRFontName(const CFX_ByteStringC& bsPsName, return false; bool bMatch = false; - switch (bsPsName.GetAt(iPsLen - 1)) { + switch (bsPsName[iPsLen - 1]) { case 'L': { if (bsDRName.Right(5) == "Light") { bMatch = true; diff --git a/xfa/fxfa/cxfa_textlayout.cpp b/xfa/fxfa/cxfa_textlayout.cpp index 25bbe45e1b..9c4e36739d 100644 --- a/xfa/fxfa/cxfa_textlayout.cpp +++ b/xfa/fxfa/cxfa_textlayout.cpp @@ -796,7 +796,7 @@ bool CXFA_TextLayout::LoadRichText( (m_pLoader->m_dwFlags & XFA_LOADERCNTXTFLG_FILTERSPACE)) { m_pLoader->m_dwFlags &= ~XFA_LOADERCNTXTFLG_FILTERSPACE; } else if (wsText.GetLength() > 0 && - (0x20 == wsText.GetAt(wsText.GetLength() - 1))) { + (0x20 == wsText[wsText.GetLength() - 1])) { m_pLoader->m_dwFlags |= XFA_LOADERCNTXTFLG_FILTERSPACE; } else if (wsText.GetLength() != 0) { m_pLoader->m_dwFlags &= ~XFA_LOADERCNTXTFLG_FILTERSPACE; @@ -885,7 +885,7 @@ bool CXFA_TextLayout::AppendChar(const CFX_WideString& wsText, int32_t iLength = wsText.GetLength(); for (int32_t i = iChar; i < iLength; i++) { - wchar_t wch = wsText.GetAt(i); + wchar_t wch = wsText[i]; if (wch == 0xA0) wch = 0x20; diff --git a/xfa/fxfa/cxfa_textparser.cpp b/xfa/fxfa/cxfa_textparser.cpp index 7e16202b16..659ec9cc6d 100644 --- a/xfa/fxfa/cxfa_textparser.cpp +++ b/xfa/fxfa/cxfa_textparser.cpp @@ -498,7 +498,7 @@ bool CXFA_TextParser::GetEmbbedObj(CXFA_TextProvider* pTextProvider, CFX_WideString wsAttr = pElement->GetString(L"xfa:embed"); if (wsAttr.IsEmpty()) return false; - if (wsAttr.GetAt(0) == L'#') + if (wsAttr[0] == L'#') wsAttr.Delete(0); CFX_WideString ws = pElement->GetString(L"xfa:embedType"); diff --git a/xfa/fxfa/cxfa_widgetacc.cpp b/xfa/fxfa/cxfa_widgetacc.cpp index 92d00e5ba9..30b1eca3e7 100644 --- a/xfa/fxfa/cxfa_widgetacc.cpp +++ b/xfa/fxfa/cxfa_widgetacc.cpp @@ -828,7 +828,7 @@ void CXFA_WidgetAcc::CalculateTextContentSize(CFX_SizeF& size) { } wchar_t wcEnter = '\n'; - wchar_t wsLast = wsText.GetAt(wsText.GetLength() - 1); + wchar_t wsLast = wsText[wsText.GetLength() - 1]; if (wsLast == wcEnter) wsText = wsText + wcEnter; diff --git a/xfa/fxfa/fm2js/cxfa_fm2jscontext.cpp b/xfa/fxfa/fm2js/cxfa_fm2jscontext.cpp index 9028642b76..5912d26a99 100644 --- a/xfa/fxfa/fm2js/cxfa_fm2jscontext.cpp +++ b/xfa/fxfa/fm2js/cxfa_fm2jscontext.cpp @@ -3488,17 +3488,17 @@ CFX_WideString CXFA_FM2JSContext::EncodeURL(const CFX_ByteString& szURLString) { int32_t iIndex = 0; if (iLen % 2 != 0) { strEncode[1] = '0'; - strEncode[2] = strTmp.GetAt(iLen - 1); + strEncode[2] = strTmp[iLen - 1]; iIndex = iLen - 2; } else { - strEncode[1] = strTmp.GetAt(iLen - 1); - strEncode[2] = strTmp.GetAt(iLen - 2); + strEncode[1] = strTmp[iLen - 1]; + strEncode[2] = strTmp[iLen - 2]; iIndex = iLen - 3; } wsResultBuf << strEncode; while (iIndex > 0) { - strEncode[1] = strTmp.GetAt(iIndex); - strEncode[2] = strTmp.GetAt(iIndex - 1); + strEncode[1] = strTmp[iIndex]; + strEncode[2] = strTmp[iIndex - 1]; iIndex -= 2; wsResultBuf << strEncode; } @@ -3994,8 +3994,8 @@ void CXFA_FM2JSContext::Replace(CFXJSE_Value* pThis, std::ostringstream resultString; int32_t iFindIndex = 0; for (int32_t u = 0; u < oneString.GetLength(); ++u) { - char ch = static_cast(oneString.GetAt(u)); - if (ch != static_cast(twoString.GetAt(iFindIndex))) { + char ch = static_cast(oneString[u]); + if (ch != static_cast(twoString[iFindIndex])) { resultString << ch; continue; } @@ -4003,8 +4003,8 @@ void CXFA_FM2JSContext::Replace(CFXJSE_Value* pThis, int32_t iTemp = u + 1; ++iFindIndex; while (iFindIndex < iFindLen) { - uint8_t chTemp = oneString.GetAt(iTemp); - if (chTemp != twoString.GetAt(iFindIndex)) { + uint8_t chTemp = oneString[iTemp]; + if (chTemp != twoString[iFindIndex]) { iFindIndex = 0; break; } @@ -4246,13 +4246,13 @@ void CXFA_FM2JSContext::Stuff(CFXJSE_Value* pThis, std::ostringstream resultString; int32_t i = 0; while (i < iStart) { - resultString << static_cast(sourceString.GetAt(i)); + resultString << static_cast(sourceString[i]); ++i; } resultString << insertString.AsStringC(); i = iStart + iDelete; while (i < iLength) { - resultString << static_cast(sourceString.GetAt(i)); + resultString << static_cast(sourceString[i]); ++i; } resultString << '\0'; diff --git a/xfa/fxfa/fm2js/cxfa_fmexpression.cpp b/xfa/fxfa/fm2js/cxfa_fmexpression.cpp index c6b5814d6d..e323a330dc 100644 --- a/xfa/fxfa/fm2js/cxfa_fmexpression.cpp +++ b/xfa/fxfa/fm2js/cxfa_fmexpression.cpp @@ -72,7 +72,7 @@ bool CXFA_FMFunctionDefinition::ToJavaScript(CFX_WideTextBuf& javascript) { for (const auto& identifier : m_pArguments) { if (bNeedComma) javascript << L", "; - if (identifier.GetAt(0) == L'!') { + if (identifier[0] == L'!') { CFX_WideString tempIdentifier = EXCLAMATION_IN_IDENTIFIER + identifier.Right(identifier.GetLength() - 1); @@ -128,7 +128,7 @@ CXFA_FMVarExpression::~CXFA_FMVarExpression() {} bool CXFA_FMVarExpression::ToJavaScript(CFX_WideTextBuf& javascript) { javascript << L"var "; CFX_WideString tempName(m_wsName); - if (m_wsName.GetAt(0) == L'!') { + if (m_wsName[0] == L'!') { tempName = EXCLAMATION_IN_IDENTIFIER + m_wsName.Right(m_wsName.GetLength() - 1); } @@ -152,7 +152,7 @@ bool CXFA_FMVarExpression::ToJavaScript(CFX_WideTextBuf& javascript) { bool CXFA_FMVarExpression::ToImpliedReturnJS(CFX_WideTextBuf& javascript) { javascript << L"var "; CFX_WideString tempName(m_wsName); - if (m_wsName.GetAt(0) == L'!') { + if (m_wsName[0] == L'!') { tempName = EXCLAMATION_IN_IDENTIFIER + m_wsName.Right(m_wsName.GetLength() - 1); } @@ -459,7 +459,7 @@ CXFA_FMForExpression::~CXFA_FMForExpression() {} bool CXFA_FMForExpression::ToJavaScript(CFX_WideTextBuf& javascript) { javascript << L"{\nvar "; CFX_WideString tempVariant; - if (m_wsVariant.GetAt(0) == L'!') { + if (m_wsVariant[0] == L'!') { tempVariant = EXCLAMATION_IN_IDENTIFIER + m_wsVariant.Right(m_wsVariant.GetLength() - 1); javascript << tempVariant; @@ -514,7 +514,7 @@ bool CXFA_FMForExpression::ToImpliedReturnJS(CFX_WideTextBuf& javascript) { javascript << L" = 0;\n"; javascript << L"{\nvar "; CFX_WideString tempVariant; - if (m_wsVariant.GetAt(0) == L'!') { + if (m_wsVariant[0] == L'!') { tempVariant = EXCLAMATION_IN_IDENTIFIER + m_wsVariant.Right(m_wsVariant.GetLength() - 1); javascript << tempVariant; @@ -580,7 +580,7 @@ CXFA_FMForeachExpression::~CXFA_FMForeachExpression() {} bool CXFA_FMForeachExpression::ToJavaScript(CFX_WideTextBuf& javascript) { javascript << L"{\n"; javascript << L"var "; - if (m_wsIdentifier.GetAt(0) == L'!') { + if (m_wsIdentifier[0] == L'!') { CFX_WideString tempIdentifier = EXCLAMATION_IN_IDENTIFIER + m_wsIdentifier.Right(m_wsIdentifier.GetLength() - 1); @@ -612,7 +612,7 @@ bool CXFA_FMForeachExpression::ToJavaScript(CFX_WideTextBuf& javascript) { javascript << L" < "; javascript << RUNTIMEBLOCKTEMPARRAY; javascript << L".length)\n{\n"; - if (m_wsIdentifier.GetAt(0) == L'!') { + if (m_wsIdentifier[0] == L'!') { CFX_WideString tempIdentifier = EXCLAMATION_IN_IDENTIFIER + m_wsIdentifier.Right(m_wsIdentifier.GetLength() - 1); @@ -637,7 +637,7 @@ bool CXFA_FMForeachExpression::ToImpliedReturnJS(CFX_WideTextBuf& javascript) { javascript << L" = 0;\n"; javascript << L"{\n"; javascript << L"var "; - if (m_wsIdentifier.GetAt(0) == L'!') { + if (m_wsIdentifier[0] == L'!') { CFX_WideString tempIdentifier = EXCLAMATION_IN_IDENTIFIER + m_wsIdentifier.Right(m_wsIdentifier.GetLength() - 1); @@ -668,7 +668,7 @@ bool CXFA_FMForeachExpression::ToImpliedReturnJS(CFX_WideTextBuf& javascript) { javascript << L" < "; javascript << RUNTIMEBLOCKTEMPARRAY; javascript << L".length)\n{\n"; - if (m_wsIdentifier.GetAt(0) == L'!') { + if (m_wsIdentifier[0] == L'!') { CFX_WideString tempIdentifier = EXCLAMATION_IN_IDENTIFIER + m_wsIdentifier.Right(m_wsIdentifier.GetLength() - 1); diff --git a/xfa/fxfa/parser/cxfa_dataexporter.cpp b/xfa/fxfa/parser/cxfa_dataexporter.cpp index ff9e981e9f..b502bbdfa7 100644 --- a/xfa/fxfa/parser/cxfa_dataexporter.cpp +++ b/xfa/fxfa/parser/cxfa_dataexporter.cpp @@ -58,7 +58,7 @@ CFX_WideString ExportEncodeContent(const CFX_WideStringC& str) { CFX_WideTextBuf textBuf; int32_t iLen = str.GetLength(); for (int32_t i = 0; i < iLen; i++) { - wchar_t ch = str.GetAt(i); + wchar_t ch = str[i]; if (!IsXMLValidChar(ch)) continue; @@ -73,13 +73,13 @@ CFX_WideString ExportEncodeContent(const CFX_WideStringC& str) { } else if (ch == '\"') { textBuf << L"""; } else if (ch == ' ') { - if (i && str.GetAt(i - 1) != ' ') { + if (i && str[i - 1] != ' ') { textBuf.AppendChar(' '); } else { textBuf << L" "; } } else { - textBuf.AppendChar(str.GetAt(i)); + textBuf.AppendChar(str[i]); } } return textBuf.MakeString(); diff --git a/xfa/fxfa/parser/cxfa_layoutpagemgr.cpp b/xfa/fxfa/parser/cxfa_layoutpagemgr.cpp index 55851bb34a..e643bc502f 100644 --- a/xfa/fxfa/parser/cxfa_layoutpagemgr.cpp +++ b/xfa/fxfa/parser/cxfa_layoutpagemgr.cpp @@ -160,7 +160,7 @@ CXFA_Node* ResolveBreakTarget(CXFA_Node* pPageSetRoot, return nullptr; bTargetAllFind = false; - if (wsExpr.GetAt(0) == '#') { + if (wsExpr[0] == '#') { CXFA_Node* pNode = pDocument->GetNodeByID( ToNode(pDocument->GetXFAObject(XFA_HASHCODE_Template)), wsExpr.Right(wsExpr.GetLength() - 1).AsStringC()); diff --git a/xfa/fxfa/parser/cxfa_localemgr.cpp b/xfa/fxfa/parser/cxfa_localemgr.cpp index 633f4b41fd..833f72c33f 100644 --- a/xfa/fxfa/parser/cxfa_localemgr.cpp +++ b/xfa/fxfa/parser/cxfa_localemgr.cpp @@ -1083,10 +1083,9 @@ static uint16_t XFA_GetLanguage(CFX_WideString wsLanguage) { return FX_LANG_en_US; wsLanguage.MakeLower(); - uint32_t dwIDFirst = wsLanguage.GetAt(0) << 8 | wsLanguage.GetAt(1); - uint32_t dwIDSecond = wsLanguage.GetLength() >= 5 - ? wsLanguage.GetAt(3) << 8 | wsLanguage.GetAt(4) - : 0; + uint32_t dwIDFirst = wsLanguage[0] << 8 | wsLanguage[1]; + uint32_t dwIDSecond = + wsLanguage.GetLength() >= 5 ? wsLanguage[3] << 8 | wsLanguage[4] : 0; switch (dwIDFirst) { case FXBSTR_ID(0, 0, 'z', 'h'): if (dwIDSecond == FXBSTR_ID(0, 0, 'c', 'n')) diff --git a/xfa/fxfa/parser/cxfa_measurement.cpp b/xfa/fxfa/parser/cxfa_measurement.cpp index 66b715ec38..1c427209f9 100644 --- a/xfa/fxfa/parser/cxfa_measurement.cpp +++ b/xfa/fxfa/parser/cxfa_measurement.cpp @@ -37,7 +37,7 @@ void CXFA_Measurement::SetString(const CFX_WideStringC& wsMeasure) { return; } int32_t iUsedLen = 0; - int32_t iOffset = (wsMeasure.GetAt(0) == L'=') ? 1 : 0; + int32_t iOffset = (wsMeasure[0] == L'=') ? 1 : 0; float fValue = FXSYS_wcstof(wsMeasure.unterminated_c_str() + iOffset, wsMeasure.GetLength() - iOffset, &iUsedLen); XFA_UNIT eUnit = GetUnitFromString( diff --git a/xfa/fxfa/parser/cxfa_node.cpp b/xfa/fxfa/parser/cxfa_node.cpp index 8497e60a74..2b4bdd22c0 100644 --- a/xfa/fxfa/parser/cxfa_node.cpp +++ b/xfa/fxfa/parser/cxfa_node.cpp @@ -76,7 +76,7 @@ int32_t GetCount(CXFA_Node* pInstMgrNode) { if (iCount == 0) { CFX_WideStringC wsName = pNode->GetCData(XFA_ATTRIBUTE_Name); CFX_WideStringC wsInstName = pInstMgrNode->GetCData(XFA_ATTRIBUTE_Name); - if (wsInstName.GetLength() < 1 || wsInstName.GetAt(0) != '_' || + if (wsInstName.GetLength() < 1 || wsInstName[0] != '_' || wsInstName.Right(wsInstName.GetLength() - 1) != wsName) { return iCount; } @@ -197,7 +197,7 @@ CXFA_Node* GetItem(CXFA_Node* pInstMgrNode, int32_t iIndex) { if (iCount == 0) { CFX_WideStringC wsName = pNode->GetCData(XFA_ATTRIBUTE_Name); CFX_WideStringC wsInstName = pInstMgrNode->GetCData(XFA_ATTRIBUTE_Name); - if (wsInstName.GetLength() < 1 || wsInstName.GetAt(0) != '_' || + if (wsInstName.GetLength() < 1 || wsInstName[0] != '_' || wsInstName.Right(wsInstName.GetLength() - 1) != wsName) { return nullptr; } @@ -406,7 +406,7 @@ void StrToRGB(const CFX_WideString& strRGB, int32_t iIndex = 0; int32_t iLen = strRGB.GetLength(); for (int32_t i = 0; i < iLen; ++i) { - wchar_t ch = strRGB.GetAt(i); + wchar_t ch = strRGB[i]; if (ch == L',') ++iIndex; if (iIndex > 2) @@ -2736,7 +2736,7 @@ void CXFA_Node::Script_Subform_InstanceManager(CFXJSE_Value* pValue, pNode = pNode->GetNodeItem(XFA_NODEITEM_PrevSibling)) { if (pNode->GetElementType() == XFA_Element::InstanceManager) { CFX_WideStringC wsInstMgrName = pNode->GetCData(XFA_ATTRIBUTE_Name); - if (wsInstMgrName.GetLength() >= 1 && wsInstMgrName.GetAt(0) == '_' && + if (wsInstMgrName.GetLength() >= 1 && wsInstMgrName[0] == '_' && wsInstMgrName.Right(wsInstMgrName.GetLength() - 1) == wsName) { pInstanceMgr = pNode; } @@ -4664,7 +4664,7 @@ CXFA_Node* CXFA_Node::GetInstanceMgrOfSubform() { if (eType == XFA_Element::InstanceManager) { CFX_WideStringC wsName = GetCData(XFA_ATTRIBUTE_Name); CFX_WideStringC wsInstName = pNode->GetCData(XFA_ATTRIBUTE_Name); - if (wsInstName.GetLength() > 0 && wsInstName.GetAt(0) == '_' && + if (wsInstName.GetLength() > 0 && wsInstName[0] == '_' && wsInstName.Right(wsInstName.GetLength() - 1) == wsName) { pInstanceMgr = pNode; } diff --git a/xfa/fxfa/parser/cxfa_nodehelper.cpp b/xfa/fxfa/parser/cxfa_nodehelper.cpp index 547831caca..4f1ed04fe3 100644 --- a/xfa/fxfa/parser/cxfa_nodehelper.cpp +++ b/xfa/fxfa/parser/cxfa_nodehelper.cpp @@ -283,7 +283,7 @@ bool CXFA_NodeHelper::CreateNode_ForCondition(CFX_WideString& wsCondition) { m_iCreateFlag = XFA_RESOLVENODE_RSTYPE_CreateNodeOne; return false; } - if (wsCondition.GetAt(0) == '[') { + if (wsCondition[0] == '[') { int32_t i = 1; for (; i < iLen; ++i) { wchar_t ch = wsCondition[i]; @@ -323,12 +323,12 @@ bool CXFA_NodeHelper::ResolveNodes_CreateNode( } bool bIsClassName = false; bool bResult = false; - if (wsName.GetAt(0) == '!') { + if (wsName[0] == '!') { wsName = wsName.Right(wsName.GetLength() - 1); m_pCreateParent = ToNode( pScriptContext->GetDocument()->GetXFAObject(XFA_HASHCODE_Datasets)); } - if (wsName.GetAt(0) == '#') { + if (wsName[0] == '#') { bIsClassName = true; wsName = wsName.Right(wsName.GetLength() - 1); } diff --git a/xfa/fxfa/parser/cxfa_resolveprocessor.cpp b/xfa/fxfa/parser/cxfa_resolveprocessor.cpp index 93b2d86061..9edb3bce81 100644 --- a/xfa/fxfa/parser/cxfa_resolveprocessor.cpp +++ b/xfa/fxfa/parser/cxfa_resolveprocessor.cpp @@ -41,7 +41,7 @@ int32_t CXFA_ResolveProcessor::Resolve(CXFA_ResolveNodesData& rnd) { if (rnd.m_dwStyles & XFA_RESOLVENODE_AnyChild) { return ResolveAnyChild(rnd); } - wchar_t wch = rnd.m_wsName.GetAt(0); + wchar_t wch = rnd.m_wsName[0]; switch (wch) { case '$': return ResolveDollar(rnd); @@ -89,7 +89,7 @@ int32_t CXFA_ResolveProcessor::ResolveAnyChild(CXFA_ResolveNodesData& rnd) { CFX_WideString wsCondition = rnd.m_wsCondition; CXFA_Node* findNode = nullptr; bool bClassName = false; - if (wsName.GetAt(0) == '#') { + if (wsName[0] == '#') { bClassName = true; wsName = wsName.Right(wsName.GetLength() - 1); } diff --git a/xfa/fxfa/parser/cxfa_scriptcontext.cpp b/xfa/fxfa/parser/cxfa_scriptcontext.cpp index 115cd5651e..57caa9981b 100644 --- a/xfa/fxfa/parser/cxfa_scriptcontext.cpp +++ b/xfa/fxfa/parser/cxfa_scriptcontext.cpp @@ -340,7 +340,7 @@ void CXFA_ScriptContext::NormalPropertySetter(CFXJSE_Value* pOriginalValue, pReturnValue, true, (XFA_ATTRIBUTE)lpAttributeInfo->eAttribute); } else { if (pObject->IsNode()) { - if (wsPropName.GetAt(0) == '#') { + if (wsPropName[0] == '#') { wsPropName = wsPropName.Right(wsPropName.GetLength() - 1); } CXFA_Node* pNode = ToNode(pObject); diff --git a/xfa/fxfa/parser/cxfa_widgetdata.cpp b/xfa/fxfa/parser/cxfa_widgetdata.cpp index d68a907e18..5b9f62c93f 100644 --- a/xfa/fxfa/parser/cxfa_widgetdata.cpp +++ b/xfa/fxfa/parser/cxfa_widgetdata.cpp @@ -1215,7 +1215,7 @@ bool CXFA_WidgetData::GetBarcodeAttribute_StartChar(char* val) { CFX_WideStringC wsStartEndChar; if (pUIChild->TryCData(XFA_ATTRIBUTE_StartChar, wsStartEndChar)) { if (wsStartEndChar.GetLength()) { - *val = static_cast(wsStartEndChar.GetAt(0)); + *val = static_cast(wsStartEndChar[0]); return true; } } @@ -1227,7 +1227,7 @@ bool CXFA_WidgetData::GetBarcodeAttribute_EndChar(char* val) { CFX_WideStringC wsStartEndChar; if (pUIChild->TryCData(XFA_ATTRIBUTE_EndChar, wsStartEndChar)) { if (wsStartEndChar.GetLength()) { - *val = static_cast(wsStartEndChar.GetAt(0)); + *val = static_cast(wsStartEndChar[0]); return true; } } -- cgit v1.2.3