diff options
author | Lei Zhang <thestig@chromium.org> | 2016-01-08 15:31:47 -0800 |
---|---|---|
committer | Lei Zhang <thestig@chromium.org> | 2016-01-08 15:31:47 -0800 |
commit | 9adfbb0920a258e916003b1ee9515e97879db82a (patch) | |
tree | 69c568cf9857ea028da91cc3a73f15a21a2c4c73 /fpdfsdk/src | |
parent | e5ae7226fc3ffad3f76995d31a0f6b2254d50656 (diff) | |
download | pdfium-9adfbb0920a258e916003b1ee9515e97879db82a.tar.xz |
Switch most min/max macros to std::min/max.
Fix lint errors along the way.
R=tsepez@chromium.org
Review URL: https://codereview.chromium.org/1567343002 .
Diffstat (limited to 'fpdfsdk/src')
-rw-r--r-- | fpdfsdk/src/fpdf_flatten.cpp | 6 | ||||
-rw-r--r-- | fpdfsdk/src/fsdk_baseannot.cpp | 8 | ||||
-rw-r--r-- | fpdfsdk/src/fxedit/fxet_edit.cpp | 7 | ||||
-rw-r--r-- | fpdfsdk/src/javascript/PublicMethods.cpp | 6 | ||||
-rw-r--r-- | fpdfsdk/src/pdfwindow/PWL_Utils.cpp | 15 |
5 files changed, 26 insertions, 16 deletions
diff --git a/fpdfsdk/src/fpdf_flatten.cpp b/fpdfsdk/src/fpdf_flatten.cpp index 76ffec3e26..5c30b662c4 100644 --- a/fpdfsdk/src/fpdf_flatten.cpp +++ b/fpdfsdk/src/fpdf_flatten.cpp @@ -6,6 +6,8 @@ #include "public/fpdf_flatten.h" +#include <algorithm> + #include "fpdfsdk/include/fsdk_define.h" typedef CFX_ArrayTemplate<CPDF_Dictionary*> CPDF_ObjectArray; @@ -300,8 +302,8 @@ void GetOffset(FX_FLOAT& fa, FX_FLOAT x4 = matrix.a * rcStream.right + matrix.c * rcStream.top + matrix.e; FX_FLOAT y4 = matrix.b * rcStream.right + matrix.d * rcStream.top + matrix.f; - FX_FLOAT left = FX_MIN(FX_MIN(x1, x2), FX_MIN(x3, x4)); - FX_FLOAT bottom = FX_MIN(FX_MIN(y1, y2), FX_MIN(y3, y4)); + FX_FLOAT left = std::min(std::min(x1, x2), std::min(x3, x4)); + FX_FLOAT bottom = std::min(std::min(y1, y2), std::min(y3, y4)); fa = (rcAnnot.right - rcAnnot.left) / fStreamWidth; fd = (rcAnnot.top - rcAnnot.bottom) / fStreamHeight; diff --git a/fpdfsdk/src/fsdk_baseannot.cpp b/fpdfsdk/src/fsdk_baseannot.cpp index ef7ab0c03a..9540c5766d 100644 --- a/fpdfsdk/src/fsdk_baseannot.cpp +++ b/fpdfsdk/src/fsdk_baseannot.cpp @@ -4,6 +4,8 @@ // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com +#include <algorithm> + #include "core/include/fxcrt/fx_ext.h" #include "fpdfsdk/include/fsdk_baseannot.h" #include "fpdfsdk/include/fsdk_define.h" @@ -815,9 +817,9 @@ FX_BOOL CPDFSDK_BAAnnot::GetColor(FX_COLORREF& color) const { FX_FLOAT y = pEntry->GetNumber(2); FX_FLOAT k = pEntry->GetNumber(3); - FX_FLOAT r = 1.0f - FX_MIN(1.0f, c + k); - FX_FLOAT g = 1.0f - FX_MIN(1.0f, m + k); - FX_FLOAT b = 1.0f - FX_MIN(1.0f, y + k); + FX_FLOAT r = 1.0f - std::min(1.0f, c + k); + FX_FLOAT g = 1.0f - std::min(1.0f, m + k); + FX_FLOAT b = 1.0f - std::min(1.0f, y + k); color = FXSYS_RGB((int)(r * 255), (int)(g * 255), (int)(b * 255)); diff --git a/fpdfsdk/src/fxedit/fxet_edit.cpp b/fpdfsdk/src/fxedit/fxet_edit.cpp index c7abbf44bb..0e66b0e3b5 100644 --- a/fpdfsdk/src/fxedit/fxet_edit.cpp +++ b/fpdfsdk/src/fxedit/fxet_edit.cpp @@ -6,6 +6,8 @@ #include "fpdfsdk/include/fxedit/fxet_edit.h" +#include <algorithm> + #include "core/include/fpdfapi/fpdf_resource.h" #define FX_EDIT_UNDO_MAXITEM 10000 @@ -176,8 +178,7 @@ void CFX_Edit_Refresh::Analyse(int32_t nAlignment) { CPDF_Rect rcResult; FX_FLOAT fWidthDiff; - int32_t szMax = - FX_EDIT_MAX(m_OldLineRects.GetSize(), m_NewLineRects.GetSize()); + int32_t szMax = std::max(m_OldLineRects.GetSize(), m_NewLineRects.GetSize()); int32_t i = 0; while (i < szMax) { @@ -1726,7 +1727,7 @@ void CFX_Edit::SetContentChanged() { void CFX_Edit::SelectAll() { if (m_pVT->IsValid()) { - m_SelState = GetWholeWordRange(); + m_SelState = CFX_Edit_Select(GetWholeWordRange()); SetCaret(m_SelState.EndPos); ScrollToCaret(); diff --git a/fpdfsdk/src/javascript/PublicMethods.cpp b/fpdfsdk/src/javascript/PublicMethods.cpp index 6db31de1e7..d2f7fb09ac 100644 --- a/fpdfsdk/src/javascript/PublicMethods.cpp +++ b/fpdfsdk/src/javascript/PublicMethods.cpp @@ -6,6 +6,8 @@ #include "PublicMethods.h" +#include <algorithm> + #include "Field.h" #include "JS_Context.h" #include "JS_Define.h" @@ -142,10 +144,10 @@ double CJS_PublicMethods::AF_Simple(const FX_WCHAR* sFuction, return dValue1 * dValue2; } if (FXSYS_wcsicmp(sFuction, L"MIN") == 0) { - return FX_MIN(dValue1, dValue2); + return std::min(dValue1, dValue2); } if (FXSYS_wcsicmp(sFuction, L"MAX") == 0) { - return FX_MAX(dValue1, dValue2); + return std::max(dValue1, dValue2); } return dValue1; } diff --git a/fpdfsdk/src/pdfwindow/PWL_Utils.cpp b/fpdfsdk/src/pdfwindow/PWL_Utils.cpp index 3b0f3beff9..27ba8bc99f 100644 --- a/fpdfsdk/src/pdfwindow/PWL_Utils.cpp +++ b/fpdfsdk/src/pdfwindow/PWL_Utils.cpp @@ -4,8 +4,11 @@ // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com -#include "fpdfsdk/include/pdfwindow/PWL_Icon.h" #include "fpdfsdk/include/pdfwindow/PWL_Utils.h" + +#include <algorithm> + +#include "fpdfsdk/include/pdfwindow/PWL_Icon.h" #include "fpdfsdk/include/pdfwindow/PWL_Wnd.h" #define IsFloatZero(f) ((f) < 0.0001 && (f) > -0.0001) @@ -1256,7 +1259,7 @@ void CPWL_Utils::ConvertCMYK2GRAY(FX_FLOAT dC, if (dC < 0 || dC > 1 || dM < 0 || dM > 1 || dY < 0 || dY > 1 || dK < 0 || dK > 1) return; - dGray = 1.0f - FX_MIN(1.0f, 0.3f * dC + 0.59f * dM + 0.11f * dY + dK); + dGray = 1.0f - std::min(1.0f, 0.3f * dC + 0.59f * dM + 0.11f * dY + dK); } void CPWL_Utils::ConvertGRAY2CMYK(FX_FLOAT dGray, @@ -1302,9 +1305,9 @@ void CPWL_Utils::ConvertCMYK2RGB(FX_FLOAT dC, if (dC < 0 || dC > 1 || dM < 0 || dM > 1 || dY < 0 || dY > 1 || dK < 0 || dK > 1) return; - dR = 1.0f - FX_MIN(1.0f, dC + dK); - dG = 1.0f - FX_MIN(1.0f, dM + dK); - dB = 1.0f - FX_MIN(1.0f, dY + dK); + dR = 1.0f - std::min(1.0f, dC + dK); + dG = 1.0f - std::min(1.0f, dM + dK); + dB = 1.0f - std::min(1.0f, dY + dK); } void CPWL_Utils::ConvertRGB2CMYK(FX_FLOAT dR, @@ -1320,7 +1323,7 @@ void CPWL_Utils::ConvertRGB2CMYK(FX_FLOAT dR, dC = 1.0f - dR; dM = 1.0f - dG; dY = 1.0f - dB; - dK = FX_MIN(dC, FX_MIN(dM, dY)); + dK = std::min(dC, std::min(dM, dY)); } void CPWL_Utils::PWLColorToARGB(const CPWL_Color& color, |