summaryrefslogtreecommitdiff
path: root/core/fpdftext
diff options
context:
space:
mode:
authorRyan Harrison <rharrison@chromium.org>2017-09-01 11:14:18 -0400
committerChromium commit bot <commit-bot@chromium.org>2017-09-01 15:26:31 +0000
commit57cb5447d68c01eddba0618c3a8fe450b180f917 (patch)
tree5f17dc4c02c331d81a005db179c4a2a9b51b7e46 /core/fpdftext
parentffb6ccf6a2699cbb2bfc925c96609fae5124f51f (diff)
downloadpdfium-57cb5447d68c01eddba0618c3a8fe450b180f917.tar.xz
Adjust loops in preperation for FX_STRSIZE int->size_t
Adjust loop conditions and behaviours in preperation for convering the underlying type of FX_STRSIZE to size_t. These changes are not dependent on the type switch occuring, so can be landed before hand. BUG=pdfium:828 Change-Id: I5f950c99c10e5ef0836959e3b1dd2e09f8f5afc0 Reviewed-on: https://pdfium-review.googlesource.com/12750 Commit-Queue: Ryan Harrison <rharrison@chromium.org> Reviewed-by: Henrique Nakashima <hnakashima@chromium.org>
Diffstat (limited to 'core/fpdftext')
-rw-r--r--core/fpdftext/cpdf_linkextract.cpp12
1 files changed, 6 insertions, 6 deletions
diff --git a/core/fpdftext/cpdf_linkextract.cpp b/core/fpdftext/cpdf_linkextract.cpp
index 880a4ceb92..a5eafe689a 100644
--- a/core/fpdftext/cpdf_linkextract.cpp
+++ b/core/fpdftext/cpdf_linkextract.cpp
@@ -245,24 +245,24 @@ bool CPDF_LinkExtract::CheckMailLink(CFX_WideString* str) {
// Check the local part.
FX_STRSIZE pPos = aPos.value(); // Used to track the position of '@' or '.'.
- for (FX_STRSIZE i = aPos.value() - 1; i >= 0; i--) {
- wchar_t ch = (*str)[i];
+ for (FX_STRSIZE i = aPos.value(); i > 0; i--) {
+ wchar_t ch = (*str)[i - 1];
if (ch == L'_' || ch == L'-' || FXSYS_iswalnum(ch))
continue;
- if (ch != L'.' || i == pPos - 1 || i == 0) {
- if (i == aPos.value() - 1) {
+ if (ch != L'.' || i == pPos || i == 1) {
+ if (i == aPos.value()) {
// There is '.' or invalid char before '@'.
return false;
}
// End extracting for other invalid chars, '.' at the beginning, or
// consecutive '.'.
- FX_STRSIZE removed_len = i == pPos - 1 ? i + 2 : i + 1;
+ FX_STRSIZE removed_len = i == pPos ? i + 1 : i;
*str = str->Right(str->GetLength() - removed_len);
break;
}
// Found a valid '.'.
- pPos = i;
+ pPos = i - 1;
}
// Check the domain name part.