Get rid of some needless pointer arithmetic in fx_string.cpp.
Change-Id: I57b00ac7abc7cdaeb9a9a6573c48e6061a27a027
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/51992
Reviewed-by: Lei Zhang <thestig@chromium.org>
Commit-Queue: Tom Sepez <tsepez@chromium.org>
diff --git a/core/fxcrt/fx_string.cpp b/core/fxcrt/fx_string.cpp
index b55931c..cb7465e 100644
--- a/core/fxcrt/fx_string.cpp
+++ b/core/fxcrt/fx_string.cpp
@@ -15,11 +15,9 @@
#include "third_party/base/compiler_specific.h"
ByteString FX_UTF8Encode(WideStringView wsStr) {
- size_t len = wsStr.GetLength();
- const wchar_t* pStr = wsStr.unterminated_c_str();
CFX_UTF8Encoder encoder;
- while (len-- > 0)
- encoder.Input(*pStr++);
+ for (size_t i = 0; i < wsStr.GetLength(); ++i)
+ encoder.Input(wsStr[i]);
return ByteString(encoder.GetResult());
}