summaryrefslogtreecommitdiff
path: root/xfa/src/fgas
diff options
context:
space:
mode:
Diffstat (limited to 'xfa/src/fgas')
-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
10 files changed, 68 insertions, 44 deletions
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();