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 <rharrison@chromium.org>
Reviewed-by: Tom Sepez <tsepez@chromium.org>
diff --git a/fpdfsdk/javascript/Document.cpp b/fpdfsdk/javascript/Document.cpp
index 77878a5..9b82147 100644
--- a/fpdfsdk/javascript/Document.cpp
+++ b/fpdfsdk/javascript/Document.cpp
@@ -1018,7 +1018,7 @@
CFX_WideString wsFilePath = m_pFormFillEnv->JS_docGetFilePath();
int32_t i = wsFilePath.GetLength() - 1;
for (; i >= 0; i--) {
- if (wsFilePath.GetAt(i) == L'\\' || wsFilePath.GetAt(i) == L'/')
+ if (wsFilePath[i] == L'\\' || wsFilePath[i] == L'/')
break;
}
if (i >= 0 && i < wsFilePath.GetLength() - 1) {