summaryrefslogtreecommitdiff
path: root/fpdfsdk
diff options
context:
space:
mode:
authorRyan Harrison <rharrison@chromium.org>2017-08-28 13:36:18 -0400
committerChromium commit bot <commit-bot@chromium.org>2017-08-28 19:17:03 +0000
commit61cb1121729d7e5f53c95077dcc57a61b3f575e8 (patch)
tree8c5dd34af353a53c7e781ed696e6a773a9e55949 /fpdfsdk
parent2b6e2a7c92a8c2756364a40a22e6f91b910fc514 (diff)
downloadpdfium-61cb1121729d7e5f53c95077dcc57a61b3f575e8.tar.xz
Convert find markers to Optionals in CPDF_TextPageFind
Currently these use -1 as a special value to indicate not set. This creates the same issues that FX_STRNPOS created for converting FX_STRSIZE to size_t, so this code has been rewritten. BUG=pdfium:828 Change-Id: Iaaa96af0dcb2eb8b600f3ea39060a398ac9a3800 Reviewed-on: https://pdfium-review.googlesource.com/12130 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: Ryan Harrison <rharrison@chromium.org>
Diffstat (limited to 'fpdfsdk')
-rw-r--r--fpdfsdk/fpdftext.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/fpdfsdk/fpdftext.cpp b/fpdfsdk/fpdftext.cpp
index 2ea06de5d8..8ed76ea7c1 100644
--- a/fpdfsdk/fpdftext.cpp
+++ b/fpdfsdk/fpdftext.cpp
@@ -250,7 +250,9 @@ FPDFText_FindStart(FPDF_TEXTPAGE text_page,
new CPDF_TextPageFind(CPDFTextPageFromFPDFTextPage(text_page));
FX_STRSIZE len = CFX_WideString::WStringLength(findwhat);
textpageFind->FindFirst(CFX_WideString::FromUTF16LE(findwhat, len), flags,
- start_index);
+ start_index >= 0
+ ? pdfium::Optional<FX_STRSIZE>(start_index)
+ : pdfium::Optional<FX_STRSIZE>());
return textpageFind;
}