LSC: Apply clang-tidy's modernize-use-bool-literals to pdfium

The check finds implicit conversions of integer literals to bools:
 bool b1 = 1;
 bool b2 = static_cast<bool>(1);
and transforms them to:
 bool b1 = true;
 bool b2 = true;

Bug: chromium:1290142
Change-Id: I0d31b1eef99c0e708ded05fa2b489fadb11db14e
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/89730
Auto-Submit: Anton Bikineev <bikineev@chromium.org>
Reviewed-by: Tom Sepez <tsepez@chromium.org>
Commit-Queue: Tom Sepez <tsepez@chromium.org>
diff --git a/core/fpdfapi/edit/cpdf_pagecontentgenerator.cpp b/core/fpdfapi/edit/cpdf_pagecontentgenerator.cpp
index 149e743..3f205f8 100644
--- a/core/fpdfapi/edit/cpdf_pagecontentgenerator.cpp
+++ b/core/fpdfapi/edit/cpdf_pagecontentgenerator.cpp
@@ -189,7 +189,7 @@
 
   ByteString name;
   int idnum = 1;
-  while (1) {
+  while (true) {
     name = ByteString::Format("FX%c%d", bsType[0], idnum);
     if (!pResList->KeyExist(name))
       break;
diff --git a/core/fpdfapi/font/cpdf_cmap.cpp b/core/fpdfapi/font/cpdf_cmap.cpp
index 775a3a9..8e93bae 100644
--- a/core/fpdfapi/font/cpdf_cmap.cpp
+++ b/core/fpdfapi/font/cpdf_cmap.cpp
@@ -321,7 +321,7 @@
     : m_DirectCharcodeToCIDTable(65536) {
   CPDF_CMapParser parser(this);
   CPDF_SimpleParser syntax(spEmbeddedData);
-  while (1) {
+  while (true) {
     ByteStringView word = syntax.GetWord();
     if (word.IsEmpty())
       break;
@@ -380,7 +380,7 @@
       uint8_t codes[4];
       int char_size = 1;
       codes[0] = offset < pBytes.size() ? pBytes[offset++] : 0;
-      while (1) {
+      while (true) {
         int ret = CheckFourByteCodeRange(codes, char_size,
                                          m_MixedFourByteLeadingRanges);
         if (ret == 0)
diff --git a/core/fpdfapi/font/cpdf_tounicodemap.cpp b/core/fpdfapi/font/cpdf_tounicodemap.cpp
index 99409e2..a62b34d 100644
--- a/core/fpdfapi/font/cpdf_tounicodemap.cpp
+++ b/core/fpdfapi/font/cpdf_tounicodemap.cpp
@@ -115,7 +115,7 @@
   auto pAcc = pdfium::MakeRetain<CPDF_StreamAcc>(pStream);
   pAcc->LoadAllDataFiltered();
   CPDF_SimpleParser parser(pAcc->GetSpan());
-  while (1) {
+  while (true) {
     ByteStringView word = parser.GetWord();
     if (word.IsEmpty())
       break;
@@ -140,7 +140,7 @@
 }
 
 void CPDF_ToUnicodeMap::HandleBeginBFChar(CPDF_SimpleParser* pParser) {
-  while (1) {
+  while (true) {
     ByteStringView word = pParser->GetWord();
     if (word.IsEmpty() || word == "endbfchar")
       return;
@@ -154,7 +154,7 @@
 }
 
 void CPDF_ToUnicodeMap::HandleBeginBFRange(CPDF_SimpleParser* pParser) {
-  while (1) {
+  while (true) {
     ByteStringView lowcode_str = pParser->GetWord();
     if (lowcode_str.IsEmpty() || lowcode_str == "endbfrange")
       return;
diff --git a/core/fpdfapi/page/cpdf_page.cpp b/core/fpdfapi/page/cpdf_page.cpp
index bc22a47..abacbc4 100644
--- a/core/fpdfapi/page/cpdf_page.cpp
+++ b/core/fpdfapi/page/cpdf_page.cpp
@@ -77,7 +77,7 @@
 CPDF_Object* CPDF_Page::GetPageAttr(const ByteString& name) const {
   CPDF_Dictionary* pPageDict = GetDict();
   std::set<CPDF_Dictionary*> visited;
-  while (1) {
+  while (true) {
     visited.insert(pPageDict);
     if (CPDF_Object* pObj = pPageDict->GetDirectObjectFor(name))
       return pObj;
diff --git a/core/fpdfapi/page/cpdf_psengine.cpp b/core/fpdfapi/page/cpdf_psengine.cpp
index ba41d95..6ae14b3 100644
--- a/core/fpdfapi/page/cpdf_psengine.cpp
+++ b/core/fpdfapi/page/cpdf_psengine.cpp
@@ -122,7 +122,7 @@
   if (depth > kMaxDepth)
     return false;
 
-  while (1) {
+  while (true) {
     ByteStringView word = parser->GetWord();
     if (word.IsEmpty())
       return false;
diff --git a/core/fpdfapi/page/cpdf_streamcontentparser.cpp b/core/fpdfapi/page/cpdf_streamcontentparser.cpp
index 91ea8e8..21214c6 100644
--- a/core/fpdfapi/page/cpdf_streamcontentparser.cpp
+++ b/core/fpdfapi/page/cpdf_streamcontentparser.cpp
@@ -604,7 +604,7 @@
 void CPDF_StreamContentParser::Handle_BeginImage() {
   FX_FILESIZE savePos = m_pSyntax->GetPos();
   auto pDict = m_pDocument->New<CPDF_Dictionary>();
-  while (1) {
+  while (true) {
     CPDF_StreamParser::ElementType type = m_pSyntax->ParseNextElement();
     if (type == CPDF_StreamParser::ElementType::kKeyword) {
       if (m_pSyntax->GetWord() != "ID") {
@@ -641,7 +641,7 @@
   pDict->SetNewFor<CPDF_Name>("Subtype", "Image");
   RetainPtr<CPDF_Stream> pStream =
       m_pSyntax->ReadInlineStream(m_pDocument.Get(), std::move(pDict), pCSObj);
-  while (1) {
+  while (true) {
     CPDF_StreamParser::ElementType type = m_pSyntax->ParseNextElement();
     if (type == CPDF_StreamParser::ElementType::kEndOfData)
       break;
@@ -1516,7 +1516,7 @@
   m_pSyntax = std::make_unique<CPDF_StreamParser>(
       pDataStart, m_pDocument->GetByteStringPool());
 
-  while (1) {
+  while (true) {
     uint32_t cost = m_pObjectHolder->GetPageObjectCount() - init_obj_count;
     if (max_cost && cost >= max_cost) {
       break;
@@ -1547,7 +1547,7 @@
   float params[6] = {};
   int nParams = 0;
   int last_pos = m_pSyntax->GetPos();
-  while (1) {
+  while (true) {
     CPDF_StreamParser::ElementType type = m_pSyntax->ParseNextElement();
     bool bProcessed = true;
     switch (type) {
diff --git a/core/fpdfapi/page/cpdf_streamparser.cpp b/core/fpdfapi/page/cpdf_streamparser.cpp
index 14a474d..b134e50 100644
--- a/core/fpdfapi/page/cpdf_streamparser.cpp
+++ b/core/fpdfapi/page/cpdf_streamparser.cpp
@@ -192,7 +192,7 @@
 
     uint32_t dwSavePos = m_Pos;
     m_Pos += dwStreamSize;
-    while (1) {
+    while (true) {
       uint32_t dwPrevPos = m_Pos;
       ElementType type = ParseNextElement();
       if (type == ElementType::kEndOfData)
@@ -226,7 +226,7 @@
     return ElementType::kEndOfData;
 
   uint8_t ch = m_pBuf[m_Pos++];
-  while (1) {
+  while (true) {
     while (PDFCharIsWhitespace(ch)) {
       if (!PositionIsInBounds())
         return ElementType::kEndOfData;
@@ -237,7 +237,7 @@
     if (ch != '%')
       break;
 
-    while (1) {
+    while (true) {
       if (!PositionIsInBounds())
         return ElementType::kEndOfData;
 
@@ -254,7 +254,7 @@
   }
 
   bool bIsNumber = true;
-  while (1) {
+  while (true) {
     if (m_WordSize < kMaxWordLength)
       m_WordBuffer[m_WordSize++] = ch;
 
@@ -330,7 +330,7 @@
       return pdfium::MakeRetain<CPDF_String>(m_pPool, ReadHexString(), true);
 
     auto pDict = pdfium::MakeRetain<CPDF_Dictionary>(m_pPool);
-    while (1) {
+    while (true) {
       GetNextWord(bIsNumber);
       if (m_WordSize == 2 && m_WordBuffer[0] == '>')
         break;
@@ -355,7 +355,7 @@
       return nullptr;
 
     auto pArray = pdfium::MakeRetain<CPDF_Array>();
-    while (1) {
+    while (true) {
       RetainPtr<CPDF_Object> pObj =
           ReadNextObject(bAllowNestedArray, true, dwRecursionLevel + 1);
       if (pObj) {
@@ -385,7 +385,7 @@
     return;
 
   uint8_t ch = m_pBuf[m_Pos++];
-  while (1) {
+  while (true) {
     while (PDFCharIsWhitespace(ch)) {
       if (!PositionIsInBounds()) {
         return;
@@ -396,7 +396,7 @@
     if (ch != '%')
       break;
 
-    while (1) {
+    while (true) {
       if (!PositionIsInBounds())
         return;
       ch = m_pBuf[m_Pos++];
@@ -409,7 +409,7 @@
     bIsNumber = false;
     m_WordBuffer[m_WordSize++] = ch;
     if (ch == '/') {
-      while (1) {
+      while (true) {
         if (!PositionIsInBounds())
           return;
         ch = m_pBuf[m_Pos++];
@@ -440,7 +440,7 @@
     return;
   }
 
-  while (1) {
+  while (true) {
     if (m_WordSize < kMaxWordLength)
       m_WordBuffer[m_WordSize++] = ch;
     if (!PDFCharIsNumeric(ch))
@@ -465,7 +465,7 @@
   int status = 0;
   int iEscCode = 0;
   uint8_t ch = m_pBuf[m_Pos++];
-  while (1) {
+  while (true) {
     switch (status) {
       case 0:
         if (ch == ')') {
diff --git a/core/fpdfapi/parser/cfdf_document.cpp b/core/fpdfapi/parser/cfdf_document.cpp
index 6f2f541..5b6510e 100644
--- a/core/fpdfapi/parser/cfdf_document.cpp
+++ b/core/fpdfapi/parser/cfdf_document.cpp
@@ -38,7 +38,7 @@
 void CFDF_Document::ParseStream(RetainPtr<IFX_SeekableReadStream> pFile) {
   m_pFile = std::move(pFile);
   CPDF_SyntaxParser parser(m_pFile);
-  while (1) {
+  while (true) {
     CPDF_SyntaxParser::WordResult word_result = parser.GetNextWord();
     if (word_result.is_number) {
       uint32_t objnum = FXSYS_atoui(word_result.word.c_str());
diff --git a/core/fpdfapi/parser/cpdf_crypto_handler.cpp b/core/fpdfapi/parser/cpdf_crypto_handler.cpp
index eeb8329..51ddea6 100644
--- a/core/fpdfapi/parser/cpdf_crypto_handler.cpp
+++ b/core/fpdfapi/parser/cpdf_crypto_handler.cpp
@@ -167,7 +167,7 @@
   }
   uint32_t src_off = 0;
   uint32_t src_left = source.size();
-  while (1) {
+  while (true) {
     uint32_t copy_size = 16 - pContext->m_BlockOffset;
     if (copy_size > src_left) {
       copy_size = src_left;
diff --git a/core/fpdfapi/parser/cpdf_parser.cpp b/core/fpdfapi/parser/cpdf_parser.cpp
index 17aedfb..dde8886 100644
--- a/core/fpdfapi/parser/cpdf_parser.cpp
+++ b/core/fpdfapi/parser/cpdf_parser.cpp
@@ -569,7 +569,7 @@
   if (m_pSyntax->GetKeyword() != "xref")
     return false;
   std::vector<CrossRefObjData> result_objects;
-  while (1) {
+  while (true) {
     FX_FILESIZE saved_pos = m_pSyntax->GetPos();
     CPDF_SyntaxParser::WordResult word_result = m_pSyntax->GetNextWord();
     const ByteString& word = word_result.word;
diff --git a/core/fpdfapi/parser/cpdf_simple_parser.cpp b/core/fpdfapi/parser/cpdf_simple_parser.cpp
index ff6e2cf..37c3be2 100644
--- a/core/fpdfapi/parser/cpdf_simple_parser.cpp
+++ b/core/fpdfapi/parser/cpdf_simple_parser.cpp
@@ -17,7 +17,7 @@
   uint8_t ch;
 
   // Skip whitespace and comment lines.
-  while (1) {
+  while (true) {
     if (data_.size() <= cur_pos_)
       return ByteStringView();
 
@@ -31,7 +31,7 @@
     if (ch != '%')
       break;
 
-    while (1) {
+    while (true) {
       if (data_.size() <= cur_pos_)
         return ByteStringView();
 
@@ -46,7 +46,7 @@
   if (PDFCharIsDelimiter(ch)) {
     // Find names
     if (ch == '/') {
-      while (1) {
+      while (true) {
         if (data_.size() <= cur_pos_)
           break;
 
diff --git a/core/fpdfapi/parser/cpdf_syntax_parser.cpp b/core/fpdfapi/parser/cpdf_syntax_parser.cpp
index f7baf3f..61532d2 100644
--- a/core/fpdfapi/parser/cpdf_syntax_parser.cpp
+++ b/core/fpdfapi/parser/cpdf_syntax_parser.cpp
@@ -185,7 +185,7 @@
 
     m_WordBuffer[m_WordSize++] = ch;
     if (ch == '/') {
-      while (1) {
+      while (true) {
         if (!GetNextChar(ch))
           return word_type;
 
@@ -217,7 +217,7 @@
     return word_type;
   }
 
-  while (1) {
+  while (true) {
     if (m_WordSize < sizeof(m_WordBuffer) - 1)
       m_WordBuffer[m_WordSize++] = ch;
 
@@ -244,7 +244,7 @@
   int32_t parlevel = 0;
   ReadStatus status = ReadStatus::kNormal;
   int32_t iEscCode = 0;
-  while (1) {
+  while (true) {
     switch (status) {
       case ReadStatus::kNormal:
         if (ch == ')') {
@@ -329,7 +329,7 @@
   ByteString buf;
   bool bFirst = true;
   uint8_t code = 0;
-  while (1) {
+  while (true) {
     if (ch == '>')
       break;
 
@@ -378,7 +378,7 @@
   if (!GetNextChar(ch))
     return;
 
-  while (1) {
+  while (true) {
     while (PDFCharIsWhitespace(ch)) {
       if (!GetNextChar(ch))
         return;
@@ -387,7 +387,7 @@
     if (ch != '%')
       break;
 
-    while (1) {
+    while (true) {
       if (!GetNextChar(ch))
         return;
       if (PDFCharIsLineEnding(ch))
@@ -414,7 +414,7 @@
   EofState eof_state = EofState::kInitial;
   // Find the first character which is neither whitespace, nor part of a
   // comment.
-  while (1) {
+  while (true) {
     uint8_t ch;
     if (!GetNextChar(ch))
       return;
@@ -556,7 +556,7 @@
   if (word == "<<") {
     RetainPtr<CPDF_Dictionary> pDict =
         pdfium::MakeRetain<CPDF_Dictionary>(m_pPool);
-    while (1) {
+    while (true) {
       WordResult inner_word_result = GetNextWord();
       const ByteString& inner_word = inner_word_result.word;
       if (inner_word.IsEmpty())
@@ -859,7 +859,7 @@
 
   FX_FILESIZE pos = m_Pos;
   int32_t offset = taglen - 1;
-  while (1) {
+  while (true) {
     if (limit && pos <= m_Pos - limit)
       return false;
 
@@ -891,7 +891,7 @@
   DCHECK_GT(taglen, 0);
 
   int32_t match = 0;
-  while (1) {
+  while (true) {
     uint8_t ch;
     if (!GetNextChar(ch))
       return -1;
diff --git a/core/fpdfapi/render/cpdf_rendershading.cpp b/core/fpdfapi/render/cpdf_rendershading.cpp
index 7078c1a..7275f22 100644
--- a/core/fpdfapi/render/cpdf_rendershading.cpp
+++ b/core/fpdfapi/render/cpdf_rendershading.cpp
@@ -476,7 +476,7 @@
     return;
 
   int last_index = 0;
-  while (1) {
+  while (true) {
     vertices[1 - last_index] = stream.ReadVertexRow(mtObject2Bitmap, row_verts);
     if (vertices[1 - last_index].empty())
       return;
diff --git a/core/fpdfapi/render/cpdf_scaledrenderbuffer.cpp b/core/fpdfapi/render/cpdf_scaledrenderbuffer.cpp
index b6a4474..52b658e 100644
--- a/core/fpdfapi/render/cpdf_scaledrenderbuffer.cpp
+++ b/core/fpdfapi/render/cpdf_scaledrenderbuffer.cpp
@@ -38,7 +38,7 @@
   bool bIsAlpha =
       !!(m_pDevice->GetDeviceCaps(FXDC_RENDER_CAPS) & FXRC_ALPHA_OUTPUT);
   FXDIB_Format dibFormat = bIsAlpha ? FXDIB_Format::kArgb : FXDIB_Format::kRgb;
-  while (1) {
+  while (true) {
     FX_RECT bitmap_rect =
         m_Matrix.TransformRect(CFX_FloatRect(rect)).GetOuterRect();
     int32_t width = bitmap_rect.Width();
diff --git a/core/fpdfdoc/cpdf_defaultappearance.cpp b/core/fpdfdoc/cpdf_defaultappearance.cpp
index 44a6cf9..621e8a8 100644
--- a/core/fpdfdoc/cpdf_defaultappearance.cpp
+++ b/core/fpdfdoc/cpdf_defaultappearance.cpp
@@ -29,7 +29,7 @@
   int buf_count = 0;
 
   parser->SetCurPos(0);
-  while (1) {
+  while (true) {
     pBuf[buf_index++] = parser->GetCurPos();
     if (buf_index == nParams)
       buf_index = 0;
diff --git a/core/fpdfdoc/cpdf_interactiveform.cpp b/core/fpdfdoc/cpdf_interactiveform.cpp
index 00d5aef..36bdae1 100644
--- a/core/fpdfdoc/cpdf_interactiveform.cpp
+++ b/core/fpdfdoc/cpdf_interactiveform.cpp
@@ -485,7 +485,7 @@
   Node* pNode = GetRoot();
   Node* pLast = nullptr;
   CFieldNameExtractor name_extractor(full_name);
-  while (1) {
+  while (true) {
     WideStringView name_view = name_extractor.GetNext();
     if (name_view.IsEmpty())
       break;
diff --git a/core/fpdftext/cpdf_textpagefind.cpp b/core/fpdftext/cpdf_textpagefind.cpp
index 74df306..30e5f94 100644
--- a/core/fpdftext/cpdf_textpagefind.cpp
+++ b/core/fpdftext/cpdf_textpagefind.cpp
@@ -128,7 +128,7 @@
   }
 
   int index = 0;
-  while (1) {
+  while (true) {
     absl::optional<WideString> word = ExtractSubString(findwhat.c_str(), index);
     if (!word.has_value())
       break;
diff --git a/core/fxcodec/fax/faxmodule.cpp b/core/fxcodec/fax/faxmodule.cpp
index 8feafcd..9386f82 100644
--- a/core/fxcodec/fax/faxmodule.cpp
+++ b/core/fxcodec/fax/faxmodule.cpp
@@ -261,7 +261,7 @@
               int bitsize) {
   uint32_t code = 0;
   int ins_off = 0;
-  while (1) {
+  while (true) {
     uint8_t ins = ins_array[ins_off++];
     if (ins == 0xff)
       return -1;
@@ -290,7 +290,7 @@
                  int columns) {
   int a0 = -1;
   bool a0color = true;
-  while (1) {
+  while (true) {
     if (*bitpos >= bitsize)
       return;
 
@@ -314,7 +314,7 @@
         v_delta = bit2 ? 1 : -1;
       } else if (bit2) {
         int run_len1 = 0;
-        while (1) {
+        while (true) {
           int run = FaxGetRun(a0color ? FaxWhiteRunIns : FaxBlackRunIns,
                               src_buf, bitpos, bitsize);
           run_len1 += run;
@@ -331,7 +331,7 @@
           FaxFillBits(dest_buf, columns, a0, a1);
 
         int run_len2 = 0;
-        while (1) {
+        while (true) {
           int run = FaxGetRun(a0color ? FaxBlackRunIns : FaxWhiteRunIns,
                               src_buf, bitpos, bitsize);
           run_len2 += run;
@@ -426,12 +426,12 @@
                   int columns) {
   bool color = true;
   int startpos = 0;
-  while (1) {
+  while (true) {
     if (*bitpos >= bitsize)
       return;
 
     int run_len = 0;
-    while (1) {
+    while (true) {
       int run = FaxGetRun(color ? FaxWhiteRunIns : FaxBlackRunIns, src_buf,
                           bitpos, bitsize);
       if (run < 0) {
diff --git a/core/fxcodec/flate/flatemodule.cpp b/core/fxcodec/flate/flatemodule.cpp
index ab423ec..9dd3603 100644
--- a/core/fxcodec/flate/flatemodule.cpp
+++ b/core/fxcodec/flate/flatemodule.cpp
@@ -158,7 +158,7 @@
 }
 
 void CLZWDecoder::DecodeString(uint32_t code) {
-  while (1) {
+  while (true) {
     int index = code - 258;
     if (index < 0 || static_cast<uint32_t>(index) >= current_code_)
       break;
@@ -196,7 +196,7 @@
   // this size.
   dest_buf_size_ = 512;
   dest_buf_.reset(FX_Alloc(uint8_t, dest_buf_size_));
-  while (1) {
+  while (true) {
     if (src_bit_pos_ + code_len_ > src_span_.size() * 8)
       break;
 
@@ -547,7 +547,7 @@
   std::vector<std::unique_ptr<uint8_t, FxFreeDeleter>> result_tmp_bufs;
   {
     std::unique_ptr<uint8_t, FxFreeDeleter> cur_buf = std::move(guess_buf);
-    while (1) {
+    while (true) {
       uint32_t ret = FlateOutput(context.get(), cur_buf.get(), buf_size);
       uint32_t avail_buf_size = FlateGetAvailOut(context.get());
       if (ret != Z_OK || avail_buf_size != 0) {
diff --git a/core/fxcodec/jbig2/JBig2_ArithDecoder.h b/core/fxcodec/jbig2/JBig2_ArithDecoder.h
index 9731ac6..eea78ea 100644
--- a/core/fxcodec/jbig2/JBig2_ArithDecoder.h
+++ b/core/fxcodec/jbig2/JBig2_ArithDecoder.h
@@ -32,7 +32,7 @@
   unsigned int I() const { return m_I; }
 
  private:
-  bool m_MPS = 0;
+  bool m_MPS = false;
   unsigned int m_I = 0;
 };
 
diff --git a/core/fxcodec/jbig2/JBig2_Context.cpp b/core/fxcodec/jbig2/JBig2_Context.cpp
index f19c98d..6bdcf9f 100644
--- a/core/fxcodec/jbig2/JBig2_Context.cpp
+++ b/core/fxcodec/jbig2/JBig2_Context.cpp
@@ -346,7 +346,7 @@
         return JBig2_Result::kFailure;
       }
 
-      m_pPage->Fill((pPageInfo->m_cFlags & 4) ? 1 : 0);
+      m_pPage->Fill((pPageInfo->m_cFlags & 4) ? true : false);
       m_PageInfoList.push_back(std::move(pPageInfo));
       m_bInPage = true;
     } break;
@@ -803,7 +803,8 @@
       const auto& pPageInfo = m_PageInfoList.back();
       if ((pPageInfo->m_bIsStriped == 1) &&
           (ri.y + ri.height > m_pPage->height())) {
-        m_pPage->Expand(ri.y + ri.height, (pPageInfo->m_cFlags & 4) ? 1 : 0);
+        m_pPage->Expand(ri.y + ri.height,
+                        (pPageInfo->m_cFlags & 4) ? true : false);
       }
     }
     m_pPage->ComposeFrom(ri.x, ri.y, pSegment->m_Image.get(),
@@ -919,7 +920,8 @@
       const auto& pPageInfo = m_PageInfoList.back();
       if (pPageInfo->m_bIsStriped == 1 &&
           ri.y + ri.height > m_pPage->height()) {
-        m_pPage->Expand(ri.y + ri.height, (pPageInfo->m_cFlags & 4) ? 1 : 0);
+        m_pPage->Expand(ri.y + ri.height,
+                        (pPageInfo->m_cFlags & 4) ? true : false);
       }
     }
     m_pPage->ComposeFrom(ri.x, ri.y, pSegment->m_Image.get(),
@@ -958,7 +960,7 @@
         }
       }
     }
-    pGRD->USESKIP = 0;
+    pGRD->USESKIP = false;
     m_pGRD = std::move(pGRD);
   }
   pSegment->m_nResultType = JBIG2_IMAGE_POINTER;
@@ -986,7 +988,7 @@
             if ((pPageInfo->m_bIsStriped == 1) &&
                 (m_ri.y + m_ri.height > m_pPage->height())) {
               m_pPage->Expand(m_ri.y + m_ri.height,
-                              (pPageInfo->m_cFlags & 4) ? 1 : 0);
+                              (pPageInfo->m_cFlags & 4) ? true : false);
             }
           }
           const FX_RECT& rect = m_pGRD->GetReplaceRect();
@@ -1020,7 +1022,7 @@
       if ((pPageInfo->m_bIsStriped == 1) &&
           (m_ri.y + m_ri.height > m_pPage->height())) {
         m_pPage->Expand(m_ri.y + m_ri.height,
-                        (pPageInfo->m_cFlags & 4) ? 1 : 0);
+                        (pPageInfo->m_cFlags & 4) ? true : false);
       }
     }
     const FX_RECT& rect = m_pGRD->GetReplaceRect();
@@ -1093,7 +1095,8 @@
       JBig2PageInfo* pPageInfo = m_PageInfoList.back().get();
       if ((pPageInfo->m_bIsStriped == 1) &&
           (ri.y + ri.height > m_pPage->height())) {
-        m_pPage->Expand(ri.y + ri.height, (pPageInfo->m_cFlags & 4) ? 1 : 0);
+        m_pPage->Expand(ri.y + ri.height,
+                        (pPageInfo->m_cFlags & 4) ? true : false);
       }
     }
     m_pPage->ComposeFrom(ri.x, ri.y, pSegment->m_Image.get(),
diff --git a/core/fxcodec/jbig2/JBig2_GrdProc.cpp b/core/fxcodec/jbig2/JBig2_GrdProc.cpp
index fbb1664..0aef859 100644
--- a/core/fxcodec/jbig2/JBig2_GrdProc.cpp
+++ b/core/fxcodec/jbig2/JBig2_GrdProc.cpp
@@ -198,7 +198,7 @@
   if (!GBREG->data())
     return nullptr;
 
-  GBREG->Fill(0);
+  GBREG->Fill(false);
   int LTP = 0;
   uint8_t MOD2 = UNOPT % 2;
   uint8_t DIV2 = UNOPT / 2;
@@ -344,7 +344,7 @@
   if (!GBREG->data())
     return nullptr;
 
-  GBREG->Fill(0);
+  GBREG->Fill(false);
   int LTP = 0;
   for (uint32_t h = 0; h < GBH; h++) {
     if (TPGDON) {
@@ -398,7 +398,7 @@
     m_ProgressiveStatus = FXCODEC_STATUS::kError;
     return FXCODEC_STATUS::kError;
   }
-  pImage->get()->Fill(0);
+  pImage->get()->Fill(false);
   m_DecodeType = 1;
   m_LTP = 0;
   m_pLine = nullptr;
diff --git a/core/fxcodec/jbig2/JBig2_GrrdProc.cpp b/core/fxcodec/jbig2/JBig2_GrrdProc.cpp
index d1172ae..7adabb8 100644
--- a/core/fxcodec/jbig2/JBig2_GrrdProc.cpp
+++ b/core/fxcodec/jbig2/JBig2_GrrdProc.cpp
@@ -44,7 +44,7 @@
   if (!GRREG->data())
     return nullptr;
 
-  GRREG->Fill(0);
+  GRREG->Fill(false);
   int LTP = 0;
   for (uint32_t h = 0; h < GRH; h++) {
     if (TPGRON) {
@@ -285,7 +285,7 @@
   if (!GRREG->data())
     return nullptr;
 
-  GRREG->Fill(0);
+  GRREG->Fill(false);
   int LTP = 0;
   for (uint32_t h = 0; h < GRH; h++) {
     if (TPGRON) {
diff --git a/core/fxcodec/jbig2/JBig2_HtrdProc.cpp b/core/fxcodec/jbig2/JBig2_HtrdProc.cpp
index dadb925..7423044 100644
--- a/core/fxcodec/jbig2/JBig2_HtrdProc.cpp
+++ b/core/fxcodec/jbig2/JBig2_HtrdProc.cpp
@@ -42,7 +42,7 @@
   GRD.GBW = HGW;
   GRD.GBH = HGH;
   GRD.GBTEMPLATE = HTEMPLATE;
-  GRD.TPGDON = 0;
+  GRD.TPGDON = false;
   GRD.USESKIP = HENABLESKIP;
   GRD.SKIP = HSKIP.get();
   if (HTEMPLATE <= 1)
diff --git a/core/fxcodec/jbig2/JBig2_HuffmanDecoder.cpp b/core/fxcodec/jbig2/JBig2_HuffmanDecoder.cpp
index 8f56dc5..01cbb5a 100644
--- a/core/fxcodec/jbig2/JBig2_HuffmanDecoder.cpp
+++ b/core/fxcodec/jbig2/JBig2_HuffmanDecoder.cpp
@@ -18,7 +18,7 @@
                                         int* nResult) {
   FX_SAFE_INT32 nSafeVal = 0;
   int nBits = 0;
-  while (1) {
+  while (true) {
     uint32_t nTmp;
     if (m_pStream->read1Bit(&nTmp) == -1)
       break;
diff --git a/core/fxcodec/jbig2/JBig2_Image.cpp b/core/fxcodec/jbig2/JBig2_Image.cpp
index b06694e..52ed9fa 100644
--- a/core/fxcodec/jbig2/JBig2_Image.cpp
+++ b/core/fxcodec/jbig2/JBig2_Image.cpp
@@ -671,5 +671,5 @@
       }
     }
   }
-  return 1;
+  return true;
 }
diff --git a/core/fxcodec/jbig2/JBig2_PddProc.cpp b/core/fxcodec/jbig2/JBig2_PddProc.cpp
index c6551a7..b682693 100644
--- a/core/fxcodec/jbig2/JBig2_PddProc.cpp
+++ b/core/fxcodec/jbig2/JBig2_PddProc.cpp
@@ -21,8 +21,8 @@
     return nullptr;
 
   pGRD->GBTEMPLATE = HDTEMPLATE;
-  pGRD->TPGDON = 0;
-  pGRD->USESKIP = 0;
+  pGRD->TPGDON = false;
+  pGRD->USESKIP = false;
   pGRD->GBAT[0] = -1 * static_cast<int32_t>(HDPW);
   pGRD->GBAT[1] = 0;
   if (pGRD->GBTEMPLATE == 0) {
diff --git a/core/fxcodec/jbig2/JBig2_SddProc.cpp b/core/fxcodec/jbig2/JBig2_SddProc.cpp
index 63ea40d..5569141 100644
--- a/core/fxcodec/jbig2/JBig2_SddProc.cpp
+++ b/core/fxcodec/jbig2/JBig2_SddProc.cpp
@@ -100,12 +100,12 @@
       TOTWIDTH = TOTWIDTH + SYMWIDTH;
       if (SDREFAGG == 0) {
         auto pGRD = std::make_unique<CJBig2_GRDProc>();
-        pGRD->MMR = 0;
+        pGRD->MMR = false;
         pGRD->GBW = SYMWIDTH;
         pGRD->GBH = HCHEIGHT;
         pGRD->GBTEMPLATE = SDTEMPLATE;
-        pGRD->TPGDON = 0;
-        pGRD->USESKIP = 0;
+        pGRD->TPGDON = false;
+        pGRD->USESKIP = false;
         pGRD->GBAT[0] = SDAT[0];
         pGRD->GBAT[1] = SDAT[1];
         pGRD->GBAT[2] = SDAT[2];
@@ -131,7 +131,7 @@
           auto SBHUFFRSIZE = std::make_unique<CJBig2_HuffmanTable>(1);
           auto pDecoder = std::make_unique<CJBig2_TRDProc>();
           pDecoder->SBHUFF = SDHUFF;
-          pDecoder->SBREFINE = 1;
+          pDecoder->SBREFINE = true;
           pDecoder->SBW = SYMWIDTH;
           pDecoder->SBH = HCHEIGHT;
           pDecoder->SBNUMINSTANCES = REFAGGNINST;
@@ -149,9 +149,9 @@
           for (size_t i = 0; i < NSYMSDECODED; ++i)
             SBSYMS[i + SDNUMINSYMS] = SDNEWSYMS[i].get();
           pDecoder->SBSYMS = SBSYMS.data();
-          pDecoder->SBDEFPIXEL = 0;
+          pDecoder->SBDEFPIXEL = false;
           pDecoder->SBCOMBOP = JBIG2_COMPOSE_OR;
-          pDecoder->TRANSPOSED = 0;
+          pDecoder->TRANSPOSED = false;
           pDecoder->REFCORNER = JBIG2_CORNER_TOPLEFT;
           pDecoder->SBDSOFFSET = 0;
           pDecoder->SBHUFFFS = SBHUFFFS.get();
@@ -204,7 +204,7 @@
           pGRRD->GRREFERENCE = SBSYMS[IDI];
           pGRRD->GRREFERENCEDX = RDXI;
           pGRRD->GRREFERENCEDY = RDYI;
-          pGRRD->TPGRON = 0;
+          pGRRD->TPGRON = false;
           pGRRD->GRAT[0] = SDRAT[0];
           pGRRD->GRAT[1] = SDRAT[1];
           pGRRD->GRAT[2] = SDRAT[2];
@@ -219,7 +219,7 @@
     }
   }
   EXINDEX = 0;
-  CUREXFLAG = 0;
+  CUREXFLAG = false;
   EXFLAGS.resize(SDNUMINSYMS + SDNUMNEWSYMS);
   num_ex_syms = 0;
   while (EXINDEX < SDNUMINSYMS + SDNUMNEWSYMS) {
@@ -339,7 +339,7 @@
           auto SBHUFFRSIZE = std::make_unique<CJBig2_HuffmanTable>(1);
           auto pDecoder = std::make_unique<CJBig2_TRDProc>();
           pDecoder->SBHUFF = SDHUFF;
-          pDecoder->SBREFINE = 1;
+          pDecoder->SBREFINE = true;
           pDecoder->SBW = SYMWIDTH;
           pDecoder->SBH = HCHEIGHT;
           pDecoder->SBNUMINSTANCES = REFAGGNINST;
@@ -360,9 +360,9 @@
           for (size_t i = 0; i < NSYMSDECODED; ++i)
             SBSYMS[i + SDNUMINSYMS] = SDNEWSYMS[i].get();
           pDecoder->SBSYMS = SBSYMS.data();
-          pDecoder->SBDEFPIXEL = 0;
+          pDecoder->SBDEFPIXEL = false;
           pDecoder->SBCOMBOP = JBIG2_COMPOSE_OR;
-          pDecoder->TRANSPOSED = 0;
+          pDecoder->TRANSPOSED = false;
           pDecoder->REFCORNER = JBIG2_CORNER_TOPLEFT;
           pDecoder->SBDSOFFSET = 0;
           pDecoder->SBHUFFFS = SBHUFFFS.get();
@@ -422,7 +422,7 @@
           pGRRD->GRREFERENCE = SBSYMS[IDI];
           pGRRD->GRREFERENCEDX = RDXI;
           pGRRD->GRREFERENCEDY = RDYI;
-          pGRRD->TPGRON = 0;
+          pGRRD->TPGRON = false;
           pGRRD->GRAT[0] = SDRAT[0];
           pGRRD->GRAT[1] = SDRAT[1];
           pGRRD->GRAT[2] = SDRAT[2];
@@ -470,7 +470,7 @@
         }
       } else {
         auto pGRD = std::make_unique<CJBig2_GRDProc>();
-        pGRD->MMR = 1;
+        pGRD->MMR = true;
         pGRD->GBW = TOTWIDTH;
         pGRD->GBH = HCHEIGHT;
         pGRD->StartDecodeMMR(&BHC, pStream);
@@ -487,7 +487,7 @@
     }
   }
   EXINDEX = 0;
-  CUREXFLAG = 0;
+  CUREXFLAG = false;
   pTable = std::make_unique<CJBig2_HuffmanTable>(1);
   EXFLAGS.resize(SDNUMINSYMS + SDNUMNEWSYMS);
   num_ex_syms = 0;
diff --git a/core/fxcodec/jbig2/JBig2_TrdProc.cpp b/core/fxcodec/jbig2/JBig2_TrdProc.cpp
index f3822f2..38a4a2e 100644
--- a/core/fxcodec/jbig2/JBig2_TrdProc.cpp
+++ b/core/fxcodec/jbig2/JBig2_TrdProc.cpp
@@ -133,7 +133,7 @@
         if (IDI < SBNUMSYMS)
           break;
       }
-      bool RI = 0;
+      bool RI = false;
       if (SBREFINE != 0 && pStream->read1Bit(&RI) != 0)
         return nullptr;
 
@@ -179,7 +179,7 @@
         pGRRD->GRREFERENCE = IBOI;
         pGRRD->GRREFERENCEDX = GRREFERENCEDX.value();
         pGRRD->GRREFERENCEDY = GRREFERENCEDY.value();
-        pGRRD->TPGRON = 0;
+        pGRRD->TPGRON = false;
         pGRRD->GRAT[0] = SBRAT[0];
         pGRRD->GRAT[1] = SBRAT[1];
         pGRRD->GRAT[2] = SBRAT[2];
@@ -359,7 +359,7 @@
         pGRRD->GRREFERENCE = IBOI;
         pGRRD->GRREFERENCEDX = GRREFERENCEDX.value();
         pGRRD->GRREFERENCEDY = GRREFERENCEDY.value();
-        pGRRD->TPGRON = 0;
+        pGRRD->TPGRON = false;
         pGRRD->GRAT[0] = SBRAT[0];
         pGRRD->GRAT[1] = SBRAT[1];
         pGRRD->GRAT[2] = SBRAT[2];
diff --git a/core/fxcrt/bytestring.cpp b/core/fxcrt/bytestring.cpp
index dce2a0b..d5a0fc0 100644
--- a/core/fxcrt/bytestring.cpp
+++ b/core/fxcrt/bytestring.cpp
@@ -45,7 +45,7 @@
   const char* end_ptr = haystack + haystack_len - needle_len;
   while (haystack <= end_ptr) {
     size_t i = 0;
-    while (1) {
+    while (true) {
       if (haystack[i] != needle[i])
         break;
 
@@ -643,7 +643,7 @@
   size_t nCount = 0;
   const char* pStart = m_pData->m_String;
   char* pEnd = m_pData->m_String + m_pData->m_nDataLength;
-  while (1) {
+  while (true) {
     const char* pTarget = FX_strstr(pStart, static_cast<int>(pEnd - pStart),
                                     pOld.unterminated_c_str(), nSourceLen);
     if (!pTarget)
diff --git a/core/fxcrt/css/cfx_cssstyleselector.cpp b/core/fxcrt/css/cfx_cssstyleselector.cpp
index a60d131..3237b51 100644
--- a/core/fxcrt/css/cfx_cssstyleselector.cpp
+++ b/core/fxcrt/css/cfx_cssstyleselector.cpp
@@ -147,7 +147,7 @@
   int32_t iLen2 = 0;
   const CFX_CSSData::Property* property = nullptr;
   WideString wsName;
-  while (1) {
+  while (true) {
     CFX_CSSSyntaxParser::Status eStatus = pSyntax->DoSyntaxParse();
     if (eStatus == CFX_CSSSyntaxParser::Status::kPropertyName) {
       WideStringView strValue = pSyntax->GetCurrentString();
diff --git a/core/fxcrt/css/cfx_cssstylesheet.cpp b/core/fxcrt/css/cfx_cssstylesheet.cpp
index cd907b4..834eb4c 100644
--- a/core/fxcrt/css/cfx_cssstylesheet.cpp
+++ b/core/fxcrt/css/cfx_cssstylesheet.cpp
@@ -28,7 +28,7 @@
 bool CFX_CSSStyleSheet::LoadBuffer(WideStringView buffer) {
   m_RuleArray.clear();
   auto pSyntax = std::make_unique<CFX_CSSSyntaxParser>(buffer);
-  while (1) {
+  while (true) {
     CFX_CSSSyntaxParser::Status eStatus = pSyntax->DoSyntaxParse();
     if (eStatus == CFX_CSSSyntaxParser::Status::kStyleRule)
       eStatus = LoadStyleRule(pSyntax.get());
@@ -46,7 +46,7 @@
   int32_t iValueLen = 0;
   const CFX_CSSData::Property* property = nullptr;
   WideString wsName;
-  while (1) {
+  while (true) {
     switch (pSyntax->DoSyntaxParse()) {
       case CFX_CSSSyntaxParser::Status::kSelector: {
         WideStringView strValue = pSyntax->GetCurrentString();
@@ -105,7 +105,7 @@
 }
 
 void CFX_CSSStyleSheet::SkipRuleSet(CFX_CSSSyntaxParser* pSyntax) {
-  while (1) {
+  while (true) {
     switch (pSyntax->DoSyntaxParse()) {
       case CFX_CSSSyntaxParser::Status::kSelector:
       case CFX_CSSSyntaxParser::Status::kDeclOpen:
diff --git a/core/fxcrt/fx_string.h b/core/fxcrt/fx_string.h
index 3d036d6..9bdf465 100644
--- a/core/fxcrt/fx_string.h
+++ b/core/fxcrt/fx_string.h
@@ -35,7 +35,7 @@
 std::vector<StrType> Split(const StrType& that, typename StrType::CharType ch) {
   std::vector<StrType> result;
   StringViewTemplate<typename StrType::CharType> remaining(that.span());
-  while (1) {
+  while (true) {
     absl::optional<size_t> index = remaining.Find(ch);
     if (!index.has_value())
       break;
diff --git a/core/fxcrt/widestring.cpp b/core/fxcrt/widestring.cpp
index a17fa2d..8f58a2c 100644
--- a/core/fxcrt/widestring.cpp
+++ b/core/fxcrt/widestring.cpp
@@ -45,7 +45,7 @@
   const wchar_t* end_ptr = haystack + haystack_len - needle_len;
   while (haystack <= end_ptr) {
     size_t i = 0;
-    while (1) {
+    while (true) {
       if (haystack[i] != needle[i])
         break;
 
@@ -875,7 +875,7 @@
   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) {
+  while (true) {
     const wchar_t* pTarget =
         FX_wcsstr(pStart, static_cast<size_t>(pEnd - pStart),
                   pOld.unterminated_c_str(), nSourceLen);
diff --git a/core/fxge/agg/fx_agg_driver.cpp b/core/fxge/agg/fx_agg_driver.cpp
index 5dcd97b..10727c1 100644
--- a/core/fxge/agg/fx_agg_driver.cpp
+++ b/core/fxge/agg/fx_agg_driver.cpp
@@ -860,7 +860,7 @@
   bool bDestAlpha = m_pDevice->IsAlphaFormat() || m_pDevice->IsMaskFormat();
   unsigned num_spans = sl.num_spans();
   typename Scanline::const_iterator span = sl.begin();
-  while (1) {
+  while (true) {
     if (span->len <= 0)
       break;
 
@@ -941,7 +941,7 @@
     int y = sl.y();
     unsigned num_spans = sl.num_spans();
     typename Scanline::const_iterator span = sl.begin();
-    while (1) {
+    while (true) {
       int x = span->x;
       if (span->len > 0) {
         m_ren->blend_solid_hspan(x - m_left, y - m_top, (unsigned)span->len,
diff --git a/core/fxge/cfx_fontmapper.cpp b/core/fxge/cfx_fontmapper.cpp
index 61347df..7a5694d 100644
--- a/core/fxge/cfx_fontmapper.cpp
+++ b/core/fxge/cfx_fontmapper.cpp
@@ -326,7 +326,7 @@
   if (bLocalized) {
     void* hFont = m_pFontInfo->GetFont(name);
     if (!hFont) {
-      hFont = m_pFontInfo->MapFont(0, 0, FX_Charset::kDefault, 0, name);
+      hFont = m_pFontInfo->MapFont(0, false, FX_Charset::kDefault, 0, name);
       if (!hFont)
         return;
     }
@@ -721,8 +721,8 @@
   if (!m_pFontInfo)
     return nullptr;
 
-  void* hFont =
-      m_pFontInfo->MapFont(0, 0, FX_Charset::kDefault, 0, GetFaceName(index));
+  void* hFont = m_pFontInfo->MapFont(0, false, FX_Charset::kDefault, 0,
+                                     GetFaceName(index));
   if (!hFont)
     return nullptr;
 
diff --git a/core/fxge/freetype/fx_freetype.cpp b/core/fxge/freetype/fx_freetype.cpp
index 3a3a6c8..8ea74a3 100644
--- a/core/fxge/freetype/fx_freetype.cpp
+++ b/core/fxge/freetype/fx_freetype.cpp
@@ -18,7 +18,7 @@
                     int table_offset,
                     wchar_t unicode) {
   // copy letters
-  while (1) {
+  while (true) {
     glyph_name[name_offset] = ft_adobe_glyph_list[table_offset] & 0x7f;
     name_offset++;
     table_offset++;
diff --git a/fpdfsdk/fpdf_edit_embeddertest.cpp b/fpdfsdk/fpdf_edit_embeddertest.cpp
index de213c7..dbca269 100644
--- a/fpdfsdk/fpdf_edit_embeddertest.cpp
+++ b/fpdfsdk/fpdf_edit_embeddertest.cpp
@@ -3050,8 +3050,8 @@
   CFX_Font CIDfont;
   {
     // First, get the data from the font
-    CIDfont.LoadSubst("Noto Sans CJK JP", 1, 0, 400, 0, FX_CodePage::kShiftJIS,
-                      0);
+    CIDfont.LoadSubst("Noto Sans CJK JP", true, 0, 400, 0,
+                      FX_CodePage::kShiftJIS, false);
     EXPECT_EQ("Noto Sans CJK JP", CIDfont.GetFaceName());
     pdfium::span<const uint8_t> span = CIDfont.GetFontSpan();
 
diff --git a/fpdfsdk/fpdf_save.cpp b/fpdfsdk/fpdf_save.cpp
index ba7c27f..f7ffabd 100644
--- a/fpdfsdk/fpdf_save.cpp
+++ b/fpdfsdk/fpdf_save.cpp
@@ -154,7 +154,7 @@
                absl::optional<int> version) {
   CPDF_Document* pPDFDoc = CPDFDocumentFromFPDFDocument(document);
   if (!pPDFDoc)
-    return 0;
+    return false;
 
 #ifdef PDF_ENABLE_XFA
   auto* pContext = static_cast<CPDFXFA_Context*>(pPDFDoc->GetExtension());
diff --git a/fpdfsdk/fpdf_view.cpp b/fpdfsdk/fpdf_view.cpp
index 78d5302..b18373a 100644
--- a/fpdfsdk/fpdf_view.cpp
+++ b/fpdfsdk/fpdf_view.cpp
@@ -1259,7 +1259,7 @@
 
   // Traverse the document.
   syntax->SetPos(0);
-  while (1) {
+  while (true) {
     CPDF_SyntaxParser::WordResult word_result = syntax->GetNextWord();
     if (word_result.is_number) {
       // The object number was read. Read the generation number.
@@ -1281,7 +1281,7 @@
     } else if (word_result.word == "startxref") {
       syntax->GetNextWord();
     } else if (word_result.word == "xref") {
-      while (1) {
+      while (true) {
         word_result = syntax->GetNextWord();
         if (word_result.word.IsEmpty() || word_result.word == "startxref")
           break;
diff --git a/fpdfsdk/fpdfxfa/cpdfxfa_page.cpp b/fpdfsdk/fpdfxfa/cpdfxfa_page.cpp
index e1320b9..d5881d9 100644
--- a/fpdfsdk/fpdfxfa/cpdfxfa_page.cpp
+++ b/fpdfsdk/fpdfxfa/cpdfxfa_page.cpp
@@ -304,7 +304,7 @@
       xfaView->CreateGCedFormWidgetIterator(Mask<XFA_WidgetStatus>{
           XFA_WidgetStatus::kVisible, XFA_WidgetStatus::kViewable});
 
-  while (1) {
+  while (true) {
     CXFA_FFWidget* pWidget = pWidgetIterator->MoveToNext();
     if (!pWidget)
       break;
diff --git a/fxjs/cjs_field.cpp b/fxjs/cjs_field.cpp
index aef9db0..976ee6c 100644
--- a/fxjs/cjs_field.cpp
+++ b/fxjs/cjs_field.cpp
@@ -888,7 +888,7 @@
     return CJS_Result::Failure(JSMessage::kBadObjectError);
 
   return CJS_Result::Success(pRuntime->NewBoolean(
-      pFormControl->GetIconFit().IsProportionalScale() ? 0 : 1));
+      pFormControl->GetIconFit().IsProportionalScale() ? false : true));
 }
 
 CJS_Result CJS_Field::set_button_scale_how(CJS_Runtime* pRuntime,
diff --git a/fxjs/cjs_global.cpp b/fxjs/cjs_global.cpp
index b6e18ea..8b86e32 100644
--- a/fxjs/cjs_global.cpp
+++ b/fxjs/cjs_global.cpp
@@ -485,7 +485,7 @@
     JSGlobalData* pTemp = it->second.get();
     if (pTemp->bDeleted || pTemp->nType != nType) {
       pTemp->dData = 0;
-      pTemp->bData = 0;
+      pTemp->bData = false;
       pTemp->sData.clear();
       pTemp->nType = nType;
     }
diff --git a/fxjs/cjs_util.cpp b/fxjs/cjs_util.cpp
index 5823ee1..756ffb3 100644
--- a/fxjs/cjs_util.cpp
+++ b/fxjs/cjs_util.cpp
@@ -219,7 +219,7 @@
 
   for (size_t i = 0; i < pdfium::size(TbConvertTable); ++i) {
     size_t nFound = 0;
-    while (1) {
+    while (true) {
       nFound = cFormat.find(TbConvertTable[i].lpszJSMark, nFound);
       if (nFound == std::wstring::npos)
         break;
@@ -240,7 +240,7 @@
 
   for (size_t i = 0; i < pdfium::size(cTableAd); ++i) {
     size_t nFound = 0;
-    while (1) {
+    while (true) {
       nFound = cFormat.find(cTableAd[i].js_mark, nFound);
       if (nFound == std::wstring::npos)
         break;
diff --git a/fxjs/xfa/cfxjse_resolveprocessor.cpp b/fxjs/xfa/cfxjse_resolveprocessor.cpp
index 566f955..eb4c6a7 100644
--- a/fxjs/xfa/cfxjse_resolveprocessor.cpp
+++ b/fxjs/xfa/cfxjse_resolveprocessor.cpp
@@ -362,7 +362,7 @@
   }
   if (dwStyles & XFA_ResolveFlag::kAttributes) {
     if (ResolveForAttributeRs(curNode, &rnd.m_Result, wsName.AsStringView()))
-      return 1;
+      return true;
   }
   if (dwStyles & XFA_ResolveFlag::kProperties) {
     for (CXFA_Node* pChildProperty : properties) {
diff --git a/fxjs/xfa/cjx_node.cpp b/fxjs/xfa/cjx_node.cpp
index 447f5da..7fcbba0 100644
--- a/fxjs/xfa/cjx_node.cpp
+++ b/fxjs/xfa/cjx_node.cpp
@@ -215,7 +215,7 @@
   if (params.size() >= 2)
     bIgnoreRoot = runtime->ToBoolean(params[1]);
 
-  bool bOverwrite = 0;
+  bool bOverwrite = false;
   if (params.size() >= 3)
     bOverwrite = runtime->ToBoolean(params[2]);
 
diff --git a/testing/embedder_test_timer_handling_delegate.h b/testing/embedder_test_timer_handling_delegate.h
index a32ad202..8b9000a 100644
--- a/testing/embedder_test_timer_handling_delegate.h
+++ b/testing/embedder_test_timer_handling_delegate.h
@@ -57,7 +57,7 @@
 
   void AdvanceTime(int increment_msecs) {
     fake_elapsed_msecs_ += increment_msecs;
-    while (1) {
+    while (true) {
       auto iter = expiry_to_timer_map_.begin();
       if (iter == expiry_to_timer_map_.end()) {
         break;
diff --git a/testing/fx_string_testhelpers.cpp b/testing/fx_string_testhelpers.cpp
index 51983de..32ad120 100644
--- a/testing/fx_string_testhelpers.cpp
+++ b/testing/fx_string_testhelpers.cpp
@@ -25,7 +25,7 @@
 std::vector<std::string> StringSplit(const std::string& str, char delimiter) {
   std::vector<std::string> result;
   size_t pos = 0;
-  while (1) {
+  while (true) {
     size_t found = str.find(delimiter, pos);
     if (found == std::string::npos)
       break;
diff --git a/xfa/fgas/crt/cfgas_decimal.cpp b/xfa/fgas/crt/cfgas_decimal.cpp
index 18d931b..72363e7 100644
--- a/xfa/fgas/crt/cfgas_decimal.cpp
+++ b/xfa/fgas/crt/cfgas_decimal.cpp
@@ -304,7 +304,7 @@
   while (str != strBound && *str == ' ')
     str++;
   if (str != strBound && *str == '-') {
-    negmet = 1;
+    negmet = true;
     str++;
   } else if (str != strBound && *str == '+') {
     str++;
@@ -314,7 +314,7 @@
          scale < FXMATH_DECIMAL_SCALELIMIT) {
     if (*str == '.') {
       if (!pointmet)
-        pointmet = 1;
+        pointmet = true;
     } else {
       m_uHi = m_uHi * 0xA + FXMATH_DECIMAL_RSHIFT32BIT((uint64_t)m_uMid * 0xA);
       m_uMid = m_uMid * 0xA + FXMATH_DECIMAL_RSHIFT32BIT((uint64_t)m_uLo * 0xA);
@@ -437,7 +437,7 @@
 
   uint8_t minscale = scale;
   if (!IsNotZero())
-    return CFGAS_Decimal(0, 0, 0, 0, minscale);
+    return CFGAS_Decimal(0, 0, 0, false, minscale);
 
   while (!a[6]) {
     decimal_helper_mul10_any(a, 7);
diff --git a/xfa/fxfa/fm2js/cxfa_fmparser.cpp b/xfa/fxfa/fm2js/cxfa_fmparser.cpp
index 89a2faa..0bad5cf 100644
--- a/xfa/fxfa/fm2js/cxfa_fmparser.cpp
+++ b/xfa/fxfa/fm2js/cxfa_fmparser.cpp
@@ -118,7 +118,7 @@
 
   std::vector<WideString> arguments;
   bool last_was_comma = false;
-  while (1) {
+  while (true) {
     if (m_token.m_type == TOKrparen)
       break;
     if (m_token.m_type != TOKidentifier)
@@ -282,7 +282,7 @@
   if (!e1)
     return nullptr;
 
-  while (1) {
+  while (true) {
     if (!IncrementParseDepthAndCheck())
       return nullptr;
 
@@ -315,7 +315,7 @@
   if (!e1)
     return nullptr;
 
-  while (1) {
+  while (true) {
     if (!IncrementParseDepthAndCheck())
       return nullptr;
 
@@ -348,7 +348,7 @@
   if (!e1)
     return nullptr;
 
-  while (1) {
+  while (true) {
     if (!IncrementParseDepthAndCheck())
       return nullptr;
 
@@ -392,7 +392,7 @@
   if (!e1)
     return nullptr;
 
-  while (1) {
+  while (true) {
     if (!IncrementParseDepthAndCheck())
       return nullptr;
 
@@ -458,7 +458,7 @@
   if (!e1)
     return nullptr;
 
-  while (1) {
+  while (true) {
     if (!IncrementParseDepthAndCheck())
       return nullptr;
 
@@ -500,7 +500,7 @@
   if (!e1)
     return nullptr;
 
-  while (1) {
+  while (true) {
     if (!IncrementParseDepthAndCheck())
       return nullptr;
 
@@ -641,7 +641,7 @@
     return nullptr;
 
   size_t expr_count = 0;
-  while (1) {
+  while (true) {
     ++expr_count;
     // Limit the number of expressions allowed in the post expression statement.
     // If we don't do this then its possible to generate a stack overflow
diff --git a/xfa/fxfa/layout/cxfa_contentlayoutprocessor.cpp b/xfa/fxfa/layout/cxfa_contentlayoutprocessor.cpp
index a9778c1..b149ef6a 100644
--- a/xfa/fxfa/layout/cxfa_contentlayoutprocessor.cpp
+++ b/xfa/fxfa/layout/cxfa_contentlayoutprocessor.cpp
@@ -992,7 +992,7 @@
   CXFA_Node* pCurChildNode = nullptr;
   CXFA_LayoutItem* pBeforeItem = nullptr;
   Stage nCurChildNodeStage = Stage::kNone;
-  while (1) {
+  while (true) {
     std::tie(nCurChildNodeStage, pCurChildNode) = GotoNextContainerNode(
         nCurChildNodeStage, false, pFormNode, pCurChildNode);
     if (!pCurChildNode)