summaryrefslogtreecommitdiff
path: root/xfa
diff options
context:
space:
mode:
Diffstat (limited to 'xfa')
-rw-r--r--xfa/src/fdp/src/css/fde_csscache.cpp7
-rw-r--r--xfa/src/fdp/src/fde/fde_gedevice.cpp4
-rw-r--r--xfa/src/fdp/src/tto/fde_textout.cpp10
-rw-r--r--xfa/src/fdp/src/xml/fde_xml.cpp6
-rw-r--r--xfa/src/fee/src/fee/fde_txtedtbuf.cpp10
-rw-r--r--xfa/src/fee/src/fee/fde_txtedtengine.cpp6
-rw-r--r--xfa/src/fee/src/fee/fde_txtedtpage.cpp6
-rw-r--r--xfa/src/fgas/src/crt/fx_memory.cpp6
-rw-r--r--xfa/src/fgas/src/crt/fx_stream.cpp40
-rw-r--r--xfa/src/fgas/src/crt/fx_stream.h2
-rw-r--r--xfa/src/fgas/src/crt/fx_system.cpp4
-rw-r--r--xfa/src/fgas/src/crt/fx_utils.cpp7
-rw-r--r--xfa/src/fgas/src/layout/fx_rtfbreak.cpp12
-rw-r--r--xfa/src/fgas/src/layout/fx_textbreak.cpp10
-rw-r--r--xfa/src/fgas/src/localization/fx_locale.cpp16
-rw-r--r--xfa/src/fgas/src/xml/fx_sax_imp.cpp13
-rw-r--r--xfa/src/fgas/src/xml/fx_sax_imp.h2
-rw-r--r--xfa/src/fwl/src/basewidget/fwl_checkboximp.cpp6
-rw-r--r--xfa/src/fwl/src/basewidget/fwl_editimp.cpp16
-rw-r--r--xfa/src/fwl/src/core/fwl_widgetimp.cpp4
-rw-r--r--xfa/src/fwl/src/theme/widgettp.cpp4
-rw-r--r--xfa/src/fxbarcode/BC_TwoDimWriter.cpp34
-rw-r--r--xfa/src/fxbarcode/common/BC_CommonByteArray.cpp4
-rw-r--r--xfa/src/fxbarcode/datamatrix/BC_DataMatrixDetector.cpp16
-rw-r--r--xfa/src/fxbarcode/oned/BC_OneDReader.cpp4
-rw-r--r--xfa/src/fxbarcode/oned/BC_OneDimWriter.cpp6
-rw-r--r--xfa/src/fxbarcode/oned/BC_OnedCodaBarReader.cpp4
-rw-r--r--xfa/src/fxbarcode/oned/BC_OnedCode128Reader.cpp8
-rw-r--r--xfa/src/fxbarcode/oned/BC_OnedCode39Reader.cpp4
-rw-r--r--xfa/src/fxbarcode/qrcode/BC_QRCoderEncoder.cpp6
-rw-r--r--xfa/src/fxbarcode/qrcode/BC_QRDetector.cpp10
-rw-r--r--xfa/src/fxfa/src/app/xfa_ffapp.cpp4
-rw-r--r--xfa/src/fxfa/src/app/xfa_ffwidget.cpp8
-rw-r--r--xfa/src/fxfa/src/app/xfa_ffwidgetacc.cpp24
-rw-r--r--xfa/src/fxfa/src/app/xfa_fontmgr.cpp4
-rw-r--r--xfa/src/fxfa/src/app/xfa_textlayout.cpp14
-rw-r--r--xfa/src/fxfa/src/parser/xfa_layout_itemlayout.cpp6
37 files changed, 214 insertions, 133 deletions
diff --git a/xfa/src/fdp/src/css/fde_csscache.cpp b/xfa/src/fdp/src/css/fde_csscache.cpp
index fd33019e18..3d3b040a87 100644
--- a/xfa/src/fdp/src/css/fde_csscache.cpp
+++ b/xfa/src/fdp/src/css/fde_csscache.cpp
@@ -4,6 +4,8 @@
// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
+#include <algorithm>
+
#include "xfa/src/foxitlib.h"
#include "fde_csscache.h"
_FDE_CSSCACHEITEM::_FDE_CSSCACHEITEM(IFDE_CSSStyleSheet* p)
@@ -34,8 +36,9 @@ void CFDE_CSSStyleSheetCache::AddStyleSheet(const CFX_ByteStringC& szKey,
IFDE_CSSStyleSheet* pStyleSheet) {
FXSYS_assert(pStyleSheet != NULL);
if (m_pFixedStore == NULL) {
- m_pFixedStore = FX_CreateAllocator(
- FX_ALLOCTYPE_Fixed, FX_MAX(10, m_iMaxItems), sizeof(FDE_CSSCACHEITEM));
+ m_pFixedStore =
+ FX_CreateAllocator(FX_ALLOCTYPE_Fixed, std::max(10, m_iMaxItems),
+ sizeof(FDE_CSSCACHEITEM));
FXSYS_assert(m_pFixedStore != NULL);
}
auto it = m_Stylesheets.find(szKey);
diff --git a/xfa/src/fdp/src/fde/fde_gedevice.cpp b/xfa/src/fdp/src/fde/fde_gedevice.cpp
index 08f05e74bb..f4e46d0d81 100644
--- a/xfa/src/fdp/src/fde/fde_gedevice.cpp
+++ b/xfa/src/fdp/src/fde/fde_gedevice.cpp
@@ -4,6 +4,8 @@
// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
+#include <algorithm>
+
#include "xfa/src/foxitlib.h"
#include "fde_gedevice.h"
#include "fde_geobject.h"
@@ -541,7 +543,7 @@ FX_BOOL CFDE_FxgeDevice::FillLinearGradientPath(IFDE_Brush* pBrush,
FX_FLOAT fLength = fDiagonal.Length();
FX_FLOAT fTotalX = fLength / FXSYS_cos(fTheta);
FX_FLOAT fTotalY = fLength / FXSYS_cos(FX_PI / 2 - fTheta);
- FX_FLOAT fSteps = FX_MAX(fTotalX, fTotalY);
+ FX_FLOAT fSteps = std::max(fTotalX, fTotalY);
FX_FLOAT dx = fTotalX / fSteps;
FX_FLOAT dy = fTotalY / fSteps;
FX_ARGB cr0, cr1;
diff --git a/xfa/src/fdp/src/tto/fde_textout.cpp b/xfa/src/fdp/src/tto/fde_textout.cpp
index b9a8e80107..90f21f15bb 100644
--- a/xfa/src/fdp/src/tto/fde_textout.cpp
+++ b/xfa/src/fdp/src/tto/fde_textout.cpp
@@ -4,6 +4,8 @@
// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
+#include <algorithm>
+
#include "xfa/src/foxitlib.h"
#include "fde_textout.h"
IFDE_TextOut* IFDE_TextOut::Create() {
@@ -270,11 +272,11 @@ void CFDE_TextOut::CalcTextSize(const FX_WCHAR* pwsStr,
rect.top += fStartPos;
rect.left += fInc;
rect.width = fHeight;
- rect.height = FX_MIN(fWidth, rect.Height());
+ rect.height = std::min(fWidth, rect.Height());
} else {
rect.left += fStartPos;
rect.top += fInc;
- rect.width = FX_MIN(fWidth, rect.Width());
+ rect.width = std::min(fWidth, rect.Width());
rect.height = fHeight;
if (m_dwStyles & FDE_TTOSTYLE_LastLineHeight) {
rect.height -= m_fLineSpace - m_fFontSize;
@@ -313,7 +315,7 @@ FX_BOOL CFDE_TextOut::RetrieveLineWidth(FX_DWORD dwBreakStatus,
for (int32_t i = 0; i < iCount; i++) {
const CFX_TxtPiece* pPiece = m_pTxtBreak->GetBreakPiece(i);
fLineWidth += (FX_FLOAT)pPiece->m_iWidth / 20000.0f;
- fStartPos = FX_MIN(fStartPos, (FX_FLOAT)pPiece->m_iStartPos / 20000.0f);
+ fStartPos = std::min(fStartPos, (FX_FLOAT)pPiece->m_iStartPos / 20000.0f);
}
m_pTxtBreak->ClearBreakPieces();
if (dwBreakStatus == FX_TXTBREAK_ParagraphBreak) {
@@ -322,7 +324,7 @@ FX_BOOL CFDE_TextOut::RetrieveLineWidth(FX_DWORD dwBreakStatus,
if (!bLineWrap && dwBreakStatus == FX_TXTBREAK_LineBreak) {
fWidth += fLineWidth;
} else {
- fWidth = FX_MAX(fWidth, fLineWidth);
+ fWidth = std::max(fWidth, fLineWidth);
fHeight += fLineStep;
}
m_iTotalLines++;
diff --git a/xfa/src/fdp/src/xml/fde_xml.cpp b/xfa/src/fdp/src/xml/fde_xml.cpp
index aa217227c4..8725cb7655 100644
--- a/xfa/src/fdp/src/xml/fde_xml.cpp
+++ b/xfa/src/fdp/src/xml/fde_xml.cpp
@@ -4,6 +4,8 @@
// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
+#include <algorithm>
+
#include "xfa/src/foxitlib.h"
#include "fde_xml.h"
#ifdef __cplusplus
@@ -1484,7 +1486,7 @@ void CFDE_XMLSyntaxParser::Init(IFX_Stream* pStream,
int32_t iStreamLength = pStream->GetLength();
FXSYS_assert(iStreamLength > 0);
m_pStream = pStream;
- m_iXMLPlaneSize = FX_MIN(iXMLPlaneSize, iStreamLength);
+ m_iXMLPlaneSize = std::min(iXMLPlaneSize, iStreamLength);
uint8_t bom[4];
m_iCurrentPos = m_pStream->GetBOM(bom);
FXSYS_assert(m_pBuffer == NULL);
@@ -2002,7 +2004,7 @@ void CFDE_XMLSyntaxParser::Init(IFX_Stream* pStream,
int32_t iStreamLength = pStream->GetLength();
FXSYS_assert(iStreamLength > 0);
m_pStream = pStream;
- m_iXMLPlaneSize = FX_MIN(iXMLPlaneSize, iStreamLength);
+ m_iXMLPlaneSize = std::min(iXMLPlaneSize, iStreamLength);
m_iTextDataSize = iTextDataSize;
uint8_t bom[4];
m_iCurrentPos = m_pStream->GetBOM(bom);
diff --git a/xfa/src/fee/src/fee/fde_txtedtbuf.cpp b/xfa/src/fee/src/fee/fde_txtedtbuf.cpp
index 0019207212..bdef8d2a9f 100644
--- a/xfa/src/fee/src/fee/fde_txtedtbuf.cpp
+++ b/xfa/src/fee/src/fee/fde_txtedtbuf.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/fee/include/ifde_txtedtbuf.h"
#include "xfa/src/fee/include/ifde_txtedtengine.h"
@@ -269,7 +271,7 @@ void CFDE_TxtEdtBuf::Insert(int32_t nPos,
if (lpChunk->nUsed != m_nChunkSize) {
cp.nChunkIndex--;
int32_t nFree = m_nChunkSize - lpChunk->nUsed;
- int32_t nCopy = FX_MIN(nLengthTemp, nFree);
+ int32_t nCopy = std::min(nLengthTemp, nFree);
FXSYS_memcpy(lpChunk->wChars + lpChunk->nUsed, lpText,
nCopy * sizeof(FX_WCHAR));
lpText += nCopy;
@@ -282,7 +284,7 @@ void CFDE_TxtEdtBuf::Insert(int32_t nPos,
FDE_LPCHUNKHEADER lpChunk = (FDE_LPCHUNKHEADER)m_pAllocator->Alloc(
sizeof(FDE_CHUNKHEADER) + (m_nChunkSize - 1) * sizeof(FX_WCHAR));
FXSYS_assert(lpChunk);
- int32_t nCopy = FX_MIN(nLengthTemp, m_nChunkSize);
+ int32_t nCopy = std::min(nLengthTemp, m_nChunkSize);
FXSYS_memcpy(lpChunk->wChars, lpText, nCopy * sizeof(FX_WCHAR));
lpText += nCopy;
nLengthTemp -= nCopy;
@@ -302,7 +304,7 @@ void CFDE_TxtEdtBuf::Delete(int32_t nIndex, int32_t nLength) {
int32_t nFirstPart = cpEnd.nCharIndex + 1;
int32_t nMovePart = lpChunk->nUsed - nFirstPart;
if (nMovePart != 0) {
- int32_t nDelete = FX_MIN(nFirstPart, nLength);
+ int32_t nDelete = std::min(nFirstPart, nLength);
FXSYS_memmove(lpChunk->wChars + nFirstPart - nDelete,
lpChunk->wChars + nFirstPart, nMovePart * sizeof(FX_WCHAR));
lpChunk->nUsed -= nDelete;
@@ -311,7 +313,7 @@ void CFDE_TxtEdtBuf::Delete(int32_t nIndex, int32_t nLength) {
}
while (nLength > 0) {
lpChunk = (FDE_LPCHUNKHEADER)m_Chunks[cpEnd.nChunkIndex];
- int32_t nDeleted = FX_MIN(lpChunk->nUsed, nLength);
+ int32_t nDeleted = std::min(lpChunk->nUsed, nLength);
lpChunk->nUsed -= nDeleted;
if (lpChunk->nUsed == 0) {
m_pAllocator->Free(lpChunk);
diff --git a/xfa/src/fee/src/fee/fde_txtedtengine.cpp b/xfa/src/fee/src/fee/fde_txtedtengine.cpp
index 51f41d1273..7d87f2c0e9 100644
--- a/xfa/src/fee/src/fee/fde_txtedtengine.cpp
+++ b/xfa/src/fee/src/fee/fde_txtedtengine.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/fee/include/ifde_txtedtengine.h"
#include "xfa/src/fee/include/ifde_txtedtbuf.h"
@@ -122,7 +124,7 @@ void CFDE_TxtEdtEngine::SetTextByStream(IFX_Stream* pStream) {
uint8_t bom[4];
int32_t nPos = pStream->GetBOM(bom);
pStream->Seek(FX_STREAMSEEK_Begin, nPos);
- int32_t nPlateSize = FX_MIN(nStreamLength, m_pTxtBuf->GetChunkSize());
+ int32_t nPlateSize = std::min(nStreamLength, m_pTxtBuf->GetChunkSize());
FX_WCHAR* lpwstr = FX_Alloc(FX_WCHAR, nPlateSize);
FX_BOOL bEos = false;
while (!bEos) {
@@ -389,7 +391,7 @@ int32_t CFDE_TxtEdtEngine::MoveCaretPos(FDE_TXTEDTMOVECARET eMoveCaret,
break;
}
if (bShift && m_nAnchorPos != -1 && (m_nAnchorPos != m_nCaret)) {
- AddSelRange(FX_MIN(m_nAnchorPos, m_nCaret),
+ AddSelRange(std::min(m_nAnchorPos, m_nCaret),
FXSYS_abs(m_nAnchorPos - m_nCaret));
m_Param.pEventSink->On_SelChanged(this);
}
diff --git a/xfa/src/fee/src/fee/fde_txtedtpage.cpp b/xfa/src/fee/src/fee/fde_txtedtpage.cpp
index 2c592232f6..fbeccbeba0 100644
--- a/xfa/src/fee/src/fee/fde_txtedtpage.cpp
+++ b/xfa/src/fee/src/fee/fde_txtedtpage.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/fee/include/ifde_txtedtbuf.h"
#include "xfa/src/fee/include/ifde_txtedtengine.h"
@@ -395,8 +397,8 @@ int32_t CFDE_TxtEdtPage::LoadPage(FX_LPCRECTF pClipBox, IFX_Pause* pPause) {
pBreak->ClearBreakPieces();
int32_t nPageLineCount = m_pEditEngine->GetPageLineCount();
int32_t nStartLine = nPageLineCount * m_nPageIndex;
- int32_t nEndLine = FX_MIN((nStartLine + nPageLineCount - 1),
- (m_pEditEngine->GetLineCount() - 1));
+ int32_t nEndLine = std::min((nStartLine + nPageLineCount - 1),
+ (m_pEditEngine->GetLineCount() - 1));
int32_t nPageStart, nPageEnd, nTemp, nBgnParag, nStartLineInParag, nEndParag,
nEndLineInParag;
nBgnParag = m_pEditEngine->Line2Parag(0, 0, nStartLine, nStartLineInParag);
diff --git a/xfa/src/fgas/src/crt/fx_memory.cpp b/xfa/src/fgas/src/crt/fx_memory.cpp
index a450119caf..0f17dc8a7e 100644
--- a/xfa/src/fgas/src/crt/fx_memory.cpp
+++ b/xfa/src/fgas/src/crt/fx_memory.cpp
@@ -4,6 +4,8 @@
// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
+#include <algorithm>
+
#include "xfa/src/fgas/src/fgas_base.h"
#include "fx_memory.h"
#define FX_4BYTEALIGN(size) (((size) + 3) / 4 * 4)
@@ -59,7 +61,7 @@ FX_LPSTATICSTORECHUNK CFX_StaticStore::AllocChunk(size_t size) {
FX_LPSTATICSTORECHUNK CFX_StaticStore::FindChunk(size_t size) {
FXSYS_assert(size != 0);
if (m_pLastChunk == NULL || m_pLastChunk->iFreeSize < size) {
- return AllocChunk(FX_MAX(m_iDefChunkSize, size));
+ return AllocChunk(std::max(m_iDefChunkSize, size));
}
return m_pLastChunk;
}
@@ -242,7 +244,7 @@ void* CFX_DynamicStore::Alloc(size_t size) {
pChunk = pChunk->pNextChunk;
}
if (pChunk == NULL) {
- pChunk = AllocChunk(FX_MAX(m_iDefChunkSize, size));
+ pChunk = AllocChunk(std::max(m_iDefChunkSize, size));
pBlock = pChunk->FirstBlock();
}
FXSYS_assert(pChunk != NULL && pBlock != NULL);
diff --git a/xfa/src/fgas/src/crt/fx_stream.cpp b/xfa/src/fgas/src/crt/fx_stream.cpp
index 9bb59782c2..fb8c3c7fba 100644
--- a/xfa/src/fgas/src/crt/fx_stream.cpp
+++ b/xfa/src/fgas/src/crt/fx_stream.cpp
@@ -4,6 +4,8 @@
// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
+#include <algorithm>
+
#include "xfa/src/fgas/src/fgas_base.h"
#include "fx_stream.h"
IFX_Stream* IFX_Stream::CreateStream(IFX_BufferRead* pBufferRead,
@@ -204,7 +206,7 @@ int32_t CFX_FileStreamImp::ReadString(FX_WCHAR* pStr,
return 0;
}
int32_t iPosition = FXSYS_ftell(m_hFile);
- int32_t iLen = FX_MIN((m_iLength - iPosition) / 2, iMaxLength);
+ int32_t iLen = std::min((m_iLength - iPosition) / 2, iMaxLength);
if (iLen <= 0) {
return 0;
}
@@ -415,7 +417,7 @@ int32_t CFX_BufferReadStreamImp::ReadData(uint8_t* pBuffer,
const uint8_t* pBufferTmp = m_pBufferRead->GetBlockBuffer();
FX_DWORD dwOffsetTmp = m_iPosition - dwBlockOffset;
FX_DWORD dwCopySize =
- FX_MIN(iBufferSize, (int32_t)(dwBlockSize - dwOffsetTmp));
+ std::min(iBufferSize, (int32_t)(dwBlockSize - dwOffsetTmp));
FXSYS_memcpy(pBuffer, pBufferTmp + dwOffsetTmp, dwCopySize);
dwOffsetTmp = dwCopySize;
iBufferSize -= dwCopySize;
@@ -426,7 +428,7 @@ int32_t CFX_BufferReadStreamImp::ReadData(uint8_t* pBuffer,
dwBlockOffset = m_pBufferRead->GetBlockOffset();
dwBlockSize = m_pBufferRead->GetBlockSize();
pBufferTmp = m_pBufferRead->GetBlockBuffer();
- dwCopySize = FX_MIN((FX_DWORD)iBufferSize, dwBlockSize);
+ dwCopySize = std::min((FX_DWORD)iBufferSize, dwBlockSize);
FXSYS_memcpy(pBuffer + dwOffsetTmp, pBufferTmp, dwCopySize);
dwOffsetTmp += dwCopySize;
iBufferSize -= dwCopySize;
@@ -562,7 +564,7 @@ FX_BOOL CFX_BufferStreamImp::IsEOF() const {
int32_t CFX_BufferStreamImp::ReadData(uint8_t* pBuffer, int32_t iBufferSize) {
FXSYS_assert(m_pData != NULL);
FXSYS_assert(pBuffer != NULL && iBufferSize > 0);
- int32_t iLen = FX_MIN(m_iLength - m_iPosition, iBufferSize);
+ int32_t iLen = std::min(m_iLength - m_iPosition, iBufferSize);
if (iLen <= 0) {
return 0;
}
@@ -575,7 +577,7 @@ int32_t CFX_BufferStreamImp::ReadString(FX_WCHAR* pStr,
FX_BOOL& bEOS) {
FXSYS_assert(m_pData != NULL);
FXSYS_assert(pStr != NULL && iMaxLength > 0);
- int32_t iLen = FX_MIN((m_iLength - m_iPosition) / 2, iMaxLength);
+ int32_t iLen = std::min((m_iLength - m_iPosition) / 2, iMaxLength);
if (iLen <= 0) {
return 0;
}
@@ -592,7 +594,7 @@ int32_t CFX_BufferStreamImp::WriteData(const uint8_t* pBuffer,
int32_t iBufferSize) {
FXSYS_assert(m_pData != NULL && (m_dwAccess & FX_STREAMACCESS_Write) != 0);
FXSYS_assert(pBuffer != NULL && iBufferSize > 0);
- int32_t iLen = FX_MIN(m_iTotalSize - m_iPosition, iBufferSize);
+ int32_t iLen = std::min(m_iTotalSize - m_iPosition, iBufferSize);
if (iLen <= 0) {
return 0;
}
@@ -607,7 +609,7 @@ int32_t CFX_BufferStreamImp::WriteString(const FX_WCHAR* pStr,
int32_t iLength) {
FXSYS_assert(m_pData != NULL && (m_dwAccess & FX_STREAMACCESS_Write) != 0);
FXSYS_assert(pStr != NULL && iLength > 0);
- int32_t iLen = FX_MIN((m_iTotalSize - m_iPosition) / 2, iLength);
+ int32_t iLen = std::min((m_iTotalSize - m_iPosition) / 2, iLength);
if (iLen <= 0) {
return 0;
}
@@ -688,7 +690,7 @@ void CFX_TextStream::InitStream() {
}
}
#endif
- m_pStreamImp->Seek(FX_STREAMSEEK_Begin, FX_MAX(m_wBOMLength, iPosition));
+ m_pStreamImp->Seek(FX_STREAMSEEK_Begin, std::max(m_wBOMLength, iPosition));
}
void CFX_TextStream::Release() {
if (--m_iRefCount < 1) {
@@ -747,7 +749,7 @@ int32_t CFX_TextStream::GetBOM(uint8_t bom[4]) const {
return 0;
}
*(FX_DWORD*)bom = m_dwBOM;
- return (int32_t)m_wBOMLength;
+ return m_wBOMLength;
}
FX_WORD CFX_TextStream::SetCodePage(FX_WORD wCodePage) {
if (m_wBOMLength > 0) {
@@ -788,7 +790,7 @@ int32_t CFX_TextStream::ReadString(FX_WCHAR* pStr,
} else {
int32_t pos = m_pStreamImp->GetPosition();
int32_t iBytes = pByteSize == NULL ? iMaxLength : *pByteSize;
- iBytes = FX_MIN(iBytes, m_pStreamImp->GetLength() - pos);
+ iBytes = std::min(iBytes, m_pStreamImp->GetLength() - pos);
if (iBytes > 0) {
if (m_pBuf == NULL) {
m_pBuf = FX_Alloc(uint8_t, iBytes);
@@ -1024,7 +1026,7 @@ int32_t CFX_Stream::ReadData(uint8_t* pBuffer, int32_t iBufferSize) {
if (m_pStreamImp == NULL) {
return -1;
}
- int32_t iLen = FX_MIN(m_iStart + m_iLength - m_iPosition, iBufferSize);
+ int32_t iLen = std::min(m_iStart + m_iLength - m_iPosition, iBufferSize);
if (iLen <= 0) {
return 0;
}
@@ -1048,9 +1050,9 @@ int32_t CFX_Stream::ReadString(FX_WCHAR* pStr,
int32_t iEnd = m_iStart + m_iLength;
int32_t iLen = iEnd - m_iPosition;
if (pByteSize != NULL) {
- iLen = FX_MIN(iLen, *pByteSize);
+ iLen = std::min(iLen, *pByteSize);
}
- iLen = FX_MIN(iEnd / 2, iMaxLength);
+ iLen = std::min(iEnd / 2, iMaxLength);
if (iLen <= 0) {
return 0;
}
@@ -1076,7 +1078,7 @@ int32_t CFX_Stream::WriteData(const uint8_t* pBuffer, int32_t iBufferSize) {
}
int32_t iLen = iBufferSize;
if (m_eStreamType == FX_STREAMTYPE_Stream) {
- iLen = FX_MIN(m_iStart + m_iTotalSize - m_iPosition, iBufferSize);
+ iLen = std::min(m_iStart + m_iTotalSize - m_iPosition, iBufferSize);
if (iLen <= 0) {
return 0;
}
@@ -1104,7 +1106,7 @@ int32_t CFX_Stream::WriteString(const FX_WCHAR* pStr, int32_t iLength) {
}
int32_t iLen = iLength;
if (m_eStreamType == FX_STREAMTYPE_Stream) {
- iLen = FX_MIN((m_iStart + m_iTotalSize - m_iPosition) / 2, iLength);
+ iLen = std::min((m_iStart + m_iTotalSize - m_iPosition) / 2, iLength);
if (iLen <= 0) {
return 0;
}
@@ -1322,7 +1324,7 @@ FX_BOOL CFX_BufferAccImp::ReadBlock(void* buffer,
}
const uint8_t* pBuffer = m_pBufferRead->GetBlockBuffer();
FX_FILESIZE dwOffset = offset - dwBlockOffset;
- size_t dwCopySize = FX_MIN(size, dwBlockSize - dwOffset);
+ size_t dwCopySize = std::min(size, dwBlockSize - dwOffset);
FXSYS_memcpy(buffer, pBuffer + dwOffset, dwCopySize);
offset = dwCopySize;
size -= dwCopySize;
@@ -1333,7 +1335,7 @@ FX_BOOL CFX_BufferAccImp::ReadBlock(void* buffer,
dwBlockOffset = m_pBufferRead->GetBlockOffset();
dwBlockSize = m_pBufferRead->GetBlockSize();
pBuffer = m_pBufferRead->GetBlockBuffer();
- dwCopySize = FX_MIN(size, dwBlockSize);
+ dwCopySize = std::min(size, dwBlockSize);
FXSYS_memcpy(((uint8_t*)buffer) + offset, pBuffer, dwCopySize);
offset += dwCopySize;
size -= dwCopySize;
@@ -1415,7 +1417,7 @@ FX_BOOL CFX_BufferAccImp::ReadBlock(void* buffer,
}
const uint8_t* pBuffer = m_pBufferRead->GetBlockBuffer();
FX_DWORD dwOffset = offset - dwBlockOffset;
- FX_DWORD dwCopySize = FX_MIN(size, dwBlockSize - dwOffset);
+ FX_DWORD dwCopySize = std::min(size, dwBlockSize - dwOffset);
FXSYS_memcpy(buffer, pBuffer + dwOffset, dwCopySize);
offset = dwCopySize;
size -= dwCopySize;
@@ -1426,7 +1428,7 @@ FX_BOOL CFX_BufferAccImp::ReadBlock(void* buffer,
dwBlockOffset = m_pBufferRead->GetBlockOffset();
dwBlockSize = m_pBufferRead->GetBlockSize();
pBuffer = m_pBufferRead->GetBlockBuffer();
- dwCopySize = FX_MIN(size, dwBlockSize);
+ dwCopySize = std::min(size, dwBlockSize);
FXSYS_memcpy(((uint8_t*)buffer) + offset, pBuffer, dwCopySize);
offset += dwCopySize;
size -= dwCopySize;
diff --git a/xfa/src/fgas/src/crt/fx_stream.h b/xfa/src/fgas/src/crt/fx_stream.h
index bb13758f7b..8edd7e2627 100644
--- a/xfa/src/fgas/src/crt/fx_stream.h
+++ b/xfa/src/fgas/src/crt/fx_stream.h
@@ -252,7 +252,7 @@ class CFX_TextStream : public IFX_Stream, public CFX_ThreadLock {
protected:
FX_WORD m_wCodePage;
- FX_WORD m_wBOMLength;
+ int32_t m_wBOMLength;
FX_DWORD m_dwBOM;
uint8_t* m_pBuf;
int32_t m_iBufSize;
diff --git a/xfa/src/fgas/src/crt/fx_system.cpp b/xfa/src/fgas/src/crt/fx_system.cpp
index 0de8e0eb5b..861d1177ad 100644
--- a/xfa/src/fgas/src/crt/fx_system.cpp
+++ b/xfa/src/fgas/src/crt/fx_system.cpp
@@ -4,6 +4,8 @@
// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
+#include <algorithm>
+
#include "xfa/src/fgas/src/fgas_base.h"
#if _FX_OS_ == _FX_WIN32_DESKTOP_ || _FX_OS_ == _FX_WIN32_MOBILE_ || \
_FX_OS_ == _FX_WIN64_
@@ -155,7 +157,7 @@ FX_BOOL FX_IsRelativePath(const CFX_WideStringC& wsUrl) {
if (iUrlLen == 0) {
return TRUE;
}
- for (int32_t i = FX_MIN(5, iUrlLen) - 1; i >= 0; --i)
+ for (int32_t i = std::min(5, iUrlLen) - 1; i >= 0; --i)
if (wsUrl.GetAt(i) == ':') {
return FALSE;
}
diff --git a/xfa/src/fgas/src/crt/fx_utils.cpp b/xfa/src/fgas/src/crt/fx_utils.cpp
index 9d89e240f4..7cc4de7022 100644
--- a/xfa/src/fgas/src/crt/fx_utils.cpp
+++ b/xfa/src/fgas/src/crt/fx_utils.cpp
@@ -4,6 +4,8 @@
// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
+#include <algorithm>
+
#include "xfa/src/fgas/include/fx_utl.h"
#include "xfa/src/fgas/src/fgas_base.h"
#include "fx_utils.h"
@@ -241,7 +243,8 @@ void CFX_BaseMassArrayImp::Append(int32_t iDstStart,
uint8_t* pSrcChunk = (uint8_t*)src.GetAt(iSrcStart);
int32_t iDstChunkSize = m_iChunkSize - (iDstStart % m_iChunkSize);
int32_t iSrcChunkSize = src.m_iChunkSize - (iSrcStart % src.m_iChunkSize);
- int32_t iCopySize = FX_MIN(iSrcCount, FX_MIN(iSrcChunkSize, iDstChunkSize));
+ int32_t iCopySize =
+ std::min(iSrcCount, std::min(iSrcChunkSize, iDstChunkSize));
int32_t iCopyBytes = iCopySize * m_iBlockSize;
while (iSrcCount > 0) {
FXSYS_assert(pDstChunk != NULL && pSrcChunk != NULL);
@@ -263,7 +266,7 @@ void CFX_BaseMassArrayImp::Append(int32_t iDstStart,
} else {
pDstChunk += iCopyBytes;
}
- iCopySize = FX_MIN(iSrcCount, FX_MIN(iSrcChunkSize, iDstChunkSize));
+ iCopySize = std::min(iSrcCount, std::min(iSrcChunkSize, iDstChunkSize));
iCopyBytes = iCopySize * m_iBlockSize;
}
}
diff --git a/xfa/src/fgas/src/layout/fx_rtfbreak.cpp b/xfa/src/fgas/src/layout/fx_rtfbreak.cpp
index 8683bcfdb6..26d27312bc 100644
--- a/xfa/src/fgas/src/layout/fx_rtfbreak.cpp
+++ b/xfa/src/fgas/src/layout/fx_rtfbreak.cpp
@@ -4,6 +4,8 @@
// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
+#include <algorithm>
+
#include "xfa/src/fgas/include/fx_lbk.h"
#include "xfa/src/fgas/src/fgas_base.h"
#include "xfa/src/fgas/src/layout/fx_unicode.h"
@@ -389,7 +391,7 @@ FX_DWORD CFX_RTFBreak::AppendChar(FX_WCHAR wch) {
(this->*g_FX_RTFBreak_lpfAppendChar[dwType >> FX_CHARTYPEBITS])(
pCurChar, iRotation);
m_dwCharType = dwType;
- return FX_MAX(dwRet1, dwRet2);
+ return std::max(dwRet1, dwRet2);
}
FX_DWORD CFX_RTFBreak::AppendChar_CharCode(FX_WCHAR wch) {
FXSYS_assert(m_pFont != NULL && m_pCurLine != NULL);
@@ -1151,7 +1153,7 @@ void CFX_RTFBreak::GetLineRect(CFX_RectF& rect) const {
pBreakPiece = rtfPieces.GetPtrAt(i);
int32_t iFontHeight = FXSYS_round(pBreakPiece->m_iFontHeight *
pBreakPiece->m_iVerticalScale / 100.0f);
- iMax = FX_MAX(pBreakPiece->m_iFontSize, iFontHeight);
+ iMax = std::max(pBreakPiece->m_iFontSize, iFontHeight);
if (i == 0) {
iLineHeight = iMax;
} else if (iLineHeight < iMax) {
@@ -1441,7 +1443,7 @@ int32_t CFX_RTFBreak::GetCharRects(FX_LPCRTFTEXTOBJ pText,
if (bCharBBox) {
bCharBBox = pFont->GetBBox(bbox);
}
- FX_FLOAT fLeft = FX_MAX(0, bbox.left * fScale);
+ FX_FLOAT fLeft = std::max(0.0f, bbox.left * fScale);
FX_FLOAT fHeight = FXSYS_fabs(bbox.height * fScale);
rtArray.RemoveAll();
rtArray.SetSize(iLength);
@@ -1506,13 +1508,13 @@ int32_t CFX_RTFBreak::GetCharRects(FX_LPCRTFTEXTOBJ pText,
rtBBoxF.left = rect.top + (rect.height - fHeight) / 2.0f;
rtBBoxF.height = fCharWidth;
rtBBoxF.width = fHeight;
- rtBBoxF.left = FX_MAX(rtBBoxF.left, 0);
+ rtBBoxF.left = std::max(rtBBoxF.left, 0.0f);
} else {
rtBBoxF.left = rect.left + fRTLeft;
rtBBoxF.top = rect.top + (rect.height - fHeight) / 2.0f;
rtBBoxF.width = fCharWidth;
rtBBoxF.height = fHeight;
- rtBBoxF.top = FX_MAX(rtBBoxF.top, 0);
+ rtBBoxF.top = std::max(rtBBoxF.top, 0.0f);
}
rtArray.SetAt(i, rtBBoxF);
continue;
diff --git a/xfa/src/fgas/src/layout/fx_textbreak.cpp b/xfa/src/fgas/src/layout/fx_textbreak.cpp
index 754e10d863..a9ce859623 100644
--- a/xfa/src/fgas/src/layout/fx_textbreak.cpp
+++ b/xfa/src/fgas/src/layout/fx_textbreak.cpp
@@ -4,6 +4,8 @@
// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
+#include <algorithm>
+
#include "core/include/fxcrt/fx_arb.h"
#include "xfa/src/fgas/include/fx_lbk.h"
#include "xfa/src/fgas/src/fgas_base.h"
@@ -605,7 +607,7 @@ FX_DWORD CFX_TxtBreak::AppendChar(FX_WCHAR wch) {
FX_DWORD dwRet2 =
(this->*g_FX_TxtBreak_lpfAppendChar[dwType >> FX_CHARTYPEBITS])(
pCurChar, iRotation);
- return FX_MAX(dwRet1, dwRet2);
+ return std::max(dwRet1, dwRet2);
}
void CFX_TxtBreak::EndBreak_UpdateArabicShapes() {
FXSYS_assert(m_bArabicShapes);
@@ -1572,7 +1574,7 @@ int32_t CFX_TxtBreak::GetCharRects(FX_LPCTXTRUN pTxtRun,
if (bCharBBox) {
bCharBBox = pFont->GetBBox(bbox);
}
- FX_FLOAT fLeft = FX_MAX(0, bbox.left * fScale);
+ FX_FLOAT fLeft = std::max(0.0f, bbox.left * fScale);
FX_FLOAT fHeight = FXSYS_fabs(bbox.height * fScale);
rtArray.RemoveAll();
rtArray.SetSize(iLength);
@@ -1642,13 +1644,13 @@ int32_t CFX_TxtBreak::GetCharRects(FX_LPCTXTRUN pTxtRun,
rtBBoxF.left = rect.top + (rect.height - fHeight) / 2.0f;
rtBBoxF.height = fCharWidth;
rtBBoxF.width = fHeight;
- rtBBoxF.left = FX_MAX(rtBBoxF.left, 0);
+ rtBBoxF.left = std::max(rtBBoxF.left, 0.0f);
} else {
rtBBoxF.left = rect.left + fRTLeft;
rtBBoxF.top = rect.top + (rect.height - fHeight) / 2.0f;
rtBBoxF.width = fCharWidth;
rtBBoxF.height = fHeight;
- rtBBoxF.top = FX_MAX(rtBBoxF.top, 0);
+ rtBBoxF.top = std::max(rtBBoxF.top, 0.0f);
}
rtArray.SetAt(i, rtBBoxF);
continue;
diff --git a/xfa/src/fgas/src/localization/fx_locale.cpp b/xfa/src/fgas/src/localization/fx_locale.cpp
index d9424c39fc..49629101c9 100644
--- a/xfa/src/fgas/src/localization/fx_locale.cpp
+++ b/xfa/src/fgas/src/localization/fx_locale.cpp
@@ -4,6 +4,8 @@
// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
+#include <algorithm>
+
#include "core/include/fxcrt/fx_xml.h"
#include "xfa/src/fgas/src/fgas_base.h"
#include "fx_localeimp.h"
@@ -4579,7 +4581,7 @@ static inline int8_t fxmath_decimal_helper_raw_compare_any(uint64_t a[],
uint64_t b[],
uint8_t bl) {
int8_t retVal = 0;
- for (int i = FX_MAX(al - 1, bl - 1); i >= 0; i--) {
+ for (int i = std::max(al - 1, bl - 1); i >= 0; i--) {
uint64_t l = (i >= al ? 0 : a[i]), r = (i >= bl ? 0 : b[i]);
retVal += (l > r ? 1 : (l < r ? -1 : 0));
if (retVal) {
@@ -4680,13 +4682,13 @@ static inline void fxmath_decimal_helper_raw_div(uint64_t a[],
fxmath_decimal_helper_dec_any(right, al);
break;
case 0:
- for (i = 0; i < FX_MIN(al, cl); i++) {
+ for (i = 0; i < std::min(al, cl); i++) {
c[i] = cur[i];
}
return;
}
}
- for (i = 0; i < FX_MIN(al, cl); i++) {
+ for (i = 0; i < std::min(al, cl); i++) {
c[i] = left[i];
}
}
@@ -4956,8 +4958,8 @@ int8_t CFX_Decimal::Compare(const CFX_Decimal& val) const {
int8_t retVal = 0;
if (FXMATH_DECIMAL_FLAGS2SCALE(lhs.m_uFlags) !=
FXMATH_DECIMAL_FLAGS2SCALE(rhs.m_uFlags)) {
- uint8_t scale = FX_MIN(FXMATH_DECIMAL_FLAGS2SCALE(lhs.m_uFlags),
- FXMATH_DECIMAL_FLAGS2SCALE(rhs.m_uFlags));
+ uint8_t scale = std::min(FXMATH_DECIMAL_FLAGS2SCALE(lhs.m_uFlags),
+ FXMATH_DECIMAL_FLAGS2SCALE(rhs.m_uFlags));
lhs.SetScale(scale);
rhs.SetScale(scale);
}
@@ -4975,8 +4977,8 @@ CFX_Decimal CFX_Decimal::AddOrMinus(const CFX_Decimal& val,
CFX_Decimal lhs = *this, rhs = val;
if (FXMATH_DECIMAL_FLAGS2SCALE(lhs.m_uFlags) !=
FXMATH_DECIMAL_FLAGS2SCALE(rhs.m_uFlags)) {
- uint8_t scale = FX_MAX(FXMATH_DECIMAL_FLAGS2SCALE(lhs.m_uFlags),
- FXMATH_DECIMAL_FLAGS2SCALE(rhs.m_uFlags));
+ uint8_t scale = std::max(FXMATH_DECIMAL_FLAGS2SCALE(lhs.m_uFlags),
+ FXMATH_DECIMAL_FLAGS2SCALE(rhs.m_uFlags));
lhs.SetScale(scale);
rhs.SetScale(scale);
}
diff --git a/xfa/src/fgas/src/xml/fx_sax_imp.cpp b/xfa/src/fgas/src/xml/fx_sax_imp.cpp
index dce96470a6..6b3cc778ab 100644
--- a/xfa/src/fgas/src/xml/fx_sax_imp.cpp
+++ b/xfa/src/fgas/src/xml/fx_sax_imp.cpp
@@ -4,8 +4,17 @@
// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
+#include <algorithm>
+
#include "xfa/src/fgas/src/fgas_base.h"
#include "fx_sax_imp.h"
+
+namespace {
+
+const FX_DWORD kSaxFileBufSize = 32768;
+
+} // namespace
+
IFX_SAXReader* FX_SAXReader_Create() {
return new CFX_SAXReader;
}
@@ -31,7 +40,7 @@ FX_BOOL CFX_SAXFile::StartFile(IFX_FileRead* pFile,
if (dwLen == 0) {
return FALSE;
}
- m_dwBufSize = FX_MIN(dwLen, FX_SAXFILE_BUFSIZE);
+ m_dwBufSize = std::min(dwLen, kSaxFileBufSize);
m_pBuf = FX_Alloc(uint8_t, m_dwBufSize);
if (!pFile->ReadBlock(m_pBuf, dwStart, m_dwBufSize)) {
return FALSE;
@@ -49,7 +58,7 @@ FX_BOOL CFX_SAXFile::ReadNextBlock() {
if (dwSize == 0) {
return FALSE;
}
- m_dwBufSize = FX_MIN(dwSize, FX_SAXFILE_BUFSIZE);
+ m_dwBufSize = std::min(dwSize, kSaxFileBufSize);
if (!m_pFile->ReadBlock(m_pBuf, m_dwCur, m_dwBufSize)) {
return FALSE;
}
diff --git a/xfa/src/fgas/src/xml/fx_sax_imp.h b/xfa/src/fgas/src/xml/fx_sax_imp.h
index 7d04f14698..71be388efd 100644
--- a/xfa/src/fgas/src/xml/fx_sax_imp.h
+++ b/xfa/src/fgas/src/xml/fx_sax_imp.h
@@ -6,7 +6,7 @@
#ifndef _FX_SAX_IMP_
#define _FX_SAX_IMP_
-#define FX_SAXFILE_BUFSIZE 32768
+
class CFX_SAXFile {
public:
CFX_SAXFile();
diff --git a/xfa/src/fwl/src/basewidget/fwl_checkboximp.cpp b/xfa/src/fwl/src/basewidget/fwl_checkboximp.cpp
index 3df1f21391..3fa2119b02 100644
--- a/xfa/src/fwl/src/basewidget/fwl_checkboximp.cpp
+++ b/xfa/src/fwl/src/basewidget/fwl_checkboximp.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/fwl/src/core/include/fwl_targetimp.h"
#include "xfa/src/fwl/src/core/include/fwl_noteimp.h"
@@ -245,8 +247,8 @@ void CFWL_CheckBoxImp::Layout() {
CalcTextRect(wsCaption, m_pProperties->m_pThemeProvider, m_dwTTOStyles,
m_iTTOAlign, rtFocus);
if ((m_pProperties->m_dwStyleExes & FWL_STYLEEXT_CKB_MultiLine) == 0) {
- FX_FLOAT fWidth = FX_MAX(m_rtCaption.width, rtFocus.width);
- FX_FLOAT fHeight = FX_MIN(m_rtCaption.height, rtFocus.height);
+ FX_FLOAT fWidth = std::max(m_rtCaption.width, rtFocus.width);
+ FX_FLOAT fHeight = std::min(m_rtCaption.height, rtFocus.height);
FX_FLOAT fLeft = m_rtCaption.left;
FX_FLOAT fTop = m_rtCaption.top;
if ((m_pProperties->m_dwStyleExes & FWL_STYLEEXT_CKB_HLayoutMask) ==
diff --git a/xfa/src/fwl/src/basewidget/fwl_editimp.cpp b/xfa/src/fwl/src/basewidget/fwl_editimp.cpp
index 9b652a79fc..06e185e5a2 100644
--- a/xfa/src/fwl/src/basewidget/fwl_editimp.cpp
+++ b/xfa/src/fwl/src/basewidget/fwl_editimp.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/fwl/src/core/include/fwl_threadimp.h"
#include "xfa/src/fwl/src/core/include/fwl_appimp.h"
@@ -887,11 +889,11 @@ void CFWL_EditImp::On_TextChanged(IFDE_TxtEdtEngine* pEdit,
fContentHeight1 = page1->GetContentsBox().height;
}
if (m_pProperties->m_dwStyleExes & FWL_STYLEEXT_EDT_HSelfAdaption) {
- rtTemp.width = FX_MAX(m_pProperties->m_rtWidget.width, fContentWidth1);
+ rtTemp.width = std::max(m_pProperties->m_rtWidget.width, fContentWidth1);
m_pProperties->m_rtWidget.width = fContentWidth1;
}
if (m_pProperties->m_dwStyleExes & FWL_STYLEEXT_EDT_VSelfAdaption) {
- rtTemp.height = FX_MAX(m_pProperties->m_rtWidget.height, fContentHeight1);
+ rtTemp.height = std::max(m_pProperties->m_rtWidget.height, fContentHeight1);
m_pProperties->m_rtWidget.height = fContentHeight1;
}
CFWL_EvtEdtTextChanged event;
@@ -1062,8 +1064,8 @@ void CFWL_EditImp::DrawContent(CFX_Graphics* pGraphics,
if (nCharEnd < nPageCharStart || nCharStart > nPageCharEnd) {
continue;
}
- int32_t nBgn = FX_MAX(nCharStart, nPageCharStart);
- int32_t nEnd = FX_MIN(nCharEnd, nPageCharEnd);
+ int32_t nBgn = std::max(nCharStart, nPageCharStart);
+ int32_t nEnd = std::min(nCharEnd, nPageCharEnd);
pPage->CalcRangeRectArray(nBgn - nPageCharStart, nEnd - nBgn + 1,
rectArr);
}
@@ -1926,8 +1928,8 @@ void CFWL_EditImpDelegate::OnLButtonDown(CFWL_MsgMouse* pMsg) {
}
FX_BOOL bShift = pMsg->m_dwFlags & FWL_KEYFLAG_Shift;
if (bShift && m_pOwner->m_nSelStart != nIndex) {
- int32_t iStart = FX_MIN(m_pOwner->m_nSelStart, nIndex);
- int32_t iEnd = FX_MAX(m_pOwner->m_nSelStart, nIndex);
+ int32_t iStart = std::min(m_pOwner->m_nSelStart, nIndex);
+ int32_t iEnd = std::max(m_pOwner->m_nSelStart, nIndex);
m_pOwner->m_pEdtEngine->AddSelRange(iStart, iEnd - iStart);
bRepaint = TRUE;
} else {
@@ -1985,7 +1987,7 @@ void CFWL_EditImpDelegate::OnMouseMove(CFWL_MsgMouse* pMsg) {
m_pOwner->m_nSelStart = nLen;
}
m_pOwner->m_pEdtEngine->AddSelRange(
- FX_MIN(m_pOwner->m_nSelStart, nIndex),
+ std::min(m_pOwner->m_nSelStart, nIndex),
FXSYS_abs(nIndex - m_pOwner->m_nSelStart));
}
}
diff --git a/xfa/src/fwl/src/core/fwl_widgetimp.cpp b/xfa/src/fwl/src/core/fwl_widgetimp.cpp
index 88db9b30e2..3872def983 100644
--- a/xfa/src/fwl/src/core/fwl_widgetimp.cpp
+++ b/xfa/src/fwl/src/core/fwl_widgetimp.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/fwl/src/core/include/fwl_targetimp.h"
#include "xfa/src/fwl/src/core/include/fwl_noteimp.h"
@@ -769,7 +771,7 @@ FX_BOOL CFWL_WidgetImp::GetPopupPosComboBox(FX_FLOAT fMinHeight,
} else if (rtPopup.height < fMinHeight) {
fPopHeight = fMinHeight;
}
- FX_FLOAT fWidth = FX_MAX(rtAnchor.width, rtPopup.width);
+ FX_FLOAT fWidth = std::max(rtAnchor.width, rtPopup.width);
FX_FLOAT fBottom = rtAnchor.bottom() + fPopHeight;
TransformTo(NULL, fx, fy);
if (fBottom + fy > fScreenHeight) {
diff --git a/xfa/src/fwl/src/theme/widgettp.cpp b/xfa/src/fwl/src/theme/widgettp.cpp
index 7eaf6e881b..e1351b5a21 100644
--- a/xfa/src/fwl/src/theme/widgettp.cpp
+++ b/xfa/src/fwl/src/theme/widgettp.cpp
@@ -4,6 +4,8 @@
// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
+#include <algorithm>
+
#include "xfa/src/foxitlib.h"
static void FWL_SetChildThemeID(IFWL_Widget* pParent, FX_DWORD dwThemeID) {
IFWL_WidgetMgr* pWidgetMgr = FWL_GetWidgetMgr();
@@ -528,7 +530,7 @@ void CFWL_WidgetTP::DrawArrow(CFX_Graphics* pGraphics,
CFX_Path path;
path.Create();
FX_FLOAT fBtn =
- FX_MIN(pRect->width, pRect->height) / FWLTHEME_ARROW_Denominator;
+ std::min(pRect->width, pRect->height) / FWLTHEME_ARROW_Denominator;
rtArrow.left = pRect->left + (pRect->width - fBtn) / 2;
rtArrow.top = pRect->top + (pRect->height - fBtn) / 2;
rtArrow.width = fBtn;
diff --git a/xfa/src/fxbarcode/BC_TwoDimWriter.cpp b/xfa/src/fxbarcode/BC_TwoDimWriter.cpp
index d6d6614449..b270378a87 100644
--- a/xfa/src/fxbarcode/BC_TwoDimWriter.cpp
+++ b/xfa/src/fxbarcode/BC_TwoDimWriter.cpp
@@ -4,10 +4,14 @@
// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
+#include <algorithm>
+
+#include "third_party/base/numerics/safe_math.h"
#include "xfa/src/fxbarcode/barcode.h"
#include "xfa/src/fxbarcode/common/BC_CommonBitMatrix.h"
#include "xfa/src/fxbarcode/BC_Writer.h"
#include "xfa/src/fxbarcode/BC_TwoDimWriter.h"
+
CBC_TwoDimWriter::CBC_TwoDimWriter() {
m_iCorrectLevel = 1;
m_bFixedSize = TRUE;
@@ -92,18 +96,18 @@ void CBC_TwoDimWriter::RenderResult(uint8_t* code,
int32_t& e) {
int32_t inputWidth = codeWidth;
int32_t inputHeight = codeHeight;
- int32_t tempWidth = inputWidth + (1 << 1);
- int32_t tempHeight = inputHeight + (1 << 1);
- FX_FLOAT moduleHSize = (FX_FLOAT)FX_MIN(m_ModuleWidth, m_ModuleHeight);
- if (moduleHSize > 8) {
- moduleHSize = 8;
- } else if (moduleHSize < 1) {
- moduleHSize = 1;
- }
- int32_t outputWidth = (int32_t)FX_MAX(tempWidth * moduleHSize, tempWidth);
- int32_t outputHeight = (int32_t)FX_MAX(tempHeight * moduleHSize, tempHeight);
- int32_t multiX = 1;
- int32_t multiY = 1;
+ int32_t tempWidth = inputWidth + 2;
+ int32_t tempHeight = inputHeight + 2;
+ FX_FLOAT moduleHSize = std::min(m_ModuleWidth, m_ModuleHeight);
+ moduleHSize = std::min(moduleHSize, 8.0f);
+ moduleHSize = std::max(moduleHSize, 1.0f);
+ pdfium::base::CheckedNumeric<int32_t> scaledWidth = tempWidth;
+ pdfium::base::CheckedNumeric<int32_t> scaledHeight = tempHeight;
+ scaledWidth *= moduleHSize;
+ scaledHeight *= moduleHSize;
+
+ int32_t outputWidth = scaledWidth.ValueOrDie();
+ int32_t outputHeight = scaledHeight.ValueOrDie();
if (m_bFixedSize) {
if (m_Width < outputWidth || m_Height < outputHeight) {
e = BCExceptionBitmapSizeError;
@@ -117,10 +121,10 @@ void CBC_TwoDimWriter::RenderResult(uint8_t* code,
outputHeight * ceil((FX_FLOAT)m_Height / (FX_FLOAT)outputHeight));
}
}
- multiX = (int32_t)ceil((FX_FLOAT)outputWidth / (FX_FLOAT)tempWidth);
- multiY = (int32_t)ceil((FX_FLOAT)outputHeight / (FX_FLOAT)tempHeight);
+ int32_t multiX = (int32_t)ceil((FX_FLOAT)outputWidth / (FX_FLOAT)tempWidth);
+ int32_t multiY = (int32_t)ceil((FX_FLOAT)outputHeight / (FX_FLOAT)tempHeight);
if (m_bFixedSize) {
- multiX = FX_MIN(multiX, multiY);
+ multiX = std::min(multiX, multiY);
multiY = multiX;
}
int32_t leftPadding = (outputWidth - (inputWidth * multiX)) / 2;
diff --git a/xfa/src/fxbarcode/common/BC_CommonByteArray.cpp b/xfa/src/fxbarcode/common/BC_CommonByteArray.cpp
index 967a1849d5..c36ff34a6d 100644
--- a/xfa/src/fxbarcode/common/BC_CommonByteArray.cpp
+++ b/xfa/src/fxbarcode/common/BC_CommonByteArray.cpp
@@ -20,6 +20,8 @@
* limitations under the License.
*/
+#include <algorithm>
+
#include "xfa/src/fxbarcode/barcode.h"
#include "BC_CommonByteArray.h"
CBC_CommonByteArray::CBC_CommonByteArray() {
@@ -61,7 +63,7 @@ FX_BOOL CBC_CommonByteArray::IsEmpty() {
}
void CBC_CommonByteArray::AppendByte(int32_t value) {
if (m_size == 0 || m_index >= m_size) {
- int32_t newSize = FX_MAX(32, m_size << 1);
+ int32_t newSize = std::max(32, m_size << 1);
Reserve(newSize);
}
m_bytes[m_index] = (uint8_t)value;
diff --git a/xfa/src/fxbarcode/datamatrix/BC_DataMatrixDetector.cpp b/xfa/src/fxbarcode/datamatrix/BC_DataMatrixDetector.cpp
index c930f0e45d..27c29afe77 100644
--- a/xfa/src/fxbarcode/datamatrix/BC_DataMatrixDetector.cpp
+++ b/xfa/src/fxbarcode/datamatrix/BC_DataMatrixDetector.cpp
@@ -20,6 +20,8 @@
* limitations under the License.
*/
+#include <algorithm>
+
#include "xfa/src/fxbarcode/barcode.h"
#include "xfa/src/fxbarcode/BC_ResultPoint.h"
#include "xfa/src/fxbarcode/common/BC_WhiteRectangleDetector.h"
@@ -166,7 +168,7 @@ CBC_QRDetectorResult* CBC_DataMatrixDetector::Detect(int32_t& e) {
correctedTopRight.get(), dimensionTop, dimensionRight, e));
BC_EXCEPTION_CHECK_ReturnValue(e, NULL);
} else {
- int32_t dimension = FX_MIN(dimensionRight, dimensionTop);
+ int32_t dimension = std::min(dimensionRight, dimensionTop);
correctedTopRight = CBC_AutoPtr<CBC_ResultPoint>(
CorrectTopRight(bottomLeft, bottomRight, topLeft, topRight, dimension));
if (correctedTopRight.get() == NULL) {
@@ -176,12 +178,12 @@ CBC_QRDetectorResult* CBC_DataMatrixDetector::Detect(int32_t& e) {
topRight = NULL;
}
int32_t dimensionCorrected =
- FX_MAX(CBC_AutoPtr<CBC_ResultPointsAndTransitions>(
- TransitionsBetween(topLeft, correctedTopRight.get()))
- ->GetTransitions(),
- CBC_AutoPtr<CBC_ResultPointsAndTransitions>(
- TransitionsBetween(bottomRight, correctedTopRight.get()))
- ->GetTransitions());
+ std::max(CBC_AutoPtr<CBC_ResultPointsAndTransitions>(
+ TransitionsBetween(topLeft, correctedTopRight.get()))
+ ->GetTransitions(),
+ CBC_AutoPtr<CBC_ResultPointsAndTransitions>(
+ TransitionsBetween(bottomRight, correctedTopRight.get()))
+ ->GetTransitions());
dimensionCorrected++;
if ((dimensionCorrected & 0x01) == 1) {
dimensionCorrected++;
diff --git a/xfa/src/fxbarcode/oned/BC_OneDReader.cpp b/xfa/src/fxbarcode/oned/BC_OneDReader.cpp
index 61448d21e7..b89f76423e 100644
--- a/xfa/src/fxbarcode/oned/BC_OneDReader.cpp
+++ b/xfa/src/fxbarcode/oned/BC_OneDReader.cpp
@@ -20,6 +20,8 @@
* limitations under the License.
*/
+#include <algorithm>
+
#include "xfa/src/fxbarcode/barcode.h"
#include "xfa/src/fxbarcode/BC_Reader.h"
#include "xfa/src/fxbarcode/BC_BinaryBitmap.h"
@@ -48,7 +50,7 @@ CFX_ByteString CBC_OneDReader::DeDecode(CBC_BinaryBitmap* image,
CBC_CommonBitArray* row = NULL;
int32_t middle = height >> 1;
FX_BOOL tryHarder = FALSE;
- int32_t rowStep = FX_MAX(1, height >> (tryHarder ? 8 : 5));
+ int32_t rowStep = std::max(1, height >> (tryHarder ? 8 : 5));
int32_t maxLines;
if (tryHarder) {
maxLines = height;
diff --git a/xfa/src/fxbarcode/oned/BC_OneDimWriter.cpp b/xfa/src/fxbarcode/oned/BC_OneDimWriter.cpp
index 8f4b226e8c..159f27f826 100644
--- a/xfa/src/fxbarcode/oned/BC_OneDimWriter.cpp
+++ b/xfa/src/fxbarcode/oned/BC_OneDimWriter.cpp
@@ -22,6 +22,7 @@
#include "BC_OneDimWriter.h"
+#include <algorithm>
#include <memory>
#include "xfa/src/fxbarcode/BC_Writer.h"
@@ -391,7 +392,8 @@ void CBC_OneDimWriter::RenderResult(const CFX_WideStringC& contents,
m_outputHScale = (FX_FLOAT)m_Width / (FX_FLOAT)codeLength;
}
if (!isDevice) {
- m_outputHScale = FX_MAX(m_outputHScale, m_ModuleWidth);
+ m_outputHScale =
+ std::max(m_outputHScale, static_cast<FX_FLOAT>(m_ModuleWidth));
}
FX_FLOAT dataLengthScale = 1.0;
if (m_iDataLenth > 0 && contents.GetLength() != 0) {
@@ -407,7 +409,7 @@ void CBC_OneDimWriter::RenderResult(const CFX_WideStringC& contents,
int32_t outputHeight = 1;
if (!isDevice) {
if (m_Height == 0) {
- outputHeight = FX_MAX(20, m_ModuleHeight);
+ outputHeight = std::max(20, m_ModuleHeight);
} else {
outputHeight = m_Height;
}
diff --git a/xfa/src/fxbarcode/oned/BC_OnedCodaBarReader.cpp b/xfa/src/fxbarcode/oned/BC_OnedCodaBarReader.cpp
index a2177fd699..c75ddd48ee 100644
--- a/xfa/src/fxbarcode/oned/BC_OnedCodaBarReader.cpp
+++ b/xfa/src/fxbarcode/oned/BC_OnedCodaBarReader.cpp
@@ -20,6 +20,8 @@
* limitations under the License.
*/
+#include <algorithm>
+
#include "xfa/src/fxbarcode/barcode.h"
#include "xfa/src/fxbarcode/BC_Reader.h"
#include "xfa/src/fxbarcode/common/BC_CommonBitArray.h"
@@ -140,7 +142,7 @@ CFX_Int32Array* CBC_OnedCodaBarReader::FindAsteriskPattern(
if (counterPosition == patternLength - 1) {
if (ArrayContains(STARTEND_ENCODING, ToNarrowWidePattern(&counters))) {
FX_BOOL btemp3 =
- row->IsRange(FX_MAX(0, patternStart - (i - patternStart) / 2),
+ row->IsRange(std::max(0, patternStart - (i - patternStart) / 2),
patternStart, FALSE, e);
BC_EXCEPTION_CHECK_ReturnValue(e, NULL);
if (btemp3) {
diff --git a/xfa/src/fxbarcode/oned/BC_OnedCode128Reader.cpp b/xfa/src/fxbarcode/oned/BC_OnedCode128Reader.cpp
index 601baa2a4c..cbc7a5a859 100644
--- a/xfa/src/fxbarcode/oned/BC_OnedCode128Reader.cpp
+++ b/xfa/src/fxbarcode/oned/BC_OnedCode128Reader.cpp
@@ -20,6 +20,8 @@
* limitations under the License.
*/
+#include <algorithm>
+
#include "xfa/src/fxbarcode/barcode.h"
#include "xfa/src/fxbarcode/BC_Reader.h"
#include "xfa/src/fxbarcode/common/BC_CommonBitArray.h"
@@ -115,7 +117,7 @@ CFX_Int32Array* CBC_OnedCode128Reader::FindStartPattern(CBC_CommonBitArray* row,
}
if (bestMatch >= 0) {
FX_BOOL btemp2 =
- row->IsRange(FX_MAX(0, patternStart - (i - patternStart) / 2),
+ row->IsRange(std::max(0, patternStart - (i - patternStart) / 2),
patternStart, FALSE, e);
BC_EXCEPTION_CHECK_ReturnValue(e, NULL);
if (btemp2) {
@@ -338,8 +340,8 @@ CFX_ByteString CBC_OnedCode128Reader::DecodeRow(int32_t rowNumber,
nextStart++;
}
FX_BOOL boolT1 = row->IsRange(
- nextStart, FX_MIN(width, nextStart + (nextStart - lastStart) / 2), FALSE,
- e);
+ nextStart, std::min(width, nextStart + (nextStart - lastStart) / 2),
+ FALSE, e);
BC_EXCEPTION_CHECK_ReturnValue(e, "");
if (!boolT1) {
e = BCExceptionNotFound;
diff --git a/xfa/src/fxbarcode/oned/BC_OnedCode39Reader.cpp b/xfa/src/fxbarcode/oned/BC_OnedCode39Reader.cpp
index a5b77ed13f..18d1e96494 100644
--- a/xfa/src/fxbarcode/oned/BC_OnedCode39Reader.cpp
+++ b/xfa/src/fxbarcode/oned/BC_OnedCode39Reader.cpp
@@ -20,6 +20,8 @@
* limitations under the License.
*/
+#include <algorithm>
+
#include "xfa/src/fxbarcode/barcode.h"
#include "xfa/src/fxbarcode/BC_Reader.h"
#include "xfa/src/fxbarcode/common/BC_CommonBitArray.h"
@@ -144,7 +146,7 @@ CFX_Int32Array* CBC_OnedCode39Reader::FindAsteriskPattern(
if (counterPosition == patternLength - 1) {
if (ToNarrowWidePattern(&counters) == ASTERISK_ENCODING) {
FX_BOOL bT1 =
- row->IsRange(FX_MAX(0, patternStart - (i - patternStart) / 2),
+ row->IsRange(std::max(0, patternStart - (i - patternStart) / 2),
patternStart, FALSE, e);
BC_EXCEPTION_CHECK_ReturnValue(e, NULL);
if (bT1) {
diff --git a/xfa/src/fxbarcode/qrcode/BC_QRCoderEncoder.cpp b/xfa/src/fxbarcode/qrcode/BC_QRCoderEncoder.cpp
index 2610db95dc..2e16c036ca 100644
--- a/xfa/src/fxbarcode/qrcode/BC_QRCoderEncoder.cpp
+++ b/xfa/src/fxbarcode/qrcode/BC_QRCoderEncoder.cpp
@@ -20,6 +20,8 @@
* limitations under the License.
*/
+#include <algorithm>
+
#include "xfa/src/fxbarcode/barcode.h"
#include "xfa/src/fxbarcode/BC_UtilCodingConvert.h"
#include "xfa/src/fxbarcode/common/BC_CommonByteArray.h"
@@ -876,8 +878,8 @@ void CBC_QRCoderEncoder::InterleaveWithECBytes(CBC_QRCoderBitVector* bits,
GenerateECBytes(dataBytes, numEcBytesInBlosk, e);
BC_EXCEPTION_CHECK_ReturnVoid(e);
blocks.Add(new CBC_QRCoderBlockPair(dataBytes, ecBytes));
- maxNumDataBytes = FX_MAX(maxNumDataBytes, dataBytes->Size());
- maxNumEcBytes = FX_MAX(maxNumEcBytes, ecBytes->Size());
+ maxNumDataBytes = std::max(maxNumDataBytes, dataBytes->Size());
+ maxNumEcBytes = std::max(maxNumEcBytes, ecBytes->Size());
dataBytesOffset += numDataBytesInBlock;
}
if (numDataBytes != dataBytesOffset) {
diff --git a/xfa/src/fxbarcode/qrcode/BC_QRDetector.cpp b/xfa/src/fxbarcode/qrcode/BC_QRDetector.cpp
index 1b799114b4..2280e9a4b8 100644
--- a/xfa/src/fxbarcode/qrcode/BC_QRDetector.cpp
+++ b/xfa/src/fxbarcode/qrcode/BC_QRDetector.cpp
@@ -20,6 +20,8 @@
* limitations under the License.
*/
+#include <algorithm>
+
#include "xfa/src/fxbarcode/barcode.h"
#include "xfa/src/fxbarcode/common/BC_CommonBitMatrix.h"
#include "xfa/src/fxbarcode/BC_ResultPoint.h"
@@ -255,16 +257,16 @@ CBC_QRAlignmentPattern* CBC_QRDetector::FindAlignmentInRegion(
FX_FLOAT allowanceFactor,
int32_t& e) {
int32_t allowance = (int32_t)(allowanceFactor * overallEstModuleSize);
- int32_t alignmentAreaLeftX = FX_MAX(0, estAlignmentX - allowance);
+ int32_t alignmentAreaLeftX = std::max(0, estAlignmentX - allowance);
int32_t alignmentAreaRightX =
- FX_MIN(m_image->GetWidth() - 1, estAlignmentX + allowance);
+ std::min(m_image->GetWidth() - 1, estAlignmentX + allowance);
if (alignmentAreaRightX - alignmentAreaLeftX < overallEstModuleSize * 3) {
e = BCExceptionRead;
BC_EXCEPTION_CHECK_ReturnValue(e, NULL);
}
- int32_t alignmentAreaTopY = FX_MAX(0, estAlignmentY - allowance);
+ int32_t alignmentAreaTopY = std::max(0, estAlignmentY - allowance);
int32_t alignmentAreaBottomY =
- FX_MIN(m_image->GetHeight() - 1, estAlignmentY + allowance);
+ std::min(m_image->GetHeight() - 1, estAlignmentY + allowance);
CBC_QRAlignmentPatternFinder alignmentFinder(
m_image, alignmentAreaLeftX, alignmentAreaTopY,
alignmentAreaRightX - alignmentAreaLeftX,
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;