Clang-format //testing

Change-Id: I27360f1264aefc45286e07242f30f1882aeca2ba
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/130753
Reviewed-by: Tom Sepez <tsepez@chromium.org>
Commit-Queue: Lei Zhang <thestig@chromium.org>
diff --git a/testing/command_line_helpers.cpp b/testing/command_line_helpers.cpp
index ea10998..eb2e3ec 100644
--- a/testing/command_line_helpers.cpp
+++ b/testing/command_line_helpers.cpp
@@ -7,8 +7,9 @@
 bool ParseSwitchKeyValue(const std::string& arg,
                          const std::string& key,
                          std::string* value) {
-  if (arg.size() <= key.size() || arg.compare(0, key.size(), key) != 0)
+  if (arg.size() <= key.size() || arg.compare(0, key.size(), key) != 0) {
     return false;
+  }
 
   *value = arg.substr(key.size());
   return true;
diff --git a/testing/embedder_test.cpp b/testing/embedder_test.cpp
index 3206b6b..b7b23d5 100644
--- a/testing/embedder_test.cpp
+++ b/testing/embedder_test.cpp
@@ -287,8 +287,9 @@
   // possible. This can fail when an DCHECK test fails in a test case.
   EXPECT_EQ(0U, page_map_.size());
   EXPECT_EQ(0U, saved_page_map_.size());
-  if (document())
+  if (document()) {
     CloseDocument();
+  }
 }
 
 void EmbedderTest::CreateEmptyDocument() {
@@ -376,13 +377,15 @@
       nRet = FPDFAvail_IsDocAvail(avail_ptr,
                                   network_simulator->GetDownloadHints());
     }
-    if (nRet == PDF_DATA_ERROR)
+    if (nRet == PDF_DATA_ERROR) {
       return false;
+    }
 
     document->reset(FPDFAvail_GetDocument(avail_ptr, password));
     document_ptr = document->get();
-    if (!document_ptr)
+    if (!document_ptr) {
       return false;
+    }
 
     nRet = PDF_DATA_NOTAVAIL;
     while (nRet == PDF_DATA_NOTAVAIL) {
@@ -390,8 +393,9 @@
       nRet = FPDFAvail_IsFormAvail(avail_ptr,
                                    network_simulator->GetDownloadHints());
     }
-    if (nRet == PDF_FORM_ERROR)
+    if (nRet == PDF_FORM_ERROR) {
       return false;
+    }
 
     int page_count = FPDF_GetPageCount(document_ptr);
     for (int i = 0; i < page_count; ++i) {
@@ -401,24 +405,28 @@
         nRet = FPDFAvail_IsPageAvail(avail_ptr, i,
                                      network_simulator->GetDownloadHints());
       }
-      if (nRet == PDF_DATA_ERROR)
+      if (nRet == PDF_DATA_ERROR) {
         return false;
+      }
     }
   } else {
-    if (linearize_option == LinearizeOption::kMustLinearize)
+    if (linearize_option == LinearizeOption::kMustLinearize) {
       return false;
+    }
     network_simulator->SetWholeFileAvailable();
     document->reset(
         FPDF_LoadCustomDocument(network_simulator->GetFileAccess(), password));
     document_ptr = document->get();
-    if (!document_ptr)
+    if (!document_ptr) {
       return false;
+    }
   }
   form_handle->reset(SetupFormFillEnvironment(document_ptr, javascript_option));
 
   int doc_type = FPDF_GetFormType(document_ptr);
-  if (doc_type == FORMTYPE_XFA_FULL || doc_type == FORMTYPE_XFA_FOREGROUND)
+  if (doc_type == FORMTYPE_XFA_FULL || doc_type == FORMTYPE_XFA_FOREGROUND) {
     FPDF_LoadXFA(document_ptr);
+  }
 
   return true;
 }
@@ -480,8 +488,9 @@
   formfillinfo->FFI_DoURIActionWithKeyboardModifier =
       DoURIActionWithKeyboardModifierTrampoline;
 
-  if (javascript_option == JavaScriptOption::kEnableJavaScript)
+  if (javascript_option == JavaScriptOption::kEnableJavaScript) {
     formfillinfo->m_pJsPlatform = platform;
+  }
 
   FPDF_FORMHANDLE form_handle =
       FPDFDOC_InitFormFillEnvironment(doc, formfillinfo);
@@ -504,9 +513,10 @@
 
 int EmbedderTest::GetPageCount() {
   int page_count = FPDF_GetPageCount(document());
-  for (int i = 0; i < page_count; ++i)
+  for (int i = 0; i < page_count; ++i) {
     (void)FPDFAvail_IsPageAvail(avail(), i,
                                 fake_file_access_->GetDownloadHints());
+  }
   return page_count;
 }
 
@@ -529,8 +539,9 @@
   CHECK(!pdfium::Contains(page_map_, page_index));
 
   FPDF_PAGE page = FPDF_LoadPage(document(), page_index);
-  if (!page)
+  if (!page) {
     return nullptr;
+  }
 
   if (do_events) {
     FORM_OnAfterLoadPage(page, form_handle());
@@ -643,8 +654,9 @@
   // This comes from Emf::InitFromData() in Chromium.
   HENHMETAFILE emf = SetEnhMetaFileBits(
       pdfium::checked_cast<UINT>(emf_data.size()), emf_data.data());
-  if (!emf)
+  if (!emf) {
     return std::string();
+  }
 
   // This comes from Emf::Enumerator::Enumerator() in Chromium.
   std::vector<const ENHMETARECORD*> records;
@@ -656,8 +668,9 @@
   // This comes from PostScriptMetaFile::SafePlayback() in Chromium.
   std::string ps_data;
   for (const auto* record : records) {
-    if (record->iType != EMR_GDICOMMENT)
+    if (record->iType != EMR_GDICOMMENT) {
       continue;
+    }
 
     // PostScript data is encapsulated inside EMF comment records.
     // The first two bytes of the comment indicate the string length. The rest
@@ -717,8 +730,9 @@
   CHECK(!pdfium::Contains(saved_page_map_, page_index));
 
   FPDF_PAGE page = FPDF_LoadPage(saved_document(), page_index);
-  if (!page)
+  if (!page) {
     return nullptr;
+  }
 
   FORM_OnAfterLoadPage(page, saved_form_handle());
   FORM_DoPageAAction(page, saved_form_handle(), FPDFPAGE_AACTION_OPEN);
@@ -791,8 +805,9 @@
                         static_cast<size_t>(stride) * height);
 
   CRYPT_md5_context context = CRYPT_MD5Start();
-  for (int i = 0; i < height; ++i)
+  for (int i = 0; i < height; ++i) {
     CRYPT_MD5Update(&context, span.subspan(i * stride, usable_bytes_per_row));
+  }
   uint8_t digest[16];
   CRYPT_MD5Finish(&context, digest);
   return CryptToBase16(digest);
@@ -818,8 +833,9 @@
       (expected_width * GetBitmapBytesPerPixel(bitmap) * 8 + 31) / 32 * 4;
   ASSERT_EQ(expected_stride, FPDFBitmap_GetStride(bitmap));
 
-  if (!expected_md5sum)
+  if (!expected_md5sum) {
     return;
+  }
 
   std::string actual_md5sum = HashBitmap(bitmap);
   EXPECT_EQ(expected_md5sum, actual_md5sum);
@@ -836,8 +852,9 @@
 
   pThis->data_string_.append(static_cast<const char*>(data), size);
 
-  if (pThis->filestream_.is_open())
+  if (pThis->filestream_.is_open()) {
     pThis->filestream_.write(static_cast<const char*>(data), size);
+  }
 
   return 1;
 }
diff --git a/testing/embedder_test_environment.cpp b/testing/embedder_test_environment.cpp
index c167877..5ebfb84 100644
--- a/testing/embedder_test_environment.cpp
+++ b/testing/embedder_test_environment.cpp
@@ -65,8 +65,9 @@
 }
 
 void EmbedderTestEnvironment::AddFlags(int argc, char** argv) {
-  for (int i = 1; i < argc; ++i)
+  for (int i = 1; i < argc; ++i) {
     AddFlag(argv[i]);
+  }
 }
 
 void EmbedderTestEnvironment::AddFlag(const std::string& flag) {
diff --git a/testing/fake_file_access.cpp b/testing/fake_file_access.cpp
index 2d72b41..aec4791 100644
--- a/testing/fake_file_access.cpp
+++ b/testing/fake_file_access.cpp
@@ -104,11 +104,13 @@
 int FakeFileAccess::GetBlock(unsigned long position,
                              unsigned char* pBuf,
                              unsigned long size) {
-  if (!pBuf || !size)
+  if (!pBuf || !size) {
     return false;
+  }
 
-  if (!IsDataAvail(static_cast<size_t>(position), static_cast<size_t>(size)))
+  if (!IsDataAvail(static_cast<size_t>(position), static_cast<size_t>(size))) {
     return false;
+  }
 
   return file_access_->m_GetBlock(file_access_->m_Param, position, pBuf, size);
 }
diff --git a/testing/fuzzers/pdf_bidi_fuzzer.cc b/testing/fuzzers/pdf_bidi_fuzzer.cc
index 6990324..cb0053a 100644
--- a/testing/fuzzers/pdf_bidi_fuzzer.cc
+++ b/testing/fuzzers/pdf_bidi_fuzzer.cc
@@ -16,8 +16,9 @@
 #include "xfa/fgas/layout/cfgas_rtfbreak.h"
 
 extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
-  if (size > 8192)
+  if (size > 8192) {
     return 0;
+  }
 
   auto font = std::make_unique<CFX_Font>();
   font->LoadSubst("Arial", true, 0, pdfium::kFontWeightNormal, 0,
@@ -32,8 +33,9 @@
   // SAFETY: trusted arguments from fuzzer.
   auto span = UNSAFE_BUFFERS(pdfium::make_span(data, size));
   WideString input = WideString::FromUTF16LE(span);
-  for (wchar_t ch : input)
+  for (wchar_t ch : input) {
     rtf_break.AppendChar(ch);
+  }
 
   std::vector<CFGAS_Char> chars =
       rtf_break.GetCurrentLineForTesting()->line_chars_;
diff --git a/testing/fuzzers/pdf_cfgas_stringformatter_fuzzer.cc b/testing/fuzzers/pdf_cfgas_stringformatter_fuzzer.cc
index 5e067f1..173690d 100644
--- a/testing/fuzzers/pdf_cfgas_stringformatter_fuzzer.cc
+++ b/testing/fuzzers/pdf_cfgas_stringformatter_fuzzer.cc
@@ -30,8 +30,9 @@
 }  // namespace
 
 extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
-  if (size < 5 || size > 128)  // Big strings are unlikely to help.
+  if (size < 5 || size > 128) {  // Big strings are unlikely to help.
     return 0;
+  }
 
   auto* state = static_cast<XFAProcessState*>(FPDF_GetFuzzerPerProcessState());
   cppgc::Heap* heap = state->GetHeap();
diff --git a/testing/fuzzers/pdf_cfx_barcode_fuzzer.cc b/testing/fuzzers/pdf_cfx_barcode_fuzzer.cc
index a8933a9..fbdd769 100644
--- a/testing/fuzzers/pdf_cfx_barcode_fuzzer.cc
+++ b/testing/fuzzers/pdf_cfx_barcode_fuzzer.cc
@@ -8,8 +8,9 @@
 #include "fxbarcode/cfx_barcode.h"
 
 extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
-  if (size < 2 * sizeof(uint16_t))
+  if (size < 2 * sizeof(uint16_t)) {
     return 0;
+  }
 
   // SAFETY: trusted arguments from fuzzer.
   auto span = UNSAFE_BUFFERS(pdfium::make_span(data, size));
@@ -29,8 +30,9 @@
   barcode->SetWidth(418);
 
   WideString content = WideString::FromUTF16LE(span);
-  if (!barcode->Encode(content.AsStringView()))
+  if (!barcode->Encode(content.AsStringView())) {
     return 0;
+  }
 
   // TODO(tsepez): Output to device.
   return 0;
diff --git a/testing/fuzzers/pdf_cmap_fuzzer.cc b/testing/fuzzers/pdf_cmap_fuzzer.cc
index 030ffd9..67223f8 100644
--- a/testing/fuzzers/pdf_cmap_fuzzer.cc
+++ b/testing/fuzzers/pdf_cmap_fuzzer.cc
@@ -9,8 +9,9 @@
 #include "core/fxcrt/span.h"
 
 extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
-  if (size > 256 * 1024)
+  if (size > 256 * 1024) {
     return 0;
+  }
 
   pdfium::MakeRetain<CPDF_CMap>(pdfium::make_span(data, size));
   return 0;
diff --git a/testing/fuzzers/pdf_codec_fax_fuzzer.cc b/testing/fuzzers/pdf_codec_fax_fuzzer.cc
index aa66eb9..1943ec3 100644
--- a/testing/fuzzers/pdf_codec_fax_fuzzer.cc
+++ b/testing/fuzzers/pdf_codec_fax_fuzzer.cc
@@ -13,13 +13,15 @@
 
 extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
   static constexpr size_t kParameterSize = 21;
-  if (size < kParameterSize)
+  if (size < kParameterSize) {
     return 0;
+  }
 
   // Limit data size to prevent fuzzer timeout.
   static constexpr size_t kMaxDataSize = 256 * 1024;
-  if (size > kParameterSize + kMaxDataSize)
+  if (size > kParameterSize + kMaxDataSize) {
     return 0;
+  }
 
   // SAFETY: trusted arguments from fuzzer.
   auto span = UNSAFE_BUFFERS(pdfium::make_span(data, size));
@@ -41,8 +43,9 @@
 
   if (decoder) {
     int line = 0;
-    while (!decoder->GetScanline(line).empty())
+    while (!decoder->GetScanline(line).empty()) {
       line++;
+    }
   }
 
   return 0;
diff --git a/testing/fuzzers/pdf_codec_icc_fuzzer.cc b/testing/fuzzers/pdf_codec_icc_fuzzer.cc
index 1f74e6a..a02f032 100644
--- a/testing/fuzzers/pdf_codec_icc_fuzzer.cc
+++ b/testing/fuzzers/pdf_codec_icc_fuzzer.cc
@@ -10,8 +10,9 @@
 extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
   std::unique_ptr<fxcodec::IccTransform> transform =
       fxcodec::IccTransform::CreateTransformSRGB(pdfium::make_span(data, size));
-  if (!transform)
+  if (!transform) {
     return 0;
+  }
 
   const float src[4] = {0.5f, 0.5f, 0.5f, 0.5f};
   float dst[4];
diff --git a/testing/fuzzers/pdf_codec_jbig2_fuzzer.cc b/testing/fuzzers/pdf_codec_jbig2_fuzzer.cc
index 4b422fd..02fff6a 100644
--- a/testing/fuzzers/pdf_codec_jbig2_fuzzer.cc
+++ b/testing/fuzzers/pdf_codec_jbig2_fuzzer.cc
@@ -16,8 +16,9 @@
 
 extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
   const size_t kParameterSize = 8;
-  if (size < kParameterSize)
+  if (size < kParameterSize) {
     return 0;
+  }
 
   // SAFETY: trusted arguments from fuzzer.
   auto span = UNSAFE_BUFFERS(pdfium::make_span(data, size));
@@ -30,12 +31,14 @@
   FX_SAFE_UINT32 mem = width;
   mem *= height;
   mem *= k1bppRgbComponents;
-  if (!mem.IsValid() || mem.ValueOrDie() > kMemLimit)
+  if (!mem.IsValid() || mem.ValueOrDie() > kMemLimit) {
     return 0;
+  }
 
   auto bitmap = pdfium::MakeRetain<CFX_DIBitmap>();
-  if (!bitmap->Create(width, height, FXDIB_Format::k1bppRgb))
+  if (!bitmap->Create(width, height, FXDIB_Format::k1bppRgb)) {
     return 0;
+  }
 
   JBig2_DocumentContext document_context;
   Jbig2Context jbig2_context;
@@ -43,7 +46,8 @@
       &jbig2_context, &document_context, width, height, span, 1, {}, 0,
       bitmap->GetWritableBuffer(), bitmap->GetPitch(), nullptr);
 
-  while (status == FXCODEC_STATUS::kDecodeToBeContinued)
+  while (status == FXCODEC_STATUS::kDecodeToBeContinued) {
     status = Jbig2Decoder::ContinueDecode(&jbig2_context, nullptr);
+  }
   return 0;
 }
diff --git a/testing/fuzzers/pdf_cpdf_tounicodemap_fuzzer.cc b/testing/fuzzers/pdf_cpdf_tounicodemap_fuzzer.cc
index 9040eff..bfc9207 100644
--- a/testing/fuzzers/pdf_cpdf_tounicodemap_fuzzer.cc
+++ b/testing/fuzzers/pdf_cpdf_tounicodemap_fuzzer.cc
@@ -14,13 +14,15 @@
 
 extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
   static constexpr size_t kParameterSize = sizeof(uint32_t) + sizeof(wchar_t);
-  if (size <= kParameterSize)
+  if (size <= kParameterSize) {
     return 0;
+  }
 
   // Limit data size to prevent fuzzer timeout.
   static constexpr size_t kMaxDataSize = 256 * 1024;
-  if (size > kParameterSize + kMaxDataSize)
+  if (size > kParameterSize + kMaxDataSize) {
     return 0;
+  }
 
   FuzzedDataProvider data_provider(data, size);
   uint32_t charcode_to_lookup = data_provider.ConsumeIntegral<uint32_t>();
diff --git a/testing/fuzzers/pdf_css_fuzzer.cc b/testing/fuzzers/pdf_css_fuzzer.cc
index 70815da..7998441 100644
--- a/testing/fuzzers/pdf_css_fuzzer.cc
+++ b/testing/fuzzers/pdf_css_fuzzer.cc
@@ -12,8 +12,9 @@
       UNSAFE_BUFFERS(ByteStringView(data, static_cast<size_t>(size))));
 
   // If we convert the input into an empty string bail out.
-  if (input.IsEmpty())
+  if (input.IsEmpty()) {
     return 0;
+  }
 
   CFX_CSSSyntaxParser parser(input.AsStringView());
   CFX_CSSSyntaxParser::Status status;
diff --git a/testing/fuzzers/pdf_font_fuzzer.cc b/testing/fuzzers/pdf_font_fuzzer.cc
index a02052a..50b286c 100644
--- a/testing/fuzzers/pdf_font_fuzzer.cc
+++ b/testing/fuzzers/pdf_font_fuzzer.cc
@@ -9,8 +9,9 @@
 static constexpr size_t kMaxFuzzBytes = 1024 * 1024 * 1024;  // 1 GB.
 
 extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
-  if (size < 2 || size > kMaxFuzzBytes)
+  if (size < 2 || size > kMaxFuzzBytes) {
     return 0;
+  }
 
   ScopedFPDFDocument doc(FPDF_CreateNewDocument());
   ScopedFPDFPage page(FPDFPage_New(doc.get(), 0, 612, 792));
@@ -20,8 +21,9 @@
   size -= 2;
   ScopedFPDFFont font(FPDFText_LoadFont(
       doc.get(), data, static_cast<uint32_t>(size), font_type, cid));
-  if (!font)
+  if (!font) {
     return 0;
+  }
 
   FPDF_PAGEOBJECT text_object =
       FPDFPageObj_CreateTextObj(doc.get(), font.get(), 12.0f);
diff --git a/testing/fuzzers/pdf_fuzzer_init_public.cc b/testing/fuzzers/pdf_fuzzer_init_public.cc
index d009726..60910bc 100644
--- a/testing/fuzzers/pdf_fuzzer_init_public.cc
+++ b/testing/fuzzers/pdf_fuzzer_init_public.cc
@@ -43,22 +43,25 @@
 #ifdef _WIN32
   char path[MAX_PATH];
   DWORD len = GetModuleFileNameA(nullptr, path, MAX_PATH);
-  if (len != 0)
+  if (len != 0) {
     result = std::string(path, len);
+  }
 #elif defined(__APPLE__)
   char path[PATH_MAX];
   unsigned int len = PATH_MAX;
   if (!_NSGetExecutablePath(path, &len)) {
     std::unique_ptr<char, pdfium::FreeDeleter> resolved_path(
         realpath(path, nullptr));
-    if (resolved_path.get())
+    if (resolved_path.get()) {
       result = std::string(resolved_path.get());
+    }
   }
 #else  // Linux
   char path[PATH_MAX];
   ssize_t len = readlink("/proc/self/exe", path, PATH_MAX);
-  if (len > 0)
+  if (len > 0) {
     result = std::string(path, len);
+  }
 #endif
   return result;
 }
diff --git a/testing/fuzzers/pdf_hint_table_fuzzer.cc b/testing/fuzzers/pdf_hint_table_fuzzer.cc
index f4b918c..14308e1 100644
--- a/testing/fuzzers/pdf_hint_table_fuzzer.cc
+++ b/testing/fuzzers/pdf_hint_table_fuzzer.cc
@@ -30,15 +30,18 @@
   ~HintTableForFuzzing() override = default;
 
   void Fuzz(const uint8_t* data, size_t size) {
-    if (shared_hint_table_offset_ <= 0)
+    if (shared_hint_table_offset_ <= 0) {
       return;
+    }
 
-    if (size < static_cast<size_t>(shared_hint_table_offset_))
+    if (size < static_cast<size_t>(shared_hint_table_offset_)) {
       return;
+    }
 
     CFX_BitStream bs(pdfium::make_span(data, size));
-    if (!ReadPageHintTable(&bs))
+    if (!ReadPageHintTable(&bs)) {
       return;
+    }
     ReadSharedObjHintTable(&bs, shared_hint_table_offset_);
   }
 
@@ -56,8 +59,9 @@
   // Need 28 bytes for |linearized_dict|.
   // The header section of page offset hint table is 36 bytes.
   // The header section of shared object hint table is 24 bytes.
-  if (size < 28 + 36 + 24)
+  if (size < 28 + 36 + 24) {
     return 0;
+  }
 
   const int32_t* data32 = reinterpret_cast<const int32_t*>(data);
 
diff --git a/testing/fuzzers/pdf_jpx_fuzzer.cc b/testing/fuzzers/pdf_jpx_fuzzer.cc
index 798c492..395d50d 100644
--- a/testing/fuzzers/pdf_jpx_fuzzer.cc
+++ b/testing/fuzzers/pdf_jpx_fuzzer.cc
@@ -41,22 +41,26 @@
   std::unique_ptr<CJPX_Decoder> decoder =
       CJPX_Decoder::Create(span.subspan(3u), color_space_option,
                            resolution_levels_to_skip, strict_mode);
-  if (!decoder)
+  if (!decoder) {
     return 0;
+  }
 
   // A call to StartDecode could be too expensive if image size is very big, so
   // check size before calling StartDecode().
   CJPX_Decoder::JpxImageInfo image_info = decoder->GetInfo();
-  if (!CheckImageSize(image_info))
+  if (!CheckImageSize(image_info)) {
     return 0;
+  }
 
-  if (!decoder->StartDecode())
+  if (!decoder->StartDecode()) {
     return 0;
+  }
 
   // StartDecode() could change image size, so check again.
   image_info = decoder->GetInfo();
-  if (!CheckImageSize(image_info))
+  if (!CheckImageSize(image_info)) {
     return 0;
+  }
 
   FXDIB_Format format;
   if (image_info.channels == 1) {
@@ -70,13 +74,15 @@
     format = FXDIB_Format::kBgr;
   }
   auto bitmap = pdfium::MakeRetain<CFX_DIBitmap>();
-  if (!bitmap->Create(image_info.width, image_info.height, format))
+  if (!bitmap->Create(image_info.width, image_info.height, format)) {
     return 0;
+  }
 
   if (bitmap->GetHeight() <= 0 ||
       kMaxJPXFuzzSize / bitmap->GetPitch() <
-          static_cast<uint32_t>(bitmap->GetHeight()))
+          static_cast<uint32_t>(bitmap->GetHeight())) {
     return 0;
+  }
 
   decoder->Decode(bitmap->GetWritableBuffer(), bitmap->GetPitch(),
                   /*swap_rgb=*/false, GetCompsFromFormat(format));
diff --git a/testing/fuzzers/pdf_lzw_fuzzer.cc b/testing/fuzzers/pdf_lzw_fuzzer.cc
index 01eb1e1..e5f6251 100644
--- a/testing/fuzzers/pdf_lzw_fuzzer.cc
+++ b/testing/fuzzers/pdf_lzw_fuzzer.cc
@@ -25,8 +25,9 @@
              uint8_t code_exp) {
   std::unique_ptr<LZWDecompressor> decompressor =
       LZWDecompressor::Create(color_exp, code_exp);
-  if (!decompressor)
+  if (!decompressor) {
     return;
+  }
 
   for (uint32_t compressions_ratio = kMinCompressionRatio;
        compressions_ratio <= kMaxCompressionRatio; compressions_ratio++) {
diff --git a/testing/fuzzers/pdf_nametree_fuzzer.cc b/testing/fuzzers/pdf_nametree_fuzzer.cc
index 42664ea..de5badc 100644
--- a/testing/fuzzers/pdf_nametree_fuzzer.cc
+++ b/testing/fuzzers/pdf_nametree_fuzzer.cc
@@ -47,8 +47,9 @@
   // |remaining| needs to outlive |parser|.
   std::vector<uint8_t> remaining =
       data_provider.ConsumeRemainingBytes<uint8_t>();
-  if (remaining.empty())
+  if (remaining.empty()) {
     return 0;
+  }
 
   CPDF_StreamParser parser(remaining);
   auto dict = pdfium::MakeRetain<CPDF_Dictionary>();
@@ -57,18 +58,21 @@
   for (const auto& name : params.names) {
     RetainPtr<CPDF_Object> obj = parser.ReadNextObject(
         /*bAllowNestedArray*/ true, /*bInArray=*/false, /*dwRecursionLevel=*/0);
-    if (!obj)
+    if (!obj) {
       break;
+    }
 
     name_tree->AddValueAndName(std::move(obj), name);
   }
 
   if (params.delete_backwards) {
-    for (size_t i = params.count; i > 0; --i)
+    for (size_t i = params.count; i > 0; --i) {
       name_tree->DeleteValueAndName(i);
+    }
   } else {
-    for (size_t i = 0; i < params.count; ++i)
+    for (size_t i = 0; i < params.count; ++i) {
       name_tree->DeleteValueAndName(0);
+    }
   }
   return 0;
 }
diff --git a/testing/fuzzers/pdf_psengine_fuzzer.cc b/testing/fuzzers/pdf_psengine_fuzzer.cc
index d1dbdee..bb86b01 100644
--- a/testing/fuzzers/pdf_psengine_fuzzer.cc
+++ b/testing/fuzzers/pdf_psengine_fuzzer.cc
@@ -9,7 +9,8 @@
 
 extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
   CPDF_PSEngine engine;
-  if (engine.Parse(pdfium::make_span(data, size)))
+  if (engine.Parse(pdfium::make_span(data, size))) {
     engine.Execute();
+  }
   return 0;
 }
diff --git a/testing/fuzzers/pdf_streamparser_fuzzer.cc b/testing/fuzzers/pdf_streamparser_fuzzer.cc
index 8d89bed..190d0ac 100644
--- a/testing/fuzzers/pdf_streamparser_fuzzer.cc
+++ b/testing/fuzzers/pdf_streamparser_fuzzer.cc
@@ -10,8 +10,9 @@
 
 extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
   CPDF_StreamParser parser(pdfium::make_span(data, size));
-  while (RetainPtr<CPDF_Object> pObj = parser.ReadNextObject(true, false, 0))
+  while (RetainPtr<CPDF_Object> pObj = parser.ReadNextObject(true, false, 0)) {
     continue;
+  }
 
   return 0;
 }
diff --git a/testing/fuzzers/pdf_xfa_fdp_fuzzer.cc b/testing/fuzzers/pdf_xfa_fdp_fuzzer.cc
index c86fbf3..fd0a96d 100644
--- a/testing/fuzzers/pdf_xfa_fdp_fuzzer.cc
+++ b/testing/fuzzers/pdf_xfa_fdp_fuzzer.cc
@@ -25,8 +25,10 @@
   // done by the non-xfa fuzzer.
   bool OnFormFillEnvLoaded(FPDF_DOCUMENT doc) override {
     int form_type = FPDF_GetFormType(doc);
-    if (form_type != FORMTYPE_XFA_FULL && form_type != FORMTYPE_XFA_FOREGROUND)
+    if (form_type != FORMTYPE_XFA_FULL &&
+        form_type != FORMTYPE_XFA_FOREGROUND) {
       return false;
+    }
     return FPDF_LoadXFA(doc);
   }
 
diff --git a/testing/fuzzers/pdf_xfa_raw_fuzzer.cc b/testing/fuzzers/pdf_xfa_raw_fuzzer.cc
index 8dce02f..c9ae2ce 100644
--- a/testing/fuzzers/pdf_xfa_raw_fuzzer.cc
+++ b/testing/fuzzers/pdf_xfa_raw_fuzzer.cc
@@ -22,8 +22,10 @@
   // done by the non-xfa fuzzer.
   bool OnFormFillEnvLoaded(FPDF_DOCUMENT doc) override {
     int form_type = FPDF_GetFormType(doc);
-    if (form_type != FORMTYPE_XFA_FULL && form_type != FORMTYPE_XFA_FOREGROUND)
+    if (form_type != FORMTYPE_XFA_FULL &&
+        form_type != FORMTYPE_XFA_FOREGROUND) {
       return false;
+    }
     return FPDF_LoadXFA(doc);
   }
 };
diff --git a/testing/fuzzers/pdf_xfa_xdp_fdp_fuzzer.cc b/testing/fuzzers/pdf_xfa_xdp_fdp_fuzzer.cc
index 8917ce7..7734b19 100644
--- a/testing/fuzzers/pdf_xfa_xdp_fdp_fuzzer.cc
+++ b/testing/fuzzers/pdf_xfa_xdp_fdp_fuzzer.cc
@@ -19,8 +19,10 @@
 
   bool OnFormFillEnvLoaded(FPDF_DOCUMENT doc) override {
     int form_type = FPDF_GetFormType(doc);
-    if (form_type != FORMTYPE_XFA_FULL && form_type != FORMTYPE_XFA_FOREGROUND)
+    if (form_type != FORMTYPE_XFA_FULL &&
+        form_type != FORMTYPE_XFA_FOREGROUND) {
       return false;
+    }
     return FPDF_LoadXFA(doc);
   }
 };
diff --git a/testing/fuzzers/pdf_xml_fuzzer.cc b/testing/fuzzers/pdf_xml_fuzzer.cc
index bf24bce..6e9bb73 100644
--- a/testing/fuzzers/pdf_xml_fuzzer.cc
+++ b/testing/fuzzers/pdf_xml_fuzzer.cc
@@ -16,20 +16,23 @@
 
 extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
   FX_SAFE_SIZE_T safe_size = size;
-  if (!safe_size.IsValid())
+  if (!safe_size.IsValid()) {
     return 0;
+  }
 
   auto stream =
       pdfium::MakeRetain<CFX_ReadOnlySpanStream>(pdfium::make_span(data, size));
   CFX_XMLParser parser(stream);
   std::unique_ptr<CFX_XMLDocument> doc = parser.Parse();
-  if (!doc || !doc->GetRoot())
+  if (!doc || !doc->GetRoot()) {
     return 0;
+  }
 
   for (CFX_XMLNode* pXMLNode = doc->GetRoot()->GetFirstChild(); pXMLNode;
        pXMLNode = pXMLNode->GetNextSibling()) {
-    if (pXMLNode->GetType() == CFX_XMLNode::Type::kElement)
+    if (pXMLNode->GetType() == CFX_XMLNode::Type::kElement) {
       break;
+    }
   }
   return 0;
 }
diff --git a/testing/fuzzers/pdfium_fuzzer_helper.cc b/testing/fuzzers/pdfium_fuzzer_helper.cc
index b9a60c5..52aa34b 100644
--- a/testing/fuzzers/pdfium_fuzzer_helper.cc
+++ b/testing/fuzzers/pdfium_fuzzer_helper.cc
@@ -156,15 +156,18 @@
   if (FPDFAvail_IsLinearized(pdf_avail.get()) == PDF_LINEARIZED) {
     doc.reset(FPDFAvail_GetDocument(pdf_avail.get(), nullptr));
     if (doc) {
-      while (nRet == PDF_DATA_NOTAVAIL)
+      while (nRet == PDF_DATA_NOTAVAIL) {
         nRet = FPDFAvail_IsDocAvail(pdf_avail.get(), &hints);
+      }
 
-      if (nRet == PDF_DATA_ERROR)
+      if (nRet == PDF_DATA_ERROR) {
         return;
+      }
 
       nRet = FPDFAvail_IsFormAvail(pdf_avail.get(), &hints);
-      if (nRet == PDF_FORM_ERROR || nRet == PDF_FORM_NOTAVAIL)
+      if (nRet == PDF_FORM_ERROR || nRet == PDF_FORM_NOTAVAIL) {
         return;
+      }
 
       bIsLinearized = true;
     }
@@ -172,13 +175,15 @@
     doc.reset(FPDF_LoadCustomDocument(&file_access, nullptr));
   }
 
-  if (!doc)
+  if (!doc) {
     return;
+  }
 
   ScopedFPDFFormHandle form(
       FPDFDOC_InitFormFillEnvironment(doc.get(), &form_callbacks));
-  if (!OnFormFillEnvLoaded(doc.get()))
+  if (!OnFormFillEnvLoaded(doc.get())) {
     return;
+  }
 
   FPDF_SetFormFieldHighlightColor(form.get(), FPDF_FORMFIELD_UNKNOWN, 0xFFE4DD);
   FPDF_SetFormFieldHighlightAlpha(form.get(), 100);
@@ -189,11 +194,13 @@
   for (int i = 0; i < page_count; ++i) {
     if (bIsLinearized) {
       nRet = PDF_DATA_NOTAVAIL;
-      while (nRet == PDF_DATA_NOTAVAIL)
+      while (nRet == PDF_DATA_NOTAVAIL) {
         nRet = FPDFAvail_IsPageAvail(pdf_avail.get(), i, &hints);
+      }
 
-      if (nRet == PDF_DATA_ERROR)
+      if (nRet == PDF_DATA_ERROR) {
         return;
+      }
     }
     RenderPage(doc.get(), form.get(), i, render_flags, form_flags);
   }
@@ -207,8 +214,9 @@
                                     int render_flags,
                                     int form_flags) {
   ScopedFPDFPage page(FPDF_LoadPage(doc, page_index));
-  if (!page)
+  if (!page) {
     return false;
+  }
 
   ScopedFPDFTextPage text_page(FPDFText_LoadPage(page.get()));
   FORM_OnAfterLoadPage(page.get(), form);
diff --git a/testing/fuzzers/pdfium_xfa_fuzzer.cc b/testing/fuzzers/pdfium_xfa_fuzzer.cc
index 1ba78cc..4b66d1e 100644
--- a/testing/fuzzers/pdfium_xfa_fuzzer.cc
+++ b/testing/fuzzers/pdfium_xfa_fuzzer.cc
@@ -18,8 +18,10 @@
   // done by the non-xfa fuzzer.
   bool OnFormFillEnvLoaded(FPDF_DOCUMENT doc) override {
     int form_type = FPDF_GetFormType(doc);
-    if (form_type != FORMTYPE_XFA_FULL && form_type != FORMTYPE_XFA_FOREGROUND)
+    if (form_type != FORMTYPE_XFA_FULL &&
+        form_type != FORMTYPE_XFA_FOREGROUND) {
       return false;
+    }
     return FPDF_LoadXFA(doc);
   }
 };
diff --git a/testing/fuzzers/xfa_process_state.cc b/testing/fuzzers/xfa_process_state.cc
index f768fea..91d552c 100644
--- a/testing/fuzzers/xfa_process_state.cc
+++ b/testing/fuzzers/xfa_process_state.cc
@@ -20,6 +20,7 @@
 
 void XFAProcessState::ForceGCAndPump() {
   FXGC_ForceGarbageCollection(heap_.get());
-  while (v8::platform::PumpMessageLoop(platform_, isolate_))
+  while (v8::platform::PumpMessageLoop(platform_, isolate_)) {
     continue;
+  }
 }
diff --git a/testing/fx_string_testhelpers.cpp b/testing/fx_string_testhelpers.cpp
index 363fa40..a8d5106 100644
--- a/testing/fx_string_testhelpers.cpp
+++ b/testing/fx_string_testhelpers.cpp
@@ -29,8 +29,9 @@
   size_t pos = 0;
   while (true) {
     size_t found = str.find(delimiter, pos);
-    if (found == std::string::npos)
+    if (found == std::string::npos) {
       break;
+    }
 
     result.push_back(str.substr(pos, found - pos));
     pos = found + 1;
@@ -45,12 +46,14 @@
 }
 
 std::wstring GetPlatformWString(FPDF_WIDESTRING wstr) {
-  if (!wstr)
+  if (!wstr) {
     return std::wstring();
+  }
 
   size_t characters = 0;
-  while (wstr[characters])
+  while (wstr[characters]) {
     ++characters;
+  }
 
   std::wstring platform_string;
   platform_string.reserve(characters);
diff --git a/testing/gtest_mac.h b/testing/gtest_mac.h
index 95d7d32..dee9851 100644
--- a/testing/gtest_mac.h
+++ b/testing/gtest_mac.h
@@ -4,8 +4,9 @@
 
 #ifndef TESTING_GTEST_MAC_H_
 #define TESTING_GTEST_MAC_H_
-#include <gtest/internal/gtest-port.h>
+
 #include <gtest/gtest.h>
+#include <gtest/internal/gtest-port.h>
 #ifdef GTEST_OS_MAC
 #import <Foundation/Foundation.h>
 namespace testing {
@@ -60,4 +61,5 @@
 #define ASSERT_NSNE(val1, val2) \
   ASSERT_PRED_FORMAT2(::testing::internal::CmpHelperNSNE, val1, val2)
 #endif  // GTEST_OS_MAC
+
 #endif  // TESTING_GTEST_MAC_H_
diff --git a/testing/gtest_mac.mm b/testing/gtest_mac.mm
index 47912c7..03ef9f9 100644
--- a/testing/gtest_mac.mm
+++ b/testing/gtest_mac.mm
@@ -3,12 +3,15 @@
 // found in the LICENSE file.
 
 #import "gtest_mac.h"
-#include <string>
+
 #include <gtest/gtest.h>
 #include <gtest/internal/gtest-port.h>
 #include <gtest/internal/gtest-string.h>
+#include <string>
+
 #ifdef GTEST_OS_MAC
 #import <Foundation/Foundation.h>
+
 namespace testing {
 namespace internal {
 // Handles nil values for |obj| properly by using safe printing of %@ in
diff --git a/testing/helpers/write.cc b/testing/helpers/write.cc
index 08b9e40..dcce49f 100644
--- a/testing/helpers/write.cc
+++ b/testing/helpers/write.cc
@@ -634,7 +634,7 @@
   }
   SkSerialProcs procs;
   procs.fImageProc = [](SkImage* img, void*) -> sk_sp<SkData> {
-      return SkPngEncoder::Encode(nullptr, img, SkPngEncoder::Options{});
+    return SkPngEncoder::Encode(nullptr, img, SkPngEncoder::Options{});
   };
 
   picture.serialize(stream.get(), &procs);
diff --git a/testing/image_diff/image_diff.cpp b/testing/image_diff/image_diff.cpp
index 787753a..02c0fab 100644
--- a/testing/image_diff/image_diff.cpp
+++ b/testing/image_diff/image_diff.cpp
@@ -65,14 +65,16 @@
 
   // Returns the RGBA value of the pixel at the given location
   uint32_t pixel_at(int x, int y) const {
-    if (!pixel_in_bounds(x, y))
+    if (!pixel_in_bounds(x, y)) {
       return 0;
+    }
     return *reinterpret_cast<const uint32_t*>(&(data_[pixel_address(x, y)]));
   }
 
   void set_pixel_at(int x, int y, uint32_t color) {
-    if (!pixel_in_bounds(x, y))
+    if (!pixel_in_bounds(x, y)) {
       return;
+    }
 
     void* addr = &data_[pixel_address(x, y)];
     *reinterpret_cast<uint32_t*>(addr) = color;
@@ -82,8 +84,9 @@
   bool CreateFromFilenameImpl(const std::string& path,
                               bool reverse_byte_order) {
     FILE* f = fopen(path.c_str(), "rb");
-    if (!f)
+    if (!f) {
       return false;
+    }
 
     std::vector<uint8_t> compressed;
     const size_t kBufSize = 1024;
@@ -221,10 +224,11 @@
     for (int x = 0; x < w; ++x) {
       uint32_t actual_rgba = actual.pixel_at(x, y);
       auto it = baseline_histogram.find(actual_rgba);
-      if (it != baseline_histogram.end() && it->second > 0)
+      if (it != baseline_histogram.end() && it->second > 0) {
         --it->second;
-      else
+      } else {
         ++pixels_different;
+      }
     }
   }
 
@@ -393,22 +397,26 @@
   bool same = do_subtraction
                   ? SubtractImages(baseline_image, actual_image, &diff_image)
                   : CreateImageDiff(baseline_image, actual_image, &diff_image);
-  if (same)
+  if (same) {
     return kStatusSame;
+  }
 
   std::vector<uint8_t> png_encoding = image_diff_png::EncodeRGBAPNG(
       diff_image.span(), diff_image.w(), diff_image.h(), diff_image.w() * 4);
-  if (png_encoding.empty())
+  if (png_encoding.empty()) {
     return kStatusError;
+  }
 
   FILE* f = fopen(out_file.c_str(), "wb");
-  if (!f)
+  if (!f) {
     return kStatusError;
+  }
 
   size_t size = png_encoding.size();
   char* ptr = reinterpret_cast<char*>(&png_encoding.front());
-  if (fwrite(ptr, 1, size, f) != size)
+  if (fwrite(ptr, 1, size, f) != size) {
     return kStatusError;
+  }
 
   return kStatusDifferent;
 }
@@ -432,8 +440,9 @@
   int i;
   for (i = 1; i < argc; ++i) {
     const char* arg = argv[i];
-    if (strstr(arg, "--") != arg)
+    if (strstr(arg, "--") != arg) {
       break;
+    }
     if (strcmp(arg, "--histogram") == 0) {
       histograms = true;
     } else if (strcmp(arg, "--diff") == 0) {
@@ -446,12 +455,15 @@
       max_pixel_per_channel_delta = 1;
     }
   }
-  if (i < argc)
+  if (i < argc) {
     filename1 = argv[i++];
-  if (i < argc)
+  }
+  if (i < argc) {
     filename2 = argv[i++];
-  if (i < argc)
+  }
+  if (i < argc) {
     diff_filename = argv[i++];
+  }
 
   if (produce_diff_image || produce_image_subtraction) {
     if (!diff_filename.empty()) {
diff --git a/testing/image_diff/image_diff_png.cpp b/testing/image_diff/image_diff_png.cpp
index 6e00aae..62582ba 100644
--- a/testing/image_diff/image_diff_png.cpp
+++ b/testing/image_diff/image_diff_png.cpp
@@ -192,28 +192,33 @@
   // that an image's size (in bytes) fits in a (signed) int.
   unsigned long long total_size =
       static_cast<unsigned long long>(w) * static_cast<unsigned long long>(h);
-  if (total_size > ((1 << 29) - 1))
+  if (total_size > ((1 << 29) - 1)) {
     longjmp(png_jmpbuf(png_ptr), 1);
+  }
   state->width = static_cast<int>(w);
   state->height = static_cast<int>(h);
 
   // Expand to ensure we use 24-bit for RGB and 32-bit for RGBA.
   if (color_type == PNG_COLOR_TYPE_PALETTE ||
-      (color_type == PNG_COLOR_TYPE_GRAY && bit_depth < 8))
+      (color_type == PNG_COLOR_TYPE_GRAY && bit_depth < 8)) {
     png_set_expand(png_ptr);
+  }
 
   // Transparency for paletted images.
-  if (png_get_valid(png_ptr, info_ptr, PNG_INFO_tRNS))
+  if (png_get_valid(png_ptr, info_ptr, PNG_INFO_tRNS)) {
     png_set_expand(png_ptr);
+  }
 
   // Convert 16-bit to 8-bit.
-  if (bit_depth == 16)
+  if (bit_depth == 16) {
     png_set_strip_16(png_ptr);
+  }
 
   // Expand grayscale to RGB.
   if (color_type == PNG_COLOR_TYPE_GRAY ||
-      color_type == PNG_COLOR_TYPE_GRAY_ALPHA)
+      color_type == PNG_COLOR_TYPE_GRAY_ALPHA) {
     png_set_gray_to_rgb(png_ptr);
+  }
 
   // Deal with gamma and keep it under our control.
   double gamma;
@@ -228,8 +233,9 @@
   }
 
   // Tell libpng to send us rows for interlaced pngs.
-  if (interlace_type == PNG_INTERLACE_ADAM7)
+  if (interlace_type == PNG_INTERLACE_ADAM7) {
     png_set_interlace_handling(png_ptr);
+  }
 
   // Update our info now
   png_read_update_info(png_ptr, info_ptr);
@@ -293,10 +299,11 @@
   base = &state->output->front();
 
   uint8_t* dest = &base[state->width * state->output_channels * row_num];
-  if (state->row_converter)
+  if (state->row_converter) {
     state->row_converter(new_row, state->width, dest, &state->is_opaque);
-  else
+  } else {
     FXSYS_memcpy(dest, new_row, state->width * state->output_channels);
+  }
 }
 
 void DecodeEndCallback(png_struct* png_ptr, png_info* info) {
@@ -323,17 +330,20 @@
 bool BuildPNGStruct(pdfium::span<const uint8_t> input,
                     png_struct** png_ptr,
                     png_info** info_ptr) {
-  if (input.size() < 8)
+  if (input.size() < 8) {
     return false;  // Input data too small to be a png
+  }
 
   // Have libpng check the signature, it likes the first 8 bytes.
-  if (png_sig_cmp(const_cast<uint8_t*>(input.data()), 0, 8) != 0)
+  if (png_sig_cmp(const_cast<uint8_t*>(input.data()), 0, 8) != 0) {
     return false;
+  }
 
   *png_ptr =
       png_create_read_struct(PNG_LIBPNG_VER_STRING, nullptr, nullptr, nullptr);
-  if (!*png_ptr)
+  if (!*png_ptr) {
     return false;
+  }
 
   *info_ptr = png_create_info_struct(*png_ptr);
   if (!*info_ptr) {
@@ -351,8 +361,9 @@
   std::vector<uint8_t> output;
   png_struct* png_ptr = nullptr;
   png_info* info_ptr = nullptr;
-  if (!BuildPNGStruct(input, &png_ptr, &info_ptr))
+  if (!BuildPNGStruct(input, &png_ptr, &info_ptr)) {
     return output;
+  }
 
   PngReadStructDestroyer destroyer(&png_ptr, &info_ptr);
   if (setjmp(png_jmpbuf(png_ptr))) {
@@ -433,8 +444,9 @@
  public:
   explicit CommentWriter(const std::vector<Comment>& comments)
       : comments_(comments), png_text_(new png_text[comments.size()]) {
-    for (size_t i = 0; i < comments.size(); ++i)
+    for (size_t i = 0; i < comments.size(); ++i) {
       AddComment(i, comments[i]);
+    }
   }
 
   ~CommentWriter() {
@@ -455,8 +467,9 @@
   void AddComment(size_t pos, const Comment& comment) {
     png_text_[pos].compression = PNG_TEXT_COMPRESSION_NONE;
     // A PNG comment's key can only be 79 characters long.
-    if (comment.key.size() > 79)
+    if (comment.key.size() > 79) {
       return;
+    }
     png_text_[pos].key = strdup(comment.key.substr(0, 78).c_str());
     png_text_[pos].text = strdup(comment.text.c_str());
     png_text_[pos].text_length = comment.text.size();
@@ -607,13 +620,15 @@
   }
 
   // Row stride should be at least as long as the length of the data.
-  if (row_byte_width < input_color_components * width)
+  if (row_byte_width < input_color_components * width) {
     return output;
+  }
 
   png_struct* png_ptr =
       png_create_write_struct(PNG_LIBPNG_VER_STRING, nullptr, nullptr, nullptr);
-  if (!png_ptr)
+  if (!png_ptr) {
     return output;
+  }
   png_info* info_ptr = png_create_info_struct(png_ptr);
   if (!info_ptr) {
     png_destroy_write_struct(&png_ptr, nullptr);
@@ -627,8 +642,9 @@
                     output_color_components, converter, comments);
   png_destroy_write_struct(&png_ptr, &info_ptr);
 
-  if (!success)
+  if (!success) {
     output.clear();
+  }
   return output;
 }
 
diff --git a/testing/pdfium_test.cc b/testing/pdfium_test.cc
index f552e1d..23cd8a7 100644
--- a/testing/pdfium_test.cc
+++ b/testing/pdfium_test.cc
@@ -205,28 +205,39 @@
 
 int PageRenderFlagsFromOptions(const Options& options) {
   int flags = FPDF_ANNOT;
-  if (options.lcd_text)
+  if (options.lcd_text) {
     flags |= FPDF_LCD_TEXT;
-  if (options.no_nativetext)
+  }
+  if (options.no_nativetext) {
     flags |= FPDF_NO_NATIVETEXT;
-  if (options.grayscale)
+  }
+  if (options.grayscale) {
     flags |= FPDF_GRAYSCALE;
-  if (options.fill_to_stroke)
+  }
+  if (options.fill_to_stroke) {
     flags |= FPDF_CONVERT_FILL_TO_STROKE;
-  if (options.limit_cache)
+  }
+  if (options.limit_cache) {
     flags |= FPDF_RENDER_LIMITEDIMAGECACHE;
-  if (options.force_halftone)
+  }
+  if (options.force_halftone) {
     flags |= FPDF_RENDER_FORCEHALFTONE;
-  if (options.printing)
+  }
+  if (options.printing) {
     flags |= FPDF_PRINTING;
-  if (options.no_smoothtext)
+  }
+  if (options.no_smoothtext) {
     flags |= FPDF_RENDER_NO_SMOOTHTEXT;
-  if (options.no_smoothimage)
+  }
+  if (options.no_smoothimage) {
     flags |= FPDF_RENDER_NO_SMOOTHIMAGE;
-  if (options.no_smoothpath)
+  }
+  if (options.no_smoothpath) {
     flags |= FPDF_RENDER_NO_SMOOTHPATH;
-  if (options.reverse_byte_order)
+  }
+  if (options.reverse_byte_order) {
     flags |= FPDF_REVERSE_BYTE_ORDER;
+  }
   return flags;
 }
 
@@ -251,13 +262,15 @@
 #if defined(__APPLE__) || (defined(__linux__) && !defined(__ANDROID__))
   // Set custom font path to an empty path. This avoids the fallback to default
   // font paths.
-  if (options.linux_no_system_fonts)
+  if (options.linux_no_system_fonts) {
     return nullptr;
+  }
 #endif
 
   // No custom font path. Use default.
-  if (options.font_directory.empty())
+  if (options.font_directory.empty()) {
     return std::nullopt;
+  }
 
   // Set custom font path to |options.font_directory|.
   return options.font_directory.c_str();
@@ -299,8 +312,9 @@
                     int type,
                     int icon) {
   printf("%ls", GetPlatformWString(title).c_str());
-  if (icon || type)
+  if (icon || type) {
     printf("[icon=%d,type=%d]", icon, type);
+  }
   printf(": %ls\n", GetPlatformWString(msg).c_str());
   return 0;
 }
@@ -335,8 +349,9 @@
 int ExampleDocGetFilePath(IPDF_JSPLATFORM*, void* file_path, int length) {
   static const char kPath[] = "myfile.pdf";
   static constexpr int kRequired = static_cast<int>(sizeof(kPath));
-  if (file_path && length >= kRequired)
+  if (file_path && length >= kRequired) {
     memcpy(file_path, kPath, kRequired);
+  }
   return kRequired;
 }
 
@@ -375,8 +390,9 @@
   printf("Doc Submit Form: url=%ls + %d data bytes:\n",
          GetPlatformWString(url).c_str(), length);
   uint8_t* ptr = reinterpret_cast<uint8_t*>(formData);
-  for (int i = 0; i < length; ++i)
+  for (int i = 0; i < length; ++i) {
     printf(" %02x", ptr[i]);
+  }
   printf("\n");
 }
 
@@ -387,8 +403,9 @@
 int ExampleFieldBrowse(IPDF_JSPLATFORM*, void* file_path, int length) {
   static const char kPath[] = "selected.txt";
   static constexpr int kRequired = static_cast<int>(sizeof(kPath));
-  if (file_path && length >= kRequired)
+  if (file_path && length >= kRequired) {
     memcpy(file_path, kPath, kRequired);
+  }
   return kRequired;
 }
 #endif  // PDF_ENABLE_V8
@@ -456,8 +473,9 @@
 bool ParseCommandLine(const std::vector<std::string>& args,
                       Options* options,
                       std::vector<std::string>* files) {
-  if (args.empty())
+  if (args.empty()) {
     return false;
+  }
 
   options->exe_path = args[0];
   size_t cur_idx = 1;
@@ -782,12 +800,14 @@
       ToPDFiumTestFormFillInfo(param);
   auto& loaded_pages = form_fill_info->loaded_pages;
   auto iter = loaded_pages.find(index);
-  if (iter != loaded_pages.end())
+  if (iter != loaded_pages.end()) {
     return iter->second.get();
+  }
 
   ScopedFPDFPage page(FPDF_LoadPage(doc, index));
-  if (!page)
+  if (!page) {
     return nullptr;
+  }
 
   // Mark the page as loaded first to prevent infinite recursion.
   FPDF_PAGE page_ptr = page.get();
@@ -1270,15 +1290,17 @@
 
   bool Write(const std::string& name, int page_index, bool md5) override {
     std::string image_file_name = WriteSkp(name.c_str(), page_index, *picture_);
-    if (image_file_name.empty())
+    if (image_file_name.empty()) {
       return false;
+    }
 
     if (md5) {
       // Play back the `SkPicture` so we can take a hash of the result.
       sk_sp<SkSurface> surface = SkSurfaces::Raster(SkImageInfo::MakeN32Premul(
           /*width=*/width(), /*height=*/height()));
-      if (!surface)
+      if (!surface) {
         return false;
+      }
 
       // Must clear to white before replay to match initial `CFX_DIBitmap`.
       surface->getCanvas()->clear(SK_ColorWHITE);
@@ -1286,8 +1308,9 @@
 
       // Write the filename and the MD5 of the buffer to stdout.
       SkPixmap pixmap;
-      if (!surface->peekPixels(&pixmap))
+      if (!surface->peekPixels(&pixmap)) {
         return false;
+      }
 
       OutputMD5Hash(image_file_name.c_str(),
                     UNSAFE_TODO(pdfium::make_span(
@@ -1520,8 +1543,9 @@
   }
 
   if (renderer->Start()) {
-    while (renderer->Continue())
+    while (renderer->Continue()) {
       continue;
+    }
     renderer->Finish(form());
     renderer->Write(name(), page_index, /*md5=*/options().md5);
   } else {
@@ -1571,8 +1595,9 @@
       int avail_status = PDF_DATA_NOTAVAIL;
       doc.reset(FPDFAvail_GetDocument(pdf_avail.get(), password));
       if (doc) {
-        while (avail_status == PDF_DATA_NOTAVAIL)
+        while (avail_status == PDF_DATA_NOTAVAIL) {
           avail_status = FPDFAvail_IsDocAvail(pdf_avail.get(), &hints);
+        }
 
         if (avail_status == PDF_DATA_ERROR) {
           fprintf(stderr, "Unknown error in checking if doc was available.\n");
@@ -1598,8 +1623,9 @@
     return;
   }
 
-  if (!FPDF_DocumentHasValidCrossReferenceTable(doc.get()))
+  if (!FPDF_DocumentHasValidCrossReferenceTable(doc.get())) {
     fprintf(stderr, "Document has invalid cross reference table\n");
+  }
 
   if (options().show_metadata) {
     DumpMetaData(doc.get());
@@ -1649,8 +1675,9 @@
   if (!options().disable_xfa && !options().disable_javascript) {
     int doc_type = FPDF_GetFormType(doc.get());
     if (doc_type == FORMTYPE_XFA_FULL || doc_type == FORMTYPE_XFA_FOREGROUND) {
-      if (!FPDF_LoadXFA(doc.get()))
+      if (!FPDF_LoadXFA(doc.get())) {
         fprintf(stderr, "LoadXFA unsuccessful, continuing anyway.\n");
+      }
     }
   }
 #endif  // PDF_ENABLE_XFA
@@ -1680,8 +1707,9 @@
   for (int i = first_page; i < last_page; ++i) {
     if (is_linearized) {
       int avail_status = PDF_DATA_NOTAVAIL;
-      while (avail_status == PDF_DATA_NOTAVAIL)
+      while (avail_status == PDF_DATA_NOTAVAIL) {
         avail_status = FPDFAvail_IsPageAvail(pdf_avail.get(), i, &hints);
+      }
 
       if (avail_status == PDF_DATA_ERROR) {
         fprintf(stderr, "Unknown error in checking if page %d is available.\n",
@@ -1701,15 +1729,17 @@
   Idle();
 
   fprintf(stderr, "Processed %d pages.\n", processed_pages);
-  if (bad_pages)
+  if (bad_pages) {
     fprintf(stderr, "Skipped %d bad pages.\n", bad_pages);
+  }
 }
 
 void ShowConfig() {
   std::string config;
   [[maybe_unused]] auto append_config = [&config](const char* name) {
-    if (!config.empty())
+    if (!config.empty()) {
       config += ',';
+    }
     config += name;
   };
 
@@ -1936,10 +1966,12 @@
 
     idler = [&platform, &isolate]() {
       int task_count = 0;
-      while (v8::platform::PumpMessageLoop(platform.get(), isolate.get()))
+      while (v8::platform::PumpMessageLoop(platform.get(), isolate.get())) {
         ++task_count;
-      if (task_count)
+      }
+      if (task_count) {
         fprintf(stderr, "Pumped %d tasks\n", task_count);
+      }
     };
   }
 #endif  // PDF_ENABLE_V8
diff --git a/testing/pseudo_retainable.h b/testing/pseudo_retainable.h
index 6dbfffc..6111f40 100644
--- a/testing/pseudo_retainable.h
+++ b/testing/pseudo_retainable.h
@@ -10,8 +10,9 @@
   PseudoRetainable() = default;
   void Retain() const { ++retain_count_; }
   void Release() const {
-    if (++release_count_ == retain_count_)
+    if (++release_count_ == retain_count_) {
       alive_ = false;
+    }
   }
   bool alive() const { return alive_; }
   int retain_count() const { return retain_count_; }
diff --git a/testing/range_set.cpp b/testing/range_set.cpp
index 9c8c17b..6bc3722 100644
--- a/testing/range_set.cpp
+++ b/testing/range_set.cpp
@@ -14,22 +14,25 @@
 RangeSet::~RangeSet() = default;
 
 bool RangeSet::Contains(const Range& range) const {
-  if (IsEmptyRange(range))
+  if (IsEmptyRange(range)) {
     return false;
+  }
 
   const Range fixed_range = FixDirection(range);
   auto it = ranges().upper_bound(fixed_range);
 
-  if (it == ranges().begin())
+  if (it == ranges().begin()) {
     return false;  // No ranges includes range.first.
+  }
 
   --it;  // Now it starts equal or before range.first.
   return it->second >= fixed_range.second;
 }
 
 void RangeSet::Union(const Range& range) {
-  if (IsEmptyRange(range))
+  if (IsEmptyRange(range)) {
     return;
+  }
 
   Range fixed_range = FixDirection(range);
   if (IsEmpty()) {
@@ -38,11 +41,13 @@
   }
 
   auto start = ranges_.upper_bound(fixed_range);
-  if (start != ranges_.begin())
+  if (start != ranges_.begin()) {
     --start;  // start now points to the key equal or lower than offset.
+  }
 
-  if (start->second < fixed_range.first)
+  if (start->second < fixed_range.first) {
     ++start;  // start element is entirely before current range, skip it.
+  }
 
   auto end = ranges_.upper_bound(Range(fixed_range.second, fixed_range.second));
 
@@ -61,8 +66,9 @@
 
 void RangeSet::Union(const RangeSet& range_set) {
   DCHECK(&range_set != this);
-  for (const auto& it : range_set.ranges())
+  for (const auto& it : range_set.ranges()) {
     Union(it);
+  }
 }
 
 RangeSet::Range RangeSet::FixDirection(const Range& range) const {
diff --git a/testing/scoped_set_tz.cpp b/testing/scoped_set_tz.cpp
index 08debba..35550cc 100644
--- a/testing/scoped_set_tz.cpp
+++ b/testing/scoped_set_tz.cpp
@@ -28,17 +28,19 @@
 
 ScopedSetTZ::ScopedSetTZ(const std::string& tz) {
   const char* old_tz = getenv(kTZ);
-  if (old_tz)
+  if (old_tz) {
     old_tz_ = old_tz;
+  }
 
   CHECK_EQ(0, SETENV(kTZ, tz.c_str()));
   TZSET();
 }
 
 ScopedSetTZ::~ScopedSetTZ() {
-  if (old_tz_.has_value())
+  if (old_tz_.has_value()) {
     CHECK_EQ(0, SETENV(kTZ, old_tz_.value().c_str()));
-  else
+  } else {
     CHECK_EQ(0, UNSETENV(kTZ));
+  }
   TZSET();
 }
diff --git a/testing/test_fonts.cpp b/testing/test_fonts.cpp
index e0b1038..c3b7191 100644
--- a/testing/test_fonts.cpp
+++ b/testing/test_fonts.cpp
@@ -33,11 +33,13 @@
     return face;
   }
 
-  if (face.Contains("Bold"))
+  if (face.Contains("Bold")) {
     result += " Bold";
+  }
 
-  if (face.Contains("Italic") || face.Contains("Oblique"))
+  if (face.Contains("Italic") || face.Contains("Oblique")) {
     result += " Italic";
+  }
 
   return result;
 }
@@ -93,8 +95,9 @@
 }  // namespace
 
 TestFonts::TestFonts() {
-  if (!PathService::GetExecutableDir(&font_path_))
+  if (!PathService::GetExecutableDir(&font_path_)) {
     return;
+  }
   font_path_.push_back(PATH_SEPARATOR);
   font_path_.append("test_fonts");
   font_paths_ = std::vector<const char*>{font_path_.c_str(), nullptr};
diff --git a/testing/test_support.h b/testing/test_support.h
index b5701d7..7a165a4 100644
--- a/testing/test_support.h
+++ b/testing/test_support.h
@@ -12,19 +12,14 @@
 
 namespace pdfium {
 
-#define STR_IN_TEST_CASE(input_literal, ...)         \
-  {                                                  \
-    reinterpret_cast<const uint8_t*>(input_literal), \
-        sizeof(input_literal) - 1, __VA_ARGS__       \
-  }
+#define STR_IN_TEST_CASE(input_literal, ...)                                   \
+  {reinterpret_cast<const uint8_t*>(input_literal), sizeof(input_literal) - 1, \
+   __VA_ARGS__}
 
-#define STR_IN_OUT_CASE(input_literal, expected_literal, ...) \
-  {                                                           \
-    reinterpret_cast<const uint8_t*>(input_literal),          \
-        sizeof(input_literal) - 1,                            \
-        reinterpret_cast<const uint8_t*>(expected_literal),   \
-        sizeof(expected_literal) - 1, __VA_ARGS__             \
-  }
+#define STR_IN_OUT_CASE(input_literal, expected_literal, ...)                  \
+  {reinterpret_cast<const uint8_t*>(input_literal), sizeof(input_literal) - 1, \
+   reinterpret_cast<const uint8_t*>(expected_literal),                         \
+   sizeof(expected_literal) - 1, __VA_ARGS__}
 
 struct StrFuncTestData {
   pdfium::span<const uint8_t> input_span() const {
diff --git a/testing/utils/path_service.cpp b/testing/utils/path_service.cpp
index 1626874..104cefa 100644
--- a/testing/utils/path_service.cpp
+++ b/testing/utils/path_service.cpp
@@ -44,13 +44,15 @@
 bool PathService::DirectoryExists(const std::string& path) {
 #ifdef _WIN32
   DWORD fileattr = GetFileAttributesA(path.c_str());
-  if (fileattr != INVALID_FILE_ATTRIBUTES)
+  if (fileattr != INVALID_FILE_ATTRIBUTES) {
     return (fileattr & FILE_ATTRIBUTE_DIRECTORY) != 0;
+  }
   return false;
 #else
   stat_wrapper_t file_info;
-  if (CallStat(path.c_str(), &file_info) != 0)
+  if (CallStat(path.c_str(), &file_info) != 0) {
     return false;
+  }
   return S_ISDIR(file_info.st_mode);
 #endif
 }
@@ -67,48 +69,56 @@
   char path_buffer[MAX_PATH];
   path_buffer[0] = 0;
 
-  if (GetModuleFileNameA(NULL, path_buffer, MAX_PATH) == 0)
+  if (GetModuleFileNameA(NULL, path_buffer, MAX_PATH) == 0) {
     return false;
+  }
   *path = std::string(path_buffer);
 #elif defined(__APPLE__)
   DCHECK(path);
   unsigned int path_length = 0;
   _NSGetExecutablePath(NULL, &path_length);
-  if (path_length == 0)
+  if (path_length == 0) {
     return false;
+  }
 
   path->reserve(path_length);
   path->resize(path_length - 1);
-  if (_NSGetExecutablePath(&((*path)[0]), &path_length))
+  if (_NSGetExecutablePath(&((*path)[0]), &path_length)) {
     return false;
+  }
 #else   // Linux
   static const char kProcSelfExe[] = "/proc/self/exe";
   char buf[PATH_MAX];
   ssize_t count = ::readlink(kProcSelfExe, buf, PATH_MAX);
-  if (count <= 0)
+  if (count <= 0) {
     return false;
+  }
 
   *path = std::string(buf, count);
 #endif  // _WIN32
 
   // Get the directory path.
   size_t pos = path->size() - 1;
-  if (EndsWithSeparator(*path))
+  if (EndsWithSeparator(*path)) {
     pos--;
+  }
   size_t found = path->find_last_of(PATH_SEPARATOR, pos);
-  if (found == std::string::npos)
+  if (found == std::string::npos) {
     return false;
+  }
   path->resize(found);
   return true;
 }
 
 // static
 bool PathService::GetSourceDir(std::string* path) {
-  if (!GetExecutableDir(path))
+  if (!GetExecutableDir(path)) {
     return false;
+  }
 
-  if (!EndsWithSeparator(*path))
+  if (!EndsWithSeparator(*path)) {
     path->push_back(PATH_SEPARATOR);
+  }
   path->append("..");
   path->push_back(PATH_SEPARATOR);
 #if defined(ANDROID)
@@ -121,11 +131,13 @@
 
 // static
 bool PathService::GetTestDataDir(std::string* path) {
-  if (!GetSourceDir(path))
+  if (!GetSourceDir(path)) {
     return false;
+  }
 
-  if (!EndsWithSeparator(*path))
+  if (!EndsWithSeparator(*path)) {
     path->push_back(PATH_SEPARATOR);
+  }
 
   std::string potential_path = *path;
   potential_path.append("testing");
@@ -169,11 +181,13 @@
 // static
 bool PathService::GetThirdPartyFilePath(const std::string& file_name,
                                         std::string* path) {
-  if (!GetSourceDir(path))
+  if (!GetSourceDir(path)) {
     return false;
+  }
 
-  if (!EndsWithSeparator(*path))
+  if (!EndsWithSeparator(*path)) {
     path->push_back(PATH_SEPARATOR);
+  }
 
   std::string potential_path = *path;
   potential_path.append("third_party");
diff --git a/testing/v8_initializer.cpp b/testing/v8_initializer.cpp
index 613226f..f4e42d3 100644
--- a/testing/v8_initializer.cpp
+++ b/testing/v8_initializer.cpp
@@ -79,8 +79,9 @@
   const char* recommended_v8_flags = FPDF_GetRecommendedV8Flags();
   v8::V8::SetFlagsFromString(recommended_v8_flags);
 
-  if (!js_flags.empty())
+  if (!js_flags.empty()) {
     v8::V8::SetFlagsFromString(js_flags.c_str());
+  }
 
   // By enabling predictable mode, V8 won't post any background tasks.
   // By enabling GC, it makes it easier to chase use-after-free.
@@ -102,8 +103,10 @@
   std::unique_ptr<v8::Platform> platform =
       InitializeV8Common(exe_path, js_flags);
   if (snapshot_blob) {
-    if (!GetExternalData(exe_path, bin_dir, "snapshot_blob.bin", snapshot_blob))
+    if (!GetExternalData(exe_path, bin_dir, "snapshot_blob.bin",
+                         snapshot_blob)) {
       return nullptr;
+    }
     v8::V8::SetSnapshotDataBlob(snapshot_blob);
   }
   return platform;
diff --git a/testing/v8_test_environment.cpp b/testing/v8_test_environment.cpp
index 889dd1e..fdf31b0 100644
--- a/testing/v8_test_environment.cpp
+++ b/testing/v8_test_environment.cpp
@@ -32,8 +32,9 @@
   DCHECK(g_environment);
 
 #ifdef V8_USE_EXTERNAL_STARTUP_DATA
-  if (startup_data_)
+  if (startup_data_) {
     free(const_cast<char*>(startup_data_->data));
+  }
 #endif  // V8_USE_EXTERNAL_STARTUP_DATA
 
   g_environment = nullptr;
@@ -47,8 +48,9 @@
 // static
 void V8TestEnvironment::PumpPlatformMessageLoop(v8::Isolate* isolate) {
   v8::Platform* platform = GetInstance()->platform();
-  while (v8::platform::PumpMessageLoop(platform, isolate))
+  while (v8::platform::PumpMessageLoop(platform, isolate)) {
     continue;
+  }
 }
 
 void V8TestEnvironment::SetUp() {
diff --git a/testing/xfa_js_embedder_test.cpp b/testing/xfa_js_embedder_test.cpp
index 661f967..3368cba 100644
--- a/testing/xfa_js_embedder_test.cpp
+++ b/testing/xfa_js_embedder_test.cpp
@@ -36,16 +36,19 @@
 
 CXFA_Document* XFAJSEmbedderTest::GetXFADocument() const {
   auto* pDoc = CPDFDocumentFromFPDFDocument(document());
-  if (!pDoc)
+  if (!pDoc) {
     return nullptr;
+  }
 
   auto* pContext = static_cast<CPDFXFA_Context*>(pDoc->GetExtension());
-  if (!pContext)
+  if (!pContext) {
     return nullptr;
+  }
 
   CXFA_FFDoc* pFFDoc = pContext->GetXFADoc();
-  if (!pFFDoc)
+  if (!pFFDoc) {
     return nullptr;
+  }
 
   return pFFDoc->GetXFADoc();
 }
@@ -66,8 +69,9 @@
     return false;
   }
   CXFA_Document* pDoc = GetXFADocument();
-  if (!pDoc)
+  if (!pDoc) {
     return false;
+  }
 
   script_context_ = pDoc->GetScriptContext();
   return true;
@@ -76,24 +80,28 @@
 bool XFAJSEmbedderTest::Execute(ByteStringView input) {
   CFXJSE_ScopeUtil_IsolateHandleContext scope(
       script_context_->GetJseContextForTest());
-  if (ExecuteHelper(input))
+  if (ExecuteHelper(input)) {
     return true;
+  }
 
   fprintf(stderr, "FormCalc: %.*s\n", static_cast<int>(input.GetLength()),
           input.unterminated_c_str());
 
   v8::Local<v8::Value> result = GetValue();
-  if (!fxv8::IsArray(result))
+  if (!fxv8::IsArray(result)) {
     return false;
+  }
 
   v8::Local<v8::Value> msg = fxv8::ReentrantGetArrayElementHelper(
       isolate(), result.As<v8::Array>(), 1);
-  if (!fxv8::IsString(msg))
+  if (!fxv8::IsString(msg)) {
     return false;
+  }
 
   WideString str = fxv8::ReentrantToWideStringHelper(isolate(), msg);
-  if (!str.IsEmpty())
+  if (!str.IsEmpty()) {
     fprintf(stderr, "JS ERROR: %ls\n", str.c_str());
+  }
   return false;
 }