Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(89)

Unified Diff: core/src/fpdftext/fpdf_text_int.cpp

Issue 1577503002: Merge to XFA: Switch most min/max macros to std::min/max. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@xfa
Patch Set: rebase Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « core/src/fpdfdoc/pdf_vt.h ('k') | core/src/fxcodec/codec/fx_codec_png.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: core/src/fpdftext/fpdf_text_int.cpp
diff --git a/core/src/fpdftext/fpdf_text_int.cpp b/core/src/fpdftext/fpdf_text_int.cpp
index cf6cde1169c8e06542951d49b75c0ad27902e752..f527f48814d72c4ce209c6bfd0b17f703c1374a0 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;
}
« no previous file with comments | « core/src/fpdfdoc/pdf_vt.h ('k') | core/src/fxcodec/codec/fx_codec_png.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698