From 3c3e271ea9fd19dd535a74b5546b27e3e82dcb81 Mon Sep 17 00:00:00 2001 From: Tom Sepez Date: Mon, 17 Apr 2017 15:38:19 -0700 Subject: Use Byte/WideString iterators Change-Id: I85c8423c177fd7ecd5da90ef89419efc0f9cf44b Reviewed-on: https://pdfium-review.googlesource.com/4262 Reviewed-by: Lei Zhang Commit-Queue: Tom Sepez --- xfa/fxfa/fm2js/xfa_fm2jscontext.cpp | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) (limited to 'xfa/fxfa') 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('&'); -- cgit v1.2.3