Clang-format unit tests
Add back all the curly braces deleted over the years.
Change-Id: I6a48560260c9f9b43091ff66744b83701ea8dea1
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/130090
Reviewed-by: Tom Sepez <tsepez@chromium.org>
Reviewed-by: Thomas Sepez <tsepez@google.com>
Commit-Queue: Lei Zhang <thestig@chromium.org>
diff --git a/core/fdrm/fx_crypt_unittest.cpp b/core/fdrm/fx_crypt_unittest.cpp
index 8b856ff..fe43b39 100644
--- a/core/fdrm/fx_crypt_unittest.cpp
+++ b/core/fdrm/fx_crypt_unittest.cpp
@@ -68,8 +68,9 @@
const uint32_t length = 10 * 1024 * 1024 + 1;
std::vector<uint8_t> data(length);
- for (uint32_t i = 0; i < length; ++i)
+ for (uint32_t i = 0; i < length; ++i) {
data[i] = i & 0xFF;
+ }
uint8_t digest[16];
CRYPT_MD5Generate(data, digest);
@@ -94,8 +95,9 @@
const uint32_t length = 10 * 1024 * 1024 + 1;
std::vector<uint8_t> data(length);
- for (uint32_t i = 0; i < length; ++i)
+ for (uint32_t i = 0; i < length; ++i) {
data[i] = i & 0xFF;
+ }
pdfium::span<const uint8_t> data_span = pdfium::make_span(data);
uint32_t total = 0;
diff --git a/core/fpdfapi/page/cpdf_pageimagecache_unittest.cpp b/core/fpdfapi/page/cpdf_pageimagecache_unittest.cpp
index 9919f738..d6d382a 100644
--- a/core/fpdfapi/page/cpdf_pageimagecache_unittest.cpp
+++ b/core/fpdfapi/page/cpdf_pageimagecache_unittest.cpp
@@ -59,8 +59,9 @@
bool should_continue = page_image_cache->StartGetCachedBitmap(
image->GetImage(), nullptr, page->GetMutablePageResources(), true,
CPDF_ColorSpace::Family::kICCBased, false, {50, 50});
- while (should_continue)
+ while (should_continue) {
should_continue = page_image_cache->Continue(nullptr);
+ }
RetainPtr<CFX_DIBBase> bitmap_small = page_image_cache->DetachCurBitmap();
@@ -68,8 +69,9 @@
should_continue = page_image_cache->StartGetCachedBitmap(
image->GetImage(), nullptr, page->GetMutablePageResources(), true,
CPDF_ColorSpace::Family::kICCBased, false, {100, 100});
- while (should_continue)
+ while (should_continue) {
should_continue = page_image_cache->Continue(nullptr);
+ }
RetainPtr<CFX_DIBBase> bitmap_large = page_image_cache->DetachCurBitmap();
diff --git a/core/fpdfapi/page/cpdf_pageobjectholder_unittest.cpp b/core/fpdfapi/page/cpdf_pageobjectholder_unittest.cpp
index 4bbaafb..356a575 100644
--- a/core/fpdfapi/page/cpdf_pageobjectholder_unittest.cpp
+++ b/core/fpdfapi/page/cpdf_pageobjectholder_unittest.cpp
@@ -28,8 +28,9 @@
// Verify self-comparisions.
for (float c1 : {fMin, 1.0f, 2.0f, fMax, fInf, fNan}) {
for (float c2 : {fMin, 1.0f, 2.0f, fMax, fInf, fNan}) {
- for (BlendMode c3 : {BlendMode::kMultiply, BlendMode::kScreen})
+ for (BlendMode c3 : {BlendMode::kMultiply, BlendMode::kScreen}) {
EXPECT_FALSE(GraphicsData({c1, c2, c3}) < GraphicsData({c1, c2, c3}));
+ }
}
}
@@ -76,8 +77,9 @@
// Erase in forward index permuted order.
for (BlendMode c3 : {BlendMode::kMultiply, BlendMode::kScreen}) {
for (float c2 : {fMin, 1.0f, 2.0f, fMax, fInf, fNan}) {
- for (float c1 : {fMin, 1.0f, 2.0f, fMax, fInf, fNan})
+ for (float c1 : {fMin, 1.0f, 2.0f, fMax, fInf, fNan}) {
graphics_map.erase({c1, c2, c3});
+ }
}
}
EXPECT_EQ(0u, graphics_map.size());
diff --git a/core/fpdfapi/parser/cpdf_array_unittest.cpp b/core/fpdfapi/parser/cpdf_array_unittest.cpp
index 18745d5..28e8f54 100644
--- a/core/fpdfapi/parser/cpdf_array_unittest.cpp
+++ b/core/fpdfapi/parser/cpdf_array_unittest.cpp
@@ -40,8 +40,9 @@
for (const int elem : {1, 2, 3, 4, 5, 6, 7, 8, 9, 10}) {
arr->AppendNew<CPDF_Number>(elem);
}
- for (size_t i = 0; i < 3; ++i)
+ for (size_t i = 0; i < 3; ++i) {
arr->RemoveAt(3);
+ }
static constexpr std::array<int, 7> expected = {{1, 2, 3, 7, 8, 9, 10}};
ASSERT_EQ(expected.size(), arr->size());
for (size_t i = 0; i < expected.size(); ++i) {
@@ -51,8 +52,9 @@
arr->RemoveAt(4);
static constexpr std::array<int, 5> expected2 = {{1, 2, 3, 7, 10}};
ASSERT_EQ(std::size(expected2), arr->size());
- for (size_t i = 0; i < std::size(expected2); ++i)
+ for (size_t i = 0; i < std::size(expected2); ++i) {
EXPECT_EQ(expected2[i], arr->GetIntegerAt(i));
+ }
}
{
// When the range is out of bound, RemoveAt() has no effect.
diff --git a/core/fpdfapi/parser/cpdf_document_unittest.cpp b/core/fpdfapi/parser/cpdf_document_unittest.cpp
index c476d14..1b63258 100644
--- a/core/fpdfapi/parser/cpdf_document_unittest.cpp
+++ b/core/fpdfapi/parser/cpdf_document_unittest.cpp
@@ -287,10 +287,12 @@
std::unique_ptr<CPDF_TestDocumentForPages> document =
std::make_unique<CPDF_TestDocumentForPages>();
document->SetTreeSize(kNumTestPages + 3);
- for (int i = 0; i < kNumTestPages; i++)
+ for (int i = 0; i < kNumTestPages; i++) {
EXPECT_TRUE(document->GetPageDictionary(i));
- for (int i = kNumTestPages; i < kNumTestPages + 4; i++)
+ }
+ for (int i = kNumTestPages; i < kNumTestPages + 4; i++) {
EXPECT_FALSE(document->GetPageDictionary(i));
+ }
EXPECT_TRUE(document->GetPageDictionary(kNumTestPages - 1));
}
@@ -299,8 +301,9 @@
auto pDoc = std::make_unique<CPDF_TestDocPagesWithoutKids>();
EXPECT_TRUE(pDoc->GetPageDictionary(0));
// Test GetPage does not fetch pages out of range
- for (int i = 1; i < 5; i++)
+ for (int i = 1; i < 5; i++) {
EXPECT_FALSE(pDoc->GetPageDictionary(i));
+ }
EXPECT_TRUE(pDoc->GetPageDictionary(0));
}
diff --git a/core/fpdfapi/parser/cpdf_object_avail_unittest.cpp b/core/fpdfapi/parser/cpdf_object_avail_unittest.cpp
index 097cee4..a79687a 100644
--- a/core/fpdfapi/parser/cpdf_object_avail_unittest.cpp
+++ b/core/fpdfapi/parser/cpdf_object_avail_unittest.cpp
@@ -46,8 +46,9 @@
// CPDF_IndirectObjectHolder overrides:
RetainPtr<CPDF_Object> ParseIndirectObject(uint32_t objnum) override {
auto it = objects_data_.find(objnum);
- if (it == objects_data_.end())
+ if (it == objects_data_.end()) {
return nullptr;
+ }
ObjectData& obj_data = it->second;
if (obj_data.state == ObjectState::Unavailable) {
@@ -78,8 +79,9 @@
CPDF_Object* GetTestObject(uint32_t objnum) {
auto it = objects_data_.find(objnum);
- if (it == objects_data_.end())
+ if (it == objects_data_.end()) {
return nullptr;
+ }
return it->second.object.Get();
}
diff --git a/core/fpdfapi/parser/cpdf_object_unittest.cpp b/core/fpdfapi/parser/cpdf_object_unittest.cpp
index 184d448..c8fd175 100644
--- a/core/fpdfapi/parser/cpdf_object_unittest.cpp
+++ b/core/fpdfapi/parser/cpdf_object_unittest.cpp
@@ -116,10 +116,12 @@
}
bool Equal(const CPDF_Object* obj1, const CPDF_Object* obj2) {
- if (obj1 == obj2)
+ if (obj1 == obj2) {
return true;
- if (!obj1 || !obj2 || obj1->GetType() != obj2->GetType())
+ }
+ if (!obj1 || !obj2 || obj1->GetType() != obj2->GetType()) {
return false;
+ }
switch (obj1->GetType()) {
case CPDF_Object::kBoolean:
return obj1->GetInteger() == obj2->GetInteger();
@@ -132,8 +134,9 @@
case CPDF_Object::kArray: {
const CPDF_Array* array1 = obj1->AsArray();
const CPDF_Array* array2 = obj2->AsArray();
- if (array1->size() != array2->size())
+ if (array1->size() != array2->size()) {
return false;
+ }
for (size_t i = 0; i < array1->size(); ++i) {
if (!Equal(array1->GetObjectAt(i).Get(),
array2->GetObjectAt(i).Get())) {
@@ -145,12 +148,15 @@
case CPDF_Object::kDictionary: {
const CPDF_Dictionary* dict1 = obj1->AsDictionary();
const CPDF_Dictionary* dict2 = obj2->AsDictionary();
- if (dict1->size() != dict2->size())
+ if (dict1->size() != dict2->size()) {
return false;
+ }
CPDF_DictionaryLocker locker1(dict1);
for (const auto& item : locker1) {
- if (!Equal(item.second.Get(), dict2->GetObjectFor(item.first).Get()))
+ if (!Equal(item.second.Get(),
+ dict2->GetObjectFor(item.first).Get())) {
return false;
+ }
}
return true;
}
@@ -160,8 +166,9 @@
RetainPtr<const CPDF_Stream> stream1(obj1->AsStream());
RetainPtr<const CPDF_Stream> stream2(obj2->AsStream());
// Compare dictionaries.
- if (!Equal(stream1->GetDict().Get(), stream2->GetDict().Get()))
+ if (!Equal(stream1->GetDict().Get(), stream2->GetDict().Get())) {
return false;
+ }
auto streamAcc1 =
pdfium::MakeRetain<CPDF_StreamAcc>(std::move(stream1));
@@ -173,8 +180,9 @@
pdfium::span<const uint8_t> span2 = streamAcc2->GetSpan();
// Compare sizes.
- if (span1.size() != span2.size())
+ if (span1.size() != span2.size()) {
return false;
+ }
return UNSAFE_TODO(memcmp(span1.data(), span2.data(), span2.size())) ==
0;
@@ -242,8 +250,9 @@
// Check indirect references.
static constexpr auto indirect_obj_results =
fxcrt::ToArray<const float>({0, 1245, 0, 0, 0, 0, 0});
- for (size_t i = 0; i < m_RefObjs.size(); ++i)
+ for (size_t i = 0; i < m_RefObjs.size(); ++i) {
EXPECT_EQ(indirect_obj_results[i], m_RefObjs[i]->GetNumber());
+ }
}
TEST_F(PDFObjectsTest, GetInteger) {
@@ -328,22 +337,26 @@
TEST_F(PDFObjectsTest, GetType) {
// Check for direct objects.
- for (size_t i = 0; i < m_DirectObjs.size(); ++i)
+ for (size_t i = 0; i < m_DirectObjs.size(); ++i) {
EXPECT_EQ(m_DirectObjTypes[i], m_DirectObjs[i]->GetType());
+ }
// Check indirect references.
- for (const auto& it : m_RefObjs)
+ for (const auto& it : m_RefObjs) {
EXPECT_EQ(CPDF_Object::kReference, it->GetType());
+ }
}
TEST_F(PDFObjectsTest, GetDirect) {
// Check for direct objects.
- for (size_t i = 0; i < m_DirectObjs.size(); ++i)
+ for (size_t i = 0; i < m_DirectObjs.size(); ++i) {
EXPECT_EQ(m_DirectObjs[i].Get(), m_DirectObjs[i]->GetDirect());
+ }
// Check indirect references.
- for (size_t i = 0; i < m_RefObjs.size(); ++i)
+ for (size_t i = 0; i < m_RefObjs.size(); ++i) {
EXPECT_EQ(m_IndirectObjNums[i], m_RefObjs[i]->GetDirect()->GetObjNum());
+ }
}
TEST_F(PDFObjectsTest, SetString) {
@@ -587,8 +600,9 @@
{
// Null element array.
auto arr = pdfium::MakeRetain<CPDF_Array>();
- for (size_t i = 0; i < 3; ++i)
+ for (size_t i = 0; i < 3; ++i) {
arr->InsertNewAt<CPDF_Null>(i);
+ }
for (size_t i = 0; i < 3; ++i) {
TestArrayAccessors(arr.Get(), i, // Array and index.
"", // String value.
@@ -737,10 +751,11 @@
EXPECT_EQ(stream_val, arr->GetStreamAt(i));
} else {
EXPECT_FALSE(arr->GetStreamAt(i));
- if (i == 12)
+ if (i == 12) {
EXPECT_EQ(dict_val, arr->GetDictAt(i));
- else
+ } else {
EXPECT_FALSE(arr->GetDictAt(i));
+ }
}
}
}
@@ -813,8 +828,9 @@
indirect_objs[i]->GetObjNum());
}
// Check indirect objects.
- for (size_t i = 0; i < std::size(obj_nums); ++i)
+ for (size_t i = 0; i < std::size(obj_nums); ++i) {
EXPECT_EQ(indirect_objs[i], holder->GetOrParseIndirectObject(obj_nums[i]));
+ }
// Check arrays.
EXPECT_EQ(arr->size(), arr1->size());
for (size_t i = 0; i < arr->size(); ++i) {
diff --git a/core/fpdfapi/parser/cpdf_object_walker_unittest.cpp b/core/fpdfapi/parser/cpdf_object_walker_unittest.cpp
index c558250..761da82 100644
--- a/core/fpdfapi/parser/cpdf_object_walker_unittest.cpp
+++ b/core/fpdfapi/parser/cpdf_object_walker_unittest.cpp
@@ -25,24 +25,25 @@
std::ostringstream result;
CPDF_ObjectWalker walker(std::move(object));
while (RetainPtr<const CPDF_Object> obj = walker.GetNext()) {
- if (obj->IsDictionary())
+ if (obj->IsDictionary()) {
result << " Dict";
- else if (obj->IsArray())
+ } else if (obj->IsArray()) {
result << " Arr";
- else if (obj->IsString())
+ } else if (obj->IsString()) {
result << " Str";
- else if (obj->IsBoolean())
+ } else if (obj->IsBoolean()) {
result << " Bool";
- else if (obj->IsStream())
+ } else if (obj->IsStream()) {
result << " Stream";
- else if (obj->IsReference())
+ } else if (obj->IsReference()) {
result << " Ref";
- else if (obj->IsNumber())
+ } else if (obj->IsNumber()) {
result << " Num";
- else if (obj->IsNull())
+ } else if (obj->IsNull()) {
result << " Null";
- else
+ } else {
result << " Unknown";
+ }
}
std::string result_str = result.str();
if (!result_str.empty()) {
@@ -126,8 +127,9 @@
// skip other array except root.
walker.SkipWalkIntoCurrentObject();
}
- if (!obj->IsArray())
+ if (!obj->IsArray()) {
++non_array_objects;
+ }
}
// 2 objects from child array should be skipped.
EXPECT_EQ(2, non_array_objects);
diff --git a/core/fpdfapi/parser/cpdf_page_object_avail_unittest.cpp b/core/fpdfapi/parser/cpdf_page_object_avail_unittest.cpp
index 82d8004..d909fb2 100644
--- a/core/fpdfapi/parser/cpdf_page_object_avail_unittest.cpp
+++ b/core/fpdfapi/parser/cpdf_page_object_avail_unittest.cpp
@@ -46,8 +46,9 @@
// CPDF_IndirectObjectHolder overrides:
RetainPtr<CPDF_Object> ParseIndirectObject(uint32_t objnum) override {
auto it = objects_data_.find(objnum);
- if (it == objects_data_.end())
+ if (it == objects_data_.end()) {
return nullptr;
+ }
ObjectData& obj_data = it->second;
if (obj_data.state == ObjectState::Unavailable) {
@@ -78,8 +79,9 @@
CPDF_Object* GetTestObject(uint32_t objnum) {
auto it = objects_data_.find(objnum);
- if (it == objects_data_.end())
+ if (it == objects_data_.end()) {
return nullptr;
+ }
return it->second.object.Get();
}
diff --git a/core/fpdfapi/parser/cpdf_parser_unittest.cpp b/core/fpdfapi/parser/cpdf_parser_unittest.cpp
index f6008c4..e273c64 100644
--- a/core/fpdfapi/parser/cpdf_parser_unittest.cpp
+++ b/core/fpdfapi/parser/cpdf_parser_unittest.cpp
@@ -109,8 +109,9 @@
bool InitTestFromFile(const char* path) {
RetainPtr<IFX_SeekableReadStream> pFileAccess =
IFX_SeekableReadStream::CreateFromFilename(path);
- if (!pFileAccess)
+ if (!pFileAccess) {
return false;
+ }
// For the test file, the header is set at the beginning.
SetSyntaxParserForTesting(
diff --git a/core/fpdfdoc/cpdf_annot_unittest.cpp b/core/fpdfdoc/cpdf_annot_unittest.cpp
index a988719..5e2f582 100644
--- a/core/fpdfdoc/cpdf_annot_unittest.cpp
+++ b/core/fpdfdoc/cpdf_annot_unittest.cpp
@@ -16,8 +16,9 @@
RetainPtr<CPDF_Array> CreateQuadPointArrayFromVector(
const std::vector<int>& points) {
auto array = pdfium::MakeRetain<CPDF_Array>();
- for (float point : points)
+ for (float point : points) {
array->AppendNew<CPDF_Number>(point);
+ }
return array;
}
@@ -130,7 +131,8 @@
array->AppendNew<CPDF_Number>(0);
EXPECT_EQ(1u, CPDF_Annot::QuadPointCount(array.Get()));
}
- for (int i = 0; i < 50; ++i)
+ for (int i = 0; i < 50; ++i) {
array->AppendNew<CPDF_Number>(0);
+ }
EXPECT_EQ(8u, CPDF_Annot::QuadPointCount(array.Get()));
}
diff --git a/core/fpdfdoc/cpdf_filespec_unittest.cpp b/core/fpdfdoc/cpdf_filespec_unittest.cpp
index 81ce06a..2b12dbf 100644
--- a/core/fpdfdoc/cpdf_filespec_unittest.cpp
+++ b/core/fpdfdoc/cpdf_filespec_unittest.cpp
@@ -22,33 +22,33 @@
TEST(CPDFFileSpecTest, EncodeDecodeFileName) {
static const std::vector<pdfium::NullTermWstrFuncTestData> test_data = {
- // Empty src string.
- {L"", L""},
- // only file name.
- {L"test.pdf", L"test.pdf"},
+ // Empty src string.
+ {L"", L""},
+ // only file name.
+ {L"test.pdf", L"test.pdf"},
#if BUILDFLAG(IS_WIN)
- // With drive identifier.
- {L"r:\\pdfdocs\\spec.pdf", L"/r/pdfdocs/spec.pdf"},
- // Relative path.
- {L"My Document\\test.pdf", L"My Document/test.pdf"},
- // Absolute path without drive identifier.
- {L"\\pdfdocs\\spec.pdf", L"//pdfdocs/spec.pdf"},
- // Absolute path with double backslashes.
- {L"\\\\pdfdocs\\spec.pdf", L"/pdfdocs/spec.pdf"},
+ // With drive identifier.
+ {L"r:\\pdfdocs\\spec.pdf", L"/r/pdfdocs/spec.pdf"},
+ // Relative path.
+ {L"My Document\\test.pdf", L"My Document/test.pdf"},
+ // Absolute path without drive identifier.
+ {L"\\pdfdocs\\spec.pdf", L"//pdfdocs/spec.pdf"},
+ // Absolute path with double backslashes.
+ {L"\\\\pdfdocs\\spec.pdf", L"/pdfdocs/spec.pdf"},
// Network resource name. It is not supported yet.
// {L"pclib/eng:\\pdfdocs\\spec.pdf", L"/pclib/eng/pdfdocs/spec.pdf"},
#elif BUILDFLAG(IS_APPLE)
- // Absolute path with colon separator.
- {L"Mac HD:PDFDocs:spec.pdf", L"/Mac HD/PDFDocs/spec.pdf"},
- // Relative path with colon separator.
- {L"PDFDocs:spec.pdf", L"PDFDocs/spec.pdf"},
+ // Absolute path with colon separator.
+ {L"Mac HD:PDFDocs:spec.pdf", L"/Mac HD/PDFDocs/spec.pdf"},
+ // Relative path with colon separator.
+ {L"PDFDocs:spec.pdf", L"PDFDocs/spec.pdf"},
#else
- // Relative path.
- {L"./docs/test.pdf", L"./docs/test.pdf"},
- // Relative path with parent dir.
- {L"../test_docs/test.pdf", L"../test_docs/test.pdf"},
- // Absolute path.
- {L"/usr/local/home/test.pdf", L"/usr/local/home/test.pdf"},
+ // Relative path.
+ {L"./docs/test.pdf", L"./docs/test.pdf"},
+ // Relative path with parent dir.
+ {L"../test_docs/test.pdf", L"../test_docs/test.pdf"},
+ // Absolute path.
+ {L"/usr/local/home/test.pdf", L"/usr/local/home/test.pdf"},
#endif
};
for (const auto& data : test_data) {
@@ -63,14 +63,11 @@
// String object.
static const pdfium::NullTermWstrFuncTestData test_data = {
#if BUILDFLAG(IS_WIN)
- L"/C/docs/test.pdf",
- L"C:\\docs\\test.pdf"
+ L"/C/docs/test.pdf", L"C:\\docs\\test.pdf"
#elif BUILDFLAG(IS_APPLE)
- L"/Mac HD/docs/test.pdf",
- L"Mac HD:docs:test.pdf"
+ L"/Mac HD/docs/test.pdf", L"Mac HD:docs:test.pdf"
#else
- L"/docs/test.pdf",
- L"/docs/test.pdf"
+ L"/docs/test.pdf", L"/docs/test.pdf"
#endif
};
auto str_obj = pdfium::MakeRetain<CPDF_String>(nullptr, test_data.input);
diff --git a/core/fxcodec/basic/rle_unittest.cpp b/core/fxcodec/basic/rle_unittest.cpp
index b37a713..b343443 100644
--- a/core/fxcodec/basic/rle_unittest.cpp
+++ b/core/fxcodec/basic/rle_unittest.cpp
@@ -70,8 +70,9 @@
{
// Case 2: Match, non-match
std::array<uint8_t, 260> src_buf_2 = {{2}};
- for (uint16_t i = 128; i < 260; i++)
+ for (uint16_t i = 128; i < 260; i++) {
src_buf_2[i] = static_cast<uint8_t>(i - 125);
+ }
DataVector<uint8_t> dest_buf = BasicModule::RunLengthEncode(src_buf_2);
DataAndBytesConsumed result = RunLengthDecode(dest_buf);
EXPECT_THAT(result.data, ElementsAreArray(src_buf_2));
@@ -79,8 +80,9 @@
{
// Case 3: Non-match, match
std::array<uint8_t, 260> src_buf_3 = {};
- for (uint8_t i = 0; i < 128; i++)
+ for (uint8_t i = 0; i < 128; i++) {
src_buf_3[i] = i;
+ }
DataVector<uint8_t> dest_buf = BasicModule::RunLengthEncode(src_buf_3);
DataAndBytesConsumed result = RunLengthDecode(dest_buf);
EXPECT_THAT(result.data, ElementsAreArray(src_buf_3));
@@ -88,8 +90,9 @@
{
// Case 4: Non-match, non-match
std::array<uint8_t, 260> src_buf_4;
- for (uint16_t i = 0; i < 260; i++)
+ for (uint16_t i = 0; i < 260; i++) {
src_buf_4[i] = static_cast<uint8_t>(i);
+ }
DataVector<uint8_t> dest_buf = BasicModule::RunLengthEncode(src_buf_4);
DataAndBytesConsumed result = RunLengthDecode(dest_buf);
EXPECT_THAT(result.data, ElementsAreArray(src_buf_4));
diff --git a/core/fxcrt/css/cfx_cssstylesheet_unittest.cpp b/core/fxcrt/css/cfx_cssstylesheet_unittest.cpp
index f5f17f1..97f43a3 100644
--- a/core/fxcrt/css/cfx_cssstylesheet_unittest.cpp
+++ b/core/fxcrt/css/cfx_cssstylesheet_unittest.cpp
@@ -95,8 +95,9 @@
static bool HasSelector(CFX_CSSStyleRule* style, WideStringView selector) {
uint32_t hash = FX_HashCode_GetLoweredW(selector);
for (size_t i = 0; i < style->CountSelectorLists(); ++i) {
- if (style->GetSelectorList(i)->name_hash() == hash)
+ if (style->GetSelectorList(i)->name_hash() == hash) {
return true;
+ }
}
return false;
}
diff --git a/core/fxcrt/fx_number_unittest.cpp b/core/fxcrt/fx_number_unittest.cpp
index 9a1d2eb..e79bc3a 100644
--- a/core/fxcrt/fx_number_unittest.cpp
+++ b/core/fxcrt/fx_number_unittest.cpp
@@ -91,11 +91,8 @@
// signed value. This is needed for things like the encryption permissions
// flag (Table 3.20 PDF 1.7 spec)
static constexpr TestCase kNegativeCases[] = {
- {"4294965252", -2044},
- {"4294967247", -49},
- {"4294967248", -48},
- {"4294967292", -4},
- {"4294967295", -1},
+ {"4294965252", -2044}, {"4294967247", -49}, {"4294967248", -48},
+ {"4294967292", -4}, {"4294967295", -1},
};
test_func(kNegativeCases);
}
diff --git a/core/fxge/dib/cfx_dibbase_unittest.cpp b/core/fxge/dib/cfx_dibbase_unittest.cpp
index f6a3a12..b0ba4ce 100644
--- a/core/fxge/dib/cfx_dibbase_unittest.cpp
+++ b/core/fxge/dib/cfx_dibbase_unittest.cpp
@@ -125,8 +125,9 @@
/*dest_top_left=*/{0, 0},
/*overlap_size=*/{400, 300}},
};
- for (const Input& input : kEmptyInputs)
+ for (const Input& input : kEmptyInputs) {
RunOverlapRectTest(bitmap.Get(), input, /*expected_output=*/nullptr);
+ }
const Input kOutOfBoundInputs[] = {
// Source out of bounds on x-axis.
@@ -158,6 +159,7 @@
/*dest_top_left=*/{0, 300},
/*overlap_size=*/{400, 300}},
};
- for (const Input& input : kOutOfBoundInputs)
+ for (const Input& input : kOutOfBoundInputs) {
RunOverlapRectTest(bitmap.Get(), input, /*expected_output=*/nullptr);
+ }
}
diff --git a/fpdfsdk/cpdfsdk_helpers_unittest.cpp b/fpdfsdk/cpdfsdk_helpers_unittest.cpp
index 0118ed5..47a71f8 100644
--- a/fpdfsdk/cpdfsdk_helpers_unittest.cpp
+++ b/fpdfsdk/cpdfsdk_helpers_unittest.cpp
@@ -29,8 +29,9 @@
NulTerminateMaybeCopyAndReturnLength(
to_be_copied,
pdfium::make_span(buf).first(kExpectedToBeCopiedLen)));
- for (char c : buf)
+ for (char c : buf) {
EXPECT_EQ(0x42, c);
+ }
// Buffer should copy over if long enough.
ASSERT_EQ(kExpectedToBeCopiedLen + 1,
diff --git a/fxbarcode/datamatrix/BC_DataMatrixWriter_unittest.cpp b/fxbarcode/datamatrix/BC_DataMatrixWriter_unittest.cpp
index 5f7e8bb..8a5db1b 100644
--- a/fxbarcode/datamatrix/BC_DataMatrixWriter_unittest.cpp
+++ b/fxbarcode/datamatrix/BC_DataMatrixWriter_unittest.cpp
@@ -141,8 +141,9 @@
static constexpr int kMaxInputLength = 2335; // Per spec.
WideString input;
- for (size_t i = 0; i < kMaxInputLength; ++i)
+ for (size_t i = 0; i < kMaxInputLength; ++i) {
input.InsertAtBack(L'a');
+ }
{
static constexpr int kExpectedDimension = 144;
@@ -171,8 +172,9 @@
static constexpr int kMaxInputLength = 3116; // Per spec.
WideString input;
- for (size_t i = 0; i < kMaxInputLength; ++i)
+ for (size_t i = 0; i < kMaxInputLength; ++i) {
input.InsertAtBack(L'1');
+ }
{
static constexpr int kExpectedDimension = 144;
diff --git a/fxjs/xfa/cfxjse_formcalc_context_unittest.cpp b/fxjs/xfa/cfxjse_formcalc_context_unittest.cpp
index ee9437e..3efeb20 100644
--- a/fxjs/xfa/cfxjse_formcalc_context_unittest.cpp
+++ b/fxjs/xfa/cfxjse_formcalc_context_unittest.cpp
@@ -48,8 +48,8 @@
/*bIsStar=*/false);
EXPECT_EQ(result, "barb[+2147483647]");
- result = CFXJSE_FormCalcContext::GenerateSomExpression(
- "bart", 2, -2147483648, /*bIsStar=*/false);
+ result = CFXJSE_FormCalcContext::GenerateSomExpression("bart", 2, -2147483648,
+ /*bIsStar=*/false);
EXPECT_EQ(result, "bart[-0]");
result = CFXJSE_FormCalcContext::GenerateSomExpression("bark", 3, 0,
@@ -68,8 +68,8 @@
/*bIsStar=*/false);
EXPECT_EQ(result, "cars[-2147483647]");
- result = CFXJSE_FormCalcContext::GenerateSomExpression(
- "mars", 3, -2147483648, /*bIsStar=*/false);
+ result = CFXJSE_FormCalcContext::GenerateSomExpression("mars", 3, -2147483648,
+ /*bIsStar=*/false);
EXPECT_EQ(result, "mars[0]");
}
diff --git a/xfa/fde/cfde_textout_unittest.cpp b/xfa/fde/cfde_textout_unittest.cpp
index adfd9dc..e4a4f62 100644
--- a/xfa/fde/cfde_textout_unittest.cpp
+++ b/xfa/fde/cfde_textout_unittest.cpp
@@ -80,8 +80,9 @@
ByteString GetBitmapChecksum() {
CRYPT_md5_context context = CRYPT_MD5Start();
- for (int i = 0; i < bitmap_->GetHeight(); ++i)
+ for (int i = 0; i < bitmap_->GetHeight(); ++i) {
CRYPT_MD5Update(&context, bitmap_->GetScanline(i));
+ }
uint8_t digest[16];
CRYPT_MD5Finish(&context, digest);
return ByteString(CryptToBase16(digest).c_str());
diff --git a/xfa/fgas/layout/cfgas_rtfbreak_unittest.cpp b/xfa/fgas/layout/cfgas_rtfbreak_unittest.cpp
index ec2e8c8..23d2496 100644
--- a/xfa/fgas/layout/cfgas_rtfbreak_unittest.cpp
+++ b/xfa/fgas/layout/cfgas_rtfbreak_unittest.cpp
@@ -42,8 +42,9 @@
TEST_F(CFGASRTFBreakTest, AddChars) {
auto rtf_break = CreateBreak(CFGAS_Break::LayoutStyle::kExpandTab);
WideString str(L"Input String.");
- for (wchar_t ch : str)
+ for (wchar_t ch : str) {
EXPECT_EQ(CFGAS_Char::BreakType::kNone, rtf_break->AppendChar(ch));
+ }
EXPECT_EQ(CFGAS_Char::BreakType::kParagraph, rtf_break->AppendChar(L'\n'));
ASSERT_EQ(1, rtf_break->CountBreakPieces());
@@ -54,8 +55,9 @@
EXPECT_EQ(0, rtf_break->GetCurrentLineForTesting()->GetLineEnd());
str = L"Second str.";
- for (wchar_t ch : str)
+ for (wchar_t ch : str) {
EXPECT_EQ(CFGAS_Char::BreakType::kNone, rtf_break->AppendChar(ch));
+ }
// Force the end of the break at the end of the string.
rtf_break->EndBreak(CFGAS_Char::BreakType::kParagraph);
@@ -83,8 +85,9 @@
// SAFETY: known fixed-length string.
WideString input =
WideString::FromUTF8(UNSAFE_BUFFERS(ByteStringView("\xa\x0\xa\xa", 4)));
- for (wchar_t ch : input)
+ for (wchar_t ch : input) {
rtf_break->AppendChar(ch);
+ }
std::vector<CFGAS_Char> chars =
rtf_break->GetCurrentLineForTesting()->m_LineChars;
diff --git a/xfa/fgas/layout/cfgas_txtbreak_unittest.cpp b/xfa/fgas/layout/cfgas_txtbreak_unittest.cpp
index a8b108d..0e328be 100644
--- a/xfa/fgas/layout/cfgas_txtbreak_unittest.cpp
+++ b/xfa/fgas/layout/cfgas_txtbreak_unittest.cpp
@@ -40,8 +40,9 @@
// SAFETY: known fixed-length string.
WideString input =
WideString::FromUTF8(UNSAFE_BUFFERS(ByteStringView("\xa\x0\xa\xa", 4)));
- for (wchar_t ch : input)
+ for (wchar_t ch : input) {
txt_break->AppendChar(ch);
+ }
std::vector<CFGAS_Char> chars =
txt_break->GetCurrentLineForTesting()->m_LineChars;
diff --git a/xfa/fxfa/formcalc/cxfa_fmexpression_unittest.cpp b/xfa/fxfa/formcalc/cxfa_fmexpression_unittest.cpp
index 33614b5..f68c599 100644
--- a/xfa/fxfa/formcalc/cxfa_fmexpression_unittest.cpp
+++ b/xfa/fxfa/formcalc/cxfa_fmexpression_unittest.cpp
@@ -39,15 +39,17 @@
// Generate the result javascript string.
WideString result = L"sign(";
for (size_t i = 0; i < 50; i++) {
- if (i > 0)
+ if (i > 0) {
result += L", ";
+ }
result += L"pfm_rt.get_";
// Object positions for sign() method.
- if (i == 0 || i == 5 || i == 6)
+ if (i == 0 || i == 5 || i == 6) {
result += L"jsobj(null)";
- else
+ } else {
result += L"val(null)";
+ }
}
result += L")";
diff --git a/xfa/fxfa/formcalc/cxfa_fmlexer_unittest.cpp b/xfa/fxfa/formcalc/cxfa_fmlexer_unittest.cpp
index 6464e09..6b00fac 100644
--- a/xfa/fxfa/formcalc/cxfa_fmlexer_unittest.cpp
+++ b/xfa/fxfa/formcalc/cxfa_fmlexer_unittest.cpp
@@ -2,7 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-
#include "xfa/fxfa/formcalc/cxfa_fmlexer.h"
#include <vector>
diff --git a/xfa/fxfa/parser/cxfa_document_builder_unittest.cpp b/xfa/fxfa/parser/cxfa_document_builder_unittest.cpp
index f541629..acb6161 100644
--- a/xfa/fxfa/parser/cxfa_document_builder_unittest.cpp
+++ b/xfa/fxfa/parser/cxfa_document_builder_unittest.cpp
@@ -32,12 +32,14 @@
CXFA_Node* ParseAndBuild(const RetainPtr<CFX_ReadOnlySpanStream>& stream) {
xml_ = CFX_XMLParser(stream).Parse();
- if (!xml_)
+ if (!xml_) {
return nullptr;
+ }
CXFA_DocumentBuilder builder(doc_);
- if (!builder.BuildDocument(xml_.get(), XFA_PacketType::Config))
+ if (!builder.BuildDocument(xml_.get(), XFA_PacketType::Config)) {
return nullptr;
+ }
return builder.GetRootNode();
}
diff --git a/xfa/fxfa/parser/cxfa_nodeiteratortemplate_unittest.cpp b/xfa/fxfa/parser/cxfa_nodeiteratortemplate_unittest.cpp
index b4740bf..84fe0fb 100644
--- a/xfa/fxfa/parser/cxfa_nodeiteratortemplate_unittest.cpp
+++ b/xfa/fxfa/parser/cxfa_nodeiteratortemplate_unittest.cpp
@@ -29,8 +29,9 @@
explicit Node(Node* parent) : parent_(parent) {
if (parent) {
- if (!parent->children_.empty())
+ if (!parent->children_.empty()) {
parent->children_.back()->next_sibling_ = this;
+ }
parent->children_.push_back(this);
}
}