Refactor/modernize CPVT_Word and CPVT_WordInfo structs Replace manual constructor initializer lists with inline default member initializers, and explicitly declares default and copy constructors, and assignment operators. Purely structural refactor, no functional or logical changes. Bug: 40115028 Change-Id: Id434c4d4988be9e9ae800774d3cb79351c15adf5 Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/149970 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Seung Hyun Jin <seunghyunjin@google.com>
diff --git a/core/fpdfdoc/BUILD.gn b/core/fpdfdoc/BUILD.gn index b7f8fbd..ba6b16f 100644 --- a/core/fpdfdoc/BUILD.gn +++ b/core/fpdfdoc/BUILD.gn
@@ -70,6 +70,7 @@ "cpvt_section.h", "cpvt_variabletext.cpp", "cpvt_variabletext.h", + "cpvt_word.cpp", "cpvt_word.h", "cpvt_wordinfo.cpp", "cpvt_wordinfo.h",
diff --git a/core/fpdfdoc/cpvt_word.cpp b/core/fpdfdoc/cpvt_word.cpp new file mode 100644 index 0000000..fe29b15 --- /dev/null +++ b/core/fpdfdoc/cpvt_word.cpp
@@ -0,0 +1,10 @@ +// Copyright 2026 The PDFium Authors +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "core/fpdfdoc/cpvt_word.h" + +CPVT_Word::CPVT_Word() = default; +CPVT_Word::CPVT_Word(const CPVT_Word&) = default; +CPVT_Word& CPVT_Word::operator=(const CPVT_Word&) = default; +CPVT_Word::~CPVT_Word() = default;
diff --git a/core/fpdfdoc/cpvt_word.h b/core/fpdfdoc/cpvt_word.h index f5ec843..5c8bb44 100644 --- a/core/fpdfdoc/cpvt_word.h +++ b/core/fpdfdoc/cpvt_word.h
@@ -11,29 +11,24 @@ #include "core/fpdfdoc/cpvt_wordplace.h" #include "core/fxcrt/fx_codepage.h" +#include "core/fxcrt/fx_coordinates.h" class CPVT_Word { public: CPVT_Word(); + CPVT_Word(const CPVT_Word&); + CPVT_Word& operator=(const CPVT_Word&); + ~CPVT_Word(); - uint16_t Word; - FX_Charset nCharset; + uint16_t Word = 0; + FX_Charset nCharset = FX_Charset::kANSI; CPVT_WordPlace WordPlace; CFX_PointF ptWord; - float fAscent; - float fDescent; - float fWidth; - int32_t nFontIndex; - float fFontSize; + float fAscent = 0.0f; + float fDescent = 0.0f; + float fWidth = 0.0f; + int32_t nFontIndex = -1; + float fFontSize = 0.0f; }; -inline CPVT_Word::CPVT_Word() - : Word(0), - nCharset(FX_Charset::kANSI), - fAscent(0.0f), - fDescent(0.0f), - fWidth(0.0f), - nFontIndex(-1), - fFontSize(0.0f) {} - #endif // CORE_FPDFDOC_CPVT_WORD_H_