summaryrefslogtreecommitdiff
path: root/core/fpdftext/cpdf_linkextract.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'core/fpdftext/cpdf_linkextract.cpp')
-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.