Use FX_SAFE_INT32 in more places.

Instead of writing pdfium::base::CheckedNumeric<int32_t>. Also change
fx_safe_types.h to use "using" statements instead of typedefs. Also
remove FX_SAFE_INT64, which is unused.

Change-Id: I568d8cf56704b7c9eb2d11174885c834c7bb64c1
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/65594
Reviewed-by: Tom Sepez <tsepez@chromium.org>
Commit-Queue: Lei Zhang <thestig@chromium.org>
diff --git a/core/fxcodec/tiff/tiffmodule.cpp b/core/fxcodec/tiff/tiffmodule.cpp
index 0258ebc..179fca6 100644
--- a/core/fxcodec/tiff/tiffmodule.cpp
+++ b/core/fxcodec/tiff/tiffmodule.cpp
@@ -276,8 +276,8 @@
   Tiff_Exif_GetStringInfo(m_tif_ctx.get(), TIFFTAG_MAKE, pAttribute);
   Tiff_Exif_GetStringInfo(m_tif_ctx.get(), TIFFTAG_MODEL, pAttribute);
 
-  pdfium::base::CheckedNumeric<int32_t> checked_width = tif_width;
-  pdfium::base::CheckedNumeric<int32_t> checked_height = tif_height;
+  FX_SAFE_INT32 checked_width = tif_width;
+  FX_SAFE_INT32 checked_height = tif_height;
   if (!checked_width.IsValid() || !checked_height.IsValid())
     return false;
 
diff --git a/core/fxcrt/fx_safe_types.h b/core/fxcrt/fx_safe_types.h
index 046a984..6f5b967 100644
--- a/core/fxcrt/fx_safe_types.h
+++ b/core/fxcrt/fx_safe_types.h
@@ -10,10 +10,9 @@
 #include "core/fxcrt/fx_system.h"
 #include "third_party/base/numerics/safe_math.h"
 
-typedef pdfium::base::CheckedNumeric<uint32_t> FX_SAFE_UINT32;
-typedef pdfium::base::CheckedNumeric<int32_t> FX_SAFE_INT32;
-typedef pdfium::base::CheckedNumeric<int64_t> FX_SAFE_INT64;
-typedef pdfium::base::CheckedNumeric<size_t> FX_SAFE_SIZE_T;
-typedef pdfium::base::CheckedNumeric<FX_FILESIZE> FX_SAFE_FILESIZE;
+using FX_SAFE_UINT32 = pdfium::base::CheckedNumeric<uint32_t>;
+using FX_SAFE_INT32 = pdfium::base::CheckedNumeric<int32_t>;
+using FX_SAFE_SIZE_T = pdfium::base::CheckedNumeric<size_t>;
+using FX_SAFE_FILESIZE = pdfium::base::CheckedNumeric<FX_FILESIZE>;
 
 #endif  // CORE_FXCRT_FX_SAFE_TYPES_H_
diff --git a/fxbarcode/BC_TwoDimWriter.cpp b/fxbarcode/BC_TwoDimWriter.cpp
index 61d2b55..b88574c 100644
--- a/fxbarcode/BC_TwoDimWriter.cpp
+++ b/fxbarcode/BC_TwoDimWriter.cpp
@@ -8,6 +8,7 @@
 
 #include <algorithm>
 
+#include "core/fxcrt/fx_safe_types.h"
 #include "core/fxge/cfx_graphstatedata.h"
 #include "core/fxge/cfx_pathdata.h"
 #include "core/fxge/cfx_renderdevice.h"
@@ -34,8 +35,8 @@
   float moduleHSize = std::min(m_ModuleWidth, m_ModuleHeight);
   moduleHSize = std::min(moduleHSize, 8.0f);
   moduleHSize = std::max(moduleHSize, 1.0f);
-  pdfium::base::CheckedNumeric<int32_t> scaledWidth = tempWidth;
-  pdfium::base::CheckedNumeric<int32_t> scaledHeight = tempHeight;
+  FX_SAFE_INT32 scaledWidth = tempWidth;
+  FX_SAFE_INT32 scaledHeight = tempHeight;
   scaledWidth *= moduleHSize;
   scaledHeight *= moduleHSize;
   m_outputWidth = scaledWidth.ValueOrDie();
diff --git a/xfa/fgas/layout/cfx_rtfbreak.cpp b/xfa/fgas/layout/cfx_rtfbreak.cpp
index cba0ba3..78d723b 100644
--- a/xfa/fgas/layout/cfx_rtfbreak.cpp
+++ b/xfa/fgas/layout/cfx_rtfbreak.cpp
@@ -138,7 +138,7 @@
   int32_t iCharWidthValid = iCharWidth.ValueOrDefault(0);
   pCurChar->m_iCharWidth = iCharWidthValid;
   if (iCharWidthValid > 0) {
-    pdfium::base::CheckedNumeric<int32_t> checked_width = m_pCurLine->m_iWidth;
+    FX_SAFE_INT32 checked_width = m_pCurLine->m_iWidth;
     checked_width += iCharWidthValid;
     if (!checked_width.IsValid())
       return;
@@ -226,8 +226,7 @@
       int iCharWidthValid = iCharWidth.ValueOrDefault(0);
       pLastChar->m_iCharWidth = iCharWidthValid;
 
-      pdfium::base::CheckedNumeric<int32_t> checked_width =
-          m_pCurLine->m_iWidth;
+      FX_SAFE_INT32 checked_width = m_pCurLine->m_iWidth;
       checked_width += iCharWidthValid;
       if (!checked_width.IsValid())
         return CFX_BreakType::None;
@@ -256,7 +255,7 @@
   int iCharWidthValid = iCharWidth.ValueOrDefault(0);
   pCurChar->m_iCharWidth = iCharWidthValid;
 
-  pdfium::base::CheckedNumeric<int32_t> checked_width = m_pCurLine->m_iWidth;
+  FX_SAFE_INT32 checked_width = m_pCurLine->m_iWidth;
   checked_width += iCharWidthValid;
   if (!checked_width.IsValid())
     return CFX_BreakType::None;
@@ -286,7 +285,7 @@
   int iCharWidthValid = iCharWidth.ValueOrDefault(0);
   pCurChar->m_iCharWidth = iCharWidthValid;
 
-  pdfium::base::CheckedNumeric<int32_t> checked_width = m_pCurLine->m_iWidth;
+  FX_SAFE_INT32 checked_width = m_pCurLine->m_iWidth;
   checked_width += iCharWidthValid;
   if (!checked_width.IsValid())
     return CFX_BreakType::None;