Resolve some simple clang-tidy warnings.
These include:
- use of nullptr
- use of `= default` for trivial methods
- use of nested namespaces
- use of emplace_back()
- matching /*variable=*/ comments with actual name.
Change-Id: I8a0639f442fd0fed39d3061b83d855302d7b7d7e
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/111170
Reviewed-by: Lei Zhang <thestig@chromium.org>
Commit-Queue: Tom Sepez <tsepez@chromium.org>
diff --git a/constants/annotation_common.cpp b/constants/annotation_common.cpp
index 6110e38..396e655 100644
--- a/constants/annotation_common.cpp
+++ b/constants/annotation_common.cpp
@@ -4,8 +4,7 @@
#include "constants/annotation_common.h"
-namespace pdfium {
-namespace annotation {
+namespace pdfium::annotation {
// PDF 1.7 spec, table 8.15.
// Entries common to all annotation dictionaries.
@@ -33,5 +32,4 @@
// Entries for line annotations
const char kL[] = "L";
-} // namespace annotation
-} // namespace pdfium
+} // namespace pdfium::annotation
diff --git a/constants/appearance.cpp b/constants/appearance.cpp
index 3ccdddd..d8fdb93 100644
--- a/constants/appearance.cpp
+++ b/constants/appearance.cpp
@@ -4,8 +4,7 @@
#include "constants/appearance.h"
-namespace pdfium {
-namespace appearance {
+namespace pdfium::appearance {
// ISO 32000-1:2008 spec, table 189.
// Entries in an appearance characteristics dictionary.
@@ -19,5 +18,4 @@
const char kRI[] = "RI";
const char kIX[] = "IX";
-} // namespace appearance
-} // namespace pdfium
+} // namespace pdfium::appearance
diff --git a/constants/font_encodings.cpp b/constants/font_encodings.cpp
index 4359701..9b2d09f 100644
--- a/constants/font_encodings.cpp
+++ b/constants/font_encodings.cpp
@@ -4,8 +4,7 @@
#include "constants/font_encodings.h"
-namespace pdfium {
-namespace font_encodings {
+namespace pdfium::font_encodings {
// ISO 32000-1:2008 spec, table D1.
const char kMacRomanEncoding[] = "MacRomanEncoding";
@@ -13,5 +12,4 @@
const char kPDFDocEncoding[] = "PDFDocEncoding";
const char kMacExpertEncoding[] = "MacExpertEncoding";
-} // namespace font_encodings
-} // namespace pdfium
+} // namespace pdfium::font_encodings
diff --git a/constants/form_fields.cpp b/constants/form_fields.cpp
index 32ef84c..84531fb 100644
--- a/constants/form_fields.cpp
+++ b/constants/form_fields.cpp
@@ -4,8 +4,7 @@
#include "constants/form_fields.h"
-namespace pdfium {
-namespace form_fields {
+namespace pdfium::form_fields {
// ISO 32000-1:2008 table 220.
// Entries common to all field dictionaries.
@@ -34,5 +33,4 @@
const char kDS[] = "DS";
const char kRV[] = "RV";
-} // namespace form_fields
-} // namespace pdfium
+} // namespace pdfium::form_fields
diff --git a/constants/page_object.cpp b/constants/page_object.cpp
index 0a3e068..45d3020 100644
--- a/constants/page_object.cpp
+++ b/constants/page_object.cpp
@@ -4,8 +4,7 @@
#include "constants/page_object.h"
-namespace pdfium {
-namespace page_object {
+namespace pdfium::page_object {
// PDF 1.7 spec, table 3.27.
// Entries in a page object.
@@ -20,5 +19,4 @@
const char kContents[] = "Contents";
const char kRotate[] = "Rotate";
-} // namespace page_object
-} // namespace pdfium
+} // namespace pdfium::page_object
diff --git a/constants/stream_dict_common.cpp b/constants/stream_dict_common.cpp
index 5d294c4..42b0fd9 100644
--- a/constants/stream_dict_common.cpp
+++ b/constants/stream_dict_common.cpp
@@ -4,8 +4,7 @@
#include "constants/stream_dict_common.h"
-namespace pdfium {
-namespace stream {
+namespace pdfium::stream {
// PDF 1.7 spec, table 3.4.
// Entries common to all stream dictionaries.
@@ -18,5 +17,4 @@
const char kF[] = "F";
const char kDL[] = "DL";
-} // namespace stream
-} // namespace pdfium
+} // namespace pdfium::stream
diff --git a/constants/transparency.cpp b/constants/transparency.cpp
index 11b8703..c25ae6f 100644
--- a/constants/transparency.cpp
+++ b/constants/transparency.cpp
@@ -4,8 +4,7 @@
#include "constants/transparency.h"
-namespace pdfium {
-namespace transparency {
+namespace pdfium::transparency {
// PDF 1.7 spec, table 7.2.
// Standard separable blend modes.
@@ -44,5 +43,4 @@
const char kCS[] = "CS";
const char kI[] = "I";
-} // namespace transparency
-} // namespace pdfium
+} // namespace pdfium::transparency
diff --git a/core/fpdfapi/page/cpdf_colorstate.cpp b/core/fpdfapi/page/cpdf_colorstate.cpp
index a03fd43..8d94627 100644
--- a/core/fpdfapi/page/cpdf_colorstate.cpp
+++ b/core/fpdfapi/page/cpdf_colorstate.cpp
@@ -16,8 +16,7 @@
CPDF_ColorState::CPDF_ColorState() = default;
-CPDF_ColorState::CPDF_ColorState(const CPDF_ColorState& that)
- : m_Ref(that.m_Ref) {}
+CPDF_ColorState::CPDF_ColorState(const CPDF_ColorState& that) = default;
CPDF_ColorState::~CPDF_ColorState() = default;
diff --git a/core/fpdfapi/page/cpdf_generalstate.cpp b/core/fpdfapi/page/cpdf_generalstate.cpp
index 8ebefa3..7c4d4d6 100644
--- a/core/fpdfapi/page/cpdf_generalstate.cpp
+++ b/core/fpdfapi/page/cpdf_generalstate.cpp
@@ -71,8 +71,7 @@
CPDF_GeneralState::CPDF_GeneralState() = default;
-CPDF_GeneralState::CPDF_GeneralState(const CPDF_GeneralState& that)
- : m_Ref(that.m_Ref) {}
+CPDF_GeneralState::CPDF_GeneralState(const CPDF_GeneralState& that) = default;
CPDF_GeneralState::~CPDF_GeneralState() = default;
diff --git a/core/fpdfapi/page/cpdf_path.cpp b/core/fpdfapi/page/cpdf_path.cpp
index cec8175..edb6997 100644
--- a/core/fpdfapi/page/cpdf_path.cpp
+++ b/core/fpdfapi/page/cpdf_path.cpp
@@ -8,7 +8,7 @@
CPDF_Path::CPDF_Path() = default;
-CPDF_Path::CPDF_Path(const CPDF_Path& that) : m_Ref(that.m_Ref) {}
+CPDF_Path::CPDF_Path(const CPDF_Path& that) = default;
CPDF_Path::~CPDF_Path() = default;
diff --git a/core/fpdfapi/page/cpdf_streamcontentparser.cpp b/core/fpdfapi/page/cpdf_streamcontentparser.cpp
index cae9d72..3ed5414 100644
--- a/core/fpdfapi/page/cpdf_streamcontentparser.cpp
+++ b/core/fpdfapi/page/cpdf_streamcontentparser.cpp
@@ -654,8 +654,7 @@
if (m_pSyntax->GetWord() == "EI")
break;
}
- CPDF_ImageObject* pObj =
- AddImageFromStream(std::move(pStream), /*resource_name=*/"");
+ 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())
diff --git a/core/fpdfapi/render/cpdf_type3glyphmap.cpp b/core/fpdfapi/render/cpdf_type3glyphmap.cpp
index 10b2b4a..54120ba 100644
--- a/core/fpdfapi/render/cpdf_type3glyphmap.cpp
+++ b/core/fpdfapi/render/cpdf_type3glyphmap.cpp
@@ -39,7 +39,7 @@
} // namespace
-CPDF_Type3GlyphMap::CPDF_Type3GlyphMap() {}
+CPDF_Type3GlyphMap::CPDF_Type3GlyphMap() = default;
CPDF_Type3GlyphMap::~CPDF_Type3GlyphMap() = default;
diff --git a/core/fxcodec/jbig2/JBig2_Context.cpp b/core/fxcodec/jbig2/JBig2_Context.cpp
index 0d9028e..6ad10d8 100644
--- a/core/fxcodec/jbig2/JBig2_Context.cpp
+++ b/core/fxcodec/jbig2/JBig2_Context.cpp
@@ -529,8 +529,7 @@
++it) {
if (it->first == key) {
pSegment->m_SymbolDict = it->second->DeepCopy();
- m_pSymbolDictCache->push_front(
- CJBig2_CachePair(key, std::move(it->second)));
+ m_pSymbolDictCache->emplace_front(key, std::move(it->second));
m_pSymbolDictCache->erase(it);
cache_hit = true;
break;
@@ -563,7 +562,7 @@
m_pSymbolDictCache->pop_back();
--size;
}
- m_pSymbolDictCache->push_front(CJBig2_CachePair(key, std::move(value)));
+ m_pSymbolDictCache->emplace_front(key, std::move(value));
}
}
if (wFlags & 0x0200) {
diff --git a/core/fxcodec/jbig2/JBig2_SymbolDict.cpp b/core/fxcodec/jbig2/JBig2_SymbolDict.cpp
index 431441d..70413ae 100644
--- a/core/fxcodec/jbig2/JBig2_SymbolDict.cpp
+++ b/core/fxcodec/jbig2/JBig2_SymbolDict.cpp
@@ -8,7 +8,7 @@
#include "core/fxcodec/jbig2/JBig2_Image.h"
-CJBig2_SymbolDict::CJBig2_SymbolDict() {}
+CJBig2_SymbolDict::CJBig2_SymbolDict() = default;
CJBig2_SymbolDict::~CJBig2_SymbolDict() = default;
diff --git a/core/fxcrt/bytestring.cpp b/core/fxcrt/bytestring.cpp
index d2ba60e..b98e20d 100644
--- a/core/fxcrt/bytestring.cpp
+++ b/core/fxcrt/bytestring.cpp
@@ -126,7 +126,7 @@
ByteString::ByteString() = default;
-ByteString::ByteString(const ByteString& other) : m_pData(other.m_pData) {}
+ByteString::ByteString(const ByteString& other) = default;
ByteString::ByteString(ByteString&& other) noexcept {
m_pData.Swap(other.m_pData);
diff --git a/core/fxcrt/css/cfx_csscustomproperty.cpp b/core/fxcrt/css/cfx_csscustomproperty.cpp
index f07887b..6721e9a 100644
--- a/core/fxcrt/css/cfx_csscustomproperty.cpp
+++ b/core/fxcrt/css/cfx_csscustomproperty.cpp
@@ -8,7 +8,7 @@
const WideString& value)
: name_(name), value_(value) {}
-CFX_CSSCustomProperty::CFX_CSSCustomProperty(const CFX_CSSCustomProperty& prop)
- : name_(prop.name_), value_(prop.value_) {}
+CFX_CSSCustomProperty::CFX_CSSCustomProperty(
+ const CFX_CSSCustomProperty& prop) = default;
CFX_CSSCustomProperty::~CFX_CSSCustomProperty() = default;
diff --git a/core/fxcrt/fx_memory.cpp b/core/fxcrt/fx_memory.cpp
index 7b6aa34..0d978b6 100644
--- a/core/fxcrt/fx_memory.cpp
+++ b/core/fxcrt/fx_memory.cpp
@@ -52,8 +52,7 @@
abort();
}
-namespace pdfium {
-namespace internal {
+namespace pdfium::internal {
void* AllocOrDie(size_t num_members, size_t member_size) {
void* result = Alloc(num_members, member_size);
@@ -99,5 +98,5 @@
return result;
}
-} // namespace internal
-} // namespace pdfium
+
+} // namespace pdfium::internal
diff --git a/core/fxcrt/fx_memory_pa.cpp b/core/fxcrt/fx_memory_pa.cpp
index 789f68c..2473fbc 100644
--- a/core/fxcrt/fx_memory_pa.cpp
+++ b/core/fxcrt/fx_memory_pa.cpp
@@ -40,8 +40,7 @@
} // namespace
-namespace pdfium {
-namespace internal {
+namespace pdfium::internal {
void* Alloc(size_t num_members, size_t member_size) {
FX_SAFE_SIZE_T total = member_size;
@@ -116,8 +115,7 @@
}
}
-} // namespace internal
-} // namespace pdfium
+} // namespace pdfium::internal
void FX_InitializeMemoryAllocators() {
static bool s_partition_allocators_initialized = false;
diff --git a/core/fxcrt/fx_random.cpp b/core/fxcrt/fx_random.cpp
index cc40efc..8a8182d 100644
--- a/core/fxcrt/fx_random.cpp
+++ b/core/fxcrt/fx_random.cpp
@@ -59,7 +59,7 @@
seed ^= GetCurrentProcessId();
#else
struct timeval tv;
- gettimeofday(&tv, 0);
+ gettimeofday(&tv, nullptr);
seed ^= static_cast<uint32_t>(tv.tv_sec) * 1000000;
seed ^= static_cast<uint32_t>(tv.tv_usec);
seed ^= static_cast<uint32_t>(getpid());
diff --git a/core/fxcrt/fx_unicode.cpp b/core/fxcrt/fx_unicode.cpp
index e3fb97b..fe27d7b 100644
--- a/core/fxcrt/fx_unicode.cpp
+++ b/core/fxcrt/fx_unicode.cpp
@@ -138,8 +138,7 @@
} // namespace
-namespace pdfium {
-namespace unicode {
+namespace pdfium::unicode {
wchar_t GetMirrorChar(wchar_t wch) {
uint16_t prop = GetUnicodeProperties(wch);
@@ -173,5 +172,4 @@
}
#endif // PDF_ENABLE_XFA
-} // namespace unicode
-} // namespace pdfium
+} // namespace pdfium::unicode
diff --git a/core/fxcrt/widestring.cpp b/core/fxcrt/widestring.cpp
index 241e544..9d0b956 100644
--- a/core/fxcrt/widestring.cpp
+++ b/core/fxcrt/widestring.cpp
@@ -330,7 +330,7 @@
WideString::WideString() = default;
-WideString::WideString(const WideString& other) : m_pData(other.m_pData) {}
+WideString::WideString(const WideString& other) = default;
WideString::WideString(WideString&& other) noexcept {
m_pData.Swap(other.m_pData);
diff --git a/core/fxge/cfx_fontmapper.cpp b/core/fxge/cfx_fontmapper.cpp
index 63173b6..96af1411 100644
--- a/core/fxge/cfx_fontmapper.cpp
+++ b/core/fxge/cfx_fontmapper.cpp
@@ -460,7 +460,7 @@
ScopedFontDeleter scoped_font(m_pFontInfo.get(), font_handle);
ByteString new_name = GetPSNameFromTT(font_handle);
if (!new_name.IsEmpty())
- m_LocalizedTTFonts.push_back(std::make_pair(new_name, name));
+ m_LocalizedTTFonts.emplace_back(new_name, name);
}
m_InstalledTTFonts.push_back(name);
m_LastFamily = name;
diff --git a/core/fxge/cfx_graphstate.cpp b/core/fxge/cfx_graphstate.cpp
index 18f32a3..69b6b2f 100644
--- a/core/fxge/cfx_graphstate.cpp
+++ b/core/fxge/cfx_graphstate.cpp
@@ -10,8 +10,7 @@
CFX_GraphState::CFX_GraphState() = default;
-CFX_GraphState::CFX_GraphState(const CFX_GraphState& that)
- : m_Ref(that.m_Ref) {}
+CFX_GraphState::CFX_GraphState(const CFX_GraphState& that) = default;
CFX_GraphState::~CFX_GraphState() = default;
diff --git a/core/fxge/cfx_path.cpp b/core/fxge/cfx_path.cpp
index d52c21e..43a807b 100644
--- a/core/fxge/cfx_path.cpp
+++ b/core/fxge/cfx_path.cpp
@@ -288,11 +288,11 @@
}
void CFX_Path::AppendPoint(const CFX_PointF& point, Point::Type type) {
- m_Points.push_back(Point(point, type, /*close=*/false));
+ m_Points.emplace_back(point, type, /*close=*/false);
}
void CFX_Path::AppendPointAndClose(const CFX_PointF& point, Point::Type type) {
- m_Points.push_back(Point(point, type, /*close=*/true));
+ m_Points.emplace_back(point, type, /*close=*/true);
}
void CFX_Path::AppendLine(const CFX_PointF& pt1, const CFX_PointF& pt2) {
diff --git a/core/fxge/scoped_font_transform.cpp b/core/fxge/scoped_font_transform.cpp
index 76626b3..0db3c86 100644
--- a/core/fxge/scoped_font_transform.cpp
+++ b/core/fxge/scoped_font_transform.cpp
@@ -16,7 +16,7 @@
matrix.xy = 0;
matrix.yx = 0;
matrix.yy = 0x10000L;
- FT_Set_Transform(face, &matrix, 0);
+ FT_Set_Transform(face, &matrix, nullptr);
}
} // namespace
@@ -24,7 +24,7 @@
ScopedFontTransform::ScopedFontTransform(RetainPtr<CFX_Face> face,
FT_Matrix* matrix)
: m_Face(std::move(face)) {
- FT_Set_Transform(m_Face->GetRec(), matrix, 0);
+ FT_Set_Transform(m_Face->GetRec(), matrix, nullptr);
}
ScopedFontTransform::~ScopedFontTransform() {
diff --git a/core/fxge/skia/fx_skia_device.cpp b/core/fxge/skia/fx_skia_device.cpp
index 6bff316..8e4521a 100644
--- a/core/fxge/skia/fx_skia_device.cpp
+++ b/core/fxge/skia/fx_skia_device.cpp
@@ -1320,7 +1320,7 @@
colors[i] = SkColorSetARGB(0xFF, (U8CPU)(r * 255), (U8CPU)(g * 255),
(U8CPU)(b * 255));
}
- m_pCanvas->drawPatch(cubics, colors, /*textCoords=*/nullptr,
+ m_pCanvas->drawPatch(cubics, colors, /*texCoords=*/nullptr,
SkBlendMode::kDst, paint);
}
return true;
diff --git a/fpdfsdk/fpdf_dataavail_embeddertest.cpp b/fpdfsdk/fpdf_dataavail_embeddertest.cpp
index e03f2ac..55e7705 100644
--- a/fpdfsdk/fpdf_dataavail_embeddertest.cpp
+++ b/fpdfsdk/fpdf_dataavail_embeddertest.cpp
@@ -114,7 +114,7 @@
}
void AddSegmentImpl(size_t offset, size_t size) {
- requested_segments_.push_back(std::make_pair(offset, size));
+ requested_segments_.emplace_back(offset, size);
max_requested_bound_ = std::max(max_requested_bound_, offset + size);
}
diff --git a/fpdfsdk/pwl/cpwl_edit_impl.cpp b/fpdfsdk/pwl/cpwl_edit_impl.cpp
index 37ec306..ba4f43d 100644
--- a/fpdfsdk/pwl/cpwl_edit_impl.cpp
+++ b/fpdfsdk/pwl/cpwl_edit_impl.cpp
@@ -142,7 +142,7 @@
void CPWL_EditImpl::RefreshState::Push(const CPVT_WordRange& linerange,
const CFX_FloatRect& rect) {
- m_NewLineRects.emplace_back(LineRect(linerange, rect));
+ m_NewLineRects.emplace_back(linerange, rect);
}
void CPWL_EditImpl::RefreshState::NoAnalyse() {
@@ -167,7 +167,7 @@
if (rect.Contains(new_rect))
return;
}
- m_RefreshRects.emplace_back(CFX_FloatRect(new_rect));
+ m_RefreshRects.push_back(new_rect);
}
CPWL_EditImpl::UndoStack::UndoStack() = default;
diff --git a/fxjs/cjs_display.cpp b/fxjs/cjs_display.cpp
index 0e0ee26..4d15d15 100644
--- a/fxjs/cjs_display.cpp
+++ b/fxjs/cjs_display.cpp
@@ -7,10 +7,10 @@
#include "fxjs/cjs_display.h"
const JSConstSpec CJS_Display::ConstSpecs[] = {
- {"visible", JSConstSpec::Number, 0, 0},
- {"hidden", JSConstSpec::Number, 1, 0},
- {"noPrint", JSConstSpec::Number, 2, 0},
- {"noView", JSConstSpec::Number, 3, 0}};
+ {"visible", JSConstSpec::Number, 0, nullptr},
+ {"hidden", JSConstSpec::Number, 1, nullptr},
+ {"noPrint", JSConstSpec::Number, 2, nullptr},
+ {"noView", JSConstSpec::Number, 3, nullptr}};
uint32_t CJS_Display::ObjDefnID = 0;
diff --git a/fxjs/cjs_position.cpp b/fxjs/cjs_position.cpp
index ccf4fe6..7c40525 100644
--- a/fxjs/cjs_position.cpp
+++ b/fxjs/cjs_position.cpp
@@ -7,13 +7,13 @@
#include "fxjs/cjs_position.h"
const JSConstSpec CJS_Position::ConstSpecs[] = {
- {"textOnly", JSConstSpec::Number, 0, 0},
- {"iconOnly", JSConstSpec::Number, 1, 0},
- {"iconTextV", JSConstSpec::Number, 2, 0},
- {"textIconV", JSConstSpec::Number, 3, 0},
- {"iconTextH", JSConstSpec::Number, 4, 0},
- {"textIconH", JSConstSpec::Number, 5, 0},
- {"overlay", JSConstSpec::Number, 6, 0}};
+ {"textOnly", JSConstSpec::Number, 0, nullptr},
+ {"iconOnly", JSConstSpec::Number, 1, nullptr},
+ {"iconTextV", JSConstSpec::Number, 2, nullptr},
+ {"textIconV", JSConstSpec::Number, 3, nullptr},
+ {"iconTextH", JSConstSpec::Number, 4, nullptr},
+ {"textIconH", JSConstSpec::Number, 5, nullptr},
+ {"overlay", JSConstSpec::Number, 6, nullptr}};
uint32_t CJS_Position::ObjDefnID = 0;
diff --git a/fxjs/cjs_scalewhen.cpp b/fxjs/cjs_scalewhen.cpp
index e8a3dd4..c562277 100644
--- a/fxjs/cjs_scalewhen.cpp
+++ b/fxjs/cjs_scalewhen.cpp
@@ -7,10 +7,10 @@
#include "fxjs/cjs_scalewhen.h"
const JSConstSpec CJS_ScaleWhen::ConstSpecs[] = {
- {"always", JSConstSpec::Number, 0, 0},
- {"never", JSConstSpec::Number, 1, 0},
- {"tooBig", JSConstSpec::Number, 2, 0},
- {"tooSmall", JSConstSpec::Number, 3, 0}};
+ {"always", JSConstSpec::Number, 0, nullptr},
+ {"never", JSConstSpec::Number, 1, nullptr},
+ {"tooBig", JSConstSpec::Number, 2, nullptr},
+ {"tooSmall", JSConstSpec::Number, 3, nullptr}};
uint32_t CJS_ScaleWhen::ObjDefnID = 0;
diff --git a/fxjs/xfa/cfxjse_class.cpp b/fxjs/xfa/cfxjse_class.cpp
index c600bd7..d0668f4 100644
--- a/fxjs/xfa/cfxjse_class.cpp
+++ b/fxjs/xfa/cfxjse_class.cpp
@@ -286,7 +286,7 @@
pClass->m_pClassDescriptor = pClassDescriptor;
CFXJSE_ScopeUtil_IsolateHandleRootContext scope(pIsolate);
v8::Local<v8::FunctionTemplate> hFunctionTemplate = v8::FunctionTemplate::New(
- pIsolate, bIsJSGlobal ? 0 : V8ConstructorCallback_Wrapper,
+ pIsolate, bIsJSGlobal ? nullptr : V8ConstructorCallback_Wrapper,
v8::External::New(pIsolate,
const_cast<FXJSE_CLASS_DESCRIPTOR*>(pClassDescriptor)));
v8::Local<v8::String> classname =
diff --git a/fxjs/xfa/cfxjse_runtimedata.cpp b/fxjs/xfa/cfxjse_runtimedata.cpp
index b6a24c4..39feeff 100644
--- a/fxjs/xfa/cfxjse_runtimedata.cpp
+++ b/fxjs/xfa/cfxjse_runtimedata.cpp
@@ -36,7 +36,7 @@
fxv8::NewStringHelper(pIsolate, "global"));
v8::Local<v8::Context> hContext =
- v8::Context::New(pIsolate, 0, hGlobalTemplate);
+ v8::Context::New(pIsolate, nullptr, hGlobalTemplate);
DCHECK_EQ(hContext->Global()->InternalFieldCount(), 0);
DCHECK_EQ(
diff --git a/fxjs/xfa/fxjse.cpp b/fxjs/xfa/fxjse.cpp
index d03ca7e..e218218 100644
--- a/fxjs/xfa/fxjse.cpp
+++ b/fxjs/xfa/fxjse.cpp
@@ -12,14 +12,12 @@
#include "v8/include/v8-object.h"
#include "v8/include/v8-template.h"
-namespace pdfium {
-namespace fxjse {
+namespace pdfium::fxjse {
const char kFuncTag[] = "function descriptor tag";
const char kClassTag[] = "class descriptor tag";
-} // namespace fxjse
-} // namespace pdfium
+} // namespace pdfium::fxjse
// static
CFXJSE_HostObject* CFXJSE_HostObject::FromV8(v8::Local<v8::Value> arg) {
diff --git a/testing/fuzzers/pdf_bidi_fuzzer.cc b/testing/fuzzers/pdf_bidi_fuzzer.cc
index c0ca776..ffa6558 100644
--- a/testing/fuzzers/pdf_bidi_fuzzer.cc
+++ b/testing/fuzzers/pdf_bidi_fuzzer.cc
@@ -19,7 +19,7 @@
auto font = std::make_unique<CFX_Font>();
font->LoadSubst("Arial", true, 0, FXFONT_FW_NORMAL, 0, FX_CodePage::kDefANSI,
- 0);
+ false);
assert(font);
CFGAS_RTFBreak rtf_break(CFGAS_Break::LayoutStyle::kExpandTab);
diff --git a/testing/fuzzers/pdf_hint_table_fuzzer.cc b/testing/fuzzers/pdf_hint_table_fuzzer.cc
index 1351a04..a90199c 100644
--- a/testing/fuzzers/pdf_hint_table_fuzzer.cc
+++ b/testing/fuzzers/pdf_hint_table_fuzzer.cc
@@ -27,7 +27,7 @@
int shared_hint_table_offset)
: CPDF_HintTables(nullptr, pLinearized),
shared_hint_table_offset_(shared_hint_table_offset) {}
- ~HintTableForFuzzing() = default;
+ ~HintTableForFuzzing() override = default;
void Fuzz(const uint8_t* data, size_t size) {
if (shared_hint_table_offset_ <= 0)
diff --git a/testing/test_fonts.cpp b/testing/test_fonts.cpp
index e3b6559..3a096a9 100644
--- a/testing/test_fonts.cpp
+++ b/testing/test_fonts.cpp
@@ -46,7 +46,7 @@
public:
explicit SystemFontInfoWrapper(std::unique_ptr<SystemFontInfoIface> impl)
: impl_(std::move(impl)) {}
- ~SystemFontInfoWrapper() { CHECK(active_fonts_.empty()); }
+ ~SystemFontInfoWrapper() override { CHECK(active_fonts_.empty()); }
bool EnumFontList(CFX_FontMapper* pMapper) override {
return impl_->EnumFontList(pMapper);
diff --git a/xfa/fde/cfde_textout.cpp b/xfa/fde/cfde_textout.cpp
index d7582d8..be60c3a 100644
--- a/xfa/fde/cfde_textout.cpp
+++ b/xfa/fde/cfde_textout.cpp
@@ -527,8 +527,7 @@
CFDE_TextOut::Line::Line() = default;
-CFDE_TextOut::Line::Line(const Line& that)
- : new_reload_(that.new_reload_), pieces_(that.pieces_) {}
+CFDE_TextOut::Line::Line(const Line& that) = default;
CFDE_TextOut::Line::~Line() = default;
diff --git a/xfa/fgas/graphics/cfgas_gegraphics.cpp b/xfa/fgas/graphics/cfgas_gegraphics.cpp
index cb2b959..6f255d6 100644
--- a/xfa/fgas/graphics/cfgas_gegraphics.cpp
+++ b/xfa/fgas/graphics/cfgas_gegraphics.cpp
@@ -412,22 +412,10 @@
CFGAS_GEGraphics::TInfo::TInfo() = default;
-CFGAS_GEGraphics::TInfo::TInfo(const TInfo& info)
- : graphState(info.graphState),
- CTM(info.CTM),
- isActOnDash(info.isActOnDash),
- strokeColor(info.strokeColor),
- fillColor(info.fillColor) {}
+CFGAS_GEGraphics::TInfo::TInfo(const TInfo& info) = default;
CFGAS_GEGraphics::TInfo& CFGAS_GEGraphics::TInfo::operator=(
- const TInfo& other) {
- graphState = other.graphState;
- CTM = other.CTM;
- isActOnDash = other.isActOnDash;
- strokeColor = other.strokeColor;
- fillColor = other.fillColor;
- return *this;
-}
+ const TInfo& other) = default;
CFGAS_GEGraphics::StateRestorer::StateRestorer(CFGAS_GEGraphics* graphics)
: graphics_(graphics) {
diff --git a/xfa/fgas/layout/fgas_arabic.cpp b/xfa/fgas/layout/fgas_arabic.cpp
index 434f195..172c3ed 100644
--- a/xfa/fgas/layout/fgas_arabic.cpp
+++ b/xfa/fgas/layout/fgas_arabic.cpp
@@ -168,8 +168,7 @@
} // namespace
-namespace pdfium {
-namespace arabic {
+namespace pdfium::arabic {
wchar_t GetFormChar(wchar_t wch, wchar_t prev, wchar_t next) {
CFGAS_Char c(wch);
@@ -220,5 +219,4 @@
return kShaddaTable[shadda - kFirstShaddaTableEntry];
}
-} // namespace arabic
-} // namespace pdfium
+} // namespace pdfium::arabic
diff --git a/xfa/fxfa/formcalc/cxfa_fmexpression.cpp b/xfa/fxfa/formcalc/cxfa_fmexpression.cpp
index ca4de2c..2b2f089 100644
--- a/xfa/fxfa/formcalc/cxfa_fmexpression.cpp
+++ b/xfa/fxfa/formcalc/cxfa_fmexpression.cpp
@@ -1042,7 +1042,7 @@
return !CXFA_IsTooBig(*js);
}
-CXFA_FMBreakExpression::CXFA_FMBreakExpression() : CXFA_FMExpression() {}
+CXFA_FMBreakExpression::CXFA_FMBreakExpression() = default;
CXFA_FMBreakExpression::~CXFA_FMBreakExpression() = default;
@@ -1056,7 +1056,7 @@
return !CXFA_IsTooBig(*js);
}
-CXFA_FMContinueExpression::CXFA_FMContinueExpression() : CXFA_FMExpression() {}
+CXFA_FMContinueExpression::CXFA_FMContinueExpression() = default;
CXFA_FMContinueExpression::~CXFA_FMContinueExpression() = default;
diff --git a/xfa/fxfa/layout/cxfa_viewlayoutprocessor.cpp b/xfa/fxfa/layout/cxfa_viewlayoutprocessor.cpp
index b56c377..c8ec206 100644
--- a/xfa/fxfa/layout/cxfa_viewlayoutprocessor.cpp
+++ b/xfa/fxfa/layout/cxfa_viewlayoutprocessor.cpp
@@ -855,12 +855,12 @@
absl::optional<CXFA_ViewLayoutProcessor::BreakData>
CXFA_ViewLayoutProcessor::ProcessBreakBefore(const CXFA_Node* pBreakNode) {
- return ProcessBreakBeforeOrAfter(pBreakNode, /*before=*/true);
+ return ProcessBreakBeforeOrAfter(pBreakNode, /*bBefore=*/true);
}
absl::optional<CXFA_ViewLayoutProcessor::BreakData>
CXFA_ViewLayoutProcessor::ProcessBreakAfter(const CXFA_Node* pBreakNode) {
- return ProcessBreakBeforeOrAfter(pBreakNode, /*before=*/false);
+ return ProcessBreakBeforeOrAfter(pBreakNode, /*bBefore=*/false);
}
absl::optional<CXFA_ViewLayoutProcessor::BreakData>
@@ -907,12 +907,12 @@
CXFA_Node* CXFA_ViewLayoutProcessor::ProcessBookendLeader(
const CXFA_Node* pBookendNode) {
- return ProcessBookendLeaderOrTrailer(pBookendNode, /*leader=*/true);
+ return ProcessBookendLeaderOrTrailer(pBookendNode, /*bLeader=*/true);
}
CXFA_Node* CXFA_ViewLayoutProcessor::ProcessBookendTrailer(
const CXFA_Node* pBookendNode) {
- return ProcessBookendLeaderOrTrailer(pBookendNode, /*leader=*/false);
+ return ProcessBookendLeaderOrTrailer(pBookendNode, /*bLeader=*/false);
}
CXFA_Node* CXFA_ViewLayoutProcessor::ProcessBookendLeaderOrTrailer(