summaryrefslogtreecommitdiff
path: root/core/src/fpdftext
diff options
context:
space:
mode:
authorLei Zhang <thestig@chromium.org>2016-01-11 11:59:17 -0800
committerLei Zhang <thestig@chromium.org>2016-01-11 11:59:17 -0800
commit375a86403b7fa8d17d7b142c270e2d8e33bb924f (patch)
tree1db1ffddb2bbbcd429cd1d7954b1949bfa54e1ab /core/src/fpdftext
parent492961df3011ccc25646eae12ac6e6dcfe7f26da (diff)
downloadpdfium-375a86403b7fa8d17d7b142c270e2d8e33bb924f.tar.xz
Merge to XFA: Switch most min/max macros to std::min/max.
Fix lint errors along the way. R=tsepez@chromium.org TBR=tsepez@chromium.org Review URL: https://codereview.chromium.org/1567343002 . (cherry picked from commit 9adfbb0920a258e916003b1ee9515e97879db82a) Review URL: https://codereview.chromium.org/1577503002 .
Diffstat (limited to 'core/src/fpdftext')
-rw-r--r--core/src/fpdftext/fpdf_text_int.cpp36
1 files changed, 17 insertions, 19 deletions
diff --git a/core/src/fpdftext/fpdf_text_int.cpp b/core/src/fpdftext/fpdf_text_int.cpp
index cf6cde1169..f527f48814 100644
--- a/core/src/fpdftext/fpdf_text_int.cpp
+++ b/core/src/fpdftext/fpdf_text_int.cpp
@@ -161,9 +161,9 @@ FX_BOOL CPDF_TextPage::ParseTextPage() {
PAGECHAR_INFO charinfo = *(PAGECHAR_INFO*)m_charList.GetAt(i);
if (charinfo.m_Flag == FPDFTEXT_CHAR_GENERATED) {
bNormal = TRUE;
- } else if (charinfo.m_Unicode == 0 || IsControlChar(charinfo))
+ } else if (charinfo.m_Unicode == 0 || IsControlChar(charinfo)) {
bNormal = FALSE;
- else {
+ } else {
bNormal = TRUE;
}
if (bNormal) {
@@ -1807,10 +1807,10 @@ FX_BOOL CPDF_TextPage::IsHyphen(FX_WCHAR curChar) {
}
preChar = (PAGECHAR_INFO)m_charList[size - 1];
}
- if (FPDFTEXT_CHAR_PIECE == preChar.m_Flag)
- if (0xAD == preChar.m_Unicode || 0x2D == preChar.m_Unicode) {
- return TRUE;
- }
+ if (FPDFTEXT_CHAR_PIECE == preChar.m_Flag &&
+ (0xAD == preChar.m_Unicode || 0x2D == preChar.m_Unicode)) {
+ return TRUE;
+ }
}
return FALSE;
}
@@ -1920,17 +1920,14 @@ int CPDF_TextPage::ProcessInsertObject(const CPDF_TextObject* pObj,
}
}
}
- if (bNewline) {
- if (IsHyphen(curChar)) {
- return 3;
- }
- return 2;
- }
+ if (bNewline)
+ return IsHyphen(curChar) ? 3 : 2;
+
int32_t nChars = pObj->CountChars();
- if (nChars == 1 && (0x2D == curChar || 0xAD == curChar))
- if (IsHyphen(curChar)) {
- return 3;
- }
+ if (nChars == 1 && (0x2D == curChar || 0xAD == curChar) &&
+ IsHyphen(curChar)) {
+ return 3;
+ }
CFX_WideString PrevStr =
m_pPreTextObj->GetFont()->UnicodeFromCharCode(PrevItem.m_CharCode);
FX_WCHAR preChar = PrevStr.GetAt(PrevStr.GetLength() - 1);
@@ -1956,7 +1953,7 @@ int CPDF_TextPage::ProcessInsertObject(const CPDF_TextObject* pObj,
threshold *= 1.5;
}
if (FXSYS_fabs(last_pos + last_width - x) > threshold && curChar != L' ' &&
- preChar != L' ')
+ preChar != L' ') {
if (curChar != L' ' && preChar != L' ') {
if ((x - last_pos - last_width) > threshold ||
(last_pos - x - last_width) > threshold) {
@@ -1970,6 +1967,7 @@ int CPDF_TextPage::ProcessInsertObject(const CPDF_TextObject* pObj,
return 1;
}
}
+ }
return 0;
}
FX_BOOL CPDF_TextPage::IsSameTextObject(CPDF_TextObject* pTextObj1,
@@ -2023,8 +2021,8 @@ FX_BOOL CPDF_TextPage::IsSameTextObject(CPDF_TextObject* pTextObj1,
GetCharWidth(itemPer.m_CharCode, pTextObj2->GetFont()) *
pTextObj2->GetFontSize() / 1000 * 0.9 ||
FXSYS_fabs(pTextObj1->GetPosY() - pTextObj2->GetPosY()) >
- FX_MAX(FX_MAX(rcPreObj.Height(), rcPreObj.Width()),
- pTextObj2->GetFontSize()) /
+ std::max(std::max(rcPreObj.Height(), rcPreObj.Width()),
+ pTextObj2->GetFontSize()) /
8) {
return FALSE;
}