diff options
author | Lei Zhang <thestig@chromium.org> | 2016-01-11 11:59:17 -0800 |
---|---|---|
committer | Lei Zhang <thestig@chromium.org> | 2016-01-11 11:59:17 -0800 |
commit | 375a86403b7fa8d17d7b142c270e2d8e33bb924f (patch) | |
tree | 1db1ffddb2bbbcd429cd1d7954b1949bfa54e1ab /xfa/src/fxfa | |
parent | 492961df3011ccc25646eae12ac6e6dcfe7f26da (diff) | |
download | pdfium-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 'xfa/src/fxfa')
-rw-r--r-- | xfa/src/fxfa/src/app/xfa_ffapp.cpp | 4 | ||||
-rw-r--r-- | xfa/src/fxfa/src/app/xfa_ffwidget.cpp | 8 | ||||
-rw-r--r-- | xfa/src/fxfa/src/app/xfa_ffwidgetacc.cpp | 24 | ||||
-rw-r--r-- | xfa/src/fxfa/src/app/xfa_fontmgr.cpp | 4 | ||||
-rw-r--r-- | xfa/src/fxfa/src/app/xfa_textlayout.cpp | 14 | ||||
-rw-r--r-- | xfa/src/fxfa/src/parser/xfa_layout_itemlayout.cpp | 6 |
6 files changed, 36 insertions, 24 deletions
diff --git a/xfa/src/fxfa/src/app/xfa_ffapp.cpp b/xfa/src/fxfa/src/app/xfa_ffapp.cpp index 0ce79e05db..fb37fb7ba3 100644 --- a/xfa/src/fxfa/src/app/xfa_ffapp.cpp +++ b/xfa/src/fxfa/src/app/xfa_ffapp.cpp @@ -4,6 +4,8 @@ // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
+#include <algorithm>
+
#include "xfa/src/foxitlib.h"
#include "xfa/src/fxfa/src/common/xfa_common.h"
#include "xfa_ffdochandler.h"
@@ -47,7 +49,7 @@ FX_BOOL CXFA_FileRead::ReadBlock(void* buffer, while (index < iCount) {
CPDF_StreamAcc& acc = m_Data[index];
FX_DWORD dwSize = acc.GetSize();
- FX_DWORD dwRead = FX_MIN(size, dwSize - offset);
+ size_t dwRead = std::min(size, static_cast<size_t>(dwSize - offset));
FXSYS_memcpy(buffer, acc.GetData() + offset, dwRead);
size -= dwRead;
if (size == 0) {
diff --git a/xfa/src/fxfa/src/app/xfa_ffwidget.cpp b/xfa/src/fxfa/src/app/xfa_ffwidget.cpp index 58047302e0..08194bade1 100644 --- a/xfa/src/fxfa/src/app/xfa_ffwidget.cpp +++ b/xfa/src/fxfa/src/app/xfa_ffwidget.cpp @@ -4,6 +4,8 @@ // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
+#include <algorithm>
+
#include "xfa/src/foxitlib.h"
#include "xfa/src/fxfa/src/common/xfa_common.h"
#include "xfa_ffapp.h"
@@ -776,7 +778,7 @@ void XFA_DrawImage(CFX_Graphics* pGS, case XFA_ATTRIBUTEENUM_Fit: {
FX_FLOAT f1 = rtImage.height / rtFit.height;
FX_FLOAT f2 = rtImage.width / rtFit.width;
- f1 = FX_MIN(f1, f2);
+ f1 = std::min(f1, f2);
rtFit.height = rtFit.height * f1;
rtFit.width = rtFit.width * f1;
} break;
@@ -1116,7 +1118,7 @@ static void XFA_BOX_GetPath_Arc(CXFA_Box box, a = rtDraw.width / 2.0f;
b = rtDraw.height / 2.0f;
if (box.IsCircular() || (dwFlags & XFA_DRAWBOX_ForceRound) != 0) {
- a = b = FX_MIN(a, b);
+ a = b = std::min(a, b);
}
CFX_PointF center = rtDraw.Center();
rtDraw.left = center.x - a;
@@ -1655,7 +1657,7 @@ static void XFA_BOX_StrokeArc(CXFA_Box box, a = rtWidget.width / 2.0f;
b = rtWidget.height / 2.0f;
if (dwFlags & XFA_DRAWBOX_ForceRound) {
- a = b = FX_MIN(a, b);
+ a = b = std::min(a, b);
}
CFX_PointF center = rtWidget.Center();
rtWidget.left = center.x - a;
diff --git a/xfa/src/fxfa/src/app/xfa_ffwidgetacc.cpp b/xfa/src/fxfa/src/app/xfa_ffwidgetacc.cpp index 92b6fe920c..717408d7a3 100644 --- a/xfa/src/fxfa/src/app/xfa_ffwidgetacc.cpp +++ b/xfa/src/fxfa/src/app/xfa_ffwidgetacc.cpp @@ -4,6 +4,8 @@ // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
+#include <algorithm>
+
#include "xfa/src/foxitlib.h"
#include "xfa/src/fxfa/src/common/xfa_common.h"
#include "xfa_ffwidget.h"
@@ -825,12 +827,12 @@ FX_BOOL CXFA_WidgetAcc::CalculateFieldAutoSize(CFX_SizeF& size) { case XFA_ATTRIBUTEENUM_Right:
case XFA_ATTRIBUTEENUM_Inline: {
size.x += szCap.x;
- size.y = FX_MAX(size.y, szCap.y);
+ size.y = std::max(size.y, szCap.y);
} break;
case XFA_ATTRIBUTEENUM_Top:
case XFA_ATTRIBUTEENUM_Bottom: {
size.y += szCap.y;
- size.x = FX_MAX(size.x, szCap.x);
+ size.x = std::max(size.x, szCap.x);
}
default:
break;
@@ -859,10 +861,10 @@ FX_BOOL CXFA_WidgetAcc::CalculateWidgetAutoSize(CFX_SizeF& size) { size.x = fVal;
} else {
if (this->GetMinWidth(fMin)) {
- size.x = FX_MAX(size.x, fMin);
+ size.x = std::max(size.x, fMin);
}
if (this->GetMaxWidth(fMax) && fMax > 0) {
- size.x = FX_MIN(size.x, fMax);
+ size.x = std::min(size.x, fMax);
}
}
fVal = 0, fMin = 0, fMax = 0;
@@ -870,10 +872,10 @@ FX_BOOL CXFA_WidgetAcc::CalculateWidgetAutoSize(CFX_SizeF& size) { size.y = fVal;
} else {
if (this->GetMinHeight(fMin)) {
- size.y = FX_MAX(size.y, fMin);
+ size.y = std::max(size.y, fMin);
}
if (this->GetMaxHeight(fMax) && fMax > 0) {
- size.y = FX_MIN(size.y, fMax);
+ size.y = std::min(size.y, fMax);
}
}
return TRUE;
@@ -944,7 +946,7 @@ FX_BOOL CXFA_WidgetAcc::CalculateTextEditAutoSize(CFX_SizeF& size) { case XFA_ATTRIBUTEENUM_Left:
case XFA_ATTRIBUTEENUM_Right:
case XFA_ATTRIBUTEENUM_Inline: {
- size.y = FX_MAX(size.y, szCap.y);
+ size.y = std::max(size.y, szCap.y);
} break;
case XFA_ATTRIBUTEENUM_Top:
case XFA_ATTRIBUTEENUM_Bottom: {
@@ -1071,10 +1073,10 @@ FX_FLOAT CXFA_WidgetAcc::CalculateWidgetAutoWidth(FX_FLOAT fWidthCalc) { }
FX_FLOAT fMin = 0, fMax = 0;
if (this->GetMinWidth(fMin)) {
- fWidthCalc = FX_MAX(fWidthCalc, fMin);
+ fWidthCalc = std::max(fWidthCalc, fMin);
}
if (this->GetMaxWidth(fMax) && fMax > 0) {
- fWidthCalc = FX_MIN(fWidthCalc, fMax);
+ fWidthCalc = std::min(fWidthCalc, fMax);
}
return fWidthCalc;
}
@@ -1098,10 +1100,10 @@ FX_FLOAT CXFA_WidgetAcc::CalculateWidgetAutoHeight(FX_FLOAT fHeightCalc) { }
FX_FLOAT fMin = 0, fMax = 0;
if (this->GetMinHeight(fMin)) {
- fHeightCalc = FX_MAX(fHeightCalc, fMin);
+ fHeightCalc = std::max(fHeightCalc, fMin);
}
if (this->GetMaxHeight(fMax) && fMax > 0) {
- fHeightCalc = FX_MIN(fHeightCalc, fMax);
+ fHeightCalc = std::min(fHeightCalc, fMax);
}
return fHeightCalc;
}
diff --git a/xfa/src/fxfa/src/app/xfa_fontmgr.cpp b/xfa/src/fxfa/src/app/xfa_fontmgr.cpp index 5be4c8b426..ad5120e493 100644 --- a/xfa/src/fxfa/src/app/xfa_fontmgr.cpp +++ b/xfa/src/fxfa/src/app/xfa_fontmgr.cpp @@ -4,6 +4,8 @@ // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
+#include <algorithm>
+
#include "xfa/src/foxitlib.h"
#include "xfa/src/fxfa/src/common/xfa_common.h"
#include "xfa_fontmgr.h"
@@ -1983,7 +1985,7 @@ FX_BOOL CXFA_PDFFontMgr::PsNameMatchDRFontName( }
if (bBoldFont) {
iDifferLength =
- FX_MIN(iDifferLength - 4, bsDRName.GetLength() - iBoldIndex - 4);
+ std::min(iDifferLength - 4, bsDRName.GetLength() - iBoldIndex - 4);
}
FX_BOOL bItalicFont = TRUE;
if (bsDRName.Find("Italic") > 0) {
diff --git a/xfa/src/fxfa/src/app/xfa_textlayout.cpp b/xfa/src/fxfa/src/app/xfa_textlayout.cpp index 45eac17884..83fd9ddda5 100644 --- a/xfa/src/fxfa/src/app/xfa_textlayout.cpp +++ b/xfa/src/fxfa/src/app/xfa_textlayout.cpp @@ -4,6 +4,8 @@ // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
+#include <algorithm>
+
#include "xfa/src/foxitlib.h"
#include "xfa/src/fxfa/src/common/xfa_common.h"
#include "xfa_textlayout.h"
@@ -511,7 +513,7 @@ FX_FLOAT CXFA_TextParser::GetLineHeight(IXFA_TextProvider* pTextProvider, if (fLineHeight < 0.1f) {
fLineHeight = fFontSize;
} else {
- fLineHeight = FX_MIN(fLineHeight, fFontSize);
+ fLineHeight = std::min(fLineHeight, fFontSize);
}
} else if (fLineHeight < 0.1f) {
fLineHeight = GetFontSize(pTextProvider, pStyle) * 1.2f;
@@ -1704,7 +1706,7 @@ void CXFA_TextLayout::DoTabstops(IFDE_CSSComputedStyle* pStyle, }
}
m_pTabstopContext->m_fLeft =
- FX_MIN(fLeft, m_pTabstopContext->m_fTabWidth);
+ std::min(fLeft, m_pTabstopContext->m_fTabWidth);
m_pTabstopContext->m_bTabstops = FALSE;
m_pTabstopContext->m_fTabWidth = 0;
}
@@ -1772,7 +1774,7 @@ void CXFA_TextLayout::AppendTextLine(FX_DWORD dwStatus, } else if (fBaseLine < -fBaseLineTemp) {
fBaseLine = -fBaseLineTemp;
}
- fLineStep = FX_MAX(fLineStep, fLineHeight);
+ fLineStep = std::max(fLineStep, fLineHeight);
if (pUserData != NULL && pUserData->m_pLinkData != NULL) {
pUserData->m_pLinkData->AddRef();
pTP->pLinkData = pUserData->m_pLinkData;
@@ -1786,7 +1788,7 @@ void CXFA_TextLayout::AppendTextLine(FX_DWORD dwStatus, FX_FLOAT& fTop = pTP->rtPiece.top;
FX_FLOAT fBaseLineTemp = fTop;
fTop = fLinePos + fLineStep - pTP->rtPiece.height - fBaseLineTemp;
- fTop = FX_MAX(0, fTop);
+ fTop = std::max(0.0f, fTop);
}
fLinePos += fLineStep + fBaseLine;
} else {
@@ -1809,11 +1811,11 @@ void CXFA_TextLayout::AppendTextLine(FX_DWORD dwStatus, fLineHeight = fLineHeightTmp;
}
}
- fLineStep = FX_MAX(fLineStep, fLineHeight);
+ fLineStep = std::max(fLineStep, fLineHeight);
fLineWidth += pPiece->m_iWidth / 20000.0f;
}
fLinePos += fLineStep;
- m_fMaxWidth = FX_MAX(m_fMaxWidth, fLineWidth);
+ m_fMaxWidth = std::max(m_fMaxWidth, fLineWidth);
if (m_pLoader && m_pLoader->m_bSaveLineHeight) {
FX_FLOAT fHeight = fLinePos - m_pLoader->m_fLastPos;
m_pLoader->m_fLastPos = fLinePos;
diff --git a/xfa/src/fxfa/src/parser/xfa_layout_itemlayout.cpp b/xfa/src/fxfa/src/parser/xfa_layout_itemlayout.cpp index 7d12a289e8..3b991065ad 100644 --- a/xfa/src/fxfa/src/parser/xfa_layout_itemlayout.cpp +++ b/xfa/src/fxfa/src/parser/xfa_layout_itemlayout.cpp @@ -4,6 +4,8 @@ // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
+#include <algorithm>
+
#include "xfa/src/foxitlib.h"
#include "xfa/src/fxfa/src/common/xfa_utils.h"
#include "xfa/src/fxfa/src/common/xfa_object.h"
@@ -1277,8 +1279,8 @@ static inline void XFA_ItemLayoutProcessor_RelocateTableRowCells( fColSpanWidth += rgSpecifiedColumnWidths[nCurrentColIdx + i];
}
if (nColSpan != nOriginalColSpan) {
- fColSpanWidth =
- bMetWholeRowCell ? 0 : FX_MAX(fColSpanWidth, pLayoutChild->m_sSize.y);
+ fColSpanWidth = bMetWholeRowCell ? 0 : std::max(fColSpanWidth,
+ pLayoutChild->m_sSize.y);
}
if (nOriginalColSpan == -1) {
bMetWholeRowCell = TRUE;
|