summaryrefslogtreecommitdiff
path: root/fpdfsdk
diff options
context:
space:
mode:
Diffstat (limited to 'fpdfsdk')
-rw-r--r--fpdfsdk/include/fxedit/fxet_edit.h35
-rw-r--r--fpdfsdk/src/fpdf_flatten.cpp6
-rw-r--r--fpdfsdk/src/fsdk_baseannot.cpp8
-rw-r--r--fpdfsdk/src/fxedit/fxet_edit.cpp7
-rw-r--r--fpdfsdk/src/javascript/PublicMethods.cpp6
-rw-r--r--fpdfsdk/src/pdfwindow/PWL_Utils.cpp15
6 files changed, 33 insertions, 44 deletions
diff --git a/fpdfsdk/include/fxedit/fxet_edit.h b/fpdfsdk/include/fxedit/fxet_edit.h
index 1ecb70426f..d1df3812fc 100644
--- a/fpdfsdk/include/fxedit/fxet_edit.h
+++ b/fpdfsdk/include/fxedit/fxet_edit.h
@@ -8,19 +8,10 @@
#define FPDFSDK_INCLUDE_FXEDIT_FXET_EDIT_H_
#include "core/include/fpdfdoc/fpdf_vt.h"
-#include "fx_edit.h"
-
-class CFX_Edit_Page;
-struct CFX_Edit_LineRect;
-class CFX_Edit_LineRectArray;
-class CFX_Edit_RectArray;
-class CFX_Edit_Refresh;
-class CFX_Edit_Select;
+#include "fpdfsdk/include/fxedit/fx_edit.h"
+
class CFX_Edit;
class CFX_Edit_Iterator;
-class CFX_Edit_Refresh;
-class CFX_Edit_UndoItem;
-class CFX_Edit_Undo;
class CFX_Edit_Provider;
#define FX_EDIT_IsFloatZero(f) (f < 0.0001 && f > -0.0001)
@@ -29,18 +20,6 @@ class CFX_Edit_Provider;
#define FX_EDIT_IsFloatSmaller(fa, fb) \
(fa < fb && !FX_EDIT_IsFloatEqual(fa, fb))
-template <class T>
-T FX_EDIT_MIN(const T& i, const T& j) {
- return ((i < j) ? i : j);
-}
-template <class T>
-T FX_EDIT_MAX(const T& i, const T& j) {
- return ((i > j) ? i : j);
-}
-
-#define FX_EDIT_PI 3.14159265358979f
-#define FX_EDIT_ITALIC_ANGEL 10 * FX_EDIT_PI / 180.0f
-
/* ------------------------- CFX_Edit_Refresh ---------------------------- */
enum REFRESH_PLAN_E { RP_ANALYSE, RP_NOANALYSE, RP_OPTIONAL };
@@ -195,7 +174,7 @@ class CFX_Edit_Select {
Set(begin, end);
}
- CFX_Edit_Select(const CPVT_WordRange& range) {
+ explicit CFX_Edit_Select(const CPVT_WordRange& range) {
Set(range.BeginPos, range.EndPos);
}
@@ -230,7 +209,7 @@ class CFX_Edit_Select {
class CFX_Edit_Undo {
public:
- CFX_Edit_Undo(int32_t nBufsize = 10000);
+ explicit CFX_Edit_Undo(int32_t nBufsize);
virtual ~CFX_Edit_Undo();
void Undo();
@@ -285,7 +264,7 @@ class CFX_Edit_UndoItem : public IFX_Edit_UndoItem {
class CFX_Edit_GroupUndoItem : public IFX_Edit_UndoItem {
public:
- CFX_Edit_GroupUndoItem(const CFX_WideString& sTitle);
+ explicit CFX_Edit_GroupUndoItem(const CFX_WideString& sTitle);
~CFX_Edit_GroupUndoItem() override;
void Undo() override;
@@ -542,7 +521,7 @@ class CFX_Edit : public IFX_Edit {
friend class CFXEU_InsertText;
public:
- CFX_Edit(IPDF_VariableText* pVT);
+ explicit CFX_Edit(IPDF_VariableText* pVT);
~CFX_Edit() override;
// IFX_Edit
@@ -813,7 +792,7 @@ class CFX_Edit_Iterator : public IFX_Edit_Iterator {
class CFX_Edit_Provider : public IPDF_VariableText_Provider {
public:
- CFX_Edit_Provider(IFX_Edit_FontMap* pFontMap);
+ explicit CFX_Edit_Provider(IFX_Edit_FontMap* pFontMap);
~CFX_Edit_Provider() override;
IFX_Edit_FontMap* GetFontMap();
diff --git a/fpdfsdk/src/fpdf_flatten.cpp b/fpdfsdk/src/fpdf_flatten.cpp
index 2a0c2d947c..50d5036724 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 629f35a1d2..30e702241e 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"
@@ -819,9 +821,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,