Avoid virtual method CBC_OnedCodaBarWriter::FindChar()

- Make into anonymous function.
- Rename to better describe purpose.

Change-Id: I1946d2a450c6f4e8915a8e0987743bf028ab7768
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/91870
Commit-Queue: Tom Sepez <tsepez@chromium.org>
Auto-Submit: Tom Sepez <tsepez@chromium.org>
Reviewed-by: Lei Zhang <thestig@chromium.org>
Commit-Queue: Lei Zhang <thestig@chromium.org>
diff --git a/fxbarcode/oned/BC_OnedCodaBarWriter.cpp b/fxbarcode/oned/BC_OnedCodaBarWriter.cpp
index 922e488..6c4da2d 100644
--- a/fxbarcode/oned/BC_OnedCodaBarWriter.cpp
+++ b/fxbarcode/oned/BC_OnedCodaBarWriter.cpp
@@ -46,9 +46,18 @@
 
 const char kStartEndChars[] = {'A', 'B', 'C', 'D', 'T', 'N', '*', 'E',
                                'a', 'b', 'c', 'd', 't', 'n', 'e'};
-const char kCOntentChars[] = {'0', '1', '2', '3', '4', '5', '6', '7',
+const char kContentChars[] = {'0', '1', '2', '3', '4', '5', '6', '7',
                               '8', '9', '-', '$', '/', ':', '+', '.'};
 
+bool IsValidChar(wchar_t ch, bool isContent) {
+  if (ch > 0x7F)
+    return false;
+
+  char narrow_ch = static_cast<char>(ch);
+  return pdfium::Contains(kContentChars, narrow_ch) ||
+         (isContent && pdfium::Contains(kStartEndChars, narrow_ch));
+}
+
 }  // namespace
 
 CBC_OnedCodaBarWriter::CBC_OnedCodaBarWriter() = default;
@@ -87,20 +96,10 @@
   return true;
 }
 
-bool CBC_OnedCodaBarWriter::FindChar(wchar_t ch, bool isContent) {
-  if (ch > 0x7F)
-    return false;
-
-  char narrow_ch = static_cast<char>(ch);
-  return pdfium::Contains(kCOntentChars, narrow_ch) ||
-         (isContent && pdfium::Contains(kStartEndChars, narrow_ch));
-}
-
 bool CBC_OnedCodaBarWriter::CheckContentValidity(WideStringView contents) {
   return HasValidContentSize(contents) &&
-         std::all_of(
-             contents.begin(), contents.end(),
-             [this](const wchar_t& ch) { return this->FindChar(ch, false); });
+         std::all_of(contents.begin(), contents.end(),
+                     [](const wchar_t& ch) { return IsValidChar(ch, false); });
 }
 
 WideString CBC_OnedCodaBarWriter::FilterContents(WideStringView contents) {
@@ -113,7 +112,7 @@
       index++;
       continue;
     }
-    if (!FindChar(ch, true))
+    if (!IsValidChar(ch, true))
       continue;
     filtercontents += ch;
   }
diff --git a/fxbarcode/oned/BC_OnedCodaBarWriter.h b/fxbarcode/oned/BC_OnedCodaBarWriter.h
index 45b76e4..f634b2c 100644
--- a/fxbarcode/oned/BC_OnedCodaBarWriter.h
+++ b/fxbarcode/oned/BC_OnedCodaBarWriter.h
@@ -18,7 +18,7 @@
   CBC_OnedCodaBarWriter();
   ~CBC_OnedCodaBarWriter() override;
 
-  // CBC_OneDimWriter
+  // CBC_OneDimWriter:
   uint8_t* EncodeImpl(const ByteString& contents, int32_t& outLength) override;
   uint8_t* EncodeWithHint(const ByteString& contents,
                           BC_TYPE format,
@@ -36,8 +36,6 @@
   bool SetStartChar(char start) override;
   bool SetEndChar(char end) override;
 
-  virtual bool FindChar(wchar_t ch, bool isContent);
-
   WideString encodedContents(WideStringView contents);
 
  private: