Remove more CFX_WideTextBuf usage from cfxjse_formcalc_context.cpp
WideString is sufficient for accumulating characters.
Change-Id: I5eed7791639b1c865a86c1925396377215ab29ac
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/91810
Auto-Submit: Tom Sepez <tsepez@chromium.org>
Reviewed-by: Lei Zhang <thestig@chromium.org>
Commit-Queue: Lei Zhang <thestig@chromium.org>
diff --git a/fxjs/xfa/cfxjse_formcalc_context.cpp b/fxjs/xfa/cfxjse_formcalc_context.cpp
index a18bbe0..a5a4650 100644
--- a/fxjs/xfa/cfxjse_formcalc_context.cpp
+++ b/fxjs/xfa/cfxjse_formcalc_context.cpp
@@ -4415,20 +4415,17 @@
return;
}
- CFX_WideTextBuf upperStringBuf;
ByteString bsArg = ValueToUTF8String(info.GetIsolate(), argOne);
WideString wsArg = WideString::FromUTF8(bsArg.AsStringView());
- const wchar_t* pData = wsArg.c_str();
- size_t i = 0;
- while (i < wsArg.GetLength()) {
- int32_t ch = pData[i];
+ WideString upperStringBuf;
+ upperStringBuf.Reserve(wsArg.GetLength());
+ for (wchar_t ch : wsArg) {
if ((ch >= 0x61 && ch <= 0x7A) || (ch >= 0xE0 && ch <= 0xFE))
ch -= 32;
else if (ch == 0x101 || ch == 0x103 || ch == 0x105)
ch -= 1;
- upperStringBuf.AppendChar(ch);
- ++i;
+ upperStringBuf += ch;
}
info.GetReturnValue().Set(fxv8::NewStringHelper(
info.GetIsolate(),