Remove |CPDF_LinkExtract::m_strPageText|.
It's not really being used for anything, and there is already another
call to retrieve the same text string. With |m_strPageText| removed,
ExtractLinks() is just a thin wrapper around ParseLink(), so merge the
two methods.
Change-Id: I179cc3a4c60bb92ac49595632a2fe5ea26cf1383
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/65350
Reviewed-by: Tom Sepez <tsepez@chromium.org>
Commit-Queue: Lei Zhang <thestig@chromium.org>
diff --git a/core/fpdftext/cpdf_linkextract.cpp b/core/fpdftext/cpdf_linkextract.cpp
index 91c7e4b..53006b7 100644
--- a/core/fpdftext/cpdf_linkextract.cpp
+++ b/core/fpdftext/cpdf_linkextract.cpp
@@ -108,21 +108,13 @@
CPDF_LinkExtract::CPDF_LinkExtract(const CPDF_TextPage* pTextPage)
: m_pTextPage(pTextPage) {}
-CPDF_LinkExtract::~CPDF_LinkExtract() {}
+CPDF_LinkExtract::~CPDF_LinkExtract() = default;
void CPDF_LinkExtract::ExtractLinks() {
m_LinkArray.clear();
if (!m_pTextPage->IsParsed())
return;
- m_strPageText = m_pTextPage->GetAllPageText();
- if (m_strPageText.IsEmpty())
- return;
-
- ParseLink();
-}
-
-void CPDF_LinkExtract::ParseLink() {
int start = 0;
int pos = 0;
int nTotalChar = m_pTextPage->CountChars();
diff --git a/core/fpdftext/cpdf_linkextract.h b/core/fpdftext/cpdf_linkextract.h
index 1bb7b2f..56d70a3 100644
--- a/core/fpdftext/cpdf_linkextract.h
+++ b/core/fpdftext/cpdf_linkextract.h
@@ -27,7 +27,6 @@
bool GetTextRange(size_t index, int* start_char_index, int* char_count) const;
protected:
- void ParseLink();
bool CheckWebLink(WideString* str, int32_t* nStart, int32_t* nCount);
bool CheckMailLink(WideString* str);
@@ -39,7 +38,6 @@
};
UnownedPtr<const CPDF_TextPage> const m_pTextPage;
- WideString m_strPageText;
std::vector<Link> m_LinkArray;
};