Remove FX_STRSIZE and replace with size_t

BUG=pdfium:828

Change-Id: I5c40237433ebabaeabdb43aec9cdf783e41dfe16
Reviewed-on: https://pdfium-review.googlesource.com/13230
Reviewed-by: dsinclair <dsinclair@chromium.org>
Commit-Queue: Ryan Harrison <rharrison@chromium.org>
diff --git a/core/fpdfapi/font/cpdf_cmap.cpp b/core/fpdfapi/font/cpdf_cmap.cpp
index 54f7b34..1eabfff 100644
--- a/core/fpdfapi/font/cpdf_cmap.cpp
+++ b/core/fpdfapi/font/cpdf_cmap.cpp
@@ -182,13 +182,13 @@
 };
 
 int CheckFourByteCodeRange(uint8_t* codes,
-                           FX_STRSIZE size,
+                           size_t size,
                            const std::vector<CPDF_CMap::CodeRange>& ranges) {
   for (size_t i = ranges.size(); i > 0; i--) {
     size_t seg = i - 1;
     if (ranges[seg].m_CharSize < size)
       continue;
-    FX_STRSIZE iChar = 0;
+    size_t iChar = 0;
     while (iChar < size) {
       if (codes[iChar] < ranges[seg].m_Lower[iChar] ||
           codes[iChar] > ranges[seg].m_Upper[iChar]) {
@@ -214,13 +214,13 @@
   codes[0] = codes[1] = 0x00;
   codes[2] = static_cast<uint8_t>(charcode >> 8 & 0xFF);
   codes[3] = static_cast<uint8_t>(charcode);
-  for (FX_STRSIZE offset = 0; offset < 4; offset++) {
-    FX_STRSIZE size = 4 - offset;
+  for (size_t offset = 0; offset < 4; offset++) {
+    size_t size = 4 - offset;
     for (size_t j = 0; j < ranges.size(); j++) {
       size_t iSeg = (ranges.size() - 1) - j;
       if (ranges[iSeg].m_CharSize < size)
         continue;
-      FX_STRSIZE iChar = 0;
+      size_t iChar = 0;
       while (iChar < size) {
         if (codes[offset + iChar] < ranges[iSeg].m_Lower[iChar] ||
             codes[offset + iChar] > ranges[iSeg].m_Upper[iChar]) {
diff --git a/core/fpdfapi/font/cpdf_cmap.h b/core/fpdfapi/font/cpdf_cmap.h
index 6e90c39..493d300 100644
--- a/core/fpdfapi/font/cpdf_cmap.h
+++ b/core/fpdfapi/font/cpdf_cmap.h
@@ -36,7 +36,7 @@
   };
 
   struct CodeRange {
-    FX_STRSIZE m_CharSize;
+    size_t m_CharSize;
     uint8_t m_Lower[4];
     uint8_t m_Upper[4];
   };
diff --git a/core/fpdfapi/font/cpdf_cmapparser.cpp b/core/fpdfapi/font/cpdf_cmapparser.cpp
index f7d4dc1..a5d7977 100644
--- a/core/fpdfapi/font/cpdf_cmapparser.cpp
+++ b/core/fpdfapi/font/cpdf_cmapparser.cpp
@@ -141,8 +141,7 @@
     return 0;
   pdfium::base::CheckedNumeric<uint32_t> num = 0;
   if (word[0] == '<') {
-    for (FX_STRSIZE i = 1; i < word.GetLength() && std::isxdigit(word[i]);
-         ++i) {
+    for (size_t i = 1; i < word.GetLength() && std::isxdigit(word[i]); ++i) {
       num = num * 16 + FXSYS_HexCharToInt(word[i]);
       if (!num.IsValid())
         return 0;
@@ -150,7 +149,7 @@
     return num.ValueOrDie();
   }
 
-  for (FX_STRSIZE i = 0; i < word.GetLength() && std::isdigit(word[i]); ++i) {
+  for (size_t i = 0; i < word.GetLength() && std::isdigit(word[i]); ++i) {
     num = num * 10 + FXSYS_DecimalCharToInt(static_cast<wchar_t>(word[i]));
     if (!num.IsValid())
       return 0;
@@ -165,7 +164,7 @@
   if (first.GetLength() == 0 || first[0] != '<')
     return false;
 
-  FX_STRSIZE i;
+  size_t i;
   for (i = 1; i < first.GetLength(); ++i) {
     if (first[i] == '>') {
       break;
@@ -182,7 +181,7 @@
         FXSYS_HexCharToInt(digit1) * 16 + FXSYS_HexCharToInt(digit2);
   }
 
-  FX_STRSIZE size = second.GetLength();
+  size_t size = second.GetLength();
   for (i = 0; i < range.m_CharSize; ++i) {
     uint8_t digit1 = (i * 2 + 1 < size) ? second[i * 2 + 1] : '0';
     uint8_t digit2 = (i * 2 + 2 < size) ? second[i * 2 + 2] : '0';
diff --git a/core/fpdfapi/page/cpdf_image.cpp b/core/fpdfapi/page/cpdf_image.cpp
index 4c08336..d722c22 100644
--- a/core/fpdfapi/page/cpdf_image.cpp
+++ b/core/fpdfapi/page/cpdf_image.cpp
@@ -171,7 +171,7 @@
   pDict->SetNewFor<CPDF_Number>("Height", BitmapHeight);
 
   const int32_t bpp = pBitmap->GetBPP();
-  FX_STRSIZE dest_pitch = 0;
+  size_t dest_pitch = 0;
   bool bCopyWithoutAlpha = true;
   if (bpp == 1) {
     int32_t reset_a = 0;
@@ -285,7 +285,7 @@
   int32_t src_pitch = pBitmap->GetPitch();
   uint8_t* dest_buf = FX_Alloc2D(uint8_t, dest_pitch, BitmapHeight);
   // Safe as checked alloc returned.
-  FX_STRSIZE dest_size = dest_pitch * BitmapHeight;
+  size_t dest_size = dest_pitch * BitmapHeight;
   uint8_t* pDest = dest_buf;
   if (bCopyWithoutAlpha) {
     for (int32_t i = 0; i < BitmapHeight; i++) {
diff --git a/core/fpdfapi/page/cpdf_streamparser.cpp b/core/fpdfapi/page/cpdf_streamparser.cpp
index e9320cb..aa1d227 100644
--- a/core/fpdfapi/page/cpdf_streamparser.cpp
+++ b/core/fpdfapi/page/cpdf_streamparser.cpp
@@ -34,7 +34,7 @@
 
 const uint32_t kMaxNestedParsingLevel = 512;
 const uint32_t kMaxWordBuffer = 256;
-const FX_STRSIZE kMaxStringLength = 32767;
+const size_t kMaxStringLength = 32767;
 
 uint32_t DecodeAllScanlines(std::unique_ptr<CCodec_ScanlineDecoder> pDecoder,
                             uint8_t** dest_buf,
@@ -478,9 +478,9 @@
       case 0:
         if (ch == ')') {
           if (parlevel == 0) {
-            return ByteString(buf.str().c_str(),
-                              std::min(static_cast<FX_STRSIZE>(buf.tellp()),
-                                       kMaxStringLength));
+            return ByteString(
+                buf.str().c_str(),
+                std::min(static_cast<size_t>(buf.tellp()), kMaxStringLength));
           }
           parlevel--;
           buf << ')';
@@ -557,7 +557,7 @@
 
   return ByteString(
       buf.str().c_str(),
-      std::min(static_cast<FX_STRSIZE>(buf.tellp()), kMaxStringLength));
+      std::min(static_cast<size_t>(buf.tellp()), kMaxStringLength));
 }
 
 ByteString CPDF_StreamParser::ReadHexString() {
@@ -590,7 +590,7 @@
 
   return ByteString(
       buf.str().c_str(),
-      std::min(static_cast<FX_STRSIZE>(buf.tellp()), kMaxStringLength));
+      std::min(static_cast<size_t>(buf.tellp()), kMaxStringLength));
 }
 
 bool CPDF_StreamParser::PositionIsInBounds() const {
diff --git a/core/fpdfapi/parser/cpdf_simple_parser.cpp b/core/fpdfapi/parser/cpdf_simple_parser.cpp
index d800796..5358b18 100644
--- a/core/fpdfapi/parser/cpdf_simple_parser.cpp
+++ b/core/fpdfapi/parser/cpdf_simple_parser.cpp
@@ -103,7 +103,7 @@
       m_dwCurPos++;
     }
     return ByteStringView(pStart,
-                          (FX_STRSIZE)(m_dwCurPos - (pStart - m_pData)));
+                          static_cast<size_t>(m_dwCurPos - (pStart - m_pData)));
   }
   if (dwSize == 1 && pStart[0] == '(') {
     int level = 1;
@@ -131,7 +131,7 @@
       m_dwCurPos++;
     }
     return ByteStringView(pStart,
-                          (FX_STRSIZE)(m_dwCurPos - (pStart - m_pData)));
+                          static_cast<size_t>(m_dwCurPos - (pStart - m_pData)));
   }
   return ByteStringView(pStart, dwSize);
 }
diff --git a/core/fpdfapi/parser/fpdf_parser_decode_unittest.cpp b/core/fpdfapi/parser/fpdf_parser_decode_unittest.cpp
index ae30959..9ab4958 100644
--- a/core/fpdfapi/parser/fpdf_parser_decode_unittest.cpp
+++ b/core/fpdfapi/parser/fpdf_parser_decode_unittest.cpp
@@ -81,7 +81,7 @@
   struct EncodeTestData {
     const wchar_t* input;
     const char* expected_output;
-    FX_STRSIZE expected_length;
+    size_t expected_length;
   } test_data[] = {
       // Empty src string.
       {L"", "", 0},
@@ -103,7 +103,7 @@
     ASSERT_EQ(test_case.expected_length, output.GetLength()) << "for case "
                                                              << i;
     const char* str_ptr = output.c_str();
-    for (FX_STRSIZE j = 0; j < test_case.expected_length; ++j) {
+    for (size_t j = 0; j < test_case.expected_length; ++j) {
       EXPECT_EQ(test_case.expected_output[j], str_ptr[j]) << "for case " << i
                                                           << " char " << j;
     }
diff --git a/core/fpdfapi/parser/fpdf_parser_utility.cpp b/core/fpdfapi/parser/fpdf_parser_utility.cpp
index e57f834..2185e88 100644
--- a/core/fpdfapi/parser/fpdf_parser_utility.cpp
+++ b/core/fpdfapi/parser/fpdf_parser_utility.cpp
@@ -106,7 +106,7 @@
       *pDest++ = bstr[i];
     }
   }
-  result.ReleaseBuffer((FX_STRSIZE)(pDest - pDestStart));
+  result.ReleaseBuffer(static_cast<size_t>(pDest - pDestStart));
   return result;
 }
 
diff --git a/core/fpdfdoc/cpdf_interform.cpp b/core/fpdfdoc/cpdf_interform.cpp
index f17e543..50db639 100644
--- a/core/fpdfdoc/cpdf_interform.cpp
+++ b/core/fpdfdoc/cpdf_interform.cpp
@@ -306,12 +306,12 @@
     m_pEnd = m_pCur + m_FullName.GetLength();
   }
 
-  void GetNext(const wchar_t*& pSubName, FX_STRSIZE& size) {
+  void GetNext(const wchar_t*& pSubName, size_t& size) {
     pSubName = m_pCur;
     while (m_pCur < m_pEnd && m_pCur[0] != L'.')
       m_pCur++;
 
-    size = (FX_STRSIZE)(m_pCur - pSubName);
+    size = static_cast<size_t>(m_pCur - pSubName);
     if (m_pCur < m_pEnd && m_pCur[0] == L'.')
       m_pCur++;
   }
@@ -376,7 +376,7 @@
   if (name1.GetLength() == name2.GetLength())
     return name1 == name2 ? 1 : 0;
 
-  FX_STRSIZE i = 0;
+  size_t i = 0;
   while (ptr1[i] == ptr2[i])
     i++;
   if (i == name1.GetLength())
@@ -509,7 +509,7 @@
 
   CFieldNameExtractor name_extractor(full_name);
   const wchar_t* pName;
-  FX_STRSIZE nLength;
+  size_t nLength;
   name_extractor.GetNext(pName, nLength);
   Node* pNode = &m_Root;
   Node* pLast = nullptr;
@@ -537,7 +537,7 @@
 
   CFieldNameExtractor name_extractor(full_name);
   const wchar_t* pName;
-  FX_STRSIZE nLength;
+  size_t nLength;
   name_extractor.GetNext(pName, nLength);
   Node* pNode = &m_Root;
   Node* pLast = nullptr;
@@ -556,7 +556,7 @@
 
   CFieldNameExtractor name_extractor(full_name);
   const wchar_t* pName;
-  FX_STRSIZE nLength;
+  size_t nLength;
   name_extractor.GetNext(pName, nLength);
   Node* pNode = &m_Root;
   Node* pLast = nullptr;
diff --git a/core/fpdftext/cpdf_linkextract.cpp b/core/fpdftext/cpdf_linkextract.cpp
index 9111671..3a38343 100644
--- a/core/fpdftext/cpdf_linkextract.cpp
+++ b/core/fpdftext/cpdf_linkextract.cpp
@@ -19,9 +19,7 @@
 // |end|. The purpose of this function is to separate url from the surrounding
 // context characters, we do not intend to fully validate the url. |str|
 // contains lower case characters only.
-FX_STRSIZE FindWebLinkEnding(const WideString& str,
-                             FX_STRSIZE start,
-                             FX_STRSIZE end) {
+size_t FindWebLinkEnding(const WideString& str, size_t start, size_t end) {
   if (str.Contains(L'/', start)) {
     // When there is a path and query after '/', most ASCII chars are allowed.
     // We don't sanitize in this case.
@@ -37,8 +35,8 @@
     if (result.has_value()) {
       end = result.value();
       if (end > start + 1) {  // Has content inside brackets.
-        FX_STRSIZE len = str.GetLength();
-        FX_STRSIZE off = end + 1;
+        size_t len = str.GetLength();
+        size_t off = end + 1;
         if (off < len && str[off] == L':') {
           off++;
           while (off < len && str[off] >= L'0' && str[off] <= L'9')
@@ -69,9 +67,9 @@
 // |end| if characters were removed.
 void TrimBackwardsToChar(const WideString& str,
                          wchar_t charToFind,
-                         FX_STRSIZE start,
-                         FX_STRSIZE* end) {
-  for (FX_STRSIZE pos = *end; pos >= start; pos--) {
+                         size_t start,
+                         size_t* end) {
+  for (size_t pos = *end; pos >= start; pos--) {
     if (str[pos] == charToFind) {
       *end = pos - 1;
       break;
@@ -83,10 +81,10 @@
 // |start| and |end| in |str|. Matches a closing bracket or quote for each
 // opening character and, if present, removes everything afterwards. Returns the
 // new end position for the string.
-FX_STRSIZE TrimExternalBracketsFromWebLink(const WideString& str,
-                                           FX_STRSIZE start,
-                                           FX_STRSIZE end) {
-  for (FX_STRSIZE pos = 0; pos < start; pos++) {
+size_t TrimExternalBracketsFromWebLink(const WideString& str,
+                                       size_t start,
+                                       size_t end) {
+  for (size_t pos = 0; pos < start; pos++) {
     if (str[pos] == '(') {
       TrimBackwardsToChar(str, ')', start, &end);
     } else if (str[pos] == '[') {
@@ -191,25 +189,25 @@
                                     int32_t* nStart,
                                     int32_t* nCount) {
   static const wchar_t kHttpScheme[] = L"http";
-  static const FX_STRSIZE kHttpSchemeLen = FXSYS_len(kHttpScheme);
+  static const size_t kHttpSchemeLen = FXSYS_len(kHttpScheme);
   static const wchar_t kWWWAddrStart[] = L"www.";
-  static const FX_STRSIZE kWWWAddrStartLen = FXSYS_len(kWWWAddrStart);
+  static const size_t kWWWAddrStartLen = FXSYS_len(kWWWAddrStart);
 
   WideString str = *strBeCheck;
   str.MakeLower();
 
-  FX_STRSIZE len = str.GetLength();
+  size_t len = str.GetLength();
   // First, try to find the scheme.
   auto start = str.Find(kHttpScheme);
   if (start.has_value()) {
-    FX_STRSIZE off = start.value() + kHttpSchemeLen;  // move after "http".
+    size_t off = start.value() + kHttpSchemeLen;  // move after "http".
     if (len > off + 4) {                      // At least "://<char>" follows.
       if (str[off] == L's')                   // "https" scheme is accepted.
         off++;
       if (str[off] == L':' && str[off + 1] == L'/' && str[off + 2] == L'/') {
         off += 3;
-        FX_STRSIZE end = TrimExternalBracketsFromWebLink(str, start.value(),
-                                                         str.GetLength() - 1);
+        size_t end = TrimExternalBracketsFromWebLink(str, start.value(),
+                                                     str.GetLength() - 1);
         end = FindWebLinkEnding(str, off, end);
         if (end > off) {  // Non-empty host name.
           *nStart = start.value();
@@ -224,8 +222,8 @@
   // When there is no scheme, try to find url starting with "www.".
   start = str.Find(kWWWAddrStart);
   if (start.has_value() && len > start.value() + kWWWAddrStartLen) {
-    FX_STRSIZE end = TrimExternalBracketsFromWebLink(str, start.value(),
-                                                     str.GetLength() - 1);
+    size_t end = TrimExternalBracketsFromWebLink(str, start.value(),
+                                                 str.GetLength() - 1);
     end = FindWebLinkEnding(str, start.value(), end);
     if (end > start.value() + kWWWAddrStartLen) {
       *nStart = start.value();
@@ -244,8 +242,8 @@
     return false;
 
   // Check the local part.
-  FX_STRSIZE pPos = aPos.value();  // Used to track the position of '@' or '.'.
-  for (FX_STRSIZE i = aPos.value(); i > 0; i--) {
+  size_t pPos = aPos.value();  // Used to track the position of '@' or '.'.
+  for (size_t i = aPos.value(); i > 0; i--) {
     wchar_t ch = (*str)[i - 1];
     if (ch == L'_' || ch == L'-' || FXSYS_iswalnum(ch))
       continue;
@@ -257,7 +255,7 @@
       }
       // End extracting for other invalid chars, '.' at the beginning, or
       // consecutive '.'.
-      FX_STRSIZE removed_len = i == pPos ? i + 1 : i;
+      size_t removed_len = i == pPos ? i + 1 : i;
       *str = str->Right(str->GetLength() - removed_len);
       break;
     }
@@ -279,16 +277,16 @@
     return false;
 
   // Validate all other chars in domain name.
-  FX_STRSIZE nLen = str->GetLength();
+  size_t nLen = str->GetLength();
   pPos = 0;  // Used to track the position of '.'.
-  for (FX_STRSIZE i = aPos.value() + 1; i < nLen; i++) {
+  for (size_t i = aPos.value() + 1; i < nLen; i++) {
     wchar_t wch = (*str)[i];
     if (wch == L'-' || FXSYS_iswalnum(wch))
       continue;
 
     if (wch != L'.' || i == pPos + 1) {
       // Domain name should end before invalid char.
-      FX_STRSIZE host_end = i == pPos + 1 ? i - 2 : i - 1;
+      size_t host_end = i == pPos + 1 ? i - 2 : i - 1;
       if (pPos > 0 && host_end - aPos.value() >= 3) {
         // Trim the ending invalid chars if there is at least one '.' and name.
         *str = str->Left(host_end + 1);
diff --git a/core/fpdftext/cpdf_textpage.cpp b/core/fpdftext/cpdf_textpage.cpp
index f73793c..fd33fb2 100644
--- a/core/fpdftext/cpdf_textpage.cpp
+++ b/core/fpdftext/cpdf_textpage.cpp
@@ -66,7 +66,7 @@
   return baseSpace;
 }
 
-FX_STRSIZE Unicode_GetNormalization(wchar_t wch, wchar_t* pDst) {
+size_t Unicode_GetNormalization(wchar_t wch, wchar_t* pDst) {
   wch = wch & 0xFFFF;
   wchar_t wFind = g_UnicodeData_Normalization[wch];
   if (!wFind) {
@@ -93,7 +93,7 @@
     while (n--)
       *pDst++ = *pMap++;
   }
-  return (FX_STRSIZE)wFind;
+  return static_cast<size_t>(wFind);
 }
 
 float MaskPercentFilled(const std::vector<bool>& mask,
@@ -649,11 +649,11 @@
   info.m_Index = m_TextBuf.GetLength();
   if (wChar >= 0xFB00 && wChar <= 0xFB06) {
     wchar_t* pDst = nullptr;
-    FX_STRSIZE nCount = Unicode_GetNormalization(wChar, pDst);
+    size_t nCount = Unicode_GetNormalization(wChar, pDst);
     if (nCount >= 1) {
       pDst = FX_Alloc(wchar_t, nCount);
       Unicode_GetNormalization(wChar, pDst);
-      for (FX_STRSIZE nIndex = 0; nIndex < nCount; nIndex++) {
+      for (size_t nIndex = 0; nIndex < nCount; nIndex++) {
         PAGECHAR_INFO info2 = info;
         info2.m_Unicode = pDst[nIndex];
         info2.m_Flag = FPDFTEXT_CHAR_PIECE;
@@ -679,11 +679,11 @@
   info.m_Index = m_TextBuf.GetLength();
   wChar = FX_GetMirrorChar(wChar);
   wchar_t* pDst = nullptr;
-  FX_STRSIZE nCount = Unicode_GetNormalization(wChar, pDst);
+  size_t nCount = Unicode_GetNormalization(wChar, pDst);
   if (nCount >= 1) {
     pDst = FX_Alloc(wchar_t, nCount);
     Unicode_GetNormalization(wChar, pDst);
-    for (FX_STRSIZE nIndex = 0; nIndex < nCount; nIndex++) {
+    for (size_t nIndex = 0; nIndex < nCount; nIndex++) {
       PAGECHAR_INFO info2 = info;
       info2.m_Unicode = pDst[nIndex];
       info2.m_Flag = FPDFTEXT_CHAR_PIECE;
@@ -704,7 +704,7 @@
 
   WideString str = m_TempTextBuf.MakeString();
   bool bPrevSpace = false;
-  for (FX_STRSIZE i = 0; i < str.GetLength(); i++) {
+  for (size_t i = 0; i < str.GetLength(); i++) {
     if (str[i] != ' ') {
       bPrevSpace = false;
       continue;
@@ -838,13 +838,12 @@
     return FPDFText_MarkedContent::Done;
   }
 
-  FX_STRSIZE nItems = actText.GetLength();
-  if (nItems < 1)
+  if (actText.IsEmpty())
     return FPDFText_MarkedContent::Pass;
 
   CPDF_Font* pFont = pTextObj->GetFont();
   bExist = false;
-  for (FX_STRSIZE i = 0; i < nItems; i++) {
+  for (size_t i = 0; i < actText.GetLength(); i++) {
     if (pFont->CharCodeFromUnicode(actText[i]) != CPDF_Font::kInvalidCharCode) {
       bExist = true;
       break;
@@ -854,7 +853,7 @@
     return FPDFText_MarkedContent::Pass;
 
   bExist = false;
-  for (FX_STRSIZE i = 0; i < nItems; i++) {
+  for (size_t i = 0; i < actText.GetLength(); i++) {
     wchar_t wChar = actText[i];
     if ((wChar > 0x80 && wChar < 0xFFFD) || (wChar <= 0x80 && isprint(wChar))) {
       bExist = true;
@@ -883,15 +882,14 @@
     if (pDict)
       actText = pDict->GetUnicodeTextFor("ActualText");
   }
-  FX_STRSIZE nItems = actText.GetLength();
-  if (nItems < 1)
+  if (actText.IsEmpty())
     return;
 
   CPDF_Font* pFont = pTextObj->GetFont();
   CFX_Matrix matrix = pTextObj->GetTextMatrix();
   matrix.Concat(Obj.m_formMatrix);
 
-  for (FX_STRSIZE k = 0; k < nItems; k++) {
+  for (size_t k = 0; k < actText.GetLength(); k++) {
     wchar_t wChar = actText[k];
     if (wChar <= 0x80 && !isprint(wChar))
       wChar = 0x20;
diff --git a/core/fpdftext/cpdf_textpagefind.cpp b/core/fpdftext/cpdf_textpagefind.cpp
index f00b8a9..9f9be20 100644
--- a/core/fpdftext/cpdf_textpagefind.cpp
+++ b/core/fpdftext/cpdf_textpagefind.cpp
@@ -81,7 +81,7 @@
 
 bool CPDF_TextPageFind::FindFirst(const WideString& findwhat,
                                   int flags,
-                                  pdfium::Optional<FX_STRSIZE> startPos) {
+                                  pdfium::Optional<size_t> startPos) {
   if (!m_pTextPage)
     return false;
   if (m_strText.IsEmpty() || m_bMatchCase != (flags & FPDFTEXT_MATCHCASE))
@@ -94,7 +94,7 @@
     m_IsFind = false;
     return true;
   }
-  FX_STRSIZE len = findwhatStr.GetLength();
+  size_t len = findwhatStr.GetLength();
   if (!m_bMatchCase) {
     findwhatStr.MakeLower();
     m_strText.MakeLower();
@@ -102,25 +102,24 @@
   m_bMatchWholeWord = !!(flags & FPDFTEXT_MATCHWHOLEWORD);
   m_findNextStart = startPos;
   if (!startPos.has_value()) {
-    if (m_strText.GetLength() > 0)
+    if (!m_strText.IsEmpty())
       m_findPreStart = m_strText.GetLength() - 1;
   } else {
     m_findPreStart = startPos;
   }
 
   m_csFindWhatArray.clear();
-  FX_STRSIZE i = 0;
-  while (i < len) {
+  size_t i = 0;
+  for (i = 0; i < len; ++i)
     if (findwhatStr[i] != ' ')
       break;
-    i++;
-  }
   if (i < len)
     ExtractFindWhat(findwhatStr);
   else
     m_csFindWhatArray.push_back(findwhatStr);
   if (m_csFindWhatArray.empty())
     return false;
+
   m_IsFind = true;
   m_resStart = 0;
   m_resEnd = -1;
@@ -137,14 +136,14 @@
     m_IsFind = false;
     return m_IsFind;
   }
-  FX_STRSIZE strLen = m_strText.GetLength();
+  size_t strLen = m_strText.GetLength();
   if (m_findNextStart.value() > strLen - 1) {
     m_IsFind = false;
     return m_IsFind;
   }
   int nCount = pdfium::CollectionSize<int>(m_csFindWhatArray);
-  pdfium::Optional<FX_STRSIZE> nResultPos = 0;
-  FX_STRSIZE nStartPos = m_findNextStart.value();
+  pdfium::Optional<size_t> nResultPos = 0;
+  size_t nStartPos = m_findNextStart.value();
   bool bSpaceStart = false;
   for (int iWord = 0; iWord < nCount; iWord++) {
     WideString csWord = m_csFindWhatArray[iWord];
@@ -162,18 +161,17 @@
       }
       continue;
     }
-    FX_STRSIZE endIndex;
     nResultPos = m_strText.Find(csWord.c_str(), nStartPos);
     if (!nResultPos.has_value()) {
       m_IsFind = false;
       return m_IsFind;
     }
-    endIndex = nResultPos.value() + csWord.GetLength() - 1;
+    size_t endIndex = nResultPos.value() + csWord.GetLength() - 1;
     if (iWord == 0)
       m_resStart = nResultPos.value();
     bool bMatch = true;
     if (iWord != 0 && !bSpaceStart) {
-      FX_STRSIZE PreResEndPos = nStartPos;
+      size_t PreResEndPos = nStartPos;
       int curChar = csWord[0];
       WideString lastWord = m_csFindWhatArray[iWord - 1];
       int lastChar = lastWord[lastWord.GetLength() - 1];
@@ -182,7 +180,7 @@
             IsIgnoreSpaceCharacter(curChar))) {
         bMatch = false;
       }
-      for (FX_STRSIZE d = PreResEndPos; d < nResultPos.value(); d++) {
+      for (size_t d = PreResEndPos; d < nResultPos.value(); d++) {
         wchar_t strInsert = m_strText[d];
         if (strInsert != TEXT_LINEFEED_CHAR && strInsert != TEXT_SPACE_CHAR &&
             strInsert != TEXT_RETURN_CHAR && strInsert != 160) {
@@ -238,20 +236,21 @@
     return m_IsFind;
   }
   CPDF_TextPageFind findEngine(m_pTextPage.Get());
-  bool ret = findEngine.FindFirst(m_findWhat, m_flags,
-                                  pdfium::Optional<FX_STRSIZE>(0));
+  bool ret =
+      findEngine.FindFirst(m_findWhat, m_flags, pdfium::Optional<size_t>(0));
   if (!ret) {
     m_IsFind = false;
     return m_IsFind;
   }
-  int order = -1, MatchedCount = 0;
+  int order = -1;
+  int MatchedCount = 0;
   while (ret) {
     ret = findEngine.FindNext();
     if (ret) {
       int order1 = findEngine.GetCurOrder();
       int MatchedCount1 = findEngine.GetMatchedCount();
-      if (static_cast<FX_STRSIZE>((order1 + MatchedCount1)) >
-          m_findPreStart.value() + 1)
+      int temp = order1 + MatchedCount1;
+      if (temp < 0 || static_cast<size_t>(temp) > m_findPreStart.value() + 1)
         break;
       order = order1;
       MatchedCount = MatchedCount1;
@@ -292,7 +291,7 @@
         break;
       }
     }
-    FX_STRSIZE pos = 0;
+    size_t pos = 0;
     while (pos < csWord.GetLength()) {
       WideString curStr = csWord.Mid(pos, 1);
       wchar_t curChar = csWord[pos];
@@ -321,13 +320,13 @@
 }
 
 bool CPDF_TextPageFind::IsMatchWholeWord(const WideString& csPageText,
-                                         FX_STRSIZE startPos,
-                                         FX_STRSIZE endPos) {
+                                         size_t startPos,
+                                         size_t endPos) {
   if (startPos > endPos)
     return false;
   wchar_t char_left = 0;
   wchar_t char_right = 0;
-  FX_STRSIZE char_count = endPos - startPos + 1;
+  size_t char_count = endPos - startPos + 1;
   if (char_count == 0)
     return false;
   if (char_count == 1 && csPageText[startPos] > 255)
diff --git a/core/fpdftext/cpdf_textpagefind.h b/core/fpdftext/cpdf_textpagefind.h
index face4e4..574f05e 100644
--- a/core/fpdftext/cpdf_textpagefind.h
+++ b/core/fpdftext/cpdf_textpagefind.h
@@ -24,7 +24,7 @@
 
   bool FindFirst(const WideString& findwhat,
                  int flags,
-                 pdfium::Optional<FX_STRSIZE> startPos);
+                 pdfium::Optional<size_t> startPos);
   bool FindNext();
   bool FindPrev();
   int GetCurOrder() const;
@@ -33,8 +33,8 @@
  protected:
   void ExtractFindWhat(const WideString& findwhat);
   bool IsMatchWholeWord(const WideString& csPageText,
-                        FX_STRSIZE startPos,
-                        FX_STRSIZE endPos);
+                        size_t startPos,
+                        size_t endPos);
   bool ExtractSubString(WideString& rString,
                         const wchar_t* lpszFullString,
                         int iSubString,
@@ -48,8 +48,8 @@
   WideString m_findWhat;
   int m_flags;
   std::vector<WideString> m_csFindWhatArray;
-  pdfium::Optional<FX_STRSIZE> m_findNextStart;
-  pdfium::Optional<FX_STRSIZE> m_findPreStart;
+  pdfium::Optional<size_t> m_findNextStart;
+  pdfium::Optional<size_t> m_findPreStart;
   bool m_bMatchCase;
   bool m_bMatchWholeWord;
   int m_resStart;
diff --git a/core/fxcodec/codec/ccodec_jpegmodule.h b/core/fxcodec/codec/ccodec_jpegmodule.h
index cc59924..ca56131 100644
--- a/core/fxcodec/codec/ccodec_jpegmodule.h
+++ b/core/fxcodec/codec/ccodec_jpegmodule.h
@@ -60,7 +60,7 @@
 #if _FX_OS_ == _FX_OS_WIN32_ || _FX_OS_ == _FX_OS_WIN64_
   static bool JpegEncode(const RetainPtr<CFX_DIBSource>& pSource,
                          uint8_t** dest_buf,
-                         FX_STRSIZE* dest_size);
+                         size_t* dest_size);
 #endif
 };
 
diff --git a/core/fxcodec/codec/ccodec_pngmodule.cpp b/core/fxcodec/codec/ccodec_pngmodule.cpp
index a08e72f..d500745 100644
--- a/core/fxcodec/codec/ccodec_pngmodule.cpp
+++ b/core/fxcodec/codec/ccodec_pngmodule.cpp
@@ -74,7 +74,7 @@
 #endif
 #if defined(PNG_TEXT_SUPPORTED)
     int i;
-    FX_STRSIZE len;
+    size_t len;
     const char* buf;
     int num_text;
     png_textp text = nullptr;
@@ -86,8 +86,10 @@
         buf = "Author";
         if (!memcmp(buf, text[i].key, std::min(len, FXSYS_strlen(buf)))) {
           pAttribute->m_strAuthor =
-              ByteString(reinterpret_cast<uint8_t*>(text[i].text),
-                         static_cast<FX_STRSIZE>(text[i].text_length));
+              text[i].text_length > 0
+                  ? ByteString(reinterpret_cast<uint8_t*>(text[i].text),
+                               static_cast<size_t>(text[i].text_length))
+                  : ByteString();
         }
       }
     }
diff --git a/core/fxcodec/codec/ccodec_tiffmodule.cpp b/core/fxcodec/codec/ccodec_tiffmodule.cpp
index 07d1892..f11c480 100644
--- a/core/fxcodec/codec/ccodec_tiffmodule.cpp
+++ b/core/fxcodec/codec/ccodec_tiffmodule.cpp
@@ -81,15 +81,15 @@
 }
 
 void _TIFFmemset(void* ptr, int val, tmsize_t size) {
-  memset(ptr, val, (size_t)size);
+  memset(ptr, val, static_cast<size_t>(size));
 }
 
 void _TIFFmemcpy(void* des, const void* src, tmsize_t size) {
-  memcpy(des, src, (size_t)size);
+  memcpy(des, src, static_cast<size_t>(size));
 }
 
 int _TIFFmemcmp(const void* ptr1, const void* ptr2, tmsize_t size) {
-  return memcmp(ptr1, ptr2, (size_t)size);
+  return memcmp(ptr1, ptr2, static_cast<size_t>(size));
 }
 
 int _TIFFIfMultiplicationOverflow(tmsize_t op1, tmsize_t op2) {
@@ -201,7 +201,7 @@
   TIFFGetField(tif_ctx, tag, &buf);
   if (!buf)
     return;
-  FX_STRSIZE size = FXSYS_strlen(buf);
+  size_t size = FXSYS_strlen(buf);
   uint8_t* ptr = FX_Alloc(uint8_t, size + 1);
   memcpy(ptr, buf, size);
   ptr[size] = 0;
diff --git a/core/fxcodec/codec/fx_codec_jpeg.cpp b/core/fxcodec/codec/fx_codec_jpeg.cpp
index b77fc87..b1dffbb 100644
--- a/core/fxcodec/codec/fx_codec_jpeg.cpp
+++ b/core/fxcodec/codec/fx_codec_jpeg.cpp
@@ -369,7 +369,7 @@
 }
 
 static void _src_skip_data1(struct jpeg_decompress_struct* cinfo, long num) {
-  if (cinfo->src->bytes_in_buffer < (size_t)num) {
+  if (cinfo->src->bytes_in_buffer < static_cast<size_t>(num)) {
     auto* pContext = reinterpret_cast<CJpegContext*>(cinfo->client_data);
     pContext->m_SkipSize = (unsigned int)(num - cinfo->src->bytes_in_buffer);
     cinfo->src->bytes_in_buffer = 0;
@@ -510,7 +510,7 @@
 #define JPEG_BLOCK_SIZE 1048576
 bool CCodec_JpegModule::JpegEncode(const RetainPtr<CFX_DIBSource>& pSource,
                                    uint8_t** dest_buf,
-                                   FX_STRSIZE* dest_size) {
+                                   size_t* dest_size) {
   struct jpeg_error_mgr jerr;
   jerr.error_exit = _error_do_nothing;
   jerr.emit_message = _error_do_nothing1;
@@ -603,7 +603,7 @@
   jpeg_finish_compress(&cinfo);
   jpeg_destroy_compress(&cinfo);
   FX_Free(line_buf);
-  *dest_size = dest_buf_length - (FX_STRSIZE)dest.free_in_buffer;
+  *dest_size = dest_buf_length - static_cast<size_t>(dest.free_in_buffer);
 
   return true;
 }
diff --git a/core/fxcrt/bytestring.cpp b/core/fxcrt/bytestring.cpp
index aa1fb57..bd195dd 100644
--- a/core/fxcrt/bytestring.cpp
+++ b/core/fxcrt/bytestring.cpp
@@ -91,12 +91,12 @@
 static_assert(sizeof(ByteString) <= sizeof(char*),
               "Strings must not require more space than pointers");
 
-ByteString::ByteString(const char* pStr, FX_STRSIZE nLen) {
+ByteString::ByteString(const char* pStr, size_t nLen) {
   if (nLen)
     m_pData.Reset(StringData::Create(pStr, nLen));
 }
 
-ByteString::ByteString(const uint8_t* pStr, FX_STRSIZE nLen) {
+ByteString::ByteString(const uint8_t* pStr, size_t nLen) {
   if (nLen)
     m_pData.Reset(
         StringData::Create(reinterpret_cast<const char*>(pStr), nLen));
@@ -128,7 +128,7 @@
   FX_SAFE_STRSIZE nSafeLen = str1.GetLength();
   nSafeLen += str2.GetLength();
 
-  FX_STRSIZE nNewLen = nSafeLen.ValueOrDie();
+  size_t nNewLen = nSafeLen.ValueOrDie();
   if (nNewLen == 0)
     return;
 
@@ -143,13 +143,13 @@
   for (const auto& item : list)
     nSafeLen += item.GetLength();
 
-  FX_STRSIZE nNewLen = nSafeLen.ValueOrDie();
+  size_t nNewLen = nSafeLen.ValueOrDie();
   if (nNewLen == 0)
     return;
 
   m_pData.Reset(StringData::Create(nNewLen));
 
-  FX_STRSIZE nOffset = 0;
+  size_t nOffset = 0;
   for (const auto& item : list) {
     m_pData->CopyContentsAt(nOffset, item.unterminated_c_str(),
                             item.GetLength());
@@ -264,13 +264,13 @@
   if (!m_pData)
     return str.IsEmpty();
 
-  FX_STRSIZE len = str.GetLength();
+  size_t len = str.GetLength();
   if (m_pData->m_nDataLength != len)
     return false;
 
   const uint8_t* pThis = (const uint8_t*)m_pData->m_String;
   const uint8_t* pThat = str.raw_str();
-  for (FX_STRSIZE i = 0; i < len; i++) {
+  for (size_t i = 0; i < len; i++) {
     if ((*pThis) != (*pThat)) {
       uint8_t bThis = FXSYS_tolower(*pThis);
       uint8_t bThat = FXSYS_tolower(*pThat);
@@ -283,13 +283,13 @@
   return true;
 }
 
-void ByteString::AssignCopy(const char* pSrcData, FX_STRSIZE nSrcLen) {
+void ByteString::AssignCopy(const char* pSrcData, size_t nSrcLen) {
   AllocBeforeWrite(nSrcLen);
   m_pData->CopyContents(pSrcData, nSrcLen);
   m_pData->m_nDataLength = nSrcLen;
 }
 
-void ByteString::ReallocBeforeWrite(FX_STRSIZE nNewLength) {
+void ByteString::ReallocBeforeWrite(size_t nNewLength) {
   if (m_pData && m_pData->CanOperateInPlace(nNewLength))
     return;
 
@@ -300,7 +300,7 @@
 
   RetainPtr<StringData> pNewData(StringData::Create(nNewLength));
   if (m_pData) {
-    FX_STRSIZE nCopyLength = std::min(m_pData->m_nDataLength, nNewLength);
+    size_t nCopyLength = std::min(m_pData->m_nDataLength, nNewLength);
     pNewData->CopyContents(m_pData->m_String, nCopyLength);
     pNewData->m_nDataLength = nCopyLength;
   } else {
@@ -310,7 +310,7 @@
   m_pData.Swap(pNewData);
 }
 
-void ByteString::AllocBeforeWrite(FX_STRSIZE nNewLength) {
+void ByteString::AllocBeforeWrite(size_t nNewLength) {
   if (m_pData && m_pData->CanOperateInPlace(nNewLength))
     return;
 
@@ -322,7 +322,7 @@
   m_pData.Reset(StringData::Create(nNewLength));
 }
 
-void ByteString::ReleaseBuffer(FX_STRSIZE nNewLength) {
+void ByteString::ReleaseBuffer(size_t nNewLength) {
   if (!m_pData)
     return;
 
@@ -343,11 +343,11 @@
   }
 }
 
-void ByteString::Reserve(FX_STRSIZE len) {
+void ByteString::Reserve(size_t len) {
   GetBuffer(len);
 }
 
-char* ByteString::GetBuffer(FX_STRSIZE nMinBufLength) {
+char* ByteString::GetBuffer(size_t nMinBufLength) {
   if (!m_pData) {
     if (nMinBufLength == 0)
       return nullptr;
@@ -372,28 +372,28 @@
   return m_pData->m_String;
 }
 
-FX_STRSIZE ByteString::Delete(FX_STRSIZE index, FX_STRSIZE count) {
+size_t ByteString::Delete(size_t index, size_t count) {
   if (!m_pData)
     return 0;
 
-  FX_STRSIZE old_length = m_pData->m_nDataLength;
+  size_t old_length = m_pData->m_nDataLength;
   if (count == 0 ||
-      index != pdfium::clamp(index, static_cast<FX_STRSIZE>(0), old_length))
+      index != pdfium::clamp(index, static_cast<size_t>(0), old_length))
     return old_length;
 
-  FX_STRSIZE removal_length = index + count;
+  size_t removal_length = index + count;
   if (removal_length > old_length)
     return old_length;
 
   ReallocBeforeWrite(old_length);
-  FX_STRSIZE chars_to_copy = old_length - removal_length + 1;
+  size_t chars_to_copy = old_length - removal_length + 1;
   memmove(m_pData->m_String + index, m_pData->m_String + removal_length,
           chars_to_copy);
   m_pData->m_nDataLength = old_length - count;
   return m_pData->m_nDataLength;
 }
 
-void ByteString::Concat(const char* pSrcData, FX_STRSIZE nSrcLen) {
+void ByteString::Concat(const char* pSrcData, size_t nSrcLen) {
   if (!pSrcData || nSrcLen == 0)
     return;
 
@@ -415,7 +415,7 @@
   m_pData.Swap(pNewData);
 }
 
-ByteString ByteString::Mid(FX_STRSIZE first, FX_STRSIZE count) const {
+ByteString ByteString::Mid(size_t first, size_t count) const {
   if (!m_pData)
     return ByteString();
 
@@ -436,21 +436,21 @@
   return dest;
 }
 
-ByteString ByteString::Left(FX_STRSIZE count) const {
+ByteString ByteString::Left(size_t count) const {
   if (count == 0 || !IsValidLength(count))
     return ByteString();
   return Mid(0, count);
 }
 
-ByteString ByteString::Right(FX_STRSIZE count) const {
+ByteString ByteString::Right(size_t count) const {
   if (count == 0 || !IsValidLength(count))
     return ByteString();
   return Mid(GetLength() - count, count);
 }
 
 void ByteString::AllocCopy(ByteString& dest,
-                           FX_STRSIZE nCopyLen,
-                           FX_STRSIZE nCopyIndex) const {
+                           size_t nCopyLen,
+                           size_t nCopyIndex) const {
   if (nCopyLen == 0)
     return;
 
@@ -472,7 +472,7 @@
 void ByteString::FormatV(const char* pFormat, va_list argList) {
   va_list argListCopy;
   va_copy(argListCopy, argList);
-  FX_STRSIZE nMaxLen = vsnprintf(nullptr, 0, pFormat, argListCopy);
+  int nMaxLen = vsnprintf(nullptr, 0, pFormat, argListCopy);
   va_end(argListCopy);
   if (nMaxLen > 0) {
     GetBuffer(nMaxLen);
@@ -495,18 +495,18 @@
   va_end(argList);
 }
 
-void ByteString::SetAt(FX_STRSIZE index, char c) {
+void ByteString::SetAt(size_t index, char c) {
   ASSERT(IsValidIndex(index));
   ReallocBeforeWrite(m_pData->m_nDataLength);
   m_pData->m_String[index] = c;
 }
 
-FX_STRSIZE ByteString::Insert(FX_STRSIZE location, char ch) {
-  const FX_STRSIZE cur_length = m_pData ? m_pData->m_nDataLength : 0;
+size_t ByteString::Insert(size_t location, char ch) {
+  const size_t cur_length = m_pData ? m_pData->m_nDataLength : 0;
   if (!IsValidLength(location))
     return cur_length;
 
-  const FX_STRSIZE new_length = cur_length + 1;
+  const size_t new_length = cur_length + 1;
   ReallocBeforeWrite(new_length);
   memmove(m_pData->m_String + location + 1, m_pData->m_String + location,
           new_length - location);
@@ -515,46 +515,46 @@
   return new_length;
 }
 
-pdfium::Optional<FX_STRSIZE> ByteString::Find(char ch, FX_STRSIZE start) const {
+pdfium::Optional<size_t> ByteString::Find(char ch, size_t start) const {
   if (!m_pData)
-    return pdfium::Optional<FX_STRSIZE>();
+    return pdfium::Optional<size_t>();
 
   if (!IsValidIndex(start))
-    return pdfium::Optional<FX_STRSIZE>();
+    return pdfium::Optional<size_t>();
 
   const char* pStr = static_cast<const char*>(
       memchr(m_pData->m_String + start, ch, m_pData->m_nDataLength - start));
-  return pStr ? pdfium::Optional<FX_STRSIZE>(
-                    static_cast<FX_STRSIZE>(pStr - m_pData->m_String))
-              : pdfium::Optional<FX_STRSIZE>();
+  return pStr ? pdfium::Optional<size_t>(
+                    static_cast<size_t>(pStr - m_pData->m_String))
+              : pdfium::Optional<size_t>();
 }
 
-pdfium::Optional<FX_STRSIZE> ByteString::Find(const ByteStringView& subStr,
-                                              FX_STRSIZE start) const {
+pdfium::Optional<size_t> ByteString::Find(const ByteStringView& subStr,
+                                          size_t start) const {
   if (!m_pData)
-    return pdfium::Optional<FX_STRSIZE>();
+    return pdfium::Optional<size_t>();
 
   if (!IsValidIndex(start))
-    return pdfium::Optional<FX_STRSIZE>();
+    return pdfium::Optional<size_t>();
 
   const char* pStr =
       FX_strstr(m_pData->m_String + start, m_pData->m_nDataLength - start,
                 subStr.unterminated_c_str(), subStr.GetLength());
-  return pStr ? pdfium::Optional<FX_STRSIZE>(
-                    static_cast<FX_STRSIZE>(pStr - m_pData->m_String))
-              : pdfium::Optional<FX_STRSIZE>();
+  return pStr ? pdfium::Optional<size_t>(
+                    static_cast<size_t>(pStr - m_pData->m_String))
+              : pdfium::Optional<size_t>();
 }
 
-pdfium::Optional<FX_STRSIZE> ByteString::ReverseFind(char ch) const {
+pdfium::Optional<size_t> ByteString::ReverseFind(char ch) const {
   if (!m_pData)
-    return pdfium::Optional<FX_STRSIZE>();
+    return pdfium::Optional<size_t>();
 
-  FX_STRSIZE nLength = m_pData->m_nDataLength;
+  size_t nLength = m_pData->m_nDataLength;
   while (nLength--) {
     if (m_pData->m_String[nLength] == ch)
-      return pdfium::Optional<FX_STRSIZE>(nLength);
+      return pdfium::Optional<size_t>(nLength);
   }
-  return pdfium::Optional<FX_STRSIZE>();
+  return pdfium::Optional<size_t>();
 }
 
 void ByteString::MakeLower() {
@@ -573,7 +573,7 @@
   FXSYS_strupr(m_pData->m_String);
 }
 
-FX_STRSIZE ByteString::Remove(char chRemove) {
+size_t ByteString::Remove(char chRemove) {
   if (!m_pData || m_pData->m_nDataLength < 1)
     return 0;
 
@@ -602,19 +602,19 @@
   }
 
   *pstrDest = 0;
-  FX_STRSIZE nCount = static_cast<FX_STRSIZE>(pstrSource - pstrDest);
+  size_t nCount = static_cast<size_t>(pstrSource - pstrDest);
   m_pData->m_nDataLength -= nCount;
   return nCount;
 }
 
-FX_STRSIZE ByteString::Replace(const ByteStringView& pOld,
-                               const ByteStringView& pNew) {
+size_t ByteString::Replace(const ByteStringView& pOld,
+                           const ByteStringView& pNew) {
   if (!m_pData || pOld.IsEmpty())
     return 0;
 
-  FX_STRSIZE nSourceLen = pOld.GetLength();
-  FX_STRSIZE nReplacementLen = pNew.GetLength();
-  FX_STRSIZE nCount = 0;
+  size_t nSourceLen = pOld.GetLength();
+  size_t nReplacementLen = pNew.GetLength();
+  size_t nCount = 0;
   const char* pStart = m_pData->m_String;
   char* pEnd = m_pData->m_String + m_pData->m_nDataLength;
   while (1) {
@@ -629,7 +629,7 @@
   if (nCount == 0)
     return 0;
 
-  FX_STRSIZE nNewLength =
+  size_t nNewLength =
       m_pData->m_nDataLength + (nReplacementLen - nSourceLen) * nCount;
 
   if (nNewLength == 0) {
@@ -640,7 +640,7 @@
   RetainPtr<StringData> pNewData(StringData::Create(nNewLength));
   pStart = m_pData->m_String;
   char* pDest = pNewData->m_String;
-  for (FX_STRSIZE i = 0; i < nCount; i++) {
+  for (size_t i = 0; i < nCount; i++) {
     const char* pTarget = FX_strstr(pStart, static_cast<int>(pEnd - pStart),
                                     pOld.unterminated_c_str(), nSourceLen);
     memcpy(pDest, pStart, pTarget - pStart);
@@ -656,7 +656,7 @@
 
 WideString ByteString::UTF8Decode() const {
   CFX_UTF8Decoder decoder;
-  for (FX_STRSIZE i = 0; i < GetLength(); i++) {
+  for (size_t i = 0; i < GetLength(); i++) {
     decoder.Input(static_cast<uint8_t>(m_pData->m_String[i]));
   }
   return WideString(decoder.GetResult());
@@ -671,10 +671,10 @@
   if (!m_pData) {
     return str.IsEmpty() ? 0 : -1;
   }
-  FX_STRSIZE this_len = m_pData->m_nDataLength;
-  FX_STRSIZE that_len = str.GetLength();
-  FX_STRSIZE min_len = std::min(this_len, that_len);
-  for (FX_STRSIZE i = 0; i < min_len; i++) {
+  size_t this_len = m_pData->m_nDataLength;
+  size_t that_len = str.GetLength();
+  size_t min_len = std::min(this_len, that_len);
+  for (size_t i = 0; i < min_len; i++) {
     if (static_cast<uint8_t>(m_pData->m_String[i]) < str[i]) {
       return -1;
     }
@@ -695,12 +695,12 @@
   if (!m_pData || pTargets.IsEmpty())
     return;
 
-  FX_STRSIZE pos = GetLength();
+  size_t pos = GetLength();
   if (pos == 0)
     return;
 
   while (pos) {
-    FX_STRSIZE i = 0;
+    size_t i = 0;
     while (i < pTargets.GetLength() &&
            pTargets[i] != m_pData->m_String[pos - 1]) {
       i++;
@@ -729,13 +729,13 @@
   if (!m_pData || pTargets.IsEmpty())
     return;
 
-  FX_STRSIZE len = GetLength();
+  size_t len = GetLength();
   if (len == 0)
     return;
 
-  FX_STRSIZE pos = 0;
+  size_t pos = 0;
   while (pos < len) {
-    FX_STRSIZE i = 0;
+    size_t i = 0;
     while (i < pTargets.GetLength() && pTargets[i] != m_pData->m_String[pos]) {
       i++;
     }
@@ -746,7 +746,7 @@
   }
   if (pos) {
     ReallocBeforeWrite(len);
-    FX_STRSIZE nDataLength = len - pos;
+    size_t nDataLength = len - pos;
     memmove(m_pData->m_String, m_pData->m_String + pos,
             (nDataLength + 1) * sizeof(char));
     m_pData->m_nDataLength = nDataLength;
@@ -763,8 +763,7 @@
 
 ByteString ByteString::FormatFloat(float d, int precision) {
   char buf[32];
-  FX_STRSIZE len = FX_ftoa(d, buf);
-  return ByteString(buf, len);
+  return ByteString(buf, FX_ftoa(d, buf));
 }
 
 std::ostream& operator<<(std::ostream& os, const ByteString& str) {
diff --git a/core/fxcrt/bytestring.h b/core/fxcrt/bytestring.h
index eba9744..2b01bc1 100644
--- a/core/fxcrt/bytestring.h
+++ b/core/fxcrt/bytestring.h
@@ -46,8 +46,8 @@
   // NOLINTNEXTLINE(runtime/explicit)
   ByteString(wchar_t) = delete;
 
-  ByteString(const char* ptr, FX_STRSIZE len);
-  ByteString(const uint8_t* ptr, FX_STRSIZE len);
+  ByteString(const char* ptr, size_t len);
+  ByteString(const uint8_t* ptr, size_t len);
 
   explicit ByteString(const ByteStringView& bstrc);
   ByteString(const ByteStringView& bstrc1, const ByteStringView& bstrc2);
@@ -91,13 +91,13 @@
     return const_reverse_iterator(begin());
   }
 
-  FX_STRSIZE GetLength() const { return m_pData ? m_pData->m_nDataLength : 0; }
-  FX_STRSIZE GetStringLength() const {
+  size_t GetLength() const { return m_pData ? m_pData->m_nDataLength : 0; }
+  size_t GetStringLength() const {
     return m_pData ? FXSYS_strlen(m_pData->m_String) : 0;
   }
   bool IsEmpty() const { return !GetLength(); }
-  bool IsValidIndex(FX_STRSIZE index) const { return index < GetLength(); }
-  bool IsValidLength(FX_STRSIZE length) const { return length <= GetLength(); }
+  bool IsValidIndex(size_t index) const { return index < GetLength(); }
+  bool IsValidLength(size_t length) const { return length <= GetLength(); }
 
   int Compare(const ByteStringView& str) const;
   bool EqualNoCase(const ByteStringView& str) const;
@@ -121,7 +121,7 @@
   const ByteString& operator+=(const ByteString& str);
   const ByteString& operator+=(const ByteStringView& bstrc);
 
-  CharType operator[](const FX_STRSIZE index) const {
+  CharType operator[](const size_t index) const {
     ASSERT(IsValidIndex(index));
     return m_pData ? m_pData->m_String[index] : 0;
   }
@@ -129,34 +129,34 @@
   CharType First() const { return GetLength() ? (*this)[0] : 0; }
   CharType Last() const { return GetLength() ? (*this)[GetLength() - 1] : 0; }
 
-  void SetAt(FX_STRSIZE index, char c);
+  void SetAt(size_t index, char c);
 
-  FX_STRSIZE Insert(FX_STRSIZE index, char ch);
-  FX_STRSIZE InsertAtFront(char ch) { return Insert(0, ch); }
-  FX_STRSIZE InsertAtBack(char ch) { return Insert(GetLength(), ch); }
-  FX_STRSIZE Delete(FX_STRSIZE index, FX_STRSIZE count = 1);
+  size_t Insert(size_t index, char ch);
+  size_t InsertAtFront(char ch) { return Insert(0, ch); }
+  size_t InsertAtBack(char ch) { return Insert(GetLength(), ch); }
+  size_t Delete(size_t index, size_t count = 1);
 
   void Format(const char* lpszFormat, ...);
   void FormatV(const char* lpszFormat, va_list argList);
 
-  void Reserve(FX_STRSIZE len);
-  char* GetBuffer(FX_STRSIZE len);
-  void ReleaseBuffer(FX_STRSIZE len);
+  void Reserve(size_t len);
+  char* GetBuffer(size_t len);
+  void ReleaseBuffer(size_t len);
 
-  ByteString Mid(FX_STRSIZE first, FX_STRSIZE count) const;
-  ByteString Left(FX_STRSIZE count) const;
-  ByteString Right(FX_STRSIZE count) const;
+  ByteString Mid(size_t first, size_t count) const;
+  ByteString Left(size_t count) const;
+  ByteString Right(size_t count) const;
 
-  pdfium::Optional<FX_STRSIZE> Find(const ByteStringView& lpszSub,
-                                    FX_STRSIZE start = 0) const;
-  pdfium::Optional<FX_STRSIZE> Find(char ch, FX_STRSIZE start = 0) const;
-  pdfium::Optional<FX_STRSIZE> ReverseFind(char ch) const;
+  pdfium::Optional<size_t> Find(const ByteStringView& lpszSub,
+                                size_t start = 0) const;
+  pdfium::Optional<size_t> Find(char ch, size_t start = 0) const;
+  pdfium::Optional<size_t> ReverseFind(char ch) const;
 
-  bool Contains(const ByteStringView& lpszSub, FX_STRSIZE start = 0) const {
+  bool Contains(const ByteStringView& lpszSub, size_t start = 0) const {
     return Find(lpszSub, start).has_value();
   }
 
-  bool Contains(char ch, FX_STRSIZE start = 0) const {
+  bool Contains(char ch, size_t start = 0) const {
     return Find(ch, start).has_value();
   }
 
@@ -171,10 +171,9 @@
   void TrimLeft(char chTarget);
   void TrimLeft(const ByteStringView& lpszTargets);
 
-  FX_STRSIZE Replace(const ByteStringView& lpszOld,
-                     const ByteStringView& lpszNew);
+  size_t Replace(const ByteStringView& lpszOld, const ByteStringView& lpszNew);
 
-  FX_STRSIZE Remove(char ch);
+  size_t Remove(char ch);
 
   WideString UTF8Decode() const;
 
@@ -186,13 +185,11 @@
  protected:
   using StringData = StringDataTemplate<char>;
 
-  void ReallocBeforeWrite(FX_STRSIZE nNewLen);
-  void AllocBeforeWrite(FX_STRSIZE nNewLen);
-  void AllocCopy(ByteString& dest,
-                 FX_STRSIZE nCopyLen,
-                 FX_STRSIZE nCopyIndex) const;
-  void AssignCopy(const char* pSrcData, FX_STRSIZE nSrcLen);
-  void Concat(const char* lpszSrcData, FX_STRSIZE nSrcLen);
+  void ReallocBeforeWrite(size_t nNewLen);
+  void AllocBeforeWrite(size_t nNewLen);
+  void AllocCopy(ByteString& dest, size_t nCopyLen, size_t nCopyIndex) const;
+  void AssignCopy(const char* pSrcData, size_t nSrcLen);
+  void Concat(const char* lpszSrcData, size_t nSrcLen);
 
   RetainPtr<StringData> m_pData;
 
diff --git a/core/fxcrt/bytestring_unittest.cpp b/core/fxcrt/bytestring_unittest.cpp
index e1c832e..d3597ad 100644
--- a/core/fxcrt/bytestring_unittest.cpp
+++ b/core/fxcrt/bytestring_unittest.cpp
@@ -550,7 +550,7 @@
   EXPECT_FALSE(empty_string.Find('a').has_value());
   EXPECT_FALSE(empty_string.Find('\0').has_value());
 
-  pdfium::Optional<FX_STRSIZE> result;
+  pdfium::Optional<size_t> result;
   ByteString single_string("a");
   result = single_string.Find('a');
   ASSERT_TRUE(result.has_value());
@@ -599,7 +599,7 @@
   EXPECT_FALSE(empty_string.ReverseFind('a').has_value());
   EXPECT_FALSE(empty_string.ReverseFind('\0').has_value());
 
-  pdfium::Optional<FX_STRSIZE> result;
+  pdfium::Optional<size_t> result;
   ByteString single_string("a");
   result = single_string.ReverseFind('a');
   ASSERT_TRUE(result.has_value());
@@ -978,7 +978,7 @@
 
   std::vector<uint8_t> lower_a_vec(10, static_cast<uint8_t>('a'));
   ByteStringView lower_a_string(lower_a_vec);
-  EXPECT_EQ(static_cast<FX_STRSIZE>(10), lower_a_string.GetLength());
+  EXPECT_EQ(static_cast<size_t>(10), lower_a_string.GetLength());
   EXPECT_EQ("aaaaaaaaaa", lower_a_string);
 
   std::vector<uint8_t> cleared_vec;
@@ -1012,7 +1012,7 @@
   EXPECT_FALSE(empty_string.Find('a').has_value());
   EXPECT_FALSE(empty_string.Find('\0').has_value());
 
-  pdfium::Optional<FX_STRSIZE> result;
+  pdfium::Optional<size_t> result;
   ByteStringView single_string("a");
   result = single_string.Find('a');
   ASSERT_TRUE(result.has_value());
diff --git a/core/fxcrt/cfx_binarybuf.cpp b/core/fxcrt/cfx_binarybuf.cpp
index b826fdd..d1bd053 100644
--- a/core/fxcrt/cfx_binarybuf.cpp
+++ b/core/fxcrt/cfx_binarybuf.cpp
@@ -12,14 +12,14 @@
 CFX_BinaryBuf::CFX_BinaryBuf()
     : m_AllocStep(0), m_AllocSize(0), m_DataSize(0) {}
 
-CFX_BinaryBuf::CFX_BinaryBuf(FX_STRSIZE size)
+CFX_BinaryBuf::CFX_BinaryBuf(size_t size)
     : m_AllocStep(0), m_AllocSize(size), m_DataSize(size) {
   m_pBuffer.reset(FX_Alloc(uint8_t, size));
 }
 
 CFX_BinaryBuf::~CFX_BinaryBuf() {}
 
-void CFX_BinaryBuf::Delete(FX_STRSIZE start_index, FX_STRSIZE count) {
+void CFX_BinaryBuf::Delete(size_t start_index, size_t count) {
   if (!m_pBuffer || count > m_DataSize || start_index > m_DataSize - count)
     return;
 
@@ -28,7 +28,7 @@
   m_DataSize -= count;
 }
 
-FX_STRSIZE CFX_BinaryBuf::GetLength() const {
+size_t CFX_BinaryBuf::GetLength() const {
   return m_DataSize;
 }
 
@@ -42,20 +42,20 @@
   return std::move(m_pBuffer);
 }
 
-void CFX_BinaryBuf::EstimateSize(FX_STRSIZE size, FX_STRSIZE step) {
+void CFX_BinaryBuf::EstimateSize(size_t size, size_t step) {
   m_AllocStep = step;
   if (m_AllocSize < size)
     ExpandBuf(size - m_DataSize);
 }
 
-void CFX_BinaryBuf::ExpandBuf(FX_STRSIZE add_size) {
+void CFX_BinaryBuf::ExpandBuf(size_t add_size) {
   FX_SAFE_STRSIZE new_size = m_DataSize;
   new_size += add_size;
   if (m_AllocSize >= new_size.ValueOrDie())
     return;
 
-  FX_STRSIZE alloc_step = std::max(static_cast<FX_STRSIZE>(128),
-                                   m_AllocStep ? m_AllocStep : m_AllocSize / 4);
+  size_t alloc_step = std::max(static_cast<size_t>(128),
+                               m_AllocStep ? m_AllocStep : m_AllocSize / 4);
   new_size += alloc_step - 1;  // Quantize, don't combine these lines.
   new_size /= alloc_step;
   new_size *= alloc_step;
@@ -65,8 +65,8 @@
                       : FX_Alloc(uint8_t, m_AllocSize));
 }
 
-void CFX_BinaryBuf::AppendBlock(const void* pBuf, FX_STRSIZE size) {
-  if (size <= 0)
+void CFX_BinaryBuf::AppendBlock(const void* pBuf, size_t size) {
+  if (size == 0)
     return;
 
   ExpandBuf(size);
@@ -78,9 +78,7 @@
   m_DataSize += size;
 }
 
-void CFX_BinaryBuf::InsertBlock(FX_STRSIZE pos,
-                                const void* pBuf,
-                                FX_STRSIZE size) {
+void CFX_BinaryBuf::InsertBlock(size_t pos, const void* pBuf, size_t size) {
   if (size <= 0)
     return;
 
diff --git a/core/fxcrt/cfx_binarybuf.h b/core/fxcrt/cfx_binarybuf.h
index 186d8d1..1a1c821 100644
--- a/core/fxcrt/cfx_binarybuf.h
+++ b/core/fxcrt/cfx_binarybuf.h
@@ -16,17 +16,17 @@
 class CFX_BinaryBuf {
  public:
   CFX_BinaryBuf();
-  explicit CFX_BinaryBuf(FX_STRSIZE size);
+  explicit CFX_BinaryBuf(size_t size);
   virtual ~CFX_BinaryBuf();
 
   uint8_t* GetBuffer() const { return m_pBuffer.get(); }
-  FX_STRSIZE GetSize() const { return m_DataSize; }
-  virtual FX_STRSIZE GetLength() const;
+  size_t GetSize() const { return m_DataSize; }
+  virtual size_t GetLength() const;
   bool IsEmpty() const { return GetLength() == 0; }
 
   void Clear();
-  void EstimateSize(FX_STRSIZE size, FX_STRSIZE alloc_step = 0);
-  void AppendBlock(const void* pBuf, FX_STRSIZE size);
+  void EstimateSize(size_t size, size_t alloc_step = 0);
+  void AppendBlock(const void* pBuf, size_t size);
   void AppendString(const ByteString& str) {
     AppendBlock(str.c_str(), str.GetLength());
   }
@@ -36,18 +36,18 @@
     m_pBuffer.get()[m_DataSize++] = byte;
   }
 
-  void InsertBlock(FX_STRSIZE pos, const void* pBuf, FX_STRSIZE size);
-  void Delete(FX_STRSIZE start_index, FX_STRSIZE count);
+  void InsertBlock(size_t pos, const void* pBuf, size_t size);
+  void Delete(size_t start_index, size_t count);
 
   // Releases ownership of |m_pBuffer| and returns it.
   std::unique_ptr<uint8_t, FxFreeDeleter> DetachBuffer();
 
  protected:
-  void ExpandBuf(FX_STRSIZE size);
+  void ExpandBuf(size_t size);
 
-  FX_STRSIZE m_AllocStep;
-  FX_STRSIZE m_AllocSize;
-  FX_STRSIZE m_DataSize;
+  size_t m_AllocStep;
+  size_t m_AllocSize;
+  size_t m_DataSize;
   std::unique_ptr<uint8_t, FxFreeDeleter> m_pBuffer;
 };
 
diff --git a/core/fxcrt/cfx_seekablestreamproxy.cpp b/core/fxcrt/cfx_seekablestreamproxy.cpp
index 3c0b5d5..f2590ec 100644
--- a/core/fxcrt/cfx_seekablestreamproxy.cpp
+++ b/core/fxcrt/cfx_seekablestreamproxy.cpp
@@ -25,10 +25,10 @@
 namespace {
 
 // Returns {src bytes consumed, dst bytes produced}.
-std::pair<FX_STRSIZE, FX_STRSIZE> UTF8Decode(const char* pSrc,
-                                             FX_STRSIZE srcLen,
-                                             wchar_t* pDst,
-                                             FX_STRSIZE dstLen) {
+std::pair<size_t, size_t> UTF8Decode(const char* pSrc,
+                                     size_t srcLen,
+                                     wchar_t* pDst,
+                                     size_t dstLen) {
   ASSERT(pDst && dstLen > 0);
 
   if (srcLen < 1)
@@ -36,9 +36,9 @@
 
   uint32_t dwCode = 0;
   int32_t iPending = 0;
-  FX_STRSIZE iSrcNum = 0;
-  FX_STRSIZE iDstNum = 0;
-  FX_STRSIZE iIndex = 0;
+  size_t iSrcNum = 0;
+  size_t iDstNum = 0;
+  size_t iIndex = 0;
   int32_t k = 1;
   while (iIndex < srcLen) {
     uint8_t byte = static_cast<uint8_t>(*(pSrc + iIndex));
@@ -91,18 +91,18 @@
   return {iSrcNum, iDstNum};
 }
 
-void UTF16ToWChar(void* pBuffer, FX_STRSIZE iLength) {
+void UTF16ToWChar(void* pBuffer, size_t iLength) {
   ASSERT(pBuffer);
   ASSERT(iLength > 0);
   ASSERT(sizeof(wchar_t) > 2);
 
   uint16_t* pSrc = static_cast<uint16_t*>(pBuffer);
   wchar_t* pDst = static_cast<wchar_t*>(pBuffer);
-  for (FX_STRSIZE i = 0; i < iLength; i++)
+  for (size_t i = 0; i < iLength; i++)
     pDst[i] = static_cast<wchar_t>(pSrc[i]);
 }
 
-void SwapByteOrder(wchar_t* pStr, FX_STRSIZE iLength) {
+void SwapByteOrder(wchar_t* pStr, size_t iLength) {
   ASSERT(pStr);
 
   uint16_t wch;
@@ -174,7 +174,7 @@
   Seek(From::Begin, static_cast<FX_FILESIZE>(m_wBOMLength));
 }
 
-CFX_SeekableStreamProxy::CFX_SeekableStreamProxy(uint8_t* data, FX_STRSIZE size)
+CFX_SeekableStreamProxy::CFX_SeekableStreamProxy(uint8_t* data, size_t size)
     : CFX_SeekableStreamProxy(
           pdfium::MakeRetain<CFX_MemoryStream>(data, size, false),
           false) {}
@@ -203,15 +203,14 @@
   m_wCodePage = wCodePage;
 }
 
-FX_STRSIZE CFX_SeekableStreamProxy::ReadData(uint8_t* pBuffer,
-                                             FX_STRSIZE iBufferSize) {
+size_t CFX_SeekableStreamProxy::ReadData(uint8_t* pBuffer, size_t iBufferSize) {
   ASSERT(pBuffer && iBufferSize > 0);
 
   if (m_IsWriteStream)
     return 0;
 
   iBufferSize =
-      std::min(iBufferSize, static_cast<FX_STRSIZE>(GetLength() - m_iPosition));
+      std::min(iBufferSize, static_cast<size_t>(GetLength() - m_iPosition));
   if (iBufferSize <= 0)
     return 0;
 
@@ -224,9 +223,9 @@
   return new_pos.IsValid() ? iBufferSize : 0;
 }
 
-FX_STRSIZE CFX_SeekableStreamProxy::ReadString(wchar_t* pStr,
-                                               FX_STRSIZE iMaxLength,
-                                               bool* bEOS) {
+size_t CFX_SeekableStreamProxy::ReadString(wchar_t* pStr,
+                                           size_t iMaxLength,
+                                           bool* bEOS) {
   if (!pStr || iMaxLength == 0)
     return 0;
 
@@ -235,8 +234,8 @@
 
   if (m_wCodePage == FX_CODEPAGE_UTF16LE ||
       m_wCodePage == FX_CODEPAGE_UTF16BE) {
-    FX_STRSIZE iBytes = iMaxLength * 2;
-    FX_STRSIZE iLen = ReadData(reinterpret_cast<uint8_t*>(pStr), iBytes);
+    size_t iBytes = iMaxLength * 2;
+    size_t iLen = ReadData(reinterpret_cast<uint8_t*>(pStr), iBytes);
     iMaxLength = iLen / 2;
     if (sizeof(wchar_t) > 2 && iMaxLength > 0)
       UTF16ToWChar(pStr, iMaxLength);
@@ -246,17 +245,17 @@
 
   } else {
     FX_FILESIZE pos = GetPosition();
-    FX_STRSIZE iBytes =
-        std::min(iMaxLength, static_cast<FX_STRSIZE>(GetLength() - pos));
+    size_t iBytes =
+        std::min(iMaxLength, static_cast<size_t>(GetLength() - pos));
 
     if (iBytes > 0) {
       std::vector<uint8_t> buf(iBytes);
 
-      FX_STRSIZE iLen = ReadData(buf.data(), iBytes);
+      size_t iLen = ReadData(buf.data(), iBytes);
       if (m_wCodePage != FX_CODEPAGE_UTF8)
         return 0;
 
-      FX_STRSIZE iSrc = 0;
+      size_t iSrc = 0;
       std::tie(iSrc, iMaxLength) = UTF8Decode(
           reinterpret_cast<const char*>(buf.data()), iLen, pStr, iMaxLength);
       Seek(From::Current, iSrc - iLen);
diff --git a/core/fxcrt/cfx_seekablestreamproxy.h b/core/fxcrt/cfx_seekablestreamproxy.h
index cadc968..c25ab3c 100644
--- a/core/fxcrt/cfx_seekablestreamproxy.h
+++ b/core/fxcrt/cfx_seekablestreamproxy.h
@@ -25,11 +25,11 @@
 
   FX_FILESIZE GetLength() const { return m_pStream->GetSize(); }
   FX_FILESIZE GetPosition() { return m_iPosition; }
-  FX_STRSIZE GetBOMLength() const { return m_wBOMLength; }
+  size_t GetBOMLength() const { return m_wBOMLength; }
   bool IsEOF() const { return m_iPosition >= GetLength(); }
 
   void Seek(From eSeek, FX_FILESIZE iOffset);
-  FX_STRSIZE ReadString(wchar_t* pStr, FX_STRSIZE iMaxLength, bool* bEOS);
+  size_t ReadString(wchar_t* pStr, size_t iMaxLength, bool* bEOS);
 
   void WriteString(const WideStringView& str);
 
@@ -39,14 +39,14 @@
  private:
   CFX_SeekableStreamProxy(const RetainPtr<IFX_SeekableStream>& stream,
                           bool isWriteSteam);
-  CFX_SeekableStreamProxy(uint8_t* data, FX_STRSIZE size);
+  CFX_SeekableStreamProxy(uint8_t* data, size_t size);
   ~CFX_SeekableStreamProxy() override;
 
-  FX_STRSIZE ReadData(uint8_t* pBuffer, FX_STRSIZE iBufferSize);
+  size_t ReadData(uint8_t* pBuffer, size_t iBufferSize);
 
   bool m_IsWriteStream;
   uint16_t m_wCodePage;
-  FX_STRSIZE m_wBOMLength;
+  size_t m_wBOMLength;
   FX_FILESIZE m_iPosition;
   RetainPtr<IFX_SeekableStream> m_pStream;
 };
diff --git a/core/fxcrt/cfx_widetextbuf.cpp b/core/fxcrt/cfx_widetextbuf.cpp
index d51e5ea..08e4921 100644
--- a/core/fxcrt/cfx_widetextbuf.cpp
+++ b/core/fxcrt/cfx_widetextbuf.cpp
@@ -6,7 +6,7 @@
 
 #include "core/fxcrt/cfx_widetextbuf.h"
 
-FX_STRSIZE CFX_WideTextBuf::GetLength() const {
+size_t CFX_WideTextBuf::GetLength() const {
   return m_DataSize / sizeof(wchar_t);
 }
 
@@ -29,10 +29,10 @@
 CFX_WideTextBuf& CFX_WideTextBuf::operator<<(int i) {
   char buf[32];
   FXSYS_itoa(i, buf, 10);
-  FX_STRSIZE len = FXSYS_strlen(buf);
+  size_t len = FXSYS_strlen(buf);
   ExpandBuf(len * sizeof(wchar_t));
   wchar_t* str = (wchar_t*)(m_pBuffer.get() + m_DataSize);
-  for (FX_STRSIZE j = 0; j < len; j++) {
+  for (size_t j = 0; j < len; j++) {
     *str++ = buf[j];
   }
   m_DataSize += len * sizeof(wchar_t);
@@ -41,10 +41,10 @@
 
 CFX_WideTextBuf& CFX_WideTextBuf::operator<<(double f) {
   char buf[32];
-  FX_STRSIZE len = FX_ftoa((float)f, buf);
+  size_t len = FX_ftoa((float)f, buf);
   ExpandBuf(len * sizeof(wchar_t));
   wchar_t* str = (wchar_t*)(m_pBuffer.get() + m_DataSize);
-  for (FX_STRSIZE i = 0; i < len; i++) {
+  for (size_t i = 0; i < len; i++) {
     *str++ = buf[i];
   }
   m_DataSize += len * sizeof(wchar_t);
diff --git a/core/fxcrt/cfx_widetextbuf.h b/core/fxcrt/cfx_widetextbuf.h
index 77fe414..84553a3 100644
--- a/core/fxcrt/cfx_widetextbuf.h
+++ b/core/fxcrt/cfx_widetextbuf.h
@@ -14,7 +14,7 @@
 class CFX_WideTextBuf : public CFX_BinaryBuf {
  public:
   void AppendChar(wchar_t wch);
-  FX_STRSIZE GetLength() const override;
+  size_t GetLength() const override;
   wchar_t* GetBuffer() const {
     return reinterpret_cast<wchar_t*>(m_pBuffer.get());
   }
diff --git a/core/fxcrt/fx_safe_types.h b/core/fxcrt/fx_safe_types.h
index c7362b8..aae6080 100644
--- a/core/fxcrt/fx_safe_types.h
+++ b/core/fxcrt/fx_safe_types.h
@@ -14,6 +14,6 @@
 typedef pdfium::base::CheckedNumeric<int32_t> FX_SAFE_INT32;
 typedef pdfium::base::CheckedNumeric<size_t> FX_SAFE_SIZE_T;
 typedef pdfium::base::CheckedNumeric<FX_FILESIZE> FX_SAFE_FILESIZE;
-typedef pdfium::base::CheckedNumeric<FX_STRSIZE> FX_SAFE_STRSIZE;
+typedef pdfium::base::CheckedNumeric<size_t> FX_SAFE_STRSIZE;
 
 #endif  // CORE_FXCRT_FX_SAFE_TYPES_H_
diff --git a/core/fxcrt/fx_string.cpp b/core/fxcrt/fx_string.cpp
index ce4e187..233c5e6 100644
--- a/core/fxcrt/fx_string.cpp
+++ b/core/fxcrt/fx_string.cpp
@@ -62,7 +62,7 @@
 }  // namespace
 
 ByteString FX_UTF8Encode(const WideStringView& wsStr) {
-  FX_STRSIZE len = wsStr.GetLength();
+  size_t len = wsStr.GetLength();
   const wchar_t* pStr = wsStr.unterminated_c_str();
   CFX_UTF8Encoder encoder;
   while (len-- > 0)
@@ -99,7 +99,7 @@
   pdfium::base::CheckedNumeric<uint32_t> integer = 0;
   bool bNegative = false;
   bool bSigned = false;
-  FX_STRSIZE cc = 0;
+  size_t cc = 0;
   if (strc[0] == '+') {
     cc++;
     bSigned = true;
@@ -184,7 +184,7 @@
   return FX_atof(FX_UTF8Encode(wsStr).c_str());
 }
 
-FX_STRSIZE FX_ftoa(float d, char* buf) {
+size_t FX_ftoa(float d, char* buf) {
   buf[0] = '0';
   buf[1] = '\0';
   if (d == 0.0f) {
@@ -208,13 +208,13 @@
     return 1;
   }
   char buf2[32];
-  FX_STRSIZE buf_size = 0;
+  size_t buf_size = 0;
   if (bNegative) {
     buf[buf_size++] = '-';
   }
   int i = scaled / scale;
   FXSYS_itoa(i, buf2, 10);
-  FX_STRSIZE len = FXSYS_strlen(buf2);
+  size_t len = FXSYS_strlen(buf2);
   memcpy(buf + buf_size, buf2, len);
   buf_size += len;
   int fraction = scaled % scale;
diff --git a/core/fxcrt/fx_string.h b/core/fxcrt/fx_string.h
index 0481a15..4c24181 100644
--- a/core/fxcrt/fx_string.h
+++ b/core/fxcrt/fx_string.h
@@ -18,6 +18,6 @@
 float FX_atof(const ByteStringView& str);
 float FX_atof(const WideStringView& wsStr);
 bool FX_atonum(const ByteStringView& str, void* pData);
-FX_STRSIZE FX_ftoa(float f, char* buf);
+size_t FX_ftoa(float f, char* buf);
 
 #endif  // CORE_FXCRT_FX_STRING_H_
diff --git a/core/fxcrt/fx_system.h b/core/fxcrt/fx_system.h
index 426dc08..2c84b02 100644
--- a/core/fxcrt/fx_system.h
+++ b/core/fxcrt/fx_system.h
@@ -76,10 +76,6 @@
 #define IsFloatSmaller(fa, fb) ((fa) < (fb) && !IsFloatZero((fa) - (fb)))
 #define IsFloatEqual(fa, fb) IsFloatZero((fa) - (fb))
 
-// Unsigned value used to represent a location or range in a string.
-// TODO(rharrison): Remove and use size_t directly once int->size_t stabilizes.
-typedef size_t FX_STRSIZE;
-
 // PDFium file sizes match the platform, but PDFium itself does not support
 // files larger than 2GB even if the platform does. The value must be signed
 // to support -1 error returns.
@@ -120,15 +116,15 @@
 
 #include "third_party/base/numerics/safe_conversions.h"
 
-#define FXSYS_strlen(ptr) pdfium::base::checked_cast<FX_STRSIZE>(strlen(ptr))
-#define FXSYS_wcslen(ptr) pdfium::base::checked_cast<FX_STRSIZE>(wcslen(ptr))
+#define FXSYS_strlen(ptr) (strlen(ptr))
+#define FXSYS_wcslen(ptr) (wcslen(ptr))
 
 // Overloaded functions for C++ templates
-inline FX_STRSIZE FXSYS_len(const char* ptr) {
+inline size_t FXSYS_len(const char* ptr) {
   return FXSYS_strlen(ptr);
 }
 
-inline FX_STRSIZE FXSYS_len(const wchar_t* ptr) {
+inline size_t FXSYS_len(const wchar_t* ptr) {
   return FXSYS_wcslen(ptr);
 }
 
@@ -150,8 +146,8 @@
 
 extern "C" {
 #else
-#define FXSYS_strlen(ptr) ((FX_STRSIZE)strlen(ptr))
-#define FXSYS_wcslen(ptr) ((FX_STRSIZE)wcslen(ptr))
+#define FXSYS_strlen(ptr) (strlen(ptr))
+#define FXSYS_wcslen(ptr) (wcslen(ptr))
 #endif  // __cplusplus
 
 #if _FX_PLATFORM_ == _FX_PLATFORM_WINDOWS_
diff --git a/core/fxcrt/string_data_template.h b/core/fxcrt/string_data_template.h
index afec50f..bc797c0 100644
--- a/core/fxcrt/string_data_template.h
+++ b/core/fxcrt/string_data_template.h
@@ -16,13 +16,13 @@
 template <typename CharType>
 class StringDataTemplate {
  public:
-  static StringDataTemplate* Create(FX_STRSIZE nLen) {
+  static StringDataTemplate* Create(size_t nLen) {
     ASSERT(nLen > 0);
 
     // Calculate space needed for the fixed portion of the struct plus the
     // NUL char that is not included in |m_nAllocLength|.
     int overhead = offsetof(StringDataTemplate, m_String) + sizeof(CharType);
-    pdfium::base::CheckedNumeric<FX_STRSIZE> nSize = nLen;
+    pdfium::base::CheckedNumeric<size_t> nSize = nLen;
     nSize *= sizeof(CharType);
     nSize += overhead;
 
@@ -32,8 +32,8 @@
     // by using this otherwise wasted space.
     nSize += 7;
     nSize &= ~7;
-    FX_STRSIZE totalSize = nSize.ValueOrDie();
-    FX_STRSIZE usableLen = (totalSize - overhead) / sizeof(CharType);
+    size_t totalSize = nSize.ValueOrDie();
+    size_t usableLen = (totalSize - overhead) / sizeof(CharType);
     ASSERT(usableLen >= nLen);
 
     void* pData = pdfium::base::PartitionAllocGeneric(
@@ -47,7 +47,7 @@
     return result;
   }
 
-  static StringDataTemplate* Create(const CharType* pStr, FX_STRSIZE nLen) {
+  static StringDataTemplate* Create(const CharType* pStr, size_t nLen) {
     StringDataTemplate* result = Create(nLen);
     result->CopyContents(pStr, nLen);
     return result;
@@ -60,7 +60,7 @@
                                          this);
   }
 
-  bool CanOperateInPlace(FX_STRSIZE nTotalLen) const {
+  bool CanOperateInPlace(size_t nTotalLen) const {
     return m_nRefs <= 1 && nTotalLen <= m_nAllocLength;
   }
 
@@ -70,15 +70,13 @@
            (other.m_nDataLength + 1) * sizeof(CharType));
   }
 
-  void CopyContents(const CharType* pStr, FX_STRSIZE nLen) {
+  void CopyContents(const CharType* pStr, size_t nLen) {
     ASSERT(nLen >= 0 && nLen <= m_nAllocLength);
     memcpy(m_String, pStr, nLen * sizeof(CharType));
     m_String[nLen] = 0;
   }
 
-  void CopyContentsAt(FX_STRSIZE offset,
-                      const CharType* pStr,
-                      FX_STRSIZE nLen) {
+  void CopyContentsAt(size_t offset, const CharType* pStr, size_t nLen) {
     ASSERT(offset >= 0 && nLen >= 0 && offset + nLen <= m_nAllocLength);
     memcpy(m_String + offset, pStr, nLen * sizeof(CharType));
     m_String[offset + nLen] = 0;
@@ -91,19 +89,17 @@
   // the address space itself is a good upper bound on it.
   intptr_t m_nRefs;
 
-  // |FX_STRSIZE| is currently typedef'd as |int|.
-  // TODO(palmer): It should be a |size_t|, or at least unsigned.
   // These lengths are in terms of number of characters, not bytes, and do not
   // include the terminating NUL character, but the underlying buffer is sized
   // to be capable of holding it.
-  FX_STRSIZE m_nDataLength;
-  FX_STRSIZE m_nAllocLength;
+  size_t m_nDataLength;
+  size_t m_nAllocLength;
 
   // Not really 1, variable size.
   CharType m_String[1];
 
  private:
-  StringDataTemplate(FX_STRSIZE dataLen, FX_STRSIZE allocLen)
+  StringDataTemplate(size_t dataLen, size_t allocLen)
       : m_nRefs(0), m_nDataLength(dataLen), m_nAllocLength(allocLen) {
     ASSERT(dataLen >= 0);
     ASSERT(dataLen <= allocLen);
diff --git a/core/fxcrt/string_view_template.h b/core/fxcrt/string_view_template.h
index 31c2c1e..346e5a4 100644
--- a/core/fxcrt/string_view_template.h
+++ b/core/fxcrt/string_view_template.h
@@ -39,13 +39,13 @@
       : m_Ptr(reinterpret_cast<const UnsignedType*>(ptr)),
         m_Length(ptr ? FXSYS_len(ptr) : 0) {}
 
-  StringViewTemplate(const CharType* ptr, FX_STRSIZE len)
+  StringViewTemplate(const CharType* ptr, size_t len)
       : m_Ptr(reinterpret_cast<const UnsignedType*>(ptr)), m_Length(len) {}
 
   template <typename U = UnsignedType>
   StringViewTemplate(
       const UnsignedType* ptr,
-      FX_STRSIZE size,
+      size_t size,
       typename std::enable_if<!std::is_same<U, CharType>::value>::type* = 0)
       : m_Ptr(ptr), m_Length(size) {}
 
@@ -64,7 +64,7 @@
 
   // Any changes to |vec| invalidate the string.
   explicit StringViewTemplate(const std::vector<UnsignedType>& vec) {
-    m_Length = pdfium::CollectionSize<FX_STRSIZE>(vec);
+    m_Length = pdfium::CollectionSize<size_t>(vec);
     m_Ptr = m_Length ? vec.data() : nullptr;
   }
 
@@ -116,8 +116,8 @@
       return 0;
 
     uint32_t strid = 0;
-    FX_STRSIZE size = std::min(static_cast<FX_STRSIZE>(4), m_Length);
-    for (FX_STRSIZE i = 0; i < size; i++)
+    size_t size = std::min(static_cast<size_t>(4), m_Length);
+    for (size_t i = 0; i < size; i++)
       strid = strid * 256 + m_Ptr.Get()[i];
 
     return strid << ((4 - size) * 8);
@@ -128,12 +128,12 @@
     return reinterpret_cast<const CharType*>(m_Ptr.Get());
   }
 
-  FX_STRSIZE GetLength() const { return m_Length; }
+  size_t GetLength() const { return m_Length; }
   bool IsEmpty() const { return m_Length == 0; }
-  bool IsValidIndex(FX_STRSIZE index) const { return index < GetLength(); }
-  bool IsValidLength(FX_STRSIZE length) const { return length <= GetLength(); }
+  bool IsValidIndex(size_t index) const { return index < GetLength(); }
+  bool IsValidLength(size_t length) const { return length <= GetLength(); }
 
-  const UnsignedType& operator[](const FX_STRSIZE index) const {
+  const UnsignedType& operator[](const size_t index) const {
     ASSERT(IsValidIndex(index));
     return m_Ptr.Get()[index];
   }
@@ -144,22 +144,22 @@
     return GetLength() ? (*this)[GetLength() - 1] : 0;
   }
 
-  const CharType CharAt(const FX_STRSIZE index) const {
+  const CharType CharAt(const size_t index) const {
     ASSERT(IsValidIndex(index));
     return static_cast<CharType>(m_Ptr.Get()[index]);
   }
 
-  pdfium::Optional<FX_STRSIZE> Find(CharType ch) const {
+  pdfium::Optional<size_t> Find(CharType ch) const {
     const UnsignedType* found = reinterpret_cast<const UnsignedType*>(FXSYS_chr(
         reinterpret_cast<const CharType*>(m_Ptr.Get()), ch, m_Length));
 
-    return found ? pdfium::Optional<FX_STRSIZE>(found - m_Ptr.Get())
-                 : pdfium::Optional<FX_STRSIZE>();
+    return found ? pdfium::Optional<size_t>(found - m_Ptr.Get())
+                 : pdfium::Optional<size_t>();
   }
 
   bool Contains(CharType ch) const { return Find(ch).has_value(); }
 
-  StringViewTemplate Mid(FX_STRSIZE first, FX_STRSIZE count) const {
+  StringViewTemplate Mid(size_t first, size_t count) const {
     if (!m_Ptr.Get())
       return StringViewTemplate();
 
@@ -175,13 +175,13 @@
     return StringViewTemplate(m_Ptr.Get() + first, count);
   }
 
-  StringViewTemplate Left(FX_STRSIZE count) const {
+  StringViewTemplate Left(size_t count) const {
     if (count == 0 || !IsValidLength(count))
       return StringViewTemplate();
     return Mid(0, count);
   }
 
-  StringViewTemplate Right(FX_STRSIZE count) const {
+  StringViewTemplate Right(size_t count) const {
     if (count == 0 || !IsValidLength(count))
       return StringViewTemplate();
     return Mid(GetLength() - count, count);
@@ -191,7 +191,7 @@
     if (IsEmpty())
       return StringViewTemplate();
 
-    FX_STRSIZE pos = GetLength();
+    size_t pos = GetLength();
     while (pos && CharAt(pos - 1) == ch)
       pos--;
 
@@ -217,7 +217,7 @@
 
  protected:
   UnownedPtr<const UnsignedType> m_Ptr;
-  FX_STRSIZE m_Length;
+  size_t m_Length;
 
  private:
   void* operator new(size_t) throw() { return nullptr; }
diff --git a/core/fxcrt/widestring.cpp b/core/fxcrt/widestring.cpp
index 5fe7ee4..a4632ee 100644
--- a/core/fxcrt/widestring.cpp
+++ b/core/fxcrt/widestring.cpp
@@ -55,9 +55,9 @@
   return nullptr;
 }
 
-pdfium::Optional<FX_STRSIZE> GuessSizeForVSWPrintf(const wchar_t* pFormat,
-                                                   va_list argList) {
-  FX_STRSIZE nMaxLen = 0;
+pdfium::Optional<size_t> GuessSizeForVSWPrintf(const wchar_t* pFormat,
+                                               va_list argList) {
+  size_t nMaxLen = 0;
   for (const wchar_t* pStr = pFormat; *pStr != 0; pStr++) {
     if (*pStr != '%' || *(pStr = pStr + 1) == '%') {
       ++nMaxLen;
@@ -80,7 +80,7 @@
         ++pStr;
     }
     if (nWidth < 0 || nWidth > 128 * 1024)
-      return pdfium::Optional<FX_STRSIZE>();
+      return pdfium::Optional<size_t>();
     int nPrecision = 0;
     if (*pStr == '.') {
       pStr++;
@@ -94,7 +94,7 @@
       }
     }
     if (nPrecision < 0 || nPrecision > 128 * 1024)
-      return pdfium::Optional<FX_STRSIZE>();
+      return pdfium::Optional<size_t>();
     int nModifier = 0;
     if (*pStr == L'I' && *(pStr + 1) == L'6' && *(pStr + 2) == L'4') {
       pStr += 3;
@@ -243,7 +243,7 @@
     nMaxLen += nItemLen;
   }
   nMaxLen += 32;  // Fudge factor.
-  return pdfium::Optional<FX_STRSIZE>(nMaxLen);
+  return pdfium::Optional<size_t>(nMaxLen);
 }
 
 #ifndef NDEBUG
@@ -293,7 +293,7 @@
   m_pData.Swap(other.m_pData);
 }
 
-WideString::WideString(const wchar_t* pStr, FX_STRSIZE nLen) {
+WideString::WideString(const wchar_t* pStr, size_t nLen) {
   if (nLen)
     m_pData.Reset(StringData::Create(pStr, nLen));
 }
@@ -317,7 +317,7 @@
   FX_SAFE_STRSIZE nSafeLen = str1.GetLength();
   nSafeLen += str2.GetLength();
 
-  FX_STRSIZE nNewLen = nSafeLen.ValueOrDie();
+  size_t nNewLen = nSafeLen.ValueOrDie();
   if (nNewLen == 0)
     return;
 
@@ -332,13 +332,13 @@
   for (const auto& item : list)
     nSafeLen += item.GetLength();
 
-  FX_STRSIZE nNewLen = nSafeLen.ValueOrDie();
+  size_t nNewLen = nSafeLen.ValueOrDie();
   if (nNewLen == 0)
     return;
 
   m_pData.Reset(StringData::Create(nNewLen));
 
-  FX_STRSIZE nOffset = 0;
+  size_t nOffset = 0;
   for (const auto& item : list) {
     m_pData->CopyContentsAt(nOffset, item.unterminated_c_str(),
                             item.GetLength());
@@ -443,13 +443,13 @@
   return result < 0 || (result == 0 && GetLength() < str.GetLength());
 }
 
-void WideString::AssignCopy(const wchar_t* pSrcData, FX_STRSIZE nSrcLen) {
+void WideString::AssignCopy(const wchar_t* pSrcData, size_t nSrcLen) {
   AllocBeforeWrite(nSrcLen);
   m_pData->CopyContents(pSrcData, nSrcLen);
   m_pData->m_nDataLength = nSrcLen;
 }
 
-void WideString::ReallocBeforeWrite(FX_STRSIZE nNewLength) {
+void WideString::ReallocBeforeWrite(size_t nNewLength) {
   if (m_pData && m_pData->CanOperateInPlace(nNewLength))
     return;
 
@@ -460,7 +460,7 @@
 
   RetainPtr<StringData> pNewData(StringData::Create(nNewLength));
   if (m_pData) {
-    FX_STRSIZE nCopyLength = std::min(m_pData->m_nDataLength, nNewLength);
+    size_t nCopyLength = std::min(m_pData->m_nDataLength, nNewLength);
     pNewData->CopyContents(m_pData->m_String, nCopyLength);
     pNewData->m_nDataLength = nCopyLength;
   } else {
@@ -470,7 +470,7 @@
   m_pData.Swap(pNewData);
 }
 
-void WideString::AllocBeforeWrite(FX_STRSIZE nNewLength) {
+void WideString::AllocBeforeWrite(size_t nNewLength) {
   if (m_pData && m_pData->CanOperateInPlace(nNewLength))
     return;
 
@@ -482,7 +482,7 @@
   m_pData.Reset(StringData::Create(nNewLength));
 }
 
-void WideString::ReleaseBuffer(FX_STRSIZE nNewLength) {
+void WideString::ReleaseBuffer(size_t nNewLength) {
   if (!m_pData)
     return;
 
@@ -503,11 +503,11 @@
   }
 }
 
-void WideString::Reserve(FX_STRSIZE len) {
+void WideString::Reserve(size_t len) {
   GetBuffer(len);
 }
 
-wchar_t* WideString::GetBuffer(FX_STRSIZE nMinBufLength) {
+wchar_t* WideString::GetBuffer(size_t nMinBufLength) {
   if (!m_pData) {
     if (nMinBufLength == 0)
       return nullptr;
@@ -532,28 +532,28 @@
   return m_pData->m_String;
 }
 
-FX_STRSIZE WideString::Delete(FX_STRSIZE index, FX_STRSIZE count) {
+size_t WideString::Delete(size_t index, size_t count) {
   if (!m_pData)
     return 0;
 
-  FX_STRSIZE old_length = m_pData->m_nDataLength;
+  size_t old_length = m_pData->m_nDataLength;
   if (count == 0 ||
-      index != pdfium::clamp(index, static_cast<FX_STRSIZE>(0), old_length))
+      index != pdfium::clamp(index, static_cast<size_t>(0), old_length))
     return old_length;
 
-  FX_STRSIZE removal_length = index + count;
+  size_t removal_length = index + count;
   if (removal_length > old_length)
     return old_length;
 
   ReallocBeforeWrite(old_length);
-  FX_STRSIZE chars_to_copy = old_length - removal_length + 1;
+  size_t chars_to_copy = old_length - removal_length + 1;
   wmemmove(m_pData->m_String + index, m_pData->m_String + removal_length,
            chars_to_copy);
   m_pData->m_nDataLength = old_length - count;
   return m_pData->m_nDataLength;
 }
 
-void WideString::Concat(const wchar_t* pSrcData, FX_STRSIZE nSrcLen) {
+void WideString::Concat(const wchar_t* pSrcData, size_t nSrcLen) {
   if (!pSrcData || nSrcLen == 0)
     return;
 
@@ -596,7 +596,7 @@
   return result;
 }
 
-WideString WideString::Mid(FX_STRSIZE first, FX_STRSIZE count) const {
+WideString WideString::Mid(size_t first, size_t count) const {
   if (!m_pData)
     return WideString();
 
@@ -617,21 +617,21 @@
   return dest;
 }
 
-WideString WideString::Left(FX_STRSIZE count) const {
+WideString WideString::Left(size_t count) const {
   if (count == 0 || !IsValidLength(count))
     return WideString();
   return Mid(0, count);
 }
 
-WideString WideString::Right(FX_STRSIZE count) const {
+WideString WideString::Right(size_t count) const {
   if (count == 0 || !IsValidLength(count))
     return WideString();
   return Mid(GetLength() - count, count);
 }
 
 void WideString::AllocCopy(WideString& dest,
-                           FX_STRSIZE nCopyLen,
-                           FX_STRSIZE nCopyIndex) const {
+                           size_t nCopyLen,
+                           size_t nCopyIndex) const {
   if (nCopyLen == 0)
     return;
 
@@ -640,7 +640,7 @@
   dest.m_pData.Swap(pNewData);
 }
 
-bool WideString::TryVSWPrintf(FX_STRSIZE size,
+bool WideString::TryVSWPrintf(size_t size,
                               const wchar_t* pFormat,
                               va_list argList) {
   GetBuffer(size);
@@ -676,7 +676,7 @@
   while (maxLen < 32 * 1024) {
     va_copy(argListCopy, argList);
     bool bSufficientBuffer =
-        TryVSWPrintf(static_cast<FX_STRSIZE>(maxLen), format, argListCopy);
+        TryVSWPrintf(static_cast<size_t>(maxLen), format, argListCopy);
     va_end(argListCopy);
     if (bSufficientBuffer)
       break;
@@ -691,12 +691,12 @@
   va_end(argList);
 }
 
-FX_STRSIZE WideString::Insert(FX_STRSIZE location, wchar_t ch) {
-  const FX_STRSIZE cur_length = m_pData ? m_pData->m_nDataLength : 0;
+size_t WideString::Insert(size_t location, wchar_t ch) {
+  const size_t cur_length = m_pData ? m_pData->m_nDataLength : 0;
   if (!IsValidLength(location))
     return cur_length;
 
-  const FX_STRSIZE new_length = cur_length + 1;
+  const size_t new_length = cur_length + 1;
   ReallocBeforeWrite(new_length);
   wmemmove(m_pData->m_String + location + 1, m_pData->m_String + location,
            new_length - location);
@@ -705,35 +705,34 @@
   return new_length;
 }
 
-pdfium::Optional<FX_STRSIZE> WideString::Find(wchar_t ch,
-                                              FX_STRSIZE start) const {
+pdfium::Optional<size_t> WideString::Find(wchar_t ch, size_t start) const {
   if (!m_pData)
-    return pdfium::Optional<FX_STRSIZE>();
+    return pdfium::Optional<size_t>();
 
   if (!IsValidIndex(start))
-    return pdfium::Optional<FX_STRSIZE>();
+    return pdfium::Optional<size_t>();
 
   const wchar_t* pStr =
       wmemchr(m_pData->m_String + start, ch, m_pData->m_nDataLength - start);
-  return pStr ? pdfium::Optional<FX_STRSIZE>(
-                    static_cast<FX_STRSIZE>(pStr - m_pData->m_String))
-              : pdfium::Optional<FX_STRSIZE>();
+  return pStr ? pdfium::Optional<size_t>(
+                    static_cast<size_t>(pStr - m_pData->m_String))
+              : pdfium::Optional<size_t>();
 }
 
-pdfium::Optional<FX_STRSIZE> WideString::Find(const WideStringView& subStr,
-                                              FX_STRSIZE start) const {
+pdfium::Optional<size_t> WideString::Find(const WideStringView& subStr,
+                                          size_t start) const {
   if (!m_pData)
-    return pdfium::Optional<FX_STRSIZE>();
+    return pdfium::Optional<size_t>();
 
   if (!IsValidIndex(start))
-    return pdfium::Optional<FX_STRSIZE>();
+    return pdfium::Optional<size_t>();
 
   const wchar_t* pStr =
       FX_wcsstr(m_pData->m_String + start, m_pData->m_nDataLength - start,
                 subStr.unterminated_c_str(), subStr.GetLength());
-  return pStr ? pdfium::Optional<FX_STRSIZE>(
-                    static_cast<FX_STRSIZE>(pStr - m_pData->m_String))
-              : pdfium::Optional<FX_STRSIZE>();
+  return pStr ? pdfium::Optional<size_t>(
+                    static_cast<size_t>(pStr - m_pData->m_String))
+              : pdfium::Optional<size_t>();
 }
 
 void WideString::MakeLower() {
@@ -752,7 +751,7 @@
   FXSYS_wcsupr(m_pData->m_String);
 }
 
-FX_STRSIZE WideString::Remove(wchar_t chRemove) {
+size_t WideString::Remove(wchar_t chRemove) {
   if (!m_pData || m_pData->m_nDataLength < 1)
     return 0;
 
@@ -781,24 +780,25 @@
   }
 
   *pstrDest = 0;
-  FX_STRSIZE count = static_cast<FX_STRSIZE>(pstrSource - pstrDest);
+  size_t count = static_cast<size_t>(pstrSource - pstrDest);
   m_pData->m_nDataLength -= count;
   return count;
 }
 
-FX_STRSIZE WideString::Replace(const WideStringView& pOld,
-                               const WideStringView& pNew) {
+size_t WideString::Replace(const WideStringView& pOld,
+                           const WideStringView& pNew) {
   if (!m_pData || pOld.IsEmpty())
     return 0;
 
-  FX_STRSIZE nSourceLen = pOld.GetLength();
-  FX_STRSIZE nReplacementLen = pNew.GetLength();
-  FX_STRSIZE count = 0;
+  size_t nSourceLen = pOld.GetLength();
+  size_t nReplacementLen = pNew.GetLength();
+  size_t count = 0;
   const wchar_t* pStart = m_pData->m_String;
   wchar_t* pEnd = m_pData->m_String + m_pData->m_nDataLength;
   while (1) {
-    const wchar_t* pTarget = FX_wcsstr(pStart, (FX_STRSIZE)(pEnd - pStart),
-                                       pOld.unterminated_c_str(), nSourceLen);
+    const wchar_t* pTarget =
+        FX_wcsstr(pStart, static_cast<size_t>(pEnd - pStart),
+                  pOld.unterminated_c_str(), nSourceLen);
     if (!pTarget)
       break;
 
@@ -808,7 +808,7 @@
   if (count == 0)
     return 0;
 
-  FX_STRSIZE nNewLength =
+  size_t nNewLength =
       m_pData->m_nDataLength + (nReplacementLen - nSourceLen) * count;
 
   if (nNewLength == 0) {
@@ -819,9 +819,10 @@
   RetainPtr<StringData> pNewData(StringData::Create(nNewLength));
   pStart = m_pData->m_String;
   wchar_t* pDest = pNewData->m_String;
-  for (FX_STRSIZE i = 0; i < count; i++) {
-    const wchar_t* pTarget = FX_wcsstr(pStart, (FX_STRSIZE)(pEnd - pStart),
-                                       pOld.unterminated_c_str(), nSourceLen);
+  for (size_t i = 0; i < count; i++) {
+    const wchar_t* pTarget =
+        FX_wcsstr(pStart, static_cast<size_t>(pEnd - pStart),
+                  pOld.unterminated_c_str(), nSourceLen);
     wmemcpy(pDest, pStart, pTarget - pStart);
     pDest += pTarget - pStart;
     wmemcpy(pDest, pNew.unterminated_c_str(), pNew.GetLength());
@@ -850,29 +851,28 @@
     return WideString();
 
   CFX_UTF8Decoder decoder;
-  for (FX_STRSIZE i = 0; i < str.GetLength(); i++)
+  for (size_t i = 0; i < str.GetLength(); i++)
     decoder.Input(str[i]);
 
   return WideString(decoder.GetResult());
 }
 
 // static
-WideString WideString::FromUTF16LE(const unsigned short* wstr,
-                                   FX_STRSIZE wlen) {
+WideString WideString::FromUTF16LE(const unsigned short* wstr, size_t wlen) {
   if (!wstr || wlen == 0) {
     return WideString();
   }
 
   WideString result;
   wchar_t* buf = result.GetBuffer(wlen);
-  for (FX_STRSIZE i = 0; i < wlen; i++) {
+  for (size_t i = 0; i < wlen; i++) {
     buf[i] = wstr[i];
   }
   result.ReleaseBuffer(wlen);
   return result;
 }
 
-void WideString::SetAt(FX_STRSIZE index, wchar_t c) {
+void WideString::SetAt(size_t index, wchar_t c) {
   ASSERT(IsValidIndex(index));
   ReallocBeforeWrite(m_pData->m_nDataLength);
   m_pData->m_String[index] = c;
@@ -894,10 +894,10 @@
   if (!str.m_pData) {
     return 1;
   }
-  FX_STRSIZE this_len = m_pData->m_nDataLength;
-  FX_STRSIZE that_len = str.m_pData->m_nDataLength;
-  FX_STRSIZE min_len = std::min(this_len, that_len);
-  for (FX_STRSIZE i = 0; i < min_len; i++) {
+  size_t this_len = m_pData->m_nDataLength;
+  size_t that_len = str.m_pData->m_nDataLength;
+  size_t min_len = std::min(this_len, that_len);
+  for (size_t i = 0; i < min_len; i++) {
     if (m_pData->m_String[i] < str.m_pData->m_String[i]) {
       return -1;
     }
@@ -921,8 +921,8 @@
   return FXSYS_wcsicmp(m_pData->m_String, lpsz);
 }
 
-FX_STRSIZE WideString::WStringLength(const unsigned short* str) {
-  FX_STRSIZE len = 0;
+size_t WideString::WStringLength(const unsigned short* str) {
+  size_t len = 0;
   if (str)
     while (str[len])
       len++;
@@ -933,7 +933,7 @@
   if (IsEmpty() || pTargets.IsEmpty())
     return;
 
-  FX_STRSIZE pos = GetLength();
+  size_t pos = GetLength();
   while (pos && pTargets.Contains(m_pData->m_String[pos - 1]))
     pos--;
 
@@ -957,13 +957,13 @@
   if (!m_pData || pTargets.IsEmpty())
     return;
 
-  FX_STRSIZE len = GetLength();
+  size_t len = GetLength();
   if (len == 0)
     return;
 
-  FX_STRSIZE pos = 0;
+  size_t pos = 0;
   while (pos < len) {
-    FX_STRSIZE i = 0;
+    size_t i = 0;
     while (i < pTargets.GetLength() &&
            pTargets.CharAt(i) != m_pData->m_String[pos]) {
       i++;
@@ -977,7 +977,7 @@
     return;
 
   ReallocBeforeWrite(len);
-  FX_STRSIZE nDataLength = len - pos;
+  size_t nDataLength = len - pos;
   memmove(m_pData->m_String, m_pData->m_String + pos,
           (nDataLength + 1) * sizeof(wchar_t));
   m_pData->m_nDataLength = nDataLength;
diff --git a/core/fxcrt/widestring.h b/core/fxcrt/widestring.h
index f56703f..73846e1 100644
--- a/core/fxcrt/widestring.h
+++ b/core/fxcrt/widestring.h
@@ -47,7 +47,7 @@
   // NOLINTNEXTLINE(runtime/explicit)
   WideString(char) = delete;
 
-  WideString(const wchar_t* ptr, FX_STRSIZE len);
+  WideString(const wchar_t* ptr, size_t len);
 
   explicit WideString(const WideStringView& str);
   WideString(const WideStringView& str1, const WideStringView& str2);
@@ -59,9 +59,9 @@
   static WideString FromCodePage(const ByteStringView& str, uint16_t codepage);
 
   static WideString FromUTF8(const ByteStringView& str);
-  static WideString FromUTF16LE(const unsigned short* str, FX_STRSIZE len);
+  static WideString FromUTF16LE(const unsigned short* str, size_t len);
 
-  static FX_STRSIZE WStringLength(const unsigned short* str);
+  static size_t WStringLength(const unsigned short* str);
 
   // Explicit conversion to C-style wide string.
   // Note: Any subsequent modification of |this| will invalidate the result.
@@ -89,13 +89,13 @@
 
   void clear() { m_pData.Reset(); }
 
-  FX_STRSIZE GetLength() const { return m_pData ? m_pData->m_nDataLength : 0; }
-  FX_STRSIZE GetStringLength() const {
+  size_t GetLength() const { return m_pData ? m_pData->m_nDataLength : 0; }
+  size_t GetStringLength() const {
     return m_pData ? FXSYS_wcslen(m_pData->m_String) : 0;
   }
   bool IsEmpty() const { return !GetLength(); }
-  bool IsValidIndex(FX_STRSIZE index) const { return index < GetLength(); }
-  bool IsValidLength(FX_STRSIZE length) const { return length <= GetLength(); }
+  bool IsValidIndex(size_t index) const { return index < GetLength(); }
+  bool IsValidLength(size_t length) const { return length <= GetLength(); }
 
   const WideString& operator=(const wchar_t* str);
   const WideString& operator=(const WideString& stringSrc);
@@ -116,7 +116,7 @@
 
   bool operator<(const WideString& str) const;
 
-  CharType operator[](const FX_STRSIZE index) const {
+  CharType operator[](const size_t index) const {
     ASSERT(IsValidIndex(index));
     return m_pData ? m_pData->m_String[index] : 0;
   }
@@ -124,20 +124,20 @@
   CharType First() const { return GetLength() ? (*this)[0] : 0; }
   CharType Last() const { return GetLength() ? (*this)[GetLength() - 1] : 0; }
 
-  void SetAt(FX_STRSIZE index, wchar_t c);
+  void SetAt(size_t index, wchar_t c);
 
   int Compare(const wchar_t* str) const;
   int Compare(const WideString& str) const;
   int CompareNoCase(const wchar_t* str) const;
 
-  WideString Mid(FX_STRSIZE first, FX_STRSIZE count) const;
-  WideString Left(FX_STRSIZE count) const;
-  WideString Right(FX_STRSIZE count) const;
+  WideString Mid(size_t first, size_t count) const;
+  WideString Left(size_t count) const;
+  WideString Right(size_t count) const;
 
-  FX_STRSIZE Insert(FX_STRSIZE index, wchar_t ch);
-  FX_STRSIZE InsertAtFront(wchar_t ch) { return Insert(0, ch); }
-  FX_STRSIZE InsertAtBack(wchar_t ch) { return Insert(GetLength(), ch); }
-  FX_STRSIZE Delete(FX_STRSIZE index, FX_STRSIZE count = 1);
+  size_t Insert(size_t index, wchar_t ch);
+  size_t InsertAtFront(wchar_t ch) { return Insert(0, ch); }
+  size_t InsertAtBack(wchar_t ch) { return Insert(GetLength(), ch); }
+  size_t Delete(size_t index, size_t count = 1);
 
   void Format(const wchar_t* lpszFormat, ...);
   void FormatV(const wchar_t* lpszFormat, va_list argList);
@@ -153,27 +153,27 @@
   void TrimLeft(wchar_t chTarget);
   void TrimLeft(const WideStringView& pTargets);
 
-  void Reserve(FX_STRSIZE len);
-  wchar_t* GetBuffer(FX_STRSIZE len);
-  void ReleaseBuffer(FX_STRSIZE len);
+  void Reserve(size_t len);
+  wchar_t* GetBuffer(size_t len);
+  void ReleaseBuffer(size_t len);
 
   int GetInteger() const;
   float GetFloat() const;
 
-  pdfium::Optional<FX_STRSIZE> Find(const WideStringView& pSub,
-                                    FX_STRSIZE start = 0) const;
-  pdfium::Optional<FX_STRSIZE> Find(wchar_t ch, FX_STRSIZE start = 0) const;
+  pdfium::Optional<size_t> Find(const WideStringView& pSub,
+                                size_t start = 0) const;
+  pdfium::Optional<size_t> Find(wchar_t ch, size_t start = 0) const;
 
-  bool Contains(const WideStringView& lpszSub, FX_STRSIZE start = 0) const {
+  bool Contains(const WideStringView& lpszSub, size_t start = 0) const {
     return Find(lpszSub, start).has_value();
   }
 
-  bool Contains(char ch, FX_STRSIZE start = 0) const {
+  bool Contains(char ch, size_t start = 0) const {
     return Find(ch, start).has_value();
   }
 
-  FX_STRSIZE Replace(const WideStringView& pOld, const WideStringView& pNew);
-  FX_STRSIZE Remove(wchar_t ch);
+  size_t Replace(const WideStringView& pOld, const WideStringView& pNew);
+  size_t Remove(wchar_t ch);
 
   ByteString UTF8Encode() const;
   ByteString UTF16LE_Encode() const;
@@ -181,16 +181,14 @@
  protected:
   using StringData = StringDataTemplate<wchar_t>;
 
-  void ReallocBeforeWrite(FX_STRSIZE nLen);
-  void AllocBeforeWrite(FX_STRSIZE nLen);
-  void AllocCopy(WideString& dest,
-                 FX_STRSIZE nCopyLen,
-                 FX_STRSIZE nCopyIndex) const;
-  void AssignCopy(const wchar_t* pSrcData, FX_STRSIZE nSrcLen);
-  void Concat(const wchar_t* lpszSrcData, FX_STRSIZE nSrcLen);
+  void ReallocBeforeWrite(size_t nLen);
+  void AllocBeforeWrite(size_t nLen);
+  void AllocCopy(WideString& dest, size_t nCopyLen, size_t nCopyIndex) const;
+  void AssignCopy(const wchar_t* pSrcData, size_t nSrcLen);
+  void Concat(const wchar_t* lpszSrcData, size_t nSrcLen);
 
   // Returns true unless we ran out of space.
-  bool TryVSWPrintf(FX_STRSIZE size, const wchar_t* format, va_list argList);
+  bool TryVSWPrintf(size_t size, const wchar_t* format, va_list argList);
 
   RetainPtr<StringData> m_pData;
 
diff --git a/core/fxcrt/widestring_unittest.cpp b/core/fxcrt/widestring_unittest.cpp
index 5eba72e..1f72196 100644
--- a/core/fxcrt/widestring_unittest.cpp
+++ b/core/fxcrt/widestring_unittest.cpp
@@ -510,7 +510,7 @@
   EXPECT_FALSE(empty_string.Find(L'a').has_value());
   EXPECT_FALSE(empty_string.Find(L'\0').has_value());
 
-  pdfium::Optional<FX_STRSIZE> result;
+  pdfium::Optional<size_t> result;
   WideString single_string(L"a");
   result = single_string.Find(L'a');
   ASSERT_TRUE(result.has_value());
@@ -1017,7 +1017,7 @@
   EXPECT_FALSE(empty_string.Find(L'a').has_value());
   EXPECT_FALSE(empty_string.Find(L'\0').has_value());
 
-  pdfium::Optional<FX_STRSIZE> result;
+  pdfium::Optional<size_t> result;
   WideStringView single_string(L"a");
   result = single_string.Find(L'a');
   ASSERT_TRUE(result.has_value());
diff --git a/core/fxcrt/xml/cfx_xmlsyntaxparser.cpp b/core/fxcrt/xml/cfx_xmlsyntaxparser.cpp
index 5dcb867..2d1d3d7 100644
--- a/core/fxcrt/xml/cfx_xmlsyntaxparser.cpp
+++ b/core/fxcrt/xml/cfx_xmlsyntaxparser.cpp
@@ -103,7 +103,7 @@
 
   m_iXMLPlaneSize =
       std::min(m_iXMLPlaneSize,
-               pdfium::base::checked_cast<FX_STRSIZE>(m_pStream->GetLength()));
+               pdfium::base::checked_cast<size_t>(m_pStream->GetLength()));
   m_iCurrentPos = m_pStream->GetBOMLength();
 
   FX_SAFE_STRSIZE alloc_size_safe = m_iXMLPlaneSize;
diff --git a/core/fxcrt/xml/cfx_xmlsyntaxparser.h b/core/fxcrt/xml/cfx_xmlsyntaxparser.h
index 8379aa4..b93bbb6 100644
--- a/core/fxcrt/xml/cfx_xmlsyntaxparser.h
+++ b/core/fxcrt/xml/cfx_xmlsyntaxparser.h
@@ -101,14 +101,14 @@
   void ParseTextChar(wchar_t ch);
 
   RetainPtr<CFX_SeekableStreamProxy> m_pStream;
-  FX_STRSIZE m_iXMLPlaneSize;
+  size_t m_iXMLPlaneSize;
   FX_FILESIZE m_iCurrentPos;
   int32_t m_iCurrentNodeNum;
   int32_t m_iLastNodeNum;
   int32_t m_iParsedBytes;
   FX_FILESIZE m_ParsedChars;
   std::vector<wchar_t> m_Buffer;
-  FX_STRSIZE m_iBufferChars;
+  size_t m_iBufferChars;
   bool m_bEOS;
   FX_FILESIZE m_Start;  // Start position in m_Buffer
   FX_FILESIZE m_End;    // End position in m_Buffer
diff --git a/core/fxge/android/cfpf_skiafontmgr.cpp b/core/fxge/android/cfpf_skiafontmgr.cpp
index 4be3566..af1d58f 100644
--- a/core/fxge/android/cfpf_skiafontmgr.cpp
+++ b/core/fxge/android/cfpf_skiafontmgr.cpp
@@ -37,7 +37,8 @@
   if (!pFileRead)
     return 0;
 
-  if (!pFileRead->ReadBlock(buffer, (FX_FILESIZE)offset, (size_t)count))
+  if (!pFileRead->ReadBlock(buffer, (FX_FILESIZE)offset,
+                            static_cast<size_t>(count)))
     return 0;
 
   return count;
diff --git a/core/fxge/apple/fx_quartz_device.cpp b/core/fxge/apple/fx_quartz_device.cpp
index b24638c..4ab6620 100644
--- a/core/fxge/apple/fx_quartz_device.cpp
+++ b/core/fxge/apple/fx_quartz_device.cpp
@@ -49,7 +49,7 @@
 
 void* CQuartz2D::CreateFont(const uint8_t* pFontData, uint32_t dwFontSize) {
   CGDataProviderRef pDataProvider = CGDataProviderCreateWithData(
-      nullptr, pFontData, (size_t)dwFontSize, nullptr);
+      nullptr, pFontData, static_cast<size_t>(dwFontSize), nullptr);
   if (!pDataProvider)
     return nullptr;
 
diff --git a/core/fxge/win32/cfx_psrenderer.cpp b/core/fxge/win32/cfx_psrenderer.cpp
index 9a617da..d973918 100644
--- a/core/fxge/win32/cfx_psrenderer.cpp
+++ b/core/fxge/win32/cfx_psrenderer.cpp
@@ -458,7 +458,7 @@
 
     int bpp = pConverted->GetBPP() / 8;
     uint8_t* output_buf = nullptr;
-    FX_STRSIZE output_size = 0;
+    size_t output_size = 0;
     const char* filter = nullptr;
     if ((m_PSLevel == 2 || flags & FXRENDER_IMAGE_LOSSY) &&
         CCodec_JpegModule::JpegEncode(pConverted, &output_buf, &output_size)) {
diff --git a/core/fxge/win32/fx_win32_device.cpp b/core/fxge/win32/fx_win32_device.cpp
index 9957239..35f9a5f 100644
--- a/core/fxge/win32/fx_win32_device.cpp
+++ b/core/fxge/win32/fx_win32_device.cpp
@@ -610,7 +610,7 @@
 
     const unsigned short* pName = reinterpret_cast<const unsigned short*>(
         g_VariantNames[i].m_pVariantName);
-    FX_STRSIZE len = WideString::WStringLength(pName);
+    size_t len = WideString::WStringLength(pName);
     WideString wsName = WideString::FromUTF16LE(pName, len);
     if (wsFace == wsName)
       return hFont;
diff --git a/fpdfsdk/cpdfsdk_interform.cpp b/fpdfsdk/cpdfsdk_interform.cpp
index fd0dffa..635655c 100644
--- a/fpdfsdk/cpdfsdk_interform.cpp
+++ b/fpdfsdk/cpdfsdk_interform.cpp
@@ -442,7 +442,7 @@
                                      bool bUrlEncoded) {
   ByteString textBuf = ExportFieldsToFDFTextBuf(fields, bIncludeOrExclude);
 
-  FX_STRSIZE nBufSize = textBuf.GetLength();
+  size_t nBufSize = textBuf.GetLength();
   if (nBufSize == 0)
     return false;
 
@@ -465,8 +465,7 @@
   return true;
 }
 
-bool CPDFSDK_InterForm::FDFToURLEncodedData(uint8_t*& pBuf,
-                                            FX_STRSIZE& nBufSize) {
+bool CPDFSDK_InterForm::FDFToURLEncodedData(uint8_t*& pBuf, size_t& nBufSize) {
   std::unique_ptr<CFDF_Document> pFDF =
       CFDF_Document::ParseMemory(pBuf, nBufSize);
   if (!pFDF)
@@ -538,14 +537,14 @@
 
   ByteString fdfBuffer = pFDFDoc->WriteToString();
 
-  FX_STRSIZE nBufSize = fdfBuffer.GetLength();
-  if (nBufSize == 0)
+  if (fdfBuffer.IsEmpty())
     return false;
 
-  uint8_t* pLocalBuffer = FX_Alloc(uint8_t, nBufSize);
-  memcpy(pLocalBuffer, fdfBuffer.c_str(), nBufSize);
+  uint8_t* pLocalBuffer = FX_Alloc(uint8_t, fdfBuffer.GetLength());
+  memcpy(pLocalBuffer, fdfBuffer.c_str(), fdfBuffer.GetLength());
   uint8_t* pBuffer = pLocalBuffer;
 
+  size_t nBufSize = fdfBuffer.GetLength();
   if (bUrlEncoded && !FDFToURLEncodedData(pBuffer, nBufSize)) {
     FX_Free(pLocalBuffer);
     return false;
diff --git a/fpdfsdk/cpdfsdk_interform.h b/fpdfsdk/cpdfsdk_interform.h
index 76acaf9..ae39913 100644
--- a/fpdfsdk/cpdfsdk_interform.h
+++ b/fpdfsdk/cpdfsdk_interform.h
@@ -115,7 +115,7 @@
   int BeforeFormImportData(CPDF_InterForm* pForm) override;
   void AfterFormImportData(CPDF_InterForm* pForm) override;
 
-  bool FDFToURLEncodedData(uint8_t*& pBuf, FX_STRSIZE& nBufSize);
+  bool FDFToURLEncodedData(uint8_t*& pBuf, size_t& nBufSize);
   int GetPageIndexByAnnotDict(CPDF_Document* pDocument,
                               CPDF_Dictionary* pAnnotDict) const;
 
diff --git a/fpdfsdk/fpdf_sysfontinfo.cpp b/fpdfsdk/fpdf_sysfontinfo.cpp
index 67b9a08..f1f165a 100644
--- a/fpdfsdk/fpdf_sysfontinfo.cpp
+++ b/fpdfsdk/fpdf_sysfontinfo.cpp
@@ -171,7 +171,7 @@
   auto* pDefault = static_cast<FPDF_SYSFONTINFO_DEFAULT*>(pThis);
   if (!pDefault->m_pFontInfo->GetFaceName(hFont, &name))
     return 0;
-  if (name.GetLength() >= static_cast<FX_STRSIZE>(buf_size))
+  if (name.GetLength() >= static_cast<size_t>(buf_size))
     return name.GetLength() + 1;
 
   strncpy(buffer, name.c_str(),
diff --git a/fpdfsdk/fpdfdoc.cpp b/fpdfsdk/fpdfdoc.cpp
index c3910b2..c536c73 100644
--- a/fpdfsdk/fpdfdoc.cpp
+++ b/fpdfsdk/fpdfdoc.cpp
@@ -103,7 +103,7 @@
   if (!pDoc)
     return nullptr;
   CPDF_BookmarkTree tree(pDoc);
-  FX_STRSIZE len = WideString::WStringLength(title);
+  size_t len = WideString::WStringLength(title);
   WideString encodedTitle = WideString::FromUTF16LE(title, len);
   std::set<CPDF_Dictionary*> visited;
   return FindBookmark(tree, CPDF_Bookmark(), encodedTitle, &visited).GetDict();
diff --git a/fpdfsdk/fpdfedittext.cpp b/fpdfsdk/fpdfedittext.cpp
index 2ac32b8..2a9ef53 100644
--- a/fpdfsdk/fpdfedittext.cpp
+++ b/fpdfsdk/fpdfedittext.cpp
@@ -420,7 +420,7 @@
   if (!pTextObj)
     return false;
 
-  FX_STRSIZE len = WideString::WStringLength(text);
+  size_t len = WideString::WStringLength(text);
   WideString encodedText = WideString::FromUTF16LE(text, len);
   ByteString byteText;
   for (wchar_t wc : encodedText) {
diff --git a/fpdfsdk/fpdfformfill.cpp b/fpdfsdk/fpdfformfill.cpp
index 65b0ae9..3d821b6 100644
--- a/fpdfsdk/fpdfformfill.cpp
+++ b/fpdfsdk/fpdfformfill.cpp
@@ -404,7 +404,7 @@
   if (!pPageView)
     return;
 
-  FX_STRSIZE len = WideString::WStringLength(wsText);
+  size_t len = WideString::WStringLength(wsText);
   WideString wide_str_text = WideString::FromUTF16LE(wsText, len);
 
   pPageView->ReplaceSelection(wide_str_text);
diff --git a/fpdfsdk/fpdfppo.cpp b/fpdfsdk/fpdfppo.cpp
index 153ae2e..3caba0e 100644
--- a/fpdfsdk/fpdfppo.cpp
+++ b/fpdfsdk/fpdfppo.cpp
@@ -77,16 +77,16 @@
     return true;
 
   rangstring.Remove(' ');
-  FX_STRSIZE nLength = rangstring.GetLength();
+  size_t nLength = rangstring.GetLength();
   ByteString cbCompareString("0123456789-,");
-  for (FX_STRSIZE i = 0; i < nLength; ++i) {
+  for (size_t i = 0; i < nLength; ++i) {
     if (!cbCompareString.Contains(rangstring[i]))
       return false;
   }
 
   ByteString cbMidRange;
-  FX_STRSIZE nStringFrom = 0;
-  pdfium::Optional<FX_STRSIZE> nStringTo = 0;
+  size_t nStringFrom = 0;
+  pdfium::Optional<size_t> nStringTo = 0;
   while (nStringTo < nLength) {
     nStringTo = rangstring.Find(',', nStringFrom);
     if (!nStringTo.has_value())
@@ -106,7 +106,7 @@
         return false;
 
       nMid = nMid.value() + 1;
-      FX_STRSIZE nEnd = cbMidRange.GetLength() - nMid.value();
+      size_t nEnd = cbMidRange.GetLength() - nMid.value();
       if (nEnd == 0)
         return false;
 
diff --git a/fpdfsdk/fpdftext.cpp b/fpdfsdk/fpdftext.cpp
index 9742974..ae6841f 100644
--- a/fpdfsdk/fpdftext.cpp
+++ b/fpdfsdk/fpdftext.cpp
@@ -175,8 +175,8 @@
   if (str.GetLength() <= 0)
     return 0;
 
-  if (str.GetLength() > static_cast<FX_STRSIZE>(count))
-    str = str.Left(static_cast<FX_STRSIZE>(count));
+  if (str.GetLength() > static_cast<size_t>(count))
+    str = str.Left(static_cast<size_t>(count));
 
   // UFT16LE_Encode doesn't handle surrogate pairs properly, so it is expected
   // the number of items to stay the same.
@@ -256,11 +256,11 @@
 
   CPDF_TextPageFind* textpageFind =
       new CPDF_TextPageFind(CPDFTextPageFromFPDFTextPage(text_page));
-  FX_STRSIZE len = WideString::WStringLength(findwhat);
+  size_t len = WideString::WStringLength(findwhat);
   textpageFind->FindFirst(WideString::FromUTF16LE(findwhat, len), flags,
                           start_index >= 0
-                              ? pdfium::Optional<FX_STRSIZE>(start_index)
-                              : pdfium::Optional<FX_STRSIZE>());
+                              ? pdfium::Optional<size_t>(start_index)
+                              : pdfium::Optional<size_t>());
   return textpageFind;
 }
 
diff --git a/fpdfsdk/fpdfview.cpp b/fpdfsdk/fpdfview.cpp
index cb5edcf..bbd60bd 100644
--- a/fpdfsdk/fpdfview.cpp
+++ b/fpdfsdk/fpdfview.cpp
@@ -240,7 +240,7 @@
     return 0;
   FX_FILESIZE dwAvail = nSize - m_nCurPos;
   if (dwAvail < (FX_FILESIZE)size)
-    size = (size_t)dwAvail;
+    size = static_cast<size_t>(dwAvail);
   if (m_pFS->ReadBlock(m_pFS->clientData, (FPDF_DWORD)m_nCurPos, buffer,
                        (FPDF_DWORD)size) == 0) {
     m_nCurPos += size;
diff --git a/fpdfsdk/javascript/Document.cpp b/fpdfsdk/javascript/Document.cpp
index 0c611c1..5d0f35c 100644
--- a/fpdfsdk/javascript/Document.cpp
+++ b/fpdfsdk/javascript/Document.cpp
@@ -386,7 +386,7 @@
   if (sTextBuf.GetLength() == 0)
     return false;
 
-  FX_STRSIZE nBufSize = sTextBuf.GetLength();
+  size_t nBufSize = sTextBuf.GetLength();
   char* pMutableBuf = FX_Alloc(char, nBufSize);
   memcpy(pMutableBuf, sTextBuf.c_str(), nBufSize);
 
@@ -1015,7 +1015,7 @@
     return false;
   }
   WideString wsFilePath = m_pFormFillEnv->JS_docGetFilePath();
-  FX_STRSIZE i = wsFilePath.GetLength();
+  size_t i = wsFilePath.GetLength();
   for (; i > 0; i--) {
     if (wsFilePath[i - 1] == L'\\' || wsFilePath[i - 1] == L'/')
       break;
diff --git a/fpdfsdk/javascript/PublicMethods.cpp b/fpdfsdk/javascript/PublicMethods.cpp
index c065bd0..af47159 100644
--- a/fpdfsdk/javascript/PublicMethods.cpp
+++ b/fpdfsdk/javascript/PublicMethods.cpp
@@ -224,12 +224,12 @@
 }
 
 int CJS_PublicMethods::ParseStringInteger(const WideString& str,
-                                          FX_STRSIZE nStart,
-                                          FX_STRSIZE& nSkip,
-                                          FX_STRSIZE nMaxStep) {
+                                          size_t nStart,
+                                          size_t& nSkip,
+                                          size_t nMaxStep) {
   int nRet = 0;
   nSkip = 0;
-  for (FX_STRSIZE i = nStart, sz = str.GetLength(); i < sz; i++) {
+  for (size_t i = nStart, sz = str.GetLength(); i < sz; i++) {
     if (i - nStart > 10)
       break;
 
@@ -247,11 +247,11 @@
 }
 
 WideString CJS_PublicMethods::ParseStringString(const WideString& str,
-                                                FX_STRSIZE nStart,
-                                                FX_STRSIZE& nSkip) {
+                                                size_t nStart,
+                                                size_t& nSkip) {
   WideString swRet;
   nSkip = 0;
-  for (FX_STRSIZE i = nStart, sz = str.GetLength(); i < sz; i++) {
+  for (size_t i = nStart, sz = str.GetLength(); i < sz; i++) {
     wchar_t c = str[i];
     if (!std::iswdigit(c))
       break;
@@ -276,10 +276,10 @@
 
   int number[3];
 
-  FX_STRSIZE nSkip = 0;
-  FX_STRSIZE nLen = value.GetLength();
-  FX_STRSIZE nIndex = 0;
-  FX_STRSIZE i = 0;
+  size_t nSkip = 0;
+  size_t nLen = value.GetLength();
+  size_t nIndex = 0;
+  size_t i = 0;
   while (i < nLen) {
     if (nIndex > 2)
       break;
@@ -364,8 +364,8 @@
   bool bExit = false;
   bool bBadFormat = false;
 
-  FX_STRSIZE i = 0;
-  FX_STRSIZE j = 0;
+  size_t i = 0;
+  size_t j = 0;
 
   while (i < format.GetLength()) {
     if (bExit)
@@ -390,9 +390,9 @@
       case 'M':
       case 's':
       case 't': {
-        FX_STRSIZE oldj = j;
-        FX_STRSIZE nSkip = 0;
-        FX_STRSIZE remaining = format.GetLength() - i - 1;
+        size_t oldj = j;
+        size_t nSkip = 0;
+        size_t remaining = format.GetLength() - i - 1;
 
         if (remaining == 0 || format[i + 1] != c) {
           switch (c) {
@@ -626,10 +626,10 @@
   int nMin = JS_GetMinFromTime(dDate);
   int nSec = JS_GetSecFromTime(dDate);
 
-  FX_STRSIZE i = 0;
+  size_t i = 0;
   while (i < format.GetLength()) {
     wchar_t c = format[i];
-    FX_STRSIZE remaining = format.GetLength() - i - 1;
+    size_t remaining = format.GetLength() - i - 1;
     sPart = L"";
     switch (c) {
       case 'y':
@@ -804,7 +804,7 @@
   }
 
   // Processing separator style
-  if (static_cast<FX_STRSIZE>(iDec2) < strValue.GetLength()) {
+  if (static_cast<size_t>(iDec2) < strValue.GetLength()) {
     if (iSepStyle == 2 || iSepStyle == 3)
       strValue.Replace(".", ",");
 
@@ -946,7 +946,7 @@
   const wchar_t cSep = iSepStyle < 2 ? L'.' : L',';
 
   bool bHasSep = wstrValue.Contains(cSep);
-  for (FX_STRSIZE i = 0; i < wstrChange.GetLength(); ++i) {
+  for (size_t i = 0; i < wstrChange.GetLength(); ++i) {
     if (wstrChange[i] == cSep) {
       if (bHasSep) {
         pEvent->Rc() = false;
@@ -982,9 +982,9 @@
   WideString wprefix = wstrValue.Left(pEvent->SelStart());
   WideString wpostfix;
   if (pEvent->SelEnd() >= 0 &&
-      static_cast<FX_STRSIZE>(pEvent->SelEnd()) < wstrValue.GetLength())
+      static_cast<size_t>(pEvent->SelEnd()) < wstrValue.GetLength())
     wpostfix = wstrValue.Right(wstrValue.GetLength() -
-                               static_cast<FX_STRSIZE>(pEvent->SelEnd()));
+                               static_cast<size_t>(pEvent->SelEnd()));
   val = wprefix + wstrChange + wpostfix;
   return true;
 }
@@ -1410,7 +1410,7 @@
     if (valEvent.IsEmpty())
       return true;
 
-    FX_STRSIZE iIndexMask = 0;
+    size_t iIndexMask = 0;
     for (; iIndexMask < valEvent.GetLength(); ++iIndexMask) {
       if (!maskSatisfied(valEvent[iIndexMask], wstrMask[iIndexMask]))
         break;
@@ -1430,9 +1430,9 @@
     return true;
 
   WideString wChange = wideChange;
-  FX_STRSIZE iIndexMask = pEvent->SelStart();
-  FX_STRSIZE combined_len = valEvent.GetLength() + wChange.GetLength() +
-                            pEvent->SelStart() - pEvent->SelEnd();
+  size_t iIndexMask = pEvent->SelStart();
+  size_t combined_len = valEvent.GetLength() + wChange.GetLength() +
+                        pEvent->SelStart() - pEvent->SelEnd();
   if (combined_len > wstrMask.GetLength()) {
     AlertIfPossible(pContext,
                     JSGetStringFromID(IDS_STRING_JSPARAM_TOOLONG).c_str());
@@ -1447,7 +1447,7 @@
     return true;
   }
 
-  for (FX_STRSIZE i = 0; i < wChange.GetLength(); ++i) {
+  for (size_t i = 0; i < wChange.GetLength(); ++i) {
     if (iIndexMask >= wstrMask.GetLength()) {
       AlertIfPossible(pContext,
                       JSGetStringFromID(IDS_STRING_JSPARAM_TOOLONG).c_str());
@@ -1537,9 +1537,9 @@
     prefix = L"";
 
   if (pEventHandler->SelEnd() >= 0 &&
-      static_cast<FX_STRSIZE>(pEventHandler->SelEnd()) <= swValue.GetLength())
+      static_cast<size_t>(pEventHandler->SelEnd()) <= swValue.GetLength())
     postfix = swValue.Right(swValue.GetLength() -
-                            static_cast<FX_STRSIZE>(pEventHandler->SelEnd()));
+                            static_cast<size_t>(pEventHandler->SelEnd()));
   else
     postfix = L"";
 
diff --git a/fpdfsdk/javascript/PublicMethods.h b/fpdfsdk/javascript/PublicMethods.h
index 365df3e..abce08b 100644
--- a/fpdfsdk/javascript/PublicMethods.h
+++ b/fpdfsdk/javascript/PublicMethods.h
@@ -133,12 +133,12 @@
   JS_STATIC_DECLARE_GLOBAL_FUN();
 
   static int ParseStringInteger(const WideString& string,
-                                FX_STRSIZE nStart,
-                                FX_STRSIZE& nSkip,
-                                FX_STRSIZE nMaxStep);
+                                size_t nStart,
+                                size_t& nSkip,
+                                size_t nMaxStep);
   static WideString ParseStringString(const WideString& string,
-                                      FX_STRSIZE nStart,
-                                      FX_STRSIZE& nSkip);
+                                      size_t nStart,
+                                      size_t& nSkip);
   static double MakeRegularDate(const WideString& value,
                                 const WideString& format,
                                 bool* bWrongFormat);
diff --git a/fpdfsdk/javascript/util.cpp b/fpdfsdk/javascript/util.cpp
index 3fe7a86..c4b1568 100644
--- a/fpdfsdk/javascript/util.cpp
+++ b/fpdfsdk/javascript/util.cpp
@@ -297,8 +297,8 @@
 WideString util::printx(const WideString& wsFormat,
                         const WideString& wsSource) {
   WideString wsResult;
-  FX_STRSIZE iSourceIdx = 0;
-  FX_STRSIZE iFormatIdx = 0;
+  size_t iSourceIdx = 0;
+  size_t iFormatIdx = 0;
   CaseMode eCaseMode = kPreserveCase;
   bool bEscaped = false;
   while (iFormatIdx < wsFormat.GetLength()) {
diff --git a/fxbarcode/datamatrix/BC_EncoderContext.cpp b/fxbarcode/datamatrix/BC_EncoderContext.cpp
index 6e16710..fe0a497 100644
--- a/fxbarcode/datamatrix/BC_EncoderContext.cpp
+++ b/fxbarcode/datamatrix/BC_EncoderContext.cpp
@@ -34,8 +34,8 @@
   ByteString dststr;
   CBC_UtilCodingConvert::UnicodeToUTF8(msg, dststr);
   WideString sb;
-  FX_STRSIZE c = dststr.GetLength();
-  for (FX_STRSIZE i = 0; i < c; i++) {
+  size_t c = dststr.GetLength();
+  for (size_t i = 0; i < c; i++) {
     wchar_t ch = static_cast<wchar_t>(dststr[i] & 0xff);
     if (ch == '?' && dststr[i] != '?') {
       e = BCExceptionCharactersOutsideISO88591Encoding;
@@ -73,7 +73,7 @@
 void CBC_EncoderContext::writeCodeword(wchar_t codeword) {
   m_codewords += codeword;
 }
-FX_STRSIZE CBC_EncoderContext::getCodewordCount() {
+size_t CBC_EncoderContext::getCodewordCount() {
   return m_codewords.GetLength();
 }
 void CBC_EncoderContext::signalEncoderChange(int32_t encoding) {
@@ -85,7 +85,7 @@
 bool CBC_EncoderContext::hasMoreCharacters() {
   return m_pos < getTotalMessageCharCount();
 }
-FX_STRSIZE CBC_EncoderContext::getRemainingCharacters() {
+size_t CBC_EncoderContext::getRemainingCharacters() {
   return getTotalMessageCharCount() - m_pos;
 }
 void CBC_EncoderContext::updateSymbolInfo(int32_t& e) {
@@ -103,6 +103,6 @@
   m_allowRectangular = true;
 }
 
-FX_STRSIZE CBC_EncoderContext::getTotalMessageCharCount() {
+size_t CBC_EncoderContext::getTotalMessageCharCount() {
   return m_msg.GetLength() - m_skipAtEnd;
 }
diff --git a/fxbarcode/datamatrix/BC_EncoderContext.h b/fxbarcode/datamatrix/BC_EncoderContext.h
index 3881319..c0ddb20 100644
--- a/fxbarcode/datamatrix/BC_EncoderContext.h
+++ b/fxbarcode/datamatrix/BC_EncoderContext.h
@@ -25,26 +25,26 @@
   wchar_t getCurrent();
   void writeCodewords(const WideString& codewords);
   void writeCodeword(wchar_t codeword);
-  FX_STRSIZE getCodewordCount();
+  size_t getCodewordCount();
   void signalEncoderChange(int32_t encoding);
   void resetEncoderSignal();
   bool hasMoreCharacters();
-  FX_STRSIZE getRemainingCharacters();
+  size_t getRemainingCharacters();
   void updateSymbolInfo(int32_t& e);
   void updateSymbolInfo(int32_t len, int32_t& e);
   void resetSymbolInfo();
 
   WideString m_msg;
   WideString m_codewords;
-  FX_STRSIZE m_pos;
+  size_t m_pos;
   int32_t m_newEncoding;
   UnownedPtr<CBC_SymbolInfo> m_symbolInfo;
 
  private:
-  FX_STRSIZE getTotalMessageCharCount();
+  size_t getTotalMessageCharCount();
 
   bool m_allowRectangular;  // Force square when false.
-  FX_STRSIZE m_skipAtEnd;
+  size_t m_skipAtEnd;
 };
 
 #endif  // FXBARCODE_DATAMATRIX_BC_ENCODERCONTEXT_H_
diff --git a/fxbarcode/oned/BC_OneDimWriter.cpp b/fxbarcode/oned/BC_OneDimWriter.cpp
index 5bcb3c3..dc0d48c 100644
--- a/fxbarcode/oned/BC_OneDimWriter.cpp
+++ b/fxbarcode/oned/BC_OneDimWriter.cpp
@@ -136,10 +136,10 @@
   std::unique_ptr<CFX_UnicodeEncodingEx> encoding =
       FX_CreateFontEncodingEx(cFont, FXFM_ENCODING_NONE);
 
-  FX_STRSIZE length = text.GetLength();
+  size_t length = text.GetLength();
   uint32_t* pCharCode = FX_Alloc(uint32_t, text.GetLength());
   float charWidth = 0;
-  for (FX_STRSIZE j = 0; j < length; j++) {
+  for (size_t j = 0; j < length; j++) {
     pCharCode[j] = encoding->CharCodeFromUnicode(text[j]);
     int32_t glyp_code = encoding->GlyphFromCharCode(pCharCode[j]);
     int32_t glyp_value = cFont->GetGlyphWidth(glyp_code);
@@ -162,7 +162,7 @@
   charPos[0].m_ExtGID = charPos[0].m_GlyphIndex;
 #endif
   penX += (float)(charPos[0].m_FontCharWidth) * (float)fontSize / 1000.0f;
-  for (FX_STRSIZE i = 1; i < length; i++) {
+  for (size_t i = 1; i < length; i++) {
     charPos[i].m_Origin = CFX_PointF(penX + left, penY + top);
     charPos[i].m_GlyphIndex = encoding->GlyphFromCharCode(pCharCode[i]);
     charPos[i].m_FontCharWidth = cFont->GetGlyphWidth(charPos[i].m_GlyphIndex);
diff --git a/fxbarcode/oned/BC_OneDimWriter.h b/fxbarcode/oned/BC_OneDimWriter.h
index 5c9ef09..a597d86 100644
--- a/fxbarcode/oned/BC_OneDimWriter.h
+++ b/fxbarcode/oned/BC_OneDimWriter.h
@@ -91,7 +91,7 @@
   int32_t m_iFontStyle;
   uint32_t m_fontColor;
   BC_TEXT_LOC m_locTextLoc;
-  FX_STRSIZE m_iContentLen;
+  size_t m_iContentLen;
   bool m_bLeftPadding;
   bool m_bRightPadding;
   std::vector<CFX_PathData> m_output;
diff --git a/fxbarcode/oned/BC_OnedCodaBarWriter.cpp b/fxbarcode/oned/BC_OnedCodaBarWriter.cpp
index 4c5ad67..791904d 100644
--- a/fxbarcode/oned/BC_OnedCodaBarWriter.cpp
+++ b/fxbarcode/oned/BC_OnedCodaBarWriter.cpp
@@ -105,7 +105,7 @@
     const WideStringView& contents) {
   WideString filtercontents;
   wchar_t ch;
-  for (FX_STRSIZE index = 0; index < contents.GetLength(); index++) {
+  for (size_t index = 0; index < contents.GetLength(); index++) {
     ch = contents[index];
     if (ch > 175) {
       index++;
@@ -136,7 +136,7 @@
   uint8_t* result = FX_Alloc2D(uint8_t, m_iWideNarrRatio * 7, data.GetLength());
   char ch;
   int32_t position = 0;
-  for (FX_STRSIZE index = 0; index < data.GetLength(); index++) {
+  for (size_t index = 0; index < data.GetLength(); index++) {
     ch = data[index];
     if (((ch >= 'a') && (ch <= 'z'))) {
       ch = ch - 32;
diff --git a/fxbarcode/oned/BC_OnedCode128Writer.cpp b/fxbarcode/oned/BC_OnedCode128Writer.cpp
index 61ec77b..50d3fb6 100644
--- a/fxbarcode/oned/BC_OnedCode128Writer.cpp
+++ b/fxbarcode/oned/BC_OnedCode128Writer.cpp
@@ -96,7 +96,7 @@
 WideString CBC_OnedCode128Writer::FilterContents(
     const WideStringView& contents) {
   WideString filterChineseChar;
-  for (FX_STRSIZE i = 0; i < contents.GetLength(); i++) {
+  for (size_t i = 0; i < contents.GetLength(); i++) {
     wchar_t ch = contents[i];
     if (ch > 175) {
       i++;
@@ -173,7 +173,7 @@
   int32_t checkWeight = 1;
   patterns->push_back(CODE_START_B);
   int32_t checkSum = CODE_START_B * checkWeight;
-  for (FX_STRSIZE position = 0; position < contents.GetLength(); position++) {
+  for (size_t position = 0; position < contents.GetLength(); position++) {
     int32_t patternIndex = contents[position] - ' ';
     patterns->push_back(patternIndex);
     checkSum += patternIndex * checkWeight++;
@@ -187,7 +187,7 @@
   int32_t checkWeight = 1;
   patterns->push_back(CODE_START_C);
   int32_t checkSum = CODE_START_C * checkWeight;
-  FX_STRSIZE position = 0;
+  size_t position = 0;
   while (position < contents.GetLength()) {
     int32_t patternIndex;
     char ch = contents[position];
diff --git a/fxbarcode/oned/BC_OnedCode39Writer.cpp b/fxbarcode/oned/BC_OnedCode39Writer.cpp
index 2e02e01..8adef14 100644
--- a/fxbarcode/oned/BC_OnedCode39Writer.cpp
+++ b/fxbarcode/oned/BC_OnedCode39Writer.cpp
@@ -49,7 +49,7 @@
 
 bool CBC_OnedCode39Writer::CheckContentValidity(
     const WideStringView& contents) {
-  for (FX_STRSIZE i = 0; i < contents.GetLength(); i++) {
+  for (size_t i = 0; i < contents.GetLength(); i++) {
     wchar_t ch = contents[i];
     if ((ch >= L'0' && ch <= L'9') || (ch >= L'A' && ch <= L'Z') ||
         ch == L'-' || ch == L'.' || ch == L' ' || ch == L'*' || ch == L'$' ||
@@ -64,7 +64,7 @@
 WideString CBC_OnedCode39Writer::FilterContents(
     const WideStringView& contents) {
   WideString filtercontents;
-  for (FX_STRSIZE i = 0; i < contents.GetLength(); i++) {
+  for (size_t i = 0; i < contents.GetLength(); i++) {
     wchar_t ch = contents[i];
     if (ch == L'*' && (i == 0 || i == contents.GetLength() - 1)) {
       continue;
@@ -87,7 +87,7 @@
 WideString CBC_OnedCode39Writer::RenderTextContents(
     const WideStringView& contents) {
   WideString renderContents;
-  for (FX_STRSIZE i = 0; i < contents.GetLength(); i++) {
+  for (size_t i = 0; i < contents.GetLength(); i++) {
     wchar_t ch = contents[i];
     if (ch == L'*' && (i == 0 || i == contents.GetLength() - 1)) {
       continue;
@@ -138,8 +138,7 @@
 }
 
 char CBC_OnedCode39Writer::CalcCheckSum(const ByteString& contents) {
-  FX_STRSIZE length = contents.GetLength();
-  if (length > 80)
+  if (contents.GetLength() > 80)
     return '*';
 
   int32_t checksum = 0;
@@ -176,7 +175,7 @@
   int32_t codeWidth = (wideStrideNum * m_iWideNarrRatio + narrStrideNum) * 2 +
                       1 + m_iContentLen;
   size_t len = strlen(ALPHABET_STRING);
-  for (FX_STRSIZE j = 0; j < m_iContentLen; j++) {
+  for (size_t j = 0; j < m_iContentLen; j++) {
     for (size_t i = 0; i < len; i++) {
       if (ALPHABET_STRING[i] != encodedContents[j])
         continue;
diff --git a/fxbarcode/oned/BC_OnedEAN13Writer.cpp b/fxbarcode/oned/BC_OnedEAN13Writer.cpp
index 6de7c2c..daf53a8 100644
--- a/fxbarcode/oned/BC_OnedEAN13Writer.cpp
+++ b/fxbarcode/oned/BC_OnedEAN13Writer.cpp
@@ -63,7 +63,7 @@
 WideString CBC_OnedEAN13Writer::FilterContents(const WideStringView& contents) {
   WideString filtercontents;
   wchar_t ch;
-  for (FX_STRSIZE i = 0; i < contents.GetLength(); i++) {
+  for (size_t i = 0; i < contents.GetLength(); i++) {
     ch = contents[i];
     if (ch > 175) {
       i++;
diff --git a/fxbarcode/oned/BC_OnedEAN8Writer.cpp b/fxbarcode/oned/BC_OnedEAN8Writer.cpp
index f92a162..865979c 100644
--- a/fxbarcode/oned/BC_OnedEAN8Writer.cpp
+++ b/fxbarcode/oned/BC_OnedEAN8Writer.cpp
@@ -70,7 +70,7 @@
 WideString CBC_OnedEAN8Writer::FilterContents(const WideStringView& contents) {
   WideString filtercontents;
   wchar_t ch;
-  for (FX_STRSIZE i = 0; i < contents.GetLength(); i++) {
+  for (size_t i = 0; i < contents.GetLength(); i++) {
     ch = contents[i];
     if (ch > 175) {
       i++;
@@ -145,10 +145,10 @@
 
   int32_t leftPosition = 3 * multiple;
   ByteString str = FX_UTF8Encode(contents);
-  FX_STRSIZE iLength = str.GetLength();
+  size_t iLength = str.GetLength();
   std::vector<FXTEXT_CHARPOS> charpos(iLength);
   ByteString tempStr = str.Left(4);
-  FX_STRSIZE iLen = tempStr.GetLength();
+  size_t iLen = tempStr.GetLength();
   int32_t strWidth = 7 * multiple * 4;
   float blank = 0.0;
 
diff --git a/fxbarcode/oned/BC_OnedEANChecksum.cpp b/fxbarcode/oned/BC_OnedEANChecksum.cpp
index 64aa1c5..b290c62 100644
--- a/fxbarcode/oned/BC_OnedEANChecksum.cpp
+++ b/fxbarcode/oned/BC_OnedEANChecksum.cpp
@@ -9,8 +9,8 @@
 int32_t EANCalcChecksum(const ByteString& contents) {
   int32_t odd = 0;
   int32_t even = 0;
-  FX_STRSIZE parity = 1;
-  for (FX_STRSIZE i = contents.GetLength(); i > 0; i--) {
+  size_t parity = 1;
+  for (size_t i = contents.GetLength(); i > 0; i--) {
     if (parity % 2)
       odd += FXSYS_DecimalCharToInt(contents[i - 1]);
     else
diff --git a/fxbarcode/oned/BC_OnedUPCAWriter.cpp b/fxbarcode/oned/BC_OnedUPCAWriter.cpp
index 5185845..025f851 100644
--- a/fxbarcode/oned/BC_OnedUPCAWriter.cpp
+++ b/fxbarcode/oned/BC_OnedUPCAWriter.cpp
@@ -43,7 +43,7 @@
 CBC_OnedUPCAWriter::~CBC_OnedUPCAWriter() {}
 
 bool CBC_OnedUPCAWriter::CheckContentValidity(const WideStringView& contents) {
-  for (FX_STRSIZE i = 0; i < contents.GetLength(); ++i) {
+  for (size_t i = 0; i < contents.GetLength(); ++i) {
     if (contents[i] < '0' || contents[i] > '9')
       return false;
   }
@@ -53,7 +53,7 @@
 WideString CBC_OnedUPCAWriter::FilterContents(const WideStringView& contents) {
   WideString filtercontents;
   wchar_t ch;
-  for (FX_STRSIZE i = 0; i < contents.GetLength(); i++) {
+  for (size_t i = 0; i < contents.GetLength(); i++) {
     ch = contents[i];
     if (ch > 175) {
       i++;
@@ -69,8 +69,8 @@
 int32_t CBC_OnedUPCAWriter::CalcChecksum(const ByteString& contents) {
   int32_t odd = 0;
   int32_t even = 0;
-  FX_STRSIZE j = 1;
-  for (FX_STRSIZE i = contents.GetLength(); i > 0; i--) {
+  size_t j = 1;
+  for (size_t i = contents.GetLength(); i > 0; i--) {
     if (j % 2) {
       odd += FXSYS_DecimalCharToInt(contents[i - 1]);
     } else {
diff --git a/fxbarcode/qrcode/BC_QRCoderEncoder.cpp b/fxbarcode/qrcode/BC_QRCoderEncoder.cpp
index c8ee709..a44dfc3 100644
--- a/fxbarcode/qrcode/BC_QRCoderEncoder.cpp
+++ b/fxbarcode/qrcode/BC_QRCoderEncoder.cpp
@@ -134,7 +134,7 @@
                      CBC_QRCoderBitVector* bits,
                      ByteString encoding,
                      int32_t& e) {
-  for (FX_STRSIZE i = 0; i < content.GetLength(); i++)
+  for (size_t i = 0; i < content.GetLength(); i++)
     bits->AppendBits(content[i], 8);
 }
 
@@ -381,7 +381,7 @@
       if (e != BCExceptionNO)
         return;
       if (element2.first == CBC_QRCoderMode::sBYTE && tmp >= 0 &&
-          element1.second.GetLength() < static_cast<FX_STRSIZE>(tmp)) {
+          element1.second.GetLength() < static_cast<size_t>(tmp)) {
         element2.second = element1.second + element2.second;
         result->erase(result->begin() + i);
         i--;
@@ -400,7 +400,7 @@
       if (e != BCExceptionNO)
         return;
       if (element2.first == CBC_QRCoderMode::sBYTE && tmp >= 0 &&
-          element1.second.GetLength() < static_cast<FX_STRSIZE>(tmp)) {
+          element1.second.GetLength() < static_cast<size_t>(tmp)) {
         element2.second = element1.second + element2.second;
         result->erase(result->begin() + i);
         i--;
@@ -411,7 +411,7 @@
       if (e != BCExceptionNO)
         return;
       if (element2.first == CBC_QRCoderMode::sALPHANUMERIC && tmp >= 0 &&
-          element1.second.GetLength() < static_cast<FX_STRSIZE>(tmp)) {
+          element1.second.GetLength() < static_cast<size_t>(tmp)) {
         element2.second = element1.second + element2.second;
         result->erase(result->begin() + i);
         i--;
@@ -425,7 +425,7 @@
 
 void SplitString(const ByteString& content,
                  std::vector<ModeStringPair>* result) {
-  FX_STRSIZE index = 0;
+  size_t index = 0;
   while (index < content.GetLength()) {
     uint8_t c = static_cast<uint8_t>(content[index]);
     if (!((c >= 0xA1 && c <= 0xAA) || (c >= 0xB0 && c <= 0xFA)))
@@ -437,7 +437,7 @@
   if (index >= content.GetLength())
     return;
 
-  FX_STRSIZE flag = index;
+  size_t flag = index;
   while (GetAlphaNumericCode(content[index]) == -1 &&
          index < content.GetLength()) {
     uint8_t c = static_cast<uint8_t>(content[index]);
@@ -490,7 +490,7 @@
 
   bool hasNumeric = false;
   bool hasAlphaNumeric = false;
-  for (FX_STRSIZE i = 0; i < content.GetLength(); i++) {
+  for (size_t i = 0; i < content.GetLength(); i++) {
     if (isdigit(content[i])) {
       hasNumeric = true;
     } else if (GetAlphaNumericCode(content[i]) != -1) {
diff --git a/testing/libfuzzer/pdf_css_fuzzer.cc b/testing/libfuzzer/pdf_css_fuzzer.cc
index b21d9d2..7cd924e 100644
--- a/testing/libfuzzer/pdf_css_fuzzer.cc
+++ b/testing/libfuzzer/pdf_css_fuzzer.cc
@@ -12,7 +12,7 @@
 
 extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
   WideString input =
-      WideString::FromUTF8(ByteStringView(data, static_cast<FX_STRSIZE>(size)));
+      WideString::FromUTF8(ByteStringView(data, static_cast<size_t>(size)));
 
   // If we convert the input into an empty string bail out.
   if (input.GetLength() == 0)
diff --git a/xfa/fde/cfde_textout.cpp b/xfa/fde/cfde_textout.cpp
index c31b178..9f96b77 100644
--- a/xfa/fde/cfde_textout.cpp
+++ b/xfa/fde/cfde_textout.cpp
@@ -326,7 +326,7 @@
 
   m_wsText = str;
 
-  if (pdfium::CollectionSize<FX_STRSIZE>(m_CharWidths) < str.GetLength())
+  if (pdfium::CollectionSize<size_t>(m_CharWidths) < str.GetLength())
     m_CharWidths.resize(str.GetLength(), 0);
 
   float fLineStep = (m_fLineSpace > m_fFontSize) ? m_fLineSpace : m_fFontSize;
diff --git a/xfa/fgas/font/cfgas_pdffontmgr.cpp b/xfa/fgas/font/cfgas_pdffontmgr.cpp
index 0fd18aa..af183c2 100644
--- a/xfa/fgas/font/cfgas_pdffontmgr.cpp
+++ b/xfa/fgas/font/cfgas_pdffontmgr.cpp
@@ -119,7 +119,7 @@
                                              bool bStrictMatch) {
   ByteString bsDRName = bsDRFontName;
   bsDRName.Remove('-');
-  FX_STRSIZE iPsLen = bsPsName.GetLength();
+  size_t iPsLen = bsPsName.GetLength();
   auto nIndex = bsDRName.Find(bsPsName);
   if (nIndex.has_value() && !bStrictMatch)
     return true;
@@ -127,7 +127,7 @@
   if (!nIndex.has_value() || nIndex.value() != 0)
     return false;
 
-  FX_STRSIZE iDifferLength = bsDRName.GetLength() - iPsLen;
+  size_t iDifferLength = bsDRName.GetLength() - iPsLen;
   if (iDifferLength > 1 || (bBold || bItalic)) {
     auto iBoldIndex = bsDRName.Find("Bold");
     if (bBold != iBoldIndex.has_value())
diff --git a/xfa/fxfa/fm2js/cxfa_fm2jscontext.cpp b/xfa/fxfa/fm2js/cxfa_fm2jscontext.cpp
index 0b38fd1..b4d070a 100644
--- a/xfa/fxfa/fm2js/cxfa_fm2jscontext.cpp
+++ b/xfa/fxfa/fm2js/cxfa_fm2jscontext.cpp
@@ -2951,7 +2951,7 @@
     return;
   }
 
-  FX_STRSIZE u = 0;
+  size_t u = 0;
   while (IsWhitespace(pData[u]))
     ++u;
 
@@ -2966,7 +2966,7 @@
   while (IsWhitespace(pData[u]))
     ++u;
 
-  FX_STRSIZE uLen = unitspanString.GetLength();
+  size_t uLen = unitspanString.GetLength();
   ByteString strFirstUnit;
   while (u < uLen) {
     if (pData[u] == ' ')
@@ -2982,7 +2982,7 @@
     std::unique_ptr<CFXJSE_Value> unitValue = GetSimpleValue(pThis, args, 1);
     ByteString unitTempString = ValueToUTF8String(unitValue.get());
     const char* pChar = unitTempString.c_str();
-    FX_STRSIZE uVal = 0;
+    size_t uVal = 0;
     while (IsWhitespace(pChar[uVal]))
       ++uVal;
 
@@ -2994,7 +2994,7 @@
     while (IsWhitespace(pChar[uVal]))
       ++uVal;
 
-    FX_STRSIZE uValLen = unitTempString.GetLength();
+    size_t uValLen = unitTempString.GetLength();
     while (uVal < uValLen) {
       if (pChar[uVal] == ' ')
         break;
@@ -3176,7 +3176,7 @@
 // static
 WideString CXFA_FM2JSContext::DecodeURL(const WideString& wsURLString) {
   const wchar_t* pData = wsURLString.c_str();
-  FX_STRSIZE i = 0;
+  size_t i = 0;
   CFX_WideTextBuf wsResultBuf;
   while (i < wsURLString.GetLength()) {
     wchar_t ch = pData[i];
@@ -3213,9 +3213,9 @@
 // static
 WideString CXFA_FM2JSContext::DecodeHTML(const WideString& wsHTMLString) {
   wchar_t strString[9];
-  FX_STRSIZE iStrIndex = 0;
-  FX_STRSIZE iLen = wsHTMLString.GetLength();
-  FX_STRSIZE i = 0;
+  size_t iStrIndex = 0;
+  size_t iLen = wsHTMLString.GetLength();
+  size_t i = 0;
   int32_t iCode = 0;
   const wchar_t* pData = wsHTMLString.c_str();
   CFX_WideTextBuf wsResultBuf;
@@ -3811,7 +3811,7 @@
   ByteString argString = ValueToUTF8String(argOne.get());
   WideString wsArgString = WideString::FromUTF8(argString.AsStringView());
   const wchar_t* pData = wsArgString.c_str();
-  FX_STRSIZE i = 0;
+  size_t i = 0;
   while (i < argString.GetLength()) {
     int32_t ch = pData[i];
     if ((ch >= 0x41 && ch <= 0x5A) || (ch >= 0xC0 && ch <= 0xDE))
@@ -4008,17 +4008,17 @@
     threeString = ValueToUTF8String(argThree.get());
   }
 
-  FX_STRSIZE iFindLen = twoString.GetLength();
+  size_t iFindLen = twoString.GetLength();
   std::ostringstream resultString;
-  FX_STRSIZE iFindIndex = 0;
-  for (FX_STRSIZE u = 0; u < oneString.GetLength(); ++u) {
+  size_t iFindIndex = 0;
+  for (size_t u = 0; u < oneString.GetLength(); ++u) {
     char ch = static_cast<char>(oneString[u]);
     if (ch != static_cast<char>(twoString[iFindIndex])) {
       resultString << ch;
       continue;
     }
 
-    FX_STRSIZE iTemp = u + 1;
+    size_t iTemp = u + 1;
     ++iFindIndex;
     while (iFindIndex < iFindLen) {
       uint8_t chTemp = oneString[iTemp];
@@ -4353,7 +4353,7 @@
   ByteString argString = ValueToUTF8String(argOne.get());
   WideString wsArgString = WideString::FromUTF8(argString.AsStringView());
   const wchar_t* pData = wsArgString.c_str();
-  FX_STRSIZE i = 0;
+  size_t i = 0;
   while (i < wsArgString.GetLength()) {
     int32_t ch = pData[i];
     if ((ch >= 0x61 && ch <= 0x7A) || (ch >= 0xE0 && ch <= 0xFE))
diff --git a/xfa/fxfa/fm2js/cxfa_fmlexer.cpp b/xfa/fxfa/fm2js/cxfa_fmlexer.cpp
index f6b2a58..675abc3 100644
--- a/xfa/fxfa/fm2js/cxfa_fmlexer.cpp
+++ b/xfa/fxfa/fm2js/cxfa_fmlexer.cpp
@@ -378,7 +378,7 @@
   }
 
   m_token->m_string =
-      WideStringView(m_cursor, static_cast<FX_STRSIZE>(end - m_cursor));
+      WideStringView(m_cursor, static_cast<size_t>(end - m_cursor));
   m_cursor = end;
 }
 
@@ -395,7 +395,7 @@
       // If the end of the input has been reached it was not escaped.
       if (m_cursor > m_end) {
         m_token->m_string =
-            WideStringView(start, static_cast<FX_STRSIZE>(m_cursor - start));
+            WideStringView(start, static_cast<size_t>(m_cursor - start));
         return;
       }
       // If the next character is not a " then the end of the string has been
@@ -430,7 +430,7 @@
     ++m_cursor;
   }
   m_token->m_string =
-      WideStringView(start, static_cast<FX_STRSIZE>(m_cursor - start));
+      WideStringView(start, static_cast<size_t>(m_cursor - start));
   m_token->m_type = TokenizeIdentifier(m_token->m_string);
 }
 
diff --git a/xfa/fxfa/fm2js/cxfa_fmsimpleexpression.cpp b/xfa/fxfa/fm2js/cxfa_fmsimpleexpression.cpp
index 73dfdd5..3cfe0f5 100644
--- a/xfa/fxfa/fm2js/cxfa_fmsimpleexpression.cpp
+++ b/xfa/fxfa/fm2js/cxfa_fmsimpleexpression.cpp
@@ -48,7 +48,7 @@
     L"Within",       L"WordNum",
 };
 
-const FX_STRSIZE g_BuiltInFuncsMaxLen = 12;
+const size_t g_BuiltInFuncsMaxLen = 12;
 
 struct XFA_FMSOMMethod {
   const wchar_t* m_wsSomMethodName;
@@ -133,7 +133,7 @@
     return true;
   }
   javascript.AppendChar(L'\"');
-  for (FX_STRSIZE i = 1; i < tempStr.GetLength() - 1; i++) {
+  for (size_t i = 1; i < tempStr.GetLength() - 1; i++) {
     wchar_t oneChar = tempStr[i];
     switch (oneChar) {
       case L'\"':
diff --git a/xfa/fxfa/parser/cxfa_dataexporter.cpp b/xfa/fxfa/parser/cxfa_dataexporter.cpp
index b0de057..5433ba7 100644
--- a/xfa/fxfa/parser/cxfa_dataexporter.cpp
+++ b/xfa/fxfa/parser/cxfa_dataexporter.cpp
@@ -225,7 +225,7 @@
           break;
 
         std::vector<WideString> wsSelTextArray;
-        FX_STRSIZE iStart = 0;
+        size_t iStart = 0;
         auto iEnd = wsRawValue.Find(L'\n', iStart);
         iEnd = !iEnd.has_value() ? wsRawValue.GetLength() : iEnd;
         while (iEnd.has_value() && iEnd >= iStart) {
@@ -335,7 +335,7 @@
       !pNode->IsContainerNode()) {
     CFX_WideTextBuf buf;
     RegenerateFormFile_Changed(pNode, buf, bSaveXML);
-    FX_STRSIZE nLen = buf.GetLength();
+    size_t nLen = buf.GetLength();
     if (nLen > 0)
       pStream->WriteString(buf.AsStringView());
     return;
diff --git a/xfa/fxfa/parser/cxfa_document.cpp b/xfa/fxfa/parser/cxfa_document.cpp
index 3a46e26..cd60f47 100644
--- a/xfa/fxfa/parser/cxfa_document.cpp
+++ b/xfa/fxfa/parser/cxfa_document.cpp
@@ -300,7 +300,7 @@
     const WideString& wsTemplateNS) {
   WideStringView wsTemplateURIPrefix =
       XFA_GetPacketByIndex(XFA_PACKET_Template)->pURI;
-  FX_STRSIZE nPrefixLength = wsTemplateURIPrefix.GetLength();
+  size_t nPrefixLength = wsTemplateURIPrefix.GetLength();
   if (WideStringView(wsTemplateNS.c_str(), wsTemplateNS.GetLength()) !=
       wsTemplateURIPrefix) {
     return XFA_VERSION_UNKNOWN;
@@ -374,7 +374,7 @@
         wsURI = wsUseVal.AsStringView();
       } else {
         wsURI = WideStringView(wsUseVal.c_str(), uSharpPos.value());
-        FX_STRSIZE uLen = wsUseVal.GetLength();
+        size_t uLen = wsUseVal.GetLength();
         if (uLen >= uSharpPos.value() + 5 &&
             WideStringView(wsUseVal.c_str() + uSharpPos.value(), 5) ==
                 L"#som(" &&
diff --git a/xfa/fxfa/parser/cxfa_layoutpagemgr.cpp b/xfa/fxfa/parser/cxfa_layoutpagemgr.cpp
index d8fdbb4..a9e5449 100644
--- a/xfa/fxfa/parser/cxfa_layoutpagemgr.cpp
+++ b/xfa/fxfa/parser/cxfa_layoutpagemgr.cpp
@@ -148,7 +148,7 @@
   bool bTargetAllFind = true;
   while (iSplitIndex != -1) {
     WideString wsExpr;
-    pdfium::Optional<FX_STRSIZE> iSplitNextIndex = 0;
+    pdfium::Optional<size_t> iSplitNextIndex = 0;
     if (!bTargetAllFind) {
       iSplitNextIndex = wsTargetAll.Find(' ', iSplitIndex);
       if (!iSplitNextIndex.has_value())
diff --git a/xfa/fxfa/parser/cxfa_node.cpp b/xfa/fxfa/parser/cxfa_node.cpp
index 1dc2048..0a95b5f 100644
--- a/xfa/fxfa/parser/cxfa_node.cpp
+++ b/xfa/fxfa/parser/cxfa_node.cpp
@@ -4037,8 +4037,8 @@
           std::vector<WideString> wsSaveTextArray;
           size_t iSize = 0;
           if (!wsContent.IsEmpty()) {
-            FX_STRSIZE iStart = 0;
-            FX_STRSIZE iLength = wsContent.GetLength();
+            size_t iStart = 0;
+            size_t iLength = wsContent.GetLength();
             auto iEnd = wsContent.Find(L'\n', iStart);
             iEnd = !iEnd.has_value() ? iLength : iEnd;
             while (iEnd.value() >= iStart) {
diff --git a/xfa/fxfa/parser/cxfa_widgetdata.cpp b/xfa/fxfa/parser/cxfa_widgetdata.cpp
index 1879377..13ccf2b 100644
--- a/xfa/fxfa/parser/cxfa_widgetdata.cpp
+++ b/xfa/fxfa/parser/cxfa_widgetdata.cpp
@@ -846,8 +846,8 @@
   WideString wsValue = GetRawValue();
   if (GetChoiceListOpen() == XFA_ATTRIBUTEENUM_MultiSelect) {
     if (!wsValue.IsEmpty()) {
-      FX_STRSIZE iStart = 0;
-      FX_STRSIZE iLength = wsValue.GetLength();
+      size_t iStart = 0;
+      size_t iLength = wsValue.GetLength();
       auto iEnd = wsValue.Find(L'\n', iStart);
       iEnd = (!iEnd.has_value()) ? iLength : iEnd;
       while (iEnd >= iStart) {
@@ -1766,22 +1766,22 @@
     bNeg = true;
     wsSrcNum.Delete(0, 1);
   }
-  FX_STRSIZE len = wsSrcNum.GetLength();
+
   auto dot_index = wsSrcNum.Find('.');
-  dot_index = !dot_index.has_value() ? len : dot_index;
+  dot_index = !dot_index.has_value() ? wsSrcNum.GetLength() : dot_index;
 
   if (dot_index.value() >= 1) {
-    FX_STRSIZE nPos = dot_index.value() % 3;
+    size_t nPos = dot_index.value() % 3;
     wsOutput.clear();
-    for (FX_STRSIZE i = 0; i < dot_index.value(); i++) {
+    for (size_t i = 0; i < dot_index.value(); i++) {
       if (i % 3 == nPos && i != 0)
         wsOutput += wsGroupSymbol;
 
       wsOutput += wsSrcNum[i];
     }
-    if (dot_index.value() < len) {
+    if (dot_index.value() < wsSrcNum.GetLength()) {
       wsOutput += pLocale->GetNumbericSymbol(FX_LOCALENUMSYMBOL_Decimal);
-      wsOutput += wsSrcNum.Right(len - dot_index.value() - 1);
+      wsOutput += wsSrcNum.Right(wsSrcNum.GetLength() - dot_index.value() - 1);
     }
     if (bNeg) {
       wsOutput =