Replace UTIL_* definitions with DataType enum class

Bug: pdfium:1085
Change-Id: Iccf276068dacae939c88f0fe508cc88d6b4a0a31
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/80572
Reviewed-by: Lei Zhang <thestig@chromium.org>
Commit-Queue: Tom Sepez <tsepez@chromium.org>
diff --git a/fxjs/cjs_util_unittest.cpp b/fxjs/cjs_util_unittest.cpp
index b4c07f7..77fa270 100644
--- a/fxjs/cjs_util_unittest.cpp
+++ b/fxjs/cjs_util_unittest.cpp
@@ -10,99 +10,99 @@
 TEST(CJS_Util, ParseDataType) {
   struct ParseDataTypeCase {
     const wchar_t* const input_string;
-    const int expected;
+    const CJS_Util::DataType expected;
   };
 
   // Commented out tests follow the spec but are not passing.
   const ParseDataTypeCase cases[] = {
       // Not conversions
-      {L"", -1},
-      {L"d", -1},
+      {L"", CJS_Util::DataType::kInvalid},
+      {L"d", CJS_Util::DataType::kInvalid},
 
       // Simple cases
-      {L"%d", UTIL_INT},
-      {L"%x", UTIL_INT},
-      {L"%f", UTIL_DOUBLE},
-      {L"%s", UTIL_STRING},
+      {L"%d", CJS_Util::DataType::kInt},
+      {L"%x", CJS_Util::DataType::kInt},
+      {L"%f", CJS_Util::DataType::kDouble},
+      {L"%s", CJS_Util::DataType::kString},
 
       // nDecSep Not implemented
-      // {L"%,0d", UTIL_INT},
-      // {L"%,1d", UTIL_INT},
-      // {L"%,2d", UTIL_INT},
-      // {L"%,3d", UTIL_INT},
+      // {L"%,0d", CJS_Util::DataType::kInt},
+      // {L"%,1d", CJS_Util::DataType::kInt},
+      // {L"%,2d", CJS_Util::DataType::kInt},
+      // {L"%,3d", CJS_Util::DataType::kInt},
       // {L"%,4d", -1},
       // {L"%,d", -1},
 
       // cFlags("+ 0#"") are only valid for numeric conversions.
-      {L"%+d", UTIL_INT},
-      {L"%+x", UTIL_INT},
-      {L"%+f", UTIL_DOUBLE},
+      {L"%+d", CJS_Util::DataType::kInt},
+      {L"%+x", CJS_Util::DataType::kInt},
+      {L"%+f", CJS_Util::DataType::kDouble},
       // {L"%+s", -1},
-      {L"% d", UTIL_INT},
-      {L"% x", UTIL_INT},
-      {L"% f", UTIL_DOUBLE},
+      {L"% d", CJS_Util::DataType::kInt},
+      {L"% x", CJS_Util::DataType::kInt},
+      {L"% f", CJS_Util::DataType::kDouble},
       // {L"% s", -1},
-      {L"%0d", UTIL_INT},
-      {L"%0x", UTIL_INT},
-      {L"%0f", UTIL_DOUBLE},
+      {L"%0d", CJS_Util::DataType::kInt},
+      {L"%0x", CJS_Util::DataType::kInt},
+      {L"%0f", CJS_Util::DataType::kDouble},
       // {L"%0s", -1},
-      {L"%#d", UTIL_INT},
-      {L"%#x", UTIL_INT},
-      {L"%#f", UTIL_DOUBLE},
+      {L"%#d", CJS_Util::DataType::kInt},
+      {L"%#x", CJS_Util::DataType::kInt},
+      {L"%#f", CJS_Util::DataType::kDouble},
       // {L"%#s", -1},
 
       // nWidth should work. for all conversions, can be combined with cFlags=0
       // for numbers.
-      {L"%5d", UTIL_INT},
-      {L"%05d", UTIL_INT},
-      {L"%5x", UTIL_INT},
-      {L"%05x", UTIL_INT},
-      {L"%5f", UTIL_DOUBLE},
-      {L"%05f", UTIL_DOUBLE},
-      {L"%5s", UTIL_STRING},
+      {L"%5d", CJS_Util::DataType::kInt},
+      {L"%05d", CJS_Util::DataType::kInt},
+      {L"%5x", CJS_Util::DataType::kInt},
+      {L"%05x", CJS_Util::DataType::kInt},
+      {L"%5f", CJS_Util::DataType::kDouble},
+      {L"%05f", CJS_Util::DataType::kDouble},
+      {L"%5s", CJS_Util::DataType::kString},
       // {L"%05s", -1},
 
       // nPrecision should only work for float
       // {L"%.5d", -1},
       // {L"%.5x", -1},
-      {L"%.5f", UTIL_DOUBLE},
+      {L"%.5f", CJS_Util::DataType::kDouble},
       // {L"%.5s", -1},
       // {L"%.14d", -1},
       // {L"%.14x", -1},
-      {L"%.14f", UTIL_DOUBLE},
+      {L"%.14f", CJS_Util::DataType::kDouble},
       // {L"%.14s", -1},
       // {L"%.f", -1},
 
       // See https://crbug.com/740166
       // nPrecision too large (> 260) causes crashes in Windows.
       // Avoid this by limiting to two digits
-      {L"%.1d", UTIL_INT},
-      {L"%.10d", UTIL_INT},
-      {L"%.100d", -1},
+      {L"%.1d", CJS_Util::DataType::kInt},
+      {L"%.10d", CJS_Util::DataType::kInt},
+      {L"%.100d", CJS_Util::DataType::kInvalid},
 
       // Unexpected characters
-      {L"%ad", -1},
-      {L"%bx", -1},
-      // {L"%cf", -1},
-      // {L"%es", -1},
-      // {L"%gd", -1},
-      {L"%hx", -1},
-      // {L"%if", -1},
-      {L"%js", -1},
-      {L"%@d", -1},
-      {L"%~x", -1},
-      {L"%[f", -1},
-      {L"%\0s", -1},
-      {L"%\nd", -1},
-      {L"%\rx", -1},
-      // {L"%%f", -1},
-      // {L"%  s", -1},
+      {L"%ad", CJS_Util::DataType::kInvalid},
+      {L"%bx", CJS_Util::DataType::kInvalid},
+      // {L"%cf", CJS_Util::DataType::kInvalid},
+      // {L"%es", CJS_Util::DataType::kInvalid},
+      // {L"%gd", CJS_Util::DataType::kInvalid},
+      {L"%hx", CJS_Util::DataType::kInvalid},
+      // {L"%if", CJS_Util::DataType::kInvalid},
+      {L"%js", CJS_Util::DataType::kInvalid},
+      {L"%@d", CJS_Util::DataType::kInvalid},
+      {L"%~x", CJS_Util::DataType::kInvalid},
+      {L"%[f", CJS_Util::DataType::kInvalid},
+      {L"%\0s", CJS_Util::DataType::kInvalid},
+      {L"%\nd", CJS_Util::DataType::kInvalid},
+      {L"%\rx", CJS_Util::DataType::kInvalid},
+      // {L"%%f", CJS_Util::DataType::kInvalid},
+      // {L"%  s", CJS_Util::DataType::kInvalid},
 
       // Combine multiple valid components
-      {L"%+6d", UTIL_INT},
-      {L"% 7x", UTIL_INT},
-      {L"%#9.3f", UTIL_DOUBLE},
-      {L"%10s", UTIL_STRING},
+      {L"%+6d", CJS_Util::DataType::kInt},
+      {L"% 7x", CJS_Util::DataType::kInt},
+      {L"%#9.3f", CJS_Util::DataType::kDouble},
+      {L"%10s", CJS_Util::DataType::kString},
   };
 
   for (size_t i = 0; i < pdfium::size(cases); i++) {