diff options
Diffstat (limited to 'xfa')
-rw-r--r-- | xfa/fgas/layout/fgas_rtfbreak_unittest.cpp | 8 | ||||
-rw-r--r-- | xfa/fxfa/fm2js/xfa_fm2jscontext.cpp | 7 |
2 files changed, 6 insertions, 9 deletions
diff --git a/xfa/fgas/layout/fgas_rtfbreak_unittest.cpp b/xfa/fgas/layout/fgas_rtfbreak_unittest.cpp index d84621a595..cc3c86cadb 100644 --- a/xfa/fgas/layout/fgas_rtfbreak_unittest.cpp +++ b/xfa/fgas/layout/fgas_rtfbreak_unittest.cpp @@ -53,8 +53,8 @@ TEST_F(RTFBreakTest, AddChars) { auto b = CreateBreak(FX_LAYOUTSTYLE_ExpandTab); CFX_WideString str(L"Input String."); - for (int32_t i = 0; i < str.GetLength(); i++) - EXPECT_EQ(CFX_BreakType::None, b->AppendChar(str.GetAt(i))); + for (const auto& c : str) + EXPECT_EQ(CFX_BreakType::None, b->AppendChar(c)); EXPECT_EQ(CFX_BreakType::Paragraph, b->AppendChar(L'\n')); ASSERT_EQ(1, b->CountBreakPieces()); @@ -65,8 +65,8 @@ TEST_F(RTFBreakTest, AddChars) { EXPECT_EQ(0, b->GetCurrentLineForTesting()->GetLineEnd()); str = L"Second str."; - for (int32_t i = 0; i < str.GetLength(); i++) - EXPECT_EQ(CFX_BreakType::None, b->AppendChar(str.GetAt(i))); + for (const auto& c : str) + EXPECT_EQ(CFX_BreakType::None, b->AppendChar(c)); // Force the end of the break at the end of the string. b->EndBreak(CFX_BreakType::Paragraph); diff --git a/xfa/fxfa/fm2js/xfa_fm2jscontext.cpp b/xfa/fxfa/fm2js/xfa_fm2jscontext.cpp index ead2a7dbe3..4621dfe134 100644 --- a/xfa/fxfa/fm2js/xfa_fm2jscontext.cpp +++ b/xfa/fxfa/fm2js/xfa_fm2jscontext.cpp @@ -3472,8 +3472,7 @@ void CXFA_FM2JSContext::EncodeURL(const CFX_ByteStringC& szURLString, wchar_t strReserved[] = {';', '/', '?', ':', '@', '=', '&'}; wchar_t strSpecial[] = {'$', '-', '+', '!', '*', '\'', '(', ')', ','}; const wchar_t* strCode = L"0123456789abcdef"; - for (int32_t u = 0; u < wsURLString.GetLength(); ++u) { - wchar_t ch = wsURLString.GetAt(u); + for (auto ch : wsURLString) { int32_t i = 0; int32_t iCount = FX_ArraySize(strUnsafe); while (i < iCount) { @@ -3624,9 +3623,7 @@ void CXFA_FM2JSContext::EncodeXML(const CFX_ByteStringC& szXMLString, strEncode[7] = ';'; strEncode[8] = 0; const wchar_t* strCode = L"0123456789abcdef"; - const wchar_t* pData = wsXMLString.c_str(); - for (int32_t u = 0; u < wsXMLString.GetLength(); ++u) { - wchar_t ch = pData[u]; + for (const auto& ch : wsXMLString) { switch (ch) { case '"': wsResultBuf.AppendChar('&'); |