Convert some WideString::CompareNoCase() to EqualsASCIINoCase().

Then remove some wasted padding by converting L"" literals to "".

-- Fixes botch in CharEncodingFromString() where `== 0` was missing.

Change-Id: Ia1647cf7db6e6f073f35d9560b89d751dd1e92f1
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/117551
Reviewed-by: Lei Zhang <thestig@chromium.org>
Reviewed-by: Thomas Sepez <tsepez@google.com>
Commit-Queue: Tom Sepez <tsepez@chromium.org>
diff --git a/fpdfsdk/fpdfxfa/cpdfxfa_docenvironment.cpp b/fpdfsdk/fpdfxfa/cpdfxfa_docenvironment.cpp
index 199e0a3..9180d6c 100644
--- a/fpdfsdk/fpdfxfa/cpdfxfa_docenvironment.cpp
+++ b/fpdfsdk/fpdfxfa/cpdfxfa_docenvironment.cpp
@@ -660,11 +660,10 @@
                                         WideString& csMsg) {
   WideString srcURL = csURL;
   srcURL.TrimWhitespaceFront();
-  if (srcURL.Left(7).CompareNoCase(L"mailto:") != 0)
+  if (!srcURL.Left(7).EqualsASCIINoCase("mailto:")) {
     return false;
-
+  }
   auto pos = srcURL.Find(L'?');
-
   {
     WideString tmp;
     if (!pos.has_value()) {
@@ -687,23 +686,21 @@
     pos = srcURL.Find(L'&');
     WideString tmp = (!pos.has_value()) ? srcURL : srcURL.Left(pos.value());
     tmp.TrimWhitespace();
-    if (tmp.GetLength() >= 3 && tmp.Left(3).CompareNoCase(L"cc=") == 0) {
+    if (tmp.GetLength() >= 3 && tmp.Left(3).EqualsASCIINoCase("cc=")) {
       tmp = tmp.Right(tmp.GetLength() - 3);
       if (!csCCAddress.IsEmpty())
         csCCAddress += L';';
       csCCAddress += tmp;
-    } else if (tmp.GetLength() >= 4 &&
-               tmp.Left(4).CompareNoCase(L"bcc=") == 0) {
+    } else if (tmp.GetLength() >= 4 && tmp.Left(4).EqualsASCIINoCase("bcc=")) {
       tmp = tmp.Right(tmp.GetLength() - 4);
       if (!csBCCAddress.IsEmpty())
         csBCCAddress += L';';
       csBCCAddress += tmp;
     } else if (tmp.GetLength() >= 8 &&
-               tmp.Left(8).CompareNoCase(L"subject=") == 0) {
+               tmp.Left(8).EqualsASCIINoCase("subject=")) {
       tmp = tmp.Right(tmp.GetLength() - 8);
       csSubject += tmp;
-    } else if (tmp.GetLength() >= 5 &&
-               tmp.Left(5).CompareNoCase(L"body=") == 0) {
+    } else if (tmp.GetLength() >= 5 && tmp.Left(5).EqualsASCIINoCase("body=")) {
       tmp = tmp.Right(tmp.GetLength() - 5);
       csMsg += tmp;
     }
@@ -952,7 +949,7 @@
   if (!pFileHandler)
     return false;
 
-  if (csURL.Left(7).CompareNoCase(L"mailto:") == 0) {
+  if (csURL.Left(7).EqualsASCIINoCase("mailto:")) {
     WideString csToAddress;
     WideString csCCAddress;
     WideString csBCCAddress;
diff --git a/fxjs/cjs_publicmethods.cpp b/fxjs/cjs_publicmethods.cpp
index 2f1dc7d..379bed7 100644
--- a/fxjs/cjs_publicmethods.cpp
+++ b/fxjs/cjs_publicmethods.cpp
@@ -543,7 +543,7 @@
             case 'm':
               i += 3;
               if (FX_IsValidMonth(nMonth))
-                sPart += fxjs::kMonths[nMonth - 1];
+                sPart += WideString::FromASCII(fxjs::kMonths[nMonth - 1]);
               break;
             default:
               i += 3;
@@ -561,7 +561,7 @@
             case 'm':
               i += 4;
               if (FX_IsValidMonth(nMonth))
-                sPart += fxjs::kFullMonths[nMonth - 1];
+                sPart += WideString::FromASCII(fxjs::kFullMonths[nMonth - 1]);
               break;
             default:
               i += 4;
@@ -933,7 +933,7 @@
   int nMonth = 1;
   sTemp = wsArray[1];
   for (size_t i = 0; i < std::size(fxjs::kMonths); ++i) {
-    if (sTemp == fxjs::kMonths[i]) {
+    if (sTemp.EqualsASCII(fxjs::kMonths[i])) {
       nMonth = static_cast<int>(i) + 1;
       break;
     }
diff --git a/fxjs/fx_date_helpers.cpp b/fxjs/fx_date_helpers.cpp
index 3d7d1f3..9601e96 100644
--- a/fxjs/fx_date_helpers.cpp
+++ b/fxjs/fx_date_helpers.cpp
@@ -168,14 +168,12 @@
 
 }  // namespace
 
-const wchar_t* const kMonths[12] = {L"Jan", L"Feb", L"Mar", L"Apr",
-                                    L"May", L"Jun", L"Jul", L"Aug",
-                                    L"Sep", L"Oct", L"Nov", L"Dec"};
+const char* const kMonths[12] = {"Jan", "Feb", "Mar", "Apr", "May", "Jun",
+                                 "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"};
 
-const wchar_t* const kFullMonths[12] = {L"January", L"February", L"March",
-                                        L"April",   L"May",      L"June",
-                                        L"July",    L"August",   L"September",
-                                        L"October", L"November", L"December"};
+const char* const kFullMonths[12] = {
+    "January", "February", "March",     "April",   "May",      "June",
+    "July",    "August",   "September", "October", "November", "December"};
 
 static constexpr size_t KMonthAbbreviationLength = 3;  // Anything in |kMonths|.
 static constexpr size_t kLongestFullMonthLength = 9;   // September
@@ -436,7 +434,7 @@
               if (nSkip == KMonthAbbreviationLength) {
                 WideString sMonth = value.Substr(j, KMonthAbbreviationLength);
                 for (size_t m = 0; m < std::size(kMonths); ++m) {
-                  if (sMonth.CompareNoCase(kMonths[m]) == 0) {
+                  if (sMonth.EqualsASCIINoCase(kMonths[m])) {
                     nMonth = static_cast<int>(m) + 1;
                     i += 3;
                     j += nSkip;
@@ -473,7 +471,7 @@
                 WideString sMonth = value.Substr(j, nSkip);
                 sMonth.MakeLower();
                 for (size_t m = 0; m < std::size(kFullMonths); ++m) {
-                  WideString sFullMonths = WideString(kFullMonths[m]);
+                  auto sFullMonths = WideString::FromASCII(kFullMonths[m]);
                   sFullMonths.MakeLower();
                   if (sFullMonths.Contains(sMonth.AsStringView())) {
                     nMonth = static_cast<int>(m) + 1;
diff --git a/fxjs/fx_date_helpers.h b/fxjs/fx_date_helpers.h
index 6f6f403..ca730e5 100644
--- a/fxjs/fx_date_helpers.h
+++ b/fxjs/fx_date_helpers.h
@@ -15,8 +15,8 @@
 
 enum class ConversionStatus { kSuccess = 0, kBadFormat, kBadDate };
 
-extern const wchar_t* const kMonths[12];
-extern const wchar_t* const kFullMonths[12];
+extern const char* const kMonths[12];
+extern const char* const kFullMonths[12];
 
 double FX_GetDateTime();
 int FX_GetYearFromTime(double dt);
diff --git a/xfa/fxfa/cxfa_ffbarcode.cpp b/xfa/fxfa/cxfa_ffbarcode.cpp
index 94acad2..176c77f 100644
--- a/xfa/fxfa/cxfa_ffbarcode.cpp
+++ b/xfa/fxfa/cxfa_ffbarcode.cpp
@@ -95,10 +95,12 @@
 
 std::optional<BC_CHAR_ENCODING> CharEncodingFromString(
     const WideString& value) {
-  if (value.CompareNoCase(L"UTF-16"))
+  if (value.EqualsASCIINoCase("UTF-16")) {
     return BC_CHAR_ENCODING::kUnicode;
-  if (value.CompareNoCase(L"UTF-8"))
+  }
+  if (value.EqualsASCIINoCase("UTF-8")) {
     return BC_CHAR_ENCODING::kUTF8;
+  }
   return std::nullopt;
 }