Initialize CPDF_TextPageFind members in the header.
Also organize them to pack better.
Change-Id: I784ee8b36733afbf1de4d4b340a0d23cb5e230fa
Reviewed-on: https://pdfium-review.googlesource.com/c/34850
Reviewed-by: Tom Sepez <tsepez@chromium.org>
Commit-Queue: Lei Zhang <thestig@chromium.org>
diff --git a/core/fpdftext/cpdf_textpagefind.cpp b/core/fpdftext/cpdf_textpagefind.cpp
index e40da81..829fc56 100644
--- a/core/fpdftext/cpdf_textpagefind.cpp
+++ b/core/fpdftext/cpdf_textpagefind.cpp
@@ -35,13 +35,7 @@
} // namespace
CPDF_TextPageFind::CPDF_TextPageFind(const CPDF_TextPage* pTextPage)
- : m_pTextPage(pTextPage),
- m_flags(0),
- m_bMatchCase(false),
- m_bMatchWholeWord(false),
- m_resStart(0),
- m_resEnd(-1),
- m_IsFind(false) {
+ : m_pTextPage(pTextPage) {
m_strText = m_pTextPage->GetAllPageText();
int nCount = pTextPage->CountChars();
if (nCount)
diff --git a/core/fpdftext/cpdf_textpagefind.h b/core/fpdftext/cpdf_textpagefind.h
index f7419cf..8d59456 100644
--- a/core/fpdftext/cpdf_textpagefind.h
+++ b/core/fpdftext/cpdf_textpagefind.h
@@ -41,20 +41,20 @@
int GetCharIndex(int index) const;
private:
- std::vector<uint16_t> m_CharIndex;
- UnownedPtr<const CPDF_TextPage> m_pTextPage;
+ UnownedPtr<const CPDF_TextPage> const m_pTextPage;
WideString m_strText;
WideString m_findWhat;
- int m_flags;
+ std::vector<uint16_t> m_CharIndex;
std::vector<WideString> m_csFindWhatArray;
+ std::vector<CFX_FloatRect> m_resArray;
Optional<size_t> m_findNextStart;
Optional<size_t> m_findPreStart;
- bool m_bMatchCase;
- bool m_bMatchWholeWord;
- int m_resStart;
- int m_resEnd;
- std::vector<CFX_FloatRect> m_resArray;
- bool m_IsFind;
+ int m_resStart = 0;
+ int m_resEnd = -1;
+ int m_flags = 0;
+ bool m_bMatchCase = false;
+ bool m_bMatchWholeWord = false;
+ bool m_IsFind = false;
};
#endif // CORE_FPDFTEXT_CPDF_TEXTPAGEFIND_H_