Try to make pdf_cfx_barcode_fuzzer result more consistent.

Generate the same widestring for testing regardless of whether
the platform uses a 2 or 4 byte representation. May make test
cases more portable across platforms.

Change-Id: I92343811cb4ec5d1bc4efc227649155ff0409f89
Reviewed-on: https://pdfium-review.googlesource.com/c/45890
Commit-Queue: Tom Sepez <tsepez@chromium.org>
Reviewed-by: Lei Zhang <thestig@chromium.org>
diff --git a/testing/fuzzers/pdf_cfx_barcode_fuzzer.cc b/testing/fuzzers/pdf_cfx_barcode_fuzzer.cc
index aaeebf3..c4e0ca4 100644
--- a/testing/fuzzers/pdf_cfx_barcode_fuzzer.cc
+++ b/testing/fuzzers/pdf_cfx_barcode_fuzzer.cc
@@ -8,14 +8,14 @@
 #include "xfa/fwl/cfx_barcode.h"
 
 extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
-  if (size < 2 * sizeof(wchar_t))
+  if (size < 2 * sizeof(uint16_t))
     return 0;
 
   BC_TYPE type = static_cast<BC_TYPE>(data[0] % (BC_DATAMATRIX + 1));
 
-  // Only used one byte, but align with wchar_t for string below.
-  data += sizeof(wchar_t);
-  size -= sizeof(wchar_t);
+  // Only used one byte, but align with uint16_t for string below.
+  data += sizeof(uint16_t);
+  size -= sizeof(uint16_t);
 
   auto barcode = CFX_Barcode::Create(type);
   if (!barcode)
@@ -27,10 +27,10 @@
   barcode->SetHeight(298);
   barcode->SetWidth(418);
 
-  WideStringView content(reinterpret_cast<const wchar_t*>(data),
-                         size / sizeof(wchar_t));
+  WideString content = WideString::FromUTF16LE(
+      reinterpret_cast<const uint16_t*>(data), size / sizeof(uint16_t));
 
-  if (!barcode->Encode(content))
+  if (!barcode->Encode(content.AsStringView()))
     return 0;
 
   // TODO(tsepez): Output to device.