summaryrefslogtreecommitdiff
path: root/fpdfsdk/src/javascript/Document.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'fpdfsdk/src/javascript/Document.cpp')
-rw-r--r--fpdfsdk/src/javascript/Document.cpp13
1 files changed, 6 insertions, 7 deletions
diff --git a/fpdfsdk/src/javascript/Document.cpp b/fpdfsdk/src/javascript/Document.cpp
index 0bd754af76..e869e72310 100644
--- a/fpdfsdk/src/javascript/Document.cpp
+++ b/fpdfsdk/src/javascript/Document.cpp
@@ -1380,14 +1380,12 @@ FX_BOOL Document::getPageNthWord(IJS_Context* cc,
page.Load(pDocument, pPageDict);
page.ParseContent(nullptr);
- FX_POSITION pos = page.GetFirstObjectPosition();
-
int nWords = 0;
-
CFX_WideString swRet;
-
+ FX_POSITION pos = page.GetPageObjectList()->GetHeadPosition();
while (pos) {
- if (CPDF_PageObject* pPageObj = page.GetNextObject(pos)) {
+ if (CPDF_PageObject* pPageObj =
+ page.GetPageObjectList()->GetNextObject(pos)) {
if (pPageObj->m_Type == CPDF_PageObject::TEXT) {
int nObjWords = CountWords((CPDF_TextObject*)pPageObj);
@@ -1444,9 +1442,10 @@ FX_BOOL Document::getPageNumWords(IJS_Context* cc,
page.ParseContent(nullptr);
int nWords = 0;
- FX_POSITION pos = page.GetFirstObjectPosition();
+ FX_POSITION pos = page.GetPageObjectList()->GetHeadPosition();
while (pos) {
- if (CPDF_PageObject* pPageObj = page.GetNextObject(pos)) {
+ if (CPDF_PageObject* pPageObj =
+ page.GetPageObjectList()->GetNextObject(pos)) {
if (pPageObj->m_Type == CPDF_PageObject::TEXT) {
CPDF_TextObject* pTextObj = (CPDF_TextObject*)pPageObj;
nWords += CountWords(pTextObj);