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/PublicMethods.cpp b/fpdfsdk/javascript/PublicMethods.cpp
index bf35a67..2996316 100644
--- a/fpdfsdk/javascript/PublicMethods.cpp
+++ b/fpdfsdk/javascript/PublicMethods.cpp
@@ -235,7 +235,7 @@
     if (i - nStart > 10)
       break;
 
-    wchar_t c = str.GetAt(i);
+    wchar_t c = str[i];
     if (!std::iswdigit(c))
       break;
 
@@ -254,7 +254,7 @@
   CFX_WideString swRet;
   nSkip = 0;
   for (int i = nStart, sz = str.GetLength(); i < sz; i++) {
-    wchar_t c = str.GetAt(i);
+    wchar_t c = str[i];
     if (!std::iswdigit(c))
       break;
 
@@ -286,7 +286,7 @@
     if (nIndex > 2)
       break;
 
-    wchar_t c = value.GetAt(i);
+    wchar_t c = value[i];
     if (std::iswdigit(c)) {
       number[nIndex++] = ParseStringInteger(value, i, nSkip, 4);
       i += nSkip;
@@ -373,7 +373,7 @@
     if (bExit)
       break;
 
-    wchar_t c = format.GetAt(i);
+    wchar_t c = format[i];
     switch (c) {
       case ':':
       case '.':
@@ -396,7 +396,7 @@
         int nSkip = 0;
         int remaining = format.GetLength() - i - 1;
 
-        if (remaining == 0 || format.GetAt(i + 1) != c) {
+        if (remaining == 0 || format[i + 1] != c) {
           switch (c) {
             case 'y':
               i++;
@@ -433,12 +433,12 @@
               j += nSkip;
               break;
             case 't':
-              bPm = (j < value.GetLength() && value.GetAt(j) == 'p');
+              bPm = (j < value.GetLength() && value[j] == 'p');
               i++;
               j++;
               break;
           }
-        } else if (remaining == 1 || format.GetAt(i + 2) != c) {
+        } else if (remaining == 1 || format[i + 2] != c) {
           switch (c) {
             case 'y':
               nYear = ParseStringInteger(value, j, nSkip, 4);
@@ -476,13 +476,13 @@
               j += nSkip;
               break;
             case 't':
-              bPm = (j + 1 < value.GetLength() && value.GetAt(j) == 'p' &&
-                     value.GetAt(j + 1) == 'm');
+              bPm = (j + 1 < value.GetLength() && value[j] == 'p' &&
+                     value[j + 1] == 'm');
               i += 2;
               j += 2;
               break;
           }
-        } else if (remaining == 2 || format.GetAt(i + 3) != c) {
+        } else if (remaining == 2 || format[i + 3] != c) {
           switch (c) {
             case 'm': {
               CFX_WideString sMonth = ParseStringString(value, j, nSkip);
@@ -510,7 +510,7 @@
               j += 3;
               break;
           }
-        } else if (remaining == 3 || format.GetAt(i + 4) != c) {
+        } else if (remaining == 3 || format[i + 4] != c) {
           switch (c) {
             case 'y':
               nYear = ParseStringInteger(value, j, nSkip, 4);
@@ -548,7 +548,7 @@
               break;
           }
         } else {
-          if (j >= value.GetLength() || format.GetAt(i) != value.GetAt(j)) {
+          if (j >= value.GetLength() || format[i] != value[j]) {
             bBadFormat = true;
             bExit = true;
           }
@@ -566,7 +566,7 @@
       default:
         if (value.GetLength() <= j) {
           bExit = true;
-        } else if (format.GetAt(i) != value.GetAt(j)) {
+        } else if (format[i] != value[j]) {
           bBadFormat = true;
           bExit = true;
         }
@@ -630,7 +630,7 @@
 
   int i = 0;
   while (i < format.GetLength()) {
-    wchar_t c = format.GetAt(i);
+    wchar_t c = format[i];
     int remaining = format.GetLength() - i - 1;
     sPart = L"";
     switch (c) {
@@ -642,7 +642,7 @@
       case 'M':
       case 's':
       case 't':
-        if (remaining == 0 || format.GetAt(i + 1) != c) {
+        if (remaining == 0 || format[i + 1] != c) {
           switch (c) {
             case 'y':
               sPart += c;
@@ -670,7 +670,7 @@
               break;
           }
           i++;
-        } else if (remaining == 1 || format.GetAt(i + 2) != c) {
+        } else if (remaining == 1 || format[i + 2] != c) {
           switch (c) {
             case 'y':
               sPart.Format(L"%02d", nYear - (nYear / 100) * 100);
@@ -698,7 +698,7 @@
               break;
           }
           i += 2;
-        } else if (remaining == 2 || format.GetAt(i + 3) != c) {
+        } else if (remaining == 2 || format[i + 3] != c) {
           switch (c) {
             case 'm':
               i += 3;
@@ -712,7 +712,7 @@
               sPart += c;
               break;
           }
-        } else if (remaining == 3 || format.GetAt(i + 4) != c) {
+        } else if (remaining == 3 || format[i + 4] != c) {
           switch (c) {
             case 'y':
               sPart.Format(L"%04d", nYear);
@@ -1762,7 +1762,7 @@
   }
 
   CFX_WideString str = params[0].ToCFXWideString(pRuntime);
-  if (str.GetAt(0) == L'.' || str.GetAt(0) == L',')
+  if (str[0] == L'.' || str[0] == L',')
     str = L"0" + str;
 
   CFX_WideString sPart;