Reduce signed/unsigned comparison warnings

The warnings generated by Clang. This is part 1 for some simple cases.

BUG=pdfium:29
R=tsepez@chromium.org

Review URL: https://codereview.chromium.org/1840483003 .
diff --git a/core/fpdfapi/fpdf_page/cpdf_colorspace.cpp b/core/fpdfapi/fpdf_page/cpdf_colorspace.cpp
index 3add21c..213d777 100644
--- a/core/fpdfapi/fpdf_page/cpdf_colorspace.cpp
+++ b/core/fpdfapi/fpdf_page/cpdf_colorspace.cpp
@@ -467,7 +467,7 @@
     return;
   }
   FX_FLOAT min, max;
-  for (int i = 0; i < m_nComponents; i++) {
+  for (uint32_t i = 0; i < m_nComponents; i++) {
     GetDefaultValue(i, buf[i], min, max);
   }
 }
@@ -490,7 +490,7 @@
   FX_FLOAT* src = srcbuf;
   FX_FLOAT R, G, B;
   for (int i = 0; i < pixels; i++) {
-    for (int j = 0; j < m_nComponents; j++)
+    for (uint32_t j = 0; j < m_nComponents; j++)
       if (m_Family == PDFCS_INDEXED) {
         src[j] = (FX_FLOAT)(*src_buf++);
       } else {
@@ -842,7 +842,7 @@
   }
   CPDF_Array* pRanges = pDict->GetArrayBy("Range");
   m_pRanges = FX_Alloc2D(FX_FLOAT, m_nComponents, 2);
-  for (int i = 0; i < m_nComponents * 2; i++) {
+  for (uint32_t i = 0; i < m_nComponents * 2; i++) {
     if (pRanges)
       m_pRanges[i] = pRanges->GetNumberAt(i);
     else if (i % 2)
@@ -918,7 +918,7 @@
     ReverseRGB(pDestBuf, pSrcBuf, pixels);
   } else if (m_pProfile->m_pTransform) {
     int nMaxColors = 1;
-    for (int i = 0; i < m_nComponents; i++) {
+    for (uint32_t i = 0; i < m_nComponents; i++) {
       nMaxColors *= 52;
     }
     if (m_nComponents > 3 || image_width * image_height < nMaxColors * 3 / 2) {
@@ -932,7 +932,7 @@
         for (int i = 0; i < nMaxColors; i++) {
           uint32_t color = i;
           uint32_t order = nMaxColors / 52;
-          for (int c = 0; c < m_nComponents; c++) {
+          for (uint32_t c = 0; c < m_nComponents; c++) {
             *pSrc++ = (uint8_t)(color / order * 5);
             color %= order;
             order /= 52;
@@ -944,7 +944,7 @@
       }
       for (int i = 0; i < pixels; i++) {
         int index = 0;
-        for (int c = 0; c < m_nComponents; c++) {
+        for (uint32_t c = 0; c < m_nComponents; c++) {
           index = index * 52 + (*pSrcBuf) / 5;
           pSrcBuf++;
         }
diff --git a/core/fpdfapi/fpdf_page/cpdf_textobject.cpp b/core/fpdfapi/fpdf_page/cpdf_textobject.cpp
index 7ca03b4..444101f 100644
--- a/core/fpdfapi/fpdf_page/cpdf_textobject.cpp
+++ b/core/fpdfapi/fpdf_page/cpdf_textobject.cpp
@@ -28,7 +28,7 @@
       m_nChars == 1 ? (uint32_t)(uintptr_t)m_pCharCodes : m_pCharCodes[index];
   pInfo->m_OriginX = index ? m_pCharPos[index - 1] : 0;
   pInfo->m_OriginY = 0;
-  if (pInfo->m_CharCode == -1) {
+  if (pInfo->m_CharCode == CPDF_Font::kInvalidCharCode) {
     return;
   }
   CPDF_Font* pFont = m_TextState.GetFont();
@@ -54,7 +54,7 @@
   }
   int count = 0;
   for (int i = 0; i < m_nChars; ++i)
-    if (m_pCharCodes[i] != (uint32_t)-1) {
+    if (m_pCharCodes[i] != CPDF_Font::kInvalidCharCode) {
       ++count;
     }
   return count;
@@ -70,10 +70,11 @@
   }
   int count = 0;
   for (int i = 0; i < m_nChars; ++i) {
-    if (m_pCharCodes[i] != (uint32_t)-1) {
+    if (m_pCharCodes[i] != CPDF_Font::kInvalidCharCode) {
       if (count == index) {
         charcode = m_pCharCodes[i];
-        if (i == m_nChars - 1 || m_pCharCodes[i + 1] != (uint32_t)-1) {
+        if (i == m_nChars - 1 ||
+            m_pCharCodes[i + 1] != CPDF_Font::kInvalidCharCode) {
           kerning = 0;
         } else {
           kerning = m_pCharPos[i];
@@ -93,7 +94,7 @@
   int count = 0;
   for (int i = 0; i < m_nChars; ++i) {
     uint32_t charcode = m_pCharCodes[i];
-    if (charcode == (uint32_t)-1) {
+    if (charcode == CPDF_Font::kInvalidCharCode) {
       continue;
     }
     if (count == index) {
@@ -156,7 +157,7 @@
       }
       if (i != nsegs - 1) {
         m_pCharPos[index - 1] = pKerning[i];
-        m_pCharCodes[index++] = (uint32_t)-1;
+        m_pCharCodes[index++] = CPDF_Font::kInvalidCharCode;
       }
     }
   } else {
@@ -206,7 +207,7 @@
     uint32_t charcode =
         m_nChars == 1 ? (uint32_t)(uintptr_t)m_pCharCodes : m_pCharCodes[i];
     if (i > 0) {
-      if (charcode == (uint32_t)-1) {
+      if (charcode == CPDF_Font::kInvalidCharCode) {
         curpos -= (m_pCharPos[i - 1] * fontsize) / 1000;
         continue;
       }
diff --git a/core/fpdfapi/fpdf_page/fpdf_page_parser_old.cpp b/core/fpdfapi/fpdf_page/fpdf_page_parser_old.cpp
index f2b7582..8bff544 100644
--- a/core/fpdfapi/fpdf_page/fpdf_page_parser_old.cpp
+++ b/core/fpdfapi/fpdf_page/fpdf_page_parser_old.cpp
@@ -48,7 +48,7 @@
                             uint8_t*& dest_buf,
                             uint32_t& dest_size) {
   if (!pDecoder) {
-    return static_cast<uint32_t>(-1);
+    return FX_INVALID_OFFSET;
   }
   int ncomps = pDecoder->CountComps();
   int bpc = pDecoder->GetBPC();
@@ -57,7 +57,7 @@
   int pitch = (width * ncomps * bpc + 7) / 8;
   if (height == 0 || pitch > (1 << 30) / height) {
     delete pDecoder;
-    return static_cast<uint32_t>(-1);
+    return FX_INVALID_OFFSET;
   }
   dest_buf = FX_Alloc2D(uint8_t, pitch, height);
   dest_size = pitch * height;  // Safe since checked alloc returned.
diff --git a/core/fpdfapi/fpdf_parser/cpdf_array.cpp b/core/fpdfapi/fpdf_parser/cpdf_array.cpp
index 69de5bb..5444699 100644
--- a/core/fpdfapi/fpdf_parser/cpdf_array.cpp
+++ b/core/fpdfapi/fpdf_parser/cpdf_array.cpp
@@ -47,7 +47,7 @@
 
 CPDF_Object* CPDF_Array::Clone(FX_BOOL bDirect) const {
   CPDF_Array* pCopy = new CPDF_Array();
-  for (int i = 0; i < GetCount(); i++) {
+  for (size_t i = 0; i < GetCount(); i++) {
     CPDF_Object* value = m_Objects.GetAt(i);
     pCopy->m_Objects.Add(value->Clone(bDirect));
   }
diff --git a/core/fpdfapi/fpdf_parser/cpdf_hint_tables.cpp b/core/fpdfapi/fpdf_parser/cpdf_hint_tables.cpp
index dd2be01..147ae37 100644
--- a/core/fpdfapi/fpdf_parser/cpdf_hint_tables.cpp
+++ b/core/fpdfapi/fpdf_parser/cpdf_hint_tables.cpp
@@ -185,7 +185,7 @@
     if (!CanReadFromBitStream(hStream, required_bits))
       return FALSE;
 
-    for (int j = 0; j < m_dwNSharedObjsArray[i]; j++)
+    for (uint32_t j = 0; j < m_dwNSharedObjsArray[i]; j++)
       m_dwIdentifierArray.Add(hStream->GetBits(dwSharedIdBits));
   }
   hStream->ByteAlign();
@@ -385,7 +385,7 @@
 
   uint32_t dwIndex = 0;
   uint32_t dwObjNum = 0;
-  for (int j = 0; j < m_dwNSharedObjsArray[index]; ++j) {
+  for (uint32_t j = 0; j < m_dwNSharedObjsArray[index]; ++j) {
     dwIndex = m_dwIdentifierArray[offset + j];
     if (dwIndex >= m_dwSharedObjNumArray.GetSize())
       return IPDF_DataAvail::DataNotAvailable;
diff --git a/core/fpdfapi/fpdf_parser/fpdf_parser_decode.cpp b/core/fpdfapi/fpdf_parser/fpdf_parser_decode.cpp
index 219a725..346476b 100644
--- a/core/fpdfapi/fpdf_parser/fpdf_parser_decode.cpp
+++ b/core/fpdfapi/fpdf_parser/fpdf_parser_decode.cpp
@@ -176,24 +176,21 @@
     if (src_buf[i] < 128) {
       old = dest_size;
       dest_size += src_buf[i] + 1;
-      if (dest_size < old) {
-        return static_cast<uint32_t>(-1);
-      }
+      if (dest_size < old)
+        return FX_INVALID_OFFSET;
       i += src_buf[i] + 2;
     } else if (src_buf[i] > 128) {
       old = dest_size;
       dest_size += 257 - src_buf[i];
-      if (dest_size < old) {
-        return static_cast<uint32_t>(-1);
-      }
+      if (dest_size < old)
+        return FX_INVALID_OFFSET;
       i += 2;
     } else {
       break;
     }
   }
-  if (dest_size >= _STREAM_MAX_SIZE_) {
-    return static_cast<uint32_t>(-1);
-  }
+  if (dest_size >= _STREAM_MAX_SIZE_)
+    return FX_INVALID_OFFSET;
   dest_buf = FX_Alloc(uint8_t, dest_size);
   i = 0;
   int dest_count = 0;
diff --git a/core/fpdftext/fpdf_text_int.cpp b/core/fpdftext/fpdf_text_int.cpp
index 349a2cd..f8f201b 100644
--- a/core/fpdftext/fpdf_text_int.cpp
+++ b/core/fpdftext/fpdf_text_int.cpp
@@ -898,7 +898,7 @@
 }
 
 int CPDF_TextPage::GetCharWidth(uint32_t charCode, CPDF_Font* pFont) const {
-  if (charCode == -1)
+  if (charCode == CPDF_Font::kInvalidCharCode)
     return 0;
 
   if (int w = pFont->GetCharWidthF(charCode))
@@ -1149,7 +1149,8 @@
   CPDF_Font* pFont = pTextObj->GetFont();
   bExist = FALSE;
   for (FX_STRSIZE i = 0; i < nItems; i++) {
-    if (pFont->CharCodeFromUnicode(actText.GetAt(i)) != -1) {
+    if (pFont->CharCodeFromUnicode(actText.GetAt(i)) !=
+        CPDF_Font::kInvalidCharCode) {
       bExist = TRUE;
       break;
     }
@@ -1417,7 +1418,7 @@
       FX_FLOAT fontsize_h = pTextObj->m_TextState.GetFontSizeH();
       uint32_t space_charcode = pFont->CharCodeFromUnicode(' ');
       FX_FLOAT threshold = 0;
-      if (space_charcode != -1) {
+      if (space_charcode != CPDF_Font::kInvalidCharCode) {
         threshold = fontsize_h * pFont->GetCharWidthF(space_charcode) / 1000;
       }
       if (threshold > fontsize_h / 3) {
@@ -1439,7 +1440,7 @@
         charinfo.m_pTextObj = pTextObj;
         charinfo.m_Index = m_TextBuf.GetLength();
         m_TempTextBuf.AppendChar(TEXT_BLANK_CHAR);
-        charinfo.m_CharCode = -1;
+        charinfo.m_CharCode = CPDF_Font::kInvalidCharCode;
         charinfo.m_Matrix.Copy(formMatrix);
         matrix.Transform(item.m_OriginX, item.m_OriginY, charinfo.m_OriginX,
                          charinfo.m_OriginY);
@@ -1448,7 +1449,7 @@
                           charinfo.m_OriginX, charinfo.m_OriginY);
         m_TempCharList.push_back(charinfo);
       }
-      if (item.m_CharCode == (uint32_t)-1) {
+      if (item.m_CharCode == CPDF_Font::kInvalidCharCode) {
         continue;
       }
     }
@@ -1858,12 +1859,13 @@
   info.m_Index = m_TextBuf.GetLength();
   info.m_Unicode = unicode;
   info.m_pTextObj = NULL;
-  info.m_CharCode = -1;
+  info.m_CharCode = CPDF_Font::kInvalidCharCode;
   info.m_Flag = FPDFTEXT_CHAR_GENERATED;
   int preWidth = 0;
-  if (preChar->m_pTextObj && preChar->m_CharCode != (uint32_t)-1)
+  if (preChar->m_pTextObj && preChar->m_CharCode != -1) {
     preWidth =
         GetCharWidth(preChar->m_CharCode, preChar->m_pTextObj->GetFont());
+  }
 
   FX_FLOAT fFontSize = preChar->m_pTextObj ? preChar->m_pTextObj->GetFontSize()
                                            : preChar->m_CharBox.Height();
diff --git a/core/fxcodec/codec/fx_codec_flate.cpp b/core/fxcodec/codec/fx_codec_flate.cpp
index e69c017..6961dcc 100644
--- a/core/fxcodec/codec/fx_codec_flate.cpp
+++ b/core/fxcodec/codec/fx_codec_flate.cpp
@@ -9,6 +9,7 @@
 #include <algorithm>
 #include <memory>
 
+#include "core/fxcrt/include/fx_ext.h"
 #include "core/include/fxcodec/fx_codec.h"
 #include "core/include/fxcodec/fx_codec_flate.h"
 #include "third_party/zlib_v128/zlib.h"
@@ -942,7 +943,7 @@
       offset = src_size;
       int err = decoder->Decode(NULL, dest_size, src_buf, offset, bEarlyChange);
       if (err || dest_size == 0 || dest_size + 1 < dest_size) {
-        return static_cast<uint32_t>(-1);
+        return FX_INVALID_OFFSET;
       }
     }
     {
@@ -965,7 +966,7 @@
     ret =
         TIFF_Predictor(dest_buf, dest_size, Colors, BitsPerComponent, Columns);
   }
-  return ret ? offset : static_cast<uint32_t>(-1);
+  return ret ? offset : FX_INVALID_OFFSET;
 }
 FX_BOOL CCodec_FlateModule::Encode(const uint8_t* src_buf,
                                    uint32_t src_size,
diff --git a/core/fxcodec/jbig2/JBig2_Context.cpp b/core/fxcodec/jbig2/JBig2_Context.cpp
index 1c316a0..1ff78e1 100644
--- a/core/fxcodec/jbig2/JBig2_Context.cpp
+++ b/core/fxcodec/jbig2/JBig2_Context.cpp
@@ -1277,7 +1277,7 @@
   const size_t kRunCodesSize = 35;
   int32_t runcodes[kRunCodesSize];
   int32_t runcodes_len[kRunCodesSize];
-  for (int32_t i = 0; i < kRunCodesSize; ++i) {
+  for (size_t i = 0; i < kRunCodesSize; ++i) {
     if (pStream->readNBits(4, &runcodes_len[i]) != 0)
       return nullptr;
   }
@@ -1288,7 +1288,7 @@
   int32_t run;
   int32_t i = 0;
   while (i < (int)SBNUMSYMS) {
-    int32_t j;
+    size_t j;
     int32_t nVal = 0;
     int32_t nBits = 0;
     uint32_t nTemp;
@@ -1299,15 +1299,13 @@
       nVal = (nVal << 1) | nTemp;
       ++nBits;
       for (j = 0; j < kRunCodesSize; ++j) {
-        if (nBits == runcodes_len[j] && nVal == runcodes[j]) {
+        if (nBits == runcodes_len[j] && nVal == runcodes[j])
           break;
-        }
       }
-      if (j < kRunCodesSize) {
+      if (j < kRunCodesSize)
         break;
-      }
     }
-    int32_t runcode = j;
+    int32_t runcode = static_cast<int32_t>(j);
     if (runcode < 32) {
       SBSYMCODES.get()[i].codelen = runcode;
       run = 0;
@@ -1327,11 +1325,11 @@
     if (run > 0) {
       if (i + run > (int)SBNUMSYMS)
         return nullptr;
-      for (j = 0; j < run; ++j) {
+      for (int32_t k = 0; k < run; ++k) {
         if (runcode == 32 && i > 0) {
-          SBSYMCODES.get()[i + j].codelen = SBSYMCODES.get()[i - 1].codelen;
+          SBSYMCODES.get()[i + k].codelen = SBSYMCODES.get()[i - 1].codelen;
         } else {
-          SBSYMCODES.get()[i + j].codelen = 0;
+          SBSYMCODES.get()[i + k].codelen = 0;
         }
       }
       i += run;
diff --git a/core/fxcrt/include/fx_ext.h b/core/fxcrt/include/fx_ext.h
index 8492bc9..68ae2a3 100644
--- a/core/fxcrt/include/fx_ext.h
+++ b/core/fxcrt/include/fx_ext.h
@@ -12,6 +12,8 @@
 
 #include "core/fxcrt/include/fx_basic.h"
 
+#define FX_INVALID_OFFSET static_cast<uint32_t>(-1)
+
 // TODO(thestig) Using unique_ptr with ReleaseDeleter is still not ideal.
 // Come up or wait for something better. This appears in this file rather
 // than fx_stream.h due to include ordering restrictions.
diff --git a/core/fxge/ge/fx_ge_font.cpp b/core/fxge/ge/fx_ge_font.cpp
index 04019a0..fab5ea2 100644
--- a/core/fxge/ge/fx_ge_font.cpp
+++ b/core/fxge/ge/fx_ge_font.cpp
@@ -4,6 +4,7 @@
 
 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
 
+#include "core/fpdfapi/fpdf_font/include/cpdf_font.h"
 #include "core/fxge/ge/fx_text_int.h"
 #include "core/include/fxge/fx_freetype.h"
 #include "core/include/fxge/fx_ge.h"
@@ -516,7 +517,7 @@
       return Unicode;
     }
   }
-  return static_cast<uint32_t>(-1);
+  return CPDF_Font::kInvalidCharCode;
 }
 
 CFX_UnicodeEncodingEx* FX_CreateFontEncodingEx(CFX_Font* pFont,
diff --git a/core/fxge/ge/fx_ge_fontmap.cpp b/core/fxge/ge/fx_ge_fontmap.cpp
index 709ef00..c6a6c5c 100644
--- a/core/fxge/ge/fx_ge_fontmap.cpp
+++ b/core/fxge/ge/fx_ge_fontmap.cpp
@@ -1329,12 +1329,12 @@
 }
 
 FX_BOOL CFX_FontMapper::IsBuiltinFace(const FXFT_Face face) const {
-  for (int i = 0; i < MM_FACE_COUNT; ++i) {
+  for (size_t i = 0; i < MM_FACE_COUNT; ++i) {
     if (m_MMFaces[i] == face) {
       return TRUE;
     }
   }
-  for (int i = 0; i < FOXIT_FACE_COUNT; ++i) {
+  for (size_t i = 0; i < FOXIT_FACE_COUNT; ++i) {
     if (m_FoxitFaces[i] == face) {
       return TRUE;
     }
diff --git a/fpdfsdk/fsdk_baseform.cpp b/fpdfsdk/fsdk_baseform.cpp
index 5dd27f8..1e12462 100644
--- a/fpdfsdk/fsdk_baseform.cpp
+++ b/fpdfsdk/fsdk_baseform.cpp
@@ -2800,13 +2800,13 @@
           sa.erase(sa.begin() + nLeftTopIndex);
 
           std::vector<int> aSelect;
-          for (int i = 0; i < sa.size(); ++i) {
+          for (size_t i = 0; i < sa.size(); ++i) {
             CFX_FloatRect rcAnnot = GetAnnotRect(sa[i]);
             FX_FLOAT fCenterY = (rcAnnot.top + rcAnnot.bottom) / 2.0f;
             if (fCenterY > rcLeftTop.bottom && fCenterY < rcLeftTop.top)
               aSelect.push_back(i);
           }
-          for (int i = 0; i < aSelect.size(); ++i)
+          for (size_t i = 0; i < aSelect.size(); ++i)
             m_Annots.push_back(sa[aSelect[i]]);
 
           for (int i = aSelect.size() - 1; i >= 0; --i)
@@ -2844,13 +2844,13 @@
           sa.erase(sa.begin() + nLeftTopIndex);
 
           std::vector<int> aSelect;
-          for (int i = 0; i < sa.size(); ++i) {
+          for (size_t i = 0; i < sa.size(); ++i) {
             CFX_FloatRect rcAnnot = GetAnnotRect(sa[i]);
             FX_FLOAT fCenterX = (rcAnnot.left + rcAnnot.right) / 2.0f;
             if (fCenterX > rcLeftTop.left && fCenterX < rcLeftTop.right)
               aSelect.push_back(i);
           }
-          for (int i = 0; i < aSelect.size(); ++i)
+          for (size_t i = 0; i < aSelect.size(); ++i)
             m_Annots.push_back(sa[aSelect[i]]);
 
           for (int i = aSelect.size() - 1; i >= 0; --i)
diff --git a/fpdfsdk/fxedit/fxet_edit.cpp b/fpdfsdk/fxedit/fxet_edit.cpp
index 3d7e485..f45f9ea 100644
--- a/fpdfsdk/fxedit/fxet_edit.cpp
+++ b/fpdfsdk/fxedit/fxet_edit.cpp
@@ -110,7 +110,7 @@
     else
       charcode = m_pFontMap->CharCodeFromUnicode(nFontIndex, word);
 
-    if (charcode != -1)
+    if (charcode != CPDF_Font::kInvalidCharCode)
       return pPDFFont->GetCharWidthF(charcode);
   }
 
diff --git a/fpdfsdk/javascript/Document.cpp b/fpdfsdk/javascript/Document.cpp
index 0b793db..70b4ef7 100644
--- a/fpdfsdk/javascript/Document.cpp
+++ b/fpdfsdk/javascript/Document.cpp
@@ -1460,7 +1460,7 @@
   FX_BOOL bIsLatin = FALSE;
 
   for (int i = 0, sz = pTextObj->CountChars(); i < sz; i++) {
-    uint32_t charcode = static_cast<uint32_t>(-1);
+    uint32_t charcode = CPDF_Font::kInvalidCharCode;
     FX_FLOAT kerning;
 
     pTextObj->GetCharInfo(i, charcode, kerning);
@@ -1493,7 +1493,7 @@
   FX_BOOL bIsLatin = FALSE;
 
   for (int i = 0, sz = pTextObj->CountChars(); i < sz; i++) {
-    uint32_t charcode = static_cast<uint32_t>(-1);
+    uint32_t charcode = CPDF_Font::kInvalidCharCode;
     FX_FLOAT kerning;
 
     pTextObj->GetCharInfo(i, charcode, kerning);
diff --git a/fpdfsdk/javascript/JS_Value.cpp b/fpdfsdk/javascript/JS_Value.cpp
index 1d57833..4d2a1d4 100644
--- a/fpdfsdk/javascript/JS_Value.cpp
+++ b/fpdfsdk/javascript/JS_Value.cpp
@@ -893,7 +893,7 @@
 
   va_list ap;
   va_start(ap, nKeywords);
-  for (int i = 0; i < nKeywords; ++i) {
+  for (size_t i = 0; i < nKeywords; ++i) {
     const wchar_t* property = va_arg(ap, const wchar_t*);
     v8::Local<v8::Value> v8Value =
         FXJS_GetObjectElement(pRuntime->GetIsolate(), pObj, property);
diff --git a/fpdfsdk/pdfwindow/PWL_FontMap.cpp b/fpdfsdk/pdfwindow/PWL_FontMap.cpp
index 0a5eef6..3f149e7 100644
--- a/fpdfsdk/pdfwindow/PWL_FontMap.cpp
+++ b/fpdfsdk/pdfwindow/PWL_FontMap.cpp
@@ -177,7 +177,7 @@
 }
 
 FX_BOOL CPWL_FontMap::IsStandardFont(const CFX_ByteString& sFontName) {
-  for (int32_t i = 0; i < FX_ArraySize(g_sDEStandardFontName); ++i) {
+  for (size_t i = 0; i < FX_ArraySize(g_sDEStandardFontName); ++i) {
     if (sFontName == g_sDEStandardFontName[i])
       return TRUE;
   }
diff --git a/testing/fx_string_testhelpers.cpp b/testing/fx_string_testhelpers.cpp
index e6b4a38..b2d30f3 100644
--- a/testing/fx_string_testhelpers.cpp
+++ b/testing/fx_string_testhelpers.cpp
@@ -12,7 +12,8 @@
 template <typename T>
 std::ostream& output_string(std::ostream& out, const T& str) {
   out << std::hex << std::setfill('0') << '"';
-  for (size_t i = 0; i < str.GetLength(); ++i) {
+  // This function is used for FX strings whose length is defined as int.
+  for (int i = 0; i < str.GetLength(); ++i) {
     unsigned int c = str.GetAt(i);
     if (c >= 0x20 && c < 0x7F) {
       out << static_cast<char>(c);