Clang-format core/fpdfapi

Change-Id: I23bbecdf719b347be09b426289e535cab46bdf51
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/130731
Commit-Queue: Lei Zhang <thestig@chromium.org>
Reviewed-by: Tom Sepez <tsepez@chromium.org>
diff --git a/core/fpdfapi/cmaps/fpdf_cmaps.cpp b/core/fpdfapi/cmaps/fpdf_cmaps.cpp
index 1af397e..28a195f 100644
--- a/core/fpdfapi/cmaps/fpdf_cmaps.cpp
+++ b/core/fpdfapi/cmaps/fpdf_cmaps.cpp
@@ -44,8 +44,9 @@
             begin, end, charcode,
             [](const DWordCIDMap& element, uint32_t charcode) {
               uint16_t hiword = static_cast<uint16_t>(charcode >> 16);
-              if (element.m_HiWord != hiword)
+              if (element.m_HiWord != hiword) {
                 return element.m_HiWord < hiword;
+              }
               return element.m_LoWordHigh < static_cast<uint16_t>(charcode);
             });
         if (found != end && loword >= found->m_LoWordLow &&
@@ -68,8 +69,9 @@
             begin, end, loword, [](const SingleCmap& element, uint16_t code) {
               return element.code < code;
             });
-        if (found != end && found->code == loword)
+        if (found != end && found->code == loword) {
           return found->cid;
+        }
         break;
       }
       case CMap::Type::kRange: {
@@ -80,8 +82,9 @@
             begin, end, loword, [](const RangeCmap& element, uint16_t code) {
               return element.high < code;
             });
-        if (found != end && loword >= found->low && loword <= found->high)
+        if (found != end && loword >= found->low && loword <= found->high) {
           return found->cid + loword - found->low;
+        }
         break;
       }
     }
diff --git a/core/fpdfapi/edit/cpdf_creator.cpp b/core/fpdfapi/edit/cpdf_creator.cpp
index 1b7f95a..97b2d44 100644
--- a/core/fpdfapi/edit/cpdf_creator.cpp
+++ b/core/fpdfapi/edit/cpdf_creator.cpp
@@ -75,22 +75,25 @@
 }
 
 bool CFX_FileBufferArchive::WriteBlock(pdfium::span<const uint8_t> buffer) {
-  if (buffer.empty())
+  if (buffer.empty()) {
     return true;
+  }
 
   pdfium::span<const uint8_t> src_span = buffer;
   while (!src_span.empty()) {
     size_t copy_size = std::min(available_.size(), src_span.size());
     available_ = fxcrt::spancpy(available_, src_span.first(copy_size));
     src_span = src_span.subspan(copy_size);
-    if (available_.empty() && !Flush())
+    if (available_.empty() && !Flush()) {
       return false;
+    }
   }
 
   FX_SAFE_FILESIZE safe_offset = offset_;
   safe_offset += buffer.size();
-  if (!safe_offset.IsValid())
+  if (!safe_offset.IsValid()) {
     return false;
+  }
 
   offset_ = safe_offset.ValueOrDie();
   return true;
@@ -129,15 +132,18 @@
 CPDF_Creator::~CPDF_Creator() = default;
 
 bool CPDF_Creator::WriteIndirectObj(uint32_t objnum, const CPDF_Object* pObj) {
-  if (!m_Archive->WriteDWord(objnum) || !m_Archive->WriteString(" 0 obj\r\n"))
+  if (!m_Archive->WriteDWord(objnum) || !m_Archive->WriteString(" 0 obj\r\n")) {
     return false;
+  }
 
   std::unique_ptr<CPDF_Encryptor> encryptor;
-  if (GetCryptoHandler() && pObj != m_pEncryptDict)
+  if (GetCryptoHandler() && pObj != m_pEncryptDict) {
     encryptor = std::make_unique<CPDF_Encryptor>(GetCryptoHandler(), objnum);
+  }
 
-  if (!pObj->WriteTo(m_Archive.get(), encryptor.get()))
+  if (!pObj->WriteTo(m_Archive.get(), encryptor.get())) {
     return false;
+  }
 
   return m_Archive->WriteString("\r\nendobj\r\n");
 }
@@ -155,10 +161,12 @@
     m_ObjectOffsets.erase(objnum);
     return true;
   }
-  if (!WriteIndirectObj(pObj->GetObjNum(), pObj.Get()))
+  if (!WriteIndirectObj(pObj->GetObjNum(), pObj.Get())) {
     return false;
-  if (!bExistInMap)
+  }
+  if (!bExistInMap) {
     m_pDocument->DeleteIndirectObject(objnum);
+  }
   return true;
 }
 
@@ -195,12 +203,14 @@
   for (size_t i = m_CurObjNum; i < m_NewObjNumArray.size(); ++i) {
     uint32_t objnum = m_NewObjNumArray[i];
     RetainPtr<const CPDF_Object> pObj = m_pDocument->GetIndirectObject(objnum);
-    if (!pObj)
+    if (!pObj) {
       continue;
+    }
 
     m_ObjectOffsets[objnum] = m_Archive->CurrentOffset();
-    if (!WriteIndirectObj(pObj->GetObjNum(), pObj.Get()))
+    if (!WriteIndirectObj(pObj->GetObjNum(), pObj.Get())) {
       return false;
+    }
   }
   return true;
 }
@@ -225,21 +235,24 @@
 CPDF_Creator::Stage CPDF_Creator::WriteDoc_Stage1() {
   DCHECK(m_iStage > Stage::kInvalid || m_iStage < Stage::kInitWriteObjs20);
   if (m_iStage == Stage::kInit0) {
-    if (!m_pParser || (m_bSecurityChanged && m_IsOriginal))
+    if (!m_pParser || (m_bSecurityChanged && m_IsOriginal)) {
       m_IsIncremental = false;
+    }
 
     m_iStage = Stage::kWriteHeader10;
   }
   if (m_iStage == Stage::kWriteHeader10) {
     if (!m_IsIncremental) {
-      if (!m_Archive->WriteString("%PDF-1."))
+      if (!m_Archive->WriteString("%PDF-1.")) {
         return Stage::kInvalid;
+      }
 
       int32_t version = 7;
-      if (m_FileVersion)
+      if (m_FileVersion) {
         version = m_FileVersion;
-      else if (m_pParser)
+      } else if (m_pParser) {
         version = m_pParser->GetFileVersion();
+      }
 
       if (!m_Archive->WriteDWord(version % 10) ||
           !m_Archive->WriteString("\r\n%\xA1\xB3\xC5\xD7\r\n")) {
@@ -253,8 +266,9 @@
   }
   if (m_iStage == Stage::kWriteIncremental15) {
     if (m_IsOriginal && m_SavedOffset > 0) {
-      if (!m_pParser->WriteToArchive(m_Archive.get(), m_SavedOffset))
+      if (!m_pParser->WriteToArchive(m_Archive.get(), m_SavedOffset)) {
         return Stage::kInvalid;
+      }
     }
     if (m_IsOriginal && m_pParser->GetLastXRefOffset() == 0) {
       for (uint32_t num = 0; num <= m_pParser->GetLastObjNum(); ++num) {
@@ -283,8 +297,9 @@
     }
   }
   if (m_iStage == Stage::kWriteOldObjs21) {
-    if (!WriteOldObjs())
+    if (!WriteOldObjs()) {
       return Stage::kInvalid;
+    }
 
     m_iStage = Stage::kInitWriteNewObjs25;
   }
@@ -293,8 +308,9 @@
     m_iStage = Stage::kWriteNewObjs26;
   }
   if (m_iStage == Stage::kWriteNewObjs26) {
-    if (!WriteNewObjs())
+    if (!WriteNewObjs()) {
       return Stage::kInvalid;
+    }
 
     m_iStage = Stage::kWriteEncryptDict27;
   }
@@ -302,12 +318,14 @@
     if (m_pEncryptDict && m_pEncryptDict->IsInline()) {
       m_dwLastObjNum += 1;
       FX_FILESIZE saveOffset = m_Archive->CurrentOffset();
-      if (!WriteIndirectObj(m_dwLastObjNum, m_pEncryptDict.Get()))
+      if (!WriteIndirectObj(m_dwLastObjNum, m_pEncryptDict.Get())) {
         return Stage::kInvalid;
+      }
 
       m_ObjectOffsets[m_dwLastObjNum] = saveOffset;
-      if (m_IsIncremental)
+      if (m_IsIncremental) {
         m_NewObjNumArray.push_back(m_dwLastObjNum);
+      }
     }
     m_iStage = Stage::kInitWriteXRefs80;
   }
@@ -327,14 +345,16 @@
         str = pdfium::Contains(m_ObjectOffsets, 1)
                   ? "xref\r\n"
                   : "xref\r\n0 1\r\n0000000000 65535 f\r\n";
-        if (!m_Archive->WriteString(str.AsStringView()))
+        if (!m_Archive->WriteString(str.AsStringView())) {
           return Stage::kInvalid;
+        }
 
         m_CurObjNum = 1;
         m_iStage = Stage::kWriteXrefsNotIncremental81;
       } else {
-        if (!m_Archive->WriteString("xref\r\n"))
+        if (!m_Archive->WriteString("xref\r\n")) {
           return Stage::kInvalid;
+        }
 
         m_CurObjNum = 0;
         m_iStage = Stage::kWriteXrefsIncremental82;
@@ -348,31 +368,38 @@
     uint32_t i = m_CurObjNum;
     uint32_t j;
     while (i <= dwLastObjNum) {
-      while (i <= dwLastObjNum && !pdfium::Contains(m_ObjectOffsets, i))
+      while (i <= dwLastObjNum && !pdfium::Contains(m_ObjectOffsets, i)) {
         i++;
+      }
 
-      if (i > dwLastObjNum)
+      if (i > dwLastObjNum) {
         break;
+      }
 
       j = i;
-      while (j <= dwLastObjNum && pdfium::Contains(m_ObjectOffsets, j))
+      while (j <= dwLastObjNum && pdfium::Contains(m_ObjectOffsets, j)) {
         j++;
+      }
 
-      if (i == 1)
+      if (i == 1) {
         str = ByteString::Format("0 %d\r\n0000000000 65535 f\r\n", j);
-      else
+      } else {
         str = ByteString::Format("%d %d\r\n", i, j - i);
+      }
 
-      if (!m_Archive->WriteString(str.AsStringView()))
+      if (!m_Archive->WriteString(str.AsStringView())) {
         return Stage::kInvalid;
+      }
 
       while (i < j) {
         str = ByteString::Format("%010d 00000 n\r\n", m_ObjectOffsets[i++]);
-        if (!m_Archive->WriteString(str.AsStringView()))
+        if (!m_Archive->WriteString(str.AsStringView())) {
           return Stage::kInvalid;
+        }
       }
-      if (i > dwLastObjNum)
+      if (i > dwLastObjNum) {
         break;
+      }
     }
     m_iStage = Stage::kWriteTrailerAndFinish90;
   }
@@ -384,27 +411,32 @@
       size_t j = i;
       uint32_t objnum = m_NewObjNumArray[i];
       while (j < iCount) {
-        if (++j == iCount)
+        if (++j == iCount) {
           break;
+        }
         uint32_t dwCurrent = m_NewObjNumArray[j];
-        if (dwCurrent - objnum > 1)
+        if (dwCurrent - objnum > 1) {
           break;
+        }
         objnum = dwCurrent;
       }
       objnum = m_NewObjNumArray[i];
-      if (objnum == 1)
+      if (objnum == 1) {
         str = ByteString::Format("0 %d\r\n0000000000 65535 f\r\n", j - i + 1);
-      else
+      } else {
         str = ByteString::Format("%d %d\r\n", objnum, j - i);
+      }
 
-      if (!m_Archive->WriteString(str.AsStringView()))
+      if (!m_Archive->WriteString(str.AsStringView())) {
         return Stage::kInvalid;
+      }
 
       while (i < j) {
         objnum = m_NewObjNumArray[i++];
         str = ByteString::Format("%010d 00000 n\r\n", m_ObjectOffsets[objnum]);
-        if (!m_Archive->WriteString(str.AsStringView()))
+        if (!m_Archive->WriteString(str.AsStringView())) {
           return Stage::kInvalid;
+        }
       }
     }
     m_iStage = Stage::kWriteTrailerAndFinish90;
@@ -417,8 +449,9 @@
 
   bool bXRefStream = m_IsIncremental && m_pParser->IsXRefStream();
   if (!bXRefStream) {
-    if (!m_Archive->WriteString("trailer\r\n<<"))
+    if (!m_Archive->WriteString("trailer\r\n<<")) {
       return Stage::kInvalid;
+    }
   } else {
     if (!m_Archive->WriteDWord(m_pDocument->GetLastObjNum() + 1) ||
         !m_Archive->WriteString(" 0 obj <<")) {
@@ -441,8 +474,9 @@
           !m_Archive->WriteString(PDF_NameEncode(key).AsStringView())) {
         return Stage::kInvalid;
       }
-      if (!pValue->WriteTo(m_Archive.get(), nullptr))
+      if (!pValue->WriteTo(m_Archive.get(), nullptr)) {
         return Stage::kInvalid;
+      }
     }
   } else {
     if (!m_Archive->WriteString("\r\n/Root ") ||
@@ -459,12 +493,14 @@
     }
   }
   if (m_pEncryptDict) {
-    if (!m_Archive->WriteString("/Encrypt"))
+    if (!m_Archive->WriteString("/Encrypt")) {
       return Stage::kInvalid;
+    }
 
     uint32_t dwObjNum = m_pEncryptDict->GetObjNum();
-    if (dwObjNum == 0)
+    if (dwObjNum == 0) {
       dwObjNum = m_pDocument->GetLastObjNum() + 1;
+    }
     if (!m_Archive->WriteString(" ") || !m_Archive->WriteDWord(dwObjNum) ||
         !m_Archive->WriteString(" 0 R ")) {
       return Stage::kInvalid;
@@ -478,8 +514,10 @@
   if (m_IsIncremental) {
     FX_FILESIZE prev = m_pParser->GetLastXRefOffset();
     if (prev) {
-      if (!m_Archive->WriteString("/Prev ") || !m_Archive->WriteFilesize(prev))
+      if (!m_Archive->WriteString("/Prev ") ||
+          !m_Archive->WriteFilesize(prev)) {
         return Stage::kInvalid;
+      }
     }
   }
   if (m_pIDArray) {
@@ -489,18 +527,22 @@
     }
   }
   if (!bXRefStream) {
-    if (!m_Archive->WriteString(">>"))
+    if (!m_Archive->WriteString(">>")) {
       return Stage::kInvalid;
+    }
   } else {
-    if (!m_Archive->WriteString("/W[0 4 1]/Index["))
+    if (!m_Archive->WriteString("/W[0 4 1]/Index[")) {
       return Stage::kInvalid;
+    }
     if (m_IsIncremental && m_pParser && m_pParser->GetLastXRefOffset() == 0) {
       uint32_t i = 0;
       for (i = 0; i < m_dwLastObjNum; i++) {
-        if (!pdfium::Contains(m_ObjectOffsets, i))
+        if (!pdfium::Contains(m_ObjectOffsets, i)) {
           continue;
-        if (!m_Archive->WriteDWord(i) || !m_Archive->WriteString(" 1 "))
+        }
+        if (!m_Archive->WriteDWord(i) || !m_Archive->WriteString(" 1 ")) {
           return Stage::kInvalid;
+        }
       }
       if (!m_Archive->WriteString("]/Length ") ||
           !m_Archive->WriteDWord(m_dwLastObjNum * 5) ||
@@ -509,10 +551,12 @@
       }
       for (i = 0; i < m_dwLastObjNum; i++) {
         auto it = m_ObjectOffsets.find(i);
-        if (it == m_ObjectOffsets.end())
+        if (it == m_ObjectOffsets.end()) {
           continue;
-        if (!OutputIndex(m_Archive.get(), it->second))
+        }
+        if (!OutputIndex(m_Archive.get(), it->second)) {
           return Stage::kInvalid;
+        }
       }
     } else {
       int count = fxcrt::CollectionSize<int>(m_NewObjNumArray);
@@ -529,12 +573,15 @@
         return Stage::kInvalid;
       }
       for (i = 0; i < count; ++i) {
-        if (!OutputIndex(m_Archive.get(), m_ObjectOffsets[m_NewObjNumArray[i]]))
+        if (!OutputIndex(m_Archive.get(),
+                         m_ObjectOffsets[m_NewObjNumArray[i]])) {
           return Stage::kInvalid;
+        }
       }
     }
-    if (!m_Archive->WriteString("\r\nendstream"))
+    if (!m_Archive->WriteString("\r\nendstream")) {
       return Stage::kInvalid;
+    }
   }
 
   if (!m_Archive->WriteString("\r\nstartxref\r\n") ||
@@ -607,22 +654,25 @@
 }
 
 bool CPDF_Creator::Continue() {
-  if (m_iStage < Stage::kInit0)
+  if (m_iStage < Stage::kInit0) {
     return false;
+  }
 
   Stage iRet = Stage::kInit0;
   while (m_iStage < Stage::kComplete100) {
-    if (m_iStage < Stage::kInitWriteObjs20)
+    if (m_iStage < Stage::kInitWriteObjs20) {
       iRet = WriteDoc_Stage1();
-    else if (m_iStage < Stage::kInitWriteXRefs80)
+    } else if (m_iStage < Stage::kInitWriteXRefs80) {
       iRet = WriteDoc_Stage2();
-    else if (m_iStage < Stage::kWriteTrailerAndFinish90)
+    } else if (m_iStage < Stage::kWriteTrailerAndFinish90) {
       iRet = WriteDoc_Stage3();
-    else
+    } else {
       iRet = WriteDoc_Stage4();
+    }
 
-    if (iRet < m_iStage)
+    if (iRet < m_iStage) {
       break;
+    }
   }
 
   if (iRet <= Stage::kInit0 || m_iStage == Stage::kComplete100) {
@@ -634,8 +684,9 @@
 }
 
 bool CPDF_Creator::SetFileVersion(int32_t fileVersion) {
-  if (fileVersion < 10 || fileVersion > 17)
+  if (fileVersion < 10 || fileVersion > 17) {
     return false;
+  }
   m_FileVersion = fileVersion;
   return true;
 }
diff --git a/core/fpdfapi/edit/cpdf_pagecontentgenerator.cpp b/core/fpdfapi/edit/cpdf_pagecontentgenerator.cpp
index fb4ee57..b1d4415 100644
--- a/core/fpdfapi/edit/cpdf_pagecontentgenerator.cpp
+++ b/core/fpdfapi/edit/cpdf_pagecontentgenerator.cpp
@@ -350,8 +350,9 @@
     // Must include dirty page objects even if they are marked as inactive.
     // Otherwise an inactive object will not be detected that its stream needs
     // to be removed as part of regeneration.
-    if (pPageObj->IsDirty())
+    if (pPageObj->IsDirty()) {
       all_dirty_streams.insert(pPageObj->GetContentStream());
+    }
   }
   std::set<int32_t> marked_dirty_streams = m_pObjHolder->TakeDirtyStreams();
   all_dirty_streams.insert(marked_dirty_streams.begin(),
@@ -390,8 +391,9 @@
 
     int stream_index = pPageObj->GetContentStream();
     auto it = streams.find(stream_index);
-    if (it == streams.end())
+    if (it == streams.end()) {
       continue;
+    }
 
     fxcrt::ostringstream* buf = &it->second;
     empty_streams.erase(stream_index);
@@ -595,8 +597,9 @@
   // Technically we should iterate backwards to close from the top to the
   // bottom, but since the EMC operators do not identify which mark they are
   // closing, it does not matter.
-  for (size_t i = first_different; i < pPrev->CountItems(); ++i)
+  for (size_t i = first_different; i < pPrev->CountItems(); ++i) {
     *buf << "EMC\n";
+  }
 
   // Open all marks that are in next but not in prev.
   for (size_t i = first_different; i < pNext->CountItems(); ++i) {
@@ -640,20 +643,22 @@
   // Technically we should iterate backwards to close from the top to the
   // bottom, but since the EMC operators do not identify which mark they are
   // closing, it does not matter.
-  for (size_t i = 0; i < pContentMarks->CountItems(); ++i)
+  for (size_t i = 0; i < pContentMarks->CountItems(); ++i) {
     *buf << "EMC\n";
+  }
 }
 
 void CPDF_PageContentGenerator::ProcessPageObject(fxcrt::ostringstream* buf,
                                                   CPDF_PageObject* pPageObj) {
-  if (CPDF_ImageObject* pImageObject = pPageObj->AsImage())
+  if (CPDF_ImageObject* pImageObject = pPageObj->AsImage()) {
     ProcessImage(buf, pImageObject);
-  else if (CPDF_FormObject* pFormObj = pPageObj->AsForm())
+  } else if (CPDF_FormObject* pFormObj = pPageObj->AsForm()) {
     ProcessForm(buf, pFormObj);
-  else if (CPDF_PathObject* pPathObj = pPageObj->AsPath())
+  } else if (CPDF_PathObject* pPathObj = pPageObj->AsPath()) {
     ProcessPath(buf, pPathObj);
-  else if (CPDF_TextObject* pTextObj = pPageObj->AsText())
+  } else if (CPDF_TextObject* pTextObj = pPageObj->AsText()) {
     ProcessText(buf, pTextObj);
+  }
   pPageObj->SetDirty(false);
 }
 
@@ -665,12 +670,14 @@
   }
 
   RetainPtr<CPDF_Image> pImage = pImageObj->GetImage();
-  if (pImage->IsInline())
+  if (pImage->IsInline()) {
     return;
+  }
 
   RetainPtr<const CPDF_Stream> pStream = pImage->GetStream();
-  if (!pStream)
+  if (!pStream) {
     return;
+  }
 
   ProcessGraphics(buf, pImageObj);
 
@@ -679,8 +686,9 @@
   }
 
   bool bWasInline = pStream->IsInline();
-  if (bWasInline)
+  if (bWasInline) {
     pImage->ConvertStreamToIndirectObject();
+  }
 
   ByteString name = RealizeResource(pStream, "XObject");
   pImageObj->SetResourceName(name);
@@ -702,8 +710,9 @@
   }
 
   RetainPtr<const CPDF_Stream> pStream = pFormObj->form()->GetStream();
-  if (!pStream)
+  if (!pStream) {
     return;
+  }
 
   ByteString name = RealizeResource(pStream.Get(), "XObject");
   pFormObj->SetResourceName(name);
@@ -736,8 +745,9 @@
     return;
   }
   for (size_t i = 0; i < points.size(); ++i) {
-    if (i > 0)
+    if (i > 0) {
       *buf << " ";
+    }
 
     WritePoint(*buf, points[i].point_);
 
@@ -780,12 +790,13 @@
 
   ProcessPathPoints(buf, &pPathObj->path());
 
-  if (pPathObj->has_no_filltype())
+  if (pPathObj->has_no_filltype()) {
     *buf << (pPathObj->stroke() ? " S" : " n");
-  else if (pPathObj->has_winding_filltype())
+  } else if (pPathObj->has_winding_filltype()) {
     *buf << (pPathObj->stroke() ? " B" : " f");
-  else if (pPathObj->has_alternate_filltype())
+  } else if (pPathObj->has_alternate_filltype()) {
     *buf << (pPathObj->stroke() ? " B*" : " f*");
+  }
   EndProcessGraphics(*buf);
 }
 
@@ -813,11 +824,13 @@
     WriteFloat(*buf, line_width) << " w ";
   }
   CFX_GraphStateData::LineCap lineCap = pPageObj->graph_state().GetLineCap();
-  if (lineCap != CFX_GraphStateData::LineCap::kButt)
+  if (lineCap != CFX_GraphStateData::LineCap::kButt) {
     *buf << static_cast<int>(lineCap) << " J ";
+  }
   CFX_GraphStateData::LineJoin lineJoin = pPageObj->graph_state().GetLineJoin();
-  if (lineJoin != CFX_GraphStateData::LineJoin::kMiter)
+  if (lineJoin != CFX_GraphStateData::LineJoin::kMiter) {
     *buf << static_cast<int>(lineJoin) << " j ";
+  }
   std::vector<float> dash_array = pPageObj->graph_state().GetLineDashArray();
   if (dash_array.size()) {
     *buf << "[";
@@ -869,11 +882,13 @@
     name = std::move(maybe_name.value());
   } else {
     auto gsDict = pdfium::MakeRetain<CPDF_Dictionary>();
-    if (graphD.fillAlpha != 1.0f)
+    if (graphD.fillAlpha != 1.0f) {
       gsDict->SetNewFor<CPDF_Number>("ca", graphD.fillAlpha);
+    }
 
-    if (graphD.strokeAlpha != 1.0f)
+    if (graphD.strokeAlpha != 1.0f) {
       gsDict->SetNewFor<CPDF_Number>("CA", graphD.strokeAlpha);
+    }
 
     if (graphD.blendType != BlendMode::kNormal) {
       gsDict->SetNewFor<CPDF_Name>("BM",
@@ -904,8 +919,9 @@
 
   std::optional<ByteString> maybe_name =
       m_pObjHolder->GraphicsMapSearch(defaultGraphics);
-  if (maybe_name.has_value())
+  if (maybe_name.has_value()) {
     return maybe_name.value();
+  }
 
   auto gsDict = pdfium::MakeRetain<CPDF_Dictionary>();
   gsDict->SetNewFor<CPDF_Number>("ca", defaultGraphics.fillAlpha);
@@ -933,8 +949,9 @@
   }
 
   RetainPtr<CPDF_Font> pFont(pTextObj->GetFont());
-  if (!pFont)
+  if (!pFont) {
     pFont = CPDF_Font::GetStockFont(m_pDocument, "Helvetica");
+  }
 
   FontData data;
   const CPDF_FontEncoding* pEncoding = nullptr;
diff --git a/core/fpdfapi/edit/cpdf_pagecontentmanager.cpp b/core/fpdfapi/edit/cpdf_pagecontentmanager.cpp
index 9630c5c..82d93a8 100644
--- a/core/fpdfapi/edit/cpdf_pagecontentmanager.cpp
+++ b/core/fpdfapi/edit/cpdf_pagecontentmanager.cpp
@@ -46,8 +46,9 @@
   if (contents_reference) {
     RetainPtr<CPDF_Object> indirect_obj =
         contents_reference->GetMutableDirect();
-    if (!indirect_obj)
+    if (!indirect_obj) {
       return;
+    }
 
     contents_array.Reset(indirect_obj->AsMutableArray());
     if (contents_array) {
@@ -88,8 +89,9 @@
 
   RetainPtr<CPDF_Reference> stream_reference =
       ToReference(contents_array->GetMutableObjectAt(stream_index));
-  if (!stream_reference)
+  if (!stream_reference) {
     return nullptr;
+  }
 
   return ToStream(stream_reference->GetMutableDirect());
 }
diff --git a/core/fpdfapi/font/cfx_cttgsubtable.cpp b/core/fpdfapi/font/cfx_cttgsubtable.cpp
index 95146ec..7ae432d 100644
--- a/core/fpdfapi/font/cfx_cttgsubtable.cpp
+++ b/core/fpdfapi/font/cfx_cttgsubtable.cpp
@@ -26,8 +26,9 @@
 }  // namespace
 
 CFX_CTTGSUBTable::CFX_CTTGSUBTable(pdfium::span<const uint8_t> gsub) {
-  if (!LoadGSUBTable(gsub))
+  if (!LoadGSUBTable(gsub)) {
     return;
+  }
 
   for (const auto& script : script_list_) {
     for (const auto& record : script) {
@@ -73,8 +74,9 @@
   for (uint32_t item : feature_set_) {
     std::optional<uint32_t> result =
         GetVerticalGlyphSub(feature_list_[item], glyphnum);
-    if (result.has_value())
+    if (result.has_value()) {
       return result.value();
+    }
   }
   return 0;
 }
@@ -91,8 +93,9 @@
     }
     std::optional<uint32_t> result =
         GetVerticalGlyphSub2(lookup_list_[index], glyphnum);
-    if (result.has_value())
+    if (result.has_value()) {
       return result.value();
+    }
   }
   return std::nullopt;
 }
diff --git a/core/fpdfapi/font/cfx_stockfontarray.cpp b/core/fpdfapi/font/cfx_stockfontarray.cpp
index e22d9f5..be58953 100644
--- a/core/fpdfapi/font/cfx_stockfontarray.cpp
+++ b/core/fpdfapi/font/cfx_stockfontarray.cpp
@@ -35,6 +35,7 @@
 
 void CFX_StockFontArray::SetFont(CFX_FontMapper::StandardFont index,
                                  RetainPtr<CPDF_Font> pFont) {
-  if (index < std::size(m_StockFonts))
+  if (index < std::size(m_StockFonts)) {
     m_StockFonts[index] = std::move(pFont);
+  }
 }
diff --git a/core/fpdfapi/font/cpdf_cid2unicodemap.cpp b/core/fpdfapi/font/cpdf_cid2unicodemap.cpp
index fa14fe9..8c86292 100644
--- a/core/fpdfapi/font/cpdf_cid2unicodemap.cpp
+++ b/core/fpdfapi/font/cpdf_cid2unicodemap.cpp
@@ -20,7 +20,8 @@
 }
 
 wchar_t CPDF_CID2UnicodeMap::UnicodeFromCID(uint16_t cid) const {
-  if (m_Charset == CIDSET_UNICODE)
+  if (m_Charset == CIDSET_UNICODE) {
     return cid;
+  }
   return cid < m_pEmbeddedMap.size() ? m_pEmbeddedMap[cid] : 0;
 }
diff --git a/core/fpdfapi/font/cpdf_cidfont.cpp b/core/fpdfapi/font/cpdf_cidfont.cpp
index 2ecb0c4..8b8335e 100644
--- a/core/fpdfapi/font/cpdf_cidfont.cpp
+++ b/core/fpdfapi/font/cpdf_cidfont.cpp
@@ -160,12 +160,14 @@
 wchar_t EmbeddedUnicodeFromCharcode(const fxcmap::CMap* pEmbedMap,
                                     CIDSet charset,
                                     uint32_t charcode) {
-  if (!IsValidEmbeddedCharcodeFromUnicodeCharset(charset))
+  if (!IsValidEmbeddedCharcodeFromUnicodeCharset(charset)) {
     return 0;
+  }
 
   uint16_t cid = fxcmap::CIDFromCharCode(pEmbedMap, charcode);
-  if (!cid)
+  if (!cid) {
     return 0;
+  }
 
   pdfium::span<const uint16_t> map =
       CPDF_FontGlobals::GetInstance()->GetEmbeddedToUnicode(charset);
@@ -175,16 +177,18 @@
 uint32_t EmbeddedCharcodeFromUnicode(const fxcmap::CMap* pEmbedMap,
                                      CIDSet charset,
                                      wchar_t unicode) {
-  if (!IsValidEmbeddedCharcodeFromUnicodeCharset(charset))
+  if (!IsValidEmbeddedCharcodeFromUnicodeCharset(charset)) {
     return 0;
+  }
 
   pdfium::span<const uint16_t> map =
       CPDF_FontGlobals::GetInstance()->GetEmbeddedToUnicode(charset);
   for (uint32_t i = 0; i < map.size(); ++i) {
     if (map[i] == unicode) {
       uint32_t charCode = fxcmap::CharCodeFromCID(pEmbedMap, i);
-      if (charCode)
+      if (charCode) {
         return charCode;
+      }
     }
   }
   return 0;
@@ -228,13 +232,15 @@
   int last_code = 0;
   for (size_t i = 0; i < pArray->size(); i++) {
     RetainPtr<const CPDF_Object> pObj = pArray->GetDirectObjectAt(i);
-    if (!pObj)
+    if (!pObj) {
       continue;
+    }
 
     const CPDF_Array* pObjArray = pObj->AsArray();
     if (pObjArray) {
-      if (width_status != 1)
+      if (width_status != 1) {
         return;
+      }
       if (first_code > std::numeric_limits<int>::max() -
                            fxcrt::CollectionSize<int>(*pObjArray)) {
         width_status = 0;
@@ -244,8 +250,9 @@
       for (size_t j = 0; j < pObjArray->size(); j += nElements) {
         result->push_back(first_code);
         result->push_back(first_code);
-        for (int k = 0; k < nElements; k++)
+        for (int k = 0; k < nElements; k++) {
           result->push_back(pObjArray->GetIntegerAt(j + k));
+        }
         first_code++;
       }
       width_status = 0;
@@ -264,8 +271,9 @@
         }
         result->push_back(pObj->GetInteger());
         iCurElement++;
-        if (iCurElement == nElements)
+        if (iCurElement == nElements) {
           width_status = 0;
+        }
       }
     }
   }
@@ -276,8 +284,9 @@
 CPDF_CIDFont::CPDF_CIDFont(CPDF_Document* pDocument,
                            RetainPtr<CPDF_Dictionary> pFontDict)
     : CPDF_Font(pDocument, std::move(pFontDict)) {
-  for (size_t i = 0; i < std::size(m_CharBBox); ++i)
+  for (size_t i = 0; i < std::size(m_CharBBox); ++i) {
     m_CharBBox[i] = FX_RECT(-1, -1, -1, -1);
+  }
 }
 
 CPDF_CIDFont::~CPDF_CIDFont() = default;
@@ -305,8 +314,9 @@
 
 WideString CPDF_CIDFont::UnicodeFromCharCode(uint32_t charcode) const {
   WideString str = CPDF_Font::UnicodeFromCharCode(charcode);
-  if (!str.IsEmpty())
+  if (!str.IsEmpty()) {
     return str;
+  }
   wchar_t ret = GetUnicodeFromCharCode(charcode);
   return ret ? WideString(ret) : WideString();
 }
@@ -317,14 +327,17 @@
     case CIDCoding::kUTF16:
       return static_cast<wchar_t>(charcode);
     case CIDCoding::kCID:
-      if (!m_pCID2UnicodeMap || !m_pCID2UnicodeMap->IsLoaded())
+      if (!m_pCID2UnicodeMap || !m_pCID2UnicodeMap->IsLoaded()) {
         return 0;
+      }
       return m_pCID2UnicodeMap->UnicodeFromCID(static_cast<uint16_t>(charcode));
     default:
       break;
   }
-  if (m_pCID2UnicodeMap && m_pCID2UnicodeMap->IsLoaded() && m_pCMap->IsLoaded())
+  if (m_pCID2UnicodeMap && m_pCID2UnicodeMap->IsLoaded() &&
+      m_pCMap->IsLoaded()) {
     return m_pCID2UnicodeMap->UnicodeFromCID(CIDFromCharCode(charcode));
+  }
 
 #if BUILDFLAG(IS_WIN)
   uint8_t sequence[2] = {};
@@ -342,8 +355,9 @@
       pdfium::span_from_ref(unicode));
   return ret == 1 ? unicode : 0;
 #else
-  if (!m_pCMap->GetEmbedMap())
+  if (!m_pCMap->GetEmbedMap()) {
     return 0;
+  }
   return EmbeddedUnicodeFromCharcode(m_pCMap->GetEmbedMap(),
                                      m_pCMap->GetCharset(), charcode);
 #endif
@@ -351,8 +365,9 @@
 
 uint32_t CPDF_CIDFont::CharCodeFromUnicode(wchar_t unicode) const {
   uint32_t charcode = CPDF_Font::CharCodeFromUnicode(unicode);
-  if (charcode)
+  if (charcode) {
     return charcode;
+  }
 
   switch (m_pCMap->GetCoding()) {
     case CIDCoding::kUNKNOWN:
@@ -361,14 +376,16 @@
     case CIDCoding::kUTF16:
       return unicode;
     case CIDCoding::kCID: {
-      if (!m_pCID2UnicodeMap || !m_pCID2UnicodeMap->IsLoaded())
+      if (!m_pCID2UnicodeMap || !m_pCID2UnicodeMap->IsLoaded()) {
         return 0;
+      }
       uint32_t cid = 0;
       while (cid < 65536) {
         wchar_t this_unicode =
             m_pCID2UnicodeMap->UnicodeFromCID(static_cast<uint16_t>(cid));
-        if (this_unicode == unicode)
+        if (this_unicode == unicode) {
           return cid;
+        }
         cid++;
       }
       break;
@@ -377,20 +394,24 @@
       break;
   }
 
-  if (unicode < 0x80)
+  if (unicode < 0x80) {
     return static_cast<uint32_t>(unicode);
-  if (m_pCMap->GetCoding() == CIDCoding::kCID)
+  }
+  if (m_pCMap->GetCoding() == CIDCoding::kCID) {
     return 0;
+  }
 #if BUILDFLAG(IS_WIN)
   uint8_t buffer[32];
   size_t ret = FX_WideCharToMultiByte(
       kCharsetCodePages[static_cast<size_t>(m_pCMap->GetCoding())],
       WideStringView(unicode),
       pdfium::as_writable_chars(pdfium::make_span(buffer).first(4u)));
-  if (ret == 1)
+  if (ret == 1) {
     return buffer[0];
-  if (ret == 2)
+  }
+  if (ret == 2) {
     return buffer[0] * 256 + buffer[1];
+  }
 #else
   if (m_pCMap->GetEmbedMap()) {
     return EmbeddedCharcodeFromUnicode(m_pCMap->GetEmbedMap(),
@@ -408,12 +429,14 @@
 
   RetainPtr<const CPDF_Array> pFonts =
       m_pFontDict->GetArrayFor("DescendantFonts");
-  if (!pFonts || pFonts->size() != 1)
+  if (!pFonts || pFonts->size() != 1) {
     return false;
+  }
 
   RetainPtr<const CPDF_Dictionary> pCIDFontDict = pFonts->GetDictAt(0);
-  if (!pCIDFontDict)
+  if (!pCIDFontDict) {
     return false;
+  }
 
   m_BaseFontName = pCIDFontDict->GetByteStringFor("BaseFont");
   if ((m_BaseFontName == "CourierStd" || m_BaseFontName == "CourierStd-Bold" ||
@@ -425,15 +448,17 @@
 
   RetainPtr<const CPDF_Object> pEncoding =
       m_pFontDict->GetDirectObjectFor("Encoding");
-  if (!pEncoding)
+  if (!pEncoding) {
     return false;
+  }
 
   ByteString subtype = pCIDFontDict->GetByteStringFor("Subtype");
   m_FontType =
       subtype == "CIDFontType0" ? CIDFontType::kType1 : CIDFontType::kTrueType;
 
-  if (!pEncoding->IsName() && !pEncoding->IsStream())
+  if (!pEncoding->IsName() && !pEncoding->IsStream()) {
     return false;
+  }
 
   auto* pFontGlobals = CPDF_FontGlobals::GetInstance();
   const CPDF_Stream* pEncodingStream = pEncoding->AsStream();
@@ -451,8 +476,9 @@
 
   RetainPtr<const CPDF_Dictionary> pFontDesc =
       pCIDFontDict->GetDictFor("FontDescriptor");
-  if (pFontDesc)
+  if (pFontDesc) {
     LoadFontDescriptor(pFontDesc.Get());
+  }
 
   m_Charset = m_pCMap->GetCharset();
   if (m_Charset == CIDSET_UNKNOWN) {
@@ -476,11 +502,13 @@
   }
   m_DefaultWidth = pCIDFontDict->GetIntegerFor("DW", 1000);
   RetainPtr<const CPDF_Array> pWidthArray = pCIDFontDict->GetArrayFor("W");
-  if (pWidthArray)
+  if (pWidthArray) {
     LoadMetricsArray(std::move(pWidthArray), &m_WidthList, 1);
+  }
 
-  if (!IsEmbedded())
+  if (!IsEmbedded()) {
     LoadSubstFont();
+  }
 
   RetainPtr<const CPDF_Object> pmap =
       pCIDFontDict->GetDirectObjectFor("CIDToGIDMap");
@@ -498,8 +526,9 @@
   CheckFontMetrics();
   if (IsVertWriting()) {
     RetainPtr<const CPDF_Array> pWidth2Array = pCIDFontDict->GetArrayFor("W2");
-    if (pWidth2Array)
+    if (pWidth2Array) {
       LoadMetricsArray(std::move(pWidth2Array), &m_VertMetrics, 3);
+    }
 
     RetainPtr<const CPDF_Array> pDefaultArray =
         pCIDFontDict->GetArrayFor("DW2");
@@ -510,15 +539,17 @@
   }
 
   // TODO(thestig): Better identify font types and identify more font types.
-  if (m_FontType == CIDFontType::kTrueType && IsEmbedded())
+  if (m_FontType == CIDFontType::kTrueType && IsEmbedded()) {
     m_Font.SetFontType(CFX_Font::FontType::kCIDTrueType);
+  }
 
   return true;
 }
 
 FX_RECT CPDF_CIDFont::GetCharBBox(uint32_t charcode) {
-  if (charcode < 256 && m_CharBBox[charcode].right != -1)
+  if (charcode < 256 && m_CharBBox[charcode].right != -1) {
     return m_CharBBox[charcode];
+  }
 
   FX_RECT rect;
   bool bVert = false;
@@ -540,8 +571,9 @@
       rect = matrix.TransformRect(CFX_FloatRect(rect)).GetOuterRect();
     }
   }
-  if (charcode < 256)
+  if (charcode < 256) {
     m_CharBBox[charcode] = rect;
+  }
 
   return rect;
 }
@@ -593,18 +625,22 @@
 }
 
 int CPDF_CIDFont::GetGlyphIndex(uint32_t unicode, bool* pVertGlyph) {
-  if (pVertGlyph)
+  if (pVertGlyph) {
     *pVertGlyph = false;
+  }
 
   int index = m_Font.GetFace()->GetCharIndex(unicode);
-  if (unicode == pdfium::unicode::kBoxDrawingsLightVerical)
+  if (unicode == pdfium::unicode::kBoxDrawingsLightVerical) {
     return index;
+  }
 
-  if (!index || !IsVertWriting())
+  if (!index || !IsVertWriting()) {
     return index;
+  }
 
-  if (m_pTTGSUBTable)
+  if (m_pTTGSUBTable) {
     return GetVerticalGlyph(index, pVertGlyph);
+  }
 
   static constexpr uint32_t kGsubTag =
       CFX_FontMapper::MakeTag('G', 'S', 'U', 'B');
@@ -627,68 +663,80 @@
 
 int CPDF_CIDFont::GetVerticalGlyph(int index, bool* pVertGlyph) {
   uint32_t vindex = m_pTTGSUBTable->GetVerticalGlyph(index);
-  if (!vindex)
+  if (!vindex) {
     return index;
+  }
 
   index = vindex;
-  if (pVertGlyph)
+  if (pVertGlyph) {
     *pVertGlyph = true;
+  }
   return index;
 }
 
 int CPDF_CIDFont::GlyphFromCharCode(uint32_t charcode, bool* pVertGlyph) {
-  if (pVertGlyph)
+  if (pVertGlyph) {
     *pVertGlyph = false;
+  }
 
   if (!m_pFontFile && (!m_pStreamAcc || m_pCID2UnicodeMap)) {
     uint16_t cid = CIDFromCharCode(charcode);
     wchar_t unicode = 0;
     if (m_bCIDIsGID) {
 #if BUILDFLAG(IS_APPLE)
-      if (FontStyleIsSymbolic(m_Flags))
+      if (FontStyleIsSymbolic(m_Flags)) {
         return cid;
+      }
 
       WideString uni_str = UnicodeFromCharCode(charcode);
-      if (uni_str.IsEmpty())
+      if (uni_str.IsEmpty()) {
         return cid;
+      }
 
       unicode = uni_str[0];
 #else
       return cid;
 #endif
     } else {
-      if (cid && m_pCID2UnicodeMap && m_pCID2UnicodeMap->IsLoaded())
+      if (cid && m_pCID2UnicodeMap && m_pCID2UnicodeMap->IsLoaded()) {
         unicode = m_pCID2UnicodeMap->UnicodeFromCID(cid);
-      if (unicode == 0)
+      }
+      if (unicode == 0) {
         unicode = GetUnicodeFromCharCode(charcode);
+      }
       if (unicode == 0) {
         WideString unicode_str = UnicodeFromCharCode(charcode);
-        if (!unicode_str.IsEmpty())
+        if (!unicode_str.IsEmpty()) {
           unicode = unicode_str[0];
+        }
       }
     }
     if (unicode == 0) {
-      if (!m_bAdobeCourierStd)
+      if (!m_bAdobeCourierStd) {
         return charcode ? static_cast<int>(charcode) : -1;
+      }
 
       charcode += 31;
       RetainPtr<CFX_Face> face = m_Font.GetFace();
       bool bMSUnicode = UseTTCharmapMSUnicode(face);
       bool bMacRoman = !bMSUnicode && UseTTCharmapMacRoman(face);
       FontEncoding base_encoding = FontEncoding::kStandard;
-      if (bMSUnicode)
+      if (bMSUnicode) {
         base_encoding = FontEncoding::kWinAnsi;
-      else if (bMacRoman)
+      } else if (bMacRoman) {
         base_encoding = FontEncoding::kMacRoman;
+      }
       const char* name =
           GetAdobeCharName(base_encoding, std::vector<ByteString>(), charcode);
-      if (!name)
+      if (!name) {
         return charcode ? static_cast<int>(charcode) : -1;
+      }
 
       int index = 0;
       uint16_t name_unicode = UnicodeFromAdobeName(name);
-      if (!name_unicode)
+      if (!name_unicode) {
         return charcode ? static_cast<int>(charcode) : -1;
+      }
 
       if (base_encoding == FontEncoding::kStandard) {
         return face->GetCharIndex(name_unicode);
@@ -703,8 +751,9 @@
         index =
             maccode ? face->GetCharIndex(maccode) : face->GetNameIndex(name);
       }
-      if (index == 0 || index == 0xffff)
+      if (index == 0 || index == 0xffff) {
         return charcode ? static_cast<int>(charcode) : -1;
+      }
       return index;
     }
     if (m_Charset == CIDSET_JAPAN1) {
@@ -728,8 +777,9 @@
       for (i = 0; i < num_charmaps; i++) {
         uint32_t ret = CharCodeFromUnicodeForEncoding(
             face->GetCharMapEncodingByIndex(i), static_cast<wchar_t>(charcode));
-        if (ret == 0)
+        if (ret == 0) {
           continue;
+        }
         face->SetCharMapByIndex(i);
         unicode = static_cast<wchar_t>(ret);
         break;
@@ -771,16 +821,18 @@
 
     if (charmap.value() == fxge::FontEncoding::kUnicode) {
       WideString unicode_str = UnicodeFromCharCode(charcode);
-      if (unicode_str.IsEmpty())
+      if (unicode_str.IsEmpty()) {
         return -1;
+      }
 
       charcode = unicode_str[0];
     }
     return GetGlyphIndex(charcode, pVertGlyph);
   }
   uint32_t byte_pos = cid * 2;
-  if (byte_pos + 2 > m_pStreamAcc->GetSize())
+  if (byte_pos + 2 > m_pStreamAcc->GetSize()) {
     return -1;
+  }
 
   pdfium::span<const uint8_t> span = m_pStreamAcc->GetSpan().subspan(byte_pos);
   return span[0] * 256 + span[1];
@@ -804,8 +856,10 @@
 }
 
 bool CPDF_CIDFont::IsUnicodeCompatible() const {
-  if (m_pCID2UnicodeMap && m_pCID2UnicodeMap->IsLoaded() && m_pCMap->IsLoaded())
+  if (m_pCID2UnicodeMap && m_pCID2UnicodeMap->IsLoaded() &&
+      m_pCMap->IsLoaded()) {
     return true;
+  }
   return m_pCMap->GetCoding() != CIDCoding::kUNKNOWN;
 }
 
@@ -832,18 +886,21 @@
   m_pCID2UnicodeMap = pFontGlobals->GetCID2UnicodeMap(m_Charset);
   RetainPtr<const CPDF_Dictionary> pFontDesc =
       m_pFontDict->GetDictFor("FontDescriptor");
-  if (pFontDesc)
+  if (pFontDesc) {
     LoadFontDescriptor(pFontDesc.Get());
+  }
 
-  if (!IsEmbedded())
+  if (!IsEmbedded()) {
     LoadSubstFont();
+  }
   CheckFontMetrics();
   m_bAnsiWidthsFixed = true;
 }
 
 const CIDTransform* CPDF_CIDFont::GetCIDTransform(uint16_t cid) const {
-  if (m_Charset != CIDSET_JAPAN1 || m_pFontFile)
+  if (m_Charset != CIDSET_JAPAN1 || m_pFontFile) {
     return nullptr;
+  }
 
   const auto* pBegin = std::begin(kJapan1VerticalCIDs);
   const auto* pEnd = std::end(kJapan1VerticalCIDs);
diff --git a/core/fpdfapi/font/cpdf_cmap.cpp b/core/fpdfapi/font/cpdf_cmap.cpp
index ce4f848..3093452 100644
--- a/core/fpdfapi/font/cpdf_cmap.cpp
+++ b/core/fpdfapi/font/cpdf_cmap.cpp
@@ -157,11 +157,13 @@
 };
 
 const PredefinedCMap* GetPredefinedCMap(ByteStringView cmapid) {
-  if (cmapid.GetLength() > 2)
+  if (cmapid.GetLength() > 2) {
     cmapid = cmapid.First(cmapid.GetLength() - 2);
+  }
   for (const auto& map : kPredefinedCMaps) {
-    if (cmapid == map.m_pName)
+    if (cmapid == map.m_pName) {
       return &map;
+    }
   }
   return nullptr;
 }
@@ -208,8 +210,9 @@
 size_t GetFourByteCharSizeImpl(
     uint32_t charcode,
     pdfium::span<const CPDF_CMap::CodeRange> ranges) {
-  if (ranges.empty())
+  if (ranges.empty()) {
     return 1;
+  }
 
   std::array<uint8_t, 4> codes = {{
       0x00,
@@ -221,8 +224,9 @@
     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)
+      if (ranges[iSeg].m_CharSize < size) {
         continue;
+      }
       size_t iChar = 0;
       while (iChar < size) {
         if (codes[offset + iChar] < ranges[iSeg].m_Lower[iChar] ||
@@ -231,8 +235,9 @@
         }
         ++iChar;
       }
-      if (iChar == ranges[iSeg].m_CharSize)
+      if (iChar == ranges[iSeg].m_CharSize) {
         return size;
+      }
     }
   }
   return 1;
@@ -241,8 +246,9 @@
 const fxcmap::CMap* FindEmbeddedCMap(pdfium::span<const fxcmap::CMap> pCMaps,
                                      ByteStringView bsName) {
   for (size_t i = 0; i < pCMaps.size(); i++) {
-    if (bsName == pCMaps[i].m_Name)
+    if (bsName == pCMaps[i].m_Name) {
       return &pCMaps[i];
+    }
   }
   return nullptr;
 }
@@ -258,19 +264,22 @@
   }
 
   const PredefinedCMap* map = GetPredefinedCMap(bsPredefinedName);
-  if (!map)
+  if (!map) {
     return;
+  }
 
   m_Charset = map->m_Charset;
   m_Coding = map->m_Coding;
   m_CodingScheme = map->m_CodingScheme;
-  if (m_CodingScheme == MixedTwoBytes)
+  if (m_CodingScheme == MixedTwoBytes) {
     m_MixedTwoByteLeadingBytes = LoadLeadingSegments(*map);
+  }
   m_pEmbedMap = FindEmbeddedCMap(
       CPDF_FontGlobals::GetInstance()->GetEmbeddedCharset(m_Charset),
       bsPredefinedName);
-  if (!m_pEmbedMap)
+  if (!m_pEmbedMap) {
     return;
+  }
 
   m_bLoaded = true;
 }
@@ -292,18 +301,22 @@
 CPDF_CMap::~CPDF_CMap() = default;
 
 uint16_t CPDF_CMap::CIDFromCharCode(uint32_t charcode) const {
-  if (m_Coding == CIDCoding::kCID)
+  if (m_Coding == CIDCoding::kCID) {
     return static_cast<uint16_t>(charcode);
+  }
 
-  if (m_pEmbedMap)
+  if (m_pEmbedMap) {
     return fxcmap::CIDFromCharCode(m_pEmbedMap, charcode);
+  }
 
-  if (m_DirectCharcodeToCIDTable.empty())
+  if (m_DirectCharcodeToCIDTable.empty()) {
     return static_cast<uint16_t>(charcode);
+  }
 
   auto table_span = m_DirectCharcodeToCIDTable.span();
-  if (charcode < table_span.size())
+  if (charcode < table_span.size()) {
     return table_span[charcode];
+  }
 
   auto it = std::lower_bound(m_AdditionalCharcodeToCIDMappings.begin(),
                              m_AdditionalCharcodeToCIDMappings.end(), charcode,
@@ -331,8 +344,9 @@
     }
     case MixedTwoBytes: {
       uint8_t byte1 = offset < pBytes.size() ? pBytes[offset++] : 0;
-      if (!m_MixedTwoByteLeadingBytes[byte1])
+      if (!m_MixedTwoByteLeadingBytes[byte1]) {
         return byte1;
+      }
       uint8_t byte2 = offset < pBytes.size() ? pBytes[offset++] : 0;
       return 256 * byte1 + byte2;
     }
@@ -344,16 +358,19 @@
         int ret =
             CheckFourByteCodeRange(pdfium::make_span(codes).first(char_size),
                                    m_MixedFourByteLeadingRanges);
-        if (ret == 0)
+        if (ret == 0) {
           return 0;
+        }
         if (ret == 2) {
           uint32_t charcode = 0;
-          for (int i = 0; i < char_size; i++)
+          for (int i = 0; i < char_size; i++) {
             charcode = (charcode << 8) + codes[i];
+          }
           return charcode;
         }
-        if (char_size == 4 || offset == pBytes.size())
+        if (char_size == 4 || offset == pBytes.size()) {
           return 0;
+        }
         codes[char_size++] = pBytes[offset++];
       }
     }
@@ -368,16 +385,20 @@
     case TwoBytes:
       return 2;
     case MixedTwoBytes:
-      if (charcode < 0x100)
+      if (charcode < 0x100) {
         return 1;
+      }
       return 2;
     case MixedFourBytes:
-      if (charcode < 0x100)
+      if (charcode < 0x100) {
         return 1;
-      if (charcode < 0x10000)
+      }
+      if (charcode < 0x10000) {
         return 2;
-      if (charcode < 0x1000000)
+      }
+      if (charcode < 0x1000000) {
         return 3;
+      }
       return 4;
   }
   NOTREACHED();
@@ -393,8 +414,9 @@
       size_t count = 0;
       for (size_t i = 0; i < pString.GetLength(); i++) {
         count++;
-        if (m_MixedTwoByteLeadingBytes[pString[i]])
+        if (m_MixedTwoByteLeadingBytes[pString[i]]) {
           i++;
+        }
       }
       return count;
     }
@@ -461,8 +483,9 @@
 
 void CPDF_CMap::SetAdditionalMappings(std::vector<CIDRange> mappings) {
   DCHECK(m_AdditionalCharcodeToCIDMappings.empty());
-  if (m_CodingScheme != MixedFourBytes || mappings.empty())
+  if (m_CodingScheme != MixedFourBytes || mappings.empty()) {
     return;
+  }
 
   std::sort(
       mappings.begin(), mappings.end(),
diff --git a/core/fpdfapi/font/cpdf_cmapparser.cpp b/core/fpdfapi/font/cpdf_cmapparser.cpp
index 0f27c4d..aace019 100644
--- a/core/fpdfapi/font/cpdf_cmapparser.cpp
+++ b/core/fpdfapi/font/cpdf_cmapparser.cpp
@@ -20,8 +20,9 @@
 namespace {
 
 ByteStringView CMap_GetString(ByteStringView word) {
-  if (word.GetLength() <= 2)
+  if (word.GetLength() <= 2) {
     return ByteStringView();
+  }
   return word.Last(word.GetLength() - 2);
 }
 
@@ -84,8 +85,9 @@
   m_CodePoints[m_CodeSeq] = GetCode(word);
   m_CodeSeq++;
   int nRequiredCodePoints = bChar ? 2 : 3;
-  if (m_CodeSeq < nRequiredCodePoints)
+  if (m_CodeSeq < nRequiredCodePoints) {
     return;
+  }
 
   uint32_t StartCode = m_CodePoints[0];
   uint32_t EndCode;
@@ -107,14 +109,16 @@
 
 void CPDF_CMapParser::HandleCodeSpaceRange(ByteStringView word) {
   if (word != "endcodespacerange") {
-    if (word.IsEmpty() || word[0] != '<')
+    if (word.IsEmpty() || word[0] != '<') {
       return;
+    }
 
     if (m_CodeSeq % 2) {
       std::optional<CPDF_CMap::CodeRange> range =
           GetCodeRange(m_LastWord.AsStringView(), word);
-      if (range.has_value())
+      if (range.has_value()) {
         m_PendingRanges.push_back(range.value());
+      }
     }
     m_CodeSeq++;
     return;
@@ -138,15 +142,17 @@
 
 // static
 uint32_t CPDF_CMapParser::GetCode(ByteStringView word) {
-  if (word.IsEmpty())
+  if (word.IsEmpty()) {
     return 0;
+  }
 
   FX_SAFE_UINT32 num = 0;
   if (word[0] == '<') {
     for (size_t i = 1; i < word.GetLength() && FXSYS_IsHexDigit(word[i]); ++i) {
       num = num * 16 + FXSYS_HexCharToInt(word[i]);
-      if (!num.IsValid())
+      if (!num.IsValid()) {
         return 0;
+      }
     }
     return num.ValueOrDie();
   }
@@ -154,8 +160,9 @@
   for (size_t i = 0;
        i < word.GetLength() && FXSYS_IsDecimalDigit(word.CharAt(i)); ++i) {
     num = num * 10 + FXSYS_DecimalCharToInt(word.CharAt(i));
-    if (!num.IsValid())
+    if (!num.IsValid()) {
       return 0;
+    }
   }
   return num.ValueOrDie();
 }
@@ -164,17 +171,20 @@
 std::optional<CPDF_CMap::CodeRange> CPDF_CMapParser::GetCodeRange(
     ByteStringView first,
     ByteStringView second) {
-  if (first.IsEmpty() || first[0] != '<')
+  if (first.IsEmpty() || first[0] != '<') {
     return std::nullopt;
+  }
 
   size_t i;
   for (i = 1; i < first.GetLength(); ++i) {
-    if (first[i] == '>')
+    if (first[i] == '>') {
       break;
+    }
   }
   size_t char_size = (i - 1) / 2;
-  if (char_size > 4)
+  if (char_size > 4) {
     return std::nullopt;
+  }
 
   CPDF_CMap::CodeRange range;
   range.m_CharSize = char_size;
@@ -203,8 +213,9 @@
       {nullptr, "GB1", "CNS1", "Japan1", "Korea1", "UCS"}};
 
   for (size_t charset = 1; charset < std::size(kCharsetNames); ++charset) {
-    if (ordering == kCharsetNames[charset])
+    if (ordering == kCharsetNames[charset]) {
       return static_cast<CIDSet>(charset);
+    }
   }
   return CIDSET_UNKNOWN;
 }
diff --git a/core/fpdfapi/font/cpdf_font.cpp b/core/fpdfapi/font/cpdf_font.cpp
index ba6b0d6..db711a2 100644
--- a/core/fpdfapi/font/cpdf_font.cpp
+++ b/core/fpdfapi/font/cpdf_font.cpp
@@ -131,15 +131,17 @@
 }
 
 WideString CPDF_Font::UnicodeFromCharCode(uint32_t charcode) const {
-  if (!m_bToUnicodeLoaded)
+  if (!m_bToUnicodeLoaded) {
     LoadUnicodeMap();
+  }
 
   return m_pToUnicodeMap ? m_pToUnicodeMap->Lookup(charcode) : WideString();
 }
 
 uint32_t CPDF_Font::CharCodeFromUnicode(wchar_t unicode) const {
-  if (!m_bToUnicodeLoaded)
+  if (!m_bToUnicodeLoaded) {
     LoadUnicodeMap();
+  }
 
   return m_pToUnicodeMap ? m_pToUnicodeMap->ReverseLookup(unicode) : 0;
 }
@@ -176,14 +178,16 @@
     bExistDescent = true;
   }
   bool bExistCapHeight = false;
-  if (pFontDesc->KeyExist("CapHeight"))
+  if (pFontDesc->KeyExist("CapHeight")) {
     bExistCapHeight = true;
+  }
   if (bExistItalicAngle && bExistAscent && bExistCapHeight && bExistDescent &&
       bExistStemV) {
     m_Flags |= FXFONT_USEEXTERNATTR;
   }
-  if (m_Descent > 10)
+  if (m_Descent > 10) {
     m_Descent = -m_Descent;
+  }
   RetainPtr<const CPDF_Array> pBBox = pFontDesc->GetArrayFor("FontBBox");
   if (pBBox) {
     m_FontBBox.left = pBBox->GetIntegerAt(0);
@@ -193,20 +197,25 @@
   }
 
   RetainPtr<const CPDF_Stream> pFontFile = pFontDesc->GetStreamFor("FontFile");
-  if (!pFontFile)
+  if (!pFontFile) {
     pFontFile = pFontDesc->GetStreamFor("FontFile2");
-  if (!pFontFile)
+  }
+  if (!pFontFile) {
     pFontFile = pFontDesc->GetStreamFor("FontFile3");
-  if (!pFontFile)
+  }
+  if (!pFontFile) {
     return;
+  }
 
   const uint64_t key = pFontFile->KeyForCache();
   m_pFontFile = m_pDocument->GetFontFileStreamAcc(std::move(pFontFile));
-  if (!m_pFontFile)
+  if (!m_pFontFile) {
     return;
+  }
 
-  if (!m_Font.LoadEmbedded(m_pFontFile->GetSpan(), IsVertWriting(), key))
+  if (!m_Font.LoadEmbedded(m_pFontFile->GetSpan(), IsVertWriting(), key)) {
     m_pDocument->MaybePurgeFontFileStreamAcc(std::move(m_pFontFile));
+  }
 }
 
 void CPDF_Font::CheckFontMetrics() {
@@ -253,8 +262,9 @@
 void CPDF_Font::LoadUnicodeMap() const {
   m_bToUnicodeLoaded = true;
   RetainPtr<const CPDF_Stream> pStream = m_pFontDict->GetStreamFor("ToUnicode");
-  if (!pStream)
+  if (!pStream) {
     return;
+  }
 
   m_pToUnicodeMap = std::make_unique<CPDF_ToUnicodeMap>(std::move(pStream));
 }
@@ -262,8 +272,9 @@
 int CPDF_Font::GetStringWidth(ByteStringView pString) {
   size_t offset = 0;
   int width = 0;
-  while (offset < pString.GetLength())
+  while (offset < pString.GetLength()) {
     width += GetCharWidthF(GetNextChar(pString, &offset));
+  }
   return width;
 }
 
@@ -273,13 +284,15 @@
   ByteString fontname(name);
   std::optional<CFX_FontMapper::StandardFont> font_id =
       CFX_FontMapper::GetStandardFontName(&fontname);
-  if (!font_id.has_value())
+  if (!font_id.has_value()) {
     return nullptr;
+  }
 
   auto* pFontGlobals = CPDF_FontGlobals::GetInstance();
   RetainPtr<CPDF_Font> pFont = pFontGlobals->Find(pDoc, font_id.value());
-  if (pFont)
+  if (pFont) {
     return pFont;
+  }
 
   auto pDict = pDoc->New<CPDF_Dictionary>();
   pDict->SetNewFor<CPDF_Name>("Type", "Font");
@@ -304,13 +317,15 @@
       if (tag == chinese_font_name) {
         RetainPtr<const CPDF_Dictionary> pFontDesc =
             pFontDict->GetDictFor("FontDescriptor");
-        if (!pFontDesc || !pFontDesc->KeyExist("FontFile2"))
+        if (!pFontDesc || !pFontDesc->KeyExist("FontFile2")) {
           pFont = pdfium::MakeRetain<CPDF_CIDFont>(pDoc, std::move(pFontDict));
+        }
         break;
       }
     }
-    if (!pFont)
+    if (!pFont) {
       pFont = pdfium::MakeRetain<CPDF_TrueTypeFont>(pDoc, std::move(pFontDict));
+    }
   } else if (type == "Type3") {
     pFont = pdfium::MakeRetain<CPDF_Type3Font>(pDoc, std::move(pFontDict),
                                                pFactory);
@@ -319,25 +334,29 @@
   } else {
     pFont = pdfium::MakeRetain<CPDF_Type1Font>(pDoc, std::move(pFontDict));
   }
-  if (!pFont->Load())
+  if (!pFont->Load()) {
     return nullptr;
+  }
 
   return pFont;
 }
 
 uint32_t CPDF_Font::GetNextChar(ByteStringView pString, size_t* pOffset) const {
-  if (pString.IsEmpty())
+  if (pString.IsEmpty()) {
     return 0;
+  }
 
   size_t& offset = *pOffset;
   return offset < pString.GetLength() ? pString[offset++] : pString.Back();
 }
 
 bool CPDF_Font::IsStandardFont() const {
-  if (!IsType1Font())
+  if (!IsType1Font()) {
     return false;
-  if (m_pFontFile)
+  }
+  if (m_pFontFile) {
     return false;
+  }
   return AsType1Font()->IsBase14Font();
 }
 
@@ -354,17 +373,21 @@
     FontEncoding base_encoding,
     const std::vector<ByteString>& charnames,
     uint32_t charcode) {
-  if (charcode >= 256)
+  if (charcode >= 256) {
     return nullptr;
+  }
 
-  if (!charnames.empty() && !charnames[charcode].IsEmpty())
+  if (!charnames.empty() && !charnames[charcode].IsEmpty()) {
     return charnames[charcode].c_str();
+  }
 
   const char* name = nullptr;
-  if (base_encoding != FontEncoding::kBuiltin)
+  if (base_encoding != FontEncoding::kBuiltin) {
     name = CharNameFromPredefinedCharSet(base_encoding, charcode);
-  if (!name)
+  }
+  if (!name) {
     return nullptr;
+  }
 
   DCHECK(name[0]);
   return name;
@@ -384,21 +407,24 @@
 }
 
 int CPDF_Font::FallbackGlyphFromCharcode(int fallbackFont, uint32_t charcode) {
-  if (!fxcrt::IndexInBounds(m_FontFallbacks, fallbackFont))
+  if (!fxcrt::IndexInBounds(m_FontFallbacks, fallbackFont)) {
     return -1;
+  }
 
   WideString str = UnicodeFromCharCode(charcode);
   uint32_t unicode = !str.IsEmpty() ? str[0] : charcode;
   int glyph = m_FontFallbacks[fallbackFont]->GetFace()->GetCharIndex(unicode);
-  if (glyph == 0)
+  if (glyph == 0) {
     return -1;
+  }
 
   return glyph;
 }
 
 CFX_Font* CPDF_Font::GetFontFallback(int position) {
-  if (position < 0 || static_cast<size_t>(position) >= m_FontFallbacks.size())
+  if (position < 0 || static_cast<size_t>(position) >= m_FontFallbacks.size()) {
     return nullptr;
+  }
   return m_FontFallbacks[position].get();
 }
 
diff --git a/core/fpdfapi/font/cpdf_fontencoding.cpp b/core/fpdfapi/font/cpdf_fontencoding.cpp
index b40f994..f035826 100644
--- a/core/fpdfapi/font/cpdf_fontencoding.cpp
+++ b/core/fpdfapi/font/cpdf_fontencoding.cpp
@@ -1659,8 +1659,9 @@
 
 int CPDF_FontEncoding::CharCodeFromUnicode(wchar_t unicode) const {
   for (size_t i = 0; i < std::size(m_Unicodes); i++) {
-    if (m_Unicodes[i] == unicode)
+    if (m_Unicodes[i] == unicode) {
       return static_cast<int>(i);
+    }
   }
   return -1;
 }
@@ -1706,14 +1707,15 @@
   }
   if (predefined.has_value()) {
     const char* pName;
-    if (predefined.value() == FontEncoding::kWinAnsi)
+    if (predefined.value() == FontEncoding::kWinAnsi) {
       pName = pdfium::font_encodings::kWinAnsiEncoding;
-    else if (predefined.value() == FontEncoding::kMacRoman)
+    } else if (predefined.value() == FontEncoding::kMacRoman) {
       pName = pdfium::font_encodings::kMacRomanEncoding;
-    else if (predefined.value() == FontEncoding::kMacExpert)
+    } else if (predefined.value() == FontEncoding::kMacExpert) {
       pName = pdfium::font_encodings::kMacExpertEncoding;
-    else
+    } else {
       return nullptr;
+    }
 
     return pdfium::MakeRetain<CPDF_Name>(pPool, pName);
   }
@@ -1789,13 +1791,15 @@
 const char* CharNameFromPredefinedCharSet(FontEncoding encoding,
                                           uint8_t charcode) {
   if (encoding == FontEncoding::kPdfDoc) {
-    if (charcode < kPDFDocEncodingTableFirstChar)
+    if (charcode < kPDFDocEncodingTableFirstChar) {
       return nullptr;
+    }
 
     charcode -= kPDFDocEncodingTableFirstChar;
   } else {
-    if (charcode < kEncodingTableFirstChar)
+    if (charcode < kEncodingTableFirstChar) {
       return nullptr;
+    }
 
     charcode -= kEncodingTableFirstChar;
   }
diff --git a/core/fpdfapi/font/cpdf_fontglobals.cpp b/core/fpdfapi/font/cpdf_fontglobals.cpp
index 0f563d3..2d0e035 100644
--- a/core/fpdfapi/font/cpdf_fontglobals.cpp
+++ b/core/fpdfapi/font/cpdf_fontglobals.cpp
@@ -24,8 +24,9 @@
 CPDF_FontGlobals* g_FontGlobals = nullptr;
 
 RetainPtr<const CPDF_CMap> LoadPredefinedCMap(ByteStringView name) {
-  if (!name.IsEmpty() && name[0] == '/')
+  if (!name.IsEmpty() && name[0] == '/') {
     name = name.Last(name.GetLength() - 1);
+  }
   return pdfium::MakeRetain<CPDF_CMap>(name);
 }
 
@@ -65,8 +66,9 @@
     CPDF_Document* pDoc,
     CFX_FontMapper::StandardFont index) {
   auto it = m_StockMap.find(pDoc);
-  if (it == m_StockMap.end() || !it->second)
+  if (it == m_StockMap.end() || !it->second) {
     return nullptr;
+  }
 
   return it->second->GetFont(index);
 }
@@ -75,8 +77,9 @@
                            CFX_FontMapper::StandardFont index,
                            RetainPtr<CPDF_Font> pFont) {
   UnownedPtr<CPDF_Document> pKey(pDoc);
-  if (!pdfium::Contains(m_StockMap, pKey))
+  if (!pdfium::Contains(m_StockMap, pKey)) {
     m_StockMap[pKey] = std::make_unique<CFX_StockFontArray>();
+  }
   m_StockMap[pKey]->SetFont(index, std::move(pFont));
 }
 
@@ -84,8 +87,9 @@
   // Avoid constructing smart-pointer key as erase() doesn't invoke
   // transparent lookup in the same way find() does.
   auto it = m_StockMap.find(pDoc);
-  if (it != m_StockMap.end())
+  if (it != m_StockMap.end()) {
     m_StockMap.erase(it);
+  }
 }
 
 void CPDF_FontGlobals::LoadEmbeddedGB1CMaps() {
@@ -111,12 +115,14 @@
 RetainPtr<const CPDF_CMap> CPDF_FontGlobals::GetPredefinedCMap(
     const ByteString& name) {
   auto it = m_CMaps.find(name);
-  if (it != m_CMaps.end())
+  if (it != m_CMaps.end()) {
     return it->second;
+  }
 
   RetainPtr<const CPDF_CMap> pCMap = LoadPredefinedCMap(name.AsStringView());
-  if (!name.IsEmpty())
+  if (!name.IsEmpty()) {
     m_CMaps[name] = pCMap;
+  }
 
   return pCMap;
 }
diff --git a/core/fpdfapi/font/cpdf_simplefont.cpp b/core/fpdfapi/font/cpdf_simplefont.cpp
index 08d2157..40a1bbb 100644
--- a/core/fpdfapi/font/cpdf_simplefont.cpp
+++ b/core/fpdfapi/font/cpdf_simplefont.cpp
@@ -22,14 +22,15 @@
 namespace {
 
 void GetPredefinedEncoding(const ByteString& value, FontEncoding* basemap) {
-  if (value == pdfium::font_encodings::kWinAnsiEncoding)
+  if (value == pdfium::font_encodings::kWinAnsiEncoding) {
     *basemap = FontEncoding::kWinAnsi;
-  else if (value == pdfium::font_encodings::kMacRomanEncoding)
+  } else if (value == pdfium::font_encodings::kMacRomanEncoding) {
     *basemap = FontEncoding::kMacRoman;
-  else if (value == pdfium::font_encodings::kMacExpertEncoding)
+  } else if (value == pdfium::font_encodings::kMacExpertEncoding) {
     *basemap = FontEncoding::kMacExpert;
-  else if (value == pdfium::font_encodings::kPDFDocEncoding)
+  } else if (value == pdfium::font_encodings::kPDFDocEncoding) {
     *basemap = FontEncoding::kPdfDoc;
+  }
 }
 
 }  // namespace
@@ -45,22 +46,26 @@
 CPDF_SimpleFont::~CPDF_SimpleFont() = default;
 
 int CPDF_SimpleFont::GlyphFromCharCode(uint32_t charcode, bool* pVertGlyph) {
-  if (pVertGlyph)
+  if (pVertGlyph) {
     *pVertGlyph = false;
+  }
 
-  if (charcode > 0xff)
+  if (charcode > 0xff) {
     return -1;
+  }
 
   int index = m_GlyphIndex[charcode];
-  if (index == 0xffff)
+  if (index == 0xffff) {
     return -1;
+  }
 
   return index;
 }
 
 void CPDF_SimpleFont::LoadCharMetrics(int charcode) {
-  if (!m_Font.GetFaceRec())
+  if (!m_Font.GetFaceRec()) {
     return;
+  }
 
   if (charcode < 0 || charcode > 0xff) {
     return;
@@ -85,8 +90,9 @@
   int err =
       FT_Load_Glyph(face_rec, glyph_index,
                     FT_LOAD_NO_SCALE | FT_LOAD_IGNORE_GLOBAL_ADVANCE_WIDTH);
-  if (err)
+  if (err) {
     return;
+  }
 
   m_CharBBox[charcode] = face->GetGlyphBBox();
 
@@ -107,8 +113,9 @@
 void CPDF_SimpleFont::LoadCharWidths(const CPDF_Dictionary* font_desc) {
   RetainPtr<const CPDF_Array> width_array = m_pFontDict->GetArrayFor("Widths");
   m_bUseFontWidth = !width_array;
-  if (!width_array)
+  if (!width_array) {
     return;
+  }
 
   if (font_desc && font_desc->KeyExist("MissingWidth")) {
     int missing_width = font_desc->GetIntegerFor("MissingWidth");
@@ -117,33 +124,40 @@
 
   size_t width_start = m_pFontDict->GetIntegerFor("FirstChar", 0);
   size_t width_end = m_pFontDict->GetIntegerFor("LastChar", 0);
-  if (width_start > 255)
+  if (width_start > 255) {
     return;
+  }
 
-  if (width_end == 0 || width_end >= width_start + width_array->size())
+  if (width_end == 0 || width_end >= width_start + width_array->size()) {
     width_end = width_start + width_array->size() - 1;
-  if (width_end > 255)
+  }
+  if (width_end > 255) {
     width_end = 255;
-  for (size_t i = width_start; i <= width_end; i++)
+  }
+  for (size_t i = width_start; i <= width_end; i++) {
     m_CharWidth[i] = width_array->GetIntegerAt(i - width_start);
+  }
 }
 
 void CPDF_SimpleFont::LoadDifferences(const CPDF_Dictionary* encoding) {
   RetainPtr<const CPDF_Array> diffs = encoding->GetArrayFor("Differences");
-  if (!diffs)
+  if (!diffs) {
     return;
+  }
 
   m_CharNames.resize(kInternalTableSize);
   uint32_t cur_code = 0;
   for (uint32_t i = 0; i < diffs->size(); i++) {
     RetainPtr<const CPDF_Object> element = diffs->GetDirectObjectAt(i);
-    if (!element)
+    if (!element) {
       continue;
+    }
 
     const CPDF_Name* name = element->AsName();
     if (name) {
-      if (cur_code < m_CharNames.size())
+      if (cur_code < m_CharNames.size()) {
         m_CharNames[cur_code] = name->GetString();
+      }
       cur_code++;
     } else {
       cur_code = element->GetInteger();
@@ -169,37 +183,43 @@
       return;
     }
     if (FontStyleIsSymbolic(m_Flags) && m_BaseFontName == "Symbol") {
-      if (!bTrueType)
+      if (!bTrueType) {
         m_BaseEncoding = FontEncoding::kAdobeSymbol;
+      }
       return;
     }
     ByteString bsEncoding = pEncoding->GetString();
-    if (bsEncoding == pdfium::font_encodings::kMacExpertEncoding)
+    if (bsEncoding == pdfium::font_encodings::kMacExpertEncoding) {
       bsEncoding = pdfium::font_encodings::kWinAnsiEncoding;
+    }
     GetPredefinedEncoding(bsEncoding, &m_BaseEncoding);
     return;
   }
 
   const CPDF_Dictionary* pDict = pEncoding->AsDictionary();
-  if (!pDict)
+  if (!pDict) {
     return;
+  }
 
   if (m_BaseEncoding != FontEncoding::kAdobeSymbol &&
       m_BaseEncoding != FontEncoding::kZapfDingbats) {
     ByteString bsEncoding = pDict->GetByteStringFor("BaseEncoding");
-    if (bTrueType && bsEncoding == pdfium::font_encodings::kMacExpertEncoding)
+    if (bTrueType && bsEncoding == pdfium::font_encodings::kMacExpertEncoding) {
       bsEncoding = pdfium::font_encodings::kWinAnsiEncoding;
+    }
     GetPredefinedEncoding(bsEncoding, &m_BaseEncoding);
   }
-  if ((!bEmbedded || bTrueType) && m_BaseEncoding == FontEncoding::kBuiltin)
+  if ((!bEmbedded || bTrueType) && m_BaseEncoding == FontEncoding::kBuiltin) {
     m_BaseEncoding = FontEncoding::kStandard;
+  }
 
   LoadDifferences(pDict);
 }
 
 int CPDF_SimpleFont::GetCharWidthF(uint32_t charcode) {
-  if (charcode > 0xff)
+  if (charcode > 0xff) {
     charcode = 0;
+  }
 
   if (m_CharWidth[charcode] == 0xffff) {
     LoadCharMetrics(charcode);
@@ -211,11 +231,13 @@
 }
 
 FX_RECT CPDF_SimpleFont::GetCharBBox(uint32_t charcode) {
-  if (charcode > 0xff)
+  if (charcode > 0xff) {
     charcode = 0;
+  }
 
-  if (m_CharBBox[charcode].left == -1)
+  if (m_CharBBox[charcode].left == -1) {
     LoadCharMetrics(charcode);
+  }
 
   return m_CharBBox[charcode];
 }
@@ -223,8 +245,9 @@
 bool CPDF_SimpleFont::LoadCommon() {
   RetainPtr<const CPDF_Dictionary> pFontDesc =
       m_pFontDict->GetDictFor("FontDescriptor");
-  if (pFontDesc)
+  if (pFontDesc) {
     LoadFontDescriptor(pFontDesc.Get());
+  }
   LoadCharWidths(pFontDesc.Get());
   if (m_pFontFile) {
     if (m_BaseFontName.GetLength() > 7 && m_BaseFontName[6] == '+') {
@@ -233,8 +256,9 @@
   } else {
     LoadSubstFont();
   }
-  if (!FontStyleIsSymbolic(m_Flags))
+  if (!FontStyleIsSymbolic(m_Flags)) {
     m_BaseEncoding = FontEncoding::kStandard;
+  }
   LoadPDFEncoding(!!m_pFontFile, m_Font.IsTTFont());
   LoadGlyphMap();
   m_CharNames.clear();
@@ -301,18 +325,21 @@
 
 WideString CPDF_SimpleFont::UnicodeFromCharCode(uint32_t charcode) const {
   WideString unicode = CPDF_Font::UnicodeFromCharCode(charcode);
-  if (!unicode.IsEmpty())
+  if (!unicode.IsEmpty()) {
     return unicode;
+  }
   wchar_t ret = m_Encoding.UnicodeFromCharCode((uint8_t)charcode);
-  if (ret == 0)
+  if (ret == 0) {
     return WideString();
+  }
   return WideString(ret);
 }
 
 uint32_t CPDF_SimpleFont::CharCodeFromUnicode(wchar_t unicode) const {
   uint32_t ret = CPDF_Font::CharCodeFromUnicode(unicode);
-  if (ret)
+  if (ret) {
     return ret;
+  }
   return m_Encoding.CharCodeFromUnicode(unicode);
 }
 
diff --git a/core/fpdfapi/font/cpdf_tounicodemap.cpp b/core/fpdfapi/font/cpdf_tounicodemap.cpp
index e799477..566d791 100644
--- a/core/fpdfapi/font/cpdf_tounicodemap.cpp
+++ b/core/fpdfapi/font/cpdf_tounicodemap.cpp
@@ -41,8 +41,9 @@
       value = 0;
     }
   }
-  if (value)
+  if (value) {
     ret.InsertAtFront(value);
+  }
   return ret;
 }
 
@@ -57,16 +58,18 @@
 WideString CPDF_ToUnicodeMap::Lookup(uint32_t charcode) const {
   auto it = m_Multimap.find(charcode);
   if (it == m_Multimap.end()) {
-    if (!m_pBaseMap)
+    if (!m_pBaseMap) {
       return WideString();
+    }
     return WideString(
         m_pBaseMap->UnicodeFromCID(static_cast<uint16_t>(charcode)));
   }
 
   uint32_t value = *it->second.begin();
   wchar_t unicode = static_cast<wchar_t>(value & 0xffff);
-  if (unicode != 0xffff)
+  if (unicode != 0xffff) {
     return WideString(unicode);
+  }
 
   size_t index = value >> 16;
   return index < m_MultiCharVec.size() ? m_MultiCharVec[index] : WideString();
@@ -74,8 +77,9 @@
 
 uint32_t CPDF_ToUnicodeMap::ReverseLookup(wchar_t unicode) const {
   for (const auto& pair : m_Multimap) {
-    if (pdfium::Contains(pair.second, static_cast<uint32_t>(unicode)))
+    if (pdfium::Contains(pair.second, static_cast<uint32_t>(unicode))) {
       return pair.first;
+    }
   }
   return 0;
 }
@@ -110,17 +114,20 @@
   }
 
   size_t len = str.GetLength();
-  if (len <= 2 || str[0] != '<' || str[len - 1] != '>')
+  if (len <= 2 || str[0] != '<' || str[len - 1] != '>') {
     return std::nullopt;
+  }
 
   FX_SAFE_UINT32 code = 0;
   for (char c : str.Substr(1, len - 2)) {
-    if (!FXSYS_IsHexDigit(c))
+    if (!FXSYS_IsHexDigit(c)) {
       return std::nullopt;
+    }
 
     code = code * 16 + FXSYS_HexCharToInt(c);
-    if (!code.IsValid())
+    if (!code.IsValid()) {
       return std::nullopt;
+    }
   }
   return std::optional<uint32_t>(code.ValueOrDie());
 }
@@ -128,15 +135,17 @@
 // static
 WideString CPDF_ToUnicodeMap::StringToWideString(ByteStringView str) {
   size_t len = str.GetLength();
-  if (len <= 2 || str[0] != '<' || str[len - 1] != '>')
+  if (len <= 2 || str[0] != '<' || str[len - 1] != '>') {
     return WideString();
+  }
 
   WideString result;
   int byte_pos = 0;
   wchar_t ch = 0;
   for (char c : str.Substr(1, len - 2)) {
-    if (!FXSYS_IsHexDigit(c))
+    if (!FXSYS_IsHexDigit(c)) {
       break;
+    }
 
     ch = ch * 16 + FXSYS_HexCharToInt(c);
     byte_pos++;
@@ -374,8 +383,9 @@
 
 void CPDF_ToUnicodeMap::SetCode(uint32_t srccode, WideString destcode) {
   size_t len = destcode.GetLength();
-  if (len == 0)
+  if (len == 0) {
     return;
+  }
 
   if (len == 1) {
     InsertIntoMultimap(srccode, destcode[0]);
diff --git a/core/fpdfapi/font/cpdf_truetypefont.cpp b/core/fpdfapi/font/cpdf_truetypefont.cpp
index 255bead..dc7e084 100644
--- a/core/fpdfapi/font/cpdf_truetypefont.cpp
+++ b/core/fpdfapi/font/cpdf_truetypefont.cpp
@@ -21,8 +21,9 @@
   for (uint8_t c : kPrefix) {
     uint16_t unicode = c * 256 + charcode;
     uint16_t val = face->GetCharIndex(unicode);
-    if (val)
+    if (val) {
       return val;
+    }
   }
   return 0;
 }
@@ -106,8 +107,9 @@
         continue;
       }
       m_GlyphIndex[charcode] = face->GetNameIndex(name);
-      if (m_GlyphIndex[charcode] != 0 || !bToUnicode)
+      if (m_GlyphIndex[charcode] != 0 || !bToUnicode) {
         continue;
+      }
 
       WideString wsUnicode = UnicodeFromCharCode(charcode);
       if (!wsUnicode.IsEmpty()) {
@@ -118,15 +120,17 @@
     return;
   }
   if (UseTTCharmapMSSymbol(face)) {
-    for (uint32_t charcode = 0; charcode < 256; charcode++)
+    for (uint32_t charcode = 0; charcode < 256; charcode++) {
       m_GlyphIndex[charcode] = GetGlyphIndexForMSSymbol(face, charcode);
+    }
     if (HasAnyGlyphIndex()) {
       if (base_encoding != FontEncoding::kBuiltin) {
         for (uint32_t charcode = 0; charcode < 256; charcode++) {
           const char* name =
               GetAdobeCharName(base_encoding, m_CharNames, charcode);
-          if (name)
+          if (name) {
             m_Encoding.SetUnicode(charcode, UnicodeFromAdobeName(name));
+          }
         }
       } else if (UseTTCharmapMacRoman(face)) {
         for (uint32_t charcode = 0; charcode < 256; charcode++) {
@@ -142,8 +146,9 @@
       m_GlyphIndex[charcode] = face->GetCharIndex(charcode);
       m_Encoding.SetUnicode(charcode, UnicodeFromAppleRomanCharCode(charcode));
     }
-    if (m_pFontFile || HasAnyGlyphIndex())
+    if (m_pFontFile || HasAnyGlyphIndex()) {
       return;
+    }
   }
   if (m_Font.GetFace()->SelectCharMap(fxge::FontEncoding::kUnicode)) {
     pdfium::span<const uint16_t> unicodes =
@@ -163,17 +168,20 @@
       m_GlyphIndex[charcode] =
           face->GetCharIndex(m_Encoding.UnicodeFromCharCode(charcode));
     }
-    if (HasAnyGlyphIndex())
+    if (HasAnyGlyphIndex()) {
       return;
+    }
   }
-  for (int charcode = 0; charcode < 256; charcode++)
+  for (int charcode = 0; charcode < 256; charcode++) {
     m_GlyphIndex[charcode] = charcode;
+  }
 }
 
 bool CPDF_TrueTypeFont::HasAnyGlyphIndex() const {
   for (uint32_t charcode = 0; charcode < kInternalTableSize; charcode++) {
-    if (m_GlyphIndex[charcode])
+    if (m_GlyphIndex[charcode]) {
       return true;
+    }
   }
   return false;
 }
@@ -224,25 +232,30 @@
     } else if (platform_id == kNamePlatformMac) {
       support_mac = true;
     }
-    if (support_win && support_mac)
+    if (support_win && support_mac) {
       break;
+    }
   }
 
-  if (m_BaseEncoding == FontEncoding::kWinAnsi && !support_win)
+  if (m_BaseEncoding == FontEncoding::kWinAnsi && !support_win) {
     return support_mac ? FontEncoding::kMacRoman : FontEncoding::kBuiltin;
-  if (m_BaseEncoding == FontEncoding::kMacRoman && !support_mac)
+  }
+  if (m_BaseEncoding == FontEncoding::kMacRoman && !support_mac) {
     return support_win ? FontEncoding::kWinAnsi : FontEncoding::kBuiltin;
+  }
   return m_BaseEncoding;
 }
 
 void CPDF_TrueTypeFont::SetGlyphIndicesFromFirstChar() {
   int start_char = m_pFontDict->GetIntegerFor("FirstChar");
-  if (start_char < 0 || start_char > 255)
+  if (start_char < 0 || start_char > 255) {
     return;
+  }
 
   auto it = std::begin(m_GlyphIndex);
   std::fill(it, it + start_char, 0);
   uint16_t glyph = 3;
-  for (int charcode = start_char; charcode < 256; charcode++, glyph++)
+  for (int charcode = start_char; charcode < 256; charcode++, glyph++) {
     m_GlyphIndex[charcode] = glyph;
+  }
 }
diff --git a/core/fpdfapi/font/cpdf_type1font.cpp b/core/fpdfapi/font/cpdf_type1font.cpp
index 56c90c1..79f8432 100644
--- a/core/fpdfapi/font/cpdf_type1font.cpp
+++ b/core/fpdfapi/font/cpdf_type1font.cpp
@@ -43,8 +43,9 @@
 
 const char* GlyphNameRemap(const char* pStrAdobe) {
   for (const auto& element : kGlyphNameSubsts) {
-    if (!FXSYS_stricmp(element.m_pStrAdobe, pStrAdobe))
+    if (!FXSYS_stricmp(element.m_pStrAdobe, pStrAdobe)) {
       return element.m_pStrUnicode;
+    }
   }
   return nullptr;
 }
@@ -94,8 +95,9 @@
 
 bool CPDF_Type1Font::Load() {
   m_Base14Font = CFX_FontMapper::GetStandardFontName(&m_BaseFontName);
-  if (!IsBase14Font())
+  if (!IsBase14Font()) {
     return LoadCommon();
+  }
 
   RetainPtr<const CPDF_Dictionary> pFontDesc =
       m_pFontDict->GetDictFor("FontDescriptor");
@@ -109,19 +111,21 @@
   if (IsFixedFont()) {
     std::fill(std::begin(m_CharWidth), std::end(m_CharWidth), 600);
   }
-  if (m_Base14Font == CFX_FontMapper::kSymbol)
+  if (m_Base14Font == CFX_FontMapper::kSymbol) {
     m_BaseEncoding = FontEncoding::kAdobeSymbol;
-  else if (m_Base14Font == CFX_FontMapper::kDingbats)
+  } else if (m_Base14Font == CFX_FontMapper::kDingbats) {
     m_BaseEncoding = FontEncoding::kZapfDingbats;
-  else if (FontStyleIsNonSymbolic(m_Flags))
+  } else if (FontStyleIsNonSymbolic(m_Flags)) {
     m_BaseEncoding = FontEncoding::kStandard;
+  }
   return LoadCommon();
 }
 
 #if BUILDFLAG(IS_APPLE)
 int CPDF_Type1Font::GlyphFromCharCodeExt(uint32_t charcode) {
-  if (charcode > 0xff)
+  if (charcode > 0xff) {
     return -1;
+  }
 
   int index = m_ExtGID[static_cast<uint8_t>(charcode)];
   return index != 0xffff ? index : -1;
@@ -137,14 +141,16 @@
 #if BUILDFLAG(IS_APPLE)
   bool bCoreText = true;
   if (!m_Font.GetPlatformFont()) {
-    if (m_Font.GetPsName() == "DFHeiStd-W5")
+    if (m_Font.GetPsName() == "DFHeiStd-W5") {
       bCoreText = false;
+    }
 
     auto* pPlatform = CFX_GEModule::Get()->GetPlatform();
     pdfium::span<const uint8_t> span = m_Font.GetFontSpan();
     m_Font.SetPlatformFont(pPlatform->CreatePlatformFont(span));
-    if (!m_Font.GetPlatformFont())
+    if (!m_Font.GetPlatformFont()) {
       bCoreText = false;
+    }
   }
 #endif
   if (!IsEmbedded() && !IsSymbolicFont() && m_Font.IsTTFont()) {
@@ -175,14 +181,16 @@
       }
     }
     face->SelectCharMap(fxge::FontEncoding::kUnicode);
-    if (m_BaseEncoding == FontEncoding::kBuiltin)
+    if (m_BaseEncoding == FontEncoding::kBuiltin) {
       m_BaseEncoding = FontEncoding::kStandard;
+    }
 
     for (uint32_t charcode = 0; charcode < kInternalTableSize; charcode++) {
       const char* name =
           GetAdobeCharName(m_BaseEncoding, m_CharNames, charcode);
-      if (!name)
+      if (!name) {
         continue;
+      }
 
       m_Encoding.SetUnicode(charcode, UnicodeFromAdobeName(name));
       m_GlyphIndex[charcode] =
@@ -234,8 +242,9 @@
     for (uint32_t charcode = 0; charcode < kInternalTableSize; charcode++) {
       const char* name =
           GetAdobeCharName(m_BaseEncoding, m_CharNames, charcode);
-      if (!name)
+      if (!name) {
         continue;
+      }
 
       m_Encoding.SetUnicode(charcode, UnicodeFromAdobeName(name));
       const char* pStrUnicode = GlyphNameRemap(name);
@@ -245,8 +254,9 @@
       }
       m_GlyphIndex[charcode] = name_index;
       SetExtGID(name, charcode);
-      if (m_GlyphIndex[charcode] != 0)
+      if (m_GlyphIndex[charcode] != 0) {
         continue;
+      }
 
       if (UNSAFE_TODO(strcmp(name, kNotDef)) != 0 &&
           UNSAFE_TODO(strcmp(name, kSpace)) != 0) {
@@ -293,13 +303,15 @@
   for (size_t charcode = 0; charcode < kInternalTableSize; charcode++) {
     const char* name = GetAdobeCharName(m_BaseEncoding, m_CharNames,
                                         static_cast<uint32_t>(charcode));
-    if (!name)
+    if (!name) {
       continue;
+    }
 
     m_Encoding.SetUnicode(charcode, UnicodeFromAdobeName(name));
     m_GlyphIndex[charcode] = m_Font.GetFace()->GetNameIndex(name);
-    if (m_GlyphIndex[charcode] != 0)
+    if (m_GlyphIndex[charcode] != 0) {
       continue;
+    }
 
     if (UNSAFE_TODO(strcmp(name, kNotDef)) != 0 &&
         UNSAFE_TODO(strcmp(name, kSpace)) != 0) {
@@ -334,8 +346,9 @@
       kCFAllocatorDefault, name, kCFStringEncodingASCII, kCFAllocatorNull);
   m_ExtGID[charcode] =
       CGFontGetGlyphWithGlyphName((CGFontRef)m_Font.GetPlatformFont(), name_ct);
-  if (name_ct)
+  if (name_ct) {
     CFRelease(name_ct);
+  }
 }
 
 void CPDF_Type1Font::CalcExtGID(uint32_t charcode) {
diff --git a/core/fpdfapi/font/cpdf_type3char.cpp b/core/fpdfapi/font/cpdf_type3char.cpp
index ff9a579..2e7874b 100644
--- a/core/fpdfapi/font/cpdf_type3char.cpp
+++ b/core/fpdfapi/font/cpdf_type3char.cpp
@@ -33,15 +33,18 @@
 }
 
 bool CPDF_Type3Char::LoadBitmapFromSoleImageOfForm() {
-  if (m_pBitmap || !m_pForm)
+  if (m_pBitmap || !m_pForm) {
     return true;
+  }
 
-  if (m_bColored)
+  if (m_bColored) {
     return false;
+  }
 
   auto result = m_pForm->GetBitmapAndMatrixFromSoleImageOfForm();
-  if (!result.has_value())
+  if (!result.has_value()) {
     return false;
+  }
 
   std::tie(m_pBitmap, m_ImageMatrix) = result.value();
   m_pForm.reset();
diff --git a/core/fpdfapi/font/cpdf_type3font.cpp b/core/fpdfapi/font/cpdf_type3font.cpp
index 60d03cf..dfb0ff7 100644
--- a/core/fpdfapi/font/cpdf_type3font.cpp
+++ b/core/fpdfapi/font/cpdf_type3font.cpp
@@ -95,8 +95,9 @@
     }
   }
   m_pCharProcs = m_pFontDict->GetMutableDictFor("CharProcs");
-  if (m_pFontDict->GetDirectObjectFor("Encoding"))
+  if (m_pFontDict->GetDirectObjectFor("Encoding")) {
     LoadPDFEncoding(false, false);
+  }
   return true;
 }
 
@@ -107,24 +108,29 @@
 }
 
 CPDF_Type3Char* CPDF_Type3Font::LoadChar(uint32_t charcode) {
-  if (m_CharLoadingDepth >= kMaxType3FormLevel)
+  if (m_CharLoadingDepth >= kMaxType3FormLevel) {
     return nullptr;
+  }
 
   auto it = m_CacheMap.find(charcode);
-  if (it != m_CacheMap.end())
+  if (it != m_CacheMap.end()) {
     return it->second.get();
+  }
 
   const char* name = GetAdobeCharName(m_BaseEncoding, m_CharNames, charcode);
-  if (!name)
+  if (!name) {
     return nullptr;
+  }
 
-  if (!m_pCharProcs)
+  if (!m_pCharProcs) {
     return nullptr;
+  }
 
   RetainPtr<CPDF_Stream> pStream =
       ToStream(m_pCharProcs->GetMutableDirectObjectFor(name));
-  if (!pStream)
+  if (!pStream) {
     return nullptr;
+  }
 
   std::unique_ptr<CPDF_Font::FormIface> pForm = m_pFormFactory->CreateForm(
       m_pDocument, m_pFontResources ? m_pFontResources : m_pPageResources,
@@ -141,12 +147,14 @@
     pForm->ParseContentForType3Char(pNewChar.get());
   }
   it = m_CacheMap.find(charcode);
-  if (it != m_CacheMap.end())
+  if (it != m_CacheMap.end()) {
     return it->second.get();
+  }
 
   pNewChar->Transform(pForm.get(), m_FontMatrix);
-  if (pForm->HasPageObjects())
+  if (pForm->HasPageObjects()) {
     pNewChar->SetForm(std::move(pForm));
+  }
 
   CPDF_Type3Char* pCachedChar = pNewChar.get();
   m_CacheMap[charcode] = std::move(pNewChar);
@@ -154,11 +162,13 @@
 }
 
 int CPDF_Type3Font::GetCharWidthF(uint32_t charcode) {
-  if (charcode >= std::size(m_CharWidthL))
+  if (charcode >= std::size(m_CharWidthL)) {
     charcode = 0;
+  }
 
-  if (m_CharWidthL[charcode])
+  if (m_CharWidthL[charcode]) {
     return m_CharWidthL[charcode];
+  }
 
   const CPDF_Type3Char* pChar = LoadChar(charcode);
   return pChar ? pChar->width() : 0;
@@ -167,7 +177,8 @@
 FX_RECT CPDF_Type3Font::GetCharBBox(uint32_t charcode) {
   FX_RECT ret;
   const CPDF_Type3Char* pChar = LoadChar(charcode);
-  if (pChar)
+  if (pChar) {
     ret = pChar->bbox();
+  }
   return ret;
 }
diff --git a/core/fpdfapi/page/cpdf_allstates.cpp b/core/fpdfapi/page/cpdf_allstates.cpp
index 253ebb2..fd48d05 100644
--- a/core/fpdfapi/page/cpdf_allstates.cpp
+++ b/core/fpdfapi/page/cpdf_allstates.cpp
@@ -41,8 +41,9 @@
   CPDF_DictionaryLocker locker(pGS);
   for (const auto& it : locker) {
     RetainPtr<CPDF_Object> pObject = it.second->GetMutableDirect();
-    if (!pObject)
+    if (!pObject) {
       continue;
+    }
 
     uint32_t key = it.first.GetID();
     switch (key) {
@@ -62,12 +63,14 @@
         break;
       case FXBSTR_ID('D', 0, 0, 0): {
         const CPDF_Array* pDash = pObject->AsArray();
-        if (!pDash)
+        if (!pDash) {
           break;
+        }
 
         RetainPtr<const CPDF_Array> pArray = pDash->GetArrayAt(0);
-        if (!pArray)
+        if (!pArray) {
           break;
+        }
 
         SetLineDash(pArray.Get(), pDash->GetFloatAt(1));
         break;
@@ -77,8 +80,9 @@
         break;
       case FXBSTR_ID('F', 'o', 'n', 't'): {
         const CPDF_Array* pFont = pObject->AsArray();
-        if (!pFont)
+        if (!pFont) {
           break;
+        }
 
         mutable_text_state().SetFontSize(pFont->GetFloatAt(1));
         mutable_text_state().SetFont(
@@ -106,9 +110,10 @@
       case FXBSTR_ID('S', 'M', 'a', 's'): {
         RetainPtr<CPDF_Dictionary> pMaskDict = ToDictionary(pObject);
         mutable_general_state().SetSoftMask(pMaskDict);
-        if (pMaskDict)
+        if (pMaskDict) {
           mutable_general_state().SetSMaskMatrix(
               pParser->GetCurStates()->m_CTM);
+        }
         break;
       }
       case FXBSTR_ID('C', 'A', 0, 0):
@@ -121,8 +126,9 @@
         break;
       case FXBSTR_ID('O', 'P', 0, 0):
         mutable_general_state().SetStrokeOP(!!pObject->GetInteger());
-        if (!pGS->KeyExist("op"))
+        if (!pGS->KeyExist("op")) {
           mutable_general_state().SetFillOP(!!pObject->GetInteger());
+        }
         break;
       case FXBSTR_ID('o', 'p', 0, 0):
         mutable_general_state().SetFillOP(!!pObject->GetInteger());
diff --git a/core/fpdfapi/page/cpdf_annotcontext.cpp b/core/fpdfapi/page/cpdf_annotcontext.cpp
index f6bd893..a8ff06c 100644
--- a/core/fpdfapi/page/cpdf_annotcontext.cpp
+++ b/core/fpdfapi/page/cpdf_annotcontext.cpp
@@ -25,8 +25,9 @@
 CPDF_AnnotContext::~CPDF_AnnotContext() = default;
 
 void CPDF_AnnotContext::SetForm(RetainPtr<CPDF_Stream> pStream) {
-  if (!pStream)
+  if (!pStream) {
     return;
+  }
 
   // Reset the annotation matrix to be the identity matrix, since the
   // appearance stream already takes matrix into account.
diff --git a/core/fpdfapi/page/cpdf_basedcs.cpp b/core/fpdfapi/page/cpdf_basedcs.cpp
index c8988bb..4ea6813 100644
--- a/core/fpdfapi/page/cpdf_basedcs.cpp
+++ b/core/fpdfapi/page/cpdf_basedcs.cpp
@@ -12,6 +12,7 @@
 
 void CPDF_BasedCS::EnableStdConversion(bool bEnabled) {
   CPDF_ColorSpace::EnableStdConversion(bEnabled);
-  if (m_pBaseCS)
+  if (m_pBaseCS) {
     m_pBaseCS->EnableStdConversion(bEnabled);
+  }
 }
diff --git a/core/fpdfapi/page/cpdf_clippath.cpp b/core/fpdfapi/page/cpdf_clippath.cpp
index 9381617..d9d2ed8 100644
--- a/core/fpdfapi/page/cpdf_clippath.cpp
+++ b/core/fpdfapi/page/cpdf_clippath.cpp
@@ -91,8 +91,9 @@
       CFX_PointF point2 = old_path.GetPoint(2);
       CFX_FloatRect old_rect(point0.x, point0.y, point2.x, point2.y);
       CFX_FloatRect new_rect = path.GetBoundingBox();
-      if (old_rect.Contains(new_rect))
+      if (old_rect.Contains(new_rect)) {
         pData->m_PathAndTypeList.pop_back();
+      }
     }
   }
   AppendPath(path, type);
@@ -103,29 +104,34 @@
   static constexpr size_t kMaxTextObjects = 1024;
   PathData* pData = m_Ref.GetPrivateCopy();
   if (pData->m_TextList.size() + pTexts->size() <= kMaxTextObjects) {
-    for (size_t i = 0; i < pTexts->size(); i++)
+    for (size_t i = 0; i < pTexts->size(); i++) {
       pData->m_TextList.push_back(std::move((*pTexts)[i]));
+    }
     pData->m_TextList.push_back(nullptr);
   }
   pTexts->clear();
 }
 
 void CPDF_ClipPath::CopyClipPath(const CPDF_ClipPath& that) {
-  if (*this == that || !that.HasRef())
+  if (*this == that || !that.HasRef()) {
     return;
+  }
 
-  for (size_t i = 0; i < that.GetPathCount(); ++i)
+  for (size_t i = 0; i < that.GetPathCount(); ++i) {
     AppendPath(that.GetPath(i), that.GetClipType(i));
+  }
 }
 
 void CPDF_ClipPath::Transform(const CFX_Matrix& matrix) {
   PathData* pData = m_Ref.GetPrivateCopy();
-  for (auto& obj : pData->m_PathAndTypeList)
+  for (auto& obj : pData->m_PathAndTypeList) {
     obj.first.Transform(matrix);
+  }
 
   for (auto& text : pData->m_TextList) {
-    if (text)
+    if (text) {
       text->Transform(matrix);
+    }
   }
 }
 
@@ -135,8 +141,9 @@
     : m_PathAndTypeList(that.m_PathAndTypeList),
       m_TextList(that.m_TextList.size()) {
   for (size_t i = 0; i < that.m_TextList.size(); ++i) {
-    if (that.m_TextList[i])
+    if (that.m_TextList[i]) {
       m_TextList[i] = that.m_TextList[i]->Clone();
+    }
   }
 }
 
diff --git a/core/fpdfapi/page/cpdf_colorspace.cpp b/core/fpdfapi/page/cpdf_colorspace.cpp
index b9949f8..d620ee0 100644
--- a/core/fpdfapi/page/cpdf_colorspace.cpp
+++ b/core/fpdfapi/page/cpdf_colorspace.cpp
@@ -88,8 +88,9 @@
 
 void GetDefaultBlackPoint(pdfium::span<float> pPoints) {
   static constexpr float kDefaultValue = 0.0f;
-  for (size_t i = 0; i < kBlackWhitePointCount; ++i)
+  for (size_t i = 0; i < kBlackWhitePointCount; ++i) {
     pPoints[i] = kDefaultValue;
+  }
 }
 
 void GetBlackPoint(const CPDF_Dictionary* pDict, pdfium::span<float> pPoints) {
@@ -111,11 +112,13 @@
 
 bool GetWhitePoint(const CPDF_Dictionary* pDict, pdfium::span<float> pPoints) {
   RetainPtr<const CPDF_Array> pParam = pDict->GetArrayFor("WhitePoint");
-  if (!pParam || pParam->size() != kBlackWhitePointCount)
+  if (!pParam || pParam->size() != kBlackWhitePointCount) {
     return false;
+  }
 
-  for (size_t i = 0; i < kBlackWhitePointCount; ++i)
+  for (size_t i = 0; i < kBlackWhitePointCount; ++i) {
     pPoints[i] = pParam->GetFloatAt(i);
+  }
   return pPoints[0] > 0.0f && pPoints[1] == 1.0f && pPoints[2] > 0.0f;
 }
 
@@ -329,8 +332,9 @@
 
   Matrix_3by3 Inverse() {
     float det = a * (e * i - f * h) - b * (i * d - f * g) + c * (d * h - e * g);
-    if (fabs(det) < std::numeric_limits<float>::epsilon())
+    if (fabs(det) < std::numeric_limits<float>::epsilon()) {
       return Matrix_3by3();
+    }
 
     return Matrix_3by3(
         (e * i - f * h) / det, -(b * i - c * h) / det, (b * f - c * e) / det,
@@ -480,14 +484,18 @@
 // static
 RetainPtr<CPDF_ColorSpace> CPDF_ColorSpace::GetStockCSForName(
     const ByteString& name) {
-  if (name == "DeviceRGB" || name == "RGB")
+  if (name == "DeviceRGB" || name == "RGB") {
     return GetStockCS(Family::kDeviceRGB);
-  if (name == "DeviceGray" || name == "G")
+  }
+  if (name == "DeviceGray" || name == "G") {
     return GetStockCS(Family::kDeviceGray);
-  if (name == "DeviceCMYK" || name == "CMYK")
+  }
+  if (name == "DeviceCMYK" || name == "CMYK") {
     return GetStockCS(Family::kDeviceCMYK);
-  if (name == "Pattern")
+  }
+  if (name == "Pattern") {
     return GetStockCS(Family::kPattern);
+  }
   return nullptr;
 }
 
@@ -496,16 +504,19 @@
     CPDF_Document* pDoc,
     const CPDF_Object* pObj,
     std::set<const CPDF_Object*>* pVisited) {
-  if (!pObj)
+  if (!pObj) {
     return nullptr;
+  }
 
-  if (pdfium::Contains(*pVisited, pObj))
+  if (pdfium::Contains(*pVisited, pObj)) {
     return nullptr;
+  }
 
   ScopedSetInsertion<const CPDF_Object*> insertion(pVisited, pObj);
 
-  if (pObj->IsName())
+  if (pObj->IsName()) {
     return GetStockCSForName(pObj->GetString());
+  }
 
   if (const CPDF_Stream* pStream = pObj->AsStream()) {
     RetainPtr<const CPDF_Dictionary> pDict = pStream->GetDict();
@@ -515,34 +526,40 @@
       if (pValue) {
         RetainPtr<CPDF_ColorSpace> pRet =
             GetStockCSForName(pValue->GetString());
-        if (pRet)
+        if (pRet) {
           return pRet;
+        }
       }
     }
     return nullptr;
   }
 
   const CPDF_Array* pArray = pObj->AsArray();
-  if (!pArray || pArray->IsEmpty())
+  if (!pArray || pArray->IsEmpty()) {
     return nullptr;
+  }
 
   RetainPtr<const CPDF_Object> pFamilyObj = pArray->GetDirectObjectAt(0);
-  if (!pFamilyObj)
+  if (!pFamilyObj) {
     return nullptr;
+  }
 
   ByteString familyname = pFamilyObj->GetString();
-  if (pArray->size() == 1)
+  if (pArray->size() == 1) {
     return GetStockCSForName(familyname);
+  }
 
   RetainPtr<CPDF_ColorSpace> pCS =
       CPDF_ColorSpace::AllocateColorSpace(familyname.AsStringView());
-  if (!pCS)
+  if (!pCS) {
     return nullptr;
+  }
 
   pCS->m_pArray.Reset(pArray);
   pCS->m_nComponents = pCS->v_Load(pDoc, pArray, pVisited);
-  if (pCS->m_nComponents == 0)
+  if (pCS->m_nComponents == 0) {
     return nullptr;
+  }
 
   return pCS;
 }
@@ -593,8 +610,9 @@
   float min;
   float max;
   std::vector<float> buf(m_nComponents);
-  for (uint32_t i = 0; i < m_nComponents; i++)
+  for (uint32_t i = 0; i < m_nComponents; i++) {
     GetDefaultValue(i, &buf[i], &min, &max);
+  }
 
   return buf;
 }
@@ -647,10 +665,11 @@
 }
 
 void CPDF_ColorSpace::EnableStdConversion(bool bEnabled) {
-  if (bEnabled)
+  if (bEnabled) {
     m_dwStdConversion++;
-  else if (m_dwStdConversion)
+  } else if (m_dwStdConversion) {
     m_dwStdConversion--;
+  }
 }
 
 bool CPDF_ColorSpace::IsNormal() const {
@@ -684,8 +703,9 @@
                               const CPDF_Array* pArray,
                               std::set<const CPDF_Object*>* pVisited) {
   RetainPtr<const CPDF_Dictionary> pDict = pArray->GetDictAt(1);
-  if (!pDict)
+  if (!pDict) {
     return 0;
+  }
 
   if (!GetWhitePoint(pDict.Get(), white_point_)) {
     return 0;
@@ -733,8 +753,9 @@
                              const CPDF_Array* pArray,
                              std::set<const CPDF_Object*>* pVisited) {
   RetainPtr<const CPDF_Dictionary> pDict = pArray->GetDictAt(1);
-  if (!pDict)
+  if (!pDict) {
     return 0;
+  }
 
   if (!GetWhitePoint(pDict.Get(), white_point_)) {
     return 0;
@@ -828,8 +849,9 @@
                             const CPDF_Array* pArray,
                             std::set<const CPDF_Object*>* pVisited) {
   RetainPtr<const CPDF_Dictionary> pDict = pArray->GetDictAt(1);
-  if (!pDict)
+  if (!pDict) {
     return 0;
+  }
 
   if (!GetWhitePoint(pDict.Get(), white_point_)) {
     return 0;
@@ -857,20 +879,23 @@
   float X;
   float Y;
   float Z;
-  if (L < 0.2069f)
+  if (L < 0.2069f) {
     X = 0.957f * 0.12842f * (L - 0.1379f);
-  else
+  } else {
     X = 0.957f * L * L * L;
+  }
 
-  if (M < 0.2069f)
+  if (M < 0.2069f) {
     Y = 0.12842f * (M - 0.1379f);
-  else
+  } else {
     Y = M * M * M;
+  }
 
-  if (N < 0.2069f)
+  if (N < 0.2069f) {
     Z = 1.0889f * 0.12842f * (N - 0.1379f);
-  else
+  } else {
     Z = 1.0889f * N * N * N;
+  }
 
   return XYZ_to_sRGB(X, Y, Z);
 }
@@ -911,8 +936,9 @@
                                  const CPDF_Array* pArray,
                                  std::set<const CPDF_Object*>* pVisited) {
   RetainPtr<const CPDF_Stream> pStream = pArray->GetStreamAt(1);
-  if (!pStream)
+  if (!pStream) {
     return 0;
+  }
 
   // The PDF 1.7 spec says the number of components must be valid. While some
   // PDF viewers tolerate invalid values, Acrobat does not, so be consistent
@@ -990,15 +1016,17 @@
   const uint32_t nComponents = ComponentCount();
   DCHECK(fxcodec::IccTransform::IsValidIccComponents(nComponents));
   int nMaxColors = 1;
-  for (uint32_t i = 0; i < nComponents; i++)
+  for (uint32_t i = 0; i < nComponents; i++) {
     nMaxColors *= 52;
+  }
 
   bool bTranslate = nComponents > 3;
   if (!bTranslate) {
     FX_SAFE_INT32 nPixelCount = image_width;
     nPixelCount *= image_height;
-    if (nPixelCount.IsValid())
+    if (nPixelCount.IsValid()) {
       bTranslate = nPixelCount.ValueOrDie() < nMaxColors * 3 / 2;
+    }
   }
   if (bTranslate && profile_->IsSupported()) {
     profile_->TranslateScanline(dest_span, src_span, pixels);
@@ -1045,8 +1073,9 @@
   if (profile_->IsSupported()) {
     return profile_->IsNormal();
   }
-  if (m_pBaseCS)
+  if (m_pBaseCS) {
     return m_pBaseCS->IsNormal();
+  }
   return false;
 }
 
@@ -1057,15 +1086,18 @@
     uint32_t nExpectedComponents) {
   RetainPtr<const CPDF_Object> pAlterCSObj =
       pDict->GetDirectObjectFor("Alternate");
-  if (!pAlterCSObj)
+  if (!pAlterCSObj) {
     return false;
+  }
 
   auto pAlterCS = CPDF_ColorSpace::Load(pDoc, pAlterCSObj.Get(), pVisited);
-  if (!pAlterCS)
+  if (!pAlterCS) {
     return false;
+  }
 
-  if (pAlterCS->GetFamily() == Family::kPattern)
+  if (pAlterCS->GetFamily() == Family::kPattern) {
     return false;
+  }
 
   if (pAlterCS->ComponentCount() != nExpectedComponents) {
     return false;
@@ -1078,12 +1110,15 @@
 // static
 RetainPtr<CPDF_ColorSpace> CPDF_ICCBasedCS::GetStockAlternateProfile(
     uint32_t nComponents) {
-  if (nComponents == 1)
+  if (nComponents == 1) {
     return GetStockCS(Family::kDeviceGray);
-  if (nComponents == 3)
+  }
+  if (nComponents == 3) {
     return GetStockCS(Family::kDeviceRGB);
-  if (nComponents == 4)
+  }
+  if (nComponents == 4) {
     return GetStockCS(Family::kDeviceCMYK);
+  }
   NOTREACHED();
 }
 
@@ -1092,8 +1127,9 @@
                                               uint32_t nComponents) {
   DCHECK(fxcodec::IccTransform::IsValidIccComponents(nComponents));
   RetainPtr<const CPDF_Array> pRanges = pDict->GetArrayFor("Range");
-  if (pRanges && pRanges->size() >= nComponents * 2)
+  if (pRanges && pRanges->size() >= nComponents * 2) {
     return ReadArrayElementsToVector(pRanges.Get(), nComponents * 2);
+  }
 
   std::vector<float> ranges;
   ranges.reserve(nComponents * 2);
@@ -1121,19 +1157,23 @@
                                    const CPDF_Array* pArray,
                                    std::set<const CPDF_Object*>* pVisited) {
   m_IsNoneType = pArray->GetByteStringAt(1) == "None";
-  if (m_IsNoneType)
+  if (m_IsNoneType) {
     return 1;
+  }
 
   RetainPtr<const CPDF_Object> pAltArray = pArray->GetDirectObjectAt(2);
-  if (HasSameArray(pAltArray.Get()))
+  if (HasSameArray(pAltArray.Get())) {
     return 0;
+  }
 
   m_pBaseCS = Load(pDoc, pAltArray.Get(), pVisited);
-  if (!m_pBaseCS)
+  if (!m_pBaseCS) {
     return 0;
+  }
 
-  if (m_pBaseCS->IsSpecial())
+  if (m_pBaseCS->IsSpecial()) {
     return 0;
+  }
 
   RetainPtr<const CPDF_Object> pFuncObj = pArray->GetDirectObjectAt(3);
   if (pFuncObj && !pFuncObj->IsName()) {
@@ -1187,20 +1227,24 @@
                                 const CPDF_Array* pArray,
                                 std::set<const CPDF_Object*>* pVisited) {
   RetainPtr<const CPDF_Array> pObj = ToArray(pArray->GetDirectObjectAt(1));
-  if (!pObj)
+  if (!pObj) {
     return 0;
+  }
 
   RetainPtr<const CPDF_Object> pAltCS = pArray->GetDirectObjectAt(2);
-  if (!pAltCS || HasSameArray(pAltCS.Get()))
+  if (!pAltCS || HasSameArray(pAltCS.Get())) {
     return 0;
+  }
 
   m_pBaseCS = Load(pDoc, pAltCS.Get(), pVisited);
   m_pFunc = CPDF_Function::Load(pArray->GetDirectObjectAt(3));
-  if (!m_pBaseCS || !m_pFunc)
+  if (!m_pBaseCS || !m_pFunc) {
     return 0;
+  }
 
-  if (m_pBaseCS->IsSpecial())
+  if (m_pBaseCS->IsSpecial()) {
     return 0;
+  }
 
   if (m_pFunc->OutputCount() < m_pBaseCS->ComponentCount()) {
     return 0;
diff --git a/core/fpdfapi/page/cpdf_contentmarks.cpp b/core/fpdfapi/page/cpdf_contentmarks.cpp
index 7c9669f..b866da2 100644
--- a/core/fpdfapi/page/cpdf_contentmarks.cpp
+++ b/core/fpdfapi/page/cpdf_contentmarks.cpp
@@ -18,8 +18,9 @@
 
 std::unique_ptr<CPDF_ContentMarks> CPDF_ContentMarks::Clone() {
   auto result = std::make_unique<CPDF_ContentMarks>();
-  if (m_pMarkData)
+  if (m_pMarkData) {
     result->m_pMarkData = pdfium::MakeRetain<MarkData>(*m_pMarkData);
+  }
   return result;
 }
 
@@ -69,20 +70,23 @@
 }
 
 void CPDF_ContentMarks::EnsureMarkDataExists() {
-  if (!m_pMarkData)
+  if (!m_pMarkData) {
     m_pMarkData = pdfium::MakeRetain<MarkData>();
+  }
 }
 
 size_t CPDF_ContentMarks::FindFirstDifference(
     const CPDF_ContentMarks* other) const {
-  if (m_pMarkData == other->m_pMarkData)
+  if (m_pMarkData == other->m_pMarkData) {
     return CountItems();
+  }
 
   size_t min_len = std::min(CountItems(), other->CountItems());
 
   for (size_t i = 0; i < min_len; ++i) {
-    if (GetItem(i) != other->GetItem(i))
+    if (GetItem(i) != other->GetItem(i)) {
       return i;
+    }
   }
   return min_len;
 }
@@ -101,8 +105,9 @@
 bool CPDF_ContentMarks::MarkData::ContainsItem(
     const CPDF_ContentMarkItem* pItem) const {
   for (const auto& pMark : m_Marks) {
-    if (pMark == pItem)
+    if (pMark == pItem) {
       return true;
+    }
   }
   return false;
 }
@@ -121,8 +126,9 @@
 int CPDF_ContentMarks::MarkData::GetMarkedContentID() const {
   for (const auto& pMark : m_Marks) {
     RetainPtr<const CPDF_Dictionary> pDict = pMark->GetParam();
-    if (pDict && pDict->KeyExist("MCID"))
+    if (pDict && pDict->KeyExist("MCID")) {
       return pDict->GetIntegerFor("MCID");
+    }
   }
   return -1;
 }
diff --git a/core/fpdfapi/page/cpdf_contentparser.cpp b/core/fpdfapi/page/cpdf_contentparser.cpp
index e21e817..7305d2d 100644
--- a/core/fpdfapi/page/cpdf_contentparser.cpp
+++ b/core/fpdfapi/page/cpdf_contentparser.cpp
@@ -51,8 +51,9 @@
   }
 
   const CPDF_Array* pArray = pContent->AsArray();
-  if (pArray && HandlePageContentArray(pArray))
+  if (pArray && HandlePageContentArray(pArray)) {
     return;
+  }
 
   HandlePageContentFailure();
 }
@@ -70,8 +71,9 @@
   DCHECK(m_pPageObjectHolder);
   CFX_Matrix form_matrix =
       m_pPageObjectHolder->GetDict()->GetMatrixFor("Matrix");
-  if (pGraphicStates)
+  if (pGraphicStates) {
     form_matrix.Concat(pGraphicStates->current_transformation_matrix());
+  }
 
   RetainPtr<const CPDF_Array> pBBox =
       m_pPageObjectHolder->GetDict()->GetArrayFor("BBox");
@@ -82,12 +84,14 @@
     ClipPath.Emplace();
     ClipPath.AppendFloatRect(form_bbox);
     ClipPath.Transform(form_matrix);
-    if (pParentMatrix)
+    if (pParentMatrix) {
       ClipPath.Transform(*pParentMatrix);
+    }
 
     form_bbox = form_matrix.TransformRect(form_bbox);
-    if (pParentMatrix)
+    if (pParentMatrix) {
       form_bbox = pParentMatrix->TransformRect(form_bbox);
+    }
   }
 
   RetainPtr<CPDF_Dictionary> pResources =
@@ -129,21 +133,25 @@
 bool CPDF_ContentParser::Continue(PauseIndicatorIface* pPause) {
   while (m_CurrentStage == Stage::kGetContent) {
     m_CurrentStage = GetContent();
-    if (pPause && pPause->NeedToPauseNow())
+    if (pPause && pPause->NeedToPauseNow()) {
       return true;
+    }
   }
 
-  if (m_CurrentStage == Stage::kPrepareContent)
+  if (m_CurrentStage == Stage::kPrepareContent) {
     m_CurrentStage = PrepareContent();
+  }
 
   while (m_CurrentStage == Stage::kParse) {
     m_CurrentStage = Parse();
-    if (pPause && pPause->NeedToPauseNow())
+    if (pPause && pPause->NeedToPauseNow()) {
       return true;
+    }
   }
 
-  if (m_CurrentStage == Stage::kCheckClip)
+  if (m_CurrentStage == Stage::kCheckClip) {
     m_CurrentStage = CheckClip();
+  }
 
   DCHECK_EQ(m_CurrentStage, Stage::kComplete);
   return false;
@@ -179,8 +187,9 @@
     m_StreamSegmentOffsets.push_back(safe_size.ValueOrDie());
     safe_size += stream->GetSize();
     safe_size += 1;
-    if (!safe_size.IsValid())
+    if (!safe_size.IsValid()) {
       return Stage::kComplete;
+    }
   }
 
   const size_t buffer_size = safe_size.ValueOrDie();
@@ -211,11 +220,13 @@
         m_pPageObjectHolder->GetBBox(), nullptr, &m_RecursionState);
     m_pParser->GetCurStates()->mutable_color_state().SetDefault();
   }
-  if (m_CurrentOffset >= GetData().size())
+  if (m_CurrentOffset >= GetData().size()) {
     return Stage::kCheckClip;
+  }
 
-  if (m_StreamSegmentOffsets.empty())
+  if (m_StreamSegmentOffsets.empty()) {
     m_StreamSegmentOffsets.push_back(0);
+  }
 
   static constexpr uint32_t kParseStepLimit = 100;
   m_CurrentOffset += m_pParser->Parse(GetData(), m_CurrentOffset,
@@ -252,8 +263,9 @@
     CFX_PointF point0 = path.GetPoint(0);
     CFX_PointF point2 = path.GetPoint(2);
     CFX_FloatRect old_rect(point0.x, point0.y, point2.x, point2.y);
-    if (old_rect.Contains(pObj->GetRect()))
+    if (old_rect.Contains(pObj->GetRect())) {
       clip_path.SetNull();
+    }
   }
   return Stage::kComplete;
 }
@@ -267,8 +279,9 @@
 
 bool CPDF_ContentParser::HandlePageContentArray(const CPDF_Array* pArray) {
   m_nStreams = fxcrt::CollectionSize<uint32_t>(*pArray);
-  if (m_nStreams == 0)
+  if (m_nStreams == 0) {
     return false;
+  }
 
   m_StreamArray.resize(m_nStreams);
   return true;
diff --git a/core/fpdfapi/page/cpdf_dib.cpp b/core/fpdfapi/page/cpdf_dib.cpp
index fa2e93c..6760e69 100644
--- a/core/fpdfapi/page/cpdf_dib.cpp
+++ b/core/fpdfapi/page/cpdf_dib.cpp
@@ -242,18 +242,21 @@
 CPDF_DIB::JpxSMaskInlineData::~JpxSMaskInlineData() = default;
 
 bool CPDF_DIB::Load() {
-  if (!LoadInternal(nullptr, nullptr))
+  if (!LoadInternal(nullptr, nullptr)) {
     return false;
+  }
 
-  if (CreateDecoder(0) == LoadState::kFail)
+  if (CreateDecoder(0) == LoadState::kFail) {
     return false;
+  }
 
   return ContinueInternal();
 }
 
 bool CPDF_DIB::ContinueToLoadMask() {
-  if (m_pColorSpace && m_bStdCS)
+  if (m_pColorSpace && m_bStdCS) {
     m_pColorSpace->EnableStdConversion(true);
+  }
 
   return ContinueInternal();
 }
@@ -277,8 +280,9 @@
   }
 
   std::optional<uint32_t> pitch = fxge::CalculatePitch32(GetBPP(), GetWidth());
-  if (!pitch.has_value())
+  if (!pitch.has_value()) {
     return false;
+  }
 
   m_LineBuf = DataVector<uint8_t>(pitch.value());
   LoadPalette();
@@ -287,8 +291,9 @@
     // `FXDIB_Format::kBgraPremul`
     SetFormat(FXDIB_Format::kBgra);
     pitch = fxge::CalculatePitch32(GetBPP(), GetWidth());
-    if (!pitch.has_value())
+    if (!pitch.has_value()) {
       return false;
+    }
     m_MaskBuf = DataVector<uint8_t>(pitch.value());
   }
   SetPitch(pitch.value());
@@ -308,11 +313,13 @@
   m_GroupFamily = GroupFamily;
   m_bLoadMask = bLoadMask;
 
-  if (!m_pStream->IsInline())
+  if (!m_pStream->IsInline()) {
     pFormResources = nullptr;
+  }
 
-  if (!LoadInternal(pFormResources, pPageResources))
+  if (!LoadInternal(pFormResources, pPageResources)) {
     return LoadState::kFail;
+  }
 
   uint8_t resolution_levels_to_skip = 0;
   if (max_size_required.width != 0 && max_size_required.height != 0) {
@@ -322,11 +329,13 @@
   }
 
   LoadState iCreatedDecoder = CreateDecoder(resolution_levels_to_skip);
-  if (iCreatedDecoder == LoadState::kFail)
+  if (iCreatedDecoder == LoadState::kFail) {
     return LoadState::kFail;
+  }
 
-  if (!ContinueToLoadMask())
+  if (!ContinueToLoadMask()) {
     return LoadState::kFail;
+  }
 
   LoadState iLoadedMask = m_bHasMask ? StartLoadMask() : LoadState::kSuccess;
   if (iCreatedDecoder == LoadState::kContinue ||
@@ -336,24 +345,29 @@
 
   DCHECK_EQ(iCreatedDecoder, LoadState::kSuccess);
   DCHECK_EQ(iLoadedMask, LoadState::kSuccess);
-  if (m_pColorSpace && m_bStdCS)
+  if (m_pColorSpace && m_bStdCS) {
     m_pColorSpace->EnableStdConversion(false);
+  }
   return LoadState::kSuccess;
 }
 
 CPDF_DIB::LoadState CPDF_DIB::ContinueLoadDIBBase(PauseIndicatorIface* pPause) {
-  if (m_Status == LoadState::kContinue)
+  if (m_Status == LoadState::kContinue) {
     return ContinueLoadMaskDIB(pPause);
+  }
 
   ByteString decoder = m_pStreamAcc->GetImageDecoder();
-  if (decoder == "JPXDecode")
+  if (decoder == "JPXDecode") {
     return LoadState::kFail;
+  }
 
-  if (decoder != "JBIG2Decode")
+  if (decoder != "JBIG2Decode") {
     return LoadState::kSuccess;
+  }
 
-  if (m_Status == LoadState::kFail)
+  if (m_Status == LoadState::kFail) {
     return LoadState::kFail;
+  }
 
   FXCODEC_STATUS iDecodeStatus;
   if (!m_pJbig2Context) {
@@ -393,8 +407,9 @@
     m_pGlobalAcc.Reset();
     return LoadState::kFail;
   }
-  if (iDecodeStatus == FXCODEC_STATUS::kDecodeToBeContinued)
+  if (iDecodeStatus == FXCODEC_STATUS::kDecodeToBeContinued) {
     return LoadState::kContinue;
+  }
 
   LoadState iContinueStatus = LoadState::kSuccess;
   if (m_bHasMask) {
@@ -403,23 +418,27 @@
       m_Status = LoadState::kContinue;
     }
   }
-  if (iContinueStatus == LoadState::kContinue)
+  if (iContinueStatus == LoadState::kContinue) {
     return LoadState::kContinue;
+  }
 
-  if (m_pColorSpace && m_bStdCS)
+  if (m_pColorSpace && m_bStdCS) {
     m_pColorSpace->EnableStdConversion(false);
+  }
   return iContinueStatus;
 }
 
 bool CPDF_DIB::LoadColorInfo(const CPDF_Dictionary* pFormResources,
                              const CPDF_Dictionary* pPageResources) {
   std::optional<DecoderArray> decoder_array = GetDecoderArray(m_pDict);
-  if (!decoder_array.has_value())
+  if (!decoder_array.has_value()) {
     return false;
+  }
 
   m_bpc_orig = m_pDict->GetIntegerFor("BitsPerComponent");
-  if (!IsMaybeValidBitsPerComponent(m_bpc_orig))
+  if (!IsMaybeValidBitsPerComponent(m_bpc_orig)) {
     return false;
+  }
 
   m_bImageMask = m_pDict->GetBooleanFor("ImageMask", /*bDefault=*/false);
 
@@ -440,16 +459,20 @@
 
   RetainPtr<const CPDF_Object> pCSObj =
       m_pDict->GetDirectObjectFor("ColorSpace");
-  if (!pCSObj)
+  if (!pCSObj) {
     return false;
+  }
 
   auto* pDocPageData = CPDF_DocPageData::FromDocument(m_pDocument);
-  if (pFormResources)
+  if (pFormResources) {
     m_pColorSpace = pDocPageData->GetColorSpace(pCSObj.Get(), pFormResources);
-  if (!m_pColorSpace)
+  }
+  if (!m_pColorSpace) {
     m_pColorSpace = pDocPageData->GetColorSpace(pCSObj.Get(), pPageResources);
-  if (!m_pColorSpace)
+  }
+  if (!m_pColorSpace) {
     return false;
+  }
 
   // If the checks above failed to find a colorspace, and the next line to set
   // |m_nComponents| does not get reached, then a decoder can try to set
@@ -459,27 +482,31 @@
   m_Family = m_pColorSpace->GetFamily();
   if (m_Family == CPDF_ColorSpace::Family::kICCBased && pCSObj->IsName()) {
     ByteString cs = pCSObj->GetString();
-    if (cs == "DeviceGray")
+    if (cs == "DeviceGray") {
       m_nComponents = 1;
-    else if (cs == "DeviceRGB")
+    } else if (cs == "DeviceRGB") {
       m_nComponents = 3;
-    else if (cs == "DeviceCMYK")
+    } else if (cs == "DeviceCMYK") {
       m_nComponents = 4;
+    }
   }
 
   ByteString filter;
-  if (!decoder_array.value().empty())
+  if (!decoder_array.value().empty()) {
     filter = decoder_array.value().back().first;
+  }
 
-  if (!ValidateDictParam(filter))
+  if (!ValidateDictParam(filter)) {
     return false;
+  }
 
   return GetDecodeAndMaskArray();
 }
 
 bool CPDF_DIB::GetDecodeAndMaskArray() {
-  if (!m_pColorSpace)
+  if (!m_pColorSpace) {
     return false;
+  }
 
   m_CompData.resize(m_nComponents);
   int max_data = (1 << m_bpc) - 1;
@@ -493,28 +520,33 @@
       float def_min;
       float def_max;
       m_pColorSpace->GetDefaultValue(i, &def_value, &def_min, &def_max);
-      if (m_Family == CPDF_ColorSpace::Family::kIndexed)
+      if (m_Family == CPDF_ColorSpace::Family::kIndexed) {
         def_max = max_data;
-      if (def_min != m_CompData[i].m_DecodeMin || def_max != max)
+      }
+      if (def_min != m_CompData[i].m_DecodeMin || def_max != max) {
         m_bDefaultDecode = false;
+      }
     }
   } else {
     for (uint32_t i = 0; i < m_nComponents; i++) {
       float def_value;
       m_pColorSpace->GetDefaultValue(i, &def_value, &m_CompData[i].m_DecodeMin,
                                      &m_CompData[i].m_DecodeStep);
-      if (m_Family == CPDF_ColorSpace::Family::kIndexed)
+      if (m_Family == CPDF_ColorSpace::Family::kIndexed) {
         m_CompData[i].m_DecodeStep = max_data;
+      }
       m_CompData[i].m_DecodeStep =
           (m_CompData[i].m_DecodeStep - m_CompData[i].m_DecodeMin) / max_data;
     }
   }
-  if (m_pDict->KeyExist("SMask"))
+  if (m_pDict->KeyExist("SMask")) {
     return true;
+  }
 
   RetainPtr<const CPDF_Object> pMask = m_pDict->GetDirectObjectFor("Mask");
-  if (!pMask)
+  if (!pMask) {
     return true;
+  }
 
   if (const CPDF_Array* pArray = pMask->AsArray()) {
     if (pArray->size() >= m_nComponents * 2) {
@@ -532,11 +564,13 @@
 
 CPDF_DIB::LoadState CPDF_DIB::CreateDecoder(uint8_t resolution_levels_to_skip) {
   ByteString decoder = m_pStreamAcc->GetImageDecoder();
-  if (decoder.IsEmpty())
+  if (decoder.IsEmpty()) {
     return LoadState::kSuccess;
+  }
 
-  if (m_bDoBpcCheck && m_bpc == 0)
+  if (m_bDoBpcCheck && m_bpc == 0) {
     return LoadState::kFail;
+  }
 
   if (decoder == "JPXDecode") {
     m_pCachedBitmap = LoadJpxBitmap(resolution_levels_to_skip);
@@ -566,22 +600,27 @@
     m_pDecoder = BasicModule::CreateRunLengthDecoder(
         src_span, GetWidth(), GetHeight(), m_nComponents, m_bpc);
   } else if (decoder == "DCTDecode") {
-    if (!CreateDCTDecoder(src_span, pParams))
+    if (!CreateDCTDecoder(src_span, pParams)) {
       return LoadState::kFail;
+    }
   }
-  if (!m_pDecoder)
+  if (!m_pDecoder) {
     return LoadState::kFail;
+  }
 
   const std::optional<uint32_t> requested_pitch =
       fxge::CalculatePitch8(m_bpc, m_nComponents, GetWidth());
-  if (!requested_pitch.has_value())
+  if (!requested_pitch.has_value()) {
     return LoadState::kFail;
+  }
   const std::optional<uint32_t> provided_pitch = fxge::CalculatePitch8(
       m_pDecoder->GetBPC(), m_pDecoder->CountComps(), m_pDecoder->GetWidth());
-  if (!provided_pitch.has_value())
+  if (!provided_pitch.has_value()) {
     return LoadState::kFail;
-  if (provided_pitch.value() < requested_pitch.value())
+  }
+  if (provided_pitch.value() < requested_pitch.value()) {
     return LoadState::kFail;
+  }
   return LoadState::kSuccess;
 }
 
@@ -590,13 +629,15 @@
   m_pDecoder = JpegModule::CreateDecoder(
       src_span, GetWidth(), GetHeight(), m_nComponents,
       !pParams || pParams->GetIntegerFor("ColorTransform", 1));
-  if (m_pDecoder)
+  if (m_pDecoder) {
     return true;
+  }
 
   std::optional<JpegModule::ImageInfo> info_opt =
       JpegModule::LoadInfo(src_span);
-  if (!info_opt.has_value())
+  if (!info_opt.has_value()) {
     return false;
+  }
 
   const JpegModule::ImageInfo& info = info_opt.value();
   SetWidth(info.width);
@@ -623,13 +664,15 @@
       case CPDF_ColorSpace::Family::kDeviceRGB:
       case CPDF_ColorSpace::Family::kDeviceCMYK: {
         uint32_t dwMinComps = CPDF_ColorSpace::ComponentsForFamily(m_Family);
-        if (colorspace_comps < dwMinComps || m_nComponents < dwMinComps)
+        if (colorspace_comps < dwMinComps || m_nComponents < dwMinComps) {
           return false;
+        }
         break;
       }
       case CPDF_ColorSpace::Family::kLab: {
-        if (m_nComponents != 3 || colorspace_comps < 3)
+        if (m_nComponents != 3 || colorspace_comps < 3) {
           return false;
+        }
         break;
       }
       case CPDF_ColorSpace::Family::kICCBased: {
@@ -641,17 +684,20 @@
         break;
       }
       default: {
-        if (colorspace_comps != m_nComponents)
+        if (colorspace_comps != m_nComponents) {
           return false;
+        }
         break;
       }
     }
   } else {
-    if (m_Family == CPDF_ColorSpace::Family::kLab && m_nComponents != 3)
+    if (m_Family == CPDF_ColorSpace::Family::kLab && m_nComponents != 3) {
       return false;
+    }
   }
-  if (!GetDecodeAndMaskArray())
+  if (!GetDecodeAndMaskArray()) {
     return false;
+  }
 
   m_bpc = info.bits_per_components;
   m_pDecoder = JpegModule::CreateDecoder(src_span, GetWidth(), GetHeight(),
@@ -665,14 +711,16 @@
       CJPX_Decoder::Create(m_pStreamAcc->GetSpan(),
                            ColorSpaceOptionFromColorSpace(m_pColorSpace.Get()),
                            resolution_levels_to_skip, /*strict_mode=*/true);
-  if (!decoder)
+  if (!decoder) {
     return nullptr;
+  }
 
   SetWidth(GetWidth() >> resolution_levels_to_skip);
   SetHeight(GetHeight() >> resolution_levels_to_skip);
 
-  if (!decoder->StartDecode())
+  if (!decoder->StartDecode()) {
     return nullptr;
+  }
 
   CJPX_Decoder::JpxImageInfo image_info = decoder->GetInfo();
   if (static_cast<int>(image_info.width) < GetWidth() ||
@@ -746,8 +794,9 @@
   }
 
   auto result_bitmap = pdfium::MakeRetain<CFX_DIBitmap>();
-  if (!result_bitmap->Create(image_info.width, image_info.height, format))
+  if (!result_bitmap->Create(image_info.width, image_info.height, format)) {
     return nullptr;
+  }
 
   result_bitmap->Clear(0xFFFFFFFF);
   if (!decoder->Decode(result_bitmap->GetWritableBuffer(),
@@ -821,8 +870,9 @@
 
 bool CPDF_DIB::LoadInternal(const CPDF_Dictionary* pFormResources,
                             const CPDF_Dictionary* pPageResources) {
-  if (!m_pStream)
+  if (!m_pStream) {
     return false;
+  }
 
   m_pDict = m_pStream->GetDict();
   SetWidth(m_pDict->GetIntegerFor("Width"));
@@ -831,21 +881,25 @@
     return false;
   }
 
-  if (!LoadColorInfo(pFormResources, pPageResources))
+  if (!LoadColorInfo(pFormResources, pPageResources)) {
     return false;
+  }
 
-  if (m_bDoBpcCheck && (m_bpc == 0 || m_nComponents == 0))
+  if (m_bDoBpcCheck && (m_bpc == 0 || m_nComponents == 0)) {
     return false;
+  }
 
   const std::optional<uint32_t> maybe_size =
       fxge::CalculatePitch8(m_bpc, m_nComponents, GetWidth());
-  if (!maybe_size.has_value())
+  if (!maybe_size.has_value()) {
     return false;
+  }
 
   FX_SAFE_UINT32 src_size = maybe_size.value();
   src_size *= GetHeight();
-  if (!src_size.IsValid())
+  if (!src_size.IsValid()) {
     return false;
+  }
 
   m_pStreamAcc = pdfium::MakeRetain<CPDF_StreamAcc>(m_pStream);
   m_pStreamAcc->LoadAllDataImageAcc(src_size.ValueOrDie());
@@ -891,15 +945,18 @@
 }
 
 CPDF_DIB::LoadState CPDF_DIB::ContinueLoadMaskDIB(PauseIndicatorIface* pPause) {
-  if (!m_pMask)
+  if (!m_pMask) {
     return LoadState::kSuccess;
+  }
 
   LoadState ret = m_pMask->ContinueLoadDIBBase(pPause);
-  if (ret == LoadState::kContinue)
+  if (ret == LoadState::kContinue) {
     return LoadState::kContinue;
+  }
 
-  if (m_pColorSpace && m_bStdCS)
+  if (m_pColorSpace && m_bStdCS) {
     m_pColorSpace->EnableStdConversion(false);
+  }
 
   if (ret == LoadState::kFail) {
     m_pMask.Reset();
@@ -923,29 +980,34 @@
                                             CPDF_ColorSpace::Family::kUnknown,
                                             false, {0, 0});
   if (ret == LoadState::kContinue) {
-    if (m_Status == LoadState::kFail)
+    if (m_Status == LoadState::kFail) {
       m_Status = LoadState::kContinue;
+    }
     return LoadState::kContinue;
   }
-  if (ret == LoadState::kFail)
+  if (ret == LoadState::kFail) {
     m_pMask.Reset();
+  }
   return LoadState::kSuccess;
 }
 
 void CPDF_DIB::LoadPalette() {
-  if (!m_pColorSpace || m_Family == CPDF_ColorSpace::Family::kPattern)
+  if (!m_pColorSpace || m_Family == CPDF_ColorSpace::Family::kPattern) {
     return;
+  }
 
-  if (m_bpc == 0)
+  if (m_bpc == 0) {
     return;
+  }
 
   // Use FX_SAFE_UINT32 just to be on the safe side, in case |m_bpc| or
   // |m_nComponents| somehow gets a bad value.
   FX_SAFE_UINT32 safe_bits = m_bpc;
   safe_bits *= m_nComponents;
   uint32_t bits = safe_bits.ValueOrDefault(255);
-  if (bits > 8)
+  if (bits > 8) {
     return;
+  }
 
   if (bits == 1) {
     if (m_bDefaultDecode && (m_Family == CPDF_ColorSpace::Family::kDeviceGray ||
@@ -1046,11 +1108,13 @@
 void CPDF_DIB::TranslateScanline24bpp(
     pdfium::span<uint8_t> dest_scan,
     pdfium::span<const uint8_t> src_scan) const {
-  if (m_bpc == 0)
+  if (m_bpc == 0) {
     return;
+  }
 
-  if (TranslateScanline24bppDefaultDecode(dest_scan, src_scan))
+  if (TranslateScanline24bppDefaultDecode(dest_scan, src_scan)) {
     return;
+  }
 
   // Using at least 16 elements due to the call m_pColorSpace->GetRGB().
   std::vector<float> color_values(std::max(m_nComponents, 16u));
@@ -1093,13 +1157,15 @@
 bool CPDF_DIB::TranslateScanline24bppDefaultDecode(
     pdfium::span<uint8_t> dest_scan,
     pdfium::span<const uint8_t> src_scan) const {
-  if (!m_bDefaultDecode)
+  if (!m_bDefaultDecode) {
     return false;
+  }
 
   if (m_Family != CPDF_ColorSpace::Family::kDeviceRGB &&
       m_Family != CPDF_ColorSpace::Family::kCalRGB) {
-    if (m_bpc != 8)
+    if (m_bpc != 8) {
       return false;
+    }
 
     if (m_nComponents == m_pColorSpace->ComponentCount()) {
       m_pColorSpace->TranslateImageLine(dest_scan, src_scan, GetWidth(),
@@ -1108,8 +1174,9 @@
     return true;
   }
 
-  if (m_nComponents != 3)
+  if (m_nComponents != 3) {
     return true;
+  }
 
   uint8_t* dest_pos = dest_scan.data();
   const uint8_t* src_pos = src_scan.data();
@@ -1161,13 +1228,15 @@
 }
 
 pdfium::span<const uint8_t> CPDF_DIB::GetScanline(int line) const {
-  if (m_bpc == 0)
+  if (m_bpc == 0) {
     return pdfium::span<const uint8_t>();
+  }
 
   const std::optional<uint32_t> src_pitch =
       fxge::CalculatePitch8(m_bpc, m_nComponents, GetWidth());
-  if (!src_pitch.has_value())
+  if (!src_pitch.has_value()) {
     return pdfium::span<const uint8_t>();
+  }
 
   uint32_t src_pitch_value = src_pitch.value();
   // This is used as the buffer of `pSrcLine` when the stream is truncated,
@@ -1176,8 +1245,9 @@
   pdfium::span<const uint8_t> pSrcLine;
 
   if (m_pCachedBitmap && src_pitch_value <= m_pCachedBitmap->GetPitch()) {
-    if (line >= m_pCachedBitmap->GetHeight())
+    if (line >= m_pCachedBitmap->GetHeight()) {
       line = m_pCachedBitmap->GetHeight() - 1;
+    }
     pSrcLine = m_pCachedBitmap->GetScanline(line);
   } else if (m_pDecoder) {
     pSrcLine = m_pDecoder->GetScanline(line);
@@ -1237,8 +1307,9 @@
       }
       result = result.first(GetWidth());
     }
-    if (!m_bColorKey)
+    if (!m_bColorKey) {
       return result;
+    }
 
     uint8_t* pDestPixel = m_MaskBuf.data();
     const uint8_t* pSrcPixel = m_LineBuf.data();
@@ -1285,8 +1356,9 @@
     src_pitch_value = 3 * GetWidth();
     pSrcLine = pdfium::make_span(m_LineBuf).first(src_pitch_value);
   }
-  if (!m_bColorKey)
+  if (!m_bColorKey) {
     return pSrcLine;
+  }
 
   // TODO(tsepez): Bounds check if cost is acceptable.
   const uint8_t* pSrcPixel = pSrcLine.data();
@@ -1322,13 +1394,15 @@
 }
 
 uint32_t CPDF_DIB::Get1BitSetValue() const {
-  if (m_CompData[0].m_ColorKeyMax == 1)
+  if (m_CompData[0].m_ColorKeyMax == 1) {
     return 0x00000000;
+  }
   return HasPalette() ? GetPaletteSpan()[1] : 0xFFFFFFFF;
 }
 
 uint32_t CPDF_DIB::Get1BitResetValue() const {
-  if (m_CompData[0].m_ColorKeyMin == 0)
+  if (m_CompData[0].m_ColorKeyMin == 0) {
     return 0x00000000;
+  }
   return HasPalette() ? GetPaletteSpan()[0] : 0xFF000000;
 }
diff --git a/core/fpdfapi/page/cpdf_docpagedata.cpp b/core/fpdfapi/page/cpdf_docpagedata.cpp
index 94bfb22..16304c4 100644
--- a/core/fpdfapi/page/cpdf_docpagedata.cpp
+++ b/core/fpdfapi/page/cpdf_docpagedata.cpp
@@ -51,8 +51,9 @@
 void InsertWidthArrayImpl(std::vector<int> widths, CPDF_Array* pWidthArray) {
   size_t i;
   for (i = 1; i < widths.size(); i++) {
-    if (widths[i] != widths[0])
+    if (widths[i] != widths[0]) {
       break;
+    }
   }
   if (i == widths.size()) {
     int first = pWidthArray->GetIntegerAt(pWidthArray->size() - 1);
@@ -62,8 +63,9 @@
     return;
   }
   auto pWidthArray1 = pWidthArray->AppendNew<CPDF_Array>();
-  for (int w : widths)
+  for (int w : widths) {
     pWidthArray1->AppendNew<CPDF_Number>(w);
+  }
 }
 
 #if BUILDFLAG(IS_WIN)
@@ -133,12 +135,13 @@
                     bool italic,
                     ByteString basefont,
                     RetainPtr<CPDF_Array> pWidths) {
-  if (bold && italic)
+  if (bold && italic) {
     basefont += ",BoldItalic";
-  else if (bold)
+  } else if (bold) {
     basefont += ",Bold";
-  else if (italic)
+  } else if (italic) {
     basefont += ",Italic";
+  }
   pBaseDict->SetNewFor<CPDF_Name>("Subtype", "TrueType");
   pBaseDict->SetNewFor<CPDF_Name>("BaseFont", basefont);
   pBaseDict->SetNewFor<CPDF_Number>("FirstChar", 32);
@@ -208,17 +211,20 @@
 
 RetainPtr<CPDF_Font> CPDF_DocPageData::GetFont(
     RetainPtr<CPDF_Dictionary> pFontDict) {
-  if (!pFontDict)
+  if (!pFontDict) {
     return nullptr;
+  }
 
   auto it = m_FontMap.find(pFontDict);
-  if (it != m_FontMap.end() && it->second)
+  if (it != m_FontMap.end() && it->second) {
     return pdfium::WrapRetain(it->second.Get());
+  }
 
   RetainPtr<CPDF_Font> pFont =
       CPDF_Font::Create(GetDocument(), pFontDict, this);
-  if (!pFont)
+  if (!pFont) {
     return nullptr;
+  }
 
   m_FontMap[std::move(pFontDict)].Reset(pFont.Get());
   return pFont;
@@ -227,25 +233,32 @@
 RetainPtr<CPDF_Font> CPDF_DocPageData::GetStandardFont(
     const ByteString& fontName,
     const CPDF_FontEncoding* pEncoding) {
-  if (fontName.IsEmpty())
+  if (fontName.IsEmpty()) {
     return nullptr;
+  }
 
   for (auto& it : m_FontMap) {
     CPDF_Font* pFont = it.second.Get();
-    if (!pFont)
+    if (!pFont) {
       continue;
-    if (pFont->GetBaseFontName() != fontName)
+    }
+    if (pFont->GetBaseFontName() != fontName) {
       continue;
-    if (pFont->IsEmbedded())
+    }
+    if (pFont->IsEmbedded()) {
       continue;
-    if (!pFont->IsType1Font())
+    }
+    if (!pFont->IsType1Font()) {
       continue;
-    if (pFont->GetFontDict()->KeyExist("Widths"))
+    }
+    if (pFont->GetFontDict()->KeyExist("Widths")) {
       continue;
+    }
 
     CPDF_Type1Font* pT1Font = pFont->AsType1Font();
-    if (pEncoding && !pT1Font->GetEncoding()->IsIdentical(pEncoding))
+    if (pEncoding && !pT1Font->GetEncoding()->IsIdentical(pEncoding)) {
       continue;
+    }
 
     return pdfium::WrapRetain(pFont);
   }
@@ -261,8 +274,9 @@
 
   // Note: NULL FormFactoryIface OK since known Type1 font from above.
   RetainPtr<CPDF_Font> pFont = CPDF_Font::Create(GetDocument(), pDict, nullptr);
-  if (!pFont)
+  if (!pFont) {
     return nullptr;
+  }
 
   m_FontMap[std::move(pDict)].Reset(pFont.Get());
   return pFont;
@@ -288,11 +302,13 @@
     const CPDF_Dictionary* pResources,
     std::set<const CPDF_Object*>* pVisited,
     std::set<const CPDF_Object*>* pVisitedInternal) {
-  if (!pCSObj)
+  if (!pCSObj) {
     return nullptr;
+  }
 
-  if (pdfium::Contains(*pVisitedInternal, pCSObj))
+  if (pdfium::Contains(*pVisitedInternal, pCSObj)) {
     return nullptr;
+  }
 
   ScopedSetInsertion<const CPDF_Object*> insertion(pVisitedInternal, pCSObj);
 
@@ -307,13 +323,15 @@
                                      nullptr, pVisited, pVisitedInternal);
       }
     }
-    if (!pCS || !pResources)
+    if (!pCS || !pResources) {
       return pCS;
+    }
 
     RetainPtr<const CPDF_Dictionary> pColorSpaces =
         pResources->GetDictFor("ColorSpace");
-    if (!pColorSpaces)
+    if (!pColorSpaces) {
       return pCS;
+    }
 
     RetainPtr<const CPDF_Object> pDefaultCS;
     switch (pCS->GetFamily()) {
@@ -329,16 +347,18 @@
       default:
         break;
     }
-    if (!pDefaultCS)
+    if (!pDefaultCS) {
       return pCS;
+    }
 
     return GetColorSpaceInternal(pDefaultCS.Get(), nullptr, pVisited,
                                  pVisitedInternal);
   }
 
   RetainPtr<const CPDF_Array> pArray(pCSObj->AsArray());
-  if (!pArray || pArray->IsEmpty())
+  if (!pArray || pArray->IsEmpty()) {
     return nullptr;
+  }
 
   if (pArray->size() == 1) {
     return GetColorSpaceInternal(pArray->GetDirectObjectAt(0).Get(), pResources,
@@ -346,13 +366,15 @@
   }
 
   auto it = m_ColorSpaceMap.find(pArray);
-  if (it != m_ColorSpaceMap.end() && it->second)
+  if (it != m_ColorSpaceMap.end() && it->second) {
     return pdfium::WrapRetain(it->second.Get());
+  }
 
   RetainPtr<CPDF_ColorSpace> pCS =
       CPDF_ColorSpace::Load(GetDocument(), pArray.Get(), pVisited);
-  if (!pCS)
+  if (!pCS) {
     return nullptr;
+  }
 
   m_ColorSpaceMap[std::move(pArray)].Reset(pCS.Get());
   return pCS;
@@ -364,8 +386,9 @@
   CHECK(pPatternObj->IsDictionary() || pPatternObj->IsStream());
 
   auto it = m_PatternMap.find(pPatternObj);
-  if (it != m_PatternMap.end() && it->second)
+  if (it != m_PatternMap.end() && it->second) {
     return pdfium::WrapRetain(it->second.Get());
+  }
 
   RetainPtr<CPDF_Pattern> pattern;
   switch (pPatternObj->GetDict()->GetIntegerFor("PatternType")) {
@@ -390,8 +413,9 @@
   CHECK(pPatternObj->IsDictionary() || pPatternObj->IsStream());
 
   auto it = m_PatternMap.find(pPatternObj);
-  if (it != m_PatternMap.end() && it->second)
+  if (it != m_PatternMap.end() && it->second) {
     return pdfium::WrapRetain(it->second->AsShadingPattern());
+  }
 
   auto pPattern = pdfium::MakeRetain<CPDF_ShadingPattern>(
       GetDocument(), pPatternObj, true, matrix);
@@ -402,8 +426,9 @@
 RetainPtr<CPDF_Image> CPDF_DocPageData::GetImage(uint32_t dwStreamObjNum) {
   DCHECK(dwStreamObjNum);
   auto it = m_ImageMap.find(dwStreamObjNum);
-  if (it != m_ImageMap.end())
+  if (it != m_ImageMap.end()) {
     return it->second;
+  }
 
   auto pImage = pdfium::MakeRetain<CPDF_Image>(GetDocument(), dwStreamObjNum);
   m_ImageMap[dwStreamObjNum] = pImage;
@@ -413,8 +438,9 @@
 void CPDF_DocPageData::MaybePurgeImage(uint32_t dwStreamObjNum) {
   DCHECK(dwStreamObjNum);
   auto it = m_ImageMap.find(dwStreamObjNum);
-  if (it != m_ImageMap.end() && it->second->HasOneRef())
+  if (it != m_ImageMap.end() && it->second->HasOneRef()) {
     m_ImageMap.erase(it);
+  }
 }
 
 RetainPtr<CPDF_IccProfile> CPDF_DocPageData::GetIccProfile(
@@ -456,8 +482,9 @@
     RetainPtr<const CPDF_Stream> pFontStream) {
   DCHECK(pFontStream);
   auto it = m_FontFileMap.find(pFontStream);
-  if (it != m_FontFileMap.end())
+  if (it != m_FontFileMap.end()) {
     return it->second;
+  }
 
   RetainPtr<const CPDF_Dictionary> pFontDict = pFontStream->GetDict();
   int32_t len1 = pFontDict->GetIntegerFor("Length1");
@@ -479,17 +506,20 @@
 
 void CPDF_DocPageData::MaybePurgeFontFileStreamAcc(
     RetainPtr<CPDF_StreamAcc>&& pStreamAcc) {
-  if (!pStreamAcc)
+  if (!pStreamAcc) {
     return;
+  }
 
   RetainPtr<const CPDF_Stream> pFontStream = pStreamAcc->GetStream();
-  if (!pFontStream)
+  if (!pFontStream) {
     return;
+  }
 
   pStreamAcc.Reset();  // Drop moved caller's reference.
   auto it = m_FontFileMap.find(pFontStream);
-  if (it != m_FontFileMap.end() && it->second->HasOneRef())
+  if (it != m_FontFileMap.end() && it->second->HasOneRef()) {
     m_FontFileMap.erase(it);
+  }
 }
 
 std::unique_ptr<CPDF_Font::FormIface> CPDF_DocPageData::CreateForm(
@@ -506,15 +536,17 @@
   ByteString mutable_name(fontName);
   std::optional<CFX_FontMapper::StandardFont> font_id =
       CFX_FontMapper::GetStandardFontName(&mutable_name);
-  if (!font_id.has_value())
+  if (!font_id.has_value()) {
     return nullptr;
+  }
   return GetStandardFont(mutable_name, pEncoding);
 }
 
 RetainPtr<CPDF_Font> CPDF_DocPageData::AddFont(std::unique_ptr<CFX_Font> pFont,
                                                FX_Charset charset) {
-  if (!pFont)
+  if (!pFont) {
     return nullptr;
+  }
 
   const bool bCJK = FX_CharSetIsCJK(charset);
   ByteString basefont = pFont->GetFamilyName();
@@ -584,8 +616,9 @@
     for (auto ch : remaining) {
       glyph = pEncoding->GlyphFromCharCode(ch);
       int width = pFont->GetGlyphWidth(glyph);
-      if (width > 0 && width < nStemV)
+      if (width > 0 && width < nStemV) {
         nStemV = width;
+      }
     }
   }
   RetainPtr<CPDF_Dictionary> pFontDesc = CalculateFontDesc(
@@ -625,11 +658,13 @@
   const FX_Charset eCharset = FX_GetCharsetFromInt(pLogFont->lfCharSet);
   const bool bCJK = FX_CharSetIsCJK(eCharset);
   ByteString basefont;
-  if (bCJK)
+  if (bCJK) {
     basefont = GetPSNameFromTT(hDC);
+  }
 
-  if (basefont.IsEmpty())
+  if (basefont.IsEmpty()) {
     basefont = pLogFont->lfFaceName;
+  }
 
   int italicangle = ptm->otmItalicAngle / 10;
   int ascend = ptm->otmrcFontBox.top;
@@ -690,8 +725,9 @@
       break;
     }
   }
-  if (i == std::size(kFX_CharsetUnicodes))
+  if (i == std::size(kFX_CharsetUnicodes)) {
     return i;
+  }
 
   auto pEncodingDict = GetDocument()->NewIndirect<CPDF_Dictionary>();
   pEncodingDict->SetNewFor<CPDF_Name>("BaseEncoding",
diff --git a/core/fpdfapi/page/cpdf_expintfunc.cpp b/core/fpdfapi/page/cpdf_expintfunc.cpp
index 6f642c9..5bc7ef9 100644
--- a/core/fpdfapi/page/cpdf_expintfunc.cpp
+++ b/core/fpdfapi/page/cpdf_expintfunc.cpp
@@ -25,16 +25,19 @@
   CHECK(pObj->IsDictionary() || pObj->IsStream());
   RetainPtr<const CPDF_Dictionary> pDict = pObj->GetDict();
   RetainPtr<const CPDF_Number> pExponent = pDict->GetNumberFor("N");
-  if (!pExponent)
+  if (!pExponent) {
     return false;
+  }
 
   m_Exponent = pExponent->GetNumber();
 
   RetainPtr<const CPDF_Array> pArray0 = pDict->GetArrayFor("C0");
-  if (pArray0 && m_nOutputs == 0)
+  if (pArray0 && m_nOutputs == 0) {
     m_nOutputs = fxcrt::CollectionSize<uint32_t>(*pArray0);
-  if (m_nOutputs == 0)
+  }
+  if (m_nOutputs == 0) {
     m_nOutputs = 1;
+  }
 
   RetainPtr<const CPDF_Array> pArray1 = pDict->GetArrayFor("C1");
   m_BeginValues = DataVector<float>(Fx2DSizeOrDie(m_nOutputs, 2));
@@ -46,8 +49,9 @@
 
   FX_SAFE_UINT32 nOutputs = m_nOutputs;
   nOutputs *= m_nInputs;
-  if (!nOutputs.IsValid())
+  if (!nOutputs.IsValid()) {
     return false;
+  }
 
   m_nOrigOutputs = m_nOutputs;
   m_nOutputs = nOutputs.ValueOrDie();
diff --git a/core/fpdfapi/page/cpdf_form.cpp b/core/fpdfapi/page/cpdf_form.cpp
index 526c148..c7cb459 100644
--- a/core/fpdfapi/page/cpdf_form.cpp
+++ b/core/fpdfapi/page/cpdf_form.cpp
@@ -27,8 +27,9 @@
     CPDF_Dictionary* pResources,
     CPDF_Dictionary* pParentResources,
     CPDF_Dictionary* pPageResources) {
-  if (pResources)
+  if (pResources) {
     return pResources;
+  }
   return pParentResources ? pParentResources : pPageResources;
 }
 
@@ -77,8 +78,9 @@
                                      const CFX_Matrix* pParentMatrix,
                                      CPDF_Type3Char* pType3Char,
                                      RecursionState* recursion_state) {
-  if (GetParseState() == ParseState::kParsed)
+  if (GetParseState() == ParseState::kParsed) {
     return;
+  }
 
   if (GetParseState() == ParseState::kNotParsed) {
     StartParse(std::make_unique<CPDF_ContentParser>(
diff --git a/core/fpdfapi/page/cpdf_function.cpp b/core/fpdfapi/page/cpdf_function.cpp
index d7a78cd..668c3ef 100644
--- a/core/fpdfapi/page/cpdf_function.cpp
+++ b/core/fpdfapi/page/cpdf_function.cpp
@@ -50,33 +50,38 @@
 std::unique_ptr<CPDF_Function> CPDF_Function::Load(
     RetainPtr<const CPDF_Object> pFuncObj,
     VisitedSet* pVisited) {
-  if (!pFuncObj)
+  if (!pFuncObj) {
     return nullptr;
+  }
 
-  if (pdfium::Contains(*pVisited, pFuncObj))
+  if (pdfium::Contains(*pVisited, pFuncObj)) {
     return nullptr;
+  }
 
   ScopedSetInsertion<VisitedSet::value_type> insertion(pVisited, pFuncObj);
 
   int iType = -1;
-  if (const CPDF_Stream* pStream = pFuncObj->AsStream())
+  if (const CPDF_Stream* pStream = pFuncObj->AsStream()) {
     iType = pStream->GetDict()->GetIntegerFor("FunctionType");
-  else if (const CPDF_Dictionary* pDict = pFuncObj->AsDictionary())
+  } else if (const CPDF_Dictionary* pDict = pFuncObj->AsDictionary()) {
     iType = pDict->GetIntegerFor("FunctionType");
+  }
 
   std::unique_ptr<CPDF_Function> pFunc;
   Type type = IntegerToFunctionType(iType);
-  if (type == Type::kType0Sampled)
+  if (type == Type::kType0Sampled) {
     pFunc = std::make_unique<CPDF_SampledFunc>();
-  else if (type == Type::kType2ExponentialInterpolation)
+  } else if (type == Type::kType2ExponentialInterpolation) {
     pFunc = std::make_unique<CPDF_ExpIntFunc>();
-  else if (type == Type::kType3Stitching)
+  } else if (type == Type::kType3Stitching) {
     pFunc = std::make_unique<CPDF_StitchFunc>();
-  else if (type == Type::kType4PostScript)
+  } else if (type == Type::kType4PostScript) {
     pFunc = std::make_unique<CPDF_PSFunc>();
+  }
 
-  if (!pFunc || !pFunc->Init(pFuncObj, pVisited))
+  if (!pFunc || !pFunc->Init(pFuncObj, pVisited)) {
     return nullptr;
+  }
 
   return pFunc;
 }
@@ -91,12 +96,14 @@
       pStream ? pStream->GetDict() : pdfium::WrapRetain(pObj->AsDictionary());
 
   RetainPtr<const CPDF_Array> pDomains = pDict->GetArrayFor("Domain");
-  if (!pDomains)
+  if (!pDomains) {
     return false;
+  }
 
   m_nInputs = fxcrt::CollectionSize<uint32_t>(*pDomains) / 2;
-  if (m_nInputs == 0)
+  if (m_nInputs == 0) {
     return false;
+  }
 
   size_t nInputs = m_nInputs * 2;
   m_Domains = ReadArrayElementsToVector(pDomains.Get(), nInputs);
@@ -108,8 +115,9 @@
   // |m_nOutputs| here implied Ranges meets the requirements.
   bool bRangeRequired =
       m_Type == Type::kType0Sampled || m_Type == Type::kType4PostScript;
-  if (bRangeRequired && m_nOutputs == 0)
+  if (bRangeRequired && m_nOutputs == 0) {
     return false;
+  }
 
   if (m_nOutputs > 0) {
     size_t nOutputs = m_nOutputs * 2;
@@ -117,8 +125,9 @@
   }
 
   uint32_t old_outputs = m_nOutputs;
-  if (!v_Init(pObj, pVisited))
+  if (!v_Init(pObj, pVisited)) {
     return false;
+  }
 
   if (!m_Ranges.empty() && m_nOutputs > old_outputs) {
     FX_SAFE_SIZE_T nOutputs = m_nOutputs;
@@ -130,29 +139,34 @@
 
 std::optional<uint32_t> CPDF_Function::Call(pdfium::span<const float> inputs,
                                             pdfium::span<float> results) const {
-  if (m_nInputs != inputs.size())
+  if (m_nInputs != inputs.size()) {
     return std::nullopt;
+  }
 
   std::vector<float> clamped_inputs(m_nInputs);
   for (uint32_t i = 0; i < m_nInputs; i++) {
     float domain1 = m_Domains[i * 2];
     float domain2 = m_Domains[i * 2 + 1];
-    if (domain1 > domain2)
+    if (domain1 > domain2) {
       return std::nullopt;
+    }
 
     clamped_inputs[i] = std::clamp(inputs[i], domain1, domain2);
   }
-  if (!v_Call(clamped_inputs, results))
+  if (!v_Call(clamped_inputs, results)) {
     return std::nullopt;
+  }
 
-  if (m_Ranges.empty())
+  if (m_Ranges.empty()) {
     return m_nOutputs;
+  }
 
   for (uint32_t i = 0; i < m_nOutputs; i++) {
     float range1 = m_Ranges[i * 2];
     float range2 = m_Ranges[i * 2 + 1];
-    if (range1 > range2)
+    if (range1 > range2) {
       return std::nullopt;
+    }
 
     results[i] = std::clamp(results[i], range1, range2);
   }
diff --git a/core/fpdfapi/page/cpdf_generalstate.cpp b/core/fpdfapi/page/cpdf_generalstate.cpp
index 35cfff3..f9cdbeb 100644
--- a/core/fpdfapi/page/cpdf_generalstate.cpp
+++ b/core/fpdfapi/page/cpdf_generalstate.cpp
@@ -16,14 +16,17 @@
 
 int RI_StringToId(const ByteString& ri) {
   uint32_t id = ri.GetID();
-  if (id == FXBSTR_ID('A', 'b', 's', 'o'))
+  if (id == FXBSTR_ID('A', 'b', 's', 'o')) {
     return 1;
+  }
 
-  if (id == FXBSTR_ID('S', 'a', 't', 'u'))
+  if (id == FXBSTR_ID('S', 'a', 't', 'u')) {
     return 2;
+  }
 
-  if (id == FXBSTR_ID('P', 'e', 'r', 'c'))
+  if (id == FXBSTR_ID('P', 'e', 'r', 'c')) {
     return 3;
+  }
 
   return 0;
 }
@@ -44,10 +47,12 @@
     case FXBSTR_ID('L', 'i', 'g', 'h'):
       return BlendMode::kLighten;
     case FXBSTR_ID('C', 'o', 'l', 'o'):
-      if (mode.GetLength() == 10)
+      if (mode.GetLength() == 10) {
         return BlendMode::kColorDodge;
-      if (mode.GetLength() == 9)
+      }
+      if (mode.GetLength() == 9) {
         return BlendMode::kColorBurn;
+      }
       return BlendMode::kColor;
     case FXBSTR_ID('H', 'a', 'r', 'd'):
       return BlendMode::kHardLight;
diff --git a/core/fpdfapi/page/cpdf_image.cpp b/core/fpdfapi/page/cpdf_image.cpp
index bca9062..3d893ea 100644
--- a/core/fpdfapi/page/cpdf_image.cpp
+++ b/core/fpdfapi/page/cpdf_image.cpp
@@ -98,8 +98,9 @@
     pdfium::span<uint8_t> src_span) {
   std::optional<JpegModule::ImageInfo> info_opt =
       JpegModule::LoadInfo(src_span);
-  if (!info_opt.has_value())
+  if (!info_opt.has_value()) {
     return nullptr;
+  }
 
   const JpegModule::ImageInfo& info = info_opt.value();
   if (!IsValidJpegComponent(info.num_components) ||
@@ -185,8 +186,9 @@
 void CPDF_Image::SetImage(const RetainPtr<CFX_DIBitmap>& pBitmap) {
   int32_t BitmapWidth = pBitmap->GetWidth();
   int32_t BitmapHeight = pBitmap->GetHeight();
-  if (BitmapWidth < 1 || BitmapHeight < 1)
+  if (BitmapWidth < 1 || BitmapHeight < 1) {
     return;
+  }
 
   RetainPtr<CPDF_Dictionary> pDict =
       CreateXObjectImageDict(BitmapWidth, BitmapHeight);
@@ -254,8 +256,9 @@
   }
 
   RetainPtr<CFX_DIBitmap> pMaskBitmap;
-  if (pBitmap->IsAlphaFormat())
+  if (pBitmap->IsAlphaFormat()) {
     pMaskBitmap = pBitmap->CloneAlphaMask();
+  }
 
   if (pMaskBitmap) {
     const int32_t mask_width = pMaskBitmap->GetWidth();
@@ -330,15 +333,18 @@
 
 RetainPtr<CFX_DIBBase> CPDF_Image::LoadDIBBase() const {
   RetainPtr<CPDF_DIB> source = CreateNewDIB();
-  if (!source->Load())
+  if (!source->Load()) {
     return nullptr;
+  }
 
-  if (!source->IsJBigImage())
+  if (!source->IsJBigImage()) {
     return source;
+  }
 
   CPDF_DIB::LoadState ret = CPDF_DIB::LoadState::kContinue;
-  while (ret == CPDF_DIB::LoadState::kContinue)
+  while (ret == CPDF_DIB::LoadState::kContinue) {
     ret = source->ContinueLoadDIBBase(nullptr);
+  }
   return ret == CPDF_DIB::LoadState::kSuccess ? source : nullptr;
 }
 
@@ -365,8 +371,9 @@
     return false;
   }
   m_pDIBBase = source;
-  if (ret == CPDF_DIB::LoadState::kContinue)
+  if (ret == CPDF_DIB::LoadState::kContinue) {
     return true;
+  }
 
   m_pMask = source->DetachMask();
   m_MatteColor = source->GetMatteColor();
@@ -376,8 +383,9 @@
 bool CPDF_Image::Continue(PauseIndicatorIface* pPause) {
   RetainPtr<CPDF_DIB> pSource = m_pDIBBase.As<CPDF_DIB>();
   CPDF_DIB::LoadState ret = pSource->ContinueLoadDIBBase(pPause);
-  if (ret == CPDF_DIB::LoadState::kContinue)
+  if (ret == CPDF_DIB::LoadState::kContinue) {
     return true;
+  }
 
   if (ret == CPDF_DIB::LoadState::kSuccess) {
     m_pMask = pSource->DetachMask();
diff --git a/core/fpdfapi/page/cpdf_imageloader.cpp b/core/fpdfapi/page/cpdf_imageloader.cpp
index b5155c2..dc6631a 100644
--- a/core/fpdfapi/page/cpdf_imageloader.cpp
+++ b/core/fpdfapi/page/cpdf_imageloader.cpp
@@ -61,8 +61,9 @@
   DCHECK(pTransferFunc);
   DCHECK(!pTransferFunc->GetIdentity());
   m_pBitmap = pTransferFunc->TranslateImage(std::move(m_pBitmap));
-  if (m_bCached && m_pMask)
+  if (m_bCached && m_pMask) {
     m_pMask = m_pMask->Realize();
+  }
   m_bCached = false;
   return m_pBitmap;
 }
diff --git a/core/fpdfapi/page/cpdf_imageobject.cpp b/core/fpdfapi/page/cpdf_imageobject.cpp
index 4781fb3..ad209e2 100644
--- a/core/fpdfapi/page/cpdf_imageobject.cpp
+++ b/core/fpdfapi/page/cpdf_imageobject.cpp
@@ -89,12 +89,14 @@
   }
 
   RetainPtr<const CPDF_Stream> pStream = m_pImage->GetStream();
-  if (!pStream)
+  if (!pStream) {
     return;
+  }
 
   uint32_t objnum = pStream->GetObjNum();
-  if (!objnum)
+  if (!objnum) {
     return;
+  }
 
   auto* pDoc = m_pImage->GetDocument();
   CHECK(pDoc);
diff --git a/core/fpdfapi/page/cpdf_meshstream.cpp b/core/fpdfapi/page/cpdf_meshstream.cpp
index 89ce587..f3f188b 100644
--- a/core/fpdfapi/page/cpdf_meshstream.cpp
+++ b/core/fpdfapi/page/cpdf_meshstream.cpp
@@ -119,24 +119,29 @@
   m_nCoordBits = pDict->GetIntegerFor("BitsPerCoordinate");
   m_nComponentBits = pDict->GetIntegerFor("BitsPerComponent");
   if (ShouldCheckBPC(m_type)) {
-    if (!IsValidBitsPerCoordinate(m_nCoordBits))
+    if (!IsValidBitsPerCoordinate(m_nCoordBits)) {
       return false;
-    if (!IsValidBitsPerComponent(m_nComponentBits))
+    }
+    if (!IsValidBitsPerComponent(m_nComponentBits)) {
       return false;
+    }
   }
 
   m_nFlagBits = pDict->GetIntegerFor("BitsPerFlag");
-  if (ShouldCheckBitsPerFlag(m_type) && !IsValidBitsPerFlag(m_nFlagBits))
+  if (ShouldCheckBitsPerFlag(m_type) && !IsValidBitsPerFlag(m_nFlagBits)) {
     return false;
+  }
 
   uint32_t nComponents = m_pCS->ComponentCount();
-  if (nComponents > kMaxComponents)
+  if (nComponents > kMaxComponents) {
     return false;
+  }
 
   m_nComponents = m_funcs.empty() ? nComponents : 1;
   RetainPtr<const CPDF_Array> pDecode = pDict->GetArrayFor("Decode");
-  if (!pDecode || pDecode->size() != 4 + m_nComponents * 2)
+  if (!pDecode || pDecode->size() != 4 + m_nComponents * 2) {
     return false;
+  }
 
   m_xmin = pDecode->GetFloatAt(0);
   m_xmax = pDecode->GetFloatAt(1);
@@ -205,9 +210,9 @@
 
   std::array<float, kMaxComponents> color_value;
   for (uint32_t i = 0; i < m_nComponents; ++i) {
-      color_value[i] = m_ColorMin[i] + m_BitStream->GetBits(m_nComponentBits) *
-                                           (m_ColorMax[i] - m_ColorMin[i]) /
-                                           m_ComponentMax;
+    color_value[i] = m_ColorMin[i] + m_BitStream->GetBits(m_nComponentBits) *
+                                         (m_ColorMax[i] - m_ColorMin[i]) /
+                                         m_ComponentMax;
   }
   if (m_funcs.empty()) {
     return m_pCS->GetRGBOrZerosOnError(color_value);
@@ -224,16 +229,19 @@
 bool CPDF_MeshStream::ReadVertex(const CFX_Matrix& pObject2Bitmap,
                                  CPDF_MeshVertex* vertex,
                                  uint32_t* flag) {
-  if (!CanReadFlag())
+  if (!CanReadFlag()) {
     return false;
+  }
   *flag = ReadFlag();
 
-  if (!CanReadCoords())
+  if (!CanReadCoords()) {
     return false;
+  }
   vertex->position = pObject2Bitmap.Transform(ReadCoords());
 
-  if (!CanReadColor())
+  if (!CanReadColor()) {
     return false;
+  }
   vertex->rgb = ReadColor();
   m_BitStream->ByteAlign();
   return true;
@@ -244,14 +252,16 @@
     int count) {
   std::vector<CPDF_MeshVertex> vertices;
   for (int i = 0; i < count; ++i) {
-    if (m_BitStream->IsEOF() || !CanReadCoords())
+    if (m_BitStream->IsEOF() || !CanReadCoords()) {
       return std::vector<CPDF_MeshVertex>();
+    }
 
     vertices.emplace_back();
     CPDF_MeshVertex& vertex = vertices.back();
     vertex.position = pObject2Bitmap.Transform(ReadCoords());
-    if (!CanReadColor())
+    if (!CanReadColor()) {
       return std::vector<CPDF_MeshVertex>();
+    }
 
     vertex.rgb = ReadColor();
     m_BitStream->ByteAlign();
diff --git a/core/fpdfapi/page/cpdf_occontext.cpp b/core/fpdfapi/page/cpdf_occontext.cpp
index 26d15b3..f406713 100644
--- a/core/fpdfapi/page/cpdf_occontext.cpp
+++ b/core/fpdfapi/page/cpdf_occontext.cpp
@@ -18,15 +18,17 @@
                ByteStringView csElement,
                ByteStringView csDef) {
   RetainPtr<const CPDF_Object> pIntent = pDict->GetDirectObjectFor("Intent");
-  if (!pIntent)
+  if (!pIntent) {
     return csElement == csDef;
+  }
 
   ByteString bsIntent;
   if (const CPDF_Array* pArray = pIntent->AsArray()) {
     for (size_t i = 0; i < pArray->size(); i++) {
       bsIntent = pArray->GetByteStringAt(i);
-      if (bsIntent == "All" || bsIntent == csElement)
+      if (bsIntent == "All" || bsIntent == csElement) {
         return true;
+      }
     }
     return false;
   }
@@ -39,26 +41,31 @@
   DCHECK(pOCGDict);
   RetainPtr<const CPDF_Dictionary> pOCProperties =
       pDoc->GetRoot()->GetDictFor("OCProperties");
-  if (!pOCProperties)
+  if (!pOCProperties) {
     return nullptr;
+  }
 
   RetainPtr<const CPDF_Array> pOCGs = pOCProperties->GetArrayFor("OCGs");
-  if (!pOCGs)
+  if (!pOCGs) {
     return nullptr;
+  }
 
-  if (!pOCGs->Contains(pOCGDict))
+  if (!pOCGs->Contains(pOCGDict)) {
     return nullptr;
+  }
 
   RetainPtr<const CPDF_Dictionary> pConfig = pOCProperties->GetDictFor("D");
   RetainPtr<const CPDF_Array> pConfigArray =
       pOCProperties->GetArrayFor("Configs");
-  if (!pConfigArray)
+  if (!pConfigArray) {
     return pConfig;
+  }
 
   for (size_t i = 0; i < pConfigArray->size(); i++) {
     RetainPtr<const CPDF_Dictionary> pFind = pConfigArray->GetDictAt(i);
-    if (pFind && HasIntent(pFind.Get(), "View", ""))
+    if (pFind && HasIntent(pFind.Get(), "View", "")) {
       return pFind;
+    }
   }
   return pConfig;
 }
@@ -95,41 +102,50 @@
     const ByteString& csConfig,
     const CPDF_Dictionary* pOCGDict) const {
   RetainPtr<const CPDF_Dictionary> pConfig = GetConfig(m_pDocument, pOCGDict);
-  if (!pConfig)
+  if (!pConfig) {
     return true;
+  }
 
   bool bState = pConfig->GetByteStringFor("BaseState", "ON") != "OFF";
   RetainPtr<const CPDF_Array> pArray = pConfig->GetArrayFor("ON");
-  if (pArray && pArray->Contains(pOCGDict))
+  if (pArray && pArray->Contains(pOCGDict)) {
     bState = true;
+  }
 
   pArray = pConfig->GetArrayFor("OFF");
-  if (pArray && pArray->Contains(pOCGDict))
+  if (pArray && pArray->Contains(pOCGDict)) {
     bState = false;
+  }
 
   pArray = pConfig->GetArrayFor("AS");
-  if (!pArray)
+  if (!pArray) {
     return bState;
+  }
 
   ByteString csFind = csConfig + "State";
   for (size_t i = 0; i < pArray->size(); i++) {
     RetainPtr<const CPDF_Dictionary> pUsage = pArray->GetDictAt(i);
-    if (!pUsage)
+    if (!pUsage) {
       continue;
+    }
 
-    if (pUsage->GetByteStringFor("Event", "View") != csConfig)
+    if (pUsage->GetByteStringFor("Event", "View") != csConfig) {
       continue;
+    }
 
     RetainPtr<const CPDF_Array> pOCGs = pUsage->GetArrayFor("OCGs");
-    if (!pOCGs)
+    if (!pOCGs) {
       continue;
+    }
 
-    if (!pOCGs->Contains(pOCGDict))
+    if (!pOCGs->Contains(pOCGDict)) {
       continue;
+    }
 
     RetainPtr<const CPDF_Dictionary> pState = pUsage->GetDictFor(csConfig);
-    if (!pState)
+    if (!pState) {
       continue;
+    }
 
     bState = pState->GetByteStringFor(csFind) != "OFF";
   }
@@ -137,8 +153,9 @@
 }
 
 bool CPDF_OCContext::LoadOCGState(const CPDF_Dictionary* pOCGDict) const {
-  if (!HasIntent(pOCGDict, "View", "View"))
+  if (!HasIntent(pOCGDict, "View", "View")) {
     return true;
+  }
 
   ByteString csState = GetUsageTypeString(m_eUsageType);
   RetainPtr<const CPDF_Dictionary> pUsage = pOCGDict->GetDictFor("Usage");
@@ -146,25 +163,29 @@
     RetainPtr<const CPDF_Dictionary> pState = pUsage->GetDictFor(csState);
     if (pState) {
       ByteString csFind = csState + "State";
-      if (pState->KeyExist(csFind))
+      if (pState->KeyExist(csFind)) {
         return pState->GetByteStringFor(csFind) != "OFF";
+      }
     }
     if (csState != "View") {
       pState = pUsage->GetDictFor("View");
-      if (pState && pState->KeyExist("ViewState"))
+      if (pState && pState->KeyExist("ViewState")) {
         return pState->GetByteStringFor("ViewState") != "OFF";
+      }
     }
   }
   return LoadOCGStateFromConfig(csState, pOCGDict);
 }
 
 bool CPDF_OCContext::GetOCGVisible(const CPDF_Dictionary* pOCGDict) const {
-  if (!pOCGDict)
+  if (!pOCGDict) {
     return false;
+  }
 
   const auto it = m_OGCStateCache.find(pOCGDict);
-  if (it != m_OGCStateCache.end())
+  if (it != m_OGCStateCache.end()) {
     return it->second;
+  }
 
   bool bState = LoadOCGState(pOCGDict);
   m_OGCStateCache[pdfium::WrapRetain(pOCGDict)] = bState;
@@ -185,35 +206,42 @@
 }
 
 bool CPDF_OCContext::GetOCGVE(const CPDF_Array* pExpression, int nLevel) const {
-  if (nLevel > 32 || !pExpression)
+  if (nLevel > 32 || !pExpression) {
     return false;
+  }
 
   ByteString csOperator = pExpression->GetByteStringAt(0);
   if (csOperator == "Not") {
     RetainPtr<const CPDF_Object> pOCGObj = pExpression->GetDirectObjectAt(1);
-    if (!pOCGObj)
+    if (!pOCGObj) {
       return false;
-    if (const CPDF_Dictionary* pDict = pOCGObj->AsDictionary())
+    }
+    if (const CPDF_Dictionary* pDict = pOCGObj->AsDictionary()) {
       return !GetOCGVisible(pDict);
-    if (const CPDF_Array* pArray = pOCGObj->AsArray())
+    }
+    if (const CPDF_Array* pArray = pOCGObj->AsArray()) {
       return !GetOCGVE(pArray, nLevel + 1);
+    }
     return false;
   }
 
-  if (csOperator != "Or" && csOperator != "And")
+  if (csOperator != "Or" && csOperator != "And") {
     return false;
+  }
 
   bool bValue = false;
   for (size_t i = 1; i < pExpression->size(); i++) {
     RetainPtr<const CPDF_Object> pOCGObj = pExpression->GetDirectObjectAt(i);
-    if (!pOCGObj)
+    if (!pOCGObj) {
       continue;
+    }
 
     bool bItem = false;
-    if (const CPDF_Dictionary* pDict = pOCGObj->AsDictionary())
+    if (const CPDF_Dictionary* pDict = pOCGObj->AsDictionary()) {
       bItem = GetOCGVisible(pDict);
-    else if (const CPDF_Array* pArray = pOCGObj->AsArray())
+    } else if (const CPDF_Array* pArray = pOCGObj->AsArray()) {
       bItem = GetOCGVE(pArray, nLevel + 1);
+    }
 
     if (i == 1) {
       bValue = bItem;
@@ -236,15 +264,18 @@
 
   ByteString csP = pOCMDDict->GetByteStringFor("P", "AnyOn");
   RetainPtr<const CPDF_Object> pOCGObj = pOCMDDict->GetDirectObjectFor("OCGs");
-  if (!pOCGObj)
+  if (!pOCGObj) {
     return true;
+  }
 
-  if (const CPDF_Dictionary* pDict = pOCGObj->AsDictionary())
+  if (const CPDF_Dictionary* pDict = pOCGObj->AsDictionary()) {
     return GetOCGVisible(pDict);
+  }
 
   const CPDF_Array* pArray = pOCGObj->AsArray();
-  if (!pArray)
+  if (!pArray) {
     return true;
+  }
 
   bool bState = (csP == "AllOn" || csP == "AllOff");
   // At least one entry of OCGs needs to be a valid dictionary for it to be
@@ -253,16 +284,19 @@
   for (size_t i = 0; i < pArray->size(); i++) {
     bool bItem = true;
     RetainPtr<const CPDF_Dictionary> pItemDict = pArray->GetDictAt(i);
-    if (!pItemDict)
+    if (!pItemDict) {
       continue;
+    }
 
     bValidEntrySeen = true;
     bItem = GetOCGVisible(pItemDict.Get());
 
-    if ((csP == "AnyOn" && bItem) || (csP == "AnyOff" && !bItem))
+    if ((csP == "AnyOn" && bItem) || (csP == "AnyOff" && !bItem)) {
       return true;
-    if ((csP == "AllOn" && !bItem) || (csP == "AllOff" && bItem))
+    }
+    if ((csP == "AllOn" && !bItem) || (csP == "AllOff" && bItem)) {
       return false;
+    }
   }
 
   return !bValidEntrySeen || bState;
@@ -270,11 +304,13 @@
 
 bool CPDF_OCContext::CheckOCGDictVisible(
     const CPDF_Dictionary* pOCGDict) const {
-  if (!pOCGDict)
+  if (!pOCGDict) {
     return true;
+  }
 
   ByteString csType = pOCGDict->GetByteStringFor("Type", "OCG");
-  if (csType == "OCG")
+  if (csType == "OCG") {
     return GetOCGVisible(pOCGDict);
+  }
   return LoadOCMDState(pOCGDict);
 }
diff --git a/core/fpdfapi/page/cpdf_page.cpp b/core/fpdfapi/page/cpdf_page.cpp
index 7560185..e6fe873 100644
--- a/core/fpdfapi/page/cpdf_page.cpp
+++ b/core/fpdfapi/page/cpdf_page.cpp
@@ -65,11 +65,13 @@
 }
 
 void CPDF_Page::ParseContent() {
-  if (GetParseState() == ParseState::kParsed)
+  if (GetParseState() == ParseState::kParsed) {
     return;
+  }
 
-  if (GetParseState() == ParseState::kNotParsed)
+  if (GetParseState() == ParseState::kNotParsed) {
     StartParse(std::make_unique<CPDF_ContentParser>(this));
+  }
 
   DCHECK_EQ(GetParseState(), ParseState::kParsing);
   ContinueParse(nullptr);
@@ -85,8 +87,9 @@
   RetainPtr<const CPDF_Dictionary> pPageDict = GetDict();
   while (pPageDict && !pdfium::Contains(visited, pPageDict)) {
     RetainPtr<const CPDF_Object> pObj = pPageDict->GetDirectObjectFor(name);
-    if (pObj)
+    if (pObj) {
       return pObj;
+    }
 
     visited.insert(pPageDict);
     pPageDict = pPageDict->GetDictFor(pdfium::page_object::kParent);
@@ -121,8 +124,9 @@
 }
 
 CFX_Matrix CPDF_Page::GetDisplayMatrix(const FX_RECT& rect, int iRotate) const {
-  if (m_PageSize.width == 0 || m_PageSize.height == 0)
+  if (m_PageSize.width == 0 || m_PageSize.height == 0) {
     return CFX_Matrix();
+  }
 
   float x0 = 0;
   float y0 = 0;
@@ -211,20 +215,23 @@
 }
 
 void CPDF_Page::ClearView() {
-  if (m_pView)
+  if (m_pView) {
     m_pView->ClearPage(this);
+  }
 }
 
 void CPDF_Page::UpdateDimensions() {
   CFX_FloatRect mediabox = GetBox(pdfium::page_object::kMediaBox);
-  if (mediabox.IsEmpty())
+  if (mediabox.IsEmpty()) {
     mediabox = CFX_FloatRect(0, 0, 612, 792);
+  }
 
   m_BBox = GetBox(pdfium::page_object::kCropBox);
-  if (m_BBox.IsEmpty())
+  if (m_BBox.IsEmpty()) {
     m_BBox = mediabox;
-  else
+  } else {
     m_BBox.Intersect(mediabox);
+  }
 
   m_PageSize.width = m_BBox.Width();
   m_PageSize.height = m_BBox.Height();
@@ -252,6 +259,7 @@
     : m_pPage(pPage) {}
 
 CPDF_Page::RenderContextClearer::~RenderContextClearer() {
-  if (m_pPage)
+  if (m_pPage) {
     m_pPage->ClearRenderContext();
+  }
 }
diff --git a/core/fpdfapi/page/cpdf_pageimagecache.cpp b/core/fpdfapi/page/cpdf_pageimagecache.cpp
index 8b58973..bc22016 100644
--- a/core/fpdfapi/page/cpdf_pageimagecache.cpp
+++ b/core/fpdfapi/page/cpdf_pageimagecache.cpp
@@ -117,8 +117,9 @@
 CPDF_PageImageCache::~CPDF_PageImageCache() = default;
 
 void CPDF_PageImageCache::CacheOptimization(int32_t dwLimitCacheSize) {
-  if (m_nCacheSize <= (uint32_t)dwLimitCacheSize)
+  if (m_nCacheSize <= (uint32_t)dwLimitCacheSize) {
     return;
+  }
 
   uint32_t nCount = fxcrt::CollectionSize<uint32_t>(m_ImageCache);
   std::vector<CacheInfo> cache_info;
@@ -133,23 +134,27 @@
   // The comparison is legal because uint32_t is an unsigned type.
   uint32_t nTimeCount = m_nTimeCount;
   if (nTimeCount + 1 < nTimeCount) {
-    for (uint32_t i = 0; i < nCount; i++)
+    for (uint32_t i = 0; i < nCount; i++) {
       m_ImageCache[cache_info[i].pStream]->SetTimeCount(i);
+    }
     m_nTimeCount = nCount;
   }
 
   size_t i = 0;
-  while (i + 15 < nCount)
+  while (i + 15 < nCount) {
     ClearImageCacheEntry(cache_info[i++].pStream);
+  }
 
-  while (i < nCount && m_nCacheSize > (uint32_t)dwLimitCacheSize)
+  while (i < nCount && m_nCacheSize > (uint32_t)dwLimitCacheSize) {
     ClearImageCacheEntry(cache_info[i++].pStream);
+  }
 }
 
 void CPDF_PageImageCache::ClearImageCacheEntry(const CPDF_Stream* pStream) {
   auto it = m_ImageCache.find(pStream);
-  if (it == m_ImageCache.end())
+  if (it == m_ImageCache.end()) {
     return;
+  }
 
   m_nCacheSize -= it->second->EstimateSize();
 
@@ -171,8 +176,9 @@
     bool bLoadMask,
     const CFX_Size& max_size_required) {
   // A cross-document image may have come from the embedder.
-  if (m_pPage->GetDocument() != pImage->GetDocument())
+  if (m_pPage->GetDocument() != pImage->GetDocument()) {
     return false;
+  }
 
   RetainPtr<const CPDF_Stream> pStream = pImage->GetStream();
   const auto it = m_ImageCache.find(pStream);
@@ -185,23 +191,27 @@
   CPDF_DIB::LoadState ret = m_pCurImageCacheEntry->StartGetCachedBitmap(
       this, pFormResources, pPageResources, bStdCS, eFamily, bLoadMask,
       max_size_required);
-  if (ret == CPDF_DIB::LoadState::kContinue)
+  if (ret == CPDF_DIB::LoadState::kContinue) {
     return true;
+  }
 
   m_nTimeCount++;
-  if (!m_bCurFindCache)
+  if (!m_bCurFindCache) {
     m_ImageCache[pStream] = m_pCurImageCacheEntry.Release();
+  }
 
-  if (ret == CPDF_DIB::LoadState::kFail)
+  if (ret == CPDF_DIB::LoadState::kFail) {
     m_nCacheSize += m_pCurImageCacheEntry->EstimateSize();
+  }
 
   return false;
 }
 
 bool CPDF_PageImageCache::Continue(PauseIndicatorIface* pPause) {
   bool ret = m_pCurImageCacheEntry->Continue(pPause, this);
-  if (ret)
+  if (ret) {
     return true;
+  }
 
   m_nTimeCount++;
   if (!m_bCurFindCache) {
@@ -215,8 +225,9 @@
 void CPDF_PageImageCache::ResetBitmapForImage(RetainPtr<CPDF_Image> pImage) {
   RetainPtr<const CPDF_Stream> pStream = pImage->GetStream();
   const auto it = m_ImageCache.find(pStream);
-  if (it == m_ImageCache.end())
+  if (it == m_ImageCache.end()) {
     return;
+  }
 
   Entry* pEntry = it->second.get();
   m_nCacheSize -= pEntry->EstimateSize();
@@ -274,13 +285,15 @@
       max_size_required);
   m_bCachedSetMaxSizeRequired =
       (max_size_required.width != 0 && max_size_required.height != 0);
-  if (ret == CPDF_DIB::LoadState::kContinue)
+  if (ret == CPDF_DIB::LoadState::kContinue) {
     return CPDF_DIB::LoadState::kContinue;
+  }
 
-  if (ret == CPDF_DIB::LoadState::kSuccess)
+  if (ret == CPDF_DIB::LoadState::kSuccess) {
     ContinueGetCachedBitmap(pPageImageCache);
-  else
+  } else {
     m_pCurBitmap.Reset();
+  }
   return CPDF_DIB::LoadState::kFail;
 }
 
@@ -289,13 +302,15 @@
     CPDF_PageImageCache* pPageImageCache) {
   CPDF_DIB::LoadState ret =
       m_pCurBitmap.AsRaw<CPDF_DIB>()->ContinueLoadDIBBase(pPause);
-  if (ret == CPDF_DIB::LoadState::kContinue)
+  if (ret == CPDF_DIB::LoadState::kContinue) {
     return true;
+  }
 
-  if (ret == CPDF_DIB::LoadState::kSuccess)
+  if (ret == CPDF_DIB::LoadState::kSuccess) {
     ContinueGetCachedBitmap(pPageImageCache);
-  else
+  } else {
     m_pCurBitmap.Reset();
+  }
   return false;
 }
 
@@ -321,10 +336,12 @@
 
 void CPDF_PageImageCache::Entry::CalcSize() {
   m_dwCacheSize = 0;
-  if (m_pCachedBitmap)
+  if (m_pCachedBitmap) {
     m_dwCacheSize += m_pCachedBitmap->GetEstimatedImageMemoryBurden();
-  if (m_pCachedMask)
+  }
+  if (m_pCachedMask) {
     m_dwCacheSize += m_pCachedMask->GetEstimatedImageMemoryBurden();
+  }
 }
 
 bool CPDF_PageImageCache::Entry::IsCacheValid(
diff --git a/core/fpdfapi/page/cpdf_pageobjectholder.cpp b/core/fpdfapi/page/cpdf_pageobjectholder.cpp
index fd5b231..a8d0293 100644
--- a/core/fpdfapi/page/cpdf_pageobjectholder.cpp
+++ b/core/fpdfapi/page/cpdf_pageobjectholder.cpp
@@ -21,16 +21,19 @@
 #include "core/fxcrt/stl_util.h"
 
 bool GraphicsData::operator<(const GraphicsData& other) const {
-  if (!FXSYS_SafeEQ(fillAlpha, other.fillAlpha))
+  if (!FXSYS_SafeEQ(fillAlpha, other.fillAlpha)) {
     return FXSYS_SafeLT(fillAlpha, other.fillAlpha);
-  if (!FXSYS_SafeEQ(strokeAlpha, other.strokeAlpha))
+  }
+  if (!FXSYS_SafeEQ(strokeAlpha, other.strokeAlpha)) {
     return FXSYS_SafeLT(strokeAlpha, other.strokeAlpha);
+  }
   return blendType < other.blendType;
 }
 
 bool FontData::operator<(const FontData& other) const {
-  if (baseFont != other.baseFont)
+  if (baseFont != other.baseFont) {
     return baseFont < other.baseFont;
+  }
   return type < other.type;
 }
 
@@ -60,12 +63,14 @@
 }
 
 void CPDF_PageObjectHolder::ContinueParse(PauseIndicatorIface* pPause) {
-  if (m_ParseState == ParseState::kParsed)
+  if (m_ParseState == ParseState::kParsed) {
     return;
+  }
 
   DCHECK_EQ(m_ParseState, ParseState::kParsing);
-  if (m_pParser->Continue(pPause))
+  if (m_pParser->Continue(pPause)) {
     return;
+  }
 
   m_ParseState = ParseState::kParsed;
   m_pDocument->IncrementParsedPageCount();
@@ -87,8 +92,9 @@
 std::optional<ByteString> CPDF_PageObjectHolder::GraphicsMapSearch(
     const GraphicsData& gd) {
   auto it = m_GraphicsMap.find(gd);
-  if (it == m_GraphicsMap.end())
+  if (it == m_GraphicsMap.end()) {
     return std::nullopt;
+  }
 
   return it->second;
 }
@@ -101,8 +107,9 @@
 std::optional<ByteString> CPDF_PageObjectHolder::FontsMapSearch(
     const FontData& fd) {
   auto it = m_FontsMap.find(fd);
-  if (it == m_FontsMap.end())
+  if (it == m_FontsMap.end()) {
     return std::nullopt;
+  }
 
   return it->second;
 }
@@ -144,16 +151,18 @@
 
 void CPDF_PageObjectHolder::LoadTransparencyInfo() {
   RetainPtr<const CPDF_Dictionary> pGroup = m_pDict->GetDictFor("Group");
-  if (!pGroup)
+  if (!pGroup) {
     return;
+  }
 
   if (pGroup->GetByteStringFor(pdfium::transparency::kGroupSubType) !=
       pdfium::transparency::kTransparency) {
     return;
   }
   m_Transparency.SetGroup();
-  if (pGroup->GetIntegerFor(pdfium::transparency::kI))
+  if (pGroup->GetIntegerFor(pdfium::transparency::kI)) {
     m_Transparency.SetIsolated();
+  }
 }
 
 size_t CPDF_PageObjectHolder::GetActivePageObjectCount() const {
@@ -183,22 +192,25 @@
     CPDF_PageObject* pPageObj) {
   auto it = std::find(std::begin(m_PageObjectList), std::end(m_PageObjectList),
                       fxcrt::MakeFakeUniquePtr(pPageObj));
-  if (it == std::end(m_PageObjectList))
+  if (it == std::end(m_PageObjectList)) {
     return nullptr;
+  }
 
   std::unique_ptr<CPDF_PageObject> result = std::move(*it);
   m_PageObjectList.erase(it);
 
   int32_t content_stream = pPageObj->GetContentStream();
-  if (content_stream >= 0)
+  if (content_stream >= 0) {
     m_DirtyStreams.insert(content_stream);
+  }
 
   return result;
 }
 
 bool CPDF_PageObjectHolder::ErasePageObjectAtIndex(size_t index) {
-  if (index >= m_PageObjectList.size())
+  if (index >= m_PageObjectList.size()) {
     return false;
+  }
 
   m_PageObjectList.erase(m_PageObjectList.begin() + index);
   return true;
diff --git a/core/fpdfapi/page/cpdf_pathobject.cpp b/core/fpdfapi/page/cpdf_pathobject.cpp
index 82d50c7..f7af055 100644
--- a/core/fpdfapi/page/cpdf_pathobject.cpp
+++ b/core/fpdfapi/page/cpdf_pathobject.cpp
@@ -36,8 +36,9 @@
 }
 
 void CPDF_PathObject::CalcBoundingBox() {
-  if (!m_Path.HasRef())
+  if (!m_Path.HasRef()) {
     return;
+  }
   CFX_FloatRect rect;
   float width = graph_state().GetLineWidth();
   if (m_bStroke && width != 0) {
@@ -48,8 +49,9 @@
   }
   rect = m_Matrix.TransformRect(rect);
 
-  if (width == 0 && m_bStroke)
+  if (width == 0 && m_bStroke) {
     rect.Inflate(0.5f, 0.5f);
+  }
   SetRect(rect);
 }
 
diff --git a/core/fpdfapi/page/cpdf_patterncs.cpp b/core/fpdfapi/page/cpdf_patterncs.cpp
index 605a3d4..fc00f71 100644
--- a/core/fpdfapi/page/cpdf_patterncs.cpp
+++ b/core/fpdfapi/page/cpdf_patterncs.cpp
@@ -25,17 +25,20 @@
                                 const CPDF_Array* pArray,
                                 std::set<const CPDF_Object*>* pVisited) {
   RetainPtr<const CPDF_Object> pBaseCS = pArray->GetDirectObjectAt(1);
-  if (HasSameArray(pBaseCS.Get()))
+  if (HasSameArray(pBaseCS.Get())) {
     return 0;
+  }
 
   auto* pDocPageData = CPDF_DocPageData::FromDocument(pDoc);
   m_pBaseCS =
       pDocPageData->GetColorSpaceGuarded(pBaseCS.Get(), nullptr, pVisited);
-  if (!m_pBaseCS)
+  if (!m_pBaseCS) {
     return 1;
+  }
 
-  if (m_pBaseCS->GetFamily() == Family::kPattern)
+  if (m_pBaseCS->GetFamily() == Family::kPattern) {
     return 0;
+  }
 
   if (m_pBaseCS->ComponentCount() > kMaxPatternColorComps) {
     return 0;
diff --git a/core/fpdfapi/page/cpdf_psengine.cpp b/core/fpdfapi/page/cpdf_psengine.cpp
index 2918736..9322692 100644
--- a/core/fpdfapi/page/cpdf_psengine.cpp
+++ b/core/fpdfapi/page/cpdf_psengine.cpp
@@ -74,10 +74,12 @@
 // Round half up is a nearest integer round with half-way numbers always rounded
 // up. Example: -5.5 rounds to -5.
 float RoundHalfUp(float f) {
-  if (isnan(f))
+  if (isnan(f)) {
     return 0;
-  if (f > std::numeric_limits<float>::max() - 0.5f)
+  }
+  if (f > std::numeric_limits<float>::max() - 0.5f) {
     return std::numeric_limits<float>::max();
+  }
   return floor(f + 0.5f);
 }
 
@@ -119,21 +121,25 @@
 CPDF_PSProc::~CPDF_PSProc() = default;
 
 bool CPDF_PSProc::Parse(CPDF_SimpleParser* parser, int depth) {
-  if (depth > kMaxDepth)
+  if (depth > kMaxDepth) {
     return false;
+  }
 
   while (true) {
     ByteStringView word = parser->GetWord();
-    if (word.IsEmpty())
+    if (word.IsEmpty()) {
       return false;
+    }
 
-    if (word == "}")
+    if (word == "}") {
       return true;
+    }
 
     if (word == "{") {
       m_Operators.push_back(std::make_unique<CPDF_PSOP>());
-      if (!m_Operators.back()->Parse(parser, depth + 1))
+      if (!m_Operators.back()->Parse(parser, depth + 1)) {
         return false;
+      }
       continue;
     }
 
@@ -144,8 +150,9 @@
 bool CPDF_PSProc::Execute(CPDF_PSEngine* pEngine) {
   for (size_t i = 0; i < m_Operators.size(); ++i) {
     const PDF_PSOP op = m_Operators[i]->GetOp();
-    if (op == PSOP_PROC)
+    if (op == PSOP_PROC) {
       continue;
+    }
 
     if (op == PSOP_CONST) {
       pEngine->Push(m_Operators[i]->GetFloatValue());
@@ -153,11 +160,13 @@
     }
 
     if (op == PSOP_IF) {
-      if (i == 0 || m_Operators[i - 1]->GetOp() != PSOP_PROC)
+      if (i == 0 || m_Operators[i - 1]->GetOp() != PSOP_PROC) {
         return false;
+      }
 
-      if (pEngine->PopInt())
+      if (pEngine->PopInt()) {
         m_Operators[i - 1]->Execute(pEngine);
+      }
     } else if (op == PSOP_IFELSE) {
       if (i < 2 || m_Operators[i - 1]->GetOp() != PSOP_PROC ||
           m_Operators[i - 2]->GetOp() != PSOP_PROC) {
@@ -182,10 +191,11 @@
                        [](const PDF_PSOpName& name, ByteStringView word) {
                          return name.name < word;
                        });
-  if (pFound != std::end(kPsOpNames) && pFound->name == word)
+  if (pFound != std::end(kPsOpNames) && pFound->name == word) {
     m_Operators.push_back(std::make_unique<CPDF_PSOP>(pFound->op));
-  else
+  } else {
     m_Operators.push_back(std::make_unique<CPDF_PSOP>(StringToFloat(word)));
+  }
 }
 
 CPDF_PSEngine::CPDF_PSEngine() = default;
@@ -193,8 +203,9 @@
 CPDF_PSEngine::~CPDF_PSEngine() = default;
 
 void CPDF_PSEngine::Push(float v) {
-  if (m_StackCount < kPSEngineStackSize)
+  if (m_StackCount < kPSEngineStackSize) {
     m_Stack[m_StackCount++] = v;
+  }
 }
 
 float CPDF_PSEngine::Pop() {
@@ -408,31 +419,37 @@
     case PSOP_COPY: {
       int n = PopInt();
       if (n < 0 || m_StackCount + n > kPSEngineStackSize ||
-          n > static_cast<int>(m_StackCount))
+          n > static_cast<int>(m_StackCount)) {
         break;
-      for (int i = 0; i < n; i++)
+      }
+      for (int i = 0; i < n; i++) {
         m_Stack[m_StackCount + i] = m_Stack[m_StackCount + i - n];
+      }
       m_StackCount += n;
       break;
     }
     case PSOP_INDEX: {
       int n = PopInt();
-      if (n < 0 || n >= static_cast<int>(m_StackCount))
+      if (n < 0 || n >= static_cast<int>(m_StackCount)) {
         break;
+      }
       Push(m_Stack[m_StackCount - n - 1]);
       break;
     }
     case PSOP_ROLL: {
       int j = PopInt();
       int n = PopInt();
-      if (j == 0 || n == 0 || m_StackCount == 0)
+      if (j == 0 || n == 0 || m_StackCount == 0) {
         break;
-      if (n < 0 || n > static_cast<int>(m_StackCount))
+      }
+      if (n < 0 || n > static_cast<int>(m_StackCount)) {
         break;
+      }
 
       j %= n;
-      if (j > 0)
+      if (j > 0) {
         j -= n;
+      }
       auto begin_it = std::begin(m_Stack) + m_StackCount - n;
       auto middle_it = begin_it - j;
       auto end_it = std::begin(m_Stack) + m_StackCount;
diff --git a/core/fpdfapi/page/cpdf_psfunc.cpp b/core/fpdfapi/page/cpdf_psfunc.cpp
index 60ec52b..2e9abe7 100644
--- a/core/fpdfapi/page/cpdf_psfunc.cpp
+++ b/core/fpdfapi/page/cpdf_psfunc.cpp
@@ -23,12 +23,15 @@
 bool CPDF_PSFunc::v_Call(pdfium::span<const float> inputs,
                          pdfium::span<float> results) const {
   m_PS.Reset();
-  for (uint32_t i = 0; i < m_nInputs; i++)
+  for (uint32_t i = 0; i < m_nInputs; i++) {
     m_PS.Push(inputs[i]);
+  }
   m_PS.Execute();
-  if (m_PS.GetStackSize() < m_nOutputs)
+  if (m_PS.GetStackSize() < m_nOutputs) {
     return false;
-  for (uint32_t i = 0; i < m_nOutputs; i++)
+  }
+  for (uint32_t i = 0; i < m_nOutputs; i++) {
     results[m_nOutputs - i - 1] = m_PS.Pop();
+  }
   return true;
 }
diff --git a/core/fpdfapi/page/cpdf_sampledfunc.cpp b/core/fpdfapi/page/cpdf_sampledfunc.cpp
index 5e53a74..1c1a5d4 100644
--- a/core/fpdfapi/page/cpdf_sampledfunc.cpp
+++ b/core/fpdfapi/page/cpdf_sampledfunc.cpp
@@ -46,17 +46,20 @@
 
 bool CPDF_SampledFunc::v_Init(const CPDF_Object* pObj, VisitedSet* pVisited) {
   RetainPtr<const CPDF_Stream> pStream(pObj->AsStream());
-  if (!pStream)
+  if (!pStream) {
     return false;
+  }
 
   RetainPtr<const CPDF_Dictionary> pDict = pStream->GetDict();
   RetainPtr<const CPDF_Array> pSize = pDict->GetArrayFor("Size");
-  if (!pSize || pSize->IsEmpty())
+  if (!pSize || pSize->IsEmpty()) {
     return false;
+  }
 
   m_nBitsPerSample = pDict->GetIntegerFor("BitsPerSample");
-  if (!IsValidBitsPerSample(m_nBitsPerSample))
+  if (!IsValidBitsPerSample(m_nBitsPerSample)) {
     return false;
+  }
 
   FX_SAFE_UINT32 nTotalSampleBits = m_nBitsPerSample;
   nTotalSampleBits *= m_nOutputs;
@@ -64,8 +67,9 @@
   m_EncodeInfo.resize(m_nInputs);
   for (uint32_t i = 0; i < m_nInputs; i++) {
     int size = pSize->GetIntegerAt(i);
-    if (size <= 0)
+    if (size <= 0) {
       return false;
+    }
 
     m_EncodeInfo[i].sizes = size;
     nTotalSampleBits *= m_EncodeInfo[i].sizes;
@@ -79,14 +83,16 @@
     }
   }
   FX_SAFE_UINT32 nTotalSampleBytes = (nTotalSampleBits + 7) / 8;
-  if (!nTotalSampleBytes.IsValid() || nTotalSampleBytes.ValueOrDie() == 0)
+  if (!nTotalSampleBytes.IsValid() || nTotalSampleBytes.ValueOrDie() == 0) {
     return false;
+  }
 
   m_SampleMax = 0xffffffff >> (32 - m_nBitsPerSample);
   m_pSampleStream = pdfium::MakeRetain<CPDF_StreamAcc>(std::move(pStream));
   m_pSampleStream->LoadAllDataFiltered();
-  if (nTotalSampleBytes.ValueOrDie() > m_pSampleStream->GetSize())
+  if (nTotalSampleBytes.ValueOrDie() > m_pSampleStream->GetSize()) {
     return false;
+  }
 
   RetainPtr<const CPDF_Array> pDecode = pDict->GetArrayFor("Decode");
   m_DecodeInfo.resize(m_nOutputs);
diff --git a/core/fpdfapi/page/cpdf_shadingpattern.cpp b/core/fpdfapi/page/cpdf_shadingpattern.cpp
index af3d7f3..f946973 100644
--- a/core/fpdfapi/page/cpdf_shadingpattern.cpp
+++ b/core/fpdfapi/page/cpdf_shadingpattern.cpp
@@ -37,8 +37,9 @@
     : CPDF_Pattern(pDoc, std::move(pPatternObj), parentMatrix),
       m_bShading(bShading) {
   DCHECK(document());
-  if (!bShading)
+  if (!bShading) {
     SetPatternToFormMatrix();
+  }
 }
 
 CPDF_ShadingPattern::~CPDF_ShadingPattern() = default;
@@ -48,14 +49,16 @@
 }
 
 bool CPDF_ShadingPattern::Load() {
-  if (m_ShadingType != kInvalidShading)
+  if (m_ShadingType != kInvalidShading) {
     return true;
+  }
 
   RetainPtr<const CPDF_Object> pShadingObj = GetShadingObject();
   RetainPtr<const CPDF_Dictionary> pShadingDict =
       pShadingObj ? pShadingObj->GetDict() : nullptr;
-  if (!pShadingDict)
+  if (!pShadingDict) {
     return false;
+  }
 
   m_pFunctions.clear();
   RetainPtr<const CPDF_Object> pFunc =
@@ -72,16 +75,18 @@
   }
   RetainPtr<const CPDF_Object> pCSObj =
       pShadingDict->GetDirectObjectFor("ColorSpace");
-  if (!pCSObj)
+  if (!pCSObj) {
     return false;
+  }
 
   auto* pDocPageData = CPDF_DocPageData::FromDocument(document());
   m_pCS = pDocPageData->GetColorSpace(pCSObj.Get(), nullptr);
 
   // The color space is required and cannot be a Pattern space, according to the
   // PDF 1.7 spec, page 305.
-  if (!m_pCS || m_pCS->GetFamily() == CPDF_ColorSpace::Family::kPattern)
+  if (!m_pCS || m_pCS->GetFamily() == CPDF_ColorSpace::Family::kPattern) {
     return false;
+  }
 
   m_ShadingType = ToShadingType(pShadingDict->GetIntegerFor("ShadingType"));
   return Validate();
@@ -93,20 +98,23 @@
 }
 
 bool CPDF_ShadingPattern::Validate() const {
-  if (m_ShadingType == kInvalidShading)
+  if (m_ShadingType == kInvalidShading) {
     return false;
+  }
 
   // We expect to have a stream if our shading type is a mesh.
-  if (IsMeshShading() && !ToStream(GetShadingObject()))
+  if (IsMeshShading() && !ToStream(GetShadingObject())) {
     return false;
+  }
 
   // Validate color space
   switch (m_ShadingType) {
     case kFunctionBasedShading:
     case kAxialShading:
     case kRadialShading: {
-      if (m_pCS->GetFamily() == CPDF_ColorSpace::Family::kIndexed)
+      if (m_pCS->GetFamily() == CPDF_ColorSpace::Family::kIndexed) {
         return false;
+      }
       break;
     }
     case kFreeFormGouraudTriangleMeshShading:
@@ -155,13 +163,15 @@
     uint32_t nExpectedNumFunctions,
     uint32_t nExpectedNumInputs,
     uint32_t nExpectedNumOutputs) const {
-  if (m_pFunctions.size() != nExpectedNumFunctions)
+  if (m_pFunctions.size() != nExpectedNumFunctions) {
     return false;
+  }
 
   FX_SAFE_UINT32 nTotalOutputs = 0;
   for (const auto& function : m_pFunctions) {
-    if (!function)
+    if (!function) {
       return false;
+    }
 
     if (function->InputCount() != nExpectedNumInputs ||
         function->OutputCount() != nExpectedNumOutputs) {
diff --git a/core/fpdfapi/page/cpdf_stitchfunc.cpp b/core/fpdfapi/page/cpdf_stitchfunc.cpp
index ddce719..51b7e07 100644
--- a/core/fpdfapi/page/cpdf_stitchfunc.cpp
+++ b/core/fpdfapi/page/cpdf_stitchfunc.cpp
@@ -25,40 +25,48 @@
 CPDF_StitchFunc::~CPDF_StitchFunc() = default;
 
 bool CPDF_StitchFunc::v_Init(const CPDF_Object* pObj, VisitedSet* pVisited) {
-  if (m_nInputs != kRequiredNumInputs)
+  if (m_nInputs != kRequiredNumInputs) {
     return false;
+  }
 
   CHECK(pObj->IsDictionary() || pObj->IsStream());
   RetainPtr<const CPDF_Dictionary> pDict = pObj->GetDict();
   RetainPtr<const CPDF_Array> pFunctionsArray = pDict->GetArrayFor("Functions");
-  if (!pFunctionsArray)
+  if (!pFunctionsArray) {
     return false;
+  }
 
   RetainPtr<const CPDF_Array> pBoundsArray = pDict->GetArrayFor("Bounds");
-  if (!pBoundsArray)
+  if (!pBoundsArray) {
     return false;
+  }
 
   RetainPtr<const CPDF_Array> pEncodeArray = pDict->GetArrayFor("Encode");
-  if (!pEncodeArray)
+  if (!pEncodeArray) {
     return false;
+  }
 
   const uint32_t nSubs = fxcrt::CollectionSize<uint32_t>(*pFunctionsArray);
-  if (nSubs == 0)
+  if (nSubs == 0) {
     return false;
+  }
 
   // Check array sizes. The checks are slightly relaxed to allow the "Bounds"
   // and "Encode" arrays to have more than the required number of elements.
   {
-    if (pBoundsArray->size() < nSubs - 1)
+    if (pBoundsArray->size() < nSubs - 1) {
       return false;
+    }
 
     FX_SAFE_UINT32 nExpectedEncodeSize = nSubs;
     nExpectedEncodeSize *= 2;
-    if (!nExpectedEncodeSize.IsValid())
+    if (!nExpectedEncodeSize.IsValid()) {
       return false;
+    }
 
-    if (pEncodeArray->size() < nExpectedEncodeSize.ValueOrDie())
+    if (pEncodeArray->size() < nExpectedEncodeSize.ValueOrDie()) {
       return false;
+    }
   }
 
   // Check sub-functions.
@@ -66,13 +74,15 @@
     std::optional<uint32_t> nOutputs;
     for (uint32_t i = 0; i < nSubs; ++i) {
       RetainPtr<const CPDF_Object> pSub = pFunctionsArray->GetDirectObjectAt(i);
-      if (pSub == pObj)
+      if (pSub == pObj) {
         return false;
+      }
 
       std::unique_ptr<CPDF_Function> pFunc =
           CPDF_Function::Load(std::move(pSub), pVisited);
-      if (!pFunc)
+      if (!pFunc) {
         return false;
+      }
 
       // Check that the input dimensionality is 1, and that all output
       // dimensionalities are the same.
@@ -81,12 +91,14 @@
       }
 
       uint32_t nFuncOutputs = pFunc->OutputCount();
-      if (nFuncOutputs == 0)
+      if (nFuncOutputs == 0) {
         return false;
+      }
 
       if (nOutputs.has_value()) {
-        if (nOutputs != nFuncOutputs)
+        if (nOutputs != nFuncOutputs) {
           return false;
+        }
       } else {
         nOutputs = nFuncOutputs;
       }
@@ -97,8 +109,9 @@
 
   m_bounds.reserve(nSubs + 1);
   m_bounds.push_back(m_Domains[0]);
-  for (uint32_t i = 0; i < nSubs - 1; i++)
+  for (uint32_t i = 0; i < nSubs - 1; i++) {
     m_bounds.push_back(pBoundsArray->GetFloatAt(i));
+  }
   m_bounds.push_back(m_Domains[1]);
 
   m_encode = ReadArrayElementsToVector(pEncodeArray.Get(), nSubs * 2);
@@ -110,8 +123,9 @@
   float input = inputs[0];
   size_t i;
   for (i = 0; i + 1 < m_pSubFunctions.size(); i++) {
-    if (input < m_bounds[i + 1])
+    if (input < m_bounds[i + 1]) {
       break;
+    }
   }
   input = Interpolate(input, m_bounds[i], m_bounds[i + 1], m_encode[i * 2],
                       m_encode[i * 2 + 1]);
diff --git a/core/fpdfapi/page/cpdf_streamcontentparser.cpp b/core/fpdfapi/page/cpdf_streamcontentparser.cpp
index ae1bd1a..1a25679 100644
--- a/core/fpdfapi/page/cpdf_streamcontentparser.cpp
+++ b/core/fpdfapi/page/cpdf_streamcontentparser.cpp
@@ -75,13 +75,15 @@
   ShadingType type = pShading->GetShadingType();
   RetainPtr<const CPDF_Stream> pStream = ToStream(pShading->GetShadingObject());
   RetainPtr<CPDF_ColorSpace> pCS = pShading->GetCS();
-  if (!pStream || !pCS)
+  if (!pStream || !pCS) {
     return CFX_FloatRect();
+  }
 
   CPDF_MeshStream stream(type, pShading->GetFuncs(), std::move(pStream),
                          std::move(pCS));
-  if (!stream.Load())
+  if (!stream.Load()) {
     return CFX_FloatRect();
+  }
 
   CFX_FloatRect rect;
   bool update_rect = false;
@@ -89,24 +91,28 @@
                   type == kLatticeFormGouraudTriangleMeshShading;
 
   int point_count;
-  if (type == kTensorProductPatchMeshShading)
+  if (type == kTensorProductPatchMeshShading) {
     point_count = kTensorCoordinatePairs;
-  else if (type == kCoonsPatchMeshShading)
+  } else if (type == kCoonsPatchMeshShading) {
     point_count = kCoonsCoordinatePairs;
-  else
+  } else {
     point_count = kSingleCoordinatePair;
+  }
 
   int color_count;
-  if (type == kCoonsPatchMeshShading || type == kTensorProductPatchMeshShading)
+  if (type == kCoonsPatchMeshShading ||
+      type == kTensorProductPatchMeshShading) {
     color_count = kQuadColorsPerPatch;
-  else
+  } else {
     color_count = kSingleColorPerPatch;
+  }
 
   while (!stream.IsEOF()) {
     uint32_t flag = 0;
     if (type != kLatticeFormGouraudTriangleMeshShading) {
-      if (!stream.CanReadFlag())
+      if (!stream.CanReadFlag()) {
         break;
+      }
       flag = stream.ReadFlag();
     }
 
@@ -116,8 +122,9 @@
     }
 
     for (int i = 0; i < point_count; ++i) {
-      if (!stream.CanReadCoords())
+      if (!stream.CanReadCoords()) {
         break;
+      }
 
       CFX_PointF origin = stream.ReadCoords();
       if (update_rect) {
@@ -130,12 +137,14 @@
     FX_SAFE_UINT32 nBits = stream.Components();
     nBits *= stream.ComponentBits();
     nBits *= color_count;
-    if (!nBits.IsValid())
+    if (!nBits.IsValid()) {
       break;
+    }
 
     stream.SkipBits(nBits.ValueOrDie());
-    if (bGouraud)
+    if (bGouraud) {
       stream.ByteAlign();
+    }
   }
   return matrix.TransformRect(rect);
 }
@@ -169,8 +178,9 @@
 ByteStringView FindFullName(pdfium::span<const AbbrPair> table,
                             ByteStringView abbr) {
   for (const auto& pair : table) {
-    if (pair.abbr == abbr)
+    if (pair.abbr == abbr) {
       return ByteStringView(pair.full_name);
+    }
   }
   return ByteStringView();
 }
@@ -210,10 +220,11 @@
     }
   }
   for (const auto& op : replacements) {
-    if (op.is_replace_key)
+    if (op.is_replace_key) {
       pDict->ReplaceKey(op.key, ByteString(op.replacement));
-    else
+    } else {
       pDict->SetNewFor<CPDF_Name>(op.key, ByteString(op.replacement));
+    }
   }
 }
 
@@ -224,8 +235,9 @@
       ByteString name = pElement->GetString();
       ByteStringView fullname =
           FindFullName(kInlineValueAbbr, name.AsStringView());
-      if (!fullname.IsEmpty())
+      if (!fullname.IsEmpty()) {
         pArray->SetNewAt<CPDF_Name>(i, ByteString(fullname));
+      }
     } else {
       ReplaceAbbr(std::move(pElement));
     }
@@ -240,8 +252,9 @@
   }
 
   CPDF_Array* pArray = pObj->AsMutableArray();
-  if (pArray)
+  if (pArray) {
     ReplaceAbbrInArray(pArray);
+  }
 }
 
 }  // namespace
@@ -393,8 +406,9 @@
       m_RecursionState(recursion_state),
       m_BBox(rcBBox),
       m_pCurStates(std::make_unique<CPDF_AllStates>()) {
-  if (pmtContentToUser)
+  if (pmtContentToUser) {
     m_mtContentToUser = *pmtContentToUser;
+  }
   if (pStates) {
     *m_pCurStates = *pStates;
   } else {
@@ -490,12 +504,14 @@
 }
 
 ByteString CPDF_StreamContentParser::GetString(uint32_t index) const {
-  if (index >= m_ParamCount)
+  if (index >= m_ParamCount) {
     return ByteString();
+  }
 
   int real_index = m_ParamStartPos + m_ParamCount - index - 1;
-  if (real_index >= kParamBufSize)
+  if (real_index >= kParamBufSize) {
     real_index -= kParamBufSize;
+  }
 
   const ContentParam& param = m_ParamBuf[real_index];
   if (std::holds_alternative<ByteString>(param)) {
@@ -513,12 +529,14 @@
 }
 
 float CPDF_StreamContentParser::GetNumber(uint32_t index) const {
-  if (index >= m_ParamCount)
+  if (index >= m_ParamCount) {
     return 0;
+  }
 
   int real_index = m_ParamStartPos + m_ParamCount - index - 1;
-  if (real_index >= kParamBufSize)
+  if (real_index >= kParamBufSize) {
     real_index -= kParamBufSize;
+  }
 
   const ContentParam& param = m_ParamBuf[real_index];
   if (std::holds_alternative<FX_Number>(param)) {
@@ -537,8 +555,9 @@
 
 std::vector<float> CPDF_StreamContentParser::GetNumbers(size_t count) const {
   std::vector<float> values(count);
-  for (size_t i = 0; i < count; ++i)
+  for (size_t i = 0; i < count; ++i) {
     values[i] = GetNumber(count - i - 1);
+  }
   return values;
 }
 
@@ -596,8 +615,9 @@
 
 void CPDF_StreamContentParser::Handle_BeginMarkedContent_Dictionary() {
   RetainPtr<CPDF_Object> pProperty = GetObject(0);
-  if (!pProperty)
+  if (!pProperty) {
     return;
+  }
 
   ByteString tag = GetString(1);
   std::unique_ptr<CPDF_ContentMarks> new_marks =
@@ -606,8 +626,9 @@
   if (pProperty->IsName()) {
     ByteString property_name = pProperty->GetString();
     RetainPtr<CPDF_Dictionary> pHolder = FindResourceHolder("Properties");
-    if (!pHolder || !pHolder->GetDictFor(property_name))
+    if (!pHolder || !pHolder->GetDictFor(property_name)) {
       return;
+    }
     new_marks->AddMarkWithPropertiesHolder(tag, std::move(pHolder),
                                            property_name);
   } else if (pProperty->IsDictionary()) {
@@ -650,8 +671,9 @@
       ByteString name = pCSObj->GetString();
       if (name != "DeviceRGB" && name != "DeviceGray" && name != "DeviceCMYK") {
         pCSObj = FindResourceObj("ColorSpace", name);
-        if (pCSObj && pCSObj->IsInline())
+        if (pCSObj && pCSObj->IsInline()) {
           pDict->SetFor("ColorSpace", pCSObj->Clone());
+        }
       }
     }
   }
@@ -660,20 +682,24 @@
       m_pSyntax->ReadInlineStream(m_pDocument, std::move(pDict), pCSObj.Get());
   while (true) {
     CPDF_StreamParser::ElementType type = m_pSyntax->ParseNextElement();
-    if (type == CPDF_StreamParser::ElementType::kEndOfData)
+    if (type == CPDF_StreamParser::ElementType::kEndOfData) {
       break;
+    }
 
-    if (type != CPDF_StreamParser::ElementType::kKeyword)
+    if (type != CPDF_StreamParser::ElementType::kKeyword) {
       continue;
+    }
 
-    if (m_pSyntax->GetWord() == "EI")
+    if (m_pSyntax->GetWord() == "EI") {
       break;
+    }
   }
   CPDF_ImageObject* pObj = AddImageFromStream(std::move(pStream), /*name=*/"");
   // Record the bounding box of this image, so rendering code can draw it
   // properly.
-  if (pObj && pObj->GetImage()->IsMask())
+  if (pObj && pObj->GetImage()->IsMask()) {
     m_pObjectHolder->AddImageMaskBoundingBox(pObj->GetRect());
+  }
 }
 
 void CPDF_StreamContentParser::Handle_BeginMarkedContent() {
@@ -704,8 +730,9 @@
 
 void CPDF_StreamContentParser::Handle_SetColorSpace_Fill() {
   RetainPtr<CPDF_ColorSpace> pCS = FindColorSpace(GetString(0));
-  if (!pCS)
+  if (!pCS) {
     return;
+  }
 
   m_pCurStates->mutable_color_state().GetMutableFillColor()->SetColorSpace(
       std::move(pCS));
@@ -713,8 +740,9 @@
 
 void CPDF_StreamContentParser::Handle_SetColorSpace_Stroke() {
   RetainPtr<CPDF_ColorSpace> pCS = FindColorSpace(GetString(0));
-  if (!pCS)
+  if (!pCS) {
     return;
+  }
 
   m_pCurStates->mutable_color_state().GetMutableStrokeColor()->SetColorSpace(
       std::move(pCS));
@@ -722,8 +750,9 @@
 
 void CPDF_StreamContentParser::Handle_SetDash() {
   RetainPtr<CPDF_Array> pArray = ToArray(GetObject(1));
-  if (!pArray)
+  if (!pArray) {
     return;
+  }
 
   m_pCurStates->SetLineDash(pArray.Get(), GetNumber(0));
 }
@@ -748,14 +777,16 @@
     CPDF_ImageObject* pObj = AddLastImage();
     // Record the bounding box of this image, so rendering code can draw it
     // properly.
-    if (pObj && pObj->GetImage()->IsMask())
+    if (pObj && pObj->GetImage()->IsMask()) {
       m_pObjectHolder->AddImageMaskBoundingBox(pObj->GetRect());
+    }
     return;
   }
 
   RetainPtr<CPDF_Stream> pXObject(ToStream(FindResourceObj("XObject", name)));
-  if (!pXObject)
+  if (!pXObject) {
     return;
+  }
 
   const ByteString type = pXObject->GetDict()->GetByteStringFor("Subtype");
   if (type == "Form") {
@@ -772,8 +803,9 @@
     m_LastImageName = std::move(name);
     if (pObj) {
       m_pLastImage = pObj->GetImage();
-      if (m_pLastImage->IsMask())
+      if (m_pLastImage->IsMask()) {
         m_pObjectHolder->AddImageMaskBoundingBox(pObj->GetRect());
+      }
     }
   }
 }
@@ -806,8 +838,9 @@
 CPDF_ImageObject* CPDF_StreamContentParser::AddImageFromStream(
     RetainPtr<CPDF_Stream> pStream,
     const ByteString& name) {
-  if (!pStream)
+  if (!pStream) {
     return nullptr;
+  }
 
   auto pImageObj = std::make_unique<CPDF_ImageObject>(GetCurrentStreamIndex());
   pImageObj->SetResourceName(name);
@@ -861,8 +894,9 @@
   DCHECK(m_ParamCount > 0);
   const uint32_t nvalues = m_ParamCount - 1;
   std::vector<float> values(nvalues);
-  for (size_t i = 0; i < nvalues; ++i)
+  for (size_t i = 0; i < nvalues; ++i) {
     values[i] = GetNumber(m_ParamCount - i - 1);
+  }
   return values;
 }
 
@@ -873,13 +907,15 @@
 void CPDF_StreamContentParser::Handle_EndMarkedContent() {
   // First element is a sentinel, so do not pop it, ever. This may come up if
   // the EMCs are mismatched with the BMC/BDCs.
-  if (m_ContentMarksStack.size() > 1)
+  if (m_ContentMarksStack.size() > 1) {
     m_ContentMarksStack.pop();
+  }
 }
 
 void CPDF_StreamContentParser::Handle_EndText() {
-  if (m_ClipTextList.empty())
+  if (m_ClipTextList.empty()) {
     return;
+  }
 
   if (TextRenderingModeIsClipMode(m_pCurStates->text_state().GetTextMode())) {
     m_pCurStates->mutable_clip_path().AppendTexts(&m_ClipTextList);
@@ -916,8 +952,9 @@
   ByteString name = GetString(0);
   RetainPtr<CPDF_Dictionary> pGS =
       ToDictionary(FindResourceObj("ExtGState", name));
-  if (!pGS)
+  if (!pGS) {
     return;
+  }
 
   CHECK(!name.IsEmpty());
   m_pCurStates->mutable_general_state().AppendGraphicsResourceName(
@@ -926,8 +963,9 @@
 }
 
 void CPDF_StreamContentParser::Handle_ClosePath() {
-  if (m_PathPoints.empty())
+  if (m_PathPoints.empty()) {
     return;
+  }
 
   if (m_PathStart.x != m_PathCurrent.x || m_PathStart.y != m_PathCurrent.y) {
     AddPathPointAndClose(m_PathStart, CFX_Path::Point::Type::kLine);
@@ -953,8 +991,9 @@
 }
 
 void CPDF_StreamContentParser::Handle_SetCMYKColor_Fill() {
-  if (m_ParamCount != 4)
+  if (m_ParamCount != 4) {
     return;
+  }
 
   m_pCurStates->mutable_color_state().SetFillColor(
       CPDF_ColorSpace::GetStockCS(CPDF_ColorSpace::Family::kDeviceCMYK),
@@ -962,8 +1001,9 @@
 }
 
 void CPDF_StreamContentParser::Handle_SetCMYKColor_Stroke() {
-  if (m_ParamCount != 4)
+  if (m_ParamCount != 4) {
     return;
+  }
 
   m_pCurStates->mutable_color_state().SetStrokeColor(
       CPDF_ColorSpace::GetStockCS(CPDF_ColorSpace::Family::kDeviceCMYK),
@@ -971,15 +1011,17 @@
 }
 
 void CPDF_StreamContentParser::Handle_LineTo() {
-  if (m_ParamCount != 2)
+  if (m_ParamCount != 2) {
     return;
+  }
 
   AddPathPoint(GetPoint(0), CFX_Path::Point::Type::kLine);
 }
 
 void CPDF_StreamContentParser::Handle_MoveTo() {
-  if (m_ParamCount != 2)
+  if (m_ParamCount != 2) {
     return;
+  }
 
   AddPathPoint(GetPoint(0), CFX_Path::Point::Type::kMove);
   ParsePathObject();
@@ -1027,8 +1069,9 @@
 }
 
 void CPDF_StreamContentParser::Handle_SetRGBColor_Fill() {
-  if (m_ParamCount != 3)
+  if (m_ParamCount != 3) {
     return;
+  }
 
   m_pCurStates->mutable_color_state().SetFillColor(
       CPDF_ColorSpace::GetStockCS(CPDF_ColorSpace::Family::kDeviceRGB),
@@ -1036,8 +1079,9 @@
 }
 
 void CPDF_StreamContentParser::Handle_SetRGBColor_Stroke() {
-  if (m_ParamCount != 3)
+  if (m_ParamCount != 3) {
     return;
+  }
 
   m_pCurStates->mutable_color_state().SetStrokeColor(
       CPDF_ColorSpace::GetStockCS(CPDF_ColorSpace::Family::kDeviceRGB),
@@ -1068,8 +1112,9 @@
 
 void CPDF_StreamContentParser::Handle_SetColorPS_Fill() {
   RetainPtr<CPDF_Object> pLastParam = GetObject(0);
-  if (!pLastParam)
+  if (!pLastParam) {
     return;
+  }
 
   if (!pLastParam->IsName()) {
     m_pCurStates->mutable_color_state().SetFillColor(nullptr, GetColors());
@@ -1079,8 +1124,9 @@
   // A valid |pLastParam| implies |m_ParamCount| > 0, so GetNamedColors() call
   // below is safe.
   RetainPtr<CPDF_Pattern> pPattern = FindPattern(GetString(0));
-  if (!pPattern)
+  if (!pPattern) {
     return;
+  }
 
   std::vector<float> values = GetNamedColors();
   m_pCurStates->mutable_color_state().SetFillPattern(std::move(pPattern),
@@ -1089,8 +1135,9 @@
 
 void CPDF_StreamContentParser::Handle_SetColorPS_Stroke() {
   RetainPtr<CPDF_Object> pLastParam = GetObject(0);
-  if (!pLastParam)
+  if (!pLastParam) {
     return;
+  }
 
   if (!pLastParam->IsName()) {
     m_pCurStates->mutable_color_state().SetStrokeColor(nullptr, GetColors());
@@ -1100,8 +1147,9 @@
   // A valid |pLastParam| implies |m_ParamCount| > 0, so GetNamedColors() call
   // below is safe.
   RetainPtr<CPDF_Pattern> pPattern = FindPattern(GetString(0));
-  if (!pPattern)
+  if (!pPattern) {
     return;
+  }
 
   std::vector<float> values = GetNamedColors();
   m_pCurStates->mutable_color_state().SetStrokePattern(std::move(pPattern),
@@ -1110,11 +1158,13 @@
 
 void CPDF_StreamContentParser::Handle_ShadeFill() {
   RetainPtr<CPDF_ShadingPattern> pShading = FindShading(GetString(0));
-  if (!pShading)
+  if (!pShading) {
     return;
+  }
 
-  if (!pShading->IsShadingObject() || !pShading->Load())
+  if (!pShading->IsShadingObject() || !pShading->Load()) {
     return;
+  }
 
   CFX_Matrix matrix =
       m_pCurStates->current_transformation_matrix() * m_mtContentToUser;
@@ -1123,8 +1173,9 @@
   SetGraphicStates(pObj.get(), false, false, false);
   CFX_FloatRect bbox =
       pObj->clip_path().HasRef() ? pObj->clip_path().GetClipBox() : m_BBox;
-  if (pShading->IsMeshShading())
+  if (pShading->IsMeshShading()) {
     bbox.Intersect(GetShadingBBox(pShading.Get(), pObj->matrix()));
+  }
   pObj->SetRect(bbox);
   m_pObjectHolder->AppendPageObject(std::move(pObj));
 }
@@ -1145,21 +1196,25 @@
 void CPDF_StreamContentParser::Handle_SetFont() {
   m_pCurStates->mutable_text_state().SetFontSize(GetNumber(0));
   RetainPtr<CPDF_Font> pFont = FindFont(GetString(1));
-  if (pFont)
+  if (pFont) {
     m_pCurStates->mutable_text_state().SetFont(std::move(pFont));
+  }
 }
 
 RetainPtr<CPDF_Dictionary> CPDF_StreamContentParser::FindResourceHolder(
     const ByteString& type) {
-  if (!m_pResources)
+  if (!m_pResources) {
     return nullptr;
+  }
 
   RetainPtr<CPDF_Dictionary> pDict = m_pResources->GetMutableDictFor(type);
-  if (pDict)
+  if (pDict) {
     return pDict;
+  }
 
-  if (m_pResources == m_pPageResources || !m_pPageResources)
+  if (m_pResources == m_pPageResources || !m_pPageResources) {
     return nullptr;
+  }
 
   return m_pPageResources->GetMutableDictFor(type);
 }
@@ -1200,8 +1255,9 @@
 
 RetainPtr<CPDF_ColorSpace> CPDF_StreamContentParser::FindColorSpace(
     const ByteString& name) {
-  if (name == "Pattern")
+  if (name == "Pattern") {
     return CPDF_ColorSpace::GetStockCS(CPDF_ColorSpace::Family::kPattern);
+  }
 
   if (name == "DeviceGray" || name == "DeviceCMYK" || name == "DeviceRGB") {
     ByteString defname = "Default";
@@ -1213,8 +1269,9 @@
         return CPDF_ColorSpace::GetStockCS(
             CPDF_ColorSpace::Family::kDeviceGray);
       }
-      if (name == "DeviceRGB")
+      if (name == "DeviceRGB") {
         return CPDF_ColorSpace::GetStockCS(CPDF_ColorSpace::Family::kDeviceRGB);
+      }
 
       return CPDF_ColorSpace::GetStockCS(CPDF_ColorSpace::Family::kDeviceCMYK);
     }
@@ -1222,8 +1279,9 @@
         ->GetColorSpace(pDefObj.Get(), nullptr);
   }
   RetainPtr<const CPDF_Object> pCSObj = FindResourceObj("ColorSpace", name);
-  if (!pCSObj)
+  if (!pCSObj) {
     return nullptr;
+  }
   return CPDF_DocPageData::FromDocument(m_pDocument)
       ->GetColorSpace(pCSObj.Get(), nullptr);
 }
@@ -1231,8 +1289,9 @@
 RetainPtr<CPDF_Pattern> CPDF_StreamContentParser::FindPattern(
     const ByteString& name) {
   RetainPtr<CPDF_Object> pPattern = FindResourceObj("Pattern", name);
-  if (!pPattern || (!pPattern->IsDictionary() && !pPattern->IsStream()))
+  if (!pPattern || (!pPattern->IsDictionary() && !pPattern->IsStream())) {
     return nullptr;
+  }
   return CPDF_DocPageData::FromDocument(m_pDocument)
       ->GetPattern(std::move(pPattern), m_pCurStates->parent_matrix());
 }
@@ -1240,8 +1299,9 @@
 RetainPtr<CPDF_ShadingPattern> CPDF_StreamContentParser::FindShading(
     const ByteString& name) {
   RetainPtr<CPDF_Object> pPattern = FindResourceObj("Shading", name);
-  if (!pPattern || (!pPattern->IsDictionary() && !pPattern->IsStream()))
+  if (!pPattern || (!pPattern->IsDictionary() && !pPattern->IsStream())) {
     return nullptr;
+  }
   return CPDF_DocPageData::FromDocument(m_pDocument)
       ->GetShading(std::move(pPattern), m_pCurStates->parent_matrix());
 }
@@ -1290,17 +1350,19 @@
         pText->CalcPositionData(m_pCurStates->text_horz_scale());
     m_pCurStates->IncrementTextPositionX(position.x);
     m_pCurStates->IncrementTextPositionY(position.y);
-    if (TextRenderingModeIsClipMode(text_mode))
+    if (TextRenderingModeIsClipMode(text_mode)) {
       m_ClipTextList.push_back(pText->Clone());
+    }
     m_pObjectHolder->AppendPageObject(std::move(pText));
   }
   if (!kernings.empty() && kernings.back() != 0) {
-    if (pFont->IsVertWriting())
+    if (pFont->IsVertWriting()) {
       m_pCurStates->IncrementTextPositionY(
           -GetVerticalTextSize(kernings.back()));
-    else
+    } else {
       m_pCurStates->IncrementTextPositionX(
           -GetHorizontalTextSize(kernings.back()));
+    }
   }
 }
 
@@ -1328,21 +1390,24 @@
 
 void CPDF_StreamContentParser::Handle_ShowText_Positioning() {
   RetainPtr<CPDF_Array> pArray = ToArray(GetObject(0));
-  if (!pArray)
+  if (!pArray) {
     return;
+  }
 
   size_t n = pArray->size();
   size_t nsegs = 0;
   for (size_t i = 0; i < n; i++) {
     RetainPtr<const CPDF_Object> pDirectObject = pArray->GetDirectObjectAt(i);
-    if (pDirectObject && pDirectObject->IsString())
+    if (pDirectObject && pDirectObject->IsString()) {
       nsegs++;
+    }
   }
   if (nsegs == 0) {
     for (size_t i = 0; i < n; i++) {
       float fKerning = pArray->GetFloatAt(i);
-      if (fKerning != 0)
+      if (fKerning != 0) {
         m_pCurStates->IncrementTextPositionX(-GetHorizontalTextSize(fKerning));
+      }
     }
     return;
   }
@@ -1352,21 +1417,24 @@
   float fInitKerning = 0;
   for (size_t i = 0; i < n; i++) {
     RetainPtr<const CPDF_Object> pObj = pArray->GetDirectObjectAt(i);
-    if (!pObj)
+    if (!pObj) {
       continue;
+    }
 
     if (pObj->IsString()) {
       ByteString str = pObj->GetString();
-      if (str.IsEmpty())
+      if (str.IsEmpty()) {
         continue;
+      }
       strs[iSegment] = std::move(str);
       kernings[iSegment++] = 0;
     } else {
       float num = pObj->GetNumber();
-      if (iSegment == 0)
+      if (iSegment == 0) {
         fInitKerning += num;
-      else
+      } else {
         kernings[iSegment - 1] += num;
+      }
     }
   }
   AddTextObject(pdfium::make_span(strs).first(iSegment), kernings,
@@ -1399,8 +1467,9 @@
 
 void CPDF_StreamContentParser::Handle_SetTextRenderMode() {
   TextRenderingMode mode;
-  if (SetTextRenderingModeFromInt(GetInteger(0), &mode))
+  if (SetTextRenderingModeFromInt(GetInteger(0), &mode)) {
     m_pCurStates->mutable_text_state().SetTextMode(mode);
+  }
 }
 
 void CPDF_StreamContentParser::Handle_SetTextRise() {
@@ -1488,8 +1557,9 @@
     const CFX_PointF& point,
     CFX_Path::Point::Type type) {
   m_PathCurrent = point;
-  if (m_PathPoints.empty())
+  if (m_PathPoints.empty()) {
     return;
+  }
 
   m_PathPoints.emplace_back(point, type, /*close=*/true);
 }
@@ -1502,8 +1572,9 @@
   CFX_FillRenderOptions::FillType path_clip_type = m_PathClipType;
   m_PathClipType = CFX_FillRenderOptions::FillType::kNoFill;
 
-  if (path_points.empty())
+  if (path_points.empty()) {
     return;
+  }
 
   if (path_points.size() == 1) {
     if (path_clip_type != CFX_FillRenderOptions::FillType::kNoFill) {
@@ -1530,8 +1601,9 @@
                              /*close=*/true);
   }
 
-  if (path_points.back().IsTypeAndOpen(CFX_Path::Point::Type::kMove))
+  if (path_points.back().IsTypeAndOpen(CFX_Path::Point::Type::kMove)) {
     path_points.pop_back();
+  }
 
   CPDF_Path path;
   for (const auto& point : path_points) {
@@ -1555,8 +1627,9 @@
     m_pObjectHolder->AppendPageObject(std::move(pPathObj));
   }
   if (path_clip_type != CFX_FillRenderOptions::FillType::kNoFill) {
-    if (!matrix.IsIdentity())
+    if (!matrix.IsIdentity()) {
       path.Transform(matrix);
+    }
     m_pCurStates->mutable_clip_path().AppendPathWithAutoMerge(path,
                                                               path_clip_type);
   }
@@ -1690,8 +1763,9 @@
         break;
       }
       case CPDF_StreamParser::ElementType::kNumber: {
-        if (nParams == 6)
+        if (nParams == 6) {
           break;
+        }
 
         FX_Number number(m_pSyntax->GetWord());
         params[nParams++] = number.GetFloat();
diff --git a/core/fpdfapi/page/cpdf_streamparser.cpp b/core/fpdfapi/page/cpdf_streamparser.cpp
index 37cef4a..60af781 100644
--- a/core/fpdfapi/page/cpdf_streamparser.cpp
+++ b/core/fpdfapi/page/cpdf_streamparser.cpp
@@ -43,29 +43,34 @@
 const char kNull[] = "null";
 
 uint32_t DecodeAllScanlines(std::unique_ptr<ScanlineDecoder> pDecoder) {
-  if (!pDecoder)
+  if (!pDecoder) {
     return FX_INVALID_OFFSET;
+  }
 
   int ncomps = pDecoder->CountComps();
   int bpc = pDecoder->GetBPC();
   int width = pDecoder->GetWidth();
   int height = pDecoder->GetHeight();
-  if (width <= 0 || height <= 0)
+  if (width <= 0 || height <= 0) {
     return FX_INVALID_OFFSET;
+  }
 
   std::optional<uint32_t> maybe_size =
       fxge::CalculatePitch8(bpc, ncomps, width);
-  if (!maybe_size.has_value())
+  if (!maybe_size.has_value()) {
     return FX_INVALID_OFFSET;
+  }
 
   FX_SAFE_UINT32 size = maybe_size.value();
   size *= height;
-  if (size.ValueOrDefault(0) == 0)
+  if (size.ValueOrDefault(0) == 0) {
     return FX_INVALID_OFFSET;
+  }
 
   for (int row = 0; row < height; ++row) {
-    if (pDecoder->GetScanline(row).empty())
+    if (pDecoder->GetScanline(row).empty()) {
       break;
+    }
   }
   return pDecoder->GetSrcOffset();
 }
@@ -225,28 +230,33 @@
 CPDF_StreamParser::ElementType CPDF_StreamParser::ParseNextElement() {
   m_pLastObj.Reset();
   m_WordSize = 0;
-  if (!PositionIsInBounds())
+  if (!PositionIsInBounds()) {
     return ElementType::kEndOfData;
+  }
 
   uint8_t ch = m_pBuf[m_Pos++];
   while (true) {
     while (PDFCharIsWhitespace(ch)) {
-      if (!PositionIsInBounds())
+      if (!PositionIsInBounds()) {
         return ElementType::kEndOfData;
+      }
 
       ch = m_pBuf[m_Pos++];
     }
 
-    if (ch != '%')
+    if (ch != '%') {
       break;
+    }
 
     while (true) {
-      if (!PositionIsInBounds())
+      if (!PositionIsInBounds()) {
         return ElementType::kEndOfData;
+      }
 
       ch = m_pBuf[m_Pos++];
-      if (PDFCharIsLineEnding(ch))
+      if (PDFCharIsLineEnding(ch)) {
         break;
+      }
     }
   }
 
@@ -258,14 +268,17 @@
 
   bool bIsNumber = true;
   while (true) {
-    if (m_WordSize < kMaxWordLength)
+    if (m_WordSize < kMaxWordLength) {
       m_WordBuffer[m_WordSize++] = ch;
+    }
 
-    if (!PDFCharIsNumeric(ch))
+    if (!PDFCharIsNumeric(ch)) {
       bIsNumber = false;
+    }
 
-    if (!PositionIsInBounds())
+    if (!PositionIsInBounds()) {
       break;
+    }
 
     ch = m_pBuf[m_Pos++];
 
@@ -276,11 +289,13 @@
   }
 
   m_WordBuffer[m_WordSize] = 0;
-  if (bIsNumber)
+  if (bIsNumber) {
     return ElementType::kNumber;
+  }
 
-  if (m_WordBuffer[0] == '/')
+  if (m_WordBuffer[0] == '/') {
     return ElementType::kName;
+  }
 
   if (m_WordSize == 4) {
     if (GetWord() == kTrue) {
@@ -307,8 +322,9 @@
   bool bIsNumber;
   // Must get the next word before returning to avoid infinite loops.
   GetNextWord(bIsNumber);
-  if (!m_WordSize || dwRecursionLevel > kMaxNestedParsingLevel)
+  if (!m_WordSize || dwRecursionLevel > kMaxNestedParsingLevel) {
     return nullptr;
+  }
 
   if (bIsNumber) {
     m_WordBuffer[m_WordSize] = 0;
@@ -334,17 +350,20 @@
     auto pDict = pdfium::MakeRetain<CPDF_Dictionary>(m_pPool);
     while (true) {
       GetNextWord(bIsNumber);
-      if (m_WordSize == 2 && m_WordBuffer[0] == '>')
+      if (m_WordSize == 2 && m_WordBuffer[0] == '>') {
         break;
+      }
 
-      if (!m_WordSize || m_WordBuffer[0] != '/')
+      if (!m_WordSize || m_WordBuffer[0] != '/') {
         return nullptr;
+      }
 
       ByteString key = PDF_NameDecode(GetWord().Substr(1));
       RetainPtr<CPDF_Object> pObj =
           ReadNextObject(true, bInArray, dwRecursionLevel + 1);
-      if (!pObj)
+      if (!pObj) {
         return nullptr;
+      }
 
       pDict->SetFor(key, std::move(pObj));
     }
@@ -352,8 +371,9 @@
   }
 
   if (first_char == '[') {
-    if ((!bAllowNestedArray && bInArray))
+    if ((!bAllowNestedArray && bInArray)) {
       return nullptr;
+    }
 
     auto pArray = pdfium::MakeRetain<CPDF_Array>();
     while (true) {
@@ -363,18 +383,22 @@
         pArray->Append(std::move(pObj));
         continue;
       }
-      if (!m_WordSize || m_WordBuffer[0] == ']')
+      if (!m_WordSize || m_WordBuffer[0] == ']') {
         break;
+      }
     }
     return pArray;
   }
 
-  if (GetWord() == kFalse)
+  if (GetWord() == kFalse) {
     return pdfium::MakeRetain<CPDF_Boolean>(false);
-  if (GetWord() == kTrue)
+  }
+  if (GetWord() == kTrue) {
     return pdfium::MakeRetain<CPDF_Boolean>(true);
-  if (GetWord() == kNull)
+  }
+  if (GetWord() == kNull) {
     return pdfium::MakeRetain<CPDF_Null>();
+  }
   return nullptr;
 }
 
@@ -382,8 +406,9 @@
 void CPDF_StreamParser::GetNextWord(bool& bIsNumber) {
   m_WordSize = 0;
   bIsNumber = true;
-  if (!PositionIsInBounds())
+  if (!PositionIsInBounds()) {
     return;
+  }
 
   uint8_t ch = m_pBuf[m_Pos++];
   while (true) {
@@ -394,15 +419,18 @@
       ch = m_pBuf[m_Pos++];
     }
 
-    if (ch != '%')
+    if (ch != '%') {
       break;
+    }
 
     while (true) {
-      if (!PositionIsInBounds())
+      if (!PositionIsInBounds()) {
         return;
+      }
       ch = m_pBuf[m_Pos++];
-      if (PDFCharIsLineEnding(ch))
+      if (PDFCharIsLineEnding(ch)) {
         break;
+      }
     }
   }
 
@@ -411,43 +439,52 @@
     m_WordBuffer[m_WordSize++] = ch;
     if (ch == '/') {
       while (true) {
-        if (!PositionIsInBounds())
+        if (!PositionIsInBounds()) {
           return;
+        }
         ch = m_pBuf[m_Pos++];
         if (!PDFCharIsOther(ch) && !PDFCharIsNumeric(ch)) {
           m_Pos--;
           return;
         }
-        if (m_WordSize < kMaxWordLength)
+        if (m_WordSize < kMaxWordLength) {
           m_WordBuffer[m_WordSize++] = ch;
+        }
       }
     } else if (ch == '<') {
-      if (!PositionIsInBounds())
+      if (!PositionIsInBounds()) {
         return;
+      }
       ch = m_pBuf[m_Pos++];
-      if (ch == '<')
+      if (ch == '<') {
         m_WordBuffer[m_WordSize++] = ch;
-      else
+      } else {
         m_Pos--;
+      }
     } else if (ch == '>') {
-      if (!PositionIsInBounds())
+      if (!PositionIsInBounds()) {
         return;
+      }
       ch = m_pBuf[m_Pos++];
-      if (ch == '>')
+      if (ch == '>') {
         m_WordBuffer[m_WordSize++] = ch;
-      else
+      } else {
         m_Pos--;
+      }
     }
     return;
   }
 
   while (true) {
-    if (m_WordSize < kMaxWordLength)
+    if (m_WordSize < kMaxWordLength) {
       m_WordBuffer[m_WordSize++] = ch;
-    if (!PDFCharIsNumeric(ch))
+    }
+    if (!PDFCharIsNumeric(ch)) {
       bIsNumber = false;
-    if (!PositionIsInBounds())
+    }
+    if (!PositionIsInBounds()) {
       return;
+    }
 
     ch = m_pBuf[m_Pos++];
     if (PDFCharIsDelimiter(ch) || PDFCharIsWhitespace(ch)) {
@@ -458,8 +495,9 @@
 }
 
 ByteString CPDF_StreamParser::ReadString() {
-  if (!PositionIsInBounds())
+  if (!PositionIsInBounds()) {
     return ByteString();
+  }
 
   ByteString buf;
   int parlevel = 0;
@@ -536,12 +574,14 @@
         break;
       case 4:
         status = 0;
-        if (ch != '\n')
+        if (ch != '\n') {
           continue;
+        }
         break;
     }
-    if (!PositionIsInBounds())
+    if (!PositionIsInBounds()) {
       return buf.First(std::min(buf.GetLength(), kMaxStringLength));
+    }
 
     ch = m_pBuf[m_Pos++];
   }
@@ -558,8 +598,9 @@
   uint8_t code = 0;
   while (PositionIsInBounds()) {
     uint8_t ch = m_pBuf[m_Pos++];
-    if (ch == '>')
+    if (ch == '>') {
       break;
+    }
 
     if (!FXSYS_IsHexDigit(ch)) {
       continue;
diff --git a/core/fpdfapi/page/cpdf_textobject.cpp b/core/fpdfapi/page/cpdf_textobject.cpp
index 3d8fad4..5478dbd 100644
--- a/core/fpdfapi/page/cpdf_textobject.cpp
+++ b/core/fpdfapi/page/cpdf_textobject.cpp
@@ -48,13 +48,15 @@
   Item info;
   info.m_CharCode = m_CharCodes[index];
   info.m_Origin = CFX_PointF(index > 0 ? m_CharPos[index - 1] : 0, 0);
-  if (info.m_CharCode == CPDF_Font::kInvalidCharCode)
+  if (info.m_CharCode == CPDF_Font::kInvalidCharCode) {
     return info;
+  }
 
   RetainPtr<CPDF_Font> pFont = GetFont();
   const CPDF_CIDFont* pCIDFont = pFont->AsCIDFont();
-  if (!IsVertWritingCIDFont(pCIDFont))
+  if (!IsVertWritingCIDFont(pCIDFont)) {
     return info;
+  }
 
   uint16_t cid = pCIDFont->CIDFromCharCode(info.m_CharCode);
   info.m_Origin = CFX_PointF(0, info.m_Origin.x);
@@ -69,8 +71,9 @@
 size_t CPDF_TextObject::CountChars() const {
   size_t count = 0;
   for (uint32_t charcode : m_CharCodes) {
-    if (charcode != CPDF_Font::kInvalidCharCode)
+    if (charcode != CPDF_Font::kInvalidCharCode) {
       ++count;
+    }
   }
   return count;
 }
@@ -78,10 +81,12 @@
 uint32_t CPDF_TextObject::GetCharCode(size_t index) const {
   size_t count = 0;
   for (uint32_t code : m_CharCodes) {
-    if (code == CPDF_Font::kInvalidCharCode)
+    if (code == CPDF_Font::kInvalidCharCode) {
       continue;
-    if (count++ != index)
+    }
+    if (count++ != index) {
       continue;
+    }
     return code;
   }
   return CPDF_Font::kInvalidCharCode;
@@ -91,10 +96,12 @@
   size_t count = 0;
   for (size_t i = 0; i < m_CharCodes.size(); ++i) {
     uint32_t charcode = m_CharCodes[i];
-    if (charcode == CPDF_Font::kInvalidCharCode)
+    if (charcode == CPDF_Font::kInvalidCharCode) {
       continue;
-    if (count++ == index)
+    }
+    if (count++ == index) {
       return GetItemInfo(i);
+    }
   }
   return Item();
 }
@@ -108,16 +115,19 @@
 
     WideString swUnicode = pFont->UnicodeFromCharCode(charcode);
     uint16_t unicode = 0;
-    if (swUnicode.GetLength() > 0)
+    if (swUnicode.GetLength() > 0) {
       unicode = swUnicode[0];
+    }
 
     bool bIsLatin = ISLATINWORD(unicode);
-    if (bIsLatin && bInLatinWord)
+    if (bIsLatin && bInLatinWord) {
       continue;
+    }
 
     bInLatinWord = bIsLatin;
-    if (unicode != 0x20)
+    if (unicode != 0x20) {
       nWords++;
+    }
   }
 
   return nWords;
@@ -133,17 +143,20 @@
 
     WideString swUnicode = pFont->UnicodeFromCharCode(charcode);
     uint16_t unicode = 0;
-    if (swUnicode.GetLength() > 0)
+    if (swUnicode.GetLength() > 0) {
       unicode = swUnicode[0];
+    }
 
     bool bIsLatin = ISLATINWORD(unicode);
     if (!bIsLatin || !bInLatinWord) {
       bInLatinWord = bIsLatin;
-      if (unicode != 0x20)
+      if (unicode != 0x20) {
         nWords++;
+      }
     }
-    if (nWords - 1 == nWordIndex)
+    if (nWords - 1 == nWordIndex) {
       swRet += unicode;
+    }
   }
   return swRet;
 }
@@ -233,8 +246,9 @@
   const float fontsize = GetFontSize() / 1000;
   RetainPtr<CPDF_Font> pFont = GetFont();
   const CPDF_CIDFont* pCIDFont = pFont->AsCIDFont();
-  if (!IsVertWritingCIDFont(pCIDFont))
+  if (!IsVertWritingCIDFont(pCIDFont)) {
     return pFont->GetCharWidthF(charcode) * fontsize;
+  }
 
   uint16_t cid = pCIDFont->CIDFromCharCode(charcode);
   return pCIDFont->GetVertWidth(cid) * fontsize;
@@ -260,8 +274,9 @@
 CFX_PointF CPDF_TextObject::CalcPositionData(float horz_scale) {
   RetainPtr<CPDF_Font> pFont = GetFont();
   const float curpos = CalcPositionDataInternal(pFont);
-  if (IsVertWritingCIDFont(pFont->AsCIDFont()))
+  if (IsVertWritingCIDFont(pFont->AsCIDFont())) {
     return {0, curpos};
+  }
   return {curpos * horz_scale, 0};
 }
 
@@ -313,8 +328,9 @@
       charwidth = pFont->GetCharWidthF(charcode) * fontsize / 1000;
     }
     curpos += charwidth;
-    if (charcode == ' ' && (!pCIDFont || pCIDFont->GetCharSize(' ') == 1))
+    if (charcode == ' ' && (!pCIDFont || pCIDFont->GetCharSize(' ') == 1)) {
       curpos += text_state().GetWordSpace();
+    }
 
     curpos += text_state().GetCharSpace();
   }
diff --git a/core/fpdfapi/page/cpdf_textstate.cpp b/core/fpdfapi/page/cpdf_textstate.cpp
index b2651f6..5a55e07 100644
--- a/core/fpdfapi/page/cpdf_textstate.cpp
+++ b/core/fpdfapi/page/cpdf_textstate.cpp
@@ -126,8 +126,9 @@
 }
 
 bool SetTextRenderingModeFromInt(int iMode, TextRenderingMode* mode) {
-  if (iMode < 0 || iMode > 7)
+  if (iMode < 0 || iMode > 7) {
     return false;
+  }
   *mode = static_cast<TextRenderingMode>(iMode);
   return true;
 }
diff --git a/core/fpdfapi/page/cpdf_tilingpattern.cpp b/core/fpdfapi/page/cpdf_tilingpattern.cpp
index f89f208..560ac09 100644
--- a/core/fpdfapi/page/cpdf_tilingpattern.cpp
+++ b/core/fpdfapi/page/cpdf_tilingpattern.cpp
@@ -40,8 +40,9 @@
   m_YStep = fabsf(pDict->GetFloatFor("YStep"));
 
   RetainPtr<CPDF_Stream> pStream = ToStream(pattern_obj());
-  if (!pStream)
+  if (!pStream) {
     return nullptr;
+  }
 
   const CFX_Matrix& matrix = parent_matrix();
   auto form =
diff --git a/core/fpdfapi/parser/cfdf_document.cpp b/core/fpdfapi/parser/cfdf_document.cpp
index b5a0c1f..7fe3a15 100644
--- a/core/fpdfapi/parser/cfdf_document.cpp
+++ b/core/fpdfapi/parser/cfdf_document.cpp
@@ -45,33 +45,40 @@
     CPDF_SyntaxParser::WordResult word_result = parser.GetNextWord();
     if (word_result.is_number) {
       uint32_t objnum = FXSYS_atoui(word_result.word.c_str());
-      if (!objnum)
+      if (!objnum) {
         break;
+      }
 
       word_result = parser.GetNextWord();
-      if (!word_result.is_number)
+      if (!word_result.is_number) {
         break;
+      }
 
       word_result = parser.GetNextWord();
-      if (word_result.word != "obj")
+      if (word_result.word != "obj") {
         break;
+      }
 
       RetainPtr<CPDF_Object> pObj = parser.GetObjectBody(this);
-      if (!pObj)
+      if (!pObj) {
         break;
+      }
 
       ReplaceIndirectObjectIfHigherGeneration(objnum, std::move(pObj));
       word_result = parser.GetNextWord();
-      if (word_result.word != "endobj")
+      if (word_result.word != "endobj") {
         break;
+      }
     } else {
-      if (word_result.word != "trailer")
+      if (word_result.word != "trailer") {
         break;
+      }
 
       RetainPtr<CPDF_Dictionary> pMainDict =
           ToDictionary(parser.GetObjectBody(this));
-      if (pMainDict)
+      if (pMainDict) {
         m_pRootDict = pMainDict->GetMutableDictFor("Root");
+      }
 
       break;
     }
@@ -79,14 +86,16 @@
 }
 
 ByteString CFDF_Document::WriteToString() const {
-  if (!m_pRootDict)
+  if (!m_pRootDict) {
     return ByteString();
+  }
 
   fxcrt::ostringstream buf;
   buf << "%FDF-1.2\r\n";
-  for (const auto& pair : *this)
+  for (const auto& pair : *this) {
     buf << pair.first << " 0 obj\r\n"
         << pair.second.Get() << "\r\nendobj\r\n\r\n";
+  }
 
   buf << "trailer\r\n<</Root " << m_pRootDict->GetObjNum()
       << " 0 R>>\r\n%%EOF\r\n";
diff --git a/core/fpdfapi/parser/cpdf_array.cpp b/core/fpdfapi/parser/cpdf_array.cpp
index c96ae46..4160544 100644
--- a/core/fpdfapi/parser/cpdf_array.cpp
+++ b/core/fpdfapi/parser/cpdf_array.cpp
@@ -29,8 +29,9 @@
   // Break cycles for cyclic references.
   m_ObjNum = kInvalidObjNum;
   for (auto& it : m_Objects) {
-    if (it->GetObjNum() == kInvalidObjNum)
+    if (it->GetObjNum() == kInvalidObjNum) {
       it.Leak();
+    }
   }
 }
 
@@ -54,8 +55,9 @@
   for (const auto& pValue : m_Objects) {
     if (!pdfium::Contains(*pVisited, pValue.Get())) {
       std::set<const CPDF_Object*> visited(*pVisited);
-      if (auto obj = pValue->CloneNonCyclic(bDirect, &visited))
+      if (auto obj = pValue->CloneNonCyclic(bDirect, &visited)) {
         pCopy->m_Objects.push_back(std::move(obj));
+      }
     }
   }
   return pCopy;
@@ -63,8 +65,9 @@
 
 CFX_FloatRect CPDF_Array::GetRect() const {
   CFX_FloatRect rect;
-  if (m_Objects.size() != 4)
+  if (m_Objects.size() != 4) {
     return rect;
+  }
 
   rect.left = GetFloatAt(0);
   rect.bottom = GetFloatAt(1);
@@ -74,8 +77,9 @@
 }
 
 CFX_Matrix CPDF_Array::GetMatrix() const {
-  if (m_Objects.size() != 6)
+  if (m_Objects.size() != 6) {
     return CFX_Matrix();
+  }
 
   return CFX_Matrix(GetFloatAt(0), GetFloatAt(1), GetFloatAt(2), GetFloatAt(3),
                     GetFloatAt(4), GetFloatAt(5));
@@ -83,8 +87,9 @@
 
 std::optional<size_t> CPDF_Array::Find(const CPDF_Object* pThat) const {
   for (size_t i = 0; i < size(); ++i) {
-    if (GetDirectObjectAt(i) == pThat)
+    if (GetDirectObjectAt(i) == pThat) {
       return i;
+    }
   }
   return std::nullopt;
 }
@@ -119,46 +124,54 @@
 }
 
 ByteString CPDF_Array::GetByteStringAt(size_t index) const {
-  if (index >= m_Objects.size())
+  if (index >= m_Objects.size()) {
     return ByteString();
+  }
   return m_Objects[index]->GetString();
 }
 
 WideString CPDF_Array::GetUnicodeTextAt(size_t index) const {
-  if (index >= m_Objects.size())
+  if (index >= m_Objects.size()) {
     return WideString();
+  }
   return m_Objects[index]->GetUnicodeText();
 }
 
 bool CPDF_Array::GetBooleanAt(size_t index, bool bDefault) const {
-  if (index >= m_Objects.size())
+  if (index >= m_Objects.size()) {
     return bDefault;
+  }
   const CPDF_Object* p = m_Objects[index].Get();
   return ToBoolean(p) ? p->GetInteger() != 0 : bDefault;
 }
 
 int CPDF_Array::GetIntegerAt(size_t index) const {
-  if (index >= m_Objects.size())
+  if (index >= m_Objects.size()) {
     return 0;
+  }
   return m_Objects[index]->GetInteger();
 }
 
 float CPDF_Array::GetFloatAt(size_t index) const {
-  if (index >= m_Objects.size())
+  if (index >= m_Objects.size()) {
     return 0;
+  }
   return m_Objects[index]->GetNumber();
 }
 
 RetainPtr<CPDF_Dictionary> CPDF_Array::GetMutableDictAt(size_t index) {
   RetainPtr<CPDF_Object> p = GetMutableDirectObjectAt(index);
-  if (!p)
+  if (!p) {
     return nullptr;
+  }
   CPDF_Dictionary* pDict = p->AsMutableDictionary();
-  if (pDict)
+  if (pDict) {
     return pdfium::WrapRetain(pDict);
+  }
   CPDF_Stream* pStream = p->AsMutableStream();
-  if (pStream)
+  if (pStream) {
     return pStream->GetMutableDict();
+  }
   return nullptr;
 }
 
@@ -197,18 +210,21 @@
 
 void CPDF_Array::RemoveAt(size_t index) {
   CHECK(!IsLocked());
-  if (index < m_Objects.size())
+  if (index < m_Objects.size()) {
     m_Objects.erase(m_Objects.begin() + index);
+  }
 }
 
 void CPDF_Array::ConvertToIndirectObjectAt(size_t index,
                                            CPDF_IndirectObjectHolder* pHolder) {
   CHECK(!IsLocked());
-  if (index >= m_Objects.size())
+  if (index >= m_Objects.size()) {
     return;
+  }
 
-  if (!m_Objects[index] || m_Objects[index]->IsReference())
+  if (!m_Objects[index] || m_Objects[index]->IsReference()) {
     return;
+  }
 
   pHolder->AddIndirectObject(m_Objects[index]);
   m_Objects[index] = m_Objects[index]->MakeReference(pHolder);
@@ -232,8 +248,9 @@
   CHECK(pObj);
   CHECK(pObj->IsInline());
   CHECK(!pObj->IsStream());
-  if (index >= m_Objects.size())
+  if (index >= m_Objects.size()) {
     return nullptr;
+  }
 
   CPDF_Object* pRet = pObj.Get();
   m_Objects[index] = std::move(pObj);
@@ -246,8 +263,9 @@
   CHECK(pObj);
   CHECK(pObj->IsInline());
   CHECK(!pObj->IsStream());
-  if (index > m_Objects.size())
+  if (index > m_Objects.size()) {
     return nullptr;
+  }
 
   CPDF_Object* pRet = pObj.Get();
   m_Objects.insert(m_Objects.begin() + index, std::move(pObj));
@@ -266,12 +284,14 @@
 
 bool CPDF_Array::WriteTo(IFX_ArchiveStream* archive,
                          const CPDF_Encryptor* encryptor) const {
-  if (!archive->WriteString("["))
+  if (!archive->WriteString("[")) {
     return false;
+  }
 
   for (size_t i = 0; i < size(); ++i) {
-    if (!GetObjectAt(i)->WriteTo(archive, encryptor))
+    if (!GetObjectAt(i)->WriteTo(archive, encryptor)) {
       return false;
+    }
   }
   return archive->WriteString("]");
 }
diff --git a/core/fpdfapi/parser/cpdf_cross_ref_avail.cpp b/core/fpdfapi/parser/cpdf_cross_ref_avail.cpp
index 9af7b97..33275c7 100644
--- a/core/fpdfapi/parser/cpdf_cross_ref_avail.cpp
+++ b/core/fpdfapi/parser/cpdf_cross_ref_avail.cpp
@@ -35,8 +35,9 @@
 CPDF_CrossRefAvail::~CPDF_CrossRefAvail() = default;
 
 CPDF_DataAvail::DocAvailStatus CPDF_CrossRefAvail::CheckAvail() {
-  if (status_ == CPDF_DataAvail::kDataAvailable)
+  if (status_ == CPDF_DataAvail::kDataAvailable) {
     return CPDF_DataAvail::kDataAvailable;
+  }
 
   CPDF_ReadValidator::ScopedSession read_session(GetValidator());
   while (true) {
@@ -54,8 +55,9 @@
       case State::kDone:
         break;
     }
-    if (!check_result)
+    if (!check_result) {
       break;
+    }
 
     DCHECK(!GetValidator()->has_read_problems());
   }
@@ -80,22 +82,25 @@
   parser_->SetPos(cross_refs_for_check_.front());
 
   const ByteString first_word = parser_->PeekNextWord();
-  if (CheckReadProblems())
+  if (CheckReadProblems()) {
     return false;
+  }
 
   const bool result = (first_word == kCrossRefKeyword) ? CheckCrossRefTable()
                                                        : CheckCrossRefStream();
 
-  if (result)
+  if (result) {
     cross_refs_for_check_.pop();
+  }
 
   return result;
 }
 
 bool CPDF_CrossRefAvail::CheckCrossRefTable() {
   const ByteString keyword = parser_->GetKeyword();
-  if (CheckReadProblems())
+  if (CheckReadProblems()) {
     return false;
+  }
 
   if (keyword != kCrossRefKeyword) {
     status_ = CPDF_DataAvail::kDataError;
@@ -110,16 +115,18 @@
 bool CPDF_CrossRefAvail::CheckCrossRefTableItem() {
   parser_->SetPos(offset_);
   const ByteString keyword = parser_->GetKeyword();
-  if (CheckReadProblems())
+  if (CheckReadProblems()) {
     return false;
+  }
 
   if (keyword.IsEmpty()) {
     status_ = CPDF_DataAvail::kDataError;
     return false;
   }
 
-  if (keyword == kTrailerKeyword)
+  if (keyword == kTrailerKeyword) {
     state_ = State::kCrossRefTableTrailerCheck;
+  }
 
   // Go to next item.
   offset_ = parser_->GetPos();
@@ -131,8 +138,9 @@
 
   RetainPtr<CPDF_Dictionary> trailer =
       ToDictionary(parser_->GetObjectBody(nullptr));
-  if (CheckReadProblems())
+  if (CheckReadProblems()) {
     return false;
+  }
 
   if (!trailer) {
     status_ = CPDF_DataAvail::kDataError;
@@ -165,8 +173,9 @@
 bool CPDF_CrossRefAvail::CheckCrossRefStream() {
   auto cross_ref =
       parser_->GetIndirectObject(nullptr, CPDF_SyntaxParser::ParseType::kLoose);
-  if (CheckReadProblems())
+  if (CheckReadProblems()) {
     return false;
+  }
 
   RetainPtr<const CPDF_Dictionary> trailer =
       cross_ref && cross_ref->IsStream() ? cross_ref->GetDict() : nullptr;
@@ -193,8 +202,9 @@
 }
 
 void CPDF_CrossRefAvail::AddCrossRefForCheck(FX_FILESIZE crossref_offset) {
-  if (pdfium::Contains(registered_crossrefs_, crossref_offset))
+  if (pdfium::Contains(registered_crossrefs_, crossref_offset)) {
     return;
+  }
 
   cross_refs_for_check_.push(crossref_offset);
   registered_crossrefs_.insert(crossref_offset);
diff --git a/core/fpdfapi/parser/cpdf_cross_ref_table.cpp b/core/fpdfapi/parser/cpdf_cross_ref_table.cpp
index cfd43b6..9a990cb 100644
--- a/core/fpdfapi/parser/cpdf_cross_ref_table.cpp
+++ b/core/fpdfapi/parser/cpdf_cross_ref_table.cpp
@@ -15,11 +15,13 @@
 std::unique_ptr<CPDF_CrossRefTable> CPDF_CrossRefTable::MergeUp(
     std::unique_ptr<CPDF_CrossRefTable> current,
     std::unique_ptr<CPDF_CrossRefTable> top) {
-  if (!current)
+  if (!current) {
     return top;
+  }
 
-  if (!top)
+  if (!top) {
     return current;
+  }
 
   current->Update(std::move(top));
   return current;
@@ -41,8 +43,9 @@
   CHECK_LT(archive_obj_num, CPDF_Parser::kMaxObjectNumber);
 
   auto& info = objects_info_[obj_num];
-  if (info.gennum > 0)
+  if (info.gennum > 0) {
     return;
+  }
 
   // Don't add known object streams to object streams.
   if (info.is_object_stream_flag) {
@@ -64,8 +67,9 @@
   CHECK_LT(obj_num, CPDF_Parser::kMaxObjectNumber);
 
   auto& info = objects_info_[obj_num];
-  if (info.gennum > gen_num)
+  if (info.gennum > gen_num) {
     return;
+  }
 
   info.type = ObjectType::kNormal;
   info.is_object_stream_flag |= is_object_stream;
@@ -149,8 +153,9 @@
 }
 
 void CPDF_CrossRefTable::UpdateTrailer(RetainPtr<CPDF_Dictionary> new_trailer) {
-  if (!new_trailer)
+  if (!new_trailer) {
     return;
+  }
 
   if (!trailer_) {
     trailer_ = std::move(new_trailer);
@@ -160,6 +165,7 @@
   new_trailer->SetFor("XRefStm", trailer_->RemoveFor("XRefStm"));
   new_trailer->SetFor("Prev", trailer_->RemoveFor("Prev"));
 
-  for (const auto& key : new_trailer->GetKeys())
+  for (const auto& key : new_trailer->GetKeys()) {
     trailer_->SetFor(key, new_trailer->RemoveFor(key.AsStringView()));
+  }
 }
diff --git a/core/fpdfapi/parser/cpdf_crypto_handler.cpp b/core/fpdfapi/parser/cpdf_crypto_handler.cpp
index 61cceeb..a6edcc1 100644
--- a/core/fpdfapi/parser/cpdf_crypto_handler.cpp
+++ b/core/fpdfapi/parser/cpdf_crypto_handler.cpp
@@ -38,12 +38,14 @@
 // static
 bool CPDF_CryptoHandler::IsSignatureDictionary(
     const CPDF_Dictionary* dictionary) {
-  if (!dictionary)
+  if (!dictionary) {
     return false;
+  }
   RetainPtr<const CPDF_Object> type_obj =
       dictionary->GetDirectObjectFor(kTypeKey);
-  if (!type_obj)
+  if (!type_obj) {
     type_obj = dictionary->GetDirectObjectFor(pdfium::form_fields::kFT);
+  }
   return type_obj && type_obj->GetString() == pdfium::form_fields::kSig;
 }
 
@@ -110,8 +112,9 @@
 };
 
 void* CPDF_CryptoHandler::DecryptStart(uint32_t objnum, uint32_t gennum) {
-  if (m_Cipher == Cipher::kNone)
+  if (m_Cipher == Cipher::kNone) {
     return this;
+  }
 
   if (m_Cipher == Cipher::kAES && m_KeyLen == 32) {
     AESCryptContext* pContext = FX_Alloc(AESCryptContext, 1);
@@ -147,8 +150,9 @@
 bool CPDF_CryptoHandler::DecryptStream(void* context,
                                        pdfium::span<const uint8_t> source,
                                        BinaryBuffer& dest_buf) {
-  if (!context)
+  if (!context) {
     return false;
+  }
 
   if (m_Cipher == Cipher::kNone) {
     dest_buf.AppendSpan(source);
@@ -196,11 +200,13 @@
 }
 
 bool CPDF_CryptoHandler::DecryptFinish(void* context, BinaryBuffer& dest_buf) {
-  if (!context)
+  if (!context) {
     return false;
+  }
 
-  if (m_Cipher == Cipher::kNone)
+  if (m_Cipher == Cipher::kNone) {
     return true;
+  }
 
   if (m_Cipher == Cipher::kRC4) {
     FX_Free(context);
@@ -238,8 +244,9 @@
 }
 
 bool CPDF_CryptoHandler::DecryptObjectTree(RetainPtr<CPDF_Object> object) {
-  if (!object)
+  if (!object) {
     return false;
+  }
 
   struct MayBeSignature {
     RetainPtr<const CPDF_Dictionary> parent;
diff --git a/core/fpdfapi/parser/cpdf_data_avail.cpp b/core/fpdfapi/parser/cpdf_data_avail.cpp
index 5aad8e4..0b88191 100644
--- a/core/fpdfapi/parser/cpdf_data_avail.cpp
+++ b/core/fpdfapi/parser/cpdf_data_avail.cpp
@@ -41,8 +41,9 @@
 
   while (pDict) {
     RetainPtr<CPDF_Object> result = pDict->GetMutableObjectFor("Resources");
-    if (result)
+    if (result) {
       return result;
+    }
     if (++depth > kMaxHierarchyDepth) {
       // We have cycle in parents hierarchy.
       return nullptr;
@@ -82,8 +83,9 @@
 
 CPDF_DataAvail::~CPDF_DataAvail() {
   m_pHintTables.reset();
-  if (m_pDocument)
+  if (m_pDocument) {
     m_pDocument->RemoveObserver(this);
+  }
 }
 
 void CPDF_DataAvail::OnObservableDestroyed() {
@@ -96,15 +98,17 @@
 
 CPDF_DataAvail::DocAvailStatus CPDF_DataAvail::IsDocAvail(
     DownloadHints* pHints) {
-  if (!m_dwFileLen)
+  if (!m_dwFileLen) {
     return kDataError;
+  }
 
   DCHECK(m_SeenPageObjList.empty());
   AutoRestorer<std::set<uint32_t>> seen_objects_restorer(&m_SeenPageObjList);
   const HintsScope hints_scope(GetValidator(), pHints);
   while (!m_bDocAvail) {
-    if (!CheckDocStatus())
+    if (!CheckDocStatus()) {
       return kDataNotAvailable;
+    }
   }
 
   return kDataAvailable;
@@ -127,12 +131,14 @@
     case InternalStatus::kInfo:
       return CheckInfo();
     case InternalStatus::kPageTree:
-      if (m_bTotalLoadPageTree)
+      if (m_bTotalLoadPageTree) {
         return CheckPages();
+      }
       return LoadDocPages();
     case InternalStatus::kPage:
-      if (m_bTotalLoadPageTree)
+      if (m_bTotalLoadPageTree) {
         return CheckPage();
+      }
       m_internalStatus = InternalStatus::kPageLaterLoad;
       return true;
     case InternalStatus::kError:
@@ -173,8 +179,9 @@
   if (!m_pCrossRefAvail) {
     CPDF_ReadValidator::ScopedSession read_session(GetValidator());
     const FX_FILESIZE last_xref_offset = m_parser.ParseStartXRef();
-    if (GetValidator()->has_read_problems())
+    if (GetValidator()->has_read_problems()) {
       return false;
+    }
 
     if (last_xref_offset <= 0) {
       m_internalStatus = InternalStatus::kError;
@@ -209,17 +216,20 @@
                                                  bool* pExistInFile) {
   *pExistInFile = false;
   CPDF_Parser* pParser = m_pDocument ? m_pDocument->GetParser() : &m_parser;
-  if (!pParser)
+  if (!pParser) {
     return nullptr;
+  }
 
   CPDF_ReadValidator::ScopedSession read_session(GetValidator());
   RetainPtr<CPDF_Object> pRet = pParser->ParseIndirectObject(objnum);
-  if (!pRet)
+  if (!pRet) {
     return nullptr;
+  }
 
   *pExistInFile = true;
-  if (GetValidator()->has_read_problems())
+  if (GetValidator()->has_read_problems()) {
     return nullptr;
+  }
 
   return pRet;
 }
@@ -233,8 +243,9 @@
 
   CPDF_ReadValidator::ScopedSession read_session(GetValidator());
   m_parser.ParseIndirectObject(dwInfoObjNum);
-  if (GetValidator()->has_read_problems())
+  if (GetValidator()->has_read_problems()) {
     return false;
+  }
 
   m_internalStatus = InternalStatus::kPageTree;
   return true;
@@ -249,8 +260,9 @@
 
   CPDF_ReadValidator::ScopedSession read_session(GetValidator());
   m_pRoot = ToDictionary(m_parser.ParseIndirectObject(dwRootObjNum));
-  if (GetValidator()->has_read_problems())
+  if (GetValidator()->has_read_problems()) {
     return false;
+  }
 
   if (!m_pRoot) {
     m_internalStatus = InternalStatus::kError;
@@ -302,8 +314,9 @@
     bool bExists = false;
     RetainPtr<CPDF_Object> pObj = GetObject(dwPageObjNum, &bExists);
     if (!pObj) {
-      if (bExists)
+      if (bExists) {
         UnavailObjList.push_back(dwPageObjNum);
+      }
       continue;
     }
 
@@ -312,14 +325,16 @@
         CPDF_ArrayLocker locker(pObj->AsArray());
         for (const auto& pArrayObj : locker) {
           const CPDF_Reference* pRef = ToReference(pArrayObj.Get());
-          if (pRef)
+          if (pRef) {
             UnavailObjList.push_back(pRef->GetRefObjNum());
+          }
         }
         break;
       }
       case CPDF_Object::kDictionary:
-        if (pObj->GetDict()->GetNameFor("Type") == "Pages")
+        if (pObj->GetDict()->GetNameFor("Type") == "Pages") {
           m_PagesArray.push_back(std::move(pObj));
+        }
         break;
       default:
         break;
@@ -340,20 +355,23 @@
     }
   }
   m_PagesArray.clear();
-  if (m_PageObjList.empty())
+  if (m_PageObjList.empty()) {
     m_internalStatus = InternalStatus::kDone;
+  }
 
   return true;
 }
 
 bool CPDF_DataAvail::GetPageKids(CPDF_Object* pPages) {
   RetainPtr<const CPDF_Dictionary> pDict = pPages->GetDict();
-  if (!pDict)
+  if (!pDict) {
     return true;
+  }
 
   RetainPtr<const CPDF_Object> pKids = pDict->GetObjectFor("Kids");
-  if (!pKids)
+  if (!pKids) {
     return true;
+  }
 
   std::vector<uint32_t> object_numbers;
   switch (pKids->GetType()) {
@@ -364,8 +382,9 @@
       CPDF_ArrayLocker locker(pKids->AsArray());
       for (const auto& pArrayObj : locker) {
         const CPDF_Reference* pRef = ToReference(pArrayObj.Get());
-        if (pRef)
+        if (pRef) {
           object_numbers.push_back(pRef->GetRefObjNum());
+        }
       }
       break;
     }
@@ -376,8 +395,9 @@
 
   for (uint32_t num : object_numbers) {
     bool inserted = m_SeenPageObjList.insert(num).second;
-    if (inserted)
+    if (inserted) {
       m_PageObjList.push_back(num);
+    }
   }
   return true;
 }
@@ -431,14 +451,16 @@
 
   uint32_t dwEnd = m_pLinearized->GetFirstPageEndOffset();
   dwEnd += 512;
-  if ((FX_FILESIZE)dwEnd > m_dwFileLen)
+  if ((FX_FILESIZE)dwEnd > m_dwFileLen) {
     dwEnd = (uint32_t)m_dwFileLen;
+  }
 
   const FX_FILESIZE start_pos = m_dwFileLen > 1024 ? 1024 : m_dwFileLen;
   const size_t data_size = dwEnd > 1024 ? static_cast<size_t>(dwEnd - 1024) : 0;
   if (!GetValidator()->CheckDataRangeAndRequestIfUnavailable(start_pos,
-                                                             data_size))
+                                                             data_size)) {
     return false;
+  }
 
   m_internalStatus = InternalStatus::kHintTable;
   return true;
@@ -453,8 +475,9 @@
     m_internalStatus = InternalStatus::kError;
     return true;
   }
-  if (GetValidator()->has_unavailable_data())
+  if (GetValidator()->has_unavailable_data()) {
     return false;
+  }
 
   m_internalStatus = InternalStatus::kDone;
   return true;
@@ -486,23 +509,27 @@
 }
 
 CPDF_DataAvail::DocAvailStatus CPDF_DataAvail::CheckHeaderAndLinearized() {
-  if (m_bHeaderAvail)
+  if (m_bHeaderAvail) {
     return kDataAvailable;
+  }
 
   CPDF_ReadValidator::ScopedSession read_session(GetValidator());
   const std::optional<FX_FILESIZE> header_offset =
       GetHeaderOffset(GetValidator());
-  if (GetValidator()->has_read_problems())
+  if (GetValidator()->has_read_problems()) {
     return kDataNotAvailable;
+  }
 
-  if (!header_offset.has_value())
+  if (!header_offset.has_value()) {
     return kDataError;
+  }
 
   m_parser.m_pSyntax = std::make_unique<CPDF_SyntaxParser>(
       GetValidator(), header_offset.value());
   m_pLinearized = m_parser.ParseLinearizedHeader();
-  if (GetValidator()->has_read_problems())
+  if (GetValidator()->has_read_problems()) {
     return kDataNotAvailable;
+  }
 
   m_bHeaderAvail = true;
   return kDataAvailable;
@@ -512,12 +539,14 @@
   while (true) {
     switch (m_internalStatus) {
       case InternalStatus::kPageTree:
-        if (!LoadDocPages())
+        if (!LoadDocPages()) {
           return false;
+        }
         break;
       case InternalStatus::kPage:
-        if (!LoadDocPage(dwPage))
+        if (!LoadDocPage(dwPage)) {
           return false;
+        }
         break;
       case InternalStatus::kError:
         return LoadAllFile();
@@ -540,8 +569,9 @@
     return false;
   }
 
-  if (!pPages)
+  if (!pPages) {
     return false;
+  }
 
   const CPDF_Array* pArray = pPages->AsArray();
   if (!pArray) {
@@ -552,8 +582,9 @@
   pPageNode->m_type = PageNode::Type::kPages;
   for (size_t i = 0; i < pArray->size(); ++i) {
     RetainPtr<const CPDF_Reference> pKid = ToReference(pArray->GetObjectAt(i));
-    if (!pKid)
+    if (!pKid) {
       continue;
+    }
 
     auto pNode = std::make_unique<PageNode>();
     pNode->m_dwPageNo = pKid->GetRefObjNum();
@@ -571,8 +602,9 @@
     return false;
   }
 
-  if (!pPage)
+  if (!pPage) {
     return false;
+  }
 
   if (pPage->IsArray()) {
     pPageNode->m_dwPageNo = dwPageNo;
@@ -618,8 +650,9 @@
       for (size_t i = 0; i < pKidsArray->size(); ++i) {
         RetainPtr<const CPDF_Reference> pKid =
             ToReference(pKidsArray->GetObjectAt(i));
-        if (!pKid)
+        if (!pKid) {
           continue;
+        }
 
         auto pNode = std::make_unique<PageNode>();
         pNode->m_dwPageNo = pKid->GetRefObjNum();
@@ -637,8 +670,9 @@
                                    int32_t iPage,
                                    int32_t& iCount,
                                    int level) {
-  if (level >= kMaxPageRecursionDepth)
+  if (level >= kMaxPageRecursionDepth) {
     return false;
+  }
 
   int32_t iSize = fxcrt::CollectionSize<int32_t>(pageNode.m_ChildNodes);
   if (iSize <= 0 || iPage >= iSize) {
@@ -647,28 +681,33 @@
   }
   for (int32_t i = 0; i < iSize; ++i) {
     PageNode* pNode = pageNode.m_ChildNodes[i].get();
-    if (!pNode)
+    if (!pNode) {
       continue;
+    }
 
     if (pNode->m_type == PageNode::Type::kUnknown) {
       // Updates the type for the unknown page node.
-      if (!CheckUnknownPageNode(pNode->m_dwPageNo, pNode))
+      if (!CheckUnknownPageNode(pNode->m_dwPageNo, pNode)) {
         return false;
+      }
     }
     if (pNode->m_type == PageNode::Type::kArray) {
       // Updates a more specific type for the array page node.
-      if (!CheckArrayPageNode(pNode->m_dwPageNo, pNode))
+      if (!CheckArrayPageNode(pNode->m_dwPageNo, pNode)) {
         return false;
+      }
     }
     switch (pNode->m_type) {
       case PageNode::Type::kPage:
         iCount++;
-        if (iPage == iCount && m_pDocument)
+        if (iPage == iCount && m_pDocument) {
           m_pDocument->SetPageObjNum(iPage, pNode->m_dwPageNo);
+        }
         break;
       case PageNode::Type::kPages:
-        if (!CheckPageNode(*pNode, iPage, iCount, level + 1))
+        if (!CheckPageNode(*pNode, iPage, iCount, level + 1)) {
           return false;
+        }
         break;
       case PageNode::Type::kUnknown:
       case PageNode::Type::kArray:
@@ -706,23 +745,26 @@
     m_internalStatus = InternalStatus::kError;
     return false;
   }
-  if (!pPages)
+  if (!pPages) {
     return false;
+  }
 
   RetainPtr<const CPDF_Dictionary> pPagesDict = pPages->GetDict();
   if (!pPagesDict) {
     m_internalStatus = InternalStatus::kError;
     return false;
   }
-  if (!pPagesDict->KeyExist("Kids"))
+  if (!pPagesDict->KeyExist("Kids")) {
     return true;
+  }
 
   return pPagesDict->GetIntegerFor("Count") > 0;
 }
 
 bool CPDF_DataAvail::LoadDocPages() {
-  if (!CheckUnknownPageNode(m_PagesObjNum, &m_PageNode))
+  if (!CheckUnknownPageNode(m_PagesObjNum, &m_PageNode)) {
     return false;
+  }
 
   if (CheckPageCount()) {
     m_internalStatus = InternalStatus::kPage;
@@ -735,20 +777,23 @@
 
 bool CPDF_DataAvail::LoadPages() {
   while (!m_bPagesTreeLoad) {
-    if (!CheckPageStatus())
+    if (!CheckPageStatus()) {
       return false;
+    }
   }
 
-  if (m_bPagesLoad)
+  if (m_bPagesLoad) {
     return true;
+  }
 
   m_pDocument->LoadPages();
   return false;
 }
 
 CPDF_DataAvail::DocAvailStatus CPDF_DataAvail::CheckLinearizedData() {
-  if (m_bLinearedDataOK)
+  if (m_bLinearedDataOK) {
     return kDataAvailable;
+  }
   DCHECK(m_pLinearized);
   if (!m_pLinearized->GetMainXRefTableFirstEntryOffset() || !m_pDocument ||
       !m_pDocument->GetParser() || !m_pDocument->GetParser()->GetTrailer()) {
@@ -759,29 +804,35 @@
     const FX_SAFE_FILESIZE prev =
         m_pDocument->GetParser()->GetTrailer()->GetIntegerFor("Prev");
     const FX_FILESIZE main_xref_offset = prev.ValueOrDefault(-1);
-    if (main_xref_offset < 0)
+    if (main_xref_offset < 0) {
       return kDataError;
+    }
 
-    if (main_xref_offset == 0)
+    if (main_xref_offset == 0) {
       return kDataAvailable;
+    }
 
     FX_SAFE_SIZE_T data_size = m_dwFileLen;
     data_size -= main_xref_offset;
-    if (!data_size.IsValid())
+    if (!data_size.IsValid()) {
       return kDataError;
+    }
 
     if (!GetValidator()->CheckDataRangeAndRequestIfUnavailable(
-            main_xref_offset, data_size.ValueOrDie()))
+            main_xref_offset, data_size.ValueOrDie())) {
       return kDataNotAvailable;
+    }
 
     CPDF_Parser::Error eRet =
         m_pDocument->GetParser()->LoadLinearizedMainXRefTable();
     m_bMainXRefLoadTried = true;
-    if (eRet != CPDF_Parser::SUCCESS)
+    if (eRet != CPDF_Parser::SUCCESS) {
       return kDataError;
+    }
 
-    if (!PreparePageItem())
+    if (!PreparePageItem()) {
       return kDataNotAvailable;
+    }
 
     m_bMainXRefLoadedOK = true;
     m_bLinearedDataOK = true;
@@ -793,8 +844,9 @@
 CPDF_DataAvail::DocAvailStatus CPDF_DataAvail::IsPageAvail(
     uint32_t dwPage,
     DownloadHints* pHints) {
-  if (!m_pDocument)
+  if (!m_pDocument) {
     return kDataError;
+  }
 
   const int iPage = pdfium::checked_cast<int>(dwPage);
   if (iPage >= m_pDocument->GetPageCount()) {
@@ -806,16 +858,18 @@
     m_bCurPageDictLoadOK = false;
   }
 
-  if (pdfium::Contains(m_pagesLoadState, dwPage))
+  if (pdfium::Contains(m_pagesLoadState, dwPage)) {
     return kDataAvailable;
+  }
 
   const HintsScope hints_scope(GetValidator(), pHints);
   if (m_pLinearized) {
     if (dwPage == m_pLinearized->GetFirstPageNo()) {
       RetainPtr<const CPDF_Dictionary> pPageDict =
           m_pDocument->GetPageDictionary(iPage);
-      if (!pPageDict)
+      if (!pPageDict) {
         return kDataError;
+      }
 
       auto page_num_obj =
           std::make_pair(dwPage, std::make_unique<CPDF_PageObjectAvail>(
@@ -828,13 +882,15 @@
     }
 
     DocAvailStatus nResult = CheckLinearizedData();
-    if (nResult != kDataAvailable)
+    if (nResult != kDataAvailable) {
       return nResult;
+    }
 
     if (m_pHintTables) {
       nResult = m_pHintTables->CheckPage(dwPage);
-      if (nResult != kDataAvailable)
+      if (nResult != kDataAvailable) {
         return nResult;
+      }
       if (GetPageDictionary(dwPage)) {
         m_pagesLoadState.insert(dwPage);
         return kDataAvailable;
@@ -842,18 +898,21 @@
     }
 
     if (!m_bMainXRefLoadedOK) {
-      if (!LoadAllFile())
+      if (!LoadAllFile()) {
         return kDataNotAvailable;
+      }
       m_pDocument->GetParser()->RebuildCrossRef();
       ResetFirstCheck(dwPage);
       return kDataAvailable;
     }
     if (m_bTotalLoadPageTree) {
-      if (!LoadPages())
+      if (!LoadPages()) {
         return kDataNotAvailable;
+      }
     } else {
-      if (!m_bCurPageDictLoadOK && !CheckPage(dwPage))
+      if (!m_bCurPageDictLoadOK && !CheckPage(dwPage)) {
         return kDataNotAvailable;
+      }
     }
   } else {
     if (!m_bTotalLoadPageTree && !m_bCurPageDictLoadOK && !CheckPage(dwPage)) {
@@ -861,13 +920,15 @@
     }
   }
 
-  if (CheckAcroForm() == kFormNotAvailable)
+  if (CheckAcroForm() == kFormNotAvailable) {
     return kDataNotAvailable;
+  }
 
   RetainPtr<CPDF_Dictionary> pPageDict =
       m_pDocument->GetMutablePageDictionary(iPage);
-  if (!pPageDict)
+  if (!pPageDict) {
     return kDataError;
+  }
 
   {
     auto page_num_obj =
@@ -876,13 +937,15 @@
     CPDF_PageObjectAvail* page_obj_avail =
         m_PagesObjAvail.insert(std::move(page_num_obj)).first->second.get();
     const DocAvailStatus status = page_obj_avail->CheckAvail();
-    if (status != kDataAvailable)
+    if (status != kDataAvailable) {
       return status;
+    }
   }
 
   const DocAvailStatus resources_status = CheckResources(std::move(pPageDict));
-  if (resources_status != kDataAvailable)
+  if (resources_status != kDataAvailable) {
     return resources_status;
+  }
 
   m_bCurPageDictLoadOK = false;
   ResetFirstCheck(dwPage);
@@ -895,11 +958,13 @@
   DCHECK(page);
   CPDF_ReadValidator::ScopedSession read_session(GetValidator());
   RetainPtr<CPDF_Object> resources = GetResourceObject(std::move(page));
-  if (GetValidator()->has_read_problems())
+  if (GetValidator()->has_read_problems()) {
     return kDataNotAvailable;
+  }
 
-  if (!resources)
+  if (!resources) {
     return kDataAvailable;
+  }
 
   CPDF_PageObjectAvail* resource_avail =
       m_PagesResourcesAvail
@@ -920,30 +985,36 @@
 }
 
 int CPDF_DataAvail::GetPageCount() const {
-  if (m_pLinearized)
+  if (m_pLinearized) {
     return m_pLinearized->GetPageCount();
+  }
   return m_pDocument ? m_pDocument->GetPageCount() : 0;
 }
 
 RetainPtr<const CPDF_Dictionary> CPDF_DataAvail::GetPageDictionary(
     int index) const {
-  if (!m_pDocument || index < 0 || index >= GetPageCount())
+  if (!m_pDocument || index < 0 || index >= GetPageCount()) {
     return nullptr;
+  }
   RetainPtr<const CPDF_Dictionary> page = m_pDocument->GetPageDictionary(index);
-  if (page)
+  if (page) {
     return page;
-  if (!m_pLinearized || !m_pHintTables)
+  }
+  if (!m_pLinearized || !m_pHintTables) {
     return nullptr;
+  }
 
-  if (index == static_cast<int>(m_pLinearized->GetFirstPageNo()))
+  if (index == static_cast<int>(m_pLinearized->GetFirstPageNo())) {
     return nullptr;
+  }
   FX_FILESIZE szPageStartPos = 0;
   FX_FILESIZE szPageLength = 0;
   uint32_t dwObjNum = 0;
   const bool bPagePosGot = m_pHintTables->GetPagePos(index, &szPageStartPos,
                                                      &szPageLength, &dwObjNum);
-  if (!bPagePosGot || !dwObjNum)
+  if (!bPagePosGot || !dwObjNum) {
     return nullptr;
+  }
   // We should say to the document, which object is the page.
   m_pDocument->SetPageObjNum(index, dwObjNum);
   // Page object already can be parsed in document.
@@ -951,8 +1022,9 @@
     m_pDocument->ReplaceIndirectObjectIfHigherGeneration(
         dwObjNum, ParseIndirectObjectAt(szPageStartPos, dwObjNum, m_pDocument));
   }
-  if (!ValidatePage(index))
+  if (!ValidatePage(index)) {
     return nullptr;
+  }
   return m_pDocument->GetPageDictionary(index);
 }
 
@@ -963,25 +1035,30 @@
 }
 
 CPDF_DataAvail::DocFormStatus CPDF_DataAvail::CheckAcroForm() {
-  if (!m_pDocument)
+  if (!m_pDocument) {
     return kFormAvailable;
+  }
 
   if (m_pLinearized) {
     DocAvailStatus nDocStatus = CheckLinearizedData();
-    if (nDocStatus == kDataError)
+    if (nDocStatus == kDataError) {
       return kFormError;
-    if (nDocStatus == kDataNotAvailable)
+    }
+    if (nDocStatus == kDataNotAvailable) {
       return kFormNotAvailable;
+    }
   }
 
   if (!m_pFormAvail) {
     const CPDF_Dictionary* pRoot = m_pDocument->GetRoot();
-    if (!pRoot)
+    if (!pRoot) {
       return kFormAvailable;
+    }
 
     RetainPtr<const CPDF_Object> pAcroForm = pRoot->GetObjectFor("AcroForm");
-    if (!pAcroForm)
+    if (!pAcroForm) {
       return kFormNotExist;
+    }
 
     m_pFormAvail = std::make_unique<CPDF_PageObjectAvail>(
         GetValidator(), m_pDocument, std::move(pAcroForm));
@@ -1000,8 +1077,9 @@
   int iPage = pdfium::checked_cast<int>(dwPage);
   RetainPtr<const CPDF_Dictionary> pPageDict =
       m_pDocument->GetPageDictionary(iPage);
-  if (!pPageDict)
+  if (!pPageDict) {
     return false;
+  }
 
   CPDF_PageObjectAvail obj_avail(GetValidator(), m_pDocument,
                                  std::move(pPageDict));
@@ -1033,8 +1111,9 @@
     return std::make_pair(CPDF_Parser::HANDLER_ERROR, nullptr);
   }
 
-  if (error != CPDF_Parser::SUCCESS)
+  if (error != CPDF_Parser::SUCCESS) {
     return std::make_pair(error, nullptr);
+  }
 
   m_pDocument = document.get();
   return std::make_pair(CPDF_Parser::SUCCESS, std::move(document));
diff --git a/core/fpdfapi/parser/cpdf_dictionary.cpp b/core/fpdfapi/parser/cpdf_dictionary.cpp
index 932879b..904f56c 100644
--- a/core/fpdfapi/parser/cpdf_dictionary.cpp
+++ b/core/fpdfapi/parser/cpdf_dictionary.cpp
@@ -33,8 +33,9 @@
   // and break cyclic references.
   m_ObjNum = kInvalidObjNum;
   for (auto& it : m_Map) {
-    if (it.second->GetObjNum() == kInvalidObjNum)
+    if (it.second->GetObjNum() == kInvalidObjNum) {
       it.second.Leak();
+    }
   }
 }
 
@@ -60,8 +61,9 @@
     if (!pdfium::Contains(*pVisited, it.second.Get())) {
       std::set<const CPDF_Object*> visited(*pVisited);
       auto obj = it.second->CloneNonCyclic(bDirect, &visited);
-      if (obj)
+      if (obj) {
         pCopy->m_Map.insert(std::make_pair(it.first, std::move(obj)));
+      }
     }
   }
   return pCopy;
@@ -114,8 +116,9 @@
 
 WideString CPDF_Dictionary::GetUnicodeTextFor(const ByteString& key) const {
   const CPDF_Object* p = GetObjectForInternal(key);
-  if (const CPDF_Reference* pRef = ToReference(p))
+  if (const CPDF_Reference* pRef = ToReference(p)) {
     p = pRef->GetDirectInternal();
+  }
   return p ? p->GetUnicodeText() : WideString();
 }
 
@@ -174,8 +177,9 @@
 RetainPtr<CPDF_Dictionary> CPDF_Dictionary::GetOrCreateDictFor(
     const ByteString& key) {
   RetainPtr<CPDF_Dictionary> result = GetMutableDictFor(key);
-  if (result)
+  if (result) {
     return result;
+  }
   return SetNewFor<CPDF_Dictionary>(key);
 }
 
@@ -197,8 +201,9 @@
 RetainPtr<CPDF_Array> CPDF_Dictionary::GetOrCreateArrayFor(
     const ByteString& key) {
   RetainPtr<CPDF_Array> result = GetMutableArrayFor(key);
-  if (result)
+  if (result) {
     return result;
+  }
   return SetNewFor<CPDF_Array>(key);
 }
 
@@ -240,15 +245,17 @@
 
 CFX_FloatRect CPDF_Dictionary::GetRectFor(const ByteString& key) const {
   const CPDF_Array* pArray = GetArrayForInternal(key);
-  if (pArray)
+  if (pArray) {
     return pArray->GetRect();
+  }
   return CFX_FloatRect();
 }
 
 CFX_Matrix CPDF_Dictionary::GetMatrixFor(const ByteString& key) const {
   const CPDF_Array* pArray = GetArrayForInternal(key);
-  if (pArray)
+  if (pArray) {
     return pArray->GetMatrix();
+  }
   return CFX_Matrix();
 }
 
@@ -259,8 +266,9 @@
 std::vector<ByteString> CPDF_Dictionary::GetKeys() const {
   std::vector<ByteString> result;
   CPDF_DictionaryLocker locker(this);
-  for (const auto& item : locker)
+  for (const auto& item : locker) {
     result.push_back(item.first);
+  }
   return result;
 }
 
@@ -288,8 +296,9 @@
     CPDF_IndirectObjectHolder* pHolder) {
   CHECK(!IsLocked());
   auto it = m_Map.find(key);
-  if (it == m_Map.end() || it->second->IsReference())
+  if (it == m_Map.end() || it->second->IsReference()) {
     return;
+  }
 
   pHolder->AddIndirectObject(it->second);
   it->second = it->second->MakeReference(pHolder);
@@ -310,12 +319,14 @@
                                  const ByteString& newkey) {
   CHECK(!IsLocked());
   auto old_it = m_Map.find(oldkey);
-  if (old_it == m_Map.end())
+  if (old_it == m_Map.end()) {
     return;
+  }
 
   auto new_it = m_Map.find(newkey);
-  if (new_it == old_it)
+  if (new_it == old_it) {
     return;
+  }
 
   m_Map[MaybeIntern(newkey)] = std::move(old_it->second);
   m_Map.erase(old_it);
@@ -347,8 +358,9 @@
 
 bool CPDF_Dictionary::WriteTo(IFX_ArchiveStream* archive,
                               const CPDF_Encryptor* encryptor) const {
-  if (!archive->WriteString("<<"))
+  if (!archive->WriteString("<<")) {
     return false;
+  }
 
   const bool is_signature = CPDF_CryptoHandler::IsSignatureDictionary(this);
 
diff --git a/core/fpdfapi/parser/cpdf_document.cpp b/core/fpdfapi/parser/cpdf_document.cpp
index 4e2210b..bee850f 100644
--- a/core/fpdfapi/parser/cpdf_document.cpp
+++ b/core/fpdfapi/parser/cpdf_document.cpp
@@ -118,22 +118,26 @@
                   int* index,
                   int level) {
   if (!pNode->KeyExist("Kids")) {
-    if (objnum == pNode->GetObjNum())
+    if (objnum == pNode->GetObjNum()) {
       return *index;
+    }
 
-    if (*skip_count != 0)
+    if (*skip_count != 0) {
       (*skip_count)--;
+    }
 
     (*index)++;
     return -1;
   }
 
   RetainPtr<const CPDF_Array> pKidList = pNode->GetArrayFor("Kids");
-  if (!pKidList)
+  if (!pKidList) {
     return -1;
+  }
 
-  if (level >= kMaxPageLevel)
+  if (level >= kMaxPageLevel) {
     return -1;
+  }
 
   size_t count = pNode->GetIntegerFor("Count");
   if (count <= *skip_count) {
@@ -146,20 +150,23 @@
     for (size_t i = 0; i < count; i++) {
       RetainPtr<const CPDF_Reference> pKid =
           ToReference(pKidList->GetObjectAt(i));
-      if (pKid && pKid->GetRefObjNum() == objnum)
+      if (pKid && pKid->GetRefObjNum() == objnum) {
         return static_cast<int>(*index + i);
+      }
     }
   }
 
   for (size_t i = 0; i < pKidList->size(); i++) {
     RetainPtr<const CPDF_Dictionary> pKid = pKidList->GetDictAt(i);
-    if (!pKid || pKid == pNode)
+    if (!pKid || pKid == pNode) {
       continue;
+    }
 
     int found_index =
         FindPageIndex(pKid.Get(), skip_count, objnum, index, level + 1);
-    if (found_index >= 0)
+    if (found_index >= 0) {
       return found_index;
+    }
   }
   return -1;
 }
@@ -198,8 +205,9 @@
 
   RetainPtr<CPDF_Object> pRootObj =
       GetOrParseIndirectObject(m_pParser->GetRootObjNum());
-  if (pRootObj)
+  if (pRootObj) {
     m_pRootDict = pRootObj->GetMutableDict();
+  }
 
   LoadPages();
   return GetRoot() && GetPageCount() > 0;
@@ -208,8 +216,9 @@
 CPDF_Parser::Error CPDF_Document::LoadDoc(
     RetainPtr<IFX_SeekableReadStream> pFileAccess,
     const ByteString& password) {
-  if (!m_pParser)
+  if (!m_pParser) {
     SetParser(std::make_unique<CPDF_Parser>(this));
+  }
 
   return HandleLoadResult(
       m_pParser->StartParse(std::move(pFileAccess), password));
@@ -218,8 +227,9 @@
 CPDF_Parser::Error CPDF_Document::LoadLinearizedDoc(
     RetainPtr<CPDF_ReadValidator> validator,
     const ByteString& password) {
-  if (!m_pParser)
+  if (!m_pParser) {
     SetParser(std::make_unique<CPDF_Parser>(this));
+  }
 
   return HandleLoadResult(
       m_pParser->StartLinearizedParse(std::move(validator), password));
@@ -249,15 +259,17 @@
 RetainPtr<CPDF_Dictionary> CPDF_Document::TraversePDFPages(int iPage,
                                                            int* nPagesToGo,
                                                            size_t level) {
-  if (*nPagesToGo < 0 || m_bReachedMaxPageLevel)
+  if (*nPagesToGo < 0 || m_bReachedMaxPageLevel) {
     return nullptr;
+  }
 
   RetainPtr<CPDF_Dictionary> pPages = m_pTreeTraversal[level].first;
   RetainPtr<CPDF_Array> pKidList = pPages->GetMutableArrayFor("Kids");
   if (!pKidList) {
     m_pTreeTraversal.pop_back();
-    if (*nPagesToGo != 1)
+    if (*nPagesToGo != 1) {
       return nullptr;
+    }
     m_PageList[iPage] = pPages->GetObjNum();
     return pPages;
   }
@@ -268,8 +280,9 @@
   }
   RetainPtr<CPDF_Dictionary> page;
   for (size_t i = m_pTreeTraversal[level].second; i < pKidList->size(); i++) {
-    if (*nPagesToGo == 0)
+    if (*nPagesToGo == 0) {
       break;
+    }
     pKidList->ConvertToIndirectObjectAt(i, this);
     RetainPtr<CPDF_Dictionary> pKid = pKidList->GetMutableDictAt(i);
     if (!pKid) {
@@ -291,14 +304,16 @@
       }
     } else {
       // If the vector has size level+1, the child is not in yet
-      if (m_pTreeTraversal.size() == level + 1)
+      if (m_pTreeTraversal.size() == level + 1) {
         m_pTreeTraversal.emplace_back(std::move(pKid), 0);
+      }
       // Now m_pTreeTraversal[level+1] should exist and be equal to pKid.
       RetainPtr<CPDF_Dictionary> pPageKid =
           TraversePDFPages(iPage, nPagesToGo, level + 1);
       // Check if child was completely processed, i.e. it popped itself out
-      if (m_pTreeTraversal.size() == level + 1)
+      if (m_pTreeTraversal.size() == level + 1) {
         m_pTreeTraversal[level].second++;
+      }
       // If child did not finish, no pages to go, or max level reached, end
       if (m_pTreeTraversal.size() != level + 1 || *nPagesToGo == 0 ||
           m_bReachedMaxPageLevel) {
@@ -307,8 +322,9 @@
       }
     }
   }
-  if (m_pTreeTraversal[level].second == pKidList->size())
+  if (m_pTreeTraversal[level].second == pKidList->size()) {
     m_pTreeTraversal.pop_back();
+  }
   return page;
 }
 
@@ -324,8 +340,9 @@
 }
 
 CPDF_Parser::Error CPDF_Document::HandleLoadResult(CPDF_Parser::Error error) {
-  if (error == CPDF_Parser::SUCCESS)
+  if (error == CPDF_Parser::SUCCESS) {
     m_bHasValidCrossReferenceTable = !m_pParser->xref_table_rebuilt();
+  }
   return error;
 }
 
@@ -344,20 +361,23 @@
 }
 
 RetainPtr<const CPDF_Dictionary> CPDF_Document::GetPageDictionary(int iPage) {
-  if (!fxcrt::IndexInBounds(m_PageList, iPage))
+  if (!fxcrt::IndexInBounds(m_PageList, iPage)) {
     return nullptr;
+  }
 
   const uint32_t objnum = m_PageList[iPage];
   if (objnum) {
     RetainPtr<CPDF_Dictionary> result =
         ToDictionary(GetOrParseIndirectObject(objnum));
-    if (result)
+    if (result) {
       return result;
+    }
   }
 
   RetainPtr<CPDF_Dictionary> pPages = GetMutablePagesDict();
-  if (!pPages)
+  if (!pPages) {
     return nullptr;
+  }
 
   if (m_pTreeTraversal.empty()) {
     ResetTraversal();
@@ -379,8 +399,9 @@
 }
 
 JBig2_DocumentContext* CPDF_Document::GetOrCreateCodecContext() {
-  if (!m_pCodecContext)
+  if (!m_pCodecContext) {
     m_pCodecContext = std::make_unique<JBig2_DocumentContext>();
+  }
   return m_pCodecContext.get();
 }
 
@@ -399,8 +420,9 @@
   uint32_t skip_count = 0;
   bool bSkipped = false;
   for (uint32_t i = 0; i < m_PageList.size(); ++i) {
-    if (m_PageList[i] == objnum)
+    if (m_PageList[i] == objnum) {
       return i;
+    }
 
     if (!bSkipped && m_PageList[i] == 0) {
       skip_count = i;
@@ -408,19 +430,22 @@
     }
   }
   RetainPtr<const CPDF_Dictionary> pPages = GetPagesDict();
-  if (!pPages)
+  if (!pPages) {
     return -1;
+  }
 
   int start_index = 0;
   int found_index = FindPageIndex(pPages, &skip_count, objnum, &start_index, 0);
 
   // Corrupt page tree may yield out-of-range results.
-  if (!fxcrt::IndexInBounds(m_PageList, found_index))
+  if (!fxcrt::IndexInBounds(m_PageList, found_index)) {
     return -1;
+  }
 
   // Only update |m_PageList| when |objnum| points to a /Page object.
-  if (IsValidPageObject(GetOrParseIndirectObject(objnum).Get()))
+  if (IsValidPageObject(GetOrParseIndirectObject(objnum).Get())) {
     m_PageList[found_index] = objnum;
+  }
   return found_index;
 }
 
@@ -430,11 +455,13 @@
 
 int CPDF_Document::RetrievePageCount() {
   RetainPtr<CPDF_Dictionary> pPages = GetMutablePagesDict();
-  if (!pPages)
+  if (!pPages) {
     return 0;
+  }
 
-  if (!pPages->KeyExist("Kids"))
+  if (!pPages->KeyExist("Kids")) {
     return 1;
+  }
 
   std::set<RetainPtr<CPDF_Dictionary>> visited_pages = {pPages};
   return CountPages(std::move(pPages), &visited_pages).value_or(0);
@@ -540,16 +567,19 @@
 bool CPDF_Document::InsertNewPage(int iPage,
                                   RetainPtr<CPDF_Dictionary> pPageDict) {
   RetainPtr<CPDF_Dictionary> pRoot = GetMutableRoot();
-  if (!pRoot)
+  if (!pRoot) {
     return false;
+  }
 
   RetainPtr<CPDF_Dictionary> pPages = pRoot->GetMutableDictFor("Pages");
-  if (!pPages)
+  if (!pPages) {
     return false;
+  }
 
   int nPages = GetPageCount();
-  if (iPage < 0 || iPage > nPages)
+  if (iPage < 0 || iPage > nPages) {
     return false;
+  }
 
   if (iPage == nPages) {
     RetainPtr<CPDF_Array> pPagesList = pPages->GetOrCreateArrayFor("Kids");
@@ -559,23 +589,28 @@
     ResetTraversal();
   } else {
     std::set<RetainPtr<CPDF_Dictionary>> stack = {pPages};
-    if (!InsertDeletePDFPage(std::move(pPages), iPage, pPageDict, true, &stack))
+    if (!InsertDeletePDFPage(std::move(pPages), iPage, pPageDict, true,
+                             &stack)) {
       return false;
+    }
   }
   m_PageList.insert(m_PageList.begin() + iPage, pPageDict->GetObjNum());
   return true;
 }
 
 RetainPtr<CPDF_Dictionary> CPDF_Document::GetInfo() {
-  if (m_pInfoDict)
+  if (m_pInfoDict) {
     return m_pInfoDict;
+  }
 
-  if (!m_pParser)
+  if (!m_pParser) {
     return nullptr;
+  }
 
   uint32_t info_obj_num = m_pParser->GetInfoObjNum();
-  if (info_obj_num == 0)
+  if (info_obj_num == 0) {
     return nullptr;
+  }
 
   auto ref = pdfium::MakeRetain<CPDF_Reference>(this, info_obj_num);
   m_pInfoDict = ToDictionary(ref->GetMutableDirect());
diff --git a/core/fpdfapi/parser/cpdf_flateencoder.cpp b/core/fpdfapi/parser/cpdf_flateencoder.cpp
index e358d1d..8c20481 100644
--- a/core/fpdfapi/parser/cpdf_flateencoder.cpp
+++ b/core/fpdfapi/parser/cpdf_flateencoder.cpp
@@ -55,8 +55,9 @@
 CPDF_FlateEncoder::~CPDF_FlateEncoder() = default;
 
 void CPDF_FlateEncoder::UpdateLength(size_t size) {
-  if (static_cast<size_t>(GetDict()->GetIntegerFor("Length")) == size)
+  if (static_cast<size_t>(GetDict()->GetIntegerFor("Length")) == size) {
     return;
+  }
 
   if (!m_pClonedDict) {
     m_pClonedDict = ToDictionary(m_pDict->Clone());
@@ -81,7 +82,8 @@
 }
 
 pdfium::span<const uint8_t> CPDF_FlateEncoder::GetSpan() const {
-  if (is_owned())
+  if (is_owned()) {
     return std::get<DataVector<uint8_t>>(m_Data);
+  }
   return std::get<pdfium::raw_span<const uint8_t>>(m_Data);
 }
diff --git a/core/fpdfapi/parser/cpdf_hint_tables.cpp b/core/fpdfapi/parser/cpdf_hint_tables.cpp
index 584bb96..713497b 100644
--- a/core/fpdfapi/parser/cpdf_hint_tables.cpp
+++ b/core/fpdfapi/parser/cpdf_hint_tables.cpp
@@ -64,13 +64,15 @@
   RetainPtr<CPDF_Stream> hints_stream = ToStream(
       parser->GetIndirectObject(nullptr, CPDF_SyntaxParser::ParseType::kLoose));
 
-  if (!hints_stream)
+  if (!hints_stream) {
     return nullptr;
+  }
 
   auto pHintTables = std::make_unique<CPDF_HintTables>(
       parser->GetValidator().Get(), pLinearized);
-  if (!pHintTables->LoadHintStream(hints_stream.Get()))
+  if (!pHintTables->LoadHintStream(hints_stream.Get())) {
     return nullptr;
+  }
 
   return pHintTables;
 }
@@ -85,49 +87,58 @@
 
 bool CPDF_HintTables::ReadPageHintTable(CFX_BitStream* hStream) {
   const uint32_t nPages = m_pLinearized->GetPageCount();
-  if (nPages < 1 || nPages >= CPDF_Document::kPageMaxNum)
+  if (nPages < 1 || nPages >= CPDF_Document::kPageMaxNum) {
     return false;
+  }
 
   const uint32_t nFirstPageNum = m_pLinearized->GetFirstPageNo();
-  if (nFirstPageNum >= nPages)
+  if (nFirstPageNum >= nPages) {
     return false;
+  }
 
-  if (!hStream || hStream->IsEOF())
+  if (!hStream || hStream->IsEOF()) {
     return false;
+  }
 
   const uint32_t kHeaderSize = 288;
-  if (hStream->BitsRemaining() < kHeaderSize)
+  if (hStream->BitsRemaining() < kHeaderSize) {
     return false;
+  }
 
   // Item 1: The least number of objects in a page.
   const uint32_t dwObjLeastNum = hStream->GetBits(32);
-  if (!dwObjLeastNum || dwObjLeastNum >= CPDF_Parser::kMaxObjectNumber)
+  if (!dwObjLeastNum || dwObjLeastNum >= CPDF_Parser::kMaxObjectNumber) {
     return false;
+  }
 
   // Item 2: The location of the first page's page object.
   const FX_FILESIZE szFirstObjLoc =
       HintsOffsetToFileOffset(hStream->GetBits(32));
-  if (!szFirstObjLoc)
+  if (!szFirstObjLoc) {
     return false;
+  }
 
   m_szFirstPageObjOffset = szFirstObjLoc;
 
   // Item 3: The number of bits needed to represent the difference
   // between the greatest and least number of objects in a page.
   const uint32_t dwDeltaObjectsBits = hStream->GetBits(16);
-  if (!IsValidPageOffsetHintTableBitCount(dwDeltaObjectsBits))
+  if (!IsValidPageOffsetHintTableBitCount(dwDeltaObjectsBits)) {
     return false;
+  }
 
   // Item 4: The least length of a page in bytes.
   const uint32_t dwPageLeastLen = hStream->GetBits(32);
-  if (!dwPageLeastLen)
+  if (!dwPageLeastLen) {
     return false;
+  }
 
   // Item 5: The number of bits needed to represent the difference
   // between the greatest and least length of a page, in bytes.
   const uint32_t dwDeltaPageLenBits = hStream->GetBits(16);
-  if (!IsValidPageOffsetHintTableBitCount(dwDeltaPageLenBits))
+  if (!IsValidPageOffsetHintTableBitCount(dwDeltaPageLenBits)) {
     return false;
+  }
 
   // Skip Item 6, 7, 8, 9 total 96 bits.
   hStream->SkipBits(96);
@@ -135,30 +146,34 @@
   // Item 10: The number of bits needed to represent the greatest
   // number of shared object references.
   const uint32_t dwSharedObjBits = hStream->GetBits(16);
-  if (!IsValidPageOffsetHintTableBitCount(dwSharedObjBits))
+  if (!IsValidPageOffsetHintTableBitCount(dwSharedObjBits)) {
     return false;
+  }
 
   // Item 11: The number of bits needed to represent the numerically
   // greatest shared object identifier used by the pages.
   const uint32_t dwSharedIdBits = hStream->GetBits(16);
-  if (!IsValidPageOffsetHintTableBitCount(dwSharedIdBits))
+  if (!IsValidPageOffsetHintTableBitCount(dwSharedIdBits)) {
     return false;
+  }
 
   // Item 12: The number of bits needed to represent the numerator of
   // the fractional position for each shared object reference. For each
   // shared object referenced from a page, there is an indication of
   // where in the page's content stream the object is first referenced.
   const uint32_t dwSharedNumeratorBits = hStream->GetBits(16);
-  if (dwSharedNumeratorBits > 32)
+  if (dwSharedNumeratorBits > 32) {
     return false;
+  }
 
   // Item 13: Skip Item 13 which has 16 bits.
   hStream->SkipBits(16);
 
   FX_SAFE_UINT32 required_bits = dwDeltaObjectsBits;
   required_bits *= nPages;
-  if (!CanReadFromBitStream(hStream, required_bits))
+  if (!CanReadFromBitStream(hStream, required_bits)) {
     return false;
+  }
 
   m_PageInfos = std::vector<PageInfo>(nPages);
   m_PageInfos[nFirstPageNum].set_start_obj_num(
@@ -168,11 +183,13 @@
   for (uint32_t i = 0; i < nPages; ++i) {
     FX_SAFE_UINT32 safeDeltaObj = hStream->GetBits(dwDeltaObjectsBits);
     safeDeltaObj += dwObjLeastNum;
-    if (!safeDeltaObj.IsValid())
+    if (!safeDeltaObj.IsValid()) {
       return false;
+    }
     m_PageInfos[i].set_objects_count(safeDeltaObj.ValueOrDie());
-    if (i == nFirstPageNum)
+    if (i == nFirstPageNum) {
       continue;
+    }
     m_PageInfos[i].set_start_obj_num(dwStartObjNum.ValueOrDie());
     dwStartObjNum += m_PageInfos[i].objects_count();
     if (!dwStartObjNum.IsValid() ||
@@ -184,14 +201,16 @@
 
   required_bits = dwDeltaPageLenBits;
   required_bits *= nPages;
-  if (!CanReadFromBitStream(hStream, required_bits))
+  if (!CanReadFromBitStream(hStream, required_bits)) {
     return false;
+  }
 
   for (uint32_t i = 0; i < nPages; ++i) {
     FX_SAFE_UINT32 safePageLen = hStream->GetBits(dwDeltaPageLenBits);
     safePageLen += dwPageLeastLen;
-    if (!safePageLen.IsValid())
+    if (!safePageLen.IsValid()) {
       return false;
+    }
     m_PageInfos[i].set_page_length(safePageLen.ValueOrDie());
   }
 
@@ -199,8 +218,9 @@
   m_PageInfos[nFirstPageNum].set_page_offset(m_szFirstPageObjOffset);
   FX_FILESIZE prev_page_end = m_pLinearized->GetFirstPageEndOffset();
   for (uint32_t i = 0; i < nPages; ++i) {
-    if (i == nFirstPageNum)
+    if (i == nFirstPageNum) {
       continue;
+    }
     m_PageInfos[i].set_page_offset(prev_page_end);
     prev_page_end += m_PageInfos[i].page_length();
   }
@@ -209,23 +229,27 @@
   // Number of shared objects.
   required_bits = dwSharedObjBits;
   required_bits *= nPages;
-  if (!CanReadFromBitStream(hStream, required_bits))
+  if (!CanReadFromBitStream(hStream, required_bits)) {
     return false;
+  }
 
   std::vector<uint32_t> dwNSharedObjsArray(nPages);
-  for (uint32_t i = 0; i < nPages; i++)
+  for (uint32_t i = 0; i < nPages; i++) {
     dwNSharedObjsArray[i] = hStream->GetBits(dwSharedObjBits);
+  }
   hStream->ByteAlign();
 
   // Array of identifiers, size = nshared_objects.
   for (uint32_t i = 0; i < nPages; i++) {
     required_bits = dwSharedIdBits;
     required_bits *= dwNSharedObjsArray[i];
-    if (!CanReadFromBitStream(hStream, required_bits))
+    if (!CanReadFromBitStream(hStream, required_bits)) {
       return false;
+    }
 
-    for (uint32_t j = 0; j < dwNSharedObjsArray[i]; j++)
+    for (uint32_t j = 0; j < dwNSharedObjsArray[i]; j++) {
       m_PageInfos[i].AddIdentifier(hStream->GetBits(dwSharedIdBits));
+    }
   }
   hStream->ByteAlign();
 
@@ -233,8 +257,9 @@
     for (uint32_t i = 0; i < nPages; i++) {
       FX_SAFE_UINT32 safeSize = dwNSharedObjsArray[i];
       safeSize *= dwSharedNumeratorBits;
-      if (!CanReadFromBitStream(hStream, safeSize))
+      if (!CanReadFromBitStream(hStream, safeSize)) {
         return false;
+      }
 
       hStream->SkipBits(safeSize.ValueOrDie());
     }
@@ -243,8 +268,9 @@
 
   FX_SAFE_UINT32 safeTotalPageLen = nPages;
   safeTotalPageLen *= dwDeltaPageLenBits;
-  if (!CanReadFromBitStream(hStream, safeTotalPageLen))
+  if (!CanReadFromBitStream(hStream, safeTotalPageLen)) {
     return false;
+  }
 
   hStream->SkipBits(safeTotalPageLen.ValueOrDie());
   hStream->ByteAlign();
@@ -253,30 +279,35 @@
 
 bool CPDF_HintTables::ReadSharedObjHintTable(CFX_BitStream* hStream,
                                              uint32_t offset) {
-  if (!hStream || hStream->IsEOF())
+  if (!hStream || hStream->IsEOF()) {
     return false;
+  }
 
   FX_SAFE_UINT32 bit_offset = offset;
   bit_offset *= 8;
-  if (!bit_offset.IsValid() || hStream->GetPos() > bit_offset.ValueOrDie())
+  if (!bit_offset.IsValid() || hStream->GetPos() > bit_offset.ValueOrDie()) {
     return false;
+  }
   hStream->SkipBits((bit_offset - hStream->GetPos()).ValueOrDie());
 
   const uint32_t kHeaderSize = 192;
-  if (hStream->BitsRemaining() < kHeaderSize)
+  if (hStream->BitsRemaining() < kHeaderSize) {
     return false;
+  }
 
   // Item 1: The object number of the first object in the shared objects
   // section.
   uint32_t dwFirstSharedObjNum = hStream->GetBits(32);
-  if (!dwFirstSharedObjNum)
+  if (!dwFirstSharedObjNum) {
     return false;
+  }
 
   // Item 2: The location of the first object in the shared objects section.
   const FX_FILESIZE szFirstSharedObjLoc =
       HintsOffsetToFileOffset(hStream->GetBits(32));
-  if (!szFirstSharedObjLoc)
+  if (!szFirstSharedObjLoc) {
     return false;
+  }
 
   // Item 3: The number of shared object entries for the first page.
   m_nFirstPageSharedObjs = hStream->GetBits(32);
@@ -288,8 +319,9 @@
   // Item 5: The number of bits needed to represent the greatest number of
   // objects in a shared object group.
   uint32_t dwSharedObjNumBits = hStream->GetBits(16);
-  if (dwSharedObjNumBits > 32)
+  if (dwSharedObjNumBits > 32) {
     return false;
+  }
 
   // Item 6: The least length of a shared object group in bytes.
   uint32_t dwGroupLeastLen = hStream->GetBits(32);
@@ -300,8 +332,9 @@
 
   // Trying to decode more than 32 bits isn't going to work when we write into
   // a uint32_t. Decoding 0 bits also makes no sense.
-  if (!IsValidPageOffsetHintTableBitCount(dwDeltaGroupLen))
+  if (!IsValidPageOffsetHintTableBitCount(dwDeltaGroupLen)) {
     return false;
+  }
 
   if (dwFirstSharedObjNum >= CPDF_Parser::kMaxObjectNumber ||
       m_nFirstPageSharedObjs >= CPDF_Parser::kMaxObjectNumber ||
@@ -311,16 +344,18 @@
 
   FX_SAFE_UINT32 required_bits = dwSharedObjTotal;
   required_bits *= dwDeltaGroupLen;
-  if (!CanReadFromBitStream(hStream, required_bits))
+  if (!CanReadFromBitStream(hStream, required_bits)) {
     return false;
+  }
 
   if (dwSharedObjTotal > 0) {
     uint32_t dwLastSharedObj = dwSharedObjTotal - 1;
     if (dwLastSharedObj > m_nFirstPageSharedObjs) {
       FX_SAFE_UINT32 safeObjNum = dwFirstSharedObjNum;
       safeObjNum += dwLastSharedObj - m_nFirstPageSharedObjs;
-      if (!safeObjNum.IsValid())
+      if (!safeObjNum.IsValid()) {
         return false;
+      }
     }
   }
 
@@ -330,20 +365,23 @@
   // group length.
   FX_SAFE_FILESIZE prev_shared_group_end_offset = m_szFirstPageObjOffset;
   for (uint32_t i = 0; i < dwSharedObjTotal; ++i) {
-    if (i == m_nFirstPageSharedObjs)
+    if (i == m_nFirstPageSharedObjs) {
       prev_shared_group_end_offset = szFirstSharedObjLoc;
+    }
 
     FX_SAFE_UINT32 safeObjLen = hStream->GetBits(dwDeltaGroupLen);
     safeObjLen += dwGroupLeastLen;
-    if (!safeObjLen.IsValid())
+    if (!safeObjLen.IsValid()) {
       return false;
+    }
 
     m_SharedObjGroupInfos[i].m_dwLength = safeObjLen.ValueOrDie();
     m_SharedObjGroupInfos[i].m_szOffset =
         prev_shared_group_end_offset.ValueOrDie();
     prev_shared_group_end_offset += m_SharedObjGroupInfos[i].m_dwLength;
-    if (!prev_shared_group_end_offset.IsValid())
+    if (!prev_shared_group_end_offset.IsValid()) {
       return false;
+    }
   }
 
   hStream->ByteAlign();
@@ -361,8 +399,9 @@
     if (signature_count) {
       required_bits = signature_count;
       required_bits *= 128;
-      if (!CanReadFromBitStream(hStream, required_bits))
+      if (!CanReadFromBitStream(hStream, required_bits)) {
         return false;
+      }
 
       hStream->SkipBits(required_bits.ValueOrDie());
       hStream->ByteAlign();
@@ -371,19 +410,22 @@
   // Item 4: A number equal to 1 less than the number of objects in the group.
   FX_SAFE_UINT32 cur_obj_num = m_pLinearized->GetFirstPageObjNum();
   for (uint32_t i = 0; i < dwSharedObjTotal; ++i) {
-    if (i == m_nFirstPageSharedObjs)
+    if (i == m_nFirstPageSharedObjs) {
       cur_obj_num = dwFirstSharedObjNum;
+    }
 
     FX_SAFE_UINT32 obj_count =
         dwSharedObjNumBits ? hStream->GetBits(dwSharedObjNumBits) : 0;
     obj_count += 1;
-    if (!obj_count.IsValid())
+    if (!obj_count.IsValid()) {
       return false;
+    }
 
     uint32_t obj_num = cur_obj_num.ValueOrDie();
     cur_obj_num += obj_count.ValueOrDie();
-    if (!cur_obj_num.IsValid())
+    if (!cur_obj_num.IsValid()) {
       return false;
+    }
 
     m_SharedObjGroupInfos[i].m_dwStartObjNum = obj_num;
     m_SharedObjGroupInfos[i].m_dwObjectsCount = obj_count.ValueOrDie();
@@ -397,8 +439,9 @@
                                  FX_FILESIZE* szPageStartPos,
                                  FX_FILESIZE* szPageLength,
                                  uint32_t* dwObjNum) const {
-  if (index >= m_pLinearized->GetPageCount())
+  if (index >= m_pLinearized->GetPageCount()) {
     return false;
+  }
 
   *szPageStartPos = m_PageInfos[index].page_offset();
   *szPageLength = m_PageInfos[index].page_length();
@@ -407,15 +450,18 @@
 }
 
 CPDF_DataAvail::DocAvailStatus CPDF_HintTables::CheckPage(uint32_t index) {
-  if (index == m_pLinearized->GetFirstPageNo())
+  if (index == m_pLinearized->GetFirstPageNo()) {
     return CPDF_DataAvail::kDataAvailable;
+  }
 
-  if (index >= m_pLinearized->GetPageCount())
+  if (index >= m_pLinearized->GetPageCount()) {
     return CPDF_DataAvail::kDataError;
+  }
 
   const uint32_t dwLength = m_PageInfos[index].page_length();
-  if (!dwLength)
+  if (!dwLength) {
     return CPDF_DataAvail::kDataError;
+  }
 
   if (!m_pValidator->CheckDataRangeAndRequestIfUnavailable(
           m_PageInfos[index].page_offset(), dwLength)) {
@@ -424,13 +470,15 @@
 
   // Download data of shared objects in the page.
   for (const uint32_t dwIndex : m_PageInfos[index].Identifiers()) {
-    if (dwIndex >= m_SharedObjGroupInfos.size())
+    if (dwIndex >= m_SharedObjGroupInfos.size()) {
       continue;
+    }
     const SharedObjGroupInfo& shared_group_info =
         m_SharedObjGroupInfos[dwIndex];
 
-    if (!shared_group_info.m_szOffset || !shared_group_info.m_dwLength)
+    if (!shared_group_info.m_szOffset || !shared_group_info.m_dwLength) {
       return CPDF_DataAvail::kDataError;
+    }
 
     if (!m_pValidator->CheckDataRangeAndRequestIfUnavailable(
             shared_group_info.m_szOffset, shared_group_info.m_dwLength)) {
@@ -441,17 +489,20 @@
 }
 
 bool CPDF_HintTables::LoadHintStream(CPDF_Stream* pHintStream) {
-  if (!pHintStream || !m_pLinearized->HasHintTable())
+  if (!pHintStream || !m_pLinearized->HasHintTable()) {
     return false;
+  }
 
   RetainPtr<const CPDF_Object> pOffset =
       pHintStream->GetDict()->GetObjectFor("S");
-  if (!pOffset || !pOffset->IsNumber())
+  if (!pOffset || !pOffset->IsNumber()) {
     return false;
+  }
 
   int shared_hint_table_offset = pOffset->GetInteger();
-  if (shared_hint_table_offset <= 0)
+  if (shared_hint_table_offset <= 0) {
     return false;
+  }
 
   auto pAcc =
       pdfium::MakeRetain<CPDF_StreamAcc>(pdfium::WrapRetain(pHintStream));
@@ -462,8 +513,9 @@
   // The header section of shared object hint table is 24 bytes.
   // Hint table has at least 60 bytes.
   const uint32_t kMinStreamLength = 60;
-  if (size < kMinStreamLength)
+  if (size < kMinStreamLength) {
     return false;
+  }
 
   FX_SAFE_UINT32 safe_shared_hint_table_offset = shared_hint_table_offset;
   if (!safe_shared_hint_table_offset.IsValid() ||
@@ -479,8 +531,9 @@
 FX_FILESIZE CPDF_HintTables::HintsOffsetToFileOffset(
     uint32_t hints_offset) const {
   FX_SAFE_FILESIZE file_offset = hints_offset;
-  if (!file_offset.IsValid())
+  if (!file_offset.IsValid()) {
     return 0;
+  }
 
   // The resulting positions shall be interpreted as if the primary hint stream
   // itself were not present. That is, a position greater than the hint stream
@@ -491,8 +544,9 @@
   // stream offset also need to have the hint stream length added to it. e.g.
   // There exists linearized PDFs generated by Adobe software that have this
   // property.
-  if (file_offset.ValueOrDie() >= m_pLinearized->GetHintStart())
+  if (file_offset.ValueOrDie() >= m_pLinearized->GetHintStart()) {
     file_offset += m_pLinearized->GetHintLength();
+  }
 
   return file_offset.ValueOrDefault(0);
 }
diff --git a/core/fpdfapi/parser/cpdf_indirect_object_holder.cpp b/core/fpdfapi/parser/cpdf_indirect_object_holder.cpp
index 3adb12f..30e5bcc 100644
--- a/core/fpdfapi/parser/cpdf_indirect_object_holder.cpp
+++ b/core/fpdfapi/parser/cpdf_indirect_object_holder.cpp
@@ -43,8 +43,9 @@
 const CPDF_Object* CPDF_IndirectObjectHolder::GetIndirectObjectInternal(
     uint32_t objnum) const {
   auto it = m_IndirectObjs.find(objnum);
-  if (it == m_IndirectObjs.end())
+  if (it == m_IndirectObjs.end()) {
     return nullptr;
+  }
 
   return FilterInvalidObjNum(it->second.Get());
 }
@@ -56,8 +57,9 @@
 
 CPDF_Object* CPDF_IndirectObjectHolder::GetOrParseIndirectObjectInternal(
     uint32_t objnum) {
-  if (objnum == 0 || objnum == CPDF_Object::kInvalidObjNum)
+  if (objnum == 0 || objnum == CPDF_Object::kInvalidObjNum) {
     return nullptr;
+  }
 
   // Add item anyway to prevent recursively parsing of same object.
   auto insert_result = m_IndirectObjs.insert(std::make_pair(objnum, nullptr));
@@ -96,13 +98,15 @@
     uint32_t objnum,
     RetainPtr<CPDF_Object> pObj) {
   DCHECK(objnum);
-  if (!pObj || objnum == CPDF_Object::kInvalidObjNum)
+  if (!pObj || objnum == CPDF_Object::kInvalidObjNum) {
     return false;
+  }
 
   auto& obj_holder = m_IndirectObjs[objnum];
   const CPDF_Object* old_object = FilterInvalidObjNum(obj_holder.Get());
-  if (old_object && pObj->GetGenNum() <= old_object->GetGenNum())
+  if (old_object && pObj->GetGenNum() <= old_object->GetGenNum()) {
     return false;
+  }
 
   pObj->SetObjNum(objnum);
   obj_holder = std::move(pObj);
@@ -112,8 +116,9 @@
 
 void CPDF_IndirectObjectHolder::DeleteIndirectObject(uint32_t objnum) {
   auto it = m_IndirectObjs.find(objnum);
-  if (it == m_IndirectObjs.end() || !FilterInvalidObjNum(it->second.Get()))
+  if (it == m_IndirectObjs.end() || !FilterInvalidObjNum(it->second.Get())) {
     return;
+  }
 
   m_IndirectObjs.erase(it);
 }
diff --git a/core/fpdfapi/parser/cpdf_linearized_header.cpp b/core/fpdfapi/parser/cpdf_linearized_header.cpp
index c573cd2..cd6461b 100644
--- a/core/fpdfapi/parser/cpdf_linearized_header.cpp
+++ b/core/fpdfapi/parser/cpdf_linearized_header.cpp
@@ -29,11 +29,13 @@
                                    const ByteString& key,
                                    T min_value,
                                    bool must_exist = true) {
-  if (!pDict->KeyExist(key))
+  if (!pDict->KeyExist(key)) {
     return !must_exist;
+  }
   RetainPtr<const CPDF_Number> pNum = pDict->GetNumberFor(key);
-  if (!pNum || !pNum->IsInteger())
+  if (!pNum || !pNum->IsInteger()) {
     return false;
+  }
   const int raw_value = pNum->GetInteger();
   if (!pdfium::IsValueInRangeForNumericType<T>(raw_value)) {
     return false;
@@ -75,14 +77,16 @@
   }
   // Move parser to the start of the xref table for the documents first page.
   // (skpping endobj keyword)
-  if (parser->GetNextWord().word != "endobj")
+  if (parser->GetNextWord().word != "endobj") {
     return nullptr;
+  }
 
   auto result = pdfium::WrapUnique(
       new CPDF_LinearizedHeader(pDict.Get(), parser->GetPos()));
 
-  if (!IsLinearizedHeaderValid(result.get(), parser->GetDocumentSize()))
+  if (!IsLinearizedHeaderValid(result.get(), parser->GetDocumentSize())) {
     return nullptr;
+  }
 
   return result;
 }
@@ -102,8 +106,9 @@
   if (nHintStreamSize == 2 || nHintStreamSize == 4) {
     m_szHintStart = std::max(pHintStreamRange->GetIntegerAt(0), 0);
     const FX_SAFE_UINT32 safe_hint_length = pHintStreamRange->GetIntegerAt(1);
-    if (safe_hint_length.IsValid())
+    if (safe_hint_length.IsValid()) {
       m_HintLength = safe_hint_length.ValueOrDie();
+    }
   }
 }
 
diff --git a/core/fpdfapi/parser/cpdf_name.cpp b/core/fpdfapi/parser/cpdf_name.cpp
index 37ef20f..dec64a0 100644
--- a/core/fpdfapi/parser/cpdf_name.cpp
+++ b/core/fpdfapi/parser/cpdf_name.cpp
@@ -12,8 +12,9 @@
 
 CPDF_Name::CPDF_Name(WeakPtr<ByteStringPool> pPool, const ByteString& str)
     : m_Name(str) {
-  if (pPool)
+  if (pPool) {
     m_Name = pPool->Intern(m_Name);
+  }
 }
 
 CPDF_Name::~CPDF_Name() = default;
@@ -44,8 +45,9 @@
 
 bool CPDF_Name::WriteTo(IFX_ArchiveStream* archive,
                         const CPDF_Encryptor* encryptor) const {
-  if (!archive->WriteString("/"))
+  if (!archive->WriteString("/")) {
     return false;
+  }
 
   const ByteString name = PDF_NameEncode(GetString());
   return name.IsEmpty() || archive->WriteString(name.AsStringView());
diff --git a/core/fpdfapi/parser/cpdf_object.cpp b/core/fpdfapi/parser/cpdf_object.cpp
index db279b9..0b1ddde 100644
--- a/core/fpdfapi/parser/cpdf_object.cpp
+++ b/core/fpdfapi/parser/cpdf_object.cpp
@@ -26,8 +26,9 @@
               "Need a smaller kMaxObjNumber for cache keys");
 
 uint64_t CPDF_Object::KeyForCache() const {
-  if (IsInline())
+  if (IsInline()) {
     return (static_cast<uint64_t>(1) << 63) | reinterpret_cast<uint64_t>(this);
+  }
 
   return (static_cast<uint64_t>(m_ObjNum) << 32) |
          static_cast<uint64_t>(m_GenNum);
diff --git a/core/fpdfapi/parser/cpdf_object_avail.cpp b/core/fpdfapi/parser/cpdf_object_avail.cpp
index 5809775..2c18bbf 100644
--- a/core/fpdfapi/parser/cpdf_object_avail.cpp
+++ b/core/fpdfapi/parser/cpdf_object_avail.cpp
@@ -23,8 +23,9 @@
   DCHECK(validator_);
   DCHECK(holder);
   DCHECK(root_);
-  if (!root_->IsInline())
+  if (!root_->IsInline()) {
     parsed_objnums_.insert(root_->GetObjNum());
+  }
 }
 
 CPDF_ObjectAvail::CPDF_ObjectAvail(RetainPtr<CPDF_ReadValidator> validator,
@@ -40,8 +41,9 @@
 CPDF_ObjectAvail::~CPDF_ObjectAvail() = default;
 
 CPDF_DataAvail::DocAvailStatus CPDF_ObjectAvail::CheckAvail() {
-  if (!LoadRootObject())
+  if (!LoadRootObject()) {
     return CPDF_DataAvail::kDataNotAvailable;
+  }
 
   if (CheckObjects()) {
     CleanMemory();
@@ -51,8 +53,9 @@
 }
 
 bool CPDF_ObjectAvail::LoadRootObject() {
-  if (!non_parsed_objects_.empty())
+  if (!non_parsed_objects_.empty()) {
     return true;
+  }
 
   while (root_ && root_->IsReference()) {
     const uint32_t ref_obj_num = root_->AsReference()->GetRefObjNum();
@@ -64,8 +67,9 @@
     CPDF_ReadValidator::ScopedSession parse_session(validator_);
     RetainPtr<CPDF_Object> direct =
         holder_->GetOrParseIndirectObject(ref_obj_num);
-    if (validator_->has_read_problems())
+    if (validator_->has_read_problems()) {
       return false;
+    }
 
     parsed_objnums_.insert(ref_obj_num);
     root_ = std::move(direct);
@@ -86,17 +90,20 @@
     const uint32_t obj_num = objects_to_check.top();
     objects_to_check.pop();
 
-    if (HasObjectParsed(obj_num))
+    if (HasObjectParsed(obj_num)) {
       continue;
+    }
 
-    if (!checked_objects.insert(obj_num).second)
+    if (!checked_objects.insert(obj_num).second) {
       continue;
+    }
 
     CPDF_ReadValidator::ScopedSession parse_session(validator_);
     RetainPtr<const CPDF_Object> direct =
         holder_->GetOrParseIndirectObject(obj_num);
-    if (direct == root_)
+    if (direct == root_) {
       continue;
+    }
 
     if (validator_->has_read_problems() ||
         !AppendObjectSubRefs(std::move(direct), &objects_to_check)) {
@@ -111,8 +118,9 @@
 bool CPDF_ObjectAvail::AppendObjectSubRefs(RetainPtr<const CPDF_Object> object,
                                            std::stack<uint32_t>* refs) const {
   DCHECK(refs);
-  if (!object)
+  if (!object) {
     return true;
+  }
 
   CPDF_ObjectWalker walker(std::move(object));
   while (RetainPtr<const CPDF_Object> obj = walker.GetNext()) {
@@ -127,16 +135,18 @@
     // We need to parse the object before we can do the exclusion check.
     // This is because the exclusion check may check against a referenced
     // field of the object which we need to make sure is loaded.
-    if (validator_->has_read_problems())
+    if (validator_->has_read_problems()) {
       return false;
+    }
 
     if (skip) {
       walker.SkipWalkIntoCurrentObject();
       continue;
     }
 
-    if (obj->IsReference())
+    if (obj->IsReference()) {
       refs->push(obj->AsReference()->GetRefObjNum());
+    }
   }
   return true;
 }
diff --git a/core/fpdfapi/parser/cpdf_object_stream.cpp b/core/fpdfapi/parser/cpdf_object_stream.cpp
index 082545a..6954b84 100644
--- a/core/fpdfapi/parser/cpdf_object_stream.cpp
+++ b/core/fpdfapi/parser/cpdf_object_stream.cpp
@@ -22,13 +22,15 @@
 namespace {
 
 bool IsObjectStream(const CPDF_Stream* stream) {
-  if (!stream)
+  if (!stream) {
     return false;
+  }
 
   // See ISO 32000-1:2008 spec, table 16.
   RetainPtr<const CPDF_Dictionary> stream_dict = stream->GetDict();
-  if (!ValidateDictType(stream_dict.Get(), "ObjStm"))
+  if (!ValidateDictType(stream_dict.Get(), "ObjStm")) {
     return false;
+  }
 
   RetainPtr<const CPDF_Number> number_of_objects =
       stream_dict->GetNumberFor("N");
@@ -54,8 +56,9 @@
 //  static
 std::unique_ptr<CPDF_ObjectStream> CPDF_ObjectStream::Create(
     RetainPtr<const CPDF_Stream> stream) {
-  if (!IsObjectStream(stream.Get()))
+  if (!IsObjectStream(stream.Get())) {
     return nullptr;
+  }
 
   // Protected constructor.
   return pdfium::WrapUnique(new CPDF_ObjectStream(std::move(stream)));
@@ -74,17 +77,20 @@
     CPDF_IndirectObjectHolder* pObjList,
     uint32_t obj_number,
     uint32_t archive_obj_index) const {
-  if (archive_obj_index >= object_info_.size())
+  if (archive_obj_index >= object_info_.size()) {
     return nullptr;
+  }
 
   const auto& info = object_info_[archive_obj_index];
-  if (info.obj_num != obj_number)
+  if (info.obj_num != obj_number) {
     return nullptr;
+  }
 
   RetainPtr<CPDF_Object> result =
       ParseObjectAtOffset(pObjList, info.obj_offset);
-  if (result)
+  if (result) {
     result->SetObjNum(obj_number);
+  }
   return result;
 }
 
@@ -96,13 +102,15 @@
   CPDF_SyntaxParser syntax(data_stream_);
   const int object_count = stream->GetDict()->GetIntegerFor("N");
   for (int32_t i = object_count; i > 0; --i) {
-    if (syntax.GetPos() >= data_stream_->GetSize())
+    if (syntax.GetPos() >= data_stream_->GetSize()) {
       break;
+    }
 
     const uint32_t obj_num = syntax.GetDirectNum();
     const uint32_t obj_offset = syntax.GetDirectNum();
-    if (!obj_num)
+    if (!obj_num) {
       continue;
+    }
 
     object_info_.emplace_back(obj_num, obj_offset);
   }
@@ -114,11 +122,13 @@
   FX_SAFE_FILESIZE offset_in_stream = first_object_offset_;
   offset_in_stream += object_offset;
 
-  if (!offset_in_stream.IsValid())
+  if (!offset_in_stream.IsValid()) {
     return nullptr;
+  }
 
-  if (offset_in_stream.ValueOrDie() >= data_stream_->GetSize())
+  if (offset_in_stream.ValueOrDie() >= data_stream_->GetSize()) {
     return nullptr;
+  }
 
   CPDF_SyntaxParser syntax(data_stream_);
   syntax.SetPos(offset_in_stream.ValueOrDie());
diff --git a/core/fpdfapi/parser/cpdf_object_walker.cpp b/core/fpdfapi/parser/cpdf_object_walker.cpp
index 2f20136..0c57b81 100644
--- a/core/fpdfapi/parser/cpdf_object_walker.cpp
+++ b/core/fpdfapi/parser/cpdf_object_walker.cpp
@@ -105,8 +105,9 @@
   }
   while (!IsFinished()) {
     RetainPtr<const CPDF_Object> result = IncrementImpl();
-    if (result)
+    if (result) {
       return result;
+    }
   }
   return nullptr;
 }
@@ -120,12 +121,15 @@
 // static
 std::unique_ptr<CPDF_ObjectWalker::SubobjectIterator>
 CPDF_ObjectWalker::MakeIterator(RetainPtr<const CPDF_Object> object) {
-  if (object->IsStream())
+  if (object->IsStream()) {
     return std::make_unique<StreamIterator>(ToStream(object));
-  if (object->IsDictionary())
+  }
+  if (object->IsDictionary()) {
     return std::make_unique<DictionaryIterator>(ToDictionary(object));
-  if (object->IsArray())
+  }
+  if (object->IsArray()) {
     return std::make_unique<ArrayIterator>(ToArray(object));
+  }
   return nullptr;
 }
 
@@ -163,8 +167,9 @@
 }
 
 void CPDF_ObjectWalker::SkipWalkIntoCurrentObject() {
-  if (stack_.empty() || stack_.top()->IsStarted())
+  if (stack_.empty() || stack_.top()->IsStarted()) {
     return;
+  }
   stack_.pop();
 }
 
diff --git a/core/fpdfapi/parser/cpdf_page_object_avail.cpp b/core/fpdfapi/parser/cpdf_page_object_avail.cpp
index af46e70..2eeb89a 100644
--- a/core/fpdfapi/parser/cpdf_page_object_avail.cpp
+++ b/core/fpdfapi/parser/cpdf_page_object_avail.cpp
@@ -10,8 +10,9 @@
 CPDF_PageObjectAvail::~CPDF_PageObjectAvail() = default;
 
 bool CPDF_PageObjectAvail::ExcludeObject(const CPDF_Object* object) const {
-  if (CPDF_ObjectAvail::ExcludeObject(object))
+  if (CPDF_ObjectAvail::ExcludeObject(object)) {
     return true;
+  }
 
   // See ISO 32000-1:2008 spec, table 30.
   return ValidateDictType(ToDictionary(object), "Page");
diff --git a/core/fpdfapi/parser/cpdf_parser.cpp b/core/fpdfapi/parser/cpdf_parser.cpp
index a15c47e..e2d0972 100644
--- a/core/fpdfapi/parser/cpdf_parser.cpp
+++ b/core/fpdfapi/parser/cpdf_parser.cpp
@@ -82,8 +82,9 @@
 // directly.
 uint32_t GetVarInt(pdfium::span<const uint8_t> input) {
   uint32_t result = 0;
-  for (uint8_t c : input)
+  for (uint8_t c : input) {
     result = result * 256 + c;
+  }
   return result;
 }
 
@@ -113,36 +114,42 @@
   if (array) {
     for (size_t i = 0; i < array->size() / 2; i++) {
       RetainPtr<const CPDF_Number> pStartNumObj = array->GetNumberAt(i * 2);
-      if (!pStartNumObj)
+      if (!pStartNumObj) {
         continue;
+      }
 
       RetainPtr<const CPDF_Number> pCountObj = array->GetNumberAt(i * 2 + 1);
-      if (!pCountObj)
+      if (!pCountObj) {
         continue;
+      }
 
       int nStartNum = pStartNumObj->GetInteger();
       int nCount = pCountObj->GetInteger();
-      if (nStartNum < 0 || nCount <= 0)
+      if (nStartNum < 0 || nCount <= 0) {
         continue;
+      }
 
       indices.push_back(
           {static_cast<uint32_t>(nStartNum), static_cast<uint32_t>(nCount)});
     }
   }
 
-  if (indices.empty())
+  if (indices.empty()) {
     indices.push_back({0, size});
+  }
   return indices;
 }
 
 std::vector<uint32_t> GetFieldWidths(const CPDF_Array* array) {
   std::vector<uint32_t> results;
-  if (!array)
+  if (!array) {
     return results;
+  }
 
   CPDF_ArrayLocker locker(array);
-  for (const auto& obj : locker)
+  for (const auto& obj : locker) {
     results.push_back(obj->GetInteger());
+  }
   return results;
 }
 
@@ -191,10 +198,12 @@
 
 bool CPDF_Parser::InitSyntaxParser(RetainPtr<CPDF_ReadValidator> validator) {
   const std::optional<FX_FILESIZE> header_offset = GetHeaderOffset(validator);
-  if (!header_offset.has_value())
+  if (!header_offset.has_value()) {
     return false;
-  if (validator->GetSize() < header_offset.value() + kPDFHeaderSize)
+  }
+  if (validator->GetSize() < header_offset.value() + kPDFHeaderSize) {
     return false;
+  }
 
   m_pSyntax = std::make_unique<CPDF_SyntaxParser>(std::move(validator),
                                                   header_offset.value());
@@ -228,8 +237,9 @@
     RetainPtr<IFX_SeekableReadStream> pFileAccess,
     const ByteString& password) {
   if (!InitSyntaxParser(pdfium::MakeRetain<CPDF_ReadValidator>(
-          std::move(pFileAccess), nullptr)))
+          std::move(pFileAccess), nullptr))) {
     return FORMAT_ERROR;
+  }
   SetPassword(password);
   return StartParseInternal();
 }
@@ -243,52 +253,62 @@
   m_LastXRefOffset = ParseStartXRef();
   if (m_LastXRefOffset >= kPDFHeaderSize) {
     if (!LoadAllCrossRefTablesAndStreams(m_LastXRefOffset)) {
-      if (!RebuildCrossRef())
+      if (!RebuildCrossRef()) {
         return FORMAT_ERROR;
+      }
 
       m_bXRefTableRebuilt = true;
       m_LastXRefOffset = 0;
     }
   } else {
-    if (!RebuildCrossRef())
+    if (!RebuildCrossRef()) {
       return FORMAT_ERROR;
+    }
 
     m_bXRefTableRebuilt = true;
   }
   Error eRet = SetEncryptHandler();
-  if (eRet != SUCCESS)
+  if (eRet != SUCCESS) {
     return eRet;
+  }
 
   if (!GetRoot() || !m_pObjectsHolder->TryInit()) {
-    if (m_bXRefTableRebuilt)
+    if (m_bXRefTableRebuilt) {
       return FORMAT_ERROR;
+    }
 
     ReleaseEncryptHandler();
-    if (!RebuildCrossRef())
+    if (!RebuildCrossRef()) {
       return FORMAT_ERROR;
+    }
 
     eRet = SetEncryptHandler();
-    if (eRet != SUCCESS)
+    if (eRet != SUCCESS) {
       return eRet;
+    }
 
     m_pObjectsHolder->TryInit();
-    if (!GetRoot())
+    if (!GetRoot()) {
       return FORMAT_ERROR;
+    }
   }
   if (GetRootObjNum() == CPDF_Object::kInvalidObjNum) {
     ReleaseEncryptHandler();
-    if (!RebuildCrossRef() || GetRootObjNum() == CPDF_Object::kInvalidObjNum)
+    if (!RebuildCrossRef() || GetRootObjNum() == CPDF_Object::kInvalidObjNum) {
       return FORMAT_ERROR;
+    }
 
     eRet = SetEncryptHandler();
-    if (eRet != SUCCESS)
+    if (eRet != SUCCESS) {
       return eRet;
+    }
   }
   if (m_pSecurityHandler && !m_pSecurityHandler->IsMetadataEncrypted()) {
     RetainPtr<const CPDF_Reference> pMetadata =
         ToReference(GetRoot()->GetObjectFor("Metadata"));
-    if (pMetadata)
+    if (pMetadata) {
       m_MetadataObjnum = pMetadata->GetRefObjNum();
+    }
   }
   return SUCCESS;
 }
@@ -297,8 +317,9 @@
   static constexpr char kStartXRefKeyword[] = "startxref";
   m_pSyntax->SetPos(m_pSyntax->GetDocumentSize() -
                     UNSAFE_TODO(strlen(kStartXRefKeyword)));
-  if (!m_pSyntax->BackwardsSearchToWord(kStartXRefKeyword, 4096))
+  if (!m_pSyntax->BackwardsSearchToWord(kStartXRefKeyword, 4096)) {
     return 0;
+  }
 
   // Skip "startxref" keyword.
   m_pSyntax->GetKeyword();
@@ -306,31 +327,38 @@
   // Read XRef offset.
   const CPDF_SyntaxParser::WordResult xref_offset_result =
       m_pSyntax->GetNextWord();
-  if (!xref_offset_result.is_number || xref_offset_result.word.IsEmpty())
+  if (!xref_offset_result.is_number || xref_offset_result.word.IsEmpty()) {
     return 0;
+  }
 
   const FX_SAFE_FILESIZE result = FXSYS_atoi64(xref_offset_result.word.c_str());
-  if (!result.IsValid() || result.ValueOrDie() >= m_pSyntax->GetDocumentSize())
+  if (!result.IsValid() ||
+      result.ValueOrDie() >= m_pSyntax->GetDocumentSize()) {
     return 0;
+  }
 
   return result.ValueOrDie();
 }
 
 CPDF_Parser::Error CPDF_Parser::SetEncryptHandler() {
   ReleaseEncryptHandler();
-  if (!GetTrailer())
+  if (!GetTrailer()) {
     return FORMAT_ERROR;
+  }
 
   RetainPtr<const CPDF_Dictionary> pEncryptDict = GetEncryptDict();
-  if (!pEncryptDict)
+  if (!pEncryptDict) {
     return SUCCESS;
+  }
 
-  if (pEncryptDict->GetNameFor("Filter") != "Standard")
+  if (pEncryptDict->GetNameFor("Filter") != "Standard") {
     return HANDLER_ERROR;
+  }
 
   auto pSecurityHandler = pdfium::MakeRetain<CPDF_SecurityHandler>();
-  if (!pSecurityHandler->OnInit(pEncryptDict, GetIDArray(), GetPassword()))
+  if (!pSecurityHandler->OnInit(pEncryptDict, GetIDArray(), GetPassword())) {
     return PASSWORD_ERROR;
+  }
 
   m_pSecurityHandler = std::move(pSecurityHandler);
   return SUCCESS;
@@ -346,8 +374,9 @@
 // in the cross reference table are all off by one.
 bool CPDF_Parser::VerifyCrossRefTable() {
   for (const auto& it : m_CrossRefTable->objects_info()) {
-    if (it.second.pos <= 0)
+    if (it.second.pos <= 0) {
       continue;
+    }
     // Find the first non-zero position.
     FX_FILESIZE SavedPos = m_pSyntax->GetPos();
     m_pSyntax->SetPos(it.second.pos);
@@ -449,12 +478,14 @@
   }
 
   RetainPtr<CPDF_Dictionary> main_trailer = LoadTrailer();
-  if (!main_trailer)
+  if (!main_trailer) {
     return false;
+  }
 
   // GetTrailer() currently returns the first-page trailer.
-  if (GetTrailer()->GetDirectIntegerFor("Size") == 0)
+  if (GetTrailer()->GetDirectIntegerFor("Size") == 0) {
     return false;
+  }
 
   // Read /XRefStm from the first-page trailer. No need to read /Prev for the
   // first-page trailer, as the caller already did that and passed it in as
@@ -502,8 +533,9 @@
     uint32_t start_objnum,
     uint32_t count,
     std::vector<CrossRefObjData>* out_objects) {
-  if (!count)
+  if (!count) {
     return true;
+  }
 
   // Each entry shall be exactly 20 byte.
   // A sample entry looks like:
@@ -514,23 +546,27 @@
     FX_SAFE_FILESIZE pos = count;
     pos *= kEntrySize;
     pos += m_pSyntax->GetPos();
-    if (!pos.IsValid())
+    if (!pos.IsValid()) {
       return false;
+    }
     m_pSyntax->SetPos(pos.ValueOrDie());
     return true;
   }
   const size_t start_obj_index = out_objects->size();
   FX_SAFE_SIZE_T new_size = start_obj_index;
   new_size += count;
-  if (!new_size.IsValid())
+  if (!new_size.IsValid()) {
     return false;
+  }
 
-  if (new_size.ValueOrDie() > kMaxXRefSize)
+  if (new_size.ValueOrDie() > kMaxXRefSize) {
     return false;
+  }
 
   const size_t max_entries_in_file = m_pSyntax->GetDocumentSize() / kEntrySize;
-  if (new_size.ValueOrDie() > max_entries_in_file)
+  if (new_size.ValueOrDie() > max_entries_in_file) {
     return false;
+  }
 
   out_objects->resize(new_size.ValueOrDie());
 
@@ -542,8 +578,9 @@
     const uint32_t entries_in_block = std::min(entries_to_read, 1024u);
     const uint32_t bytes_to_read = entries_in_block * kEntrySize;
     auto block_span = pdfium::make_span(buf).first(bytes_to_read);
-    if (!m_pSyntax->ReadBlock(pdfium::as_writable_bytes(block_span)))
+    if (!m_pSyntax->ReadBlock(pdfium::as_writable_bytes(block_span))) {
       return false;
+    }
 
     for (uint32_t i = 0; i < entries_in_block; i++) {
       uint32_t iObjectIndex = count - entries_to_read + i;
@@ -560,8 +597,9 @@
         info.type = ObjectType::kFree;
       } else {
         const FX_SAFE_FILESIZE offset = FXSYS_atoi64(pEntry.data());
-        if (!offset.IsValid())
+        if (!offset.IsValid()) {
           return false;
+        }
 
         if (offset.ValueOrDie() == 0) {
           for (int32_t c = 0; c < 10; c++) {
@@ -587,18 +625,21 @@
 
 bool CPDF_Parser::ParseCrossRefTable(
     std::vector<CrossRefObjData>* out_objects) {
-  if (out_objects)
+  if (out_objects) {
     out_objects->clear();
+  }
 
-  if (m_pSyntax->GetKeyword() != "xref")
+  if (m_pSyntax->GetKeyword() != "xref") {
     return false;
+  }
   std::vector<CrossRefObjData> result_objects;
   while (true) {
     FX_FILESIZE saved_pos = m_pSyntax->GetPos();
     CPDF_SyntaxParser::WordResult word_result = m_pSyntax->GetNextWord();
     const ByteString& word = word_result.word;
-    if (word.IsEmpty())
+    if (word.IsEmpty()) {
       return false;
+    }
 
     if (!word_result.is_number) {
       m_pSyntax->SetPos(saved_pos);
@@ -606,8 +647,9 @@
     }
 
     uint32_t start_objnum = FXSYS_atoui(word.c_str());
-    if (start_objnum >= kMaxObjectNumber)
+    if (start_objnum >= kMaxObjectNumber) {
       return false;
+    }
 
     uint32_t count = m_pSyntax->GetDirectNum();
     m_pSyntax->ToNextWord();
@@ -617,8 +659,9 @@
       return false;
     }
   }
-  if (out_objects)
+  if (out_objects) {
     *out_objects = std::move(result_objects);
+  }
   return true;
 }
 
@@ -638,8 +681,9 @@
   for (const auto& obj : objects) {
     switch (obj.info.type) {
       case ObjectType::kFree:
-        if (obj.info.gennum > 0)
+        if (obj.info.gennum > 0) {
           m_CrossRefTable->SetFree(obj.obj_num, obj.info.gennum);
+        }
         break;
       case ObjectType::kNormal:
         m_CrossRefTable->AddNormal(obj.obj_num, obj.info.gennum,
@@ -722,8 +766,9 @@
     if (result.is_number) {
       numbers.emplace_back(FXSYS_atoui(word.c_str()),
                            m_pSyntax->GetPos() - word.GetLength());
-      if (numbers.size() > 2u)
+      if (numbers.size() > 2u) {
         numbers.erase(numbers.begin());
+      }
       continue;
     }
 
@@ -772,8 +817,9 @@
           const auto& object_info = object_stream->object_info();
           for (size_t i = 0; i < object_info.size(); ++i) {
             const auto& info = object_info[i];
-            if (info.obj_num < kMaxObjectNumber)
+            if (info.obj_num < kMaxObjectNumber) {
               cross_ref_table->AddCompressed(info.obj_num, obj_num, i);
+            }
           }
         }
       }
@@ -798,12 +844,14 @@
 
   RetainPtr<const CPDF_Dictionary> pDict = pStream->GetDict();
   int32_t prev = pDict->GetIntegerFor("Prev");
-  if (prev < 0)
+  if (prev < 0) {
     return false;
+  }
 
   int32_t size = pDict->GetIntegerFor("Size");
-  if (size < 0)
+  if (size < 0) {
     return false;
+  }
 
   *pos = prev;
 
@@ -823,14 +871,17 @@
 
   std::vector<uint32_t> field_widths =
       GetFieldWidths(pDict->GetArrayFor("W").Get());
-  if (field_widths.size() < kMinFieldCount)
+  if (field_widths.size() < kMinFieldCount) {
     return false;
+  }
 
   FX_SAFE_UINT32 dwAccWidth;
-  for (uint32_t width : field_widths)
+  for (uint32_t width : field_widths) {
     dwAccWidth += width;
-  if (!dwAccWidth.IsValid())
+  }
+  if (!dwAccWidth.IsValid()) {
     return false;
+  }
 
   uint32_t total_width = dwAccWidth.ValueOrDie();
   auto pAcc = pdfium::MakeRetain<CPDF_StreamAcc>(pStream);
@@ -842,8 +893,9 @@
     FX_SAFE_UINT32 seg_end = segindex;
     seg_end += index.obj_count;
     seg_end *= total_width;
-    if (!seg_end.IsValid() || seg_end.ValueOrDie() > data_span.size())
+    if (!seg_end.IsValid() || seg_end.ValueOrDie() > data_span.size()) {
       continue;
+    }
 
     pdfium::span<const uint8_t> seg_span = data_span.subspan(
         segindex * total_width, index.obj_count * total_width);
@@ -948,16 +1000,19 @@
 }
 
 RetainPtr<const CPDF_Dictionary> CPDF_Parser::GetEncryptDict() const {
-  if (!GetTrailer())
+  if (!GetTrailer()) {
     return nullptr;
+  }
 
   RetainPtr<const CPDF_Object> pEncryptObj =
       GetTrailer()->GetObjectFor("Encrypt");
-  if (!pEncryptObj)
+  if (!pEncryptObj) {
     return nullptr;
+  }
 
-  if (pEncryptObj->IsDictionary())
+  if (pEncryptObj->IsDictionary()) {
     return pdfium::WrapRetain(pEncryptObj->AsDictionary());
+  }
 
   if (pEncryptObj->IsReference()) {
     return ToDictionary(m_pObjectsHolder->GetOrParseIndirectObject(
@@ -1043,12 +1098,14 @@
 
 const CPDF_ObjectStream* CPDF_Parser::GetObjectStream(uint32_t object_number) {
   // Prevent circular parsing the same object.
-  if (pdfium::Contains(m_ParsingObjNums, object_number))
+  if (pdfium::Contains(m_ParsingObjNums, object_number)) {
     return nullptr;
+  }
 
   auto it = m_ObjectStreamMap.find(object_number);
-  if (it != m_ObjectStreamMap.end())
+  if (it != m_ObjectStreamMap.end()) {
     return it->second.get();
+  }
 
   const auto* info = m_CrossRefTable->GetObjectInfo(object_number);
   if (!info || !info->is_object_stream_flag) {
@@ -1056,16 +1113,18 @@
   }
 
   const FX_FILESIZE object_pos = info->pos;
-  if (object_pos <= 0)
+  if (object_pos <= 0) {
     return nullptr;
+  }
 
   // Keep track of `object_number` before doing more parsing.
   ScopedSetInsertion<uint32_t> local_insert(&m_ParsingObjNums, object_number);
 
   RetainPtr<CPDF_Object> object =
       ParseIndirectObjectAt(object_pos, object_number);
-  if (!object)
+  if (!object) {
     return nullptr;
+  }
 
   std::unique_ptr<CPDF_ObjectStream> objs_stream =
       CPDF_ObjectStream::Create(ToStream(object));
@@ -1083,8 +1142,9 @@
   auto result = m_pSyntax->GetIndirectObject(
       m_pObjectsHolder, CPDF_SyntaxParser::ParseType::kLoose);
   m_pSyntax->SetPos(saved_pos);
-  if (result && objnum && result->GetObjNum() != objnum)
+  if (result && objnum && result->GetObjNum() != objnum) {
     return nullptr;
+  }
 
   const bool should_decrypt = m_pSecurityHandler &&
                               m_pSecurityHandler->GetCryptoHandler() &&
@@ -1110,8 +1170,9 @@
 }
 
 RetainPtr<CPDF_Dictionary> CPDF_Parser::LoadTrailer() {
-  if (m_pSyntax->GetKeyword() != "trailer")
+  if (m_pSyntax->GetKeyword() != "trailer") {
     return nullptr;
+  }
 
   return ToDictionary(m_pSyntax->GetObjectBody(m_pObjectsHolder));
 }
@@ -1135,12 +1196,14 @@
   m_bXRefStream = false;
   m_LastXRefOffset = 0;
 
-  if (!InitSyntaxParser(std::move(validator)))
+  if (!InitSyntaxParser(std::move(validator))) {
     return FORMAT_ERROR;
+  }
 
   m_pLinearized = ParseLinearizedHeader();
-  if (!m_pLinearized)
+  if (!m_pLinearized) {
     return StartParseInternal();
+  }
 
   m_bHasParsed = true;
 
@@ -1150,16 +1213,18 @@
       LoadCrossRefTable(dwFirstXRefOffset, /*skip=*/false);
   if (!loaded_xref_table &&
       !LoadCrossRefStream(&dwFirstXRefOffset, /*is_main_xref=*/true)) {
-    if (!RebuildCrossRef())
+    if (!RebuildCrossRef()) {
       return FORMAT_ERROR;
+    }
 
     m_bXRefTableRebuilt = true;
     m_LastXRefOffset = 0;
   }
   if (loaded_xref_table) {
     RetainPtr<CPDF_Dictionary> trailer = LoadTrailer();
-    if (!trailer)
+    if (!trailer) {
       return SUCCESS;
+    }
 
     m_CrossRefTable->SetTrailer(std::move(trailer), kNoTrailerObjectNumber);
     const int32_t xrefsize = GetTrailer()->GetDirectIntegerFor("Size");
@@ -1174,41 +1239,49 @@
   }
 
   Error eRet = SetEncryptHandler();
-  if (eRet != SUCCESS)
+  if (eRet != SUCCESS) {
     return eRet;
+  }
 
   if (!GetRoot() || !m_pObjectsHolder->TryInit()) {
-    if (m_bXRefTableRebuilt)
+    if (m_bXRefTableRebuilt) {
       return FORMAT_ERROR;
+    }
 
     ReleaseEncryptHandler();
-    if (!RebuildCrossRef())
+    if (!RebuildCrossRef()) {
       return FORMAT_ERROR;
+    }
 
     eRet = SetEncryptHandler();
-    if (eRet != SUCCESS)
+    if (eRet != SUCCESS) {
       return eRet;
+    }
 
     m_pObjectsHolder->TryInit();
-    if (!GetRoot())
+    if (!GetRoot()) {
       return FORMAT_ERROR;
+    }
   }
 
   if (GetRootObjNum() == CPDF_Object::kInvalidObjNum) {
     ReleaseEncryptHandler();
-    if (!RebuildCrossRef() || GetRootObjNum() == CPDF_Object::kInvalidObjNum)
+    if (!RebuildCrossRef() || GetRootObjNum() == CPDF_Object::kInvalidObjNum) {
       return FORMAT_ERROR;
+    }
 
     eRet = SetEncryptHandler();
-    if (eRet != SUCCESS)
+    if (eRet != SUCCESS) {
       return eRet;
+    }
   }
 
   if (m_pSecurityHandler && m_pSecurityHandler->IsMetadataEncrypted()) {
     RetainPtr<const CPDF_Reference> pMetadata =
         ToReference(GetRoot()->GetObjectFor("Metadata"));
-    if (pMetadata)
+    if (pMetadata) {
       m_MetadataObjnum = pMetadata->GetRefObjNum();
+    }
   }
   return SUCCESS;
 }
@@ -1228,8 +1301,9 @@
     }
 
     // Check for circular references.
-    if (pdfium::Contains(seen_xref_offset, xref_offset))
+    if (pdfium::Contains(seen_xref_offset, xref_offset)) {
       return false;
+    }
   }
   m_ObjectStreamMap.clear();
   m_bXRefStream = true;
@@ -1239,11 +1313,13 @@
 CPDF_Parser::Error CPDF_Parser::LoadLinearizedMainXRefTable() {
   const FX_SAFE_FILESIZE prev = GetTrailer()->GetIntegerFor("Prev");
   const FX_FILESIZE main_xref_offset = prev.ValueOrDefault(-1);
-  if (main_xref_offset < 0)
+  if (main_xref_offset < 0) {
     return FORMAT_ERROR;
+  }
 
-  if (main_xref_offset == 0)
+  if (main_xref_offset == 0) {
     return SUCCESS;
+  }
 
   const AutoRestorer<uint32_t> save_metadata_objnum(&m_MetadataObjnum);
   m_MetadataObjnum = 0;
@@ -1274,18 +1350,21 @@
     if (word_result.is_number) {
       // The object number was read. Read the generation number.
       word_result = m_pSyntax->GetNextWord();
-      if (!word_result.is_number)
+      if (!word_result.is_number) {
         break;
+      }
 
       word_result = m_pSyntax->GetNextWord();
-      if (word_result.word != "obj")
+      if (word_result.word != "obj") {
         break;
+      }
 
       m_pSyntax->GetObjectBody(nullptr);
 
       word_result = m_pSyntax->GetNextWord();
-      if (word_result.word != "endobj")
+      if (word_result.word != "endobj") {
         break;
+      }
     } else if (word_result.word == "trailer") {
       m_pSyntax->GetObjectBody(nullptr);
     } else if (word_result.word == "startxref") {
@@ -1293,8 +1372,9 @@
     } else if (word_result.word == "xref") {
       while (true) {
         word_result = m_pSyntax->GetNextWord();
-        if (word_result.word.IsEmpty() || word_result.word == "startxref")
+        if (word_result.word.IsEmpty() || word_result.word == "startxref") {
           break;
+        }
       }
       m_pSyntax->GetNextWord();
     } else {
@@ -1316,10 +1396,12 @@
     const uint32_t block_size =
         static_cast<uint32_t>(std::min(kBufferSize, src_size));
     auto block_span = pdfium::make_span(buffer).first(block_size);
-    if (!m_pSyntax->ReadBlock(block_span))
+    if (!m_pSyntax->ReadBlock(block_span)) {
       return false;
-    if (!archive->WriteBlock(pdfium::make_span(buffer).first(block_size)))
+    }
+    if (!archive->WriteBlock(pdfium::make_span(buffer).first(block_size))) {
       return false;
+    }
     src_size -= block_size;
   }
   return true;
diff --git a/core/fpdfapi/parser/cpdf_read_validator.cpp b/core/fpdfapi/parser/cpdf_read_validator.cpp
index a1d8690..cdbbab4 100644
--- a/core/fpdfapi/parser/cpdf_read_validator.cpp
+++ b/core/fpdfapi/parser/cpdf_read_validator.cpp
@@ -65,16 +65,18 @@
 
   FX_SAFE_FILESIZE end_offset = offset;
   end_offset += buffer.size();
-  if (!end_offset.IsValid() || end_offset.ValueOrDie() > file_size_)
+  if (!end_offset.IsValid() || end_offset.ValueOrDie() > file_size_) {
     return false;
+  }
 
   if (!IsDataRangeAvailable(offset, buffer.size())) {
     ScheduleDownload(offset, buffer.size());
     return false;
   }
 
-  if (file_read_->ReadBlockAtOffset(buffer, offset))
+  if (file_read_->ReadBlockAtOffset(buffer, offset)) {
     return true;
+  }
 
   read_error_ = true;
   ScheduleDownload(offset, buffer.size());
@@ -87,8 +89,9 @@
 
 void CPDF_ReadValidator::ScheduleDownload(FX_FILESIZE offset, size_t size) {
   has_unavailable_data_ = true;
-  if (!hints_ || size == 0)
+  if (!hints_ || size == 0) {
     return;
+  }
 
   const FX_FILESIZE start_segment_offset = AlignDown(offset);
   FX_SAFE_FILESIZE end_segment_offset = offset;
@@ -131,8 +134,9 @@
 bool CPDF_ReadValidator::CheckDataRangeAndRequestIfUnavailable(
     FX_FILESIZE offset,
     size_t size) {
-  if (offset > file_size_)
+  if (offset > file_size_) {
     return true;
+  }
 
   FX_SAFE_FILESIZE end_segment_offset = offset;
   end_segment_offset += size;
@@ -155,20 +159,23 @@
     return false;
   }
 
-  if (IsDataRangeAvailable(offset, segment_size.ValueOrDie()))
+  if (IsDataRangeAvailable(offset, segment_size.ValueOrDie())) {
     return true;
+  }
 
   ScheduleDownload(offset, segment_size.ValueOrDie());
   return false;
 }
 
 bool CPDF_ReadValidator::CheckWholeFileAndRequestIfUnavailable() {
-  if (IsWholeFileAvailable())
+  if (IsWholeFileAvailable()) {
     return true;
+  }
 
   const FX_SAFE_SIZE_T safe_size = file_size_;
-  if (safe_size.IsValid())
+  if (safe_size.IsValid()) {
     ScheduleDownload(0, safe_size.ValueOrDie());
+  }
 
   return false;
 }
diff --git a/core/fpdfapi/parser/cpdf_reference.cpp b/core/fpdfapi/parser/cpdf_reference.cpp
index fac010c..15ffea9 100644
--- a/core/fpdfapi/parser/cpdf_reference.cpp
+++ b/core/fpdfapi/parser/cpdf_reference.cpp
@@ -63,8 +63,9 @@
 }
 
 const CPDF_Object* CPDF_Reference::FastGetDirect() const {
-  if (!m_pObjList)
+  if (!m_pObjList) {
     return nullptr;
+  }
   const CPDF_Object* obj =
       m_pObjList->GetOrParseIndirectObjectInternal(m_RefObjNum);
   return (obj && !obj->IsReference()) ? obj : nullptr;
diff --git a/core/fpdfapi/parser/cpdf_security_handler.cpp b/core/fpdfapi/parser/cpdf_security_handler.cpp
index ec62240..b67b321 100644
--- a/core/fpdfapi/parser/cpdf_security_handler.cpp
+++ b/core/fpdfapi/parser/cpdf_security_handler.cpp
@@ -189,16 +189,20 @@
 bool CPDF_SecurityHandler::OnInit(const CPDF_Dictionary* pEncryptDict,
                                   RetainPtr<const CPDF_Array> pIdArray,
                                   const ByteString& password) {
-  if (pIdArray)
+  if (pIdArray) {
     m_FileId = pIdArray->GetByteStringAt(0);
-  else
+  } else {
     m_FileId.clear();
-  if (!LoadDict(pEncryptDict))
+  }
+  if (!LoadDict(pEncryptDict)) {
     return false;
-  if (m_Cipher == CPDF_CryptoHandler::Cipher::kNone)
+  }
+  if (m_Cipher == CPDF_CryptoHandler::Cipher::kNone) {
     return true;
-  if (!CheckSecurity(password))
+  }
+  if (!CheckSecurity(password)) {
     return false;
+  }
 
   InitCryptoHandler();
   return true;
@@ -235,16 +239,18 @@
   if (Version >= 4) {
     RetainPtr<const CPDF_Dictionary> pCryptFilters =
         pEncryptDict->GetDictFor("CF");
-    if (!pCryptFilters)
+    if (!pCryptFilters) {
       return false;
+    }
 
     if (name == "Identity") {
       *cipher = CPDF_CryptoHandler::Cipher::kNone;
     } else {
       RetainPtr<const CPDF_Dictionary> pDefFilter =
           pCryptFilters->GetDictFor(name);
-      if (!pDefFilter)
+      if (!pDefFilter) {
         return false;
+      }
 
       int nKeyBits = 0;
       if (Version == 4) {
@@ -255,25 +261,29 @@
       } else {
         nKeyBits = pEncryptDict->GetIntegerFor("Length", 256);
       }
-      if (nKeyBits < 0)
+      if (nKeyBits < 0) {
         return false;
+      }
 
       if (nKeyBits < 40) {
         nKeyBits *= 8;
       }
       keylen = nKeyBits / 8;
       ByteString cipher_name = pDefFilter->GetByteStringFor("CFM");
-      if (cipher_name == "AESV2" || cipher_name == "AESV3")
+      if (cipher_name == "AESV2" || cipher_name == "AESV3") {
         *cipher = CPDF_CryptoHandler::Cipher::kAES;
+      }
     }
   } else {
     keylen = Version > 1 ? pEncryptDict->GetIntegerFor("Length", 40) / 8 : 5;
   }
 
-  if (keylen < 0 || keylen > 32)
+  if (keylen < 0 || keylen > 32) {
     return false;
-  if (!IsValidKeyLengthForCipher(*cipher, keylen))
+  }
+  if (!IsValidKeyLengthForCipher(*cipher, keylen)) {
     return false;
+  }
 
   *keylen_out = keylen;
   return true;
@@ -284,13 +294,15 @@
   m_Version = pEncryptDict->GetIntegerFor("V");
   m_Revision = pEncryptDict->GetIntegerFor("R");
   m_Permissions = pEncryptDict->GetIntegerFor("P", -1);
-  if (m_Version < 4)
+  if (m_Version < 4) {
     return LoadCryptInfo(pEncryptDict, ByteString(), &m_Cipher, &m_KeyLen);
+  }
 
   ByteString stmf_name = pEncryptDict->GetByteStringFor("StmF");
   ByteString strf_name = pEncryptDict->GetByteStringFor("StrF");
-  if (stmf_name != strf_name)
+  if (stmf_name != strf_name) {
     return false;
+  }
 
   return LoadCryptInfo(pEncryptDict, strf_name, &m_Cipher, &m_KeyLen);
 }
@@ -308,11 +320,13 @@
   if (m_Version >= 4) {
     stmf_name = pEncryptDict->GetByteStringFor("StmF");
     strf_name = pEncryptDict->GetByteStringFor("StrF");
-    if (stmf_name != strf_name)
+    if (stmf_name != strf_name) {
       return false;
+    }
   }
-  if (!LoadCryptInfo(pEncryptDict, strf_name, cipher, key_len))
+  if (!LoadCryptInfo(pEncryptDict, strf_name, cipher, key_len)) {
     return false;
+  }
 
   m_Cipher = *cipher;
   m_KeyLen = *key_len;
@@ -325,12 +339,14 @@
   DCHECK(m_Revision >= 5);
 
   ByteString okey = m_pEncryptDict->GetByteStringFor("O");
-  if (okey.GetLength() < 48)
+  if (okey.GetLength() < 48) {
     return false;
+  }
 
   ByteString ukey = m_pEncryptDict->GetByteStringFor("U");
-  if (ukey.GetLength() < 48)
+  if (ukey.GetLength() < 48) {
     return false;
+  }
 
   const uint8_t* pkey = bOwner ? okey.unsigned_str() : ukey.unsigned_str();
   CRYPT_sha2_context sha;
@@ -364,8 +380,9 @@
     CRYPT_SHA256Finish(&sha, digest);
   }
   ByteString ekey = m_pEncryptDict->GetByteStringFor(bOwner ? "OE" : "UE");
-  if (ekey.GetLength() < 32)
+  if (ekey.GetLength() < 32) {
     return false;
+  }
 
   CRYPT_aes_context aes = {};
   CRYPT_AESSetKey(&aes, digest, sizeof(digest));
@@ -375,8 +392,9 @@
   CRYPT_AESSetKey(&aes, m_EncryptKey.data(), m_EncryptKey.size());
   CRYPT_AESSetIV(&aes, iv);
   ByteString perms = m_pEncryptDict->GetByteStringFor("Perms");
-  if (perms.IsEmpty())
+  if (perms.IsEmpty()) {
     return false;
+  }
 
   uint8_t perms_buf[16] = {};
   size_t copy_len =
@@ -384,8 +402,9 @@
   UNSAFE_TODO(FXSYS_memcpy(perms_buf, perms.unsigned_str(), copy_len));
   uint8_t buf[16];
   CRYPT_AESDecrypt(&aes, buf, perms_buf, 16);
-  if (buf[9] != 'a' || buf[10] != 'd' || buf[11] != 'b')
+  if (buf[9] != 'a' || buf[10] != 'd' || buf[11] != 'b') {
     return false;
+  }
 
   if (fxcrt::GetUInt32LSBFirst(pdfium::make_span(buf).first(4u)) !=
       m_Permissions) {
@@ -408,21 +427,24 @@
   }
 
   ByteStringView password_view = password.AsStringView();
-  if (password_view.IsASCII())
+  if (password_view.IsASCII()) {
     return false;
+  }
 
   if (m_Revision >= 5) {
     ByteString utf8_password = WideString::FromLatin1(password_view).ToUTF8();
-    if (!CheckPasswordImpl(utf8_password, bOwner))
+    if (!CheckPasswordImpl(utf8_password, bOwner)) {
       return false;
+    }
 
     m_PasswordEncodingConversion = kLatin1ToUtf8;
     return true;
   }
 
   ByteString latin1_password = WideString::FromUTF8(password_view).ToLatin1();
-  if (!CheckPasswordImpl(latin1_password, bOwner))
+  if (!CheckPasswordImpl(latin1_password, bOwner)) {
     return false;
+  }
 
   m_PasswordEncodingConversion = kUtf8toLatin1;
   return true;
@@ -430,11 +452,13 @@
 
 bool CPDF_SecurityHandler::CheckPasswordImpl(const ByteString& password,
                                              bool bOwner) {
-  if (m_Revision >= 5)
+  if (m_Revision >= 5) {
     return AES256_CheckPassword(password, bOwner);
+  }
 
-  if (bOwner)
+  if (bOwner) {
     return CheckOwnerPassword(password);
+  }
 
   return CheckUserPassword(password, false) ||
          CheckUserPassword(password, true);
@@ -472,8 +496,9 @@
   }
   CRYPT_md5_context md5 = CRYPT_MD5Start();
   CRYPT_MD5Update(&md5, kDefaultPasscode);
-  if (!m_FileId.IsEmpty())
+  if (!m_FileId.IsEmpty()) {
     CRYPT_MD5Update(&md5, m_FileId.unsigned_span());
+  }
   CRYPT_MD5Finish(&md5, pdfium::make_span(ukeybuf).first(16u));
   return UNSAFE_TODO(memcmp(test, ukeybuf, 16)) == 0;
 }
@@ -483,8 +508,9 @@
   static constexpr size_t kRequiredOkeyLength = 32;
   ByteString okey = m_pEncryptDict->GetByteStringFor("O");
   size_t okeylen = std::min<size_t>(okey.GetLength(), kRequiredOkeyLength);
-  if (okeylen < kRequiredOkeyLength)
+  if (okeylen < kRequiredOkeyLength) {
     return ByteString();
+  }
 
   DCHECK_EQ(kRequiredOkeyLength, okeylen);
   uint8_t passcode[32];
@@ -492,8 +518,9 @@
   uint8_t digest[16];
   CRYPT_MD5Generate(passcode, digest);
   if (m_Revision >= 3) {
-    for (uint32_t i = 0; i < 50; i++)
+    for (uint32_t i = 0; i < 50; i++) {
       CRYPT_MD5Generate(digest, digest);
+    }
   }
   uint8_t enckey[32] = {};
   uint8_t okeybuf[32] = {};
@@ -574,8 +601,9 @@
   }
 
   ByteString file_id;
-  if (pIdArray)
+  if (pIdArray) {
     file_id = pIdArray->GetByteStringAt(0);
+  }
 
   CalcEncryptKey(m_pEncryptDict.Get(), password,
                  pdfium::make_span(m_EncryptKey).first(key_len), false,
@@ -591,8 +619,9 @@
   } else {
     CRYPT_md5_context md5 = CRYPT_MD5Start();
     CRYPT_MD5Update(&md5, kDefaultPasscode);
-    if (!file_id.IsEmpty())
+    if (!file_id.IsEmpty()) {
       CRYPT_MD5Update(&md5, file_id.unsigned_span());
+    }
 
     uint8_t digest[32];
     auto partial_digest_span = pdfium::make_span(digest).first<16u>();
diff --git a/core/fpdfapi/parser/cpdf_seekablemultistream.cpp b/core/fpdfapi/parser/cpdf_seekablemultistream.cpp
index d7a0c99..ae2f243 100644
--- a/core/fpdfapi/parser/cpdf_seekablemultistream.cpp
+++ b/core/fpdfapi/parser/cpdf_seekablemultistream.cpp
@@ -28,8 +28,9 @@
 
 FX_FILESIZE CPDF_SeekableMultiStream::GetSize() {
   FX_SAFE_FILESIZE dwSize = 0;
-  for (const auto& acc : m_Data)
+  for (const auto& acc : m_Data) {
     dwSize += acc->GetSize();
+  }
   return dwSize.ValueOrDie();
 }
 
@@ -40,8 +41,9 @@
   while (index < iCount) {
     const auto& acc = m_Data[index];
     FX_FILESIZE dwSize = acc->GetSize();
-    if (offset < dwSize)
+    if (offset < dwSize) {
       break;
+    }
 
     offset -= dwSize;
     index++;
@@ -50,8 +52,9 @@
     auto acc_span = m_Data[index]->GetSpan();
     size_t dwRead = std::min<size_t>(buffer.size(), acc_span.size() - offset);
     buffer = fxcrt::spancpy(buffer, acc_span.subspan(offset, dwRead));
-    if (buffer.empty())
+    if (buffer.empty()) {
       return true;
+    }
 
     offset = 0;
     index++;
diff --git a/core/fpdfapi/parser/cpdf_stream.cpp b/core/fpdfapi/parser/cpdf_stream.cpp
index cf16479..f9f81a8 100644
--- a/core/fpdfapi/parser/cpdf_stream.cpp
+++ b/core/fpdfapi/parser/cpdf_stream.cpp
@@ -157,8 +157,9 @@
   DCHECK(!result.empty());
 
   auto underlying_stream = std::get<RetainPtr<IFX_SeekableReadStream>>(data_);
-  if (!underlying_stream->ReadBlockAtOffset(result, 0))
+  if (!underlying_stream->ReadBlockAtOffset(result, 0)) {
     return DataVector<uint8_t>();
+  }
 
   return result;
 }
@@ -186,14 +187,17 @@
   }
 
   encoder.UpdateLength(data.size());
-  if (!encoder.WriteDictTo(archive, encryptor))
+  if (!encoder.WriteDictTo(archive, encryptor)) {
     return false;
+  }
 
-  if (!archive->WriteString("stream\r\n"))
+  if (!archive->WriteString("stream\r\n")) {
     return false;
+  }
 
-  if (!archive->WriteBlock(data))
+  if (!archive->WriteBlock(data)) {
     return false;
+  }
 
   return archive->WriteString("\r\nendstream");
 }
diff --git a/core/fpdfapi/parser/cpdf_stream_acc.cpp b/core/fpdfapi/parser/cpdf_stream_acc.cpp
index dd24940..7d4a4e5 100644
--- a/core/fpdfapi/parser/cpdf_stream_acc.cpp
+++ b/core/fpdfapi/parser/cpdf_stream_acc.cpp
@@ -30,14 +30,16 @@
     DCHECK(!bImageAcc);
   }
 
-  if (!m_pStream)
+  if (!m_pStream) {
     return;
+  }
 
   bool bProcessRawData = bRawAccess || !m_pStream->HasFilter();
-  if (bProcessRawData)
+  if (bProcessRawData) {
     ProcessRawData();
-  else
+  } else {
     ProcessFilteredData(estimated_size, bImageAcc);
+  }
 }
 
 void CPDF_StreamAcc::LoadAllDataFiltered() {
@@ -74,10 +76,12 @@
 }
 
 pdfium::span<const uint8_t> CPDF_StreamAcc::GetSpan() const {
-  if (is_owned())
+  if (is_owned()) {
     return std::get<DataVector<uint8_t>>(m_Data);
-  if (m_pStream && m_pStream->IsMemoryBased())
+  }
+  if (m_pStream && m_pStream->IsMemoryBased()) {
     return m_pStream->GetInMemoryRawData();
+  }
   return {};
 }
 
@@ -90,8 +94,9 @@
 }
 
 DataVector<uint8_t> CPDF_StreamAcc::DetachData() {
-  if (is_owned())
+  if (is_owned()) {
     return std::move(std::get<DataVector<uint8_t>>(m_Data));
+  }
 
   auto span = std::get<pdfium::raw_span<const uint8_t>>(m_Data);
   return DataVector<uint8_t>(span.begin(), span.end());
@@ -99,8 +104,9 @@
 
 void CPDF_StreamAcc::ProcessRawData() {
   uint32_t dwSrcSize = m_pStream->GetRawSize();
-  if (dwSrcSize == 0)
+  if (dwSrcSize == 0) {
     return;
+  }
 
   if (m_pStream->IsMemoryBased()) {
     m_Data = m_pStream->GetInMemoryRawData();
@@ -108,8 +114,9 @@
   }
 
   DataVector<uint8_t> data = ReadRawStream();
-  if (data.empty())
+  if (data.empty()) {
     return;
+  }
 
   m_Data = std::move(data);
 }
@@ -117,8 +124,9 @@
 void CPDF_StreamAcc::ProcessFilteredData(uint32_t estimated_size,
                                          bool bImageAcc) {
   uint32_t dwSrcSize = m_pStream->GetRawSize();
-  if (dwSrcSize == 0)
+  if (dwSrcSize == 0) {
     return;
+  }
 
   std::variant<pdfium::raw_span<const uint8_t>, DataVector<uint8_t>> src_data;
   pdfium::span<const uint8_t> src_span;
@@ -127,8 +135,9 @@
     src_data = src_span;
   } else {
     DataVector<uint8_t> temp_src_data = ReadRawStream();
-    if (temp_src_data.empty())
+    if (temp_src_data.empty()) {
       return;
+    }
 
     src_span = pdfium::make_span(temp_src_data);
     src_data = std::move(temp_src_data);
diff --git a/core/fpdfapi/parser/cpdf_syntax_parser.cpp b/core/fpdfapi/parser/cpdf_syntax_parser.cpp
index e567dd5..08f5357 100644
--- a/core/fpdfapi/parser/cpdf_syntax_parser.cpp
+++ b/core/fpdfapi/parser/cpdf_syntax_parser.cpp
@@ -60,8 +60,9 @@
     safe_end += buffer.size();
     // Check that requested range is valid, to prevent calling of ReadBlock
     // of original m_pFileRead with incorrect params.
-    if (!safe_end.IsValid() || safe_end.ValueOrDie() > m_PartSize)
+    if (!safe_end.IsValid() || safe_end.ValueOrDie() > m_PartSize) {
       return false;
+    }
 
     return m_pFileRead->ReadBlockAtOffset(buffer, m_PartOffset + offset);
   }
@@ -112,13 +113,15 @@
 }
 
 bool CPDF_SyntaxParser::ReadBlockAt(FX_FILESIZE read_pos) {
-  if (read_pos >= m_FileLen)
+  if (read_pos >= m_FileLen) {
     return false;
+  }
   size_t read_size = m_ReadBufferSize;
   FX_SAFE_FILESIZE safe_end = read_pos;
   safe_end += read_size;
-  if (!safe_end.IsValid() || safe_end.ValueOrDie() > m_FileLen)
+  if (!safe_end.IsValid() || safe_end.ValueOrDie() > m_FileLen) {
     read_size = m_FileLen - read_pos;
+  }
 
   m_pFileBuf.resize(read_size);
   if (!m_pFileAccess->ReadBlockAtOffset(m_pFileBuf, read_pos)) {
@@ -132,11 +135,13 @@
 
 bool CPDF_SyntaxParser::GetNextChar(uint8_t& ch) {
   FX_FILESIZE pos = m_Pos + m_HeaderOffset;
-  if (pos >= m_FileLen)
+  if (pos >= m_FileLen) {
     return false;
+  }
 
-  if (!IsPositionRead(pos) && !ReadBlockAt(pos))
+  if (!IsPositionRead(pos) && !ReadBlockAt(pos)) {
     return false;
+  }
 
   ch = m_pFileBuf[pos - m_BufOffset];
   m_Pos++;
@@ -149,23 +154,27 @@
 
 bool CPDF_SyntaxParser::GetCharAtBackward(FX_FILESIZE pos, uint8_t* ch) {
   pos += m_HeaderOffset;
-  if (pos >= m_FileLen)
+  if (pos >= m_FileLen) {
     return false;
+  }
 
   if (!IsPositionRead(pos)) {
     FX_FILESIZE block_start = 0;
-    if (pos >= CPDF_Stream::kFileBufSize)
+    if (pos >= CPDF_Stream::kFileBufSize) {
       block_start = pos - CPDF_Stream::kFileBufSize + 1;
-    if (!ReadBlockAt(block_start) || !IsPositionRead(pos))
+    }
+    if (!ReadBlockAt(block_start) || !IsPositionRead(pos)) {
       return false;
+    }
   }
   *ch = m_pFileBuf[pos - m_BufOffset];
   return true;
 }
 
 bool CPDF_SyntaxParser::ReadBlock(pdfium::span<uint8_t> buffer) {
-  if (!m_pFileAccess->ReadBlockAtOffset(buffer, m_Pos + m_HeaderOffset))
+  if (!m_pFileAccess->ReadBlockAtOffset(buffer, m_Pos + m_HeaderOffset)) {
     return false;
+  }
   m_Pos += buffer.size();
   return true;
 }
@@ -176,8 +185,9 @@
 
   ToNextWord();
   uint8_t ch;
-  if (!GetNextChar(ch))
+  if (!GetNextChar(ch)) {
     return word_type;
+  }
 
   if (PDFCharIsDelimiter(ch)) {
     word_type = WordType::kWord;
@@ -185,46 +195,55 @@
     m_WordBuffer[m_WordSize++] = ch;
     if (ch == '/') {
       while (true) {
-        if (!GetNextChar(ch))
+        if (!GetNextChar(ch)) {
           return word_type;
+        }
 
         if (!PDFCharIsOther(ch) && !PDFCharIsNumeric(ch)) {
           m_Pos--;
           return word_type;
         }
 
-        if (m_WordSize < sizeof(m_WordBuffer) - 1)
+        if (m_WordSize < sizeof(m_WordBuffer) - 1) {
           m_WordBuffer[m_WordSize++] = ch;
+        }
       }
     } else if (ch == '<') {
-      if (!GetNextChar(ch))
+      if (!GetNextChar(ch)) {
         return word_type;
+      }
 
-      if (ch == '<')
+      if (ch == '<') {
         m_WordBuffer[m_WordSize++] = ch;
-      else
+      } else {
         m_Pos--;
+      }
     } else if (ch == '>') {
-      if (!GetNextChar(ch))
+      if (!GetNextChar(ch)) {
         return word_type;
+      }
 
-      if (ch == '>')
+      if (ch == '>') {
         m_WordBuffer[m_WordSize++] = ch;
-      else
+      } else {
         m_Pos--;
+      }
     }
     return word_type;
   }
 
   while (true) {
-    if (m_WordSize < sizeof(m_WordBuffer) - 1)
+    if (m_WordSize < sizeof(m_WordBuffer) - 1) {
       m_WordBuffer[m_WordSize++] = ch;
+    }
 
-    if (!PDFCharIsNumeric(ch))
+    if (!PDFCharIsNumeric(ch)) {
       word_type = WordType::kWord;
+    }
 
-    if (!GetNextChar(ch))
+    if (!GetNextChar(ch)) {
       return word_type;
+    }
 
     if (PDFCharIsDelimiter(ch) || PDFCharIsWhitespace(ch)) {
       m_Pos--;
@@ -236,8 +255,9 @@
 
 ByteString CPDF_SyntaxParser::ReadString() {
   uint8_t ch;
-  if (!GetNextChar(ch))
+  if (!GetNextChar(ch)) {
     return ByteString();
+  }
 
   ByteString buf;
   int32_t parlevel = 0;
@@ -247,16 +267,18 @@
     switch (status) {
       case ReadStatus::kNormal:
         if (ch == ')') {
-          if (parlevel == 0)
+          if (parlevel == 0) {
             return ByteString(buf);
+          }
           parlevel--;
         } else if (ch == '(') {
           parlevel++;
         }
-        if (ch == '\\')
+        if (ch == '\\') {
           status = ReadStatus::kBackslash;
-        else
+        } else {
           buf += static_cast<char>(ch);
+        }
         break;
       case ReadStatus::kBackslash:
         if (FXSYS_IsOctalDigit(ch)) {
@@ -307,13 +329,15 @@
         break;
       case ReadStatus::kCarriageReturn:
         status = ReadStatus::kNormal;
-        if (ch != '\n')
+        if (ch != '\n') {
           continue;
+        }
         break;
     }
 
-    if (!GetNextChar(ch))
+    if (!GetNextChar(ch)) {
       break;
+    }
   }
 
   GetNextChar(ch);
@@ -330,8 +354,9 @@
   bool bFirst = true;
   uint8_t code = 0;
   while (true) {
-    if (ch == '>')
+    if (ch == '>') {
       break;
+    }
 
     if (FXSYS_IsHexDigit(ch)) {
       int val = FXSYS_HexCharToInt(ch);
@@ -358,13 +383,15 @@
 void CPDF_SyntaxParser::ToNextLine() {
   uint8_t ch;
   while (GetNextChar(ch)) {
-    if (ch == '\n')
+    if (ch == '\n') {
       break;
+    }
 
     if (ch == '\r') {
       GetNextChar(ch);
-      if (ch != '\n')
+      if (ch != '\n') {
         --m_Pos;
+      }
       break;
     }
   }
@@ -377,23 +404,28 @@
   }
 
   uint8_t ch;
-  if (!GetNextChar(ch))
+  if (!GetNextChar(ch)) {
     return;
+  }
 
   while (true) {
     while (PDFCharIsWhitespace(ch)) {
-      if (!GetNextChar(ch))
+      if (!GetNextChar(ch)) {
         return;
+      }
     }
 
-    if (ch != '%')
+    if (ch != '%') {
       break;
+    }
 
     while (true) {
-      if (!GetNextChar(ch))
+      if (!GetNextChar(ch)) {
         return;
-      if (PDFCharIsLineEnding(ch))
+      }
+      if (PDFCharIsLineEnding(ch)) {
         break;
+      }
     }
   }
   m_Pos--;
@@ -418,20 +450,23 @@
   // comment.
   while (true) {
     uint8_t ch;
-    if (!GetNextChar(ch))
+    if (!GetNextChar(ch)) {
       return;
+    }
     switch (eof_state) {
       case EofState::kInitial:
-        if (!PDFCharIsWhitespace(ch))
+        if (!PDFCharIsWhitespace(ch)) {
           eof_state = ch == '%' ? EofState::kPercent : EofState::kNonPercent;
+        }
         break;
       case EofState::kNonPercent:
         break;
       case EofState::kPercent:
-        if (ch == 'E')
+        if (ch == 'E') {
           eof_state = EofState::kE;
-        else if (ch != '%')
+        } else if (ch != '%') {
           eof_state = EofState::kInvalid;
+        }
         break;
       case EofState::kE:
         eof_state = ch == 'O' ? EofState::kO : EofState::kInvalid;
@@ -449,17 +484,20 @@
           }
         }
         // If we now have a \r, that's not followed by a \n, so both are OK.
-        if (ch == '\r' || ch == '\n')
+        if (ch == '\r' || ch == '\n') {
           m_TrailerEnds->push_back(m_Pos);
+        }
         eof_state = EofState::kInvalid;
         break;
       case EofState::kInvalid:
         break;
     }
-    if (PDFCharIsLineEnding(ch))
+    if (PDFCharIsLineEnding(ch)) {
       eof_state = EofState::kInitial;
-    if (eof_state == EofState::kNonPercent)
+    }
+    if (eof_state == EofState::kNonPercent) {
       break;
+    }
   }
   m_Pos--;
 }
@@ -492,8 +530,9 @@
     CPDF_IndirectObjectHolder* pObjList) {
   CPDF_ReadValidator::ScopedSession read_session(GetValidator());
   auto result = GetObjectBodyInternal(pObjList, ParseType::kLoose);
-  if (GetValidator()->has_read_problems())
+  if (GetValidator()->has_read_problems()) {
     return nullptr;
+  }
   return result;
 }
 
@@ -501,38 +540,45 @@
     CPDF_IndirectObjectHolder* pObjList,
     ParseType parse_type) {
   AutoRestorer<int> depth_restorer(&s_CurrentRecursionDepth);
-  if (++s_CurrentRecursionDepth > kParserMaxRecursionDepth)
+  if (++s_CurrentRecursionDepth > kParserMaxRecursionDepth) {
     return nullptr;
+  }
 
   FX_FILESIZE SavedObjPos = m_Pos;
   WordResult word_result = GetNextWord();
   const ByteString& word = word_result.word;
-  if (word.IsEmpty())
+  if (word.IsEmpty()) {
     return nullptr;
+  }
 
   if (word_result.is_number) {
     AutoRestorer<FX_FILESIZE> pos_restorer(&m_Pos);
     WordResult nextword = GetNextWord();
-    if (!nextword.is_number)
+    if (!nextword.is_number) {
       return pdfium::MakeRetain<CPDF_Number>(word.AsStringView());
+    }
 
     WordResult nextword2 = GetNextWord();
-    if (nextword2.word != "R")
+    if (nextword2.word != "R") {
       return pdfium::MakeRetain<CPDF_Number>(word.AsStringView());
+    }
 
     pos_restorer.AbandonRestoration();
     uint32_t refnum = FXSYS_atoui(word.c_str());
-    if (refnum == CPDF_Object::kInvalidObjNum)
+    if (refnum == CPDF_Object::kInvalidObjNum) {
       return nullptr;
+    }
 
     return pdfium::MakeRetain<CPDF_Reference>(pObjList, refnum);
   }
 
-  if (word == "true" || word == "false")
+  if (word == "true" || word == "false") {
     return pdfium::MakeRetain<CPDF_Boolean>(word == "true");
+  }
 
-  if (word == "null")
+  if (word == "null") {
     return pdfium::MakeRetain<CPDF_Null>();
+  }
 
   if (word == "(") {
     return pdfium::MakeRetain<CPDF_String>(m_pPool, ReadString());
@@ -565,29 +611,34 @@
     while (true) {
       WordResult inner_word_result = GetNextWord();
       const ByteString& inner_word = inner_word_result.word;
-      if (inner_word.IsEmpty())
+      if (inner_word.IsEmpty()) {
         return nullptr;
+      }
 
       FX_FILESIZE SavedPos = m_Pos - inner_word.GetLength();
-      if (inner_word == ">>")
+      if (inner_word == ">>") {
         break;
+      }
 
       if (inner_word == "endobj") {
         m_Pos = SavedPos;
         break;
       }
-      if (inner_word[0] != '/')
+      if (inner_word[0] != '/') {
         continue;
+      }
 
       ByteString key = PDF_NameDecode(inner_word.AsStringView());
-      if (key.IsEmpty() && parse_type == ParseType::kLoose)
+      if (key.IsEmpty() && parse_type == ParseType::kLoose) {
         continue;
+      }
 
       RetainPtr<CPDF_Object> pObj =
           GetObjectBodyInternal(pObjList, ParseType::kLoose);
       if (!pObj) {
-        if (parse_type == ParseType::kLoose)
+        if (parse_type == ParseType::kLoose) {
           continue;
+        }
 
         ToNextLine();
         return nullptr;
@@ -601,13 +652,15 @@
     }
 
     AutoRestorer<FX_FILESIZE> pos_restorer(&m_Pos);
-    if (GetNextWord().word != "stream")
+    if (GetNextWord().word != "stream") {
       return pDict;
+    }
     pos_restorer.AbandonRestoration();
     return ReadStream(std::move(pDict));
   }
-  if (word == ">>")
+  if (word == ">>") {
     m_Pos = SavedObjPos;
+  }
 
   return nullptr;
 }
@@ -654,11 +707,13 @@
   GetCharAt(pos, byte1);
   GetCharAt(pos + 1, byte2);
 
-  if (byte1 == '\r' && byte2 == '\n')
+  if (byte1 == '\r' && byte2 == '\n') {
     return 2;
+  }
 
-  if (byte1 == '\r' || byte1 == '\n')
+  if (byte1 == '\r' || byte1 == '\n') {
     return 1;
+  }
 
   return 0;
 }
@@ -668,8 +723,9 @@
   FX_FILESIZE end_offset = FindTag(word);
   while (end_offset >= 0) {
     // Stop searching when word is found.
-    if (IsWholeWord(GetPos() - word.GetLength(), m_FileLen, word, true))
+    if (IsWholeWord(GetPos() - word.GetLength(), m_FileLen, word, true)) {
       return GetPos() - word.GetLength();
+    }
 
     end_offset = FindTag(word);
   }
@@ -726,8 +782,9 @@
   if (len > 0) {
     FX_SAFE_FILESIZE pos = GetPos();
     pos += len;
-    if (!pos.IsValid() || pos.ValueOrDie() >= m_FileLen)
+    if (!pos.IsValid() || pos.ValueOrDie() >= m_FileLen) {
       len = -1;
+    }
   }
 
   RetainPtr<IFX_SeekableReadStream> substream;
@@ -755,8 +812,9 @@
     const size_t zap_length = kEndStreamStr.GetLength() + 1;
     fxcrt::Fill(pdfium::make_span(m_WordBuffer).first(zap_length), 0);
     GetNextWordInternal();
-    if (GetValidator()->has_read_problems())
+    if (GetValidator()->has_read_problems()) {
       return nullptr;
+    }
 
     // Earlier version of PDF specification doesn't require EOL marker before
     // 'endstream' keyword. If keyword 'endstream' follows the bytes in
@@ -774,8 +832,9 @@
     // If len is not available or incorrect, len needs to be calculated
     // by searching the keywords "endstream" or "endobj".
     const FX_FILESIZE streamEndPos = FindStreamEndPos();
-    if (streamEndPos < 0)
+    if (streamEndPos < 0) {
       return nullptr;
+    }
 
     len = streamEndPos - streamStartPos;
     DCHECK_GE(len, 0);
@@ -820,8 +879,9 @@
   // Allow whitespace after endstream and before a newline.
   unsigned char ch = 0;
   while (GetNextChar(ch)) {
-    if (!PDFCharIsWhitespace(ch) || PDFCharIsLineEnding(ch))
+    if (!PDFCharIsWhitespace(ch) || PDFCharIsLineEnding(ch)) {
       break;
+    }
   }
   SetPos(GetPos() - 1);
 
@@ -837,8 +897,9 @@
 }
 
 uint32_t CPDF_SyntaxParser::GetDirectNum() {
-  if (GetNextWordInternal() != WordType::kNumber)
+  if (GetNextWordInternal() != WordType::kNumber) {
     return 0;
+  }
 
   m_WordBuffer[m_WordSize] = 0;
   return FXSYS_atoui(pdfium::as_chars(pdfium::make_span(m_WordBuffer)).data());
@@ -879,18 +940,21 @@
 bool CPDF_SyntaxParser::BackwardsSearchToWord(ByteStringView word,
                                               FX_FILESIZE limit) {
   int32_t taglen = word.GetLength();
-  if (taglen == 0)
+  if (taglen == 0) {
     return false;
+  }
 
   FX_FILESIZE pos = m_Pos;
   int32_t offset = taglen - 1;
   while (true) {
-    if (limit && pos <= m_Pos - limit)
+    if (limit && pos <= m_Pos - limit) {
       return false;
+    }
 
     uint8_t byte;
-    if (!GetCharAtBackward(pos, &byte))
+    if (!GetCharAtBackward(pos, &byte)) {
       return false;
+    }
 
     if (byte == word[offset]) {
       offset--;
@@ -905,8 +969,9 @@
     }
     offset = byte == word[taglen - 1] ? taglen - 2 : taglen - 1;
     pos--;
-    if (pos < 0)
+    if (pos < 0) {
       return false;
+    }
   }
 }
 
diff --git a/core/fpdfapi/parser/fpdf_parser_decode.cpp b/core/fpdfapi/parser/fpdf_parser_decode.cpp
index d4d3487..9286d2c 100644
--- a/core/fpdfapi/parser/fpdf_parser_decode.cpp
+++ b/core/fpdfapi/parser/fpdf_parser_decode.cpp
@@ -38,14 +38,16 @@
 const uint32_t kMaxStreamSize = 20 * 1024 * 1024;
 
 bool CheckFlateDecodeParams(int Colors, int BitsPerComponent, int Columns) {
-  if (Colors < 0 || BitsPerComponent < 0 || Columns < 0)
+  if (Colors < 0 || BitsPerComponent < 0 || Columns < 0) {
     return false;
+  }
 
   FX_SAFE_INT32 check = Columns;
   check *= Colors;
   check *= BitsPerComponent;
-  if (!check.IsValid())
+  if (!check.IsValid()) {
     return false;
+  }
 
   return check.ValueOrDie() <= INT_MAX - 7;
 }
@@ -89,8 +91,9 @@
 
 bool ValidateDecoderPipeline(const CPDF_Array* pDecoders) {
   size_t count = pDecoders->size();
-  if (count == 0)
+  if (count == 0) {
     return true;
+  }
 
   for (size_t i = 0; i < count; ++i) {
     RetainPtr<const CPDF_Object> object = pDecoders->GetDirectObjectAt(i);
@@ -99,16 +102,18 @@
     }
   }
 
-  if (count == 1)
+  if (count == 1) {
     return true;
+  }
 
   // TODO(thestig): Consolidate all the places that use these filter names.
   static const char kValidDecoders[][16] = {
       "FlateDecode",    "Fl",  "LZWDecode",       "LZW", "ASCII85Decode", "A85",
       "ASCIIHexDecode", "AHx", "RunLengthDecode", "RL"};
   for (size_t i = 0; i < count - 1; ++i) {
-    if (!pdfium::Contains(kValidDecoders, pDecoders->GetByteStringAt(i)))
+    if (!pdfium::Contains(kValidDecoders, pDecoders->GetByteStringAt(i))) {
       return false;
+    }
   }
   return true;
 }
@@ -249,8 +254,9 @@
   uint32_t dest_size = 0;
   size_t i = 0;
   while (i < src_span.size()) {
-    if (src_span[i] == 128)
+    if (src_span[i] == 128) {
       break;
+    }
 
     uint32_t old = dest_size;
     if (src_span[i] < 128) {
@@ -276,8 +282,9 @@
   i = 0;
   int dest_count = 0;
   while (i < src_span.size()) {
-    if (src_span[i] == 128)
+    if (src_span[i] == 128) {
       break;
+    }
 
     if (src_span[i] < 128) {
       uint32_t copy_len = src_span[i] + 1;
@@ -321,8 +328,9 @@
     BlackIs1 = !!pParams->GetIntegerFor("BlackIs1");
     Columns = pParams->GetIntegerFor("Columns", 1728);
     Rows = pParams->GetIntegerFor("Rows");
-    if (Rows > USHRT_MAX)
+    if (Rows > USHRT_MAX) {
       Rows = 0;
+    }
   }
   return FaxModule::CreateDecoder(src_span, width, height, K, EndOfLine,
                                   ByteAlign, BlackIs1, Columns, Rows);
@@ -344,8 +352,9 @@
     Colors = pParams->GetIntegerFor("Colors", 1);
     BitsPerComponent = pParams->GetIntegerFor("BitsPerComponent", 8);
     Columns = pParams->GetIntegerFor("Columns", 1);
-    if (!CheckFlateDecodeParams(Colors, BitsPerComponent, Columns))
+    if (!CheckFlateDecodeParams(Colors, BitsPerComponent, Columns)) {
       return nullptr;
+    }
   }
   return FlateModule::CreateDecoder(src_span, width, height, nComps, bpc,
                                     predictor, Colors, BitsPerComponent,
@@ -367,8 +376,9 @@
     Colors = pParams->GetIntegerFor("Colors", 1);
     BitsPerComponent = pParams->GetIntegerFor("BitsPerComponent", 8);
     Columns = pParams->GetIntegerFor("Columns", 1);
-    if (!CheckFlateDecodeParams(Colors, BitsPerComponent, Columns))
+    if (!CheckFlateDecodeParams(Colors, BitsPerComponent, Columns)) {
       return {DataVector<uint8_t>(), FX_INVALID_OFFSET};
+    }
   }
   return FlateModule::FlateOrLZWDecode(use_lzw, src_span, bEarlyChange,
                                        predictor, Colors, BitsPerComponent,
@@ -378,19 +388,22 @@
 std::optional<DecoderArray> GetDecoderArray(
     RetainPtr<const CPDF_Dictionary> pDict) {
   RetainPtr<const CPDF_Object> pFilter = pDict->GetDirectObjectFor("Filter");
-  if (!pFilter)
+  if (!pFilter) {
     return DecoderArray();
+  }
 
-  if (!pFilter->IsArray() && !pFilter->IsName())
+  if (!pFilter->IsArray() && !pFilter->IsName()) {
     return std::nullopt;
+  }
 
   RetainPtr<const CPDF_Object> pParams =
       pDict->GetDirectObjectFor(pdfium::stream::kDecodeParms);
 
   DecoderArray decoder_array;
   if (const CPDF_Array* pDecoders = pFilter->AsArray()) {
-    if (!ValidateDecoderPipeline(pDecoders))
+    if (!ValidateDecoderPipeline(pDecoders)) {
       return std::nullopt;
+    }
 
     RetainPtr<const CPDF_Array> pParamsArray = ToArray(pParams);
     for (size_t i = 0; i < pDecoders->size(); ++i) {
@@ -442,8 +455,9 @@
         ToDictionary(decoder_array[i].second);
     DataVector<uint8_t> new_buf;
     uint32_t bytes_consumed = FX_INVALID_OFFSET;
-    if (decoder == "Crypt")
+    if (decoder == "Crypt") {
       continue;
+    }
     if (decoder == "FlateDecode" || decoder == "Fl") {
       if (bImageAcc && i == nSize - 1) {
         result.image_encoding = "FlateDecode";
@@ -535,8 +549,9 @@
     dest_pos = StripLanguageCodes(dest_buf, result.GetLength());
   } else {
     pdfium::span<wchar_t> dest_buf = result.GetBuffer(span.size());
-    for (size_t i = 0; i < span.size(); ++i)
+    for (size_t i = 0; i < span.size(); ++i) {
       dest_buf[i] = kPDFDocEncoding[span[i]];
+    }
     dest_pos = span.size();
   }
   result.ReleaseBuffer(dest_pos);
@@ -552,18 +567,21 @@
     for (i = 0; i < len; ++i) {
       int code;
       for (code = 0; code < 256; ++code) {
-        if (kPDFDocEncoding[code] == str[i])
+        if (kPDFDocEncoding[code] == str[i]) {
           break;
+        }
       }
-      if (code == 256)
+      if (code == 256) {
         break;
+      }
 
       dest_buf[i] = code;
     }
   }
   result.ReleaseBuffer(i);
-  if (i == len)
+  if (i == len) {
     return result;
+  }
 
   if (len > INT_MAX / 2 - 1) {
     result.ReleaseBuffer(0);
@@ -602,8 +620,9 @@
       result += "\\r";
       continue;
     }
-    if (ch == ')' || ch == '\\' || ch == '(')
+    if (ch == ')' || ch == '\\' || ch == '(') {
       result += '\\';
+    }
     result += static_cast<char>(ch);
   }
   result += ')';
diff --git a/core/fpdfapi/parser/fpdf_parser_utility.cpp b/core/fpdfapi/parser/fpdf_parser_utility.cpp
index 04e998d..635c011 100644
--- a/core/fpdfapi/parser/fpdf_parser_utility.cpp
+++ b/core/fpdfapi/parser/fpdf_parser_utility.cpp
@@ -80,8 +80,9 @@
   static constexpr size_t kBufSize = 4;
   uint8_t buf[kBufSize];
   for (FX_FILESIZE offset = 0; offset <= 1024; ++offset) {
-    if (!pFile->ReadBlockAtOffset(buf, offset))
+    if (!pFile->ReadBlockAtOffset(buf, offset)) {
       return std::nullopt;
+    }
 
     // SAFETY: string literal and `buf` can accommodate 4 byte comparisons.
     if (UNSAFE_BUFFERS(memcmp(buf, "%PDF", 4)) == 0) {
@@ -151,8 +152,9 @@
   DCHECK(pArray);
   DCHECK(pArray->size() >= nCount);
   std::vector<float> ret(nCount);
-  for (size_t i = 0; i < nCount; ++i)
+  for (size_t i = 0; i < nCount; ++i) {
     ret[i] = pArray->GetFloatAt(i);
+  }
   return ret;
 }
 
@@ -163,15 +165,17 @@
 
 bool ValidateDictAllResourcesOfType(const CPDF_Dictionary* dict,
                                     ByteStringView type) {
-  if (!dict)
+  if (!dict) {
     return false;
+  }
 
   CPDF_DictionaryLocker locker(dict);
   for (const auto& it : locker) {
     RetainPtr<const CPDF_Dictionary> entry =
         ToDictionary(it.second->GetDirect());
-    if (!ValidateDictType(entry.Get(), type))
+    if (!ValidateDictType(entry.Get(), type)) {
       return false;
+    }
   }
   return true;
 }
diff --git a/core/fpdfapi/render/charposlist.cpp b/core/fpdfapi/render/charposlist.cpp
index 48229f2..ceb3c17 100644
--- a/core/fpdfapi/render/charposlist.cpp
+++ b/core/fpdfapi/render/charposlist.cpp
@@ -106,14 +106,16 @@
   bool has_to_unicode = !!font->GetFontDict()->GetStreamFor("ToUnicode");
   for (size_t i = 0; i < char_codes.size(); ++i) {
     uint32_t char_code = char_codes[i];
-    if (char_code == static_cast<uint32_t>(-1))
+    if (char_code == static_cast<uint32_t>(-1)) {
       continue;
+    }
 
     bool is_vertical_glyph = false;
     results.emplace_back();
     TextCharPos& text_char_pos = results.back();
-    if (cid_font)
+    if (cid_font) {
       text_char_pos.font_style_ = true;
+    }
     WideString unicode = font->UnicodeFromCharCode(char_code);
     text_char_pos.unicode_ = !unicode.IsEmpty() ? unicode[0] : char_code;
     text_char_pos.glyph_index_ =
@@ -140,10 +142,11 @@
 #endif
     }
 
-    if (!font->IsEmbedded() && !font->IsCIDFont())
+    if (!font->IsEmbedded() && !font->IsCIDFont()) {
       text_char_pos.font_char_width_ = font->GetCharWidthF(char_code);
-    else
+    } else {
       text_char_pos.font_char_width_ = 0;
+    }
 
     text_char_pos.origin_ = CFX_PointF(i > 0 ? char_pos[i - 1] : 0, 0);
     text_char_pos.glyph_adjust_ = false;
@@ -168,8 +171,9 @@
         text_char_pos.glyph_adjust_ = true;
       }
     }
-    if (!cid_font)
+    if (!cid_font) {
       continue;
+    }
 
     uint16_t cid = cid_font->CIDFromCharCode(char_code);
     if (is_vertical_writing) {
diff --git a/core/fpdfapi/render/cpdf_devicebuffer.cpp b/core/fpdfapi/render/cpdf_devicebuffer.cpp
index 0957db6..9882eb5 100644
--- a/core/fpdfapi/render/cpdf_devicebuffer.cpp
+++ b/core/fpdfapi/render/cpdf_devicebuffer.cpp
@@ -48,10 +48,12 @@
           pDevice->GetDeviceCaps(FXDC_PIXEL_WIDTH) * 254 / (horz_size * 10);
       int dpiv =
           pDevice->GetDeviceCaps(FXDC_PIXEL_HEIGHT) * 254 / (vert_size * 10);
-      if (dpih > max_dpi)
+      if (dpih > max_dpi) {
         matrix.Scale(static_cast<float>(max_dpi) / dpih, 1.0f);
-      if (dpiv > max_dpi)
+      }
+      if (dpiv > max_dpi) {
         matrix.Scale(1.0f, static_cast<float>(max_dpi) / dpiv);
+      }
     }
   }
   return matrix;
diff --git a/core/fpdfapi/render/cpdf_docrenderdata.cpp b/core/fpdfapi/render/cpdf_docrenderdata.cpp
index d3b6a95..689233a 100644
--- a/core/fpdfapi/render/cpdf_docrenderdata.cpp
+++ b/core/fpdfapi/render/cpdf_docrenderdata.cpp
@@ -47,8 +47,9 @@
     CPDF_Type3Font* font) {
   CHECK(font);
   auto it = m_Type3FaceMap.find(font);
-  if (it != m_Type3FaceMap.end() && it->second)
+  if (it != m_Type3FaceMap.end() && it->second) {
     return pdfium::WrapRetain(it->second.Get());
+  }
 
   auto cache = pdfium::MakeRetain<CPDF_Type3Cache>(font);
   m_Type3FaceMap[font].Reset(cache.Get());
@@ -70,8 +71,9 @@
 
 #if BUILDFLAG(IS_WIN)
 CFX_PSFontTracker* CPDF_DocRenderData::GetPSFontTracker() {
-  if (!m_PSFontTracker)
+  if (!m_PSFontTracker) {
     m_PSFontTracker = std::make_unique<CFX_PSFontTracker>();
+  }
   return m_PSFontTracker.get();
 }
 #endif
@@ -81,8 +83,9 @@
   std::array<std::unique_ptr<CPDF_Function>, 3> pFuncs;
   const CPDF_Array* pArray = pObj->AsArray();
   if (pArray) {
-    if (pArray->size() < 3)
+    if (pArray->size() < 3) {
       return nullptr;
+    }
 
     for (uint32_t i = 0; i < 3; ++i) {
       pFuncs[2 - i] = CPDF_Function::Load(pArray->GetDirectObjectAt(i));
@@ -92,8 +95,9 @@
     }
   } else {
     pFuncs[0] = CPDF_Function::Load(pObj);
-    if (!pFuncs[0])
+    if (!pFuncs[0]) {
       return nullptr;
+    }
   }
 
   float output[kMaxOutputs];
@@ -119,8 +123,9 @@
         }
         pFuncs[i]->Call(pdfium::span_from_ref(input), output);
         size_t o = FXSYS_roundf(output[0] * 255);
-        if (o != v)
+        if (o != v) {
           bIdentity = false;
+        }
         samples[i][v] = o;
       }
     }
@@ -131,10 +136,12 @@
         pFuncs[0]->Call(pdfium::span_from_ref(input), output);
       }
       size_t o = FXSYS_roundf(output[0] * 255);
-      if (o != v)
+      if (o != v) {
         bIdentity = false;
-      for (auto& channel : samples)
+      }
+      for (auto& channel : samples) {
         channel[v] = o;
+      }
     }
   }
 
diff --git a/core/fpdfapi/render/cpdf_imagerenderer.cpp b/core/fpdfapi/render/cpdf_imagerenderer.cpp
index d26c98c..46b31f2 100644
--- a/core/fpdfapi/render/cpdf_imagerenderer.cpp
+++ b/core/fpdfapi/render/cpdf_imagerenderer.cpp
@@ -67,8 +67,9 @@
 CPDF_ImageRenderer::~CPDF_ImageRenderer() = default;
 
 bool CPDF_ImageRenderer::StartLoadDIBBase() {
-  if (!GetUnitRect().has_value())
+  if (!GetUnitRect().has_value()) {
     return false;
+  }
 
   if (!m_pLoader->Start(
           m_pImageObject, m_pRenderStatus->GetContext()->GetPageCache(),
@@ -84,8 +85,9 @@
 }
 
 bool CPDF_ImageRenderer::StartRenderDIBBase() {
-  if (!m_pLoader->GetBitmap())
+  if (!m_pLoader->GetBitmap()) {
     return false;
+  }
 
   CPDF_GeneralState& state = m_pImageObject->mutable_general_state();
   m_Alpha = state.GetFillAlpha();
@@ -96,11 +98,13 @@
   }
   RetainPtr<const CPDF_Object> pTR = state.GetTR();
   if (pTR) {
-    if (!state.GetTransferFunc())
+    if (!state.GetTransferFunc()) {
       state.SetTransferFunc(m_pRenderStatus->GetTransferFunc(std::move(pTR)));
+    }
 
-    if (state.GetTransferFunc() && !state.GetTransferFunc()->GetIdentity())
+    if (state.GetTransferFunc() && !state.GetTransferFunc()->GetIdentity()) {
       m_pDIBBase = m_pLoader->TranslateImage(state.GetTransferFunc());
+    }
   }
   m_FillArgb = 0;
   m_bPatternColor = false;
@@ -109,21 +113,24 @@
     const CPDF_Color* pColor = m_pImageObject->color_state().GetFillColor();
     if (pColor && pColor->IsPattern()) {
       m_pPattern = pColor->GetPattern();
-      if (m_pPattern)
+      if (m_pPattern) {
         m_bPatternColor = true;
+      }
     }
     m_FillArgb = m_pRenderStatus->GetFillArgb(m_pImageObject);
   } else if (GetRenderOptions().ColorModeIs(CPDF_RenderOptions::kGray)) {
     RetainPtr<CFX_DIBitmap> pClone = m_pDIBBase->Realize();
-    if (!pClone)
+    if (!pClone) {
       return false;
+    }
 
     pClone->ConvertColorScale(0xffffff, 0);
     m_pDIBBase = pClone;
   }
   m_ResampleOptions = FXDIB_ResampleOptions();
-  if (GetRenderOptions().GetOptions().bForceHalftone)
+  if (GetRenderOptions().GetOptions().bForceHalftone) {
     m_ResampleOptions.bHalftone = true;
+  }
 
 #if BUILDFLAG(IS_WIN)
   if (m_pRenderStatus->GetRenderDevice()->GetDeviceType() ==
@@ -132,16 +139,19 @@
   }
 #endif
 
-  if (GetRenderOptions().GetOptions().bNoImageSmooth)
+  if (GetRenderOptions().GetOptions().bNoImageSmooth) {
     m_ResampleOptions.bNoSmoothing = true;
-  else if (m_pImageObject->GetImage()->IsInterpol())
+  } else if (m_pImageObject->GetImage()->IsInterpol()) {
     m_ResampleOptions.bInterpolateBilinear = true;
+  }
 
-  if (m_pLoader->GetMask())
+  if (m_pLoader->GetMask()) {
     return DrawMaskedImage();
+  }
 
-  if (m_bPatternColor)
+  if (m_bPatternColor) {
     return DrawPatternImage();
+  }
 
   if (m_Alpha != 1.0f || !state.HasRef() || !state.GetFillOP() ||
       state.GetOPMode() != 0 || state.GetBlendType() != BlendMode::kNormal ||
@@ -185,12 +195,14 @@
   m_BlendType = BlendMode::kNormal;
   m_mtObj2Device = mtObj2Device;
   RetainPtr<const CPDF_Dictionary> pOC = m_pImageObject->GetImage()->GetOC();
-  if (pOC && !GetRenderOptions().CheckOCGDictVisible(pOC))
+  if (pOC && !GetRenderOptions().CheckOCGDictVisible(pOC)) {
     return false;
+  }
 
   m_ImageMatrix = m_pImageObject->matrix() * mtObj2Device;
-  if (StartLoadDIBBase())
+  if (StartLoadDIBBase()) {
     return true;
+  }
 
   return StartRenderDIBBase();
 }
@@ -318,8 +330,9 @@
 #endif
 
   FX_RECT rect = GetDrawRect();
-  if (rect.IsEmpty())
+  if (rect.IsEmpty()) {
     return false;
+  }
 
   CFX_Matrix new_matrix = GetDrawMatrix(rect);
   CFX_DefaultRenderDevice bitmap_device;
@@ -366,8 +379,9 @@
 #endif
 
   FX_RECT rect = GetDrawRect();
-  if (rect.IsEmpty())
+  if (rect.IsEmpty()) {
     return false;
+  }
 
   CFX_Matrix new_matrix = GetDrawMatrix(rect);
   CFX_DefaultRenderDevice bitmap_device;
@@ -412,8 +426,9 @@
     image_size /= 8;
     image_size *= m_pDIBBase->GetWidth();
     image_size *= m_pDIBBase->GetHeight();
-    if (!image_size.IsValid())
+    if (!image_size.IsValid()) {
       return false;
+    }
 
     if (image_size.ValueOrDie() > kHugeImageSize &&
         !m_ResampleOptions.bHalftone) {
@@ -454,8 +469,9 @@
     }
 
     std::optional<FX_RECT> image_rect = GetUnitRect();
-    if (!image_rect.has_value())
+    if (!image_rect.has_value()) {
       return false;
+    }
 
     FX_RECT clip_box = m_pRenderStatus->GetRenderDevice()->GetClipBox();
     clip_box.Intersect(image_rect.value());
@@ -466,8 +482,9 @@
   }
 
   std::optional<FX_RECT> image_rect = GetUnitRect();
-  if (!image_rect.has_value())
+  if (!image_rect.has_value()) {
     return false;
+  }
 
   int dest_left;
   int dest_top;
@@ -550,8 +567,9 @@
   }
 
   std::optional<FX_RECT> image_rect = GetUnitRect();
-  if (!image_rect.has_value())
+  if (!image_rect.has_value()) {
     return false;
+  }
 
   int left;
   int top;
@@ -585,14 +603,17 @@
 }
 
 bool CPDF_ImageRenderer::ContinueDefault(PauseIndicatorIface* pPause) {
-  if (m_pLoader->Continue(pPause))
+  if (m_pLoader->Continue(pPause)) {
     return true;
+  }
 
-  if (!StartRenderDIBBase())
+  if (!StartRenderDIBBase()) {
     return false;
+  }
 
-  if (m_Mode == Mode::kDefault)
+  if (m_Mode == Mode::kDefault) {
     return false;
+  }
 
   return Continue(pPause);
 }
@@ -604,8 +625,9 @@
 
 #if BUILDFLAG(IS_WIN)
 bool CPDF_ImageRenderer::ContinueTransform(PauseIndicatorIface* pPause) {
-  if (m_pTransformer->Continue(pPause))
+  if (m_pTransformer->Continue(pPause)) {
     return true;
+  }
 
   RetainPtr<CFX_DIBitmap> bitmap = m_pTransformer->DetachBitmap();
   if (!bitmap) {
@@ -632,8 +654,9 @@
 std::optional<FX_RECT> CPDF_ImageRenderer::GetUnitRect() const {
   CFX_FloatRect image_rect_f = m_ImageMatrix.GetUnitRect();
   FX_RECT image_rect = image_rect_f.GetOuterRect();
-  if (!image_rect.Valid())
+  if (!image_rect.Valid()) {
     return std::nullopt;
+  }
   return image_rect;
 }
 
@@ -646,19 +669,23 @@
 
   int dest_width = rect.Width();
   int dest_height = rect.Height();
-  if (IsImageValueTooBig(dest_width) || IsImageValueTooBig(dest_height))
+  if (IsImageValueTooBig(dest_width) || IsImageValueTooBig(dest_height)) {
     return false;
+  }
 
-  if (m_ImageMatrix.a < 0)
+  if (m_ImageMatrix.a < 0) {
     dest_width = -dest_width;
+  }
 
-  if (m_ImageMatrix.d > 0)
+  if (m_ImageMatrix.d > 0) {
     dest_height = -dest_height;
+  }
 
   int dest_left = dest_width > 0 ? rect.left : rect.right;
   int dest_top = dest_height > 0 ? rect.top : rect.bottom;
-  if (IsImageValueTooBig(dest_left) || IsImageValueTooBig(dest_top))
+  if (IsImageValueTooBig(dest_left) || IsImageValueTooBig(dest_top)) {
     return false;
+  }
 
   *left = dest_left;
   *top = dest_top;
diff --git a/core/fpdfapi/render/cpdf_progressiverenderer.cpp b/core/fpdfapi/render/cpdf_progressiverenderer.cpp
index 71676da..c355741 100644
--- a/core/fpdfapi/render/cpdf_progressiverenderer.cpp
+++ b/core/fpdfapi/render/cpdf_progressiverenderer.cpp
@@ -54,8 +54,9 @@
       m_LastObjectRendered = m_pCurrentLayer->GetObjectHolder()->end();
       m_pRenderStatus =
           std::make_unique<CPDF_RenderStatus>(m_pContext, m_pDevice);
-      if (m_pOptions)
+      if (m_pOptions) {
         m_pRenderStatus->SetOptions(*m_pOptions);
+      }
       m_pRenderStatus->SetTransparency(
           m_pCurrentLayer->GetObjectHolder()->GetTransparency());
       m_pRenderStatus->Initialize(nullptr, nullptr);
@@ -102,20 +103,23 @@
           m_pContext->GetPageCache()->CacheOptimization(
               m_pRenderStatus->GetRenderOptions().GetCacheSizeLimit());
         }
-        if (pCurObj->IsForm() || pCurObj->IsShading())
+        if (pCurObj->IsForm() || pCurObj->IsShading()) {
           nObjsToGo = 0;
-        else
+        } else {
           --nObjsToGo;
+        }
       }
       m_LastObjectRendered = iter;
       if (nObjsToGo == 0) {
-        if (pPause && pPause->NeedToPauseNow())
+        if (pPause && pPause->NeedToPauseNow()) {
           return;
+        }
         nObjsToGo = kStepLimit;
       }
       ++iter;
-      if (is_mask && iter != iterEnd)
+      if (is_mask && iter != iterEnd) {
         return;
+      }
     }
     if (m_pCurrentLayer->GetObjectHolder()->GetParseState() ==
         CPDF_PageObjectHolder::ParseState::kParsed) {
@@ -123,8 +127,9 @@
       m_pDevice->RestoreState(false);
       m_pCurrentLayer = nullptr;
       m_LayerIndex++;
-      if (is_mask || (pPause && pPause->NeedToPauseNow()))
+      if (is_mask || (pPause && pPause->NeedToPauseNow())) {
         return;
+      }
     } else if (is_mask) {
       return;
     } else {
diff --git a/core/fpdfapi/render/cpdf_rendercontext.cpp b/core/fpdfapi/render/cpdf_rendercontext.cpp
index 5368135..630b5cd 100644
--- a/core/fpdfapi/render/cpdf_rendercontext.cpp
+++ b/core/fpdfapi/render/cpdf_rendercontext.cpp
@@ -66,8 +66,9 @@
   for (auto& layer : m_Layers) {
     CFX_RenderDevice::StateRestorer restorer(pDevice);
     CPDF_RenderStatus status(this, pDevice);
-    if (pOptions)
+    if (pOptions) {
       status.SetOptions(*pOptions);
+    }
     status.SetStopObject(pStopObj);
     status.SetTransparency(layer.GetObjectHolder()->GetTransparency());
     CFX_Matrix final_matrix = layer.GetMatrix();
@@ -81,8 +82,9 @@
       m_pPageCache->CacheOptimization(
           status.GetRenderOptions().GetCacheSizeLimit());
     }
-    if (status.IsStopped())
+    if (status.IsStopped()) {
       break;
+    }
   }
 }
 
diff --git a/core/fpdfapi/render/cpdf_renderoptions.cpp b/core/fpdfapi/render/cpdf_renderoptions.cpp
index c53d418..cfb2b0d 100644
--- a/core/fpdfapi/render/cpdf_renderoptions.cpp
+++ b/core/fpdfapi/render/cpdf_renderoptions.cpp
@@ -31,10 +31,12 @@
 CPDF_RenderOptions::~CPDF_RenderOptions() = default;
 
 FX_ARGB CPDF_RenderOptions::TranslateColor(FX_ARGB argb) const {
-  if (ColorModeIs(kNormal))
+  if (ColorModeIs(kNormal)) {
     return argb;
-  if (ColorModeIs(kAlpha))
+  }
+  if (ColorModeIs(kAlpha)) {
     return argb;
+  }
 
   const FX_BGRA_STRUCT<uint8_t> bgra = ArgbToBGRAStruct(argb);
   const int gray = FXRGB2GRAY(bgra.red, bgra.green, bgra.blue);
diff --git a/core/fpdfapi/render/cpdf_rendershading.cpp b/core/fpdfapi/render/cpdf_rendershading.cpp
index 545caf9..4b3961f 100644
--- a/core/fpdfapi/render/cpdf_rendershading.cpp
+++ b/core/fpdfapi/render/cpdf_rendershading.cpp
@@ -48,8 +48,9 @@
     const std::vector<std::unique_ptr<CPDF_Function>>& funcs) {
   FX_SAFE_UINT32 total = 0;
   for (const auto& func : funcs) {
-    if (func)
+    if (func) {
       total += func->OutputCount();
+    }
   }
   return total.ValueOrDefault(0);
 }
@@ -77,12 +78,14 @@
     float input = diff * i / kShadingSteps + t_min;
     pdfium::span<float> result_span = pdfium::make_span(result_array);
     for (const auto& func : funcs) {
-      if (!func)
+      if (!func) {
         continue;
+      }
       std::optional<uint32_t> nresults =
           func->Call(pdfium::span_from_ref(input), result_span);
-      if (nresults.has_value())
+      if (nresults.has_value()) {
         result_span = result_span.subspan(nresults.value());
+      }
     }
     auto rgb = pCS->GetRGBOrZerosOnError(result_array);
     shading_steps[i] =
@@ -101,12 +104,14 @@
   DCHECK_EQ(pBitmap->GetFormat(), FXDIB_Format::kBgra);
 
   const uint32_t total_results = GetValidatedOutputsCount(funcs, pCS);
-  if (total_results == 0)
+  if (total_results == 0) {
     return;
+  }
 
   RetainPtr<const CPDF_Array> pCoords = pDict->GetArrayFor("Coords");
-  if (!pCoords)
+  if (!pCoords) {
     return;
+  }
 
   float start_x = pCoords->GetFloatAt(0);
   float start_y = pCoords->GetFloatAt(1);
@@ -169,12 +174,14 @@
   DCHECK_EQ(pBitmap->GetFormat(), FXDIB_Format::kBgra);
 
   const uint32_t total_results = GetValidatedOutputsCount(funcs, pCS);
-  if (total_results == 0)
+  if (total_results == 0) {
     return;
+  }
 
   RetainPtr<const CPDF_Array> pCoords = pDict->GetArrayFor("Coords");
-  if (!pCoords)
+  if (!pCoords) {
     return;
+  }
 
   float start_x = pCoords->GetFloatAt(0);
   float start_y = pCoords->GetFloatAt(1);
@@ -231,8 +238,9 @@
         float root = sqrt(b2_4ac);
         float s1 = (-b - root) / (2 * a);
         float s2 = (-b + root) / (2 * a);
-        if (a <= 0)
+        if (a <= 0) {
           std::swap(s1, s2);
+        }
         if (bDecreasing) {
           s = (s1 >= 0 || bStartExtend) ? s1 : s2;
         } else {
@@ -268,8 +276,9 @@
   DCHECK_EQ(pBitmap->GetFormat(), FXDIB_Format::kBgra);
 
   const uint32_t total_results = GetValidatedOutputsCount(funcs, pCS);
-  if (total_results == 0)
+  if (total_results == 0) {
     return;
+  }
 
   RetainPtr<const CPDF_Array> pDomain = pDict->GetArrayFor("Domain");
   float xmin = 0.0f;
@@ -296,17 +305,20 @@
     for (int column = 0; column < width; column++) {
       CFX_PointF pos = matrix.Transform(
           CFX_PointF(static_cast<float>(column), static_cast<float>(row)));
-      if (pos.x < xmin || pos.x > xmax || pos.y < ymin || pos.y > ymax)
+      if (pos.x < xmin || pos.x > xmax || pos.y < ymin || pos.y > ymax) {
         continue;
+      }
 
       float input[2] = {pos.x, pos.y};
       pdfium::span<float> result_span = pdfium::make_span(result_array);
       for (const auto& func : funcs) {
-        if (!func)
+        if (!func) {
           continue;
+        }
         std::optional<uint32_t> nresults = func->Call(input, result_span);
-        if (nresults.has_value())
+        if (nresults.has_value()) {
           result_span = result_span.subspan(nresults.value());
+        }
       }
       auto rgb = pCS->GetRGBOrZerosOnError(result_array);
       dib_buf[column] = ArgbEncode(alpha, static_cast<int32_t>(rgb.red * 255),
@@ -320,12 +332,14 @@
                           const CFX_PointF& first,
                           const CFX_PointF& second,
                           float* x) {
-  if (first.y == second.y)
+  if (first.y == second.y) {
     return false;
+  }
 
   if (first.y < second.y) {
-    if (y < first.y || y > second.y)
+    if (y < first.y || y > second.y) {
       return false;
+    }
   } else if (y < second.y || y > first.y) {
     return false;
   }
@@ -342,13 +356,15 @@
     min_y = std::min(min_y, triangle[i].position.y);
     max_y = std::max(max_y, triangle[i].position.y);
   }
-  if (min_y == max_y)
+  if (min_y == max_y) {
     return;
+  }
 
   int min_yi = std::max(static_cast<int>(floorf(min_y)), 0);
   int max_yi = static_cast<int>(ceilf(max_y));
-  if (max_yi >= pBitmap->GetHeight())
+  if (max_yi >= pBitmap->GetHeight()) {
     max_yi = pBitmap->GetHeight() - 1;
+  }
 
   for (int y = min_yi; y <= max_yi; y++) {
     int nIntersects = 0;
@@ -363,8 +379,9 @@
       const CFX_PointF& position2 = vertex2.position;
       bool bIntersect =
           GetScanlineIntersect(y, position1, position2, &inter_x[nIntersects]);
-      if (!bIntersect)
+      if (!bIntersect) {
         continue;
+      }
 
       float y_dist = (y - position1.y) / (position2.y - position1.y);
       r[nIntersects] =
@@ -375,8 +392,9 @@
           vertex1.rgb.blue + ((vertex2.rgb.blue - vertex1.rgb.blue) * y_dist);
       nIntersects++;
     }
-    if (nIntersects != 2)
+    if (nIntersects != 2) {
       continue;
+    }
 
     int min_x;
     int max_x;
@@ -431,26 +449,30 @@
 
   CPDF_MeshStream stream(kFreeFormGouraudTriangleMeshShading, funcs,
                          std::move(pShadingStream), std::move(pCS));
-  if (!stream.Load())
+  if (!stream.Load()) {
     return;
+  }
 
   std::array<CPDF_MeshVertex, 3> triangle;
   while (!stream.IsEOF()) {
     CPDF_MeshVertex vertex;
     uint32_t flag;
-    if (!stream.ReadVertex(mtObject2Bitmap, &vertex, &flag))
+    if (!stream.ReadVertex(mtObject2Bitmap, &vertex, &flag)) {
       return;
+    }
 
     if (flag == 0) {
       triangle[0] = vertex;
       for (int i = 1; i < 3; ++i) {
         uint32_t dummy_flag;
-        if (!stream.ReadVertex(mtObject2Bitmap, &triangle[i], &dummy_flag))
+        if (!stream.ReadVertex(mtObject2Bitmap, &triangle[i], &dummy_flag)) {
           return;
+        }
       }
     } else {
-      if (flag == 1)
+      if (flag == 1) {
         triangle[0] = triangle[1];
+      }
 
       triangle[1] = triangle[2];
       triangle[2] = vertex;
@@ -469,24 +491,28 @@
   DCHECK_EQ(pBitmap->GetFormat(), FXDIB_Format::kBgra);
 
   int row_verts = pShadingStream->GetDict()->GetIntegerFor("VerticesPerRow");
-  if (row_verts < 2)
+  if (row_verts < 2) {
     return;
+  }
 
   CPDF_MeshStream stream(kLatticeFormGouraudTriangleMeshShading, funcs,
                          std::move(pShadingStream), std::move(pCS));
-  if (!stream.Load())
+  if (!stream.Load()) {
     return;
+  }
 
   std::array<std::vector<CPDF_MeshVertex>, 2> vertices;
   vertices[0] = stream.ReadVertexRow(mtObject2Bitmap, row_verts);
-  if (vertices[0].empty())
+  if (vertices[0].empty()) {
     return;
+  }
 
   int last_index = 0;
   while (true) {
     vertices[1 - last_index] = stream.ReadVertexRow(mtObject2Bitmap, row_verts);
-    if (vertices[1 - last_index].empty())
+    if (vertices[1 - last_index].empty()) {
       return;
+    }
 
     CPDF_MeshVertex triangle[3];
     for (int i = 1; i < row_verts; ++i) {
@@ -597,8 +623,9 @@
     std::array<float, kPointsCount> points_y;
     x.GetPoints(points_x);
     y.GetPoints(points_y);
-    for (size_t i = 0; i < kPointsCount; ++i)
+    for (size_t i = 0; i < kPointsCount; ++i) {
       path_points[i].point_ = {points_x[i], points_y[i]};
+    }
   }
 
   void GetPointsReverse(pdfium::span<CFX_Path::Point> path_points) const {
@@ -626,8 +653,9 @@
   p *= delta1;
   p /= delta2;
   p += p1;
-  if (!p.IsValid())
+  if (!p.IsValid()) {
     *overflow = true;
+  }
   return p.ValueOrDefault(0);
 }
 
@@ -802,8 +830,9 @@
 
   CPDF_MeshStream stream(type, funcs, std::move(pShadingStream),
                          std::move(pCS));
-  if (!stream.Load())
+  if (!stream.Load()) {
     return;
+  }
 
   PatchDrawer patch;
   patch.alpha = alpha;
@@ -819,8 +848,9 @@
   std::array<CFX_PointF, 16> coords;
   int point_count = type == kTensorProductPatchMeshShading ? 16 : 12;
   while (!stream.IsEOF()) {
-    if (!stream.CanReadFlag())
+    if (!stream.CanReadFlag()) {
       break;
+    }
     uint32_t flag = stream.ReadFlag();
     int iStartPoint = 0;
     int iStartColor = 0;
@@ -840,14 +870,16 @@
       fxcrt::Copy(tempColors, patch.patch_colors);
     }
     for (i = iStartPoint; i < point_count; i++) {
-      if (!stream.CanReadCoords())
+      if (!stream.CanReadCoords()) {
         break;
+      }
       coords[i] = mtObject2Bitmap.Transform(stream.ReadCoords());
     }
 
     for (i = iStartColor; i < 4; i++) {
-      if (!stream.CanReadColor())
+      if (!stream.CanReadColor()) {
         break;
+      }
 
       FX_RGB_STRUCT<float> rgb = stream.ReadColor();
       patch.patch_colors[i].comp[0] = static_cast<int32_t>(rgb.red * 255);
@@ -889,8 +921,9 @@
                               int alpha,
                               const CPDF_RenderOptions& options) {
   RetainPtr<CPDF_ColorSpace> pColorSpace = pPattern->GetCS();
-  if (!pColorSpace)
+  if (!pColorSpace) {
     return;
+  }
 
   FX_ARGB background = 0;
   RetainPtr<const CPDF_Dictionary> pDict =
diff --git a/core/fpdfapi/render/cpdf_renderstatus.cpp b/core/fpdfapi/render/cpdf_renderstatus.cpp
index a9608b8..60f69b2 100644
--- a/core/fpdfapi/render/cpdf_renderstatus.cpp
+++ b/core/fpdfapi/render/cpdf_renderstatus.cpp
@@ -130,8 +130,9 @@
 }
 
 FXDIB_Format GetFormatForLuminosity(bool is_luminosity) {
-  if (!is_luminosity)
+  if (!is_luminosity) {
     return FXDIB_Format::k8bppMask;
+  }
 #if BUILDFLAG(IS_APPLE)
   return FXDIB_Format::kBgrx;
 #else
@@ -143,11 +144,13 @@
 }
 
 bool IsAvailableMatrix(const CFX_Matrix& matrix) {
-  if (matrix.a == 0 || matrix.d == 0)
+  if (matrix.a == 0 || matrix.d == 0) {
     return matrix.b != 0 && matrix.c != 0;
+  }
 
-  if (matrix.b == 0 || matrix.c == 0)
+  if (matrix.b == 0 || matrix.c == 0) {
     return matrix.a != 0 && matrix.d != 0;
+  }
 
   return true;
 }
@@ -226,8 +229,9 @@
       continue;
     }
     RenderSingleObject(pCurObj.get(), mtObj2Device);
-    if (m_bStopped)
+    if (m_bStopped) {
       return;
+    }
   }
 }
 
@@ -252,22 +256,26 @@
                                              const CFX_Matrix& mtObj2Device,
                                              PauseIndicatorIface* pPause) {
   if (m_pImageRenderer) {
-    if (m_pImageRenderer->Continue(pPause))
+    if (m_pImageRenderer->Continue(pPause)) {
       return true;
+    }
 
-    if (!m_pImageRenderer->GetResult())
+    if (!m_pImageRenderer->GetResult()) {
       DrawObjWithBackground(pObj, mtObj2Device);
+    }
     m_pImageRenderer.reset();
     return false;
   }
 
   m_pCurObj = pObj;
-  if (!m_Options.CheckPageObjectVisible(pObj))
+  if (!m_Options.CheckPageObjectVisible(pObj)) {
     return false;
+  }
 
   ProcessClipPath(pObj->clip_path(), mtObj2Device);
-  if (ProcessTransparency(pObj, mtObj2Device))
+  if (ProcessTransparency(pObj, mtObj2Device)) {
     return false;
+  }
 
   if (!pObj->IsImage()) {
     ProcessObjectNoClip(pObj, mtObj2Device);
@@ -277,8 +285,9 @@
   m_pImageRenderer = std::make_unique<CPDF_ImageRenderer>(this);
   if (!m_pImageRenderer->Start(pObj->AsImage(), mtObj2Device,
                                /*bStdCS=*/false)) {
-    if (!m_pImageRenderer->GetResult())
+    if (!m_pImageRenderer->GetResult()) {
       DrawObjWithBackground(pObj, mtObj2Device);
+    }
     m_pImageRenderer.reset();
     return false;
   }
@@ -313,8 +322,9 @@
       bRet = ProcessForm(pObj->AsForm(), mtObj2Device);
       break;
   }
-  if (!bRet)
+  if (!bRet) {
     DrawObjWithBackground(pObj, mtObj2Device);
+  }
 }
 
 bool CPDF_RenderStatus::DrawObjWithBlend(CPDF_PageObject* pObj,
@@ -335,8 +345,9 @@
 void CPDF_RenderStatus::DrawObjWithBackground(CPDF_PageObject* pObj,
                                               const CFX_Matrix& mtObj2Device) {
   FX_RECT rect = GetObjectClippedRect(pObj, mtObj2Device);
-  if (rect.IsEmpty())
+  if (rect.IsEmpty()) {
     return;
+  }
 
   const bool needs_buffer =
       !(m_pDevice->GetDeviceCaps(FXDC_RENDER_CAPS) & FXRC_GET_BITS);
@@ -386,8 +397,9 @@
                                     const CFX_Matrix& mtObj2Device) {
   RetainPtr<const CPDF_Dictionary> pOC =
       pFormObj->form()->GetDict()->GetDictFor("OC");
-  if (pOC && !m_Options.CheckOCGDictVisible(pOC.Get()))
+  if (pOC && !m_Options.CheckOCGDictVisible(pOC.Get())) {
     return true;
+  }
 
   CFX_Matrix matrix = pFormObj->form_matrix() * mtObj2Device;
   RetainPtr<const CPDF_Dictionary> pResources =
@@ -413,8 +425,9 @@
   CFX_FillRenderOptions::FillType fill_type = path_obj->filltype();
   bool stroke = path_obj->stroke();
   ProcessPathPattern(path_obj, mtObj2Device, &fill_type, &stroke);
-  if (fill_type == CFX_FillRenderOptions::FillType::kNoFill && !stroke)
+  if (fill_type == CFX_FillRenderOptions::FillType::kNoFill && !stroke) {
     return true;
+  }
 
   // If the option to convert fill paths to stroke is enabled for forced color,
   // set |fill_type| to FillType::kNoFill and |stroke| to true.
@@ -459,12 +472,14 @@
 
 FX_ARGB CPDF_RenderStatus::GetFillArgbForType3(CPDF_PageObject* pObj) const {
   const CPDF_ColorState* pColorState = &pObj->color_state();
-  if (MissingFillColor(pColorState))
+  if (MissingFillColor(pColorState)) {
     pColorState = &m_InitialStates.color_state();
+  }
 
   FX_COLORREF colorref = pColorState->GetFillColorRef();
-  if (colorref == 0xFFFFFFFF)
+  if (colorref == 0xFFFFFFFF) {
     return 0;
+  }
 
   int32_t alpha =
       static_cast<int32_t>((pObj->general_state().GetFillAlpha() * 255));
@@ -485,15 +500,18 @@
 
 FX_ARGB CPDF_RenderStatus::GetStrokeArgb(CPDF_PageObject* pObj) const {
   const CPDF_ColorState* pColorState = &pObj->color_state();
-  if (Type3CharMissingStrokeColor(m_pType3Char, pColorState))
+  if (Type3CharMissingStrokeColor(m_pType3Char, pColorState)) {
     return m_T3FillColor;
+  }
 
-  if (MissingStrokeColor(pColorState))
+  if (MissingStrokeColor(pColorState)) {
     pColorState = &m_InitialStates.color_state();
+  }
 
   FX_COLORREF colorref = pColorState->GetStrokeColorRef();
-  if (colorref == 0xFFFFFFFF)
+  if (colorref == 0xFFFFFFFF) {
     return 0;
+  }
 
   int32_t alpha = static_cast<int32_t>(pObj->general_state().GetStrokeAlpha() *
                                        255);  // not rounded.
@@ -521,15 +539,17 @@
     }
     return;
   }
-  if (m_LastClipPath == ClipPath)
+  if (m_LastClipPath == ClipPath) {
     return;
+  }
 
   m_LastClipPath = ClipPath;
   m_pDevice->RestoreState(true);
   for (size_t i = 0; i < ClipPath.GetPathCount(); ++i) {
     const CFX_Path* pPath = ClipPath.GetPath(i).GetObject();
-    if (!pPath)
+    if (!pPath) {
       continue;
+    }
 
     if (pPath->GetPoints().empty()) {
       CFX_Path empty_path;
@@ -543,8 +563,9 @@
     }
   }
 
-  if (ClipPath.GetTextCount() == 0)
+  if (ClipPath.GetTextCount() == 0) {
     return;
+  }
 
   if (!IsPrint() &&
       !(m_pDevice->GetDeviceCaps(FXDC_RENDER_CAPS) & FXRC_SOFT_CLIP)) {
@@ -555,14 +576,16 @@
   for (size_t i = 0; i < ClipPath.GetTextCount(); ++i) {
     CPDF_TextObject* pText = ClipPath.GetText(i);
     if (pText) {
-      if (!pTextClippingPath)
+      if (!pTextClippingPath) {
         pTextClippingPath = std::make_unique<CFX_Path>();
+      }
       ProcessText(pText, mtObj2Device, pTextClippingPath.get());
       continue;
     }
 
-    if (!pTextClippingPath)
+    if (!pTextClippingPath) {
       continue;
+    }
 
     CFX_FillRenderOptions fill_options(CFX_FillRenderOptions::WindingOptions());
     if (m_Options.GetOptions().bNoTextSmooth) {
@@ -576,8 +599,9 @@
 bool CPDF_RenderStatus::ClipPattern(const CPDF_PageObject* page_obj,
                                     const CFX_Matrix& mtObj2Device,
                                     bool stroke) {
-  if (page_obj->IsPath())
+  if (page_obj->IsPath()) {
     return SelectClipPath(page_obj->AsPath(), mtObj2Device, stroke);
+  }
   if (page_obj->IsImage()) {
     m_pDevice->SetClip_Rect(page_obj->GetTransformedBBox(mtObj2Device));
     return true;
@@ -642,8 +666,9 @@
 #endif
   FX_RECT rect = pPageObj->GetTransformedBBox(mtObj2Device);
   rect.Intersect(m_pDevice->GetClipBox());
-  if (rect.IsEmpty())
+  if (rect.IsEmpty()) {
     return true;
+  }
 
   const int width = rect.Width();
   const int height = rect.Height();
@@ -652,8 +677,9 @@
   if (!transparency.IsIsolated() &&
       (m_pDevice->GetRenderCaps() & FXRC_GET_BITS)) {
     backdrop = pdfium::MakeRetain<CFX_DIBitmap>();
-    if (!m_pDevice->CreateCompatibleBitmap(backdrop, width, height))
+    if (!m_pDevice->CreateCompatibleBitmap(backdrop, width, height)) {
       return true;
+    }
     m_pDevice->GetDIBits(backdrop, rect.left, rect.top);
   }
   if (!bitmap_device.CreateWithBackdrop(
@@ -675,8 +701,9 @@
     text_device.Attach(text_mask_bitmap);
     for (size_t i = 0; i < pPageObj->clip_path().GetTextCount(); ++i) {
       CPDF_TextObject* textobj = pPageObj->clip_path().GetText(i);
-      if (!textobj)
+      if (!textobj) {
         break;
+      }
 
       // TODO(thestig): Should we check the return value here?
       CPDF_TextRenderer::DrawTextPath(
@@ -770,8 +797,9 @@
 std::unique_ptr<CPDF_GraphicStates> CPDF_RenderStatus::CloneObjStates(
     const CPDF_GraphicStates* pSrcStates,
     bool stroke) {
-  if (!pSrcStates)
+  if (!pSrcStates) {
     return nullptr;
+  }
 
   auto pStates = std::make_unique<CPDF_GraphicStates>(*pSrcStates);
   const CPDF_Color* pObjColor = stroke
@@ -790,17 +818,20 @@
 bool CPDF_RenderStatus::ProcessText(CPDF_TextObject* textobj,
                                     const CFX_Matrix& mtObj2Device,
                                     CFX_Path* clipping_path) {
-  if (textobj->GetCharCodes().empty())
+  if (textobj->GetCharCodes().empty()) {
     return true;
+  }
 
   const TextRenderingMode text_render_mode =
       textobj->text_state().GetTextMode();
-  if (text_render_mode == TextRenderingMode::MODE_INVISIBLE)
+  if (text_render_mode == TextRenderingMode::MODE_INVISIBLE) {
     return true;
+  }
 
   RetainPtr<CPDF_Font> pFont = textobj->text_state().GetFont();
-  if (pFont->IsType3Font())
+  if (pFont->IsType3Font()) {
     return ProcessType3Text(textobj, mtObj2Device);
+  }
 
   bool is_fill = false;
   bool is_stroke = false;
@@ -815,16 +846,18 @@
         break;
       case TextRenderingMode::MODE_STROKE:
       case TextRenderingMode::MODE_STROKE_CLIP:
-        if (pFont->HasFace())
+        if (pFont->HasFace()) {
           is_stroke = true;
-        else
+        } else {
           is_fill = true;
+        }
         break;
       case TextRenderingMode::MODE_FILL_STROKE:
       case TextRenderingMode::MODE_FILL_STROKE_CLIP:
         is_fill = true;
-        if (pFont->HasFace())
+        if (pFont->HasFace()) {
           is_stroke = true;
+        }
         break;
       case TextRenderingMode::MODE_INVISIBLE:
         // Already handled above, but the compiler is not smart enough to
@@ -854,8 +887,9 @@
     }
   }
   CFX_Matrix text_matrix = textobj->GetTextMatrix();
-  if (!IsAvailableMatrix(text_matrix))
+  if (!IsAvailableMatrix(text_matrix)) {
     return true;
+  }
 
   float font_size = textobj->text_state().GetFontSize();
   if (bPattern) {
@@ -893,8 +927,9 @@
 bool CPDF_RenderStatus::ProcessType3Text(CPDF_TextObject* textobj,
                                          const CFX_Matrix& mtObj2Device) {
   CPDF_Type3Font* pType3Font = textobj->text_state().GetFont()->AsType3Font();
-  if (pdfium::Contains(m_Type3FontCache, pType3Font))
+  if (pdfium::Contains(m_Type3FontCache, pType3Font)) {
     return true;
+  }
 
   FX_ARGB fill_argb = GetFillArgbForType3(textobj);
   int fill_alpha = FXARGB_A(fill_argb);
@@ -918,12 +953,14 @@
 
   for (size_t iChar = 0; iChar < textobj->GetCharCodes().size(); ++iChar) {
     uint32_t charcode = textobj->GetCharCodes()[iChar];
-    if (charcode == static_cast<uint32_t>(-1))
+    if (charcode == static_cast<uint32_t>(-1)) {
       continue;
+    }
 
     CPDF_Type3Char* pType3Char = pType3Font->LoadChar(charcode);
-    if (!pType3Char)
+    if (!pType3Char) {
       continue;
+    }
 
     CFX_Matrix matrix = char_matrix;
     matrix.e += iChar > 0 ? textobj->GetCharPositions()[iChar - 1] : 0;
@@ -938,8 +975,9 @@
           }
 
           std::optional<CFX_Point> point = glyph.GetOrigin({0, 0});
-          if (!point.has_value())
+          if (!point.has_value()) {
             continue;
+          }
 
           m_pDevice->SetBitMask(glyph.glyph_->GetBitmap(), point->x, point->y,
                                 fill_argb);
@@ -974,8 +1012,9 @@
       } else {
         FX_RECT rect =
             matrix.TransformRect(pForm->CalcBoundingBox()).GetOuterRect();
-        if (!rect.Valid())
+        if (!rect.Valid()) {
           continue;
+        }
 
         CFX_DefaultRenderDevice bitmap_device;
         // TODO(crbug.com/42271020): Consider adding support for
@@ -1048,8 +1087,9 @@
     }
   }
 
-  if (glyphs.empty())
+  if (glyphs.empty()) {
     return true;
+  }
 
   FX_RECT rect = GetGlyphsBBox(glyphs, 0);
   auto bitmap = pdfium::MakeRetain<CFX_DIBitmap>();
@@ -1063,8 +1103,9 @@
     }
 
     std::optional<CFX_Point> point = glyph.GetOrigin({rect.left, rect.top});
-    if (!point.has_value())
+    if (!point.has_value()) {
       continue;
+    }
 
     bitmap->CompositeMask(
         point->x, point->y, glyph.glyph_->GetBitmap()->GetWidth(),
@@ -1108,8 +1149,9 @@
                      : pFont->GetFontFallback(charpos.fallback_font_position_);
     const CFX_Path* pPath =
         font->LoadGlyphPath(charpos.glyph_index_, charpos.font_char_width_);
-    if (!pPath)
+    if (!pPath) {
       continue;
+    }
 
     CPDF_PathObject path;
     path.mutable_graph_state() = textobj->graph_state();
@@ -1131,16 +1173,19 @@
                                            const CPDF_PageObject* pPageObj,
                                            const CFX_Matrix& mtObj2Device,
                                            bool stroke) {
-  if (!pattern->Load())
+  if (!pattern->Load()) {
     return;
+  }
 
   CFX_RenderDevice::StateRestorer restorer(m_pDevice);
-  if (!ClipPattern(pPageObj, mtObj2Device, stroke))
+  if (!ClipPattern(pPageObj, mtObj2Device, stroke)) {
     return;
+  }
 
   FX_RECT rect = GetObjectClippedRect(pPageObj, mtObj2Device);
-  if (rect.IsEmpty())
+  if (rect.IsEmpty()) {
     return;
+  }
 
   CFX_Matrix matrix = pattern->pattern_to_form() * mtObj2Device;
   int alpha =
@@ -1153,8 +1198,9 @@
 void CPDF_RenderStatus::ProcessShading(const CPDF_ShadingObject* pShadingObj,
                                        const CFX_Matrix& mtObj2Device) {
   FX_RECT rect = GetObjectClippedRect(pShadingObj, mtObj2Device);
-  if (rect.IsEmpty())
+  if (rect.IsEmpty()) {
     return;
+  }
 
   CFX_Matrix matrix = pShadingObj->matrix() * mtObj2Device;
   CPDF_RenderShading::Draw(
@@ -1168,16 +1214,19 @@
                                           const CFX_Matrix& mtObj2Device,
                                           bool stroke) {
   const std::unique_ptr<CPDF_Form> pPatternForm = pattern->Load(pPageObj);
-  if (!pPatternForm)
+  if (!pPatternForm) {
     return;
+  }
 
   CFX_RenderDevice::StateRestorer restorer(m_pDevice);
-  if (!ClipPattern(pPageObj, mtObj2Device, stroke))
+  if (!ClipPattern(pPageObj, mtObj2Device, stroke)) {
     return;
+  }
 
   FX_RECT clip_box = m_pDevice->GetClipBox();
-  if (clip_box.IsEmpty())
+  if (clip_box.IsEmpty()) {
     return;
+  }
 
   RetainPtr<CFX_DIBitmap> screen =
       CPDF_RenderTiling::Draw(this, pPageObj, pattern, pPatternForm.get(),
@@ -1196,13 +1245,16 @@
                                             const CPDF_Color* pColor,
                                             bool stroke) {
   RetainPtr<CPDF_Pattern> pattern = pColor->GetPattern();
-  if (!pattern)
+  if (!pattern) {
     return;
+  }
 
-  if (CPDF_TilingPattern* pTilingPattern = pattern->AsTilingPattern())
+  if (CPDF_TilingPattern* pTilingPattern = pattern->AsTilingPattern()) {
     DrawTilingPattern(pTilingPattern, path_obj, mtObj2Device, stroke);
-  else if (CPDF_ShadingPattern* pShadingPattern = pattern->AsShadingPattern())
+  } else if (CPDF_ShadingPattern* pShadingPattern =
+                 pattern->AsShadingPattern()) {
     DrawShadingPattern(pShadingPattern, path_obj, mtObj2Device, stroke);
+  }
 }
 
 void CPDF_RenderStatus::ProcessPathPattern(
@@ -1299,8 +1351,9 @@
     RetainPtr<CFX_DIBitmap> pClone;
     if (m_pDevice->GetBackDrop() && m_pDevice->GetBitmap()) {
       pClone = m_pDevice->GetBackDrop()->ClipTo(rect);
-      if (!pClone)
+      if (!pClone) {
         return;
+      }
 
       pClone->CompositeBitmap(0, 0, pClone->GetWidth(), pClone->GetHeight(),
                               m_pDevice->GetBitmap(), rect.left, rect.top,
@@ -1373,14 +1426,16 @@
     const CFX_Matrix& smask_matrix) {
   RetainPtr<CPDF_Stream> pGroup =
       smask_dict->GetMutableStreamFor(pdfium::transparency::kG);
-  if (!pGroup)
+  if (!pGroup) {
     return nullptr;
+  }
 
   std::unique_ptr<CPDF_Function> pFunc;
   RetainPtr<const CPDF_Object> pFuncObj =
       smask_dict->GetDirectObjectFor(pdfium::transparency::kTR);
-  if (pFuncObj && (pFuncObj->IsDictionary() || pFuncObj->IsStream()))
+  if (pFuncObj && (pFuncObj->IsDictionary() || pFuncObj->IsStream())) {
     pFunc = CPDF_Function::Load(std::move(pFuncObj));
+  }
 
   CFX_Matrix matrix = smask_matrix;
   matrix.Translate(-clip_rect.left, -clip_rect.top);
@@ -1476,19 +1531,22 @@
   static constexpr FX_ARGB kDefaultColor = ArgbEncode(255, 0, 0, 0);
   RetainPtr<const CPDF_Array> pBC =
       pSMaskDict->GetArrayFor(pdfium::transparency::kBC);
-  if (!pBC)
+  if (!pBC) {
     return kDefaultColor;
+  }
 
   RetainPtr<const CPDF_Object> pCSObj;
   RetainPtr<const CPDF_Dictionary> pGroup =
       pGroupDict ? pGroupDict->GetDictFor("Group") : nullptr;
-  if (pGroup)
+  if (pGroup) {
     pCSObj = pGroup->GetDirectObjectFor(pdfium::transparency::kCS);
+  }
   RetainPtr<CPDF_ColorSpace> pCS =
       CPDF_DocPageData::FromDocument(m_pContext->GetDocument())
           ->GetColorSpace(pCSObj.Get(), nullptr);
-  if (!pCS)
+  if (!pCS) {
     return kDefaultColor;
+  }
 
   CPDF_ColorSpace::Family family = pCS->GetFamily();
   if (family == CPDF_ColorSpace::Family::kLab || pCS->IsSpecial() ||
diff --git a/core/fpdfapi/render/cpdf_rendertiling.cpp b/core/fpdfapi/render/cpdf_rendertiling.cpp
index 82577a9..94d71aa 100644
--- a/core/fpdfapi/render/cpdf_rendertiling.cpp
+++ b/core/fpdfapi/render/cpdf_rendertiling.cpp
@@ -53,8 +53,9 @@
 
   CFX_Matrix mtPattern2Bitmap = mtObject2Device * mtAdjust;
   CPDF_RenderOptions options;
-  if (!pPattern->colored())
+  if (!pPattern->colored()) {
     options.SetColorMode(CPDF_RenderOptions::kAlpha);
+  }
 
   options.GetOptions() = draw_options;
   options.GetOptions().bForceHalftone = true;
@@ -93,10 +94,12 @@
 
   int width = static_cast<int>(ceil_width);
   int height = static_cast<int>(ceil_height);
-  if (width <= 0)
+  if (width <= 0) {
     width = 1;
-  if (height <= 0)
+  }
+  if (height <= 0) {
     height = 1;
+  }
 
   CFX_FloatRect clip_box_p =
       mtPattern2Device.GetInverse().TransformRect(CFX_FloatRect(clip_box));
@@ -110,8 +113,9 @@
       floor((clip_box_p.top - pPattern->bbox().bottom) / pPattern->y_step()));
 
   // Make sure we can fit the needed width * height into an int.
-  if (height > std::numeric_limits<int>::max() / width)
+  if (height > std::numeric_limits<int>::max() / width) {
     return nullptr;
+  }
 
   CFX_RenderDevice* pDevice = pRenderStatus->GetRenderDevice();
   CPDF_RenderContext* pContext = pRenderStatus->GetContext();
@@ -125,7 +129,8 @@
     } else if (pPageObj->AsPath()) {
       pStates = std::make_unique<CPDF_GraphicStates>();
       pStates->SetDefaultStates();
-      pStates->mutable_general_state().SetFillAlpha(pPageObj->general_state().GetFillAlpha());
+      pStates->mutable_general_state().SetFillAlpha(
+          pPageObj->general_state().GetFillAlpha());
     }
 
     RetainPtr<const CPDF_Dictionary> pFormResource =
@@ -159,20 +164,24 @@
     int orig_x = FXSYS_roundf(mtPattern2Device.e);
     int orig_y = FXSYS_roundf(mtPattern2Device.f);
     min_col = (clip_box.left - orig_x) / width;
-    if (clip_box.left < orig_x)
+    if (clip_box.left < orig_x) {
       min_col--;
+    }
 
     max_col = (clip_box.right - orig_x) / width;
-    if (clip_box.right <= orig_x)
+    if (clip_box.right <= orig_x) {
       max_col--;
+    }
 
     min_row = (clip_box.top - orig_y) / height;
-    if (clip_box.top < orig_y)
+    if (clip_box.top < orig_y) {
       min_row--;
+    }
 
     max_row = (clip_box.bottom - orig_y) / height;
-    if (clip_box.bottom <= orig_y)
+    if (clip_box.bottom <= orig_y) {
       max_row--;
+    }
   }
   float left_offset = cell_bbox.left - mtPattern2Device.e;
   float top_offset = cell_bbox.bottom - mtPattern2Device.f;
@@ -188,11 +197,13 @@
         pContext->GetDocument(), pContext->GetPageCache(), pPattern,
         pPatternForm, mtObj2Device, width, height, options.GetOptions());
   }
-  if (!pPatternBitmap)
+  if (!pPatternBitmap) {
     return nullptr;
+  }
 
-  if (options.ColorModeIs(CPDF_RenderOptions::kGray))
+  if (options.ColorModeIs(CPDF_RenderOptions::kGray)) {
     pPatternBitmap->ConvertColorScale(0, 0xffffff);
+  }
 
   FX_ARGB fill_argb = pRenderStatus->GetFillArgb(pPageObj);
   int clip_width = clip_box.right - clip_box.left;
@@ -221,8 +232,9 @@
 
         safeStartX -= clip_box.left;
         safeStartY -= clip_box.top;
-        if (!safeStartX.IsValid() || !safeStartY.IsValid())
+        if (!safeStartX.IsValid() || !safeStartY.IsValid()) {
           return nullptr;
+        }
 
         start_x = safeStartX.ValueOrDie();
         start_y = safeStartY.ValueOrDie();
diff --git a/core/fpdfapi/render/cpdf_scaledrenderbuffer.cpp b/core/fpdfapi/render/cpdf_scaledrenderbuffer.cpp
index f64a315..8840d9a 100644
--- a/core/fpdfapi/render/cpdf_scaledrenderbuffer.cpp
+++ b/core/fpdfapi/render/cpdf_scaledrenderbuffer.cpp
@@ -45,8 +45,9 @@
     static constexpr uint32_t kNoPitch = 0;
     std::optional<CFX_DIBitmap::PitchAndSize> pitch_size =
         CFX_DIBitmap::CalculatePitchAndSize(width, height, dibFormat, kNoPitch);
-    if (!pitch_size.has_value())
+    if (!pitch_size.has_value()) {
       return false;
+    }
 
     if (pitch_size.value().size <= kImageSizeLimitBytes &&
         bitmap_device_->Create(width, height, dibFormat)) {
diff --git a/core/fpdfapi/render/cpdf_textrenderer.cpp b/core/fpdfapi/render/cpdf_textrenderer.cpp
index 058ce77..34a84d7 100644
--- a/core/fpdfapi/render/cpdf_textrenderer.cpp
+++ b/core/fpdfapi/render/cpdf_textrenderer.cpp
@@ -30,16 +30,19 @@
     const CPDF_RenderOptions& options) {
   CFX_TextRenderOptions text_options;
 
-  if (pFont->IsCIDFont())
+  if (pFont->IsCIDFont()) {
     text_options.font_is_cid = true;
+  }
 
-  if (options.GetOptions().bNoTextSmooth)
+  if (options.GetOptions().bNoTextSmooth) {
     text_options.aliasing_type = CFX_TextRenderOptions::kAliasing;
-  else if (options.GetOptions().bClearType)
+  } else if (options.GetOptions().bClearType) {
     text_options.aliasing_type = CFX_TextRenderOptions::kLcd;
+  }
 
-  if (options.GetOptions().bNoNativeText)
+  if (options.GetOptions().bNoNativeText) {
     text_options.native_text = false;
+  }
 
   return text_options;
 }
@@ -62,16 +65,18 @@
     const CFX_FillRenderOptions& fill_options) {
   std::vector<TextCharPos> pos =
       GetCharPosList(char_codes, char_pos, pFont, font_size);
-  if (pos.empty())
+  if (pos.empty()) {
     return true;
+  }
 
   bool bDraw = true;
   int32_t fontPosition = pos[0].fallback_font_position_;
   size_t startIndex = 0;
   for (size_t i = 0; i < pos.size(); ++i) {
     int32_t curFontPosition = pos[i].fallback_font_position_;
-    if (fontPosition == curFontPosition)
+    if (fontPosition == curFontPosition) {
       continue;
+    }
 
     CFX_Font* font = GetFont(pFont, fontPosition);
     if (!pDevice->DrawTextPath(
@@ -103,12 +108,14 @@
                                        const ByteString& str,
                                        FX_ARGB fill_argb,
                                        const CPDF_RenderOptions& options) {
-  if (pFont->IsType3Font())
+  if (pFont->IsType3Font()) {
     return;
+  }
 
   size_t nChars = pFont->CountChar(str.AsStringView());
-  if (nChars == 0)
+  if (nChars == 0) {
     return;
+  }
 
   size_t offset = 0;
   std::vector<uint32_t> codes;
@@ -118,8 +125,9 @@
   float cur_pos = 0;
   for (size_t i = 0; i < nChars; i++) {
     codes[i] = pFont->GetNextChar(str.AsStringView(), &offset);
-    if (i)
+    if (i) {
       positions[i - 1] = cur_pos;
+    }
     cur_pos += pFont->GetCharWidthF(codes[i]) * font_size / 1000;
   }
   CFX_Matrix new_matrix = matrix;
@@ -140,8 +148,9 @@
                                        const CPDF_RenderOptions& options) {
   std::vector<TextCharPos> pos =
       GetCharPosList(char_codes, char_pos, pFont, font_size);
-  if (pos.empty())
+  if (pos.empty()) {
     return true;
+  }
 
   CFX_TextRenderOptions text_options =
       GetTextRenderOptionsHelper(pFont, options);
@@ -150,8 +159,9 @@
   size_t startIndex = 0;
   for (size_t i = 0; i < pos.size(); ++i) {
     int32_t curFontPosition = pos[i].fallback_font_position_;
-    if (fontPosition == curFontPosition)
+    if (fontPosition == curFontPosition) {
       continue;
+    }
 
     CFX_Font* font = GetFont(pFont, fontPosition);
     if (!pDevice->DrawNormalText(
diff --git a/core/fpdfapi/render/cpdf_type3cache.cpp b/core/fpdfapi/render/cpdf_type3cache.cpp
index b75aaea..12d9bfa 100644
--- a/core/fpdfapi/render/cpdf_type3cache.cpp
+++ b/core/fpdfapi/render/cpdf_type3cache.cpp
@@ -44,10 +44,12 @@
 }
 
 bool IsScanLineBpp(int bpp, const uint8_t* pBuf, int width) {
-  if (bpp == 1)
+  if (bpp == 1) {
     return IsScanLine1bpp(pBuf, width);
-  if (bpp > 8)
+  }
+  if (bpp > 8) {
     width *= bpp / 8;
+  }
   return IsScanLine8bpp(pBuf, width);
 }
 
@@ -57,8 +59,9 @@
   const int bpp = pBitmap->GetBPP();
   for (int line = 0; line < height; ++line) {
     const uint8_t* pBuf = pBitmap->GetScanline(line).data();
-    if (IsScanLineBpp(bpp, pBuf, width))
+    if (IsScanLineBpp(bpp, pBuf, width)) {
       return line;
+    }
   }
   return -1;
 }
@@ -69,8 +72,9 @@
   const int width = pBitmap->GetWidth();
   for (int line = height - 1; line >= 0; --line) {
     const uint8_t* pBuf = pBitmap->GetScanline(line).data();
-    if (IsScanLineBpp(bpp, pBuf, width))
+    if (IsScanLineBpp(bpp, pBuf, width)) {
       return line;
+    }
   }
   return -1;
 }
@@ -99,8 +103,9 @@
     pSizeCache = it->second.get();
   }
   const CFX_GlyphBitmap* pExisting = pSizeCache->GetBitmap(charcode);
-  if (pExisting)
+  if (pExisting) {
     return pExisting;
+  }
 
   std::unique_ptr<CFX_GlyphBitmap> pNewBitmap =
       RenderGlyph(pSizeCache, charcode, mtMatrix);
@@ -114,12 +119,14 @@
     uint32_t charcode,
     const CFX_Matrix& mtMatrix) {
   CPDF_Type3Char* pChar = m_pFont->LoadChar(charcode);
-  if (!pChar)
+  if (!pChar) {
     return nullptr;
+  }
 
   RetainPtr<CFX_DIBitmap> pBitmap = pChar->GetBitmap();
-  if (!pBitmap)
+  if (!pBitmap) {
     return nullptr;
+  }
 
   CFX_Matrix text_matrix(mtMatrix.a, mtMatrix.b, mtMatrix.c, mtMatrix.d, 0, 0);
   CFX_Matrix image_matrix = pChar->matrix() * text_matrix;
@@ -135,28 +142,33 @@
       float top_y = image_matrix.d + image_matrix.f;
       float bottom_y = image_matrix.f;
       bool bFlipped = top_y > bottom_y;
-      if (bFlipped)
+      if (bFlipped) {
         std::swap(top_y, bottom_y);
+      }
       std::tie(top_line, bottom_line) = pSize->AdjustBlue(top_y, bottom_y);
       FX_SAFE_INT32 safe_height = bFlipped ? top_line : bottom_line;
       safe_height -= bFlipped ? bottom_line : top_line;
-      if (!safe_height.IsValid())
+      if (!safe_height.IsValid()) {
         return nullptr;
+      }
 
       pResBitmap = pBitmap->StretchTo(static_cast<int>(image_matrix.a),
                                       safe_height.ValueOrDie(),
                                       FXDIB_ResampleOptions(), nullptr);
       top = top_line;
-      if (image_matrix.a < 0)
+      if (image_matrix.a < 0) {
         left = FXSYS_roundf(image_matrix.e + image_matrix.a);
-      else
+      } else {
         left = FXSYS_roundf(image_matrix.e);
+      }
     }
   }
-  if (!pResBitmap)
+  if (!pResBitmap) {
     pResBitmap = pBitmap->TransformTo(image_matrix, &left, &top);
-  if (!pResBitmap)
+  }
+  if (!pResBitmap) {
     return nullptr;
+  }
 
   auto pGlyph = std::make_unique<CFX_GlyphBitmap>(left, -top);
   pGlyph->GetBitmap()->TakeOver(std::move(pResBitmap));
diff --git a/core/fpdfapi/render/cpdf_type3glyphmap.cpp b/core/fpdfapi/render/cpdf_type3glyphmap.cpp
index 54120ba..8f541f8 100644
--- a/core/fpdfapi/render/cpdf_type3glyphmap.cpp
+++ b/core/fpdfapi/render/cpdf_type3glyphmap.cpp
@@ -29,11 +29,13 @@
       closest_pos = i;
     }
   }
-  if (closest_pos >= 0)
+  if (closest_pos >= 0) {
     return blues->at(closest_pos);
+  }
   int new_pos = FXSYS_roundf(pos);
-  if (blues->size() < kType3MaxBlues)
+  if (blues->size() < kType3MaxBlues) {
     blues->push_back(new_pos);
+  }
   return new_pos;
 }