summaryrefslogtreecommitdiff
path: root/core/fpdftext
diff options
context:
space:
mode:
Diffstat (limited to 'core/fpdftext')
-rw-r--r--core/fpdftext/cpdf_textpage.cpp64
-rw-r--r--core/fpdftext/cpdf_textpagefind.cpp11
2 files changed, 36 insertions, 39 deletions
diff --git a/core/fpdftext/cpdf_textpage.cpp b/core/fpdftext/cpdf_textpage.cpp
index 8ef5522bae..98eacf3c14 100644
--- a/core/fpdftext/cpdf_textpage.cpp
+++ b/core/fpdftext/cpdf_textpage.cpp
@@ -1127,41 +1127,39 @@ void CPDF_TextPage::ProcessTextObject(PDFTEXT_Obj Obj) {
m_TempCharList.push_back(charinfo);
m_TempTextBuf.AppendChar(0xfffe);
continue;
- } else {
- int nTotal = wstrItem.GetLength();
- bool bDel = false;
- const int count =
- std::min(pdfium::CollectionSize<int>(m_TempCharList), 7);
- float threshold = charinfo.m_Matrix.TransformXDistance(
- (float)TEXT_CHARRATIO_GAPDELTA * pTextObj->GetFontSize());
- for (int n = pdfium::CollectionSize<int>(m_TempCharList);
- n > pdfium::CollectionSize<int>(m_TempCharList) - count; n--) {
- const PAGECHAR_INFO& charinfo1 = m_TempCharList[n - 1];
- CFX_PointF diff = charinfo1.m_Origin - charinfo.m_Origin;
- if (charinfo1.m_CharCode == charinfo.m_CharCode &&
- charinfo1.m_pTextObj->GetFont() == charinfo.m_pTextObj->GetFont() &&
- fabs(diff.x) < threshold && fabs(diff.y) < threshold) {
- bDel = true;
- break;
- }
+ }
+ int nTotal = wstrItem.GetLength();
+ bool bDel = false;
+ const int count = std::min(pdfium::CollectionSize<int>(m_TempCharList), 7);
+ float threshold = charinfo.m_Matrix.TransformXDistance(
+ (float)TEXT_CHARRATIO_GAPDELTA * pTextObj->GetFontSize());
+ for (int n = pdfium::CollectionSize<int>(m_TempCharList);
+ n > pdfium::CollectionSize<int>(m_TempCharList) - count; n--) {
+ const PAGECHAR_INFO& charinfo1 = m_TempCharList[n - 1];
+ CFX_PointF diff = charinfo1.m_Origin - charinfo.m_Origin;
+ if (charinfo1.m_CharCode == charinfo.m_CharCode &&
+ charinfo1.m_pTextObj->GetFont() == charinfo.m_pTextObj->GetFont() &&
+ fabs(diff.x) < threshold && fabs(diff.y) < threshold) {
+ bDel = true;
+ break;
}
- if (!bDel) {
- for (int nIndex = 0; nIndex < nTotal; nIndex++) {
- charinfo.m_Unicode = wstrItem[nIndex];
- if (charinfo.m_Unicode) {
- charinfo.m_Index = m_TextBuf.GetLength();
- m_TempTextBuf.AppendChar(charinfo.m_Unicode);
- } else {
- m_TempTextBuf.AppendChar(0xfffe);
- }
- m_TempCharList.push_back(charinfo);
- }
- } else if (i == 0) {
- WideString str = m_TempTextBuf.MakeString();
- if (!str.IsEmpty() && str[str.GetLength() - 1] == TEXT_SPACE_CHAR) {
- m_TempTextBuf.Delete(m_TempTextBuf.GetLength() - 1, 1);
- m_TempCharList.pop_back();
+ }
+ if (!bDel) {
+ for (int nIndex = 0; nIndex < nTotal; nIndex++) {
+ charinfo.m_Unicode = wstrItem[nIndex];
+ if (charinfo.m_Unicode) {
+ charinfo.m_Index = m_TextBuf.GetLength();
+ m_TempTextBuf.AppendChar(charinfo.m_Unicode);
+ } else {
+ m_TempTextBuf.AppendChar(0xfffe);
}
+ m_TempCharList.push_back(charinfo);
+ }
+ } else if (i == 0) {
+ WideString str = m_TempTextBuf.MakeString();
+ if (!str.IsEmpty() && str[str.GetLength() - 1] == TEXT_SPACE_CHAR) {
+ m_TempTextBuf.Delete(m_TempTextBuf.GetLength() - 1, 1);
+ m_TempCharList.pop_back();
}
}
}
diff --git a/core/fpdftext/cpdf_textpagefind.cpp b/core/fpdftext/cpdf_textpagefind.cpp
index 9f243a0aee..97aa34fafe 100644
--- a/core/fpdftext/cpdf_textpagefind.cpp
+++ b/core/fpdftext/cpdf_textpagefind.cpp
@@ -283,13 +283,12 @@ void CPDF_TextPageFind::ExtractFindWhat(const WideString& findwhat) {
int ret =
ExtractSubString(csWord, findwhat.c_str(), index, TEXT_SPACE_CHAR);
if (csWord.IsEmpty()) {
- if (ret) {
- m_csFindWhatArray.push_back(L"");
- index++;
- continue;
- } else {
+ if (!ret)
break;
- }
+
+ m_csFindWhatArray.push_back(L"");
+ index++;
+ continue;
}
size_t pos = 0;
while (pos < csWord.GetLength()) {