Initialize various nullptrs where declared.
Or don't bother when not needed.
Change-Id: Id8b6adb384ac029a0b8e6ea15d95b5926dc68a17
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/70924
Reviewed-by: Daniel Hosseinian <dhoss@chromium.org>
Commit-Queue: Lei Zhang <thestig@chromium.org>
diff --git a/core/fxcrt/cfx_fileaccess_windows.cpp b/core/fxcrt/cfx_fileaccess_windows.cpp
index e5043cb..3a0fd12 100644
--- a/core/fxcrt/cfx_fileaccess_windows.cpp
+++ b/core/fxcrt/cfx_fileaccess_windows.cpp
@@ -34,7 +34,7 @@
return std::make_unique<CFX_FileAccess_Windows>();
}
-CFX_FileAccess_Windows::CFX_FileAccess_Windows() : m_hFile(nullptr) {}
+CFX_FileAccess_Windows::CFX_FileAccess_Windows() = default;
CFX_FileAccess_Windows::~CFX_FileAccess_Windows() {
Close();
diff --git a/core/fxcrt/cfx_fileaccess_windows.h b/core/fxcrt/cfx_fileaccess_windows.h
index a95466f..c8c0679 100644
--- a/core/fxcrt/cfx_fileaccess_windows.h
+++ b/core/fxcrt/cfx_fileaccess_windows.h
@@ -37,7 +37,7 @@
bool Truncate(FX_FILESIZE szFile) override;
private:
- void* m_hFile;
+ void* m_hFile = nullptr;
};
#endif // CORE_FXCRT_CFX_FILEACCESS_WINDOWS_H_
diff --git a/core/fxge/android/cfx_androidfontinfo.cpp b/core/fxge/android/cfx_androidfontinfo.cpp
index fce274c..dc25f1e 100644
--- a/core/fxge/android/cfx_androidfontinfo.cpp
+++ b/core/fxge/android/cfx_androidfontinfo.cpp
@@ -12,8 +12,10 @@
#include "core/fxge/cfx_fontmapper.h"
#include "core/fxge/fx_font.h"
-CFX_AndroidFontInfo::CFX_AndroidFontInfo() : m_pFontMgr(nullptr) {}
+CFX_AndroidFontInfo::CFX_AndroidFontInfo() = default;
+
CFX_AndroidFontInfo::~CFX_AndroidFontInfo() = default;
+
bool CFX_AndroidFontInfo::Init(CFPF_SkiaFontMgr* pFontMgr) {
if (!pFontMgr)
return false;
diff --git a/xfa/fxfa/parser/cxfa_nodeiteratortemplate_unittest.cpp b/xfa/fxfa/parser/cxfa_nodeiteratortemplate_unittest.cpp
index 685814f..2be97a0 100644
--- a/xfa/fxfa/parser/cxfa_nodeiteratortemplate_unittest.cpp
+++ b/xfa/fxfa/parser/cxfa_nodeiteratortemplate_unittest.cpp
@@ -27,7 +27,7 @@
}
};
- explicit Node(Node* parent) : parent_(parent), next_sibling_(nullptr) {
+ explicit Node(Node* parent) : parent_(parent) {
if (parent) {
if (!parent->children_.empty())
parent->children_.back()->next_sibling_ = this;
@@ -36,8 +36,8 @@
}
private:
- Node* parent_;
- Node* next_sibling_;
+ Node* const parent_;
+ Node* next_sibling_ = nullptr;
std::vector<Node*> children_;
};