Initialize members in the header for CPDF_Object sub-classes.
Initialize |CPDF_Boolean::m_bValue| and |CPDF_String::m_bHex| in their
respective headers. Use =default in more places along the way.
Change-Id: I34dc115c4a3c0357601d358b9948e6d7bd465931
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/63974
Reviewed-by: Tom Sepez <tsepez@chromium.org>
Commit-Queue: Lei Zhang <thestig@chromium.org>
diff --git a/core/fpdfapi/parser/cpdf_boolean.cpp b/core/fpdfapi/parser/cpdf_boolean.cpp
index 09a5fd3..b5e12eb 100644
--- a/core/fpdfapi/parser/cpdf_boolean.cpp
+++ b/core/fpdfapi/parser/cpdf_boolean.cpp
@@ -9,11 +9,11 @@
#include "core/fxcrt/fx_stream.h"
#include "third_party/base/ptr_util.h"
-CPDF_Boolean::CPDF_Boolean() : m_bValue(false) {}
+CPDF_Boolean::CPDF_Boolean() = default;
CPDF_Boolean::CPDF_Boolean(bool value) : m_bValue(value) {}
-CPDF_Boolean::~CPDF_Boolean() {}
+CPDF_Boolean::~CPDF_Boolean() = default;
CPDF_Object::Type CPDF_Boolean::GetType() const {
return kBoolean;
diff --git a/core/fpdfapi/parser/cpdf_boolean.h b/core/fpdfapi/parser/cpdf_boolean.h
index 1f093da..8ef47ad 100644
--- a/core/fpdfapi/parser/cpdf_boolean.h
+++ b/core/fpdfapi/parser/cpdf_boolean.h
@@ -35,7 +35,7 @@
explicit CPDF_Boolean(bool value);
~CPDF_Boolean() override;
- bool m_bValue;
+ bool m_bValue = false;
};
inline CPDF_Boolean* ToBoolean(CPDF_Object* obj) {
diff --git a/core/fpdfapi/parser/cpdf_string.cpp b/core/fpdfapi/parser/cpdf_string.cpp
index fd5c7f0..7058169 100644
--- a/core/fpdfapi/parser/cpdf_string.cpp
+++ b/core/fpdfapi/parser/cpdf_string.cpp
@@ -14,7 +14,7 @@
#include "core/fxcrt/fx_stream.h"
#include "third_party/base/ptr_util.h"
-CPDF_String::CPDF_String() : m_bHex(false) {}
+CPDF_String::CPDF_String() = default;
CPDF_String::CPDF_String(WeakPtr<ByteStringPool> pPool,
const ByteString& str,
@@ -25,12 +25,12 @@
}
CPDF_String::CPDF_String(WeakPtr<ByteStringPool> pPool, const WideString& str)
- : m_String(PDF_EncodeText(str)), m_bHex(false) {
+ : m_String(PDF_EncodeText(str)) {
if (pPool)
m_String = pPool->Intern(m_String);
}
-CPDF_String::~CPDF_String() {}
+CPDF_String::~CPDF_String() = default;
CPDF_Object::Type CPDF_String::GetType() const {
return kString;
diff --git a/core/fpdfapi/parser/cpdf_string.h b/core/fpdfapi/parser/cpdf_string.h
index 9dc50f7..8efc71b 100644
--- a/core/fpdfapi/parser/cpdf_string.h
+++ b/core/fpdfapi/parser/cpdf_string.h
@@ -41,7 +41,7 @@
~CPDF_String() override;
ByteString m_String;
- bool m_bHex;
+ bool m_bHex = false;
};
inline CPDF_String* ToString(CPDF_Object* obj) {